Panda3D
xFileMaker.h
1 // Filename: xFileMaker.h
2 // Created by: drose (19Jun01)
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 XFILEMAKER_H
16 #define XFILEMAKER_H
17 
18 #include "pandatoolbase.h"
19 
20 #include "filename.h"
21 #include "pmap.h"
22 #include "luse.h"
23 #include "xFile.h"
24 
25 class EggNode;
26 class EggGroupNode;
27 class EggGroup;
28 class EggBin;
29 class EggData;
30 class EggVertexPool;
31 class Datagram;
32 class XFileMesh;
33 
34 ////////////////////////////////////////////////////////////////////
35 // Class : XFileMaker
36 // Description : This class converts a Panda scene graph into a .X
37 // file and writes it out.
38 ////////////////////////////////////////////////////////////////////
39 class XFileMaker {
40 public:
41  XFileMaker();
42  ~XFileMaker();
43 
44  bool write(const Filename &filename);
45 
46  bool add_tree(EggData *egg_data);
47 
48 private:
49  bool add_node(EggNode *egg_node, XFileNode *x_parent);
50  bool add_group(EggGroup *egg_group, XFileNode *x_parent);
51  bool add_bin(EggBin *egg_bin, XFileNode *x_parent);
52  bool add_polyset(EggBin *egg_bin, XFileNode *x_parent);
53 
54  bool recurse_nodes(EggGroupNode *egg_node, XFileNode *x_parent);
55 
56  XFileMesh *get_mesh(XFileNode *x_parent);
57  bool finalize_mesh(XFileNode *x_parent, XFileMesh *mesh);
58 
59  PT(XFile) _x_file;
60 
61  int _mesh_index;
62 
64  Meshes _meshes;
65 };
66 
67 #endif
68 
This is a collection of polygons; i.e.
Definition: xFileMesh.h:45
A base class for nodes in the hierarchy that are not leaf nodes.
Definition: eggGroupNode.h:51
This is the primary interface into all the egg data, and the root of the egg file structure...
Definition: eggData.h:41
This class converts a Panda scene graph into a .X file and writes it out.
Definition: xFileMaker.h:39
bool add_tree(EggData *egg_data)
Adds the egg tree rooted at the indicated node to the X structure.
Definition: xFileMaker.cxx:74
The main glue of the egg hierarchy, this corresponds to the <Group>, <Instance>, and <Joint> type nod...
Definition: eggGroup.h:36
A single node of an X file.
Definition: xFileNode.h:42
The name of a file, such as a texture file or an Egg file.
Definition: filename.h:44
A base class for things that may be directly added into the egg hierarchy.
Definition: eggNode.h:38
This represents the complete contents of an X file (file.x) in memory.
Definition: xFile.h:35
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:43
A collection of vertices.
Definition: eggVertexPool.h:46
bool write(const Filename &filename)
Writes the .x file data to the indicated filename; returns true on success, false otherwise...
Definition: xFileMaker.cxx:61
A type of group node that holds related subnodes.
Definition: eggBin.h:30