Fix a problem with file format differences (wrong weights) and a problem with wrongly placed bones.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3221 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
a23436f955
commit
813274d8ea
|
@ -473,6 +473,8 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file)
|
|||
|
||||
jnt->LocalMatrix.setTranslation(
|
||||
core::vector3df(pJoint->Translation[0], pJoint->Translation[1], -pJoint->Translation[2]) );
|
||||
jnt->Animatedposition.set(jnt->LocalMatrix.getTranslation());
|
||||
jnt->Animatedrotation.set(jnt->LocalMatrix.getRotationDegrees());
|
||||
|
||||
parentNames.push_back( (c8*)pJoint->ParentName );
|
||||
|
||||
|
@ -546,6 +548,7 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file)
|
|||
}
|
||||
|
||||
core::array<MS3DVertexWeights> vertexWeights;
|
||||
f32 weightFactor=0;
|
||||
|
||||
if ((pHeader->Version == 4) && (pPtr < buffer+fileSize))
|
||||
{
|
||||
|
@ -594,6 +597,10 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file)
|
|||
#ifdef __BIG_ENDIAN__
|
||||
subVersion = os::Byteswap::byteswap(subVersion);
|
||||
#endif
|
||||
if (subVersion==1)
|
||||
weightFactor=1.f/255.f;
|
||||
else
|
||||
weightFactor=1.f/100.f;
|
||||
pPtr += sizeof(s32);
|
||||
|
||||
#ifdef _IRR_DEBUG_MS3D_LOADER_
|
||||
|
@ -730,7 +737,7 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file)
|
|||
{
|
||||
ISkinnedMesh::SWeight *w=AnimatedMesh->addWeight(AnimatedMesh->getAllJoints()[boneid]);
|
||||
w->buffer_id = matidx;
|
||||
sum -= (w->strength = vertexWeights[vertidx].weights[0]/100.f);
|
||||
sum -= (w->strength = vertexWeights[vertidx].weights[0]*weightFactor);
|
||||
w->vertex_id = index;
|
||||
}
|
||||
boneid = vertexWeights[vertidx].boneIds[0];
|
||||
|
@ -738,7 +745,7 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file)
|
|||
{
|
||||
ISkinnedMesh::SWeight *w=AnimatedMesh->addWeight(AnimatedMesh->getAllJoints()[boneid]);
|
||||
w->buffer_id = matidx;
|
||||
sum -= (w->strength = vertexWeights[vertidx].weights[1]/100.f);
|
||||
sum -= (w->strength = vertexWeights[vertidx].weights[1]*weightFactor);
|
||||
w->vertex_id = index;
|
||||
}
|
||||
boneid = vertexWeights[vertidx].boneIds[1];
|
||||
|
@ -746,7 +753,7 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file)
|
|||
{
|
||||
ISkinnedMesh::SWeight *w=AnimatedMesh->addWeight(AnimatedMesh->getAllJoints()[boneid]);
|
||||
w->buffer_id = matidx;
|
||||
sum -= (w->strength = vertexWeights[vertidx].weights[2]/100.f);
|
||||
sum -= (w->strength = vertexWeights[vertidx].weights[2]*weightFactor);
|
||||
w->vertex_id = index;
|
||||
}
|
||||
boneid = vertexWeights[vertidx].boneIds[2];
|
||||
|
|
Loading…
Reference in New Issue