Panda3D
colladaLoader.h
1 // Filename: colladaLoader.h
2 // Created by: Xidram (21Dec10)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef COLLADALOADER_H
16 #define COLLADALOADER_H
17 
18 #include "pandabase.h"
19 #include "config_collada.h"
20 #include "typedReferenceCount.h"
21 #include "pandaNode.h"
22 #include "modelRoot.h"
23 #include "pvector.h"
24 #include "pta_LVecBase4.h"
25 
27 class BamCacheRecord;
28 class GeomNode;
29 class LightNode;
30 
31 class domBind_material;
32 class domCOLLADA;
33 class domNode;
34 class domVisual_scene;
35 class domExtra;
36 class domGeometry;
37 class domInstance_geometry;
38 class domLight;
39 class domCamera;
40 class domSource;
41 class DAE;
42 
43 ////////////////////////////////////////////////////////////////////
44 // Class : ColladaLoader
45 // Description : Object that interfaces with the COLLADA DOM library
46 // and loads the COLLADA structures into Panda nodes.
47 ////////////////////////////////////////////////////////////////////
49 public:
50  ColladaLoader();
51  virtual ~ColladaLoader();
52 
53  bool _error;
54  PT(ModelRoot) _root;
55  BamCacheRecord *_record;
56  CoordinateSystem _cs;
57  Filename _filename;
58 
59  bool read(const Filename &filename);
60  void build_graph();
61 
62 private:
63  const domCOLLADA* _collada;
64  DAE* _dae;
65  pvector<LightNode*> _lights;
66 
67  void load_visual_scene(domVisual_scene &scene, PandaNode *parent);
68  void load_node(domNode &node, PandaNode *parent);
69  void load_tags(domExtra &extra, PandaNode *node);
70  void load_camera(domCamera &cam, PandaNode *parent);
71  void load_instance_geometry(domInstance_geometry &inst, PandaNode *parent);
72  void load_geometry(domGeometry &geom, GeomNode *parent, ColladaBindMaterial &bind_mat);
73  void load_light(domLight &light, PandaNode *parent);
74 };
75 
76 #include "colladaLoader.I"
77 
78 #endif
A node of this type is created automatically at the root of each model file that is loaded...
Definition: modelRoot.h:31
Object that interfaces with the COLLADA DOM library and loads the COLLADA structures into Panda nodes...
Definition: colladaLoader.h:48
A basic node of the scene graph or data graph.
Definition: pandaNode.h:72
A derivative of Light and of PandaNode.
Definition: lightNode.h:29
void build_graph()
Converts scene graph structures into a Panda3D scene graph, with _root being the root node...
This is our own Panda specialization on the default STL vector.
Definition: pvector.h:39
The name of a file, such as a texture file or an Egg file.
Definition: filename.h:44
An instance of this class is written to the front of a Bam or Txo file to make the file a cached inst...
Class that deals with binding materials to COLLADA geometry.
A node that holds Geom objects, renderable pieces of geometry.
Definition: geomNode.h:37
bool read(const Filename &filename)
Reads from the indicated file.