|
Blender
V2.59
|
00001 /* 00002 * $Id: collada_internal.h 35596 2011-03-17 16:40:53Z jesterking $ 00003 * 00004 * ***** BEGIN GPL LICENSE BLOCK ***** 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software Foundation, 00018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 * 00020 * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov. 00021 * 00022 * ***** END GPL LICENSE BLOCK ***** 00023 */ 00024 00029 #ifndef COLLADA_INTERNAL_H 00030 #define COLLADA_INTERNAL_H 00031 00032 #include <string> 00033 #include <vector> 00034 #include <map> 00035 00036 #include "COLLADAFWFileInfo.h" 00037 #include "Math/COLLADABUMathMatrix4.h" 00038 00039 #include "DNA_armature_types.h" 00040 #include "DNA_material_types.h" 00041 #include "DNA_object_types.h" 00042 #include "DNA_scene_types.h" 00043 #include "BLI_math.h" 00044 00045 class UnitConverter 00046 { 00047 private: 00048 COLLADAFW::FileInfo::Unit unit; 00049 COLLADAFW::FileInfo::UpAxisType up_axis; 00050 00051 public: 00052 00053 enum UnitSystem { 00054 None, 00055 Metric, 00056 Imperial 00057 }; 00058 00059 // Initialize with Z_UP, since Blender uses right-handed, z-up 00060 UnitConverter(); 00061 00062 void read_asset(const COLLADAFW::FileInfo* asset); 00063 00064 void convertVector3(COLLADABU::Math::Vector3 &vec, float *v); 00065 00066 UnitConverter::UnitSystem isMetricSystem(void); 00067 00068 float getLinearMeter(void); 00069 00070 // TODO need also for angle conversion, time conversion... 00071 00072 void dae_matrix_to_mat4_(float out[][4], const COLLADABU::Math::Matrix4& in); 00073 00074 void mat4_to_dae(float out[][4], float in[][4]); 00075 00076 void mat4_to_dae_double(double out[][4], float in[][4]); 00077 }; 00078 00079 class TransformBase 00080 { 00081 public: 00082 void decompose(float mat[][4], float *loc, float eul[3], float quat[4], float *size); 00083 }; 00084 00085 extern void clear_global_id_map(); 00087 extern std::string translate_id(const std::string &id); 00088 00089 extern std::string id_name(void *id); 00090 00091 extern std::string get_geometry_id(Object *ob); 00092 00093 extern std::string get_light_id(Object *ob); 00094 00095 extern std::string get_joint_id(Bone *bone, Object *ob_arm); 00096 00097 extern std::string get_camera_id(Object *ob); 00098 00099 extern std::string get_material_id(Material *mat); 00100 00101 extern bool has_object_type(Scene* sce, short obtype); 00102 00103 #endif /* COLLADA_INTERNAL_H */