Files
AR-Menu/Library/PackageCache/com.unity.cloud.gltfast@db5a82ec0b47/Runtime/Scripts/Schema/AccessorSparseIndices.cs
2025-11-30 08:35:03 +02:00

46 lines
1.4 KiB
C#

// SPDX-FileCopyrightText: 2023 Unity Technologies and the glTFast authors
// SPDX-License-Identifier: Apache-2.0
namespace GLTFast.Schema
{
/// <summary>
/// Sparse indices property of a glTF
/// </summary>
/// <seealso cref="AccessorSparse"/>
[System.Serializable]
public class AccessorSparseIndices
{
/// <summary>
/// The index of the bufferView with sparse indices.
/// Referenced bufferView can't have ARRAY_BUFFER or ELEMENT_ARRAY_BUFFER target.
/// </summary>
public uint bufferView;
/// <summary>
/// The offset relative to the start of the bufferView in bytes. Must be aligned.
/// </summary>
public int byteOffset;
/// <summary>
/// The indices data type. Valid values correspond to WebGL enums:
/// `5121` (UNSIGNED_BYTE)
/// `5123` (UNSIGNED_SHORT)
/// `5125` (UNSIGNED_INT)
/// </summary>
public GltfComponentType componentType;
internal void GltfSerialize(JsonWriter writer)
{
writer.AddObject();
writer.AddProperty("bufferView", bufferView);
writer.AddProperty("componentType", componentType);
if (byteOffset >= 0)
{
writer.AddProperty("byteOffset", byteOffset);
}
writer.Close();
}
}
}