Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

GLTFBufferView

繼承: Resource < RefCounted < Object

代表 glTF 緩衝區檢視。

說明

GLTFBufferView 是一種表示 glTF 緩衝區檢視 bufferView 的資料結構,可以在 "bufferViews" 陣列中找到。緩衝區是二進位資料塊。緩衝區檢視是緩衝區的切片,可用於識別緩衝區並從緩衝區中提取資料。

大多數緩衝區的自訂用途只需要使用 buffer、byte_length 和 byte_offset。byte_stride 和 indices 屬性適用於更進階的用例,例如為 GPU 編碼的交錯網格資料。

教學

屬性

int

buffer

-1

int

byte_length

0

int

byte_offset

0

int

byte_stride

-1

bool

indices

false

bool

vertex_attributes

false

方法

GLTFBufferView

from_dictionary(dictionary: Dictionary) static

PackedByteArray

load_buffer_view_data(state: GLTFState) const

Dictionary

to_dictionary() const


屬性說明

int buffer = -1 🔗

  • void set_buffer(value: int)

  • int get_buffer()

這個緩衝檢視所參照的緩衝索引。如果為 -1,則這個緩衝檢視並沒有參照任何緩衝。


int byte_length = 0 🔗

  • void set_byte_length(value: int)

  • int get_byte_length()

這個緩衝檢視的長度,單位為位元組。如果為 0,則這個緩衝檢視為空。


int byte_offset = 0 🔗

  • void set_byte_offset(value: int)

  • int get_byte_offset()

這個緩衝檢視的起點相對於緩衝起點的偏移量,單位為位元組。


int byte_stride = -1 🔗

  • void set_byte_stride(value: int)

  • int get_byte_stride()

交錯資料的步幅,單位為位元組。如果為 -1,則這個緩衝檢視不是交錯的。


bool indices = false 🔗

  • void set_indices(value: bool)

  • bool get_indices()

如果 GLTFBufferView 的 OpenGL GPU 緩衝區型別是用於頂點索引的 ELEMENT_ARRAY_BUFFER(整數常數 34963),則為 true。如果該緩衝區型別是任何其他值,則為 false。有關可能的值,請參閱 Buffers、BufferViews 和 Accessors。該屬性在匯入時設定,並在匯出時使用。


bool vertex_attributes = false 🔗

  • void set_vertex_attributes(value: bool)

  • bool get_vertex_attributes()

如果 GLTFBufferView 的 OpenGL GPU 緩衝區型別是用於頂點屬性的 ARRAY_BUFFER(整數常數 34962),則為 true。如果該緩衝區型別是任何其他值,則為 false。有關可能的值,請參閱 Buffers、BufferViews 和 Accessors。該屬性在匯入時設定,在匯出時使用。


方法說明

GLTFBufferView from_dictionary(dictionary: Dictionary) static 🔗

通過解析給定的 Dictionary 新建 GLTFBufferView 實例。


PackedByteArray load_buffer_view_data(state: GLTFState) const 🔗

從給定 GLTFState 中該緩衝區檢視參照的緩衝區載入緩衝區檢視資料。該方法尚不支援具有位元組步幅的交錯資料。資料以 PackedByteArray 形式回傳。


Dictionary to_dictionary() const 🔗

將這個 GLTFBufferView 實例序列化為 Dictionary。