Panda3D
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"
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  */
45 public:
49 
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
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual std::string get_name() const
Returns the English name of the file type this converter supports.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual SomethingToEggConverter * make_copy()
Allocates and returns a new copy of the converter.
A base class for nodes in the hierarchy that are not leaf nodes.
Definition: eggGroupNode.h:46
virtual bool convert_file(const Filename &filename)
Handles the reading of the input file and converting it to egg.
Class representing an animated character.
Definition: daeCharacter.h:35
This class is seperated from the converter file because otherwise it would get too big and needlessly...
Definition: daeMaterials.h:38
DistanceUnit
This enumerated type lists all the kinds of units we're likely to come across in model conversion pro...
Definition: distanceUnit.h:23
This is our own Panda specialization on the default STL vector.
Definition: pvector.h:42
This class supervises the construction of an EggData structure from a DAE file.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
The main glue of the egg hierarchy, this corresponds to the <Group>, <Instance>, and <Joint> type nod...
Definition: eggGroup.h:34
The name of a file, such as a texture file or an Egg file.
Definition: filename.h:39
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual DistanceUnit get_input_units()
This may be called after convert_file() has been called and returned true, indicating a successful co...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This corresponds to a.
Definition: eggTable.h:27
virtual std::string get_extension() const
Returns the common extension of the file type this converter supports.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is a base class for a family of converter classes that manage a conversion from some file type t...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.