GLTFAccessor

package
v0.0.0-...-357ca8a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2025 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

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.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Advanced

type Advanced = class

Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.

type Any

type Any interface {
	gd.IsClass
	AsGLTFAccessor() Instance
}

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension

func (*Extension[T]) AsGLTFAccessor

func (self *Extension[T]) AsGLTFAccessor() Instance

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

func (*Extension[T]) AsRefCounted

func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted

func (*Extension[T]) AsResource

func (self *Extension[T]) AsResource() Resource.Instance

type GLTFAccessorType

type GLTFAccessorType int //gd:GLTFAccessor.GLTFAccessorType
const (
	// 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.
	TypeScalar GLTFAccessorType = 0
	// Accessor type "VEC2". For the glTF object model, this maps to "float2", represented in the glTF JSON as an array of two floats.
	TypeVec2 GLTFAccessorType = 1
	// Accessor type "VEC3". For the glTF object model, this maps to "float3", represented in the glTF JSON as an array of three floats.
	TypeVec3 GLTFAccessorType = 2
	// Accessor type "VEC4". For the glTF object model, this maps to "float4", represented in the glTF JSON as an array of four floats.
	TypeVec4 GLTFAccessorType = 3
	// Accessor type "MAT2". For the glTF object model, this maps to "float2x2", represented in the glTF JSON as an array of four floats.
	TypeMat2 GLTFAccessorType = 4
	// Accessor type "MAT3". For the glTF object model, this maps to "float3x3", represented in the glTF JSON as an array of nine floats.
	TypeMat3 GLTFAccessorType = 5
	// Accessor type "MAT4". For the glTF object model, this maps to "float4x4", represented in the glTF JSON as an array of sixteen floats.
	TypeMat4 GLTFAccessorType = 6
)

type GLTFComponentType

type GLTFComponentType int //gd:GLTFAccessor.GLTFComponentType
const (
	// Component type "NONE". This is not a valid component type, and is used to indicate that the component type is not set.
	ComponentTypeNone GLTFComponentType = 0
	// Component type "BYTE". The value is 0x1400 which comes from OpenGL. This indicates data is stored in 1-byte or 8-bit signed integers. This is a core part of the glTF specification.
	ComponentTypeSignedByte GLTFComponentType = 5120
	// Component type "UNSIGNED_BYTE". The value is 0x1401 which comes from OpenGL. This indicates data is stored in 1-byte or 8-bit unsigned integers. This is a core part of the glTF specification.
	ComponentTypeUnsignedByte GLTFComponentType = 5121
	// Component type "SHORT". The value is 0x1402 which comes from OpenGL. This indicates data is stored in 2-byte or 16-bit signed integers. This is a core part of the glTF specification.
	ComponentTypeSignedShort GLTFComponentType = 5122
	// Component type "UNSIGNED_SHORT". The value is 0x1403 which comes from OpenGL. This indicates data is stored in 2-byte or 16-bit unsigned integers. This is a core part of the glTF specification.
	ComponentTypeUnsignedShort GLTFComponentType = 5123
	// Component type "INT". The value is 0x1404 which comes from OpenGL. This indicates data is stored in 4-byte or 32-bit signed integers. This is NOT a core part of the glTF specification, and may not be supported by all glTF importers. May be used by some extensions including KHR_interactivity.
	ComponentTypeSignedInt GLTFComponentType = 5124
	// Component type "UNSIGNED_INT". The value is 0x1405 which comes from OpenGL. This indicates data is stored in 4-byte or 32-bit unsigned integers. This is a core part of the glTF specification.
	ComponentTypeUnsignedInt GLTFComponentType = 5125
	// Component type "FLOAT". The value is 0x1406 which comes from OpenGL. This indicates data is stored in 4-byte or 32-bit floating-point numbers. This is a core part of the glTF specification.
	ComponentTypeSingleFloat GLTFComponentType = 5126
	// Component type "DOUBLE". The value is 0x140A which comes from OpenGL. This indicates data is stored in 8-byte or 64-bit floating-point numbers. This is NOT a core part of the glTF specification, and may not be supported by all glTF importers. May be used by some extensions including KHR_interactivity.
	ComponentTypeDoubleFloat GLTFComponentType = 5130
	// Component type "HALF_FLOAT". The value is 0x140B which comes from OpenGL. This indicates data is stored in 2-byte or 16-bit floating-point numbers. This is NOT a core part of the glTF specification, and may not be supported by all glTF importers. May be used by some extensions including KHR_interactivity.
	ComponentTypeHalfFloat GLTFComponentType = 5131
	// Component type "LONG". The value is 0x140E which comes from OpenGL. This indicates data is stored in 8-byte or 64-bit signed integers. This is NOT a core part of the glTF specification, and may not be supported by all glTF importers. May be used by some extensions including KHR_interactivity.
	ComponentTypeSignedLong GLTFComponentType = 5134
	// Component type "UNSIGNED_LONG". The value is 0x140F which comes from OpenGL. This indicates data is stored in 8-byte or 64-bit unsigned integers. This is NOT a core part of the glTF specification, and may not be supported by all glTF importers. May be used by some extensions including KHR_interactivity.
	ComponentTypeUnsignedLong GLTFComponentType = 5135
)

