Skip to content

GLTFBufferView

Inherits: Resource < RefCounted < Object

Represents a glTF buffer view.

GLTFBufferView is a data structure representing a glTF bufferView that would be found in the "bufferViews" array. A buffer is a blob of binary data. A buffer view is a slice of a buffer that can be used to identify and extract data from the buffer.

Most custom uses of buffers only need to use the buffer, byte_length, and byte_offset. The byte_stride and indices properties are for more advanced use cases such as interleaved mesh data encoded for the GPU.

Type Name Default
int buffer -1
int byte_length 0
int byte_offset 0
int byte_stride -1
bool indices false
bool vertex_attributes false
Returns Method
GLTFBufferView from_dictionary(dictionary: Dictionary) static
PackedByteArray load_buffer_view_data(state: GLTFState) const
Dictionary to_dictionary() const

buffer

int buffer = -1

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

byte_length

int byte_length = 0

The length, in bytes, of this buffer view. If 0, this buffer view is empty.

byte_offset

int byte_offset = 0

The offset, in bytes, from the start of the buffer to the start of this buffer view.

byte_stride

int byte_stride = -1

The stride, in bytes, between interleaved data. If -1, this buffer view is not interleaved.

indices

bool indices = false

true if the GLTFBufferView’s OpenGL GPU buffer type is an ELEMENT_ARRAY_BUFFER used for vertex indices (integer constant 34963). false if the buffer type is any other value. See Buffers, BufferViews, and Accessors for possible values. This property is set on import and used on export.

vertex_attributes

bool vertex_attributes = false

true if the GLTFBufferView’s OpenGL GPU buffer type is an ARRAY_BUFFER used for vertex attributes (integer constant 34962). false if the buffer type is any other value. See Buffers, BufferViews, and Accessors for possible values. This property is set on import and used on export.

from_dictionary

GLTFBufferView from_dictionary(dictionary: Dictionary) static

Creates a new GLTFBufferView instance by parsing the given Dictionary.

load_buffer_view_data

PackedByteArray load_buffer_view_data(state: GLTFState) const

Loads the buffer view data from the buffer referenced by this buffer view in the given GLTFState. Interleaved data with a byte stride is not yet supported by this method. The data is returned as a PackedByteArray.

to_dictionary

Dictionary to_dictionary() const

Serializes this GLTFBufferView instance into a Dictionary.