Skip to content
Snippets Groups Projects
Commit 2e43de75 authored by Shon Ferguson's avatar Shon Ferguson
Browse files

Really put the skin calculations back the way they were this time. Helps, but...

Really put the skin calculations back the way they were this time.  Helps, but the hands of better bodies meshes still end up in the wrong place.
Added transform parameter to ComplexShape::Split because changing the transforms after the fact ruins the skin binds.
parent 26a11104
No related branches found
No related tags found
No related merge requests found
......@@ -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();
......
......@@ -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
......
......@@ -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 ) {
......
......@@ -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();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment