00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
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
00046
00047
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