Blender V2.61 - r43446

collada_internal.h

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