00001 // Filename: lwoToEggConverter.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 LWOTOEGGCONVERTER_H 00020 #define LWOTOEGGCONVERTER_H 00021 00022 #include <pandatoolbase.h> 00023 00024 #include <somethingToEggConverter.h> 00025 #include <lwoHeader.h> 00026 #include <pointerTo.h> 00027 00028 #include "pvector.h" 00029 #include "pmap.h" 00030 00031 class CLwoLayer; 00032 class CLwoClip; 00033 class CLwoPoints; 00034 class CLwoPolygons; 00035 class CLwoSurface; 00036 class LwoClip; 00037 00038 //////////////////////////////////////////////////////////////////// 00039 // Class : LwoToEggConverter 00040 // Description : This class supervises the construction of an EggData 00041 // structure from the data represented by the LwoHeader. 00042 // Reading and writing the egg and lwo structures is 00043 // left to the user. 00044 //////////////////////////////////////////////////////////////////// 00045 class LwoToEggConverter : public SomethingToEggConverter { 00046 public: 00047 LwoToEggConverter(); 00048 LwoToEggConverter(const LwoToEggConverter ©); 00049 virtual ~LwoToEggConverter(); 00050 00051 virtual SomethingToEggConverter *make_copy(); 00052 00053 virtual string get_name() const; 00054 virtual string get_extension() const; 00055 00056 virtual bool convert_file(const Filename &filename); 00057 bool convert_lwo(const LwoHeader *lwo_header); 00058 00059 CLwoLayer *get_layer(int number) const; 00060 CLwoClip *get_clip(int number) const; 00061 00062 CLwoSurface *get_surface(const string &name) const; 00063 00064 bool _make_materials; 00065 00066 private: 00067 void cleanup(); 00068 00069 void collect_lwo(); 00070 void make_egg(); 00071 void connect_egg(); 00072 00073 void slot_layer(int number); 00074 void slot_clip(int number); 00075 CLwoLayer *make_generic_layer(); 00076 00077 CPT(LwoHeader) _lwo_header; 00078 00079 CLwoLayer *_generic_layer; 00080 typedef pvector<CLwoLayer *> Layers; 00081 Layers _layers; 00082 00083 typedef pvector<CLwoClip *> Clips; 00084 Clips _clips; 00085 00086 typedef pvector<CLwoPoints *> Points; 00087 Points _points; 00088 00089 typedef pvector<CLwoPolygons *> Polygons; 00090 Polygons _polygons; 00091 00092 typedef pmap<string, CLwoSurface *> Surfaces; 00093 Surfaces _surfaces; 00094 }; 00095 00096 #include "lwoToEggConverter.I" 00097 00098 #endif 00099 00100