// This file is part of the "Irrlicht Engine".\r
// For conditions of distribution and use, see copyright notice in irrlicht.h\r
\r
-#include "IrrCompileConfig.h"\r
-#ifdef _IRR_COMPILE_WITH_SKINNED_MESH_SUPPORT_\r
-\r
#include "CSkinnedMesh.h"\r
#include "CBoneSceneNode.h"\r
#include "IAnimatedMeshSceneNode.h"\r
{\r
return a.rotation == b.rotation;\r
}\r
-};\r
+}\r
\r
namespace irr\r
{\r
return HardwareSkinning;\r
}\r
\r
+void CSkinnedMesh::refreshJointCache()\r
+{\r
+ //copy cache from 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
+ joint->Weights[j].StaticPos = LocalBuffers[buffer_id]->getVertex(vertex_id)->Pos;\r
+ joint->Weights[j].StaticNormal = LocalBuffers[buffer_id]->getVertex(vertex_id)->Normal;\r
+ }\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
\r
for (i=0; i<LocalBuffers.size(); ++i)\r
{\r
- Vertices_Moved.push_back( core::array<bool>() );\r
+ Vertices_Moved.push_back( core::array<char>() );\r
Vertices_Moved[i].set_used(LocalBuffers[i]->getVertexCount());\r
}\r
\r
\r
if ( redundantPosKeys > 0 )\r
{\r
- os::Printer::log("Skinned Mesh - redundant position frames kicked:", core::stringc(redundantPosKeys).c_str(), ELL_DEBUG);\r
+ os::Printer::log("Skinned Mesh - redundant position frames kicked", core::stringc(redundantPosKeys).c_str(), ELL_DEBUG);\r
}\r
if ( unorderedPosKeys > 0 )\r
{\r
- irr::os::Printer::log("Skinned Mesh - unsorted position frames kicked:", irr::core::stringc(unorderedPosKeys).c_str(), irr::ELL_DEBUG);\r
+ irr::os::Printer::log("Skinned Mesh - unsorted position frames kicked", irr::core::stringc(unorderedPosKeys).c_str(), irr::ELL_DEBUG);\r
}\r
if ( redundantScaleKeys > 0 )\r
{\r
- os::Printer::log("Skinned Mesh - redundant scale frames kicked:", core::stringc(redundantScaleKeys).c_str(), ELL_DEBUG);\r
+ os::Printer::log("Skinned Mesh - redundant scale frames kicked", core::stringc(redundantScaleKeys).c_str(), ELL_DEBUG);\r
}\r
if ( unorderedScaleKeys > 0 )\r
{\r
- irr::os::Printer::log("Skinned Mesh - unsorted scale frames kicked:", irr::core::stringc(unorderedScaleKeys).c_str(), irr::ELL_DEBUG);\r
+ irr::os::Printer::log("Skinned Mesh - unsorted scale frames kicked", irr::core::stringc(unorderedScaleKeys).c_str(), irr::ELL_DEBUG);\r
}\r
if ( redundantRotationKeys > 0 )\r
{\r
- os::Printer::log("Skinned Mesh - redundant rotation frames kicked:", core::stringc(redundantRotationKeys).c_str(), ELL_DEBUG);\r
+ os::Printer::log("Skinned Mesh - redundant rotation frames kicked", core::stringc(redundantRotationKeys).c_str(), ELL_DEBUG);\r
}\r
if ( unorderedRotationKeys > 0 )\r
{\r
- irr::os::Printer::log("Skinned Mesh - unsorted rotation frames kicked:", irr::core::stringc(unorderedRotationKeys).c_str(), irr::ELL_DEBUG);\r
+ irr::os::Printer::log("Skinned Mesh - unsorted rotation frames kicked", irr::core::stringc(unorderedRotationKeys).c_str(), irr::ELL_DEBUG);\r
}\r
}\r
\r
\r
} // end namespace scene\r
} // end namespace irr\r
-\r
-#endif // _IRR_COMPILE_WITH_SKINNED_MESH_SUPPORT_\r
-\r