From df7870389cce172c622f457cf4f62d50138d61ee Mon Sep 17 00:00:00 2001 From: ousttrue Date: Tue, 23 Mar 2021 16:47:54 +0900 Subject: [PATCH] KHR_mesh_quantization is not supported --- .../Runtime/UniGLTF/IO/ImporterContext.cs | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/ImporterContext.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/ImporterContext.cs index 634f7cfdb..e815eb303 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/ImporterContext.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/ImporterContext.cs @@ -3,6 +3,7 @@ using System.Linq; using System.Collections.Generic; using UnityEngine; using System.Threading.Tasks; +using System.Text; namespace UniGLTF { @@ -76,6 +77,14 @@ namespace UniGLTF /// public Axises InvertAxis = Axises.Z; + public static List UnsupportedExtensions = new List + { + // https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_draco_mesh_compression + "KHR_draco_mesh_compression", + // https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_mesh_quantization + "KHR_mesh_quantization", + }; + #region Load. Build unity objects public virtual async Task LoadAsync(IAwaitCaller awaitCaller = null, Func MeasureTime = null) { @@ -97,11 +106,20 @@ namespace UniGLTF Root = new GameObject("GLTF"); } - // UniGLTF does not support draco - // https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_draco_mesh_compression/README.md#conformance - if (GLTF.extensionsRequired.Contains("KHR_draco_mesh_compression")) + if (GLTF.extensionsRequired != null) { - throw new UniGLTFNotSupportedException("draco is not supported"); + var sb = new List(); + foreach (var required in GLTF.extensionsRequired) + { + if (UnsupportedExtensions.Contains(required)) + { + sb.Add(required); + } + } + if (sb.Any()) + { + throw new UniGLTFNotSupportedException(string.Join(", ", sb) + " is not supported"); + } } using (MeasureTime("LoadMaterials"))