Accessor

@Serializable
data class Accessor(var name: String? = null, val bufferView: Int = 0, val byteOffset: Int = 0, val componentType: Int = 0, val normalized: Boolean = false, val count: Int = 1, val min: FloatArray = FloatArray(0), val max: FloatArray = FloatArray(0), val type: GLTF2.AccessorType = AccessorType.SCALAR, val sparse: JsonElement? = null, val extensions: JsonElement? = null, val extras: JsonElement? = null) : GLTFProperty

https://github.com/KhronosGroup/glTF/blob/main/specification/2.0/schema/accessor.schema.json

Constructors

Link copied to clipboard
constructor(name: String? = null, bufferView: Int = 0, byteOffset: Int = 0, componentType: Int = 0, normalized: Boolean = false, count: Int = 1, min: FloatArray = FloatArray(0), max: FloatArray = FloatArray(0), type: GLTF2.AccessorType = AccessorType.SCALAR, sparse: JsonElement? = null, extensions: JsonElement? = null, extras: JsonElement? = null)

Properties

Link copied to clipboard
Link copied to clipboard
val bufferView: Int = 0

The index of the buffer view. When undefined, the accessor MUST be initialized with zeros; sparse property or extensions MAY override zeros with actual values.

Link copied to clipboard
val byteOffset: Int = 0

The offset relative to the start of the buffer view in bytes.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The datatype of the accessor's components. UNSIGNED_INT type MUST NOT be used for any accessor that is not referenced by mesh.primitive.indices. type parameter of vertexAttribPointer(). The corresponding typed arrays are Int8Array, Uint8Array, Int16Array, Uint16Array, Uint32Array, and Float32Array.

Link copied to clipboard
val count: Int = 1

The number of elements referenced by this accessor, not to be confused with the number of bytes or number of components.

Link copied to clipboard
open override val extensions: JsonElement? = null

JSON object with extension-specific objects.

Link copied to clipboard
open override val extras: JsonElement? = null

Although extras MAY have any type, it is common for applications to store and access custom data as key/value pairs. Therefore, extras SHOULD be a JSON object rather than a primitive value for best portability.

Link copied to clipboard

Maximum value of each component in this accessor.

Link copied to clipboard

Minimum value of each component in this accessor.

Link copied to clipboard
open override var name: String?
Link copied to clipboard
Link copied to clipboard
val normalized: Boolean = false

Specifies whether integer data values are normalized before usage."

Link copied to clipboard
val sparse: JsonElement? = null
Link copied to clipboard

Specifies if the accessor's elements are scalars, vectors, or matrices.

Link copied to clipboard

Functions

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun bufferSlice(gltf: GLTF2): Buffer
Link copied to clipboard
Link copied to clipboard
fun VarType.Companion.gen(kind: VarKind, ncomponent: Int, type: GLTF2.AccessorType): VarType