mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2025-01-09 20:27:34 +08:00
Fix for generating bone bind transform inverse when not given, Skeleton bone star size fix in world view
This commit is contained in:
parent
6be0d5cb30
commit
8335fd065c
@ -623,10 +623,10 @@ namespace CodeWalker.GameFiles
|
||||
var bone = Bones[i];
|
||||
BonesMap[bone.Id] = bone;
|
||||
|
||||
bone.UpdateAnimTransform();
|
||||
bone.BindTransformInv = (i < TransformationsInverted?.Length) ? TransformationsInverted[i] : Matrix.Invert(bone.AnimTransform);
|
||||
bone.BindTransformInv.M44 = 1.0f;
|
||||
|
||||
bone.UpdateAnimTransform();
|
||||
bone.UpdateSkinTransform();
|
||||
}
|
||||
}
|
||||
|
||||
@ -904,6 +904,9 @@ namespace CodeWalker.GameFiles
|
||||
}
|
||||
AnimTransform = Matrix.AffineTransformation(1.0f, ori, pos);//(global transform)
|
||||
AnimTransform.ScaleVector *= sca;
|
||||
}
|
||||
public void UpdateSkinTransform()
|
||||
{
|
||||
SkinTransform = BindTransformInv * AnimTransform;
|
||||
//SkinTransform = Matrix.Identity;//(for testing)
|
||||
}
|
||||
|
@ -477,7 +477,7 @@ namespace CodeWalker.Rendering
|
||||
{
|
||||
var bone = bones[i];
|
||||
bone.UpdateAnimTransform();
|
||||
|
||||
bone.UpdateSkinTransform();
|
||||
|
||||
//update model's transform from animated bone
|
||||
RenderableModel bmodel = null;
|
||||
|
@ -1119,6 +1119,8 @@ namespace CodeWalker.Rendering
|
||||
Skeleton skeleton = drawable?.Skeleton;
|
||||
if (skeleton == null) continue;
|
||||
|
||||
Vector3 campos = camera.Position - (entity?.Position ?? Vector3.Zero);
|
||||
|
||||
var pinds = skeleton.ParentIndices;
|
||||
var bones = skeleton.Bones;
|
||||
if ((pinds == null) || (bones == null)) continue;
|
||||
@ -1145,8 +1147,7 @@ namespace CodeWalker.Rendering
|
||||
Vector3 lbeg = Vector3.Zero;
|
||||
Vector3 lend = bone.AnimTranslation;// bone.Rotation.Multiply();
|
||||
|
||||
|
||||
float starsize = (bone.AnimTransform.TranslationVector-camera.Position).Length() * 0.011f;
|
||||
float starsize = (bone.AnimTransform.TranslationVector-campos).Length() * 0.011f;
|
||||
Vector3[] starverts0 = { Vector3.UnitX * starsize, Vector3.UnitY * starsize, Vector3.UnitZ * starsize };
|
||||
Vector3[] starverts1 = { Vector3.UnitX * -starsize, Vector3.UnitY * -starsize, Vector3.UnitZ * -starsize };
|
||||
for (int j = 0; j < 3; j++) starverts0[j] = bone.AnimTransform.MultiplyW(starverts0[j]);
|
||||
|
Loading…
Reference in New Issue
Block a user