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