Panda3D

xFileMaker.h

00001 // Filename: xFileMaker.h
00002 // Created by:  drose (19Jun01)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef XFILEMAKER_H
00016 #define XFILEMAKER_H
00017 
00018 #include "pandatoolbase.h"
00019 
00020 #include "filename.h"
00021 #include "pmap.h"
00022 #include "luse.h"
00023 #include "xFile.h"
00024 
00025 class EggNode;
00026 class EggGroupNode;
00027 class EggGroup;
00028 class EggBin;
00029 class EggData;
00030 class EggVertexPool;
00031 class Datagram;
00032 class XFileMesh;
00033 
00034 ////////////////////////////////////////////////////////////////////
00035 //       Class : XFileMaker
00036 // Description : This class converts a Panda scene graph into a .X
00037 //               file and writes it out.
00038 ////////////////////////////////////////////////////////////////////
00039 class XFileMaker {
00040 public:
00041   XFileMaker();
00042   ~XFileMaker();
00043 
00044   bool write(const Filename &filename);
00045 
00046   bool add_tree(EggData *egg_data);
00047 
00048 private:
00049   bool add_node(EggNode *egg_node, XFileNode *x_parent);
00050   bool add_group(EggGroup *egg_group, XFileNode *x_parent);
00051   bool add_bin(EggBin *egg_bin, XFileNode *x_parent);
00052   bool add_polyset(EggBin *egg_bin, XFileNode *x_parent);
00053 
00054   bool recurse_nodes(EggGroupNode *egg_node, XFileNode *x_parent);
00055 
00056   XFileMesh *get_mesh(XFileNode *x_parent);
00057   bool finalize_mesh(XFileNode *x_parent, XFileMesh *mesh);
00058 
00059   PT(XFile) _x_file;
00060 
00061   int _mesh_index;
00062 
00063   typedef pmap<XFileNode *, XFileMesh *> Meshes;
00064   Meshes _meshes;
00065 };
00066 
00067 #endif
00068 
 All Classes Functions Variables Enumerations