diff --git a/WickedEngine/skinningCS.hlsl b/WickedEngine/skinningCS.hlsl index f81118db2..a75d5eaa9 100644 --- a/WickedEngine/skinningCS.hlsl +++ b/WickedEngine/skinningCS.hlsl @@ -3,7 +3,9 @@ struct Bone { - float4x4 pose; + float4 pose0; + float4 pose1; + float4 pose2; }; STRUCTUREDBUFFER(boneBuffer, Bone, SKINNINGSLOT_IN_BONEBUFFER); @@ -30,7 +32,15 @@ inline void Skinning(inout float4 pos, inout float4 nor, in float4 inBon, in flo [loop] for (uint i = 0; ((i < 4) && (weisum<1.0f)); ++i) { - m = boneBuffer[(uint)inBon[i]].pose; + float4 pose0 = boneBuffer[(uint)inBon[i]].pose0; + float4 pose1 = boneBuffer[(uint)inBon[i]].pose1; + float4 pose2 = boneBuffer[(uint)inBon[i]].pose2; + m = float4x4( + float4(pose0.x, pose1.x, pose2.x, 0), + float4(pose0.y, pose1.y, pose2.y, 0), + float4(pose0.z, pose1.z, pose2.z, 0), + float4(pose0.w, pose1.w, pose2.w, 1) + ); m3 = (float3x3)m; p += mul(float4(pos.xyz, 1), m)*inWei[i]; diff --git a/WickedEngine/wiLoader.h b/WickedEngine/wiLoader.h index d9910cc1a..6900d3643 100644 --- a/WickedEngine/wiLoader.h +++ b/WickedEngine/wiLoader.h @@ -718,7 +718,16 @@ public: GFX_STRUCT ShaderBoneType { - XMMATRIX pose; + XMFLOAT4A pose0; + XMFLOAT4A pose1; + XMFLOAT4A pose2; + + void Create(const XMFLOAT4X4& matIn) + { + pose0 = XMFLOAT4A(matIn._11, matIn._21, matIn._31, matIn._41); + pose1 = XMFLOAT4A(matIn._12, matIn._22, matIn._32, matIn._42); + pose2 = XMFLOAT4A(matIn._13, matIn._23, matIn._33, matIn._43); + } STRUCTUREDBUFFER_SETBINDSLOT(SKINNINGSLOT_IN_BONEBUFFER) diff --git a/WickedEngine/wiRenderer.cpp b/WickedEngine/wiRenderer.cpp index 53776b85d..ddd42a5c8 100644 --- a/WickedEngine/wiRenderer.cpp +++ b/WickedEngine/wiRenderer.cpp @@ -1827,7 +1827,7 @@ void wiRenderer::UpdateRenderData(GRAPHICSTHREAD threadID) for (unsigned int k = 0; k < armature->boneCollection.size(); k++) { // Note the transpose: we NEED to transpose so that loading from the structured buffer is easier in the shader (avoid the many mov operations) - armature->boneData[k].pose = XMMatrixTranspose(XMLoadFloat4x4(&armature->boneCollection[k]->boneRelativity)); + armature->boneData[k].Create(armature->boneCollection[k]->boneRelativity); } GetDevice()->UpdateBuffer(&armature->boneBuffer, armature->boneData.data(), threadID, (int)(sizeof(Armature::ShaderBoneType) * armature->boneCollection.size())); GetDevice()->BindResourceCS(&armature->boneBuffer, STRUCTUREDBUFFER_GETBINDSLOT(Armature::ShaderBoneType), threadID); diff --git a/WickedEngine/wiVersion.cpp b/WickedEngine/wiVersion.cpp index 82fecc3e5..68d6b8769 100644 --- a/WickedEngine/wiVersion.cpp +++ b/WickedEngine/wiVersion.cpp @@ -9,7 +9,7 @@ namespace wiVersion // minor features, major updates const int minor = 13; // minor bug fixes, alterations, refactors, updates - const int revision = 13; + const int revision = 14; long GetVersion()