COLLADA code is disabled by default (it has dependencies requiring manual install). SCons and CMake builds are supported on Windows and Linux, no Mac building yet. More on building COLLADA code: http://wiki.blender.org/index.php/User:Kazanbas/Building_Collada_Branch. The detailed command log of the merge (can be useful for educational purposes): branch=https://svn.blender.org/svnroot/bf-blender/branches/soc-2009-chingachgook # collada code svn copy $branch/source/blender/collada source/blender/collada # operator svn merge -c 20401,20955,21077,24077,24079 $branch/source/blender/windowmanager/intern/wm_operators.c source/blender/windowmanager/intern/wm_operators.c # menu svn merge -c 24079 $branch/release/scripts/ui/space_info.py release/scripts/ui/space_info.py # scons svn merge -c 20398 $branch/source/blender/SConscript source/blender/SConscript svn merge -c 20398,20691,20955,22726 $branch/tools/btools.py tools/btools.py svn merge -c 20691,20955,22726 $branch/tools/Blender.py tools/Blender.py svn merge -c 20398,20692,20955 $branch/config/linux2-config.py config/linux2-config.py svn merge -c 22726 $branch/config/win64-vc-config.py config/win64-vc-config.py svn merge -c 22726 $branch/config/win32-vc-config.py config/win32-vc-config.py svn merge -c 24077 $branch/source/blender/windowmanager/SConscript source/blender/windowmanager/SConscript # cmake svn merge -c 23319,23905,24077,24158 $branch/CMakeLists.txt CMakeLists.txt svn merge -c 23319 $branch/source/blender/CMakeLists.txt source/blender/CMakeLists.txt svn merge -c 23319 $branch/source/creator/CMakeLists.txt source/creator/CMakeLists.txt svn merge -c 23319 $branch/CMake/macros.cmake CMake/macros.cmake svn merge -c 24077 $branch/source/blender/windowmanager/CMakeLists.txt source/blender/windowmanager/CMakeLists.txt
70 lines
1.3 KiB
C++
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])
|
|
{
|
|
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
|