Merge pull request #818 from ousttrue/fix/KHR_mesh_quantization_not_supported

KHR_mesh_quantization is not supported
This commit is contained in:
PoChang007 2021-03-22 22:54:09 -09:00 committed by GitHub
commit 0ece72dfb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
/// </summary>
public Axises InvertAxis = Axises.Z;
public static List<string> UnsupportedExtensions = new List<string>
{
// 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<string, IDisposable> 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<string>();
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"))