Panda3D
|
00001 // Filename: daeToEggConverter.h 00002 // Created by: pro-rsoft (08May08) 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 DAETOEGGCONVERTER_H 00016 #define DAETOEGGCONVERTER_H 00017 00018 #include "pandatoolbase.h" 00019 #include "somethingToEggConverter.h" 00020 #include "eggGroup.h" 00021 #include "eggMaterial.h" 00022 #include "eggTexture.h" 00023 #include "eggTable.h" 00024 #include "eggNurbsCurve.h" 00025 00026 #include "pre_fcollada_include.h" 00027 #include "FCollada.h" 00028 #include "FCDocument/FCDocument.h" 00029 #include "FCDocument/FCDTransform.h" 00030 #include "FCDocument/FCDEntityInstance.h" 00031 #include "FCDocument/FCDControllerInstance.h" 00032 #include "FCDocument/FCDGeometryMesh.h" 00033 #include "FCDocument/FCDGeometrySpline.h" 00034 #include "FCDocument/FCDMaterial.h" 00035 #include "FMath/FMMatrix44.h" 00036 00037 #include "daeMaterials.h" 00038 #include "pvector.h" // Include last 00039 00040 //////////////////////////////////////////////////////////////////// 00041 // Class : DAEToEggConverter 00042 // Description : This class supervises the construction of an 00043 // EggData structure from a DAE file. 00044 //////////////////////////////////////////////////////////////////// 00045 class DAEToEggConverter : public SomethingToEggConverter { 00046 public: 00047 DAEToEggConverter(); 00048 DAEToEggConverter(const DAEToEggConverter ©); 00049 ~DAEToEggConverter(); 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 00058 private: 00059 00060 PT(EggTable) _table; 00061 FCDocument* _document; 00062 FUErrorSimpleHandler* _error_handler; 00063 pmap<const string, PT(EggGroup)> _joints; 00064 pmap<const string, PT(EggVertexPool)> _vertex_pools; 00065 pvector<string> _skeletons; 00066 int _frame_rate; 00067 00068 void process_asset(); 00069 void preprocess(const FCDSceneNode* node = NULL); 00070 void process_node(PT(EggGroupNode) parent, const FCDSceneNode* node, bool forced = false); 00071 void process_instance(PT(EggGroup) parent, const FCDEntityInstance* instance); 00072 void process_mesh(PT(EggGroup) parent, const FCDGeometryMesh* mesh, PT(DaeMaterials) materials); 00073 void process_spline(PT(EggGroup) parent, const string group_name, FCDGeometrySpline* geometry_spline); 00074 void process_spline(PT(EggGroup) parent, const FCDSpline* spline); 00075 void process_controller(PT(EggGroup) parent, const FCDControllerInstance* instance); 00076 //void process_table_joint(PT(EggTable) parent, FCDSceneNode* node); 00077 void process_extra(PT(EggGroup) group, const FCDExtra* extra); 00078 00079 static LMatrix4d convert_matrix(const FMMatrix44& matrix); 00080 void apply_transform(const PT(EggGroup) to, const FCDTransform* from); 00081 00082 friend class DaeCharacter; 00083 }; 00084 00085 #endif