mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-09-08 11:59:26 -05:00
Bind bone before normalization
This commit is contained in:
@@ -17,12 +17,13 @@ namespace VRM
|
||||
dst.vertices = src.vertices;
|
||||
dst.normals = src.normals;
|
||||
dst.tangents = src.tangents;
|
||||
|
||||
if (src.colors != null && src.colors.Length > 0) dst.colors = src.colors;
|
||||
if (src.uv != null && src.uv.Length > 0) dst.uv = src.uv;
|
||||
if (src.uv2 != null && src.uv2.Length > 0) dst.uv2 = src.uv2;
|
||||
if (src.uv3 != null && src.uv3.Length > 0) dst.uv3 = src.uv3;
|
||||
if (src.uv4 != null && src.uv4.Length > 0) dst.uv4 = src.uv4;
|
||||
dst.colors = src.colors;
|
||||
dst.uv = src.uv;
|
||||
dst.uv2 = src.uv2;
|
||||
dst.uv3 = src.uv3;
|
||||
dst.uv4 = src.uv4;
|
||||
dst.boneWeights = src.boneWeights;
|
||||
dst.bindposes = src.bindposes;
|
||||
|
||||
dst.subMeshCount = src.subMeshCount;
|
||||
for (int i = 0; i < dst.subMeshCount; ++i)
|
||||
@@ -30,19 +31,19 @@ namespace VRM
|
||||
dst.SetIndices(src.GetIndices(i), src.GetTopology(i), i);
|
||||
}
|
||||
|
||||
dst.RecalculateBounds();
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
public static void ApplyRotationAndScale(this Mesh src, Matrix4x4 m)
|
||||
{
|
||||
m.SetColumn(3, new Vector4(0, 0, 0, 1));
|
||||
m.SetColumn(3, new Vector4(0, 0, 0, 1)); // remove translation
|
||||
src.ApplyMatrix(m);
|
||||
}
|
||||
|
||||
public static void ApplyMatrix(this Mesh src, Matrix4x4 m)
|
||||
{
|
||||
m.SetColumn(3, new Vector4(0, 0, 0, 1));
|
||||
|
||||
src.vertices = src.vertices.Select(x => m.MultiplyPoint(x)).ToArray();
|
||||
if (src.normals != null && src.normals.Length > 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user