//! Refreshes vertex data cached in joints such as positions and normals\r
virtual void refreshJointCache() = 0;\r
\r
+ //! Moves the mesh into static position.\r
+ virtual void resetAnimation() = 0;\r
+\r
//! A vertex weight\r
struct SWeight\r
{\r
if (!mesh)\r
return;\r
\r
+ if (mesh->getMeshType() == EAMT_SKINNED)\r
+ {\r
+ ISkinnedMesh *smesh = (ISkinnedMesh *) mesh;\r
+ smesh->resetAnimation();\r
+ }\r
+\r
const u32 bcount = mesh->getMeshBufferCount();\r
for ( u32 b=0; b<bcount; ++b)\r
recalculateNormals(mesh->getMeshBuffer(b), smooth, angleWeighted);\r
}\r
}\r
\r
+void CSkinnedMesh::resetAnimation()\r
+{\r
+ //copy from the cache to the mesh...\r
+ for (u32 i=0; i<AllJoints.size(); ++i)\r
+ {\r
+ SJoint *joint=AllJoints[i];\r
+ for (u32 j=0; j<joint->Weights.size(); ++j)\r
+ {\r
+ const u16 buffer_id=joint->Weights[j].buffer_id;\r
+ const u32 vertex_id=joint->Weights[j].vertex_id;\r
+ LocalBuffers[buffer_id]->getVertex(vertex_id)->Pos = joint->Weights[j].StaticPos;\r
+ LocalBuffers[buffer_id]->getVertex(vertex_id)->Normal = joint->Weights[j].StaticNormal;\r
+ }\r
+ }\r
+ SkinnedLastFrame = false;\r
+ LastAnimatedFrame = -1;\r
+}\r
+\r
void CSkinnedMesh::calculateGlobalMatrices(SJoint *joint,SJoint *parentJoint)\r
{\r
if (!joint && parentJoint) // bit of protection from endless loops\r
//! Refreshes vertex data cached in joints such as positions and normals\r
virtual void refreshJointCache() _IRR_OVERRIDE_;\r
\r
+ //! Moves the mesh into static position.\r
+ virtual void resetAnimation() _IRR_OVERRIDE_;\r
+\r
//Interface for the mesh loaders (finalize should lock these functions, and they should have some prefix like loader_\r
//these functions will use the needed arrays, set values, etc to help the loaders\r
\r