mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-22 04:23:09 +00:00
BFRES : Fix long lasting bug where tangents load/create wrong from 1 skin count or less.
This commit is contained in:
parent
3b24eb253b
commit
d50379879f
3 changed files with 15 additions and 0 deletions
|
@ -290,6 +290,8 @@ namespace Bfres.Structs
|
|||
{
|
||||
vertices[v].pos = Vector3.TransformPosition(vertices[v].pos, SingleBind);
|
||||
vertices[v].nrm = Vector3.TransformNormal(vertices[v].nrm, SingleBind);
|
||||
vertices[v].tan.Xyz = Vector3.TransformNormal(vertices[v].tan.Xyz, SingleBind);
|
||||
vertices[v].bitan.Xyz = Vector3.TransformNormal(vertices[v].bitan.Xyz, SingleBind);
|
||||
}
|
||||
else if (VertexSkinCount == 1)
|
||||
{
|
||||
|
@ -301,6 +303,8 @@ namespace Bfres.Structs
|
|||
|
||||
vertices[v].pos = Vector3.TransformPosition(vertices[v].pos, SingleBindLocal);
|
||||
vertices[v].nrm = Vector3.TransformNormal(vertices[v].nrm, SingleBindLocal);
|
||||
vertices[v].tan.Xyz = Vector3.TransformNormal(vertices[v].tan.Xyz, SingleBindLocal);
|
||||
vertices[v].bitan.Xyz = Vector3.TransformNormal(vertices[v].bitan.Xyz, SingleBindLocal);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2076,6 +2080,8 @@ namespace Bfres.Structs
|
|||
|
||||
vtx.pos = TransformLocal(vtx.pos, boneId, VertexSkinCount == 1);
|
||||
vtx.nrm = TransformLocal(vtx.nrm, boneId, VertexSkinCount == 1, false);
|
||||
vtx.tan.Xyz = TransformLocal(vtx.tan.Xyz, boneId, VertexSkinCount == 1, false);
|
||||
vtx.bitan.Xyz = TransformLocal(vtx.bitan.Xyz, boneId, VertexSkinCount == 1, false);
|
||||
}
|
||||
|
||||
verts.Add(new Syroot.Maths.Vector4F(vtx.pos.X, vtx.pos.Y, vtx.pos.Z, 1.0f));
|
||||
|
|
|
@ -394,6 +394,8 @@ namespace FirstPlugin
|
|||
Matrix4 sb = model.Skeleton.bones[boneIndex].Transform;
|
||||
v.pos = Vector3.TransformPosition(v.pos, sb);
|
||||
v.nrm = Vector3.TransformNormal(v.nrm, sb);
|
||||
v.tan.Xyz = Vector3.TransformNormal(v.tan.Xyz, sb);
|
||||
v.bitan.Xyz = Vector3.TransformNormal(v.bitan.Xyz, sb);
|
||||
}
|
||||
}
|
||||
if (fshp.VertexSkinCount == 0)
|
||||
|
@ -403,6 +405,8 @@ namespace FirstPlugin
|
|||
Matrix4 NoBindFix = model.Skeleton.bones[boneIndex].Transform;
|
||||
v.pos = Vector3.TransformPosition(v.pos, NoBindFix);
|
||||
v.nrm = Vector3.TransformNormal(v.nrm, NoBindFix);
|
||||
v.tan.Xyz = Vector3.TransformNormal(v.tan.Xyz, NoBindFix);
|
||||
v.bitan.Xyz = Vector3.TransformNormal(v.bitan.Xyz, NoBindFix);
|
||||
}
|
||||
fshp.vertices.Add(v);
|
||||
}
|
||||
|
|
|
@ -307,7 +307,10 @@ namespace FirstPlugin
|
|||
Matrix4 sb = model.Skeleton.bones[boneIndex].Transform;
|
||||
v.pos = Vector3.TransformPosition(v.pos, sb);
|
||||
v.nrm = Vector3.TransformNormal(v.nrm, sb);
|
||||
v.tan.Xyz = Vector3.TransformNormal(v.tan.Xyz, sb);
|
||||
v.bitan.Xyz = Vector3.TransformNormal(v.bitan.Xyz, sb);
|
||||
}
|
||||
|
||||
}
|
||||
if (fshp.VertexSkinCount == 0)
|
||||
{
|
||||
|
@ -319,6 +322,8 @@ namespace FirstPlugin
|
|||
Matrix4 NoBindFix = model.Skeleton.bones[boneIndex].Transform;
|
||||
v.pos = Vector3.TransformPosition(v.pos, NoBindFix);
|
||||
v.nrm = Vector3.TransformNormal(v.nrm, NoBindFix);
|
||||
v.tan.Xyz = Vector3.TransformNormal(v.tan.Xyz, NoBindFix);
|
||||
v.bitan.Xyz = Vector3.TransformNormal(v.bitan.Xyz, NoBindFix);
|
||||
}
|
||||
}
|
||||
catch //Matrix failed. Print the coordinate data of the bone
|
||||
|
|
Loading…
Reference in a new issue