From 98e95812290ece75bba20bdf4e4a6a1beeec0065 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Mon, 24 Jul 2023 19:54:43 +0900 Subject: [PATCH] =?UTF-8?q?float4=20=E3=81=A7=E3=81=AA=E3=81=84=20VertexCo?= =?UTF-8?q?lor=20=E3=81=8C=E5=90=AB=E3=81=BE=E3=82=8C=E3=82=8B=E3=81=A8?= =?UTF-8?q?=E3=82=A8=E3=83=A9=E3=83=BC=E3=81=AB=E3=81=AA=E3=82=8B=E3=81=93?= =?UTF-8?q?=E3=81=A8=E3=82=92=E5=9B=9E=E9=81=BF=20#2105?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/VRM10/Runtime/IO/Model/MeshImporterShared.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Assets/VRM10/Runtime/IO/Model/MeshImporterShared.cs b/Assets/VRM10/Runtime/IO/Model/MeshImporterShared.cs index 7db4f0737..76c8b6019 100644 --- a/Assets/VRM10/Runtime/IO/Model/MeshImporterShared.cs +++ b/Assets/VRM10/Runtime/IO/Model/MeshImporterShared.cs @@ -26,7 +26,18 @@ namespace UniVRM10 var positions = src.VertexBuffer.Positions.Bytes.Reinterpret(1); var normals = src.VertexBuffer.Normals?.Bytes.Reinterpret(1) ?? default; var texCoords = src.VertexBuffer.TexCoords?.Bytes.Reinterpret(1) ?? default; - var colors = src.VertexBuffer.Colors?.Bytes.Reinterpret(1) ?? default; + NativeArray colors = default; + if (src.VertexBuffer.Colors is BufferAccessor colorBuffer) + { + if (colorBuffer.ComponentType == AccessorValueType.FLOAT && colorBuffer.AccessorType == AccessorVectorType.VEC4) + { + colors = colorBuffer.Bytes.Reinterpret(1); + } + else + { + Debug.LogWarning($"COLOR_0: {colorBuffer.ComponentType}.{colorBuffer.AccessorType} not supported. skip."); + } + } var weights = src.VertexBuffer.Weights?.GetAsVector4Array() ?? default; var joints = src.VertexBuffer.Joints?.GetAsSkinJointsArray() ?? default;