Blender  V3.3
collada_internal.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
7 #pragma once
8 
9 #include <map>
10 #include <string>
11 #include <vector>
12 
13 #include "COLLADAFWFileInfo.h"
14 #include "Math/COLLADABUMathMatrix4.h"
15 
16 #include "BLI_linklist.h"
17 #include "BLI_math.h"
18 #include "DNA_armature_types.h"
19 #include "DNA_material_types.h"
20 #include "DNA_object_types.h"
21 #include "DNA_scene_types.h"
22 
24  private:
25  COLLADAFW::FileInfo::Unit unit;
26  COLLADAFW::FileInfo::UpAxisType up_axis;
27 
28  float x_up_mat4[4][4];
29  float y_up_mat4[4][4];
30  float z_up_mat4[4][4];
31  float scale_mat4[4][4];
32 
33  public:
34  enum UnitSystem {
38  };
39 
40  /* Initialize with Z_UP, since Blender uses right-handed, z-up */
41  UnitConverter();
42 
43  void read_asset(const COLLADAFW::FileInfo *asset);
44 
45  void convertVector3(COLLADABU::Math::Vector3 &vec, float *v);
46 
48 
49  float getLinearMeter(void);
50 
51  /* TODO: need also for angle conversion, time conversion... */
52 
53  static void dae_matrix_to_mat4_(float out[4][4], const COLLADABU::Math::Matrix4 &in);
54  static void mat4_to_dae(float out[4][4], float in[4][4]);
55  static void mat4_to_dae_double(double out[4][4], float in[4][4]);
56 
57  float (&get_rotation())[4][4];
58  float (&get_scale())[4][4];
59  void calculate_scale(Scene &sce);
60 };
61 
62 extern void clear_global_id_map();
64 extern std::string translate_id(const std::string &id);
66 extern std::string translate_id(const char *idString);
67 
68 extern std::string id_name(void *id);
69 extern std::string encode_xml(std::string xml);
70 
71 extern std::string get_geometry_id(Object *ob);
72 extern std::string get_geometry_id(Object *ob, bool use_instantiation);
73 
74 extern std::string get_light_id(Object *ob);
75 
76 extern std::string get_joint_sid(Bone *bone);
77 
78 extern std::string get_camera_id(Object *ob);
79 extern std::string get_morph_id(Object *ob);
80 
81 extern std::string get_effect_id(Material *mat);
82 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
static const pxr::TfToken out("out", pxr::TfToken::Immortal)