diff --git a/include/ComplexShape.h b/include/ComplexShape.h index f7b3b8560c5fbb694d9116ab2341ead686b18a02..dafc4b8f51ae2495ae7c33e370442e873b040048 100644 --- a/include/ComplexShape.h +++ b/include/ComplexShape.h @@ -64,7 +64,7 @@ public: vector<TexCoord> texCoords; }; - Ref<NiAVObject> Split( Ref<NiNode> & parent, int max_bones_per_partition = 4, bool stripify = false ) const; + Ref<NiAVObject> Split( Ref<NiNode> & parent, Matrix44 & transform, int max_bones_per_partition = 4, bool stripify = false ) const; void Merge( const Ref<NiAVObject> & root ); void Clear(); diff --git a/niflib.vcproj b/niflib.vcproj index 828b33e31b465194a164e13f8a5f98e62490a2cf..d43e9283b2bc22f86a5952840f8059c713d06edc 100644 --- a/niflib.vcproj +++ b/niflib.vcproj @@ -45,8 +45,8 @@ MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="1" - UsePrecompiledHeader="2" - PrecompiledHeaderThrough="$(ProjectDir)include/pch.h" + UsePrecompiledHeader="0" + PrecompiledHeaderThrough="" WarningLevel="3" DebugInformationFormat="3" /> @@ -109,8 +109,8 @@ WholeProgramOptimization="false" PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" RuntimeLibrary="0" - UsePrecompiledHeader="2" - PrecompiledHeaderThrough="$(ProjectDir)include/pch.h" + UsePrecompiledHeader="0" + PrecompiledHeaderThrough="" WarningLevel="3" DebugInformationFormat="3" /> @@ -170,8 +170,8 @@ Name="VCCLCompilerTool" PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" RuntimeLibrary="0" - UsePrecompiledHeader="2" - PrecompiledHeaderThrough="$(ProjectDir)include/pch.h" + UsePrecompiledHeader="0" + PrecompiledHeaderThrough="" WarningLevel="3" DebugInformationFormat="3" /> @@ -233,8 +233,8 @@ Optimization="3" PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;BUILDING_NIFLIB_DLL;USE_NIFLIB_DLL" RuntimeLibrary="2" - UsePrecompiledHeader="2" - PrecompiledHeaderThrough="$(ProjectDir)include/pch.h" + UsePrecompiledHeader="0" + PrecompiledHeaderThrough="" WarningLevel="3" DebugInformationFormat="3" /> @@ -307,8 +307,8 @@ MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="1" - UsePrecompiledHeader="2" - PrecompiledHeaderThrough="$(ProjectDir)include/pch.h" + UsePrecompiledHeader="0" + PrecompiledHeaderThrough="" WarningLevel="3" DebugInformationFormat="4" /> @@ -395,8 +395,8 @@ > <Tool Name="VCCLCompilerTool" - UsePrecompiledHeader="1" - PrecompiledHeaderThrough="$(ProjectDir)include/pch.h" + UsePrecompiledHeader="0" + PrecompiledHeaderThrough="" /> </FileConfiguration> <FileConfiguration diff --git a/src/ComplexShape.cpp b/src/ComplexShape.cpp index 7aa92e724e1bba66d0f07d72a47ba75a890b7320..eaff4b44233852bbdde6116a42e7d462070701a0 100644 --- a/src/ComplexShape.cpp +++ b/src/ComplexShape.cpp @@ -606,7 +606,7 @@ void ComplexShape::Merge( const Ref<NiAVObject> & root ) { // } //} -Ref<NiAVObject> ComplexShape::Split( Ref<NiNode> & parent, int max_bones_per_partition, bool stripify ) const { +Ref<NiAVObject> ComplexShape::Split( Ref<NiNode> & parent, Matrix44 & transform, int max_bones_per_partition, bool stripify ) const { //Make sure parent is not NULL if ( parent == NULL ) { @@ -657,6 +657,9 @@ Ref<NiAVObject> ComplexShape::Split( Ref<NiNode> & parent, int max_bones_per_par parent->AddChild( root ); + //Set transfrm of root + root->SetLocalTransform( transform ); + //Create NiTriShapeData and fill it out with all data that is relevant //to this shape based on the material. for ( unsigned int shape_num = 0; shape_num < shapes.size(); ++shape_num ) { diff --git a/src/obj/NiSkinData.cpp b/src/obj/NiSkinData.cpp index 8c7c88d2a4d171a51f186e4a7602e20c61b001ef..39e359508d08b95ff450e4c005438ffe3ecfbd27 100644 --- a/src/obj/NiSkinData.cpp +++ b/src/obj/NiSkinData.cpp @@ -95,14 +95,13 @@ NiSkinData::NiSkinData( const Ref<NiTriBasedGeom> & owner ) NI_SKIN_DATA_CONSTRU Matrix44 sr_world = skinInst->GetSkeletonRoot()->GetWorldTransform(); //Inverse owner NiTriBasedGeom matrix & multiply with skeleton root matrix - //Matrix44 res_mat = owner_mat.Inverse() * sr_world; - Matrix44 res_mat = (sr_world.Inverse() * owner_mat).Inverse() * sr_world; + Matrix44 overall_mat = owner_mat.Inverse() * sr_world; //Store result - res_mat.Decompose( translation, rotation, scale ); + overall_mat.Decompose( translation, rotation, scale ); //--Calculate Bone Offsets--// - + Matrix44 res_mat; Matrix44 bone_mat; for (uint i = 0; i < boneList.size(); ++i ) { //--Get Bone Bind Pose--// @@ -110,7 +109,7 @@ NiSkinData::NiSkinData( const Ref<NiTriBasedGeom> & owner ) NI_SKIN_DATA_CONSTRU //Get bone world position bone_mat = bone_nodes[i]->GetWorldTransform(); - bone_mat = bone_mat * sr_world; + //bone_mat = bone_mat * sr_world; //Multiply NiTriBasedGeom matrix with inversed bone matrix res_mat = owner_mat * bone_mat.Inverse();