From 828e018afaaa2fd1d3dfa90cfa842c2c87a81924 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Fri, 8 Oct 2021 14:49:39 +0900 Subject: [PATCH] =?UTF-8?q?bin=20chunk=20=E3=81=AF=20[1]=E3=80=82=20field?= =?UTF-8?q?=20=E3=81=AE=E9=A0=86=E7=95=AA=E3=82=92=E6=95=B4=E7=90=86?= =?UTF-8?q?=E3=80=82GLB=20=E4=BB=95=E6=A7=98=E3=81=AB=E9=96=A2=E3=81=99?= =?UTF-8?q?=E3=82=8B=E3=82=B3=E3=83=A1=E3=83=B3=E3=83=88=E3=82=92=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/UniGLTF/Runtime/UniGLTF/IO/GltfData.cs | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/GltfData.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/GltfData.cs index 8196458d5..a1fb057e9 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/GltfData.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/GltfData.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; namespace UniGLTF { @@ -12,27 +11,33 @@ namespace UniGLTF /// public string TargetPath { get; } - /// - /// JSON source - /// - public string Json { get; } - - /// - /// GLTF parsed from JSON - /// - public glTF GLTF { get; } - /// /// Chunk Data. /// Maybe empty if source file was not glb format. + /// https://www.khronos.org/registry/glTF/specs/2.0/glTF-2.0.html#chunks + /// [0] must JSON + /// [1] must BIN + /// [2...] may exists. /// public IReadOnlyList Chunks { get; } /// - /// Bin chunk bytes + /// JSON chunk ToString + /// > This chunk MUST be the very first chunk of Binary glTF asset + /// + public string Json { get; } + + /// + /// GLTF parsed from JSON chunk + /// + public glTF GLTF { get; } + + /// + /// BIN chunk + /// > This chunk MUST be the second chunk of the Binary glTF asset /// /// - public ArraySegment Bin => Chunks.First(x => x.ChunkType == GlbChunkType.BIN).Bytes; + public ArraySegment Bin => Chunks[1].Bytes; /// /// URI access