Panda3D

Loading...
Searching...
No Matches
daeToEggConverter.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file daeToEggConverter.h
10 * @author rdb
11 * @date 2008-05-08
12 */
13
14#ifndef DAETOEGGCONVERTER_H
15#define DAETOEGGCONVERTER_H
16
17#include "pandatoolbase.h"
18#include "somethingToEggConverter.h"
19#include "eggGroup.h"
20#include "eggMaterial.h"
21#include "eggTexture.h"
22#include "eggTable.h"
23#include "eggNurbsCurve.h"
24
25#include "pre_fcollada_include.h"
26#include <FCollada.h>
27#include <FCDocument/FCDocument.h>
28#include <FCDocument/FCDTransform.h>
29#include <FCDocument/FCDEntityInstance.h>
30#include <FCDocument/FCDControllerInstance.h>
31#include <FCDocument/FCDGeometryMesh.h>
32#include <FCDocument/FCDGeometrySpline.h>
33#include <FCDocument/FCDMaterial.h>
34#include <FMath/FMMatrix44.h>
35
36#include "daeMaterials.h"
37#include "daeCharacter.h"
38#include "pvector.h" // Include last
39
40/**
41 * This class supervises the construction of an EggData structure from a DAE
42 * file.
43 */
44 class DAEToEggConverter : public SomethingToEggConverter {
45 public:
46 DAEToEggConverter();
47 DAEToEggConverter(const DAEToEggConverter &copy);
48 ~DAEToEggConverter();
49
50 virtual SomethingToEggConverter *make_copy();
51
52 virtual std::string get_name() const;
53 virtual std::string get_extension() const;
54
55 virtual bool convert_file(const Filename &filename);
56 virtual DistanceUnit get_input_units();
57
58 bool _invert_transparency;
59
60 private:
61 std::string _unit_name;
62 double _unit_meters;
63 PT(EggTable) _table;
64 FCDocument* _document;
65 FUErrorSimpleHandler* _error_handler;
66 DaeCharacter::JointMap _joints;
67
68 typedef pvector<PT(DaeCharacter)> Characters;
69 Characters _characters;
70
71 void process_asset();
72 void process_node(EggGroupNode *parent, const FCDSceneNode* node, bool forced = false);
73 void process_instance(EggGroup *parent, const FCDEntityInstance* instance);
74 void process_mesh(EggGroup *parent, const FCDGeometryMesh* mesh,
75 DaeMaterials *materials, DaeCharacter *character = nullptr);
76 void process_spline(EggGroup *parent, const std::string group_name, FCDGeometrySpline* geometry_spline);
77 void process_spline(EggGroup *parent, const FCDSpline* spline);
78 void process_controller(EggGroup *parent, const FCDControllerInstance* instance);
79 void process_extra(EggGroup *group, const FCDExtra* extra);
80
81 static LMatrix4d convert_matrix(const FMMatrix44& matrix);
82 void apply_transform(EggGroup *to, const FCDTransform* from);
83
84 friend class DaeCharacter;
85};
86
87#endif
DAEToEggConverter::make_copy
virtual SomethingToEggConverter * make_copy()
Allocates and returns a new copy of the converter.
Definition daeToEggConverter.cxx:90
DAEToEggConverter::get_name
virtual std::string get_name() const
Returns the English name of the file type this converter supports.
Definition daeToEggConverter.cxx:99
DAEToEggConverter::convert_file
virtual bool convert_file(const Filename &filename)
Handles the reading of the input file and converting it to egg.
Definition daeToEggConverter.cxx:116
DAEToEggConverter::get_input_units
virtual DistanceUnit get_input_units()
This may be called after convert_file() has been called and returned true, indicating a successful co...
Definition daeToEggConverter.cxx:312
DAEToEggConverter::get_extension
virtual std::string get_extension() const
Returns the common extension of the file type this converter supports.
Definition daeToEggConverter.cxx:107
DaeMaterials
This class is seperated from the converter file because otherwise it would get too big and needlessly...
Definition daeMaterials.h:38
EggGroupNode
A base class for nodes in the hierarchy that are not leaf nodes.
Definition eggGroupNode.h:46
EggGroup
The main glue of the egg hierarchy, this corresponds to the <Group>, <Instance>, and <Joint> type nod...
Definition eggGroup.h:34
EggTable
This corresponds to a a <Bundle> entry.
Definition eggTable.h:27
Filename
The name of a file, such as a texture file or an Egg file.
Definition filename.h:44
daeCharacter.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
daeMaterials.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
DistanceUnit
DistanceUnit
This enumerated type lists all the kinds of units we're likely to come across in model conversion pro...
Definition distanceUnit.h:23
eggGroup.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
eggMaterial.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
eggNurbsCurve.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
eggTable.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
eggTexture.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandatoolbase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pre_fcollada_include.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pvector.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
somethingToEggConverter.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.