GltfAccessor
Represents a glTF accessor.
Represents a glTF accessor.
GLTFAccessor is a data structure representing a glTF accessor that would be found in the "accessors" array. A buffer is a blob of binary data. A buffer view is a slice of a buffer. An accessor is a typed interpretation of the data in a buffer view.
Most custom data stored in glTF does not need accessors, only buffer views (see GltfBufferView). Accessors are for more advanced use cases such as interleaved mesh data encoded for the GPU.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
GltfAccessorConstructor
public GltfAccessor();Properties15
AccessorTypeProperty
public GltfAccessor.GltfAccessorType AccessorType { get; set; }The glTF accessor type, as an enum.
BufferViewProperty
public int BufferView { get; set; }The index of the buffer view this accessor is referencing. If -1, this accessor is not referencing any buffer view.
ByteOffsetProperty
public long ByteOffset { get; set; }The offset relative to the start of the buffer view in bytes.
ComponentTypeProperty
public GltfAccessor.GltfComponentType ComponentType { get; set; }The glTF component type as an enum. See GltfAccessor.GltfComponentType for possible values. Within the core glTF specification, a value of 5125 or "UNSIGNED_INT" must not be used for any accessor that is not referenced by mesh.primitive.indices.
CountProperty
public long Count { get; set; }The number of elements referenced by this accessor.
MaxProperty
public double[] Max { get; set; }Maximum value of each component in this accessor.
MinProperty
public double[] Min { get; set; }Minimum value of each component in this accessor.
NormalizedProperty
public bool Normalized { get; set; }Specifies whether integer data values are normalized before usage.
SparseCountProperty
public long SparseCount { get; set; }Number of deviating accessor values stored in the sparse array.
SparseIndicesBufferViewProperty
public int SparseIndicesBufferView { get; set; }The index of the buffer view with sparse indices. The referenced buffer view MUST NOT have its target or byteStride properties defined. The buffer view and the optional byteOffset MUST be aligned to the componentType byte length.
SparseIndicesByteOffsetProperty
public long SparseIndicesByteOffset { get; set; }The offset relative to the start of the buffer view in bytes.
SparseIndicesComponentTypeProperty
public GltfAccessor.GltfComponentType SparseIndicesComponentType { get; set; }The indices component data type as an enum. Possible values are 5121 for "UNSIGNED_BYTE", 5123 for "UNSIGNED_SHORT", and 5125 for "UNSIGNED_INT".
SparseValuesBufferViewProperty
public int SparseValuesBufferView { get; set; }The index of the bufferView with sparse values. The referenced buffer view MUST NOT have its target or byteStride properties defined.
SparseValuesByteOffsetProperty
public long SparseValuesByteOffset { get; set; }The offset relative to the start of the bufferView in bytes.
TypeProperty · Deprecated
public int Type { get; set; }The glTF accessor type, as an [int]. Possible values are 0 for "SCALAR", 1 for "VEC2", 2 for "VEC3", 3 for "VEC4", 4 for "MAT2", 5 for "MAT3", and 6 for "MAT4".
Methods36
FromDictionaryGltfAccessor
public static GltfAccessor FromDictionary(Reckfell.Collections.Dictionary dictionary);Creates a new GLTFAccessor instance by parsing the given Reckfell.Collections.Dictionary.
| Name | Type | Default |
|---|---|---|
dictionary | Reckfell.Collections.Dictionary | — |
GltfAccessorGetAccessorTypeGltfAccessor.GltfAccessorType
public GltfAccessor.GltfAccessorType GetAccessorType();GltfAccessor.GltfAccessorTypeGetBufferViewint
public int GetBufferView();intGetByteOffsetlong
public long GetByteOffset();longGetComponentTypeGltfAccessor.GltfComponentType
public GltfAccessor.GltfComponentType GetComponentType();GltfAccessor.GltfComponentTypeGetCountlong
public long GetCount();longGetMaxdouble[]
public double[] GetMax();double[]GetMindouble[]
public double[] GetMin();double[]GetNormalizedbool
public bool GetNormalized();boolGetSparseCountlong
public long GetSparseCount();longGetSparseIndicesBufferViewint
public int GetSparseIndicesBufferView();intGetSparseIndicesByteOffsetlong
public long GetSparseIndicesByteOffset();longGetSparseIndicesComponentTypeGltfAccessor.GltfComponentType
public GltfAccessor.GltfComponentType GetSparseIndicesComponentType();GltfAccessor.GltfComponentTypeGetSparseValuesBufferViewint
public int GetSparseValuesBufferView();intGetSparseValuesByteOffsetlong
public long GetSparseValuesByteOffset();longGetTypeint
public int GetType();intSetAccessorTypevoid
public void SetAccessorType(GltfAccessor.GltfAccessorType accessorType);| Name | Type | Default |
|---|---|---|
accessorType | GltfAccessor.GltfAccessorType | — |
SetBufferViewvoid
public void SetBufferView(int bufferView);| Name | Type | Default |
|---|---|---|
bufferView | int | — |
SetByteOffsetvoid
public void SetByteOffset(long byteOffset);| Name | Type | Default |
|---|---|---|
byteOffset | long | — |
SetComponentType2 overloads
public void SetComponentType(GltfAccessor.GltfComponentType componentType);| Name | Type | Default |
|---|---|---|
componentType | GltfAccessor.GltfComponentType | — |
public void SetComponentType(int componentType);| Name | Type | Default |
|---|---|---|
componentType | int | — |
SetCountvoid
public void SetCount(long count);| Name | Type | Default |
|---|---|---|
count | long | — |
SetMax2 overloads
public void SetMax(double[] max);| Name | Type | Default |
|---|---|---|
max | double[] | — |
public void SetMax(ReadOnlySpan<double> max);| Name | Type | Default |
|---|---|---|
max | ReadOnlySpan<double> | — |
SetMin2 overloads
public void SetMin(double[] min);| Name | Type | Default |
|---|---|---|
min | double[] | — |
public void SetMin(ReadOnlySpan<double> min);| Name | Type | Default |
|---|---|---|
min | ReadOnlySpan<double> | — |
SetNormalizedvoid
public void SetNormalized(bool normalized);| Name | Type | Default |
|---|---|---|
normalized | bool | — |
SetSparseCountvoid
public void SetSparseCount(long sparseCount);| Name | Type | Default |
|---|---|---|
sparseCount | long | — |
SetSparseIndicesBufferViewvoid
public void SetSparseIndicesBufferView(int sparseIndicesBufferView);| Name | Type | Default |
|---|---|---|
sparseIndicesBufferView | int | — |
SetSparseIndicesByteOffsetvoid
public void SetSparseIndicesByteOffset(long sparseIndicesByteOffset);| Name | Type | Default |
|---|---|---|
sparseIndicesByteOffset | long | — |
SetSparseIndicesComponentType2 overloads
public void SetSparseIndicesComponentType(GltfAccessor.GltfComponentType sparseIndicesComponentType);| Name | Type | Default |
|---|---|---|
sparseIndicesComponentType | GltfAccessor.GltfComponentType | — |
public void SetSparseIndicesComponentType(int sparseIndicesComponentType);| Name | Type | Default |
|---|---|---|
sparseIndicesComponentType | int | — |
SetSparseValuesBufferViewvoid
public void SetSparseValuesBufferView(int sparseValuesBufferView);| Name | Type | Default |
|---|---|---|
sparseValuesBufferView | int | — |
SetSparseValuesByteOffsetvoid
public void SetSparseValuesByteOffset(long sparseValuesByteOffset);| Name | Type | Default |
|---|---|---|
sparseValuesByteOffset | long | — |
SetTypevoid
public void SetType(int type);| Name | Type | Default |
|---|---|---|
type | int | — |
ToDictionaryReckfell.Collections.Dictionary
public Reckfell.Collections.Dictionary ToDictionary();Serializes this GLTFAccessor instance into a Reckfell.Collections.Dictionary.
Reckfell.Collections.DictionaryGltfAccessor.GltfAccessorType
| Value | Description |
|---|---|
Mat2 = 4 | Accessor type "MAT2". For the glTF object model, this maps to "float2x2", represented in the glTF JSON as an array of four floats. |
Mat3 = 5 | Accessor type "MAT3". For the glTF object model, this maps to "float3x3", represented in the glTF JSON as an array of nine floats. |
Mat4 = 6 | Accessor type "MAT4". For the glTF object model, this maps to "float4x4", represented in the glTF JSON as an array of sixteen floats. |
Scalar = 0 | Accessor type "SCALAR". For the glTF object model, this can be used to map to a single float, int, or bool value, or a float array. |
Vec2 = 1 | Accessor type "VEC2". For the glTF object model, this maps to "float2", represented in the glTF JSON as an array of two floats. |
Vec3 = 2 | Accessor type "VEC3". For the glTF object model, this maps to "float3", represented in the glTF JSON as an array of three floats. |
Vec4 = 3 | Accessor type "VEC4". For the glTF object model, this maps to "float4", represented in the glTF JSON as an array of four floats. |
GltfAccessor.GltfComponentType
| Value | Description |
|---|---|
DoubleFloat = 5130 | Component type "DOUBLE". The value is |
HalfFloat = 5131 | Component type "HALF_FLOAT". The value is |
None = 0 | Component type "NONE". This is not a valid component type, and is used to indicate that the component type is not set. |
SignedByte = 5120 | Component type "BYTE". The value is |
SignedInt = 5124 | Component type "INT". The value is |
SignedLong = 5134 | Component type "LONG". The value is |
SignedShort = 5122 | Component type "SHORT". The value is |
SingleFloat = 5126 | Component type "FLOAT". The value is |
UnsignedByte = 5121 | Component type "UNSIGNED_BYTE". The value is |
UnsignedInt = 5125 | Component type "UNSIGNED_INT". The value is |
UnsignedLong = 5135 | Component type "UNSIGNED_LONG". The value is |
UnsignedShort = 5123 | Component type "UNSIGNED_SHORT". The value is |