class_gltfaccessor.rst 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/4.3/modules/gltf/doc_classes/GLTFAccessor.xml.
  6. .. _class_GLTFAccessor:
  7. GLTFAccessor
  8. ============
  9. **Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. Represents a GLTF accessor.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. GLTFAccessor is a data structure representing GLTF a ``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.
  15. Most custom data stored in GLTF does not need accessors, only buffer views (see :ref:`GLTFBufferView<class_GLTFBufferView>`). Accessors are for more advanced use cases such as interleaved mesh data encoded for the GPU.
  16. .. rst-class:: classref-introduction-group
  17. Tutorials
  18. ---------
  19. - `Buffers, BufferViews, and Accessors in Khronos glTF specification <https://github.com/KhronosGroup/glTF-Tutorials/blob/master/gltfTutorial/gltfTutorial_005_BuffersBufferViewsAccessors.md>`__
  20. - :doc:`Runtime file loading and saving <../tutorials/io/runtime_file_loading_and_saving>`
  21. .. rst-class:: classref-reftable-group
  22. Properties
  23. ----------
  24. .. table::
  25. :widths: auto
  26. +-------------------------------------------------------------+-------------------------------------------------------------------------------------------------+--------------------------+
  27. | :ref:`GLTFAccessorType<enum_GLTFAccessor_GLTFAccessorType>` | :ref:`accessor_type<class_GLTFAccessor_property_accessor_type>` | ``0`` |
  28. +-------------------------------------------------------------+-------------------------------------------------------------------------------------------------+--------------------------+
  29. | :ref:`int<class_int>` | :ref:`buffer_view<class_GLTFAccessor_property_buffer_view>` | ``-1`` |
  30. +-------------------------------------------------------------+-------------------------------------------------------------------------------------------------+--------------------------+
  31. | :ref:`int<class_int>` | :ref:`byte_offset<class_GLTFAccessor_property_byte_offset>` | ``0`` |
  32. +-------------------------------------------------------------+-------------------------------------------------------------------------------------------------+--------------------------+
  33. | :ref:`int<class_int>` | :ref:`component_type<class_GLTFAccessor_property_component_type>` | ``0`` |
  34. +-------------------------------------------------------------+-------------------------------------------------------------------------------------------------+--------------------------+
  35. | :ref:`int<class_int>` | :ref:`count<class_GLTFAccessor_property_count>` | ``0`` |
  36. +-------------------------------------------------------------+-------------------------------------------------------------------------------------------------+--------------------------+
  37. | :ref:`PackedFloat64Array<class_PackedFloat64Array>` | :ref:`max<class_GLTFAccessor_property_max>` | ``PackedFloat64Array()`` |
  38. +-------------------------------------------------------------+-------------------------------------------------------------------------------------------------+--------------------------+
  39. | :ref:`PackedFloat64Array<class_PackedFloat64Array>` | :ref:`min<class_GLTFAccessor_property_min>` | ``PackedFloat64Array()`` |
  40. +-------------------------------------------------------------+-------------------------------------------------------------------------------------------------+--------------------------+
  41. | :ref:`bool<class_bool>` | :ref:`normalized<class_GLTFAccessor_property_normalized>` | ``false`` |
  42. +-------------------------------------------------------------+-------------------------------------------------------------------------------------------------+--------------------------+
  43. | :ref:`int<class_int>` | :ref:`sparse_count<class_GLTFAccessor_property_sparse_count>` | ``0`` |
  44. +-------------------------------------------------------------+-------------------------------------------------------------------------------------------------+--------------------------+
  45. | :ref:`int<class_int>` | :ref:`sparse_indices_buffer_view<class_GLTFAccessor_property_sparse_indices_buffer_view>` | ``0`` |
  46. +-------------------------------------------------------------+-------------------------------------------------------------------------------------------------+--------------------------+
  47. | :ref:`int<class_int>` | :ref:`sparse_indices_byte_offset<class_GLTFAccessor_property_sparse_indices_byte_offset>` | ``0`` |
  48. +-------------------------------------------------------------+-------------------------------------------------------------------------------------------------+--------------------------+
  49. | :ref:`int<class_int>` | :ref:`sparse_indices_component_type<class_GLTFAccessor_property_sparse_indices_component_type>` | ``0`` |
  50. +-------------------------------------------------------------+-------------------------------------------------------------------------------------------------+--------------------------+
  51. | :ref:`int<class_int>` | :ref:`sparse_values_buffer_view<class_GLTFAccessor_property_sparse_values_buffer_view>` | ``0`` |
  52. +-------------------------------------------------------------+-------------------------------------------------------------------------------------------------+--------------------------+
  53. | :ref:`int<class_int>` | :ref:`sparse_values_byte_offset<class_GLTFAccessor_property_sparse_values_byte_offset>` | ``0`` |
  54. +-------------------------------------------------------------+-------------------------------------------------------------------------------------------------+--------------------------+
  55. | :ref:`int<class_int>` | :ref:`type<class_GLTFAccessor_property_type>` | |
  56. +-------------------------------------------------------------+-------------------------------------------------------------------------------------------------+--------------------------+
  57. .. rst-class:: classref-section-separator
  58. ----
  59. .. rst-class:: classref-descriptions-group
  60. Enumerations
  61. ------------
  62. .. _enum_GLTFAccessor_GLTFAccessorType:
  63. .. rst-class:: classref-enumeration
  64. enum **GLTFAccessorType**: :ref:`🔗<enum_GLTFAccessor_GLTFAccessorType>`
  65. .. _class_GLTFAccessor_constant_TYPE_SCALAR:
  66. .. rst-class:: classref-enumeration-constant
  67. :ref:`GLTFAccessorType<enum_GLTFAccessor_GLTFAccessorType>` **TYPE_SCALAR** = ``0``
  68. 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.
  69. .. _class_GLTFAccessor_constant_TYPE_VEC2:
  70. .. rst-class:: classref-enumeration-constant
  71. :ref:`GLTFAccessorType<enum_GLTFAccessor_GLTFAccessorType>` **TYPE_VEC2** = ``1``
  72. Accessor type "VEC2". For the glTF object model, this maps to "float2", represented in the glTF JSON as an array of two floats.
  73. .. _class_GLTFAccessor_constant_TYPE_VEC3:
  74. .. rst-class:: classref-enumeration-constant
  75. :ref:`GLTFAccessorType<enum_GLTFAccessor_GLTFAccessorType>` **TYPE_VEC3** = ``2``
  76. Accessor type "VEC3". For the glTF object model, this maps to "float3", represented in the glTF JSON as an array of three floats.
  77. .. _class_GLTFAccessor_constant_TYPE_VEC4:
  78. .. rst-class:: classref-enumeration-constant
  79. :ref:`GLTFAccessorType<enum_GLTFAccessor_GLTFAccessorType>` **TYPE_VEC4** = ``3``
  80. Accessor type "VEC4". For the glTF object model, this maps to "float4", represented in the glTF JSON as an array of four floats.
  81. .. _class_GLTFAccessor_constant_TYPE_MAT2:
  82. .. rst-class:: classref-enumeration-constant
  83. :ref:`GLTFAccessorType<enum_GLTFAccessor_GLTFAccessorType>` **TYPE_MAT2** = ``4``
  84. Accessor type "MAT2". For the glTF object model, this maps to "float2x2", represented in the glTF JSON as an array of four floats.
  85. .. _class_GLTFAccessor_constant_TYPE_MAT3:
  86. .. rst-class:: classref-enumeration-constant
  87. :ref:`GLTFAccessorType<enum_GLTFAccessor_GLTFAccessorType>` **TYPE_MAT3** = ``5``
  88. Accessor type "MAT3". For the glTF object model, this maps to "float3x3", represented in the glTF JSON as an array of nine floats.
  89. .. _class_GLTFAccessor_constant_TYPE_MAT4:
  90. .. rst-class:: classref-enumeration-constant
  91. :ref:`GLTFAccessorType<enum_GLTFAccessor_GLTFAccessorType>` **TYPE_MAT4** = ``6``
  92. Accessor type "MAT4". For the glTF object model, this maps to "float4x4", represented in the glTF JSON as an array of sixteen floats.
  93. .. rst-class:: classref-section-separator
  94. ----
  95. .. rst-class:: classref-descriptions-group
  96. Property Descriptions
  97. ---------------------
  98. .. _class_GLTFAccessor_property_accessor_type:
  99. .. rst-class:: classref-property
  100. :ref:`GLTFAccessorType<enum_GLTFAccessor_GLTFAccessorType>` **accessor_type** = ``0`` :ref:`🔗<class_GLTFAccessor_property_accessor_type>`
  101. .. rst-class:: classref-property-setget
  102. - |void| **set_accessor_type**\ (\ value\: :ref:`GLTFAccessorType<enum_GLTFAccessor_GLTFAccessorType>`\ )
  103. - :ref:`GLTFAccessorType<enum_GLTFAccessor_GLTFAccessorType>` **get_accessor_type**\ (\ )
  104. The GLTF accessor type as an enum. 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".
  105. .. rst-class:: classref-item-separator
  106. ----
  107. .. _class_GLTFAccessor_property_buffer_view:
  108. .. rst-class:: classref-property
  109. :ref:`int<class_int>` **buffer_view** = ``-1`` :ref:`🔗<class_GLTFAccessor_property_buffer_view>`
  110. .. rst-class:: classref-property-setget
  111. - |void| **set_buffer_view**\ (\ value\: :ref:`int<class_int>`\ )
  112. - :ref:`int<class_int>` **get_buffer_view**\ (\ )
  113. The index of the buffer view this accessor is referencing. If ``-1``, this accessor is not referencing any buffer view.
  114. .. rst-class:: classref-item-separator
  115. ----
  116. .. _class_GLTFAccessor_property_byte_offset:
  117. .. rst-class:: classref-property
  118. :ref:`int<class_int>` **byte_offset** = ``0`` :ref:`🔗<class_GLTFAccessor_property_byte_offset>`
  119. .. rst-class:: classref-property-setget
  120. - |void| **set_byte_offset**\ (\ value\: :ref:`int<class_int>`\ )
  121. - :ref:`int<class_int>` **get_byte_offset**\ (\ )
  122. The offset relative to the start of the buffer view in bytes.
  123. .. rst-class:: classref-item-separator
  124. ----
  125. .. _class_GLTFAccessor_property_component_type:
  126. .. rst-class:: classref-property
  127. :ref:`int<class_int>` **component_type** = ``0`` :ref:`🔗<class_GLTFAccessor_property_component_type>`
  128. .. rst-class:: classref-property-setget
  129. - |void| **set_component_type**\ (\ value\: :ref:`int<class_int>`\ )
  130. - :ref:`int<class_int>` **get_component_type**\ (\ )
  131. The GLTF component type as an enum. Possible values are 5120 for "BYTE", 5121 for "UNSIGNED_BYTE", 5122 for "SHORT", 5123 for "UNSIGNED_SHORT", 5125 for "UNSIGNED_INT", and 5126 for "FLOAT". A value of 5125 or "UNSIGNED_INT" must not be used for any accessor that is not referenced by mesh.primitive.indices.
  132. .. rst-class:: classref-item-separator
  133. ----
  134. .. _class_GLTFAccessor_property_count:
  135. .. rst-class:: classref-property
  136. :ref:`int<class_int>` **count** = ``0`` :ref:`🔗<class_GLTFAccessor_property_count>`
  137. .. rst-class:: classref-property-setget
  138. - |void| **set_count**\ (\ value\: :ref:`int<class_int>`\ )
  139. - :ref:`int<class_int>` **get_count**\ (\ )
  140. The number of elements referenced by this accessor.
  141. .. rst-class:: classref-item-separator
  142. ----
  143. .. _class_GLTFAccessor_property_max:
  144. .. rst-class:: classref-property
  145. :ref:`PackedFloat64Array<class_PackedFloat64Array>` **max** = ``PackedFloat64Array()`` :ref:`🔗<class_GLTFAccessor_property_max>`
  146. .. rst-class:: classref-property-setget
  147. - |void| **set_max**\ (\ value\: :ref:`PackedFloat64Array<class_PackedFloat64Array>`\ )
  148. - :ref:`PackedFloat64Array<class_PackedFloat64Array>` **get_max**\ (\ )
  149. Maximum value of each component in this accessor.
  150. .. rst-class:: classref-item-separator
  151. ----
  152. .. _class_GLTFAccessor_property_min:
  153. .. rst-class:: classref-property
  154. :ref:`PackedFloat64Array<class_PackedFloat64Array>` **min** = ``PackedFloat64Array()`` :ref:`🔗<class_GLTFAccessor_property_min>`
  155. .. rst-class:: classref-property-setget
  156. - |void| **set_min**\ (\ value\: :ref:`PackedFloat64Array<class_PackedFloat64Array>`\ )
  157. - :ref:`PackedFloat64Array<class_PackedFloat64Array>` **get_min**\ (\ )
  158. Minimum value of each component in this accessor.
  159. .. rst-class:: classref-item-separator
  160. ----
  161. .. _class_GLTFAccessor_property_normalized:
  162. .. rst-class:: classref-property
  163. :ref:`bool<class_bool>` **normalized** = ``false`` :ref:`🔗<class_GLTFAccessor_property_normalized>`
  164. .. rst-class:: classref-property-setget
  165. - |void| **set_normalized**\ (\ value\: :ref:`bool<class_bool>`\ )
  166. - :ref:`bool<class_bool>` **get_normalized**\ (\ )
  167. Specifies whether integer data values are normalized before usage.
  168. .. rst-class:: classref-item-separator
  169. ----
  170. .. _class_GLTFAccessor_property_sparse_count:
  171. .. rst-class:: classref-property
  172. :ref:`int<class_int>` **sparse_count** = ``0`` :ref:`🔗<class_GLTFAccessor_property_sparse_count>`
  173. .. rst-class:: classref-property-setget
  174. - |void| **set_sparse_count**\ (\ value\: :ref:`int<class_int>`\ )
  175. - :ref:`int<class_int>` **get_sparse_count**\ (\ )
  176. Number of deviating accessor values stored in the sparse array.
  177. .. rst-class:: classref-item-separator
  178. ----
  179. .. _class_GLTFAccessor_property_sparse_indices_buffer_view:
  180. .. rst-class:: classref-property
  181. :ref:`int<class_int>` **sparse_indices_buffer_view** = ``0`` :ref:`🔗<class_GLTFAccessor_property_sparse_indices_buffer_view>`
  182. .. rst-class:: classref-property-setget
  183. - |void| **set_sparse_indices_buffer_view**\ (\ value\: :ref:`int<class_int>`\ )
  184. - :ref:`int<class_int>` **get_sparse_indices_buffer_view**\ (\ )
  185. 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.
  186. .. rst-class:: classref-item-separator
  187. ----
  188. .. _class_GLTFAccessor_property_sparse_indices_byte_offset:
  189. .. rst-class:: classref-property
  190. :ref:`int<class_int>` **sparse_indices_byte_offset** = ``0`` :ref:`🔗<class_GLTFAccessor_property_sparse_indices_byte_offset>`
  191. .. rst-class:: classref-property-setget
  192. - |void| **set_sparse_indices_byte_offset**\ (\ value\: :ref:`int<class_int>`\ )
  193. - :ref:`int<class_int>` **get_sparse_indices_byte_offset**\ (\ )
  194. The offset relative to the start of the buffer view in bytes.
  195. .. rst-class:: classref-item-separator
  196. ----
  197. .. _class_GLTFAccessor_property_sparse_indices_component_type:
  198. .. rst-class:: classref-property
  199. :ref:`int<class_int>` **sparse_indices_component_type** = ``0`` :ref:`🔗<class_GLTFAccessor_property_sparse_indices_component_type>`
  200. .. rst-class:: classref-property-setget
  201. - |void| **set_sparse_indices_component_type**\ (\ value\: :ref:`int<class_int>`\ )
  202. - :ref:`int<class_int>` **get_sparse_indices_component_type**\ (\ )
  203. The indices component data type as an enum. Possible values are 5121 for "UNSIGNED_BYTE", 5123 for "UNSIGNED_SHORT", and 5125 for "UNSIGNED_INT".
  204. .. rst-class:: classref-item-separator
  205. ----
  206. .. _class_GLTFAccessor_property_sparse_values_buffer_view:
  207. .. rst-class:: classref-property
  208. :ref:`int<class_int>` **sparse_values_buffer_view** = ``0`` :ref:`🔗<class_GLTFAccessor_property_sparse_values_buffer_view>`
  209. .. rst-class:: classref-property-setget
  210. - |void| **set_sparse_values_buffer_view**\ (\ value\: :ref:`int<class_int>`\ )
  211. - :ref:`int<class_int>` **get_sparse_values_buffer_view**\ (\ )
  212. The index of the bufferView with sparse values. The referenced buffer view MUST NOT have its target or byteStride properties defined.
  213. .. rst-class:: classref-item-separator
  214. ----
  215. .. _class_GLTFAccessor_property_sparse_values_byte_offset:
  216. .. rst-class:: classref-property
  217. :ref:`int<class_int>` **sparse_values_byte_offset** = ``0`` :ref:`🔗<class_GLTFAccessor_property_sparse_values_byte_offset>`
  218. .. rst-class:: classref-property-setget
  219. - |void| **set_sparse_values_byte_offset**\ (\ value\: :ref:`int<class_int>`\ )
  220. - :ref:`int<class_int>` **get_sparse_values_byte_offset**\ (\ )
  221. The offset relative to the start of the bufferView in bytes.
  222. .. rst-class:: classref-item-separator
  223. ----
  224. .. _class_GLTFAccessor_property_type:
  225. .. rst-class:: classref-property
  226. :ref:`int<class_int>` **type** :ref:`🔗<class_GLTFAccessor_property_type>`
  227. .. rst-class:: classref-property-setget
  228. - |void| **set_type**\ (\ value\: :ref:`int<class_int>`\ )
  229. - :ref:`int<class_int>` **get_type**\ (\ )
  230. **Deprecated:** Use :ref:`accessor_type<class_GLTFAccessor_property_accessor_type>` instead.
  231. The GLTF accessor type as an enum. Use :ref:`accessor_type<class_GLTFAccessor_property_accessor_type>` instead.
  232. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  233. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  234. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  235. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  236. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  237. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  238. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  239. .. |void| replace:: :abbr:`void (No return value.)`