type ID

type ID Object.ID

ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Instance

type Instance [1]gdclass.GLTFAccessor

Instance of the class with convieniently typed arguments and results.

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AccessorType

func (self Instance) AccessorType() GLTFAccessorType

The glTF accessor type, as an enum.

func (Instance) AsGLTFAccessor

func (self Instance) AsGLTFAccessor() Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsRefCounted

func (self Instance) AsRefCounted() [1]gd.RefCounted

func (Instance) AsResource

func (self Instance) AsResource() Resource.Instance

func (Instance) BufferView

func (self Instance) BufferView() int

The index of the buffer view this accessor is referencing. If -1, this accessor is not referencing any buffer view.

func (Instance) ByteOffset

func (self Instance) ByteOffset() int

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

func (Instance) ComponentType

func (self Instance) ComponentType() GLTFComponentType

The glTF component type as an enum. See 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.

func (Instance) Count

func (self Instance) Count() int

The number of elements referenced by this accessor.

func (Instance) ID

func (self Instance) ID() ID

func (Instance) Max

func (self Instance) Max() []float64

Maximum value of each component in this accessor.

func (Instance) Min

func (self Instance) Min() []float64

Minimum value of each component in this accessor.

func (Instance) Normalized

func (self Instance) Normalized() bool

Specifies whether integer data values are normalized before usage.

func (Instance) SetAccessorType

func (self Instance) SetAccessorType(value GLTFAccessorType)

SetAccessorType sets the property returned by [GetAccessorType].

func (Instance) SetBufferView

func (self Instance) SetBufferView(value int)

SetBufferView sets the property returned by [GetBufferView].

func (Instance) SetByteOffset

func (self Instance) SetByteOffset(value int)

SetByteOffset sets the property returned by [GetByteOffset].

func (Instance) SetComponentType

func (self Instance) SetComponentType(value GLTFComponentType)

SetComponentType sets the property returned by [GetComponentType].

func (Instance) SetCount

func (self Instance) SetCount(value int)

SetCount sets the property returned by [GetCount].

func (Instance) SetMax

func (self Instance) SetMax(value []float64)

SetMax sets the property returned by [GetMax].

func (Instance) SetMin

func (self Instance) SetMin(value []float64)

SetMin sets the property returned by [GetMin].

func (Instance) SetNormalized

func (self Instance) SetNormalized(value bool)

SetNormalized sets the property returned by [GetNormalized].

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) SetSparseCount

func (self Instance) SetSparseCount(value int)

SetSparseCount sets the property returned by [GetSparseCount].

func (Instance) SetSparseIndicesBufferView

func (self Instance) SetSparseIndicesBufferView(value int)

SetSparseIndicesBufferView sets the property returned by [GetSparseIndicesBufferView].

func (Instance) SetSparseIndicesByteOffset

func (self Instance) SetSparseIndicesByteOffset(value int)

SetSparseIndicesByteOffset sets the property returned by [GetSparseIndicesByteOffset].

func (Instance) SetSparseIndicesComponentType

func (self Instance) SetSparseIndicesComponentType(value GLTFComponentType)

SetSparseIndicesComponentType sets the property returned by [GetSparseIndicesComponentType].

func (Instance) SetSparseValuesBufferView

func (self Instance) SetSparseValuesBufferView(value int)

SetSparseValuesBufferView sets the property returned by [GetSparseValuesBufferView].

func (Instance) SetSparseValuesByteOffset

func (self Instance) SetSparseValuesByteOffset(value int)

SetSparseValuesByteOffset sets the property returned by [GetSparseValuesByteOffset].

func (Instance) SetType

func (self Instance) SetType(value int)

SetType sets the property returned by [GetType].

func (Instance) SparseCount

func (self Instance) SparseCount() int

Number of deviating accessor values stored in the sparse array.

func (Instance) SparseIndicesBufferView

func (self Instance) SparseIndicesBufferView() int

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.

func (Instance) SparseIndicesByteOffset

func (self Instance) SparseIndicesByteOffset() int

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

func (Instance) SparseIndicesComponentType

func (self Instance) SparseIndicesComponentType() GLTFComponentType

The indices component data type as an enum. Possible values are 5121 for "UNSIGNED_BYTE", 5123 for "UNSIGNED_SHORT", and 5125 for "UNSIGNED_INT".

func (Instance) SparseValuesBufferView

func (self Instance) SparseValuesBufferView() int

The index of the bufferView with sparse values. The referenced buffer view MUST NOT have its target or byteStride properties defined.

func (Instance) SparseValuesByteOffset

func (self Instance) SparseValuesByteOffset() int

The offset relative to the start of the bufferView in bytes.

func (Instance) Type

func (self Instance) Type() int

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".

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL