Fix for bones on peds drawables with existing skeletons. Also included code to use geometry-specific bone matrices where boneIds array is used, but commented out since it never seems necessary (leaving in for reference)

This commit is contained in:
dexy
2019-11-09 21:07:41 +11:00
Unverified
parent 20545145a5
commit 03fa5575bf
5 changed files with 73 additions and 2 deletions
+37
View File
@@ -384,6 +384,41 @@ namespace CodeWalker.Rendering
bt.Row3 = b.Column3;
BoneTransforms[i] = bt;
}
//var drawbl = Key;
//if (AllModels == null) return;
//for (int i = 0; i < AllModels.Length; i++)
//{
// var model = AllModels[i];
// if (model?.Geometries == null) continue;
// for (int g = 0; g < model.Geometries.Length; g++)
// {
// var geom = model.Geometries[g];
// var boneids = geom?.DrawableGeom?.BoneIds;
// if (boneids == null) continue;
// if (boneids.Length != Bones.Count)
// {
// var idc = boneids.Length;
// if (geom.BoneTransforms == null)
// {
// geom.BoneTransforms = new Matrix3_s[idc];
// }
// for (int b = 0; b < idc; b++)
// {
// var id = boneids[b];
// if (id < BoneTransforms.Length)
// {
// geom.BoneTransforms[b] = BoneTransforms[id];
// if (id != b)
// { }
// }
// else
// { }
// }
// }
// }
//}
}
@@ -756,6 +791,8 @@ namespace CodeWalker.Rendering
public bool isHair = false;
public bool disableRendering = false;
//public Matrix3_s[] BoneTransforms = null;
public static ShaderParamNames[] GetTextureSamplerList()
{
return new ShaderParamNames[]
+8
View File
@@ -796,6 +796,14 @@ namespace CodeWalker.Rendering
{
tintpal.SetVSResource(context, 0);
}
//if (geom.BoneTransforms != null)
//{
// SetBoneMatrices(context, geom.BoneTransforms);
// defaultBoneMatricesBound = false;
//}
}
public void SetBoneMatrices(DeviceContext context, Matrix3_s[] matrices)
+8
View File
@@ -356,6 +356,14 @@ namespace CodeWalker.Rendering
{
texture.SetPSResource(context, 0);
}
//if (geom.BoneTransforms != null)
//{
// SetBoneMatrices(context, geom.BoneTransforms);
// defaultBoneMatricesBound = false;
//}
}
public void SetBoneMatrices(DeviceContext context, Matrix3_s[] matrices)