Panda3D

lwoToEggConverter.h

00001 // Filename: lwoToEggConverter.h
00002 // Created by:  drose (17Apr01)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef LWOTOEGGCONVERTER_H
00016 #define LWOTOEGGCONVERTER_H
00017 
00018 #include "pandatoolbase.h"
00019 
00020 #include "somethingToEggConverter.h"
00021 #include "lwoHeader.h"
00022 #include "pointerTo.h"
00023 
00024 #include "pvector.h"
00025 #include "pmap.h"
00026 
00027 class CLwoLayer;
00028 class CLwoClip;
00029 class CLwoPoints;
00030 class CLwoPolygons;
00031 class CLwoSurface;
00032 class LwoClip;
00033 
00034 ////////////////////////////////////////////////////////////////////
00035 //       Class : LwoToEggConverter
00036 // Description : This class supervises the construction of an EggData
00037 //               structure from the data represented by the LwoHeader.
00038 //               Reading and writing the egg and lwo structures is
00039 //               left to the user.
00040 ////////////////////////////////////////////////////////////////////
00041 class LwoToEggConverter : public SomethingToEggConverter {
00042 public:
00043   LwoToEggConverter();
00044   LwoToEggConverter(const LwoToEggConverter &copy);
00045   virtual ~LwoToEggConverter();
00046 
00047   virtual SomethingToEggConverter *make_copy();
00048 
00049   virtual string get_name() const;
00050   virtual string get_extension() const;
00051 
00052   virtual bool convert_file(const Filename &filename);
00053   bool convert_lwo(const LwoHeader *lwo_header);
00054   virtual bool supports_compressed() const;
00055 
00056   CLwoLayer *get_layer(int number) const;
00057   CLwoClip *get_clip(int number) const;
00058 
00059   CLwoSurface *get_surface(const string &name) const;
00060 
00061   bool _make_materials;
00062 
00063 private:
00064   void cleanup();
00065 
00066   void collect_lwo();
00067   void make_egg();
00068   void connect_egg();
00069 
00070   void slot_layer(int number);
00071   void slot_clip(int number);
00072   CLwoLayer *make_generic_layer();
00073 
00074   CPT(LwoHeader) _lwo_header;
00075 
00076   CLwoLayer *_generic_layer;
00077   typedef pvector<CLwoLayer *> Layers;
00078   Layers _layers;
00079 
00080   typedef pvector<CLwoClip *> Clips;
00081   Clips _clips;
00082 
00083   typedef pvector<CLwoPoints *> Points;
00084   Points _points;
00085 
00086   typedef pvector<CLwoPolygons *> Polygons;
00087   Polygons _polygons;
00088 
00089   typedef pmap<string, CLwoSurface *> Surfaces;
00090   Surfaces _surfaces;
00091 };
00092 
00093 #include "lwoToEggConverter.I"
00094 
00095 #endif
00096 
00097 
 All Classes Functions Variables Enumerations