bin chunk は [1]。 field の順番を整理。GLB 仕様に関するコメントを追加。

This commit is contained in:
ousttrue 2021-10-08 14:49:39 +09:00
parent 2adbb21f7b
commit 828e018afa

View File

@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace UniGLTF
{
@ -12,27 +11,33 @@ namespace UniGLTF
/// </summary>
public string TargetPath { get; }
/// <summary>
/// JSON source
/// </summary>
public string Json { get; }
/// <summary>
/// GLTF parsed from JSON
/// </summary>
public glTF GLTF { get; }
/// <summary>
/// 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.
/// </summary>
public IReadOnlyList<GlbChunk> Chunks { get; }
/// <summary>
/// Bin chunk bytes
/// JSON chunk ToString
/// > This chunk MUST be the very first chunk of Binary glTF asset
/// </summary>
public string Json { get; }
/// <summary>
/// GLTF parsed from JSON chunk
/// </summary>
public glTF GLTF { get; }
/// <summary>
/// BIN chunk
/// > This chunk MUST be the second chunk of the Binary glTF asset
/// </summary>
/// <returns></returns>
public ArraySegment<byte> Bin => Chunks.First(x => x.ChunkType == GlbChunkType.BIN).Bytes;
public ArraySegment<byte> Bin => Chunks[1].Bytes;
/// <summary>
/// URI access