]> git.lizzy.rs Git - irrlicht.git/blobdiff - source/Irrlicht/CSkinnedMesh.cpp
Revert "Fix: Listbox was sometimes sending EGET_LISTBOX_SELECTED_AGAIN instead of...
[irrlicht.git] / source / Irrlicht / CSkinnedMesh.cpp
index bc94759f6cc5b905e81664bd3a690d696f273e33..75e2ca645a9f2b7d5e15c3540d7a36424cdf1675 100644 (file)
@@ -2,9 +2,6 @@
 // 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
@@ -82,7 +79,7 @@ namespace
        {\r
                return a.rotation == b.rotation;\r
        }\r
-};\r
+}\r
 \r
 namespace irr\r
 {\r
@@ -813,6 +810,39 @@ bool CSkinnedMesh::setHardwareSkinning(bool on)
        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
@@ -1009,7 +1039,7 @@ void CSkinnedMesh::finalize()
 \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
@@ -1104,27 +1134,27 @@ void CSkinnedMesh::finalize()
 \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
@@ -1506,6 +1536,3 @@ void CSkinnedMesh::calculateTangents(
 \r
 } // end namespace scene\r
 } // end namespace irr\r
-\r
-#endif // _IRR_COMPILE_WITH_SKINNED_MESH_SUPPORT_\r
-\r