Commit f583f7dc authored by hybrid's avatar hybrid

Use methods of the vector class.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@947 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 17ed8d5b
...@@ -435,48 +435,38 @@ void CSkinnedMesh::SkinJoint(SJoint *Joint, SJoint *ParentJoint) ...@@ -435,48 +435,38 @@ void CSkinnedMesh::SkinJoint(SJoint *Joint, SJoint *ParentJoint)
core::vector3df ThisVertexMove, ThisNormalMove; core::vector3df ThisVertexMove, ThisNormalMove;
SWeight *Weight;
core::array<scene::SSkinMeshBuffer*> &BuffersUsed=*SkinningBuffers; core::array<scene::SSkinMeshBuffer*> &BuffersUsed=*SkinningBuffers;
//Skin Vertices Normals... //Skin Vertices Positions and Normals...
//Skin Vertices Positions...
for (u32 i=0; i<Joint->Weights.size(); ++i) for (u32 i=0; i<Joint->Weights.size(); ++i)
{ {
Weight=&Joint->Weights[i]; SWeight& weight = Joint->Weights[i];
// Pull this vertex... // Pull this vertex...
ThisVertexMove.X = JointVertexPull[0]*Weight->StaticPos.X + JointVertexPull[4]*Weight->StaticPos.Y + JointVertexPull[8]*Weight->StaticPos.Z + JointVertexPull[12]; JointVertexPull.transformVect(ThisVertexMove, weight.StaticPos);
ThisVertexMove.Y = JointVertexPull[1]*Weight->StaticPos.X + JointVertexPull[5]*Weight->StaticPos.Y + JointVertexPull[9]*Weight->StaticPos.Z + JointVertexPull[13];
ThisVertexMove.Z = JointVertexPull[2]*Weight->StaticPos.X + JointVertexPull[6]*Weight->StaticPos.Y + JointVertexPull[10]*Weight->StaticPos.Z + JointVertexPull[14];
if (AnimateNormals) if (AnimateNormals)
{ JointVertexPull.rotateVect(ThisNormalMove, weight.StaticNormal);
ThisNormalMove.X = JointVertexPull[0]*Weight->StaticNormal.X + JointVertexPull[4]*Weight->StaticNormal.Y + JointVertexPull[8]*Weight->StaticNormal.Z;
ThisNormalMove.Y = JointVertexPull[1]*Weight->StaticNormal.X + JointVertexPull[5]*Weight->StaticNormal.Y + JointVertexPull[9]*Weight->StaticNormal.Z;
ThisNormalMove.Z = JointVertexPull[2]*Weight->StaticNormal.X + JointVertexPull[6]*Weight->StaticNormal.Y + JointVertexPull[10]*Weight->StaticNormal.Z;
}
if (! (*(weight.Moved)) )
if (! (*Weight->Moved) )
{ {
(*Weight->Moved) = true; *(weight.Moved) = true;
BuffersUsed[Weight->buffer_id]->getVertex(Weight->vertex_id)->Pos = (ThisVertexMove * Weight->strength); BuffersUsed[weight.buffer_id]->getVertex(weight.vertex_id)->Pos = ThisVertexMove * weight.strength;
if (AnimateNormals) BuffersUsed[Weight->buffer_id]->getVertex(Weight->vertex_id)->Normal = (ThisNormalMove * Weight->strength); if (AnimateNormals)
BuffersUsed[weight.buffer_id]->getVertex(weight.vertex_id)->Normal = ThisNormalMove * weight.strength;
//(*Weight->_Pos) = ThisVertexMove * Weight->strength; //*(weight._Pos) = ThisVertexMove * weight.strength;
} }
else else
{ {
BuffersUsed[Weight->buffer_id]->getVertex(Weight->vertex_id)->Pos += (ThisVertexMove* Weight->strength); BuffersUsed[weight.buffer_id]->getVertex(weight.vertex_id)->Pos += ThisVertexMove * weight.strength;
if (AnimateNormals) BuffersUsed[Weight->buffer_id]->getVertex(Weight->vertex_id)->Normal += (ThisNormalMove * Weight->strength); if (AnimateNormals)
BuffersUsed[weight.buffer_id]->getVertex(weight.vertex_id)->Normal += ThisNormalMove * weight.strength;
//(*Weight->_Pos) += (ThisVertexMove * Weight->strength); //*(weight._Pos) += ThisVertexMove * weight.strength;
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment