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.
Checking the stable version of the documentation...
GLTFAccessor
繼承: Resource < RefCounted < Object
代表 glTF 存取器。
說明
GLTFAccessor 是一種表示 glTF 存取器 "accessors" 的資料結構,可以在 "accessors" 陣列中找到。緩衝區是二進位資料塊。緩衝區檢視是緩衝區的切片。存取器是對緩衝區檢視中資料的型別化解釋。
大多數儲存在 glTF 中的自訂資料不需要存取器,只需要緩衝區檢視(見 GLTFBufferView)。存取器適用於更進階的用例,例如為 GPU 編碼的交錯網格資料。
教學
屬性
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
方法
from_dictionary(dictionary: Dictionary) static |
|
to_dictionary() const |
列舉
enum GLTFAccessorType: 🔗
GLTFAccessorType TYPE_SCALAR = 0
“SCALAR”存取器型別。在 glTF 物件模型中可映射為單個 float、int、bool 值或單個 float 陣列。
GLTFAccessorType TYPE_VEC2 = 1
“VEC2”存取器型別。在 glTF 物件模型中可映射為“float2”,在 glTF JSON 中表示為包含兩個 float 的陣列。
GLTFAccessorType TYPE_VEC3 = 2
“VEC3”存取器型別。在 glTF 物件模型中可映射為“float3”,在 glTF JSON 中表示為包含三個 float 的陣列。
GLTFAccessorType TYPE_VEC4 = 3
“VEC4”存取器型別。在 glTF 物件模型中可映射為“float4”,在 glTF JSON 中表示為包含四個 float 的陣列。
GLTFAccessorType TYPE_MAT2 = 4
“MAT2”存取器型別。在 glTF 物件模型中可映射為“float2x2”,在 glTF JSON 中表示為包含四個 float 的陣列。
GLTFAccessorType TYPE_MAT3 = 5
“MAT3”存取器型別。在 glTF 物件模型中可映射為“float3x3”,在 glTF JSON 中表示為包含九個 float 的陣列。
GLTFAccessorType TYPE_MAT4 = 6
“MAT4”存取器型別。在 glTF 物件模型中可映射為“float4x4”,在 glTF JSON 中表示為包含十六個 float 的陣列。
enum GLTFComponentType: 🔗
GLTFComponentType COMPONENT_TYPE_NONE = 0
元件型別“NONE”。這不是有效的元件型別,用於表示元件型別未設定。
GLTFComponentType COMPONENT_TYPE_SIGNED_BYTE = 5120
元件型別“BYTE”。取值 0x1400 來源於 OpenGL。表示資料的儲存形式為 1 位元組即 8 位元有符號整數。這是 glTF 規範的核心部分。
GLTFComponentType COMPONENT_TYPE_UNSIGNED_BYTE = 5121
元件型別“UNSIGNED_BYTE”。取值 0x1401 來源於 OpenGL。表示資料的儲存形式為 1 位元組即 8 位元無符號整數。這是 glTF 規範的核心部分。
GLTFComponentType COMPONENT_TYPE_SIGNED_SHORT = 5122
元件型別“SHORT”。取值 0x1402 來源於 OpenGL。表示資料的儲存形式為 2 位元組即 16 位元有符號整數。這是 glTF 規範的核心部分。
GLTFComponentType COMPONENT_TYPE_UNSIGNED_SHORT = 5123
元件型別“UNSIGNED_SHORT”。取值 0x1403 來源於 OpenGL。表示資料的儲存形式為 2 位元組即 16 位元無符號整數。這是 glTF 規範的核心部分。
GLTFComponentType COMPONENT_TYPE_SIGNED_INT = 5124
元件型別“INT”。取值 0x1404 來源於 OpenGL。表示資料的儲存形式為 4 位元組即 32 位元有符號整數。這不是 glTF 規範的核心部分,可能並不是所有 glTF 匯入器都支援。KHR_interactivity 等擴充可能支援。
GLTFComponentType COMPONENT_TYPE_UNSIGNED_INT = 5125
元件型別“UNSIGNED_INT”。取值 0x1405 來源於 OpenGL。表示資料的儲存形式為 4 位元組即 32 位元無符號整數。這是 glTF 規範的核心部分。
GLTFComponentType COMPONENT_TYPE_SINGLE_FLOAT = 5126
元件型別“FLOAT”。取值 0x1406 來源於 OpenGL。表示資料的儲存形式為 4 位元組即 32 位元浮點數。這是 glTF 規範的核心部分。
GLTFComponentType COMPONENT_TYPE_DOUBLE_FLOAT = 5130
元件型別“DOUBLE”。取值 0x140A 來源於 OpenGL。表示資料的儲存形式為 8 位元組即 64 位元浮點數。這不是 glTF 規範的核心部分,可能並不是所有 glTF 匯入器都支援。KHR_interactivity 等擴充可能支援。
GLTFComponentType COMPONENT_TYPE_HALF_FLOAT = 5131
元件型別“HALF_FLOAT”。取值 0x140B 來源於 OpenGL。表示資料的儲存形式為 2 位元組即 16 位元浮點數。這不是 glTF 規範的核心部分,可能並不是所有 glTF 匯入器都支援。KHR_interactivity 等擴充可能支援。
GLTFComponentType COMPONENT_TYPE_SIGNED_LONG = 5134
元件型別“LONG”。取值 0x140E 來源於 OpenGL。表示資料的儲存形式為 8 位元組即 64 位元有符號整數。這不是 glTF 規範的核心部分,可能並不是所有 glTF 匯入器都支援。KHR_interactivity 等擴充可能支援。
GLTFComponentType COMPONENT_TYPE_UNSIGNED_LONG = 5135
元件型別“UNSIGNED_LONG”。取值 0x140F 來源於 OpenGL。表示資料的儲存形式為 8 位元組即 64 位元無符號整數。這不是 glTF 規範的核心部分,可能並不是所有 glTF 匯入器都支援。KHR_interactivity 等擴充可能支援。
屬性說明
GLTFAccessorType accessor_type = 0 🔗
void set_accessor_type(value: GLTFAccessorType)
GLTFAccessorType get_accessor_type()
glTF 存取器型別列舉。
該存取器正在參照的緩衝區檢視的索引。如果為 -1,則該存取器未參照任何緩衝區檢視。
相對於緩衝檢視起點的偏移量,單位為位元組。
GLTFComponentType component_type = 0 🔗
void set_component_type(value: GLTFComponentType)
GLTFComponentType get_component_type()
glTF 元件型別列舉。可能的取值見 GLTFComponentType。核心 glTF 規格中,未通過 mesh.primitive.indices 參照的存取器不能使用 5125 或“UNSIGNED_INT”。
該存取器參照的元素數量。
PackedFloat64Array max = PackedFloat64Array() 🔗
void set_max(value: PackedFloat64Array)
PackedFloat64Array get_max()
該存取器中每個元件的最大值。
Note: The returned array is copied and any changes to it will not update the original property value. See PackedFloat64Array for more details.
PackedFloat64Array min = PackedFloat64Array() 🔗
void set_min(value: PackedFloat64Array)
PackedFloat64Array get_min()
該存取器中每個元件的最小值。
Note: The returned array is copied and any changes to it will not update the original property value. See PackedFloat64Array for more details.
指定整數資料值在使用前是否進行了正規化。
儲存在稀疏陣列中的偏差存取器值的數量。
int sparse_indices_buffer_view = 0 🔗
具有稀疏索引的緩衝檢視的索引。參照的緩衝檢視不得定義其 target 或 byteStride 屬性。緩衝檢視和可選的 byteOffset 必須與 componentType 位元組長度對齊。
int sparse_indices_byte_offset = 0 🔗
相對於緩衝檢視起點的偏移量,單位為位元組。
GLTFComponentType sparse_indices_component_type = 0 🔗
void set_sparse_indices_component_type(value: GLTFComponentType)
GLTFComponentType get_sparse_indices_component_type()
索引元件資料型別列舉。取值 5121 為“UNSIGNED_BYTE”、5123 為“UNSIGNED_SHORT”、5125 為“UNSIGNED_INT”。
int sparse_values_buffer_view = 0 🔗
具有稀疏值的 bufferView 的索引。參照的緩衝檢視不得定義其 target 或 byteStride 屬性。
int sparse_values_byte_offset = 0 🔗
相對於 bufferView 起始位置的偏移量,單位為位元組。
已棄用: Use accessor_type instead.
glTF 存取器型別 int。取值為 0 表示“SCALAR”、1 表示“VEC2”、2 表示“VEC3”、3 表示“VEC4”、4 表示“MAT2”、5 表示“MAT3”、6 表示“MAT4”。
方法說明
GLTFAccessor from_dictionary(dictionary: Dictionary) static 🔗
通過解析給定的 Dictionary 新建 GLTFAccessor 實例。
Dictionary to_dictionary() const 🔗
將這個 GLTFAccessor 實例序列化為 Dictionary。