From 87e13d9bb05acfee925456ea930b368f8a65da2d Mon Sep 17 00:00:00 2001 From: ousttrue Date: Thu, 13 May 2021 18:43:00 +0900 Subject: [PATCH 1/2] fixMagFiler --- .../IO/TextureIO/TextureSamplerUtil.cs | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/TextureIO/TextureSamplerUtil.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/TextureIO/TextureSamplerUtil.cs index 5a3bea1ae..19f699377 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/TextureIO/TextureSamplerUtil.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/TextureIO/TextureSamplerUtil.cs @@ -8,7 +8,24 @@ namespace UniGLTF public static class TextureSamplerUtil { #region Export - public static glFilter ExportFilterMode(Texture texture) + // MagFilter は 2種類だけ + public static glFilter ExportMagFilter(Texture texture) + { + switch (texture.filterMode) + { + case FilterMode.Point: + return glFilter.NEAREST; + + case FilterMode.Bilinear: + case FilterMode.Trilinear: + return glFilter.LINEAR; + + default: + throw new NotImplementedException(); + } + } + + public static glFilter ExportMinFilter(Texture texture) { switch (texture.filterMode) { @@ -68,13 +85,14 @@ namespace UniGLTF public static glTFTextureSampler Export(Texture texture) { - var filter = ExportFilterMode(texture); + var magFilter = ExportMagFilter(texture); + var minFilter = ExportMinFilter(texture); var wrapS = ExportWrapMode(GetWrapS(texture)); var wrapT = ExportWrapMode(GetWrapT(texture)); return new glTFTextureSampler { - magFilter = filter, - minFilter = filter, + magFilter = magFilter, + minFilter = minFilter, wrapS = wrapS, wrapT = wrapT, }; From d9f011dd9c4639f0e975e39e629448bbe3cf0a8c Mon Sep 17 00:00:00 2001 From: ousttrue Date: Thu, 13 May 2021 18:57:16 +0900 Subject: [PATCH 2/2] =?UTF-8?q?fix=20min,=20max=20for=20DIVIDE=5FVERTEX=5F?= =?UTF-8?q?BUFFER=E3=80=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/UniGLTF/Runtime/UniGLTF/IO/MeshExportUtil.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshExportUtil.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshExportUtil.cs index 82a1c659d..19bd410da 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshExportUtil.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshExportUtil.cs @@ -33,6 +33,9 @@ namespace UniGLTF public gltfMorphTarget ToGltf(glTF gltf, int bufferIndex, bool useNormal) { var positionAccessorIndex = gltf.ExtendBufferAndGetAccessorIndex(bufferIndex, m_positions.ToArray(), glBufferTarget.ARRAY_BUFFER); + gltf.accessors[positionAccessorIndex].min = m_positions.Aggregate(m_positions[0], (a, b) => new Vector3(Mathf.Min(a.x, b.x), Math.Min(a.y, b.y), Mathf.Min(a.z, b.z))).ToArray(); + gltf.accessors[positionAccessorIndex].max = m_positions.Aggregate(m_positions[0], (a, b) => new Vector3(Mathf.Max(a.x, b.x), Math.Max(a.y, b.y), Mathf.Max(a.z, b.z))).ToArray(); + var normalAccessorIndex = -1; if (useNormal) {