Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

pandatool/src/xfile/xFileMaker.h

Go to the documentation of this file.
00001 // Filename: xFileMaker.h
00002 // Created by:  drose (19Jun01)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #ifndef XFILEMAKER_H
00020 #define XFILEMAKER_H
00021 
00022 #include "pandatoolbase.h"
00023 
00024 #include "filename.h"
00025 #include "pmap.h"
00026 #include "luse.h"
00027 
00028 #define WIN32_LEAN_AND_MEAN
00029 #include <windows.h>
00030 #include <d3d.h>
00031 #include <dxfile.h>
00032 #include <rmxfguid.h>
00033 #undef WIN32_LEAN_AND_MEAN
00034 
00035 class EggNode;
00036 class EggGroupNode;
00037 class EggGroup;
00038 class EggBin;
00039 class EggData;
00040 class EggVertexPool;
00041 class Datagram;
00042 class XFileMesh;
00043 
00044 ////////////////////////////////////////////////////////////////////
00045 //       Class : XFileMaker
00046 // Description : This class converts a Panda scene graph into a .X
00047 //               file and writes it out.
00048 ////////////////////////////////////////////////////////////////////
00049 class XFileMaker {
00050 public:
00051   XFileMaker();
00052   ~XFileMaker();
00053 
00054   bool open(const Filename &filename);
00055   void close();
00056 
00057   bool add_tree(EggData &egg_data);
00058 
00059 private:
00060   bool add_node(EggNode *egg_node, LPDIRECTXFILEDATA dx_parent);
00061   bool add_group(EggGroup *egg_group, LPDIRECTXFILEDATA dx_parent);
00062   bool add_bin(EggBin *egg_bin, LPDIRECTXFILEDATA dx_parent);
00063   bool add_polyset(EggBin *egg_bin, LPDIRECTXFILEDATA dx_parent);
00064 
00065   bool recurse_nodes(EggGroupNode *egg_node, LPDIRECTXFILEDATA dx_parent);
00066 
00067   bool create_object(LPDIRECTXFILEDATA &obj, REFGUID template_id,
00068                      const string &name, const Datagram &dg);
00069   bool create_frame(LPDIRECTXFILEDATA &obj, const string &name);
00070   bool add_frame_transform(LPDIRECTXFILEDATA obj, const LMatrix4f &mat);
00071 
00072   bool attach_and_release(LPDIRECTXFILEDATA obj, LPDIRECTXFILEDATA dx_parent);
00073 
00074   static string make_nice_name(const string &str);
00075 
00076   XFileMesh *get_mesh(LPDIRECTXFILEDATA dx_parent);
00077   bool finalize_mesh(LPDIRECTXFILEDATA dx_parent);
00078 
00079   LPDIRECTXFILE _dx_file;
00080   LPDIRECTXFILESAVEOBJECT _dx_file_save;
00081 
00082   int _mesh_index;
00083 
00084   typedef pmap<LPDIRECTXFILEDATA, XFileMesh *> Meshes;
00085   Meshes _meshes;
00086 };
00087 
00088 #endif
00089 

Generated on Fri May 2 03:21:52 2003 for Panda-Tool by doxygen1.3