diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/BufferAccessor.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/BufferAccessor.cs index 43e4a6273..6ead44a56 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/BufferAccessor.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/BufferAccessor.cs @@ -157,6 +157,9 @@ namespace UniGLTF } switch (ComponentType) { + case AccessorValueType.UNSIGNED_BYTE: + return ArrayManager.Convert(Bytes, (byte x) => (int)x); + case AccessorValueType.UNSIGNED_SHORT: return ArrayManager.Convert(Bytes.Reinterpret(1), (ushort x) => (int)x); diff --git a/Assets/VRM10/Runtime/IO/Model/MeshImporter.cs b/Assets/VRM10/Runtime/IO/Model/MeshImporter.cs index d27a78e76..bf33aed6b 100644 --- a/Assets/VRM10/Runtime/IO/Model/MeshImporter.cs +++ b/Assets/VRM10/Runtime/IO/Model/MeshImporter.cs @@ -65,16 +65,27 @@ namespace UniVRM10 // Indexを更新 switch (src.IndexBuffer.ComponentType) { + case AccessorValueType.UNSIGNED_BYTE: + { + var intIndices = src.IndexBuffer.GetAsIntArray(); + mesh.SetIndexBufferParams(intIndices.Length, IndexFormat.UInt32); + mesh.SetIndexBufferData(intIndices, 0, 0, intIndices.Length); + break; + } case AccessorValueType.UNSIGNED_SHORT: - var shortIndices = src.IndexBuffer.Bytes.Reinterpret(1); - mesh.SetIndexBufferParams(shortIndices.Length, IndexFormat.UInt16); - mesh.SetIndexBufferData(shortIndices, 0, 0, shortIndices.Length); - break; + { + var shortIndices = src.IndexBuffer.Bytes.Reinterpret(1); + mesh.SetIndexBufferParams(shortIndices.Length, IndexFormat.UInt16); + mesh.SetIndexBufferData(shortIndices, 0, 0, shortIndices.Length); + break; + } case AccessorValueType.UNSIGNED_INT: - var intIndices = src.IndexBuffer.Bytes.Reinterpret(1); - mesh.SetIndexBufferParams(intIndices.Length, IndexFormat.UInt32); - mesh.SetIndexBufferData(intIndices, 0, 0, intIndices.Length); - break; + { + var intIndices = src.IndexBuffer.Bytes.Reinterpret(1); + mesh.SetIndexBufferParams(intIndices.Length, IndexFormat.UInt32); + mesh.SetIndexBufferData(intIndices, 0, 0, intIndices.Length); + break; + } default: throw new NotImplementedException(); }