diff options
Diffstat (limited to 'source/blender/collada/collada_internal.h')
-rw-r--r-- | source/blender/collada/collada_internal.h | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/source/blender/collada/collada_internal.h b/source/blender/collada/collada_internal.h new file mode 100644 index 00000000000..c0d74505f72 --- /dev/null +++ b/source/blender/collada/collada_internal.h @@ -0,0 +1,69 @@ +#ifndef BLENDER_COLLADA_H +#define BLENDER_COLLADA_H + +#include "COLLADAFWFileInfo.h" +#include "Math/COLLADABUMathMatrix4.h" + +class UnitConverter +{ +private: + COLLADAFW::FileInfo::Unit unit; + COLLADAFW::FileInfo::UpAxisType up_axis; + +public: + + UnitConverter() : unit(), up_axis(COLLADAFW::FileInfo::Z_UP) {} + + void read_asset(const COLLADAFW::FileInfo* asset) + { + } + + // TODO + // convert vector vec from COLLADA format to Blender + void convertVec3(float *vec) + { + } + + // TODO need also for angle conversion, time conversion... + + void mat4_from_dae(float out[][4], const COLLADABU::Math::Matrix4& in) + { + // in DAE, matrices use columns vectors, (see comments in COLLADABUMathMatrix4.h) + // so here, to make a blender matrix, we swap columns and rows + for (int i = 0; i < 4; i++) { + for (int j = 0; j < 4; j++) { + out[i][j] = in[j][i]; + } + } + } + + void mat4_to_dae(float out[][4], float in[][4]) + { + Mat4CpyMat4(out, in); + Mat4Transp(out); + } + + void mat4_to_dae_double(double out[][4], float in[][4]) + { + float mat[4][4]; + + mat4_to_dae(mat, in); + + for (int i = 0; i < 4; i++) + for (int j = 0; j < 4; j++) + out[i][j] = mat[i][j]; + } +}; + +class TransformBase +{ +public: + void decompose(float mat[][4], float *loc, float *rot, float *size) + { + Mat4ToSize(mat, size); + Mat4ToEul(mat, rot); + VecCopyf(loc, mat[3]); + } +}; + +#endif |