set indexFormat

This commit is contained in:
ousttrue 2021-11-11 18:31:16 +09:00
parent 0e997d4162
commit 77cc07f3d9
2 changed files with 8 additions and 0 deletions

View File

@ -16,6 +16,10 @@ namespace UniVRM10
{
// submesh 方式
var mesh = new UnityEngine.Mesh();
if (src.IndexBuffer.Count > UInt16.MaxValue)
{
mesh.indexFormat = UnityEngine.Rendering.IndexFormat.UInt32;
}
mesh.vertices = src.VertexBuffer.Positions.GetSpan<Vector3>().ToArray();
mesh.normals = src.VertexBuffer.Normals?.GetSpan<Vector3>().ToArray();

View File

@ -10,6 +10,10 @@ namespace UniVRM10
public static UnityEngine.Mesh LoadDivided(VrmLib.MeshGroup src)
{
var dst = new UnityEngine.Mesh();
if (src.Meshes.Sum(x => x.IndexBuffer.Count) > ushort.MaxValue)
{
dst.indexFormat = UnityEngine.Rendering.IndexFormat.UInt32;
}
//
// vertices