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

pandatool/src/fltegg/fltToEggConverter.h

Go to the documentation of this file.
00001 // Filename: fltToEggConverter.h
00002 // Created by:  drose (17Apr01)
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 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 //       Class : FltToEggConverter
00050 // Description : This class supervises the construction of an EggData
00051 //               structure from the data represented by the FltHeader.
00052 //               Reading and writing the egg and flt structures is
00053 //               left to the user.
00054 ////////////////////////////////////////////////////////////////////
00055 class FltToEggConverter : public SomethingToEggConverter {
00056 public:
00057   FltToEggConverter();
00058   FltToEggConverter(const FltToEggConverter &copy);
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   // Set this true to store transforms in egg files as the fully
00070   // composed matrix, or false (the default) to keep them decomposed
00071   // into elemental operations.
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 

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