class_multimesh.rst 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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:`AABB<class_aabb>` | :ref:`get_aabb<class_MultiMesh_get_aabb>` **(** **)** const |
  16. +------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
  17. | :ref:`Color<class_color>` | :ref:`get_instance_color<class_MultiMesh_get_instance_color>` **(** :ref:`int<class_int>` instance **)** const |
  18. +------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
  19. | :ref:`Transform<class_transform>` | :ref:`get_instance_transform<class_MultiMesh_get_instance_transform>` **(** :ref:`int<class_int>` instance **)** const |
  20. +------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
  21. | void | :ref:`set_instance_color<class_MultiMesh_set_instance_color>` **(** :ref:`int<class_int>` instance, :ref:`Color<class_color>` color **)** |
  22. +------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | void | :ref:`set_instance_transform<class_MultiMesh_set_instance_transform>` **(** :ref:`int<class_int>` instance, :ref:`Transform<class_transform>` transform **)** |
  24. +------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. Member Variables
  26. ----------------
  27. .. _class_MultiMesh_color_format:
  28. - :ref:`ColorFormat<enum_multimesh_colorformat>` **color_format**
  29. .. _class_MultiMesh_instance_count:
  30. - :ref:`int<class_int>` **instance_count**
  31. .. _class_MultiMesh_mesh:
  32. - :ref:`Mesh<class_mesh>` **mesh**
  33. .. _class_MultiMesh_transform_format:
  34. - :ref:`TransformFormat<enum_multimesh_transformformat>` **transform_format**
  35. Enums
  36. -----
  37. .. _enum_MultiMesh_TransformFormat:
  38. enum **TransformFormat**
  39. - **TRANSFORM_2D** = **0**
  40. - **TRANSFORM_3D** = **1**
  41. .. _enum_MultiMesh_ColorFormat:
  42. enum **ColorFormat**
  43. - **COLOR_NONE** = **0**
  44. - **COLOR_8BIT** = **1**
  45. - **COLOR_FLOAT** = **2**
  46. Description
  47. -----------
  48. 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.
  49. For this case a MultiMesh becomes very useful, as it can draw thousands of instances with little API overhead.
  50. 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).
  51. Since instances may have any behavior, the AABB used for visibility must be provided by the user.
  52. Member Function Description
  53. ---------------------------
  54. .. _class_MultiMesh_get_aabb:
  55. - :ref:`AABB<class_aabb>` **get_aabb** **(** **)** const
  56. Return the visibility AABB.
  57. .. _class_MultiMesh_get_instance_color:
  58. - :ref:`Color<class_color>` **get_instance_color** **(** :ref:`int<class_int>` instance **)** const
  59. Get the color of a specific instance.
  60. .. _class_MultiMesh_get_instance_transform:
  61. - :ref:`Transform<class_transform>` **get_instance_transform** **(** :ref:`int<class_int>` instance **)** const
  62. Return the transform of a specific instance.
  63. .. _class_MultiMesh_set_instance_color:
  64. - void **set_instance_color** **(** :ref:`int<class_int>` instance, :ref:`Color<class_color>` color **)**
  65. Set the color of a specific instance.
  66. .. _class_MultiMesh_set_instance_transform:
  67. - void **set_instance_transform** **(** :ref:`int<class_int>` instance, :ref:`Transform<class_transform>` transform **)**
  68. Set the transform for a specific instance.