Panda3D
|
00001 // Filename: ObjToEggConverter.h 00002 // Created by: drose (07Dec10) 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 ObjTOEGGCONVERTER_H 00016 #define ObjTOEGGCONVERTER_H 00017 00018 #include "pandatoolbase.h" 00019 00020 #include "somethingToEggConverter.h" 00021 #include "eggVertexPool.h" 00022 #include "eggGroup.h" 00023 00024 //////////////////////////////////////////////////////////////////// 00025 // Class : ObjToEggConverter 00026 // Description : Convert an Obj file to egg data. 00027 //////////////////////////////////////////////////////////////////// 00028 class ObjToEggConverter : public SomethingToEggConverter { 00029 public: 00030 ObjToEggConverter(); 00031 ObjToEggConverter(const ObjToEggConverter ©); 00032 ~ObjToEggConverter(); 00033 00034 virtual SomethingToEggConverter *make_copy(); 00035 00036 virtual string get_name() const; 00037 virtual string get_extension() const; 00038 virtual bool supports_compressed() const; 00039 00040 virtual bool convert_file(const Filename &filename); 00041 00042 protected: 00043 bool process(const Filename &filename); 00044 bool process_line(const string &line); 00045 00046 bool process_v(vector_string &words); 00047 bool process_vt(vector_string &words); 00048 bool process_vn(vector_string &words); 00049 bool process_f(vector_string &words); 00050 bool process_g(vector_string &words); 00051 00052 EggVertex *get_vertex(int n); 00053 EggVertex *get_face_vertex(const string &face_reference); 00054 00055 int _line_number; 00056 int _vi, _vti, _vni; 00057 PT(EggVertexPool) _vpool; 00058 PT(EggGroup) _root_group; 00059 EggGroup *_current_group; 00060 00061 pset<string> _ignored_tags; 00062 }; 00063 00064 #endif