GetAsSkinJointsArray と GetAsVector4Array を使う

This commit is contained in:
ousttrue 2022-04-19 14:17:16 +09:00
parent 67a2d17958
commit c0d1fa840d
2 changed files with 4 additions and 4 deletions

View File

@ -234,10 +234,10 @@ namespace UniVRM10
var normals = mesh.VertexBuffer.Normals.Bytes.Reinterpret<Vector3>(1);
var texCoords = mesh.VertexBuffer.TexCoords.Bytes.Reinterpret<Vector2>(1);
var weights = meshGroup.Skin != null
? mesh.VertexBuffer.Weights.Bytes.Reinterpret<Vector4>(1)
? mesh.VertexBuffer.Weights.GetAsVector4Array()
: default;
var joints = meshGroup.Skin != null
? mesh.VertexBuffer.Joints.Bytes.Reinterpret<SkinJoints>(1)
? mesh.VertexBuffer.Joints.GetAsSkinJointsArray()
: default;
interleaveVertexJob = new InterleaveMeshVerticesJob(

View File

@ -96,13 +96,13 @@ namespace VrmLib
{
var jointsBuffer = vertexBuffer.Joints;
var joints = (jointsBuffer != null || jointsBuffer.Count == 0)
? jointsBuffer.Bytes.Reinterpret<SkinJoints>(1)
? jointsBuffer.GetAsSkinJointsArray()
: arrayManager.CreateNativeArray<SkinJoints>(vertexBuffer.Count) // when MorphTarget only
;
var weightsBuffer = vertexBuffer.Weights;
var weights = (weightsBuffer != null || weightsBuffer.Count == 0)
? weightsBuffer.Bytes.Reinterpret<Vector4>(1)
? weightsBuffer.GetAsVector4Array()
: arrayManager.CreateNativeArray<Vector4>(vertexBuffer.Count) // when MorphTarget only
;