Skip to content

Commit

Permalink
Fixed ModelConversion
Browse files Browse the repository at this point in the history
  • Loading branch information
MrScautHD committed Dec 8, 2024
1 parent c39bb50 commit fb76b5e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/Bliss/CSharp/Geometry/Animations/MeshAmateurBuilder.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System.Runtime.CompilerServices;
using Assimp;
using Bliss.CSharp.Geometry.Animations.Bones;
using Bliss.CSharp.Geometry.Conversions;
Expand Down Expand Up @@ -56,7 +55,7 @@ private Dictionary<int, BoneInfo[]> SetupBoneInfos(ModelAnimation animation) {
return bones;
}

private unsafe void UpdateChannel(Node node, ModelAnimation animation, int frame, AMatrix4x4 parentTransform) {
private void UpdateChannel(Node node, ModelAnimation animation, int frame, AMatrix4x4 parentTransform) {
AMatrix4x4 nodeTransformation = AMatrix4x4.Identity;

if (GetChannel(node, animation, out NodeAnimationChannel? channel)) {
Expand All @@ -75,7 +74,7 @@ private unsafe void UpdateChannel(Node node, ModelAnimation animation, int frame
rootInverseTransform.Inverse();

AMatrix4x4 transformation = bone.OffsetMatrix * nodeTransformation * parentTransform * rootInverseTransform;
this._boneTransformations[boneId] = Matrix4x4.Transpose(Unsafe.Read<Matrix4x4>(&transformation)); // TODO: By doing here Matrix4x4.Identity, it will be normal, there is just something wrong with any matrix i think translation
this._boneTransformations[boneId] = Matrix4x4.Transpose(ModelConversion.FromAMatrix4X4(transformation)); // TODO: By doing here Matrix4x4.Identity, it will be normal, there is just something wrong with any matrix i think translation
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Bliss/CSharp/Geometry/Conversions/ModelConversion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public static Matrix4x4 FromAMatrix4X4(AMatrix4x4 matrix4X4) {
aMatrix.M31 = matrix4X4.C1;
aMatrix.M32 = matrix4X4.C2;
aMatrix.M33 = matrix4X4.C3;
aMatrix.M33 = matrix4X4.C4;
aMatrix.M34 = matrix4X4.C4;

aMatrix.M41 = matrix4X4.D1;
aMatrix.M42 = matrix4X4.D2;
Expand Down

0 comments on commit fb76b5e

Please sign in to comment.