Blender  V2.93
collada_internal.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
21 #pragma once
22 
23 #include <map>
24 #include <string>
25 #include <vector>
26 
27 #include "COLLADAFWFileInfo.h"
28 #include "Math/COLLADABUMathMatrix4.h"
29 
30 #include "BLI_linklist.h"
31 #include "BLI_math.h"
32 #include "DNA_armature_types.h"
33 #include "DNA_material_types.h"
34 #include "DNA_object_types.h"
35 #include "DNA_scene_types.h"
36 
38  private:
39  COLLADAFW::FileInfo::Unit unit;
40  COLLADAFW::FileInfo::UpAxisType up_axis;
41 
42  float x_up_mat4[4][4];
43  float y_up_mat4[4][4];
44  float z_up_mat4[4][4];
45  float scale_mat4[4][4];
46 
47  public:
48  enum UnitSystem {
52  };
53 
54  /* Initialize with Z_UP, since Blender uses right-handed, z-up */
55  UnitConverter();
56 
57  void read_asset(const COLLADAFW::FileInfo *asset);
58 
59  void convertVector3(COLLADABU::Math::Vector3 &vec, float *v);
60 
62 
63  float getLinearMeter(void);
64 
65  /* TODO need also for angle conversion, time conversion... */
66 
67  static void dae_matrix_to_mat4_(float out[4][4], const COLLADABU::Math::Matrix4 &in);
68  static void mat4_to_dae(float out[4][4], float in[4][4]);
69  static void mat4_to_dae_double(double out[4][4], float in[4][4]);
70 
71  float (&get_rotation())[4][4];
72  float (&get_scale())[4][4];
73  void calculate_scale(Scene &sce);
74 };
75 
76 extern void clear_global_id_map();
78 extern std::string translate_id(const std::string &id);
79 extern std::string translate_id(const char *idString);
80 
81 extern std::string id_name(void *id);
82 extern std::string encode_xml(std::string xml);
83 
84 extern std::string get_geometry_id(Object *ob);
85 extern std::string get_geometry_id(Object *ob, bool use_instantiation);
86 
87 extern std::string get_light_id(Object *ob);
88 
89 extern std::string get_joint_sid(Bone *bone);
90 
91 extern std::string get_camera_id(Object *ob);
92 extern std::string get_morph_id(Object *ob);
93 
94 extern std::string get_effect_id(Material *mat);
95 extern std::string get_material_id(Material *mat);
typedef float(TangentPoint)[2]
Object is a sort of wrapper for general info.
ATTR_WARN_UNUSED_RESULT const BMVert * v
void read_asset(const COLLADAFW::FileInfo *asset)
float(& get_scale())[4]
static void mat4_to_dae(float out[4][4], float in[4][4])
void convertVector3(COLLADABU::Math::Vector3 &vec, float *v)
void calculate_scale(Scene &sce)
UnitConverter::UnitSystem isMetricSystem(void)
static void mat4_to_dae_double(double out[4][4], float in[4][4])
float(& get_rotation())[4]
float getLinearMeter(void)
static void dae_matrix_to_mat4_(float out[4][4], const COLLADABU::Math::Matrix4 &in)
std::string get_camera_id(Object *ob)
std::string get_morph_id(Object *ob)
std::string get_joint_sid(Bone *bone)
std::string get_geometry_id(Object *ob)
std::string translate_id(const std::string &id)
std::string get_material_id(Material *mat)
std::string encode_xml(std::string xml)
std::string get_light_id(Object *ob)
std::string get_effect_id(Material *mat)
void clear_global_id_map()
std::string id_name(void *id)
float[3] Vector3