class_multimesh.rst 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the MultiMesh.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_MultiMesh:
  5. MultiMesh
  6. =========
  7. **Inherits:** :ref:`Resource<class_resource>` **<** :ref:`Reference<class_reference>` **<** :ref:`Object<class_object>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. Provides high performance mesh instancing.
  12. Member Functions
  13. ----------------
  14. +------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  15. | :ref:`Rect3<class_rect3>` | :ref:`get_aabb<class_MultiMesh_get_aabb>` **(** **)** const |
  16. +------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  17. | :ref:`int<class_int>` | :ref:`get_color_format<class_MultiMesh_get_color_format>` **(** **)** const |
  18. +------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  19. | :ref:`Color<class_color>` | :ref:`get_instance_color<class_MultiMesh_get_instance_color>` **(** :ref:`int<class_int>` instance **)** const |
  20. +------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  21. | :ref:`int<class_int>` | :ref:`get_instance_count<class_MultiMesh_get_instance_count>` **(** **)** const |
  22. +------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | :ref:`Transform<class_transform>` | :ref:`get_instance_transform<class_MultiMesh_get_instance_transform>` **(** :ref:`int<class_int>` instance **)** const |
  24. +------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | :ref:`Mesh<class_mesh>` | :ref:`get_mesh<class_MultiMesh_get_mesh>` **(** **)** const |
  26. +------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | :ref:`int<class_int>` | :ref:`get_transform_format<class_MultiMesh_get_transform_format>` **(** **)** const |
  28. +------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | void | :ref:`set_color_format<class_MultiMesh_set_color_format>` **(** :ref:`int<class_int>` format **)** |
  30. +------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | void | :ref:`set_instance_color<class_MultiMesh_set_instance_color>` **(** :ref:`int<class_int>` instance, :ref:`Color<class_color>` color **)** |
  32. +------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | void | :ref:`set_instance_count<class_MultiMesh_set_instance_count>` **(** :ref:`int<class_int>` count **)** |
  34. +------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | void | :ref:`set_instance_transform<class_MultiMesh_set_instance_transform>` **(** :ref:`int<class_int>` instance, :ref:`Transform<class_transform>` transform **)** |
  36. +------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | void | :ref:`set_mesh<class_MultiMesh_set_mesh>` **(** :ref:`Mesh<class_mesh>` mesh **)** |
  38. +------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | void | :ref:`set_transform_format<class_MultiMesh_set_transform_format>` **(** :ref:`int<class_int>` format **)** |
  40. +------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. Member Variables
  42. ----------------
  43. - :ref:`PoolColorArray<class_poolcolorarray>` **color_array**
  44. - :ref:`int<class_int>` **color_format**
  45. - :ref:`int<class_int>` **instance_count**
  46. - :ref:`Mesh<class_mesh>` **mesh**
  47. - :ref:`PoolVector3Array<class_poolvector3array>` **transform_array**
  48. - :ref:`int<class_int>` **transform_format**
  49. Numeric Constants
  50. -----------------
  51. - **TRANSFORM_2D** = **0**
  52. - **TRANSFORM_3D** = **1**
  53. - **COLOR_NONE** = **0**
  54. - **COLOR_8BIT** = **1**
  55. - **COLOR_FLOAT** = **2**
  56. Description
  57. -----------
  58. MultiMesh provides low level mesh instancing. If the amount of :ref:`Mesh<class_mesh>` instances needed goes from hundreds to thousands (and most need to be visible at close proximity) creating such a large amount of :ref:`MeshInstance<class_meshinstance>` nodes may affect performance by using too much CPU or video memory.
  59. For this case a MultiMesh becomes very useful, as it can draw thousands of instances with little API overhead.
  60. As a drawback, if the instances are too far away of each other, performance may be reduced as every single instance will always rendered (they are spatially indexed as one, for the whole object).
  61. Since instances may have any behavior, the Rect3 used for visibility must be provided by the user.
  62. Member Function Description
  63. ---------------------------
  64. .. _class_MultiMesh_get_aabb:
  65. - :ref:`Rect3<class_rect3>` **get_aabb** **(** **)** const
  66. Return the visibility Rect3.
  67. .. _class_MultiMesh_get_color_format:
  68. - :ref:`int<class_int>` **get_color_format** **(** **)** const
  69. .. _class_MultiMesh_get_instance_color:
  70. - :ref:`Color<class_color>` **get_instance_color** **(** :ref:`int<class_int>` instance **)** const
  71. Get the color of a specific instance.
  72. .. _class_MultiMesh_get_instance_count:
  73. - :ref:`int<class_int>` **get_instance_count** **(** **)** const
  74. Return the amount of instances that is going to be drawn.
  75. .. _class_MultiMesh_get_instance_transform:
  76. - :ref:`Transform<class_transform>` **get_instance_transform** **(** :ref:`int<class_int>` instance **)** const
  77. Return the transform of a specific instance.
  78. .. _class_MultiMesh_get_mesh:
  79. - :ref:`Mesh<class_mesh>` **get_mesh** **(** **)** const
  80. Return the :ref:`Mesh<class_mesh>` resource drawn as multiple instances.
  81. .. _class_MultiMesh_get_transform_format:
  82. - :ref:`int<class_int>` **get_transform_format** **(** **)** const
  83. .. _class_MultiMesh_set_color_format:
  84. - void **set_color_format** **(** :ref:`int<class_int>` format **)**
  85. .. _class_MultiMesh_set_instance_color:
  86. - void **set_instance_color** **(** :ref:`int<class_int>` instance, :ref:`Color<class_color>` color **)**
  87. Set the color of a specific instance.
  88. .. _class_MultiMesh_set_instance_count:
  89. - void **set_instance_count** **(** :ref:`int<class_int>` count **)**
  90. Set the amount of instances that is going to be drawn. Changing this number will erase all the existing instance transform and color data.
  91. .. _class_MultiMesh_set_instance_transform:
  92. - void **set_instance_transform** **(** :ref:`int<class_int>` instance, :ref:`Transform<class_transform>` transform **)**
  93. Set the transform for a specific instance.
  94. .. _class_MultiMesh_set_mesh:
  95. - void **set_mesh** **(** :ref:`Mesh<class_mesh>` mesh **)**
  96. Set the :ref:`Mesh<class_mesh>` resource to be drawn in multiple instances.
  97. .. _class_MultiMesh_set_transform_format:
  98. - void **set_transform_format** **(** :ref:`int<class_int>` format **)**