00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef FLTTOEGGCONVERTER_H
00020 #define FLTTOEGGCONVERTER_H
00021
00022 #include "pandatoolbase.h"
00023
00024 #include "fltToEggLevelState.h"
00025 #include "somethingToEggConverter.h"
00026 #include "fltHeader.h"
00027 #include "eggVertex.h"
00028 #include "eggVertexPool.h"
00029 #include "eggTexture.h"
00030 #include "pt_EggTexture.h"
00031 #include "pt_EggVertex.h"
00032 #include "pointerTo.h"
00033
00034 class FltRecord;
00035 class FltLOD;
00036 class FltGroup;
00037 class FltObject;
00038 class FltBeadID;
00039 class FltBead;
00040 class FltVertex;
00041 class FltGeometry;
00042 class FltFace;
00043 class FltExternalReference;
00044 class FltTexture;
00045 class EggGroupNode;
00046 class EggPrimitive;
00047
00048
00049
00050
00051
00052
00053
00054
00055 class FltToEggConverter : public SomethingToEggConverter {
00056 public:
00057 FltToEggConverter();
00058 FltToEggConverter(const FltToEggConverter ©);
00059 ~FltToEggConverter();
00060
00061 virtual SomethingToEggConverter *make_copy();
00062
00063 virtual string get_name() const;
00064 virtual string get_extension() const;
00065
00066 virtual bool convert_file(const Filename &filename);
00067 bool convert_flt(const FltHeader *flt_header);
00068
00069
00070
00071
00072 bool _compose_transforms;
00073
00074 private:
00075 void cleanup();
00076
00077 typedef pvector< PT_EggVertex > EggVertices;
00078
00079 void convert_record(const FltRecord *flt_record, FltToEggLevelState &state);
00080 void dispatch_record(const FltRecord *flt_record, FltToEggLevelState &state);
00081 void convert_lod(const FltLOD *flt_lod, FltToEggLevelState &state);
00082 void convert_group(const FltGroup *flt_group, FltToEggLevelState &state);
00083 void convert_object(const FltObject *flt_object, FltToEggLevelState &state);
00084 void convert_bead_id(const FltBeadID *flt_bead, FltToEggLevelState &state);
00085 void convert_bead(const FltBead *flt_bead, FltToEggLevelState &state);
00086 void convert_face(const FltFace *flt_face, FltToEggLevelState &state);
00087 void convert_ext_ref(const FltExternalReference *flt_ext, FltToEggLevelState &state);
00088
00089 void setup_geometry(const FltGeometry *flt_geom, FltToEggLevelState &state,
00090 EggPrimitive *egg_prim, EggVertexPool *egg_vpool,
00091 const EggVertices &vertices);
00092
00093 void convert_subfaces(const FltRecord *flt_record, FltToEggLevelState &state);
00094
00095 bool parse_comment(const FltBeadID *flt_bead, EggNode *egg_node);
00096 bool parse_comment(const FltBead *flt_bead, EggNode *egg_node);
00097 bool parse_comment(const FltTexture *flt_texture, EggNode *egg_node);
00098 bool parse_comment(const string &comment, const string &name,
00099 EggNode *egg_node);
00100
00101 PT_EggVertex make_egg_vertex(const FltVertex *flt_vertex);
00102 PT_EggTexture make_egg_texture(const FltTexture *flt_texture);
00103
00104 CPT(FltHeader) _flt_header;
00105
00106 PT(EggVertexPool) _main_egg_vpool;
00107
00108 typedef pmap<const FltTexture *, PT(EggTexture) > Textures;
00109 Textures _textures;
00110 };
00111
00112 #include "fltToEggConverter.I"
00113
00114 #endif
00115
00116