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