Files
test/source/blender/collada/collada_internal.h
Brecht Van Lommel 37e4a311b0 Math Lib
* Convert all code to use new functions.
* Branch maintainers may want to skip this commit, and run this
  conversion script instead, if they use a lot of math functions
  in new code:
  http://www.pasteall.org/9052/python
2009-11-10 20:43:45 +00:00

70 lines
1.3 KiB
C++

#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])
{
copy_m4_m4(out, in);
transpose_m4(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)
{
mat4_to_size( size,mat);
mat4_to_eul( rot,mat);
copy_v3_v3(loc, mat[3]);
}
};
#endif