Use transposed matrix everywhere
This commit is contained in:
parent
3031fabcf9
commit
a00b878919
@ -21,7 +21,7 @@ namespace scene
|
|||||||
CSkinnedMesh::CSkinnedMesh()
|
CSkinnedMesh::CSkinnedMesh()
|
||||||
: SkinningBuffers(0), AnimationFrames(0.f), FramesPerSecond(25.f),
|
: SkinningBuffers(0), AnimationFrames(0.f), FramesPerSecond(25.f),
|
||||||
LastAnimatedFrame(-1), SkinnedLastFrame(false),
|
LastAnimatedFrame(-1), SkinnedLastFrame(false),
|
||||||
InterpolationMode(EIM_LINEAR), TransposedMatrix(false),
|
InterpolationMode(EIM_LINEAR),
|
||||||
HasAnimation(false), PreparedForSkinning(false),
|
HasAnimation(false), PreparedForSkinning(false),
|
||||||
AnimateNormals(true), HardwareSkinning(false), m_total_joints(0),
|
AnimateNormals(true), HardwareSkinning(false), m_total_joints(0),
|
||||||
m_current_joint(0)
|
m_current_joint(0)
|
||||||
@ -92,13 +92,6 @@ IMesh* CSkinnedMesh::getMesh(s32 frame, s32 detailLevel, s32 startFrameLoop, s32
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! For loader usage.
|
|
||||||
void CSkinnedMesh::setTransposedMatrix(bool val)
|
|
||||||
{
|
|
||||||
TransposedMatrix = val;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
// Keyframe Animation
|
// Keyframe Animation
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
@ -190,14 +183,7 @@ void CSkinnedMesh::buildAllLocalAnimatedMatrices()
|
|||||||
|
|
||||||
// IRR_TEST_BROKEN_QUATERNION_USE: TODO - switched to getMatrix_transposed instead of getMatrix for downward compatibility.
|
// IRR_TEST_BROKEN_QUATERNION_USE: TODO - switched to getMatrix_transposed instead of getMatrix for downward compatibility.
|
||||||
// Not tested so far if this was correct or wrong before quaternion fix!
|
// Not tested so far if this was correct or wrong before quaternion fix!
|
||||||
if (TransposedMatrix)
|
joint->Animatedrotation.getMatrix_transposed(joint->LocalAnimatedMatrix);
|
||||||
{
|
|
||||||
joint->Animatedrotation.getMatrix_transposed(joint->LocalAnimatedMatrix);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
joint->LocalAnimatedMatrix=joint->Animatedrotation.getMatrix();
|
|
||||||
}
|
|
||||||
|
|
||||||
// --- joint->LocalAnimatedMatrix *= joint->Animatedrotation.getMatrix() ---
|
// --- joint->LocalAnimatedMatrix *= joint->Animatedrotation.getMatrix() ---
|
||||||
f32 *m1 = joint->LocalAnimatedMatrix.pointer();
|
f32 *m1 = joint->LocalAnimatedMatrix.pointer();
|
||||||
|
@ -155,8 +155,6 @@ namespace scene
|
|||||||
|
|
||||||
virtual void updateBoundingBox(void);
|
virtual void updateBoundingBox(void);
|
||||||
|
|
||||||
void setTransposedMatrix(bool);
|
|
||||||
|
|
||||||
//! Recovers the joints from the mesh
|
//! Recovers the joints from the mesh
|
||||||
void recoverJointsFromMesh(core::array<IBoneSceneNode*> &jointChildSceneNodes);
|
void recoverJointsFromMesh(core::array<IBoneSceneNode*> &jointChildSceneNodes);
|
||||||
|
|
||||||
@ -225,7 +223,6 @@ private:
|
|||||||
|
|
||||||
E_INTERPOLATION_MODE InterpolationMode:8;
|
E_INTERPOLATION_MODE InterpolationMode:8;
|
||||||
|
|
||||||
bool TransposedMatrix;
|
|
||||||
bool HasAnimation;
|
bool HasAnimation;
|
||||||
bool PreparedForSkinning;
|
bool PreparedForSkinning;
|
||||||
bool AnimateNormals;
|
bool AnimateNormals;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# Modify this file to change the last-modified date when you add/remove a file.
|
# Modify this file to change the last-modified date when you add/remove a file.
|
||||||
# This will then trigger a new cmake run automatically.
|
# This will then trigger a new cmake run automatically.
|
||||||
file(GLOB_RECURSE STK_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.hpp")
|
file(GLOB_RECURSE STK_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.hpp")
|
||||||
file(GLOB_RECURSE STK_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.cpp")
|
file(GLOB_RECURSE STK_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.cpp")
|
||||||
|
@ -544,7 +544,7 @@ void SPMeshLoader::LocRotScale::read(irr::io::IReadFile* spm)
|
|||||||
float tmp[10];
|
float tmp[10];
|
||||||
spm->read(&tmp, 40);
|
spm->read(&tmp, 40);
|
||||||
m_loc = core::vector3df(tmp[0], tmp[1], tmp[2]);
|
m_loc = core::vector3df(tmp[0], tmp[1], tmp[2]);
|
||||||
m_rot = core::quaternion(tmp[3], tmp[4], tmp[5], tmp[6]);
|
m_rot = core::quaternion(-tmp[3], -tmp[4], -tmp[5], tmp[6]);
|
||||||
m_rot.normalize();
|
m_rot.normalize();
|
||||||
m_scale = core::vector3df(tmp[7], tmp[8], tmp[9]);
|
m_scale = core::vector3df(tmp[7], tmp[8], tmp[9]);
|
||||||
} // LocRotScale::read
|
} // LocRotScale::read
|
||||||
|
@ -326,7 +326,7 @@ private:
|
|||||||
core::matrix4 lm, sm, rm;
|
core::matrix4 lm, sm, rm;
|
||||||
lm.setTranslation(m_loc);
|
lm.setTranslation(m_loc);
|
||||||
sm.setScale(m_scale);
|
sm.setScale(m_scale);
|
||||||
m_rot.getMatrix(rm);
|
m_rot.getMatrix_transposed(rm);
|
||||||
return lm * rm * sm;
|
return lm * rm * sm;
|
||||||
}
|
}
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
|
@ -41,7 +41,6 @@ scene::IAnimatedMesh* STKMeshLoader::createMesh(io::IReadFile* f)
|
|||||||
|
|
||||||
B3DFile = f;
|
B3DFile = f;
|
||||||
AnimatedMesh = new scene::CSkinnedMesh();
|
AnimatedMesh = new scene::CSkinnedMesh();
|
||||||
AnimatedMesh->setTransposedMatrix(true);
|
|
||||||
ShowWarning = true; // If true a warning is issued if too many textures are used
|
ShowWarning = true; // If true a warning is issued if too many textures are used
|
||||||
VerticesStart=0;
|
VerticesStart=0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user