class_primitivemesh.rst 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the PrimitiveMesh.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_PrimitiveMesh:
  6. PrimitiveMesh
  7. =============
  8. **Inherits:** :ref:`Mesh<class_Mesh>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  9. **Inherited By:** :ref:`BoxMesh<class_BoxMesh>`, :ref:`CapsuleMesh<class_CapsuleMesh>`, :ref:`CylinderMesh<class_CylinderMesh>`, :ref:`PlaneMesh<class_PlaneMesh>`, :ref:`PointMesh<class_PointMesh>`, :ref:`PrismMesh<class_PrismMesh>`, :ref:`QuadMesh<class_QuadMesh>`, :ref:`RibbonTrailMesh<class_RibbonTrailMesh>`, :ref:`SphereMesh<class_SphereMesh>`, :ref:`TubeTrailMesh<class_TubeTrailMesh>`
  10. Base class for all primitive meshes. Handles applying a :ref:`Material<class_Material>` to a primitive mesh.
  11. Description
  12. -----------
  13. Base class for all primitive meshes. Handles applying a :ref:`Material<class_Material>` to a primitive mesh. Examples include :ref:`BoxMesh<class_BoxMesh>`, :ref:`CapsuleMesh<class_CapsuleMesh>`, :ref:`CylinderMesh<class_CylinderMesh>`, :ref:`PlaneMesh<class_PlaneMesh>`, :ref:`PrismMesh<class_PrismMesh>`, :ref:`QuadMesh<class_QuadMesh>`, and :ref:`SphereMesh<class_SphereMesh>`.
  14. Properties
  15. ----------
  16. +---------------------------------+--------------------------------------------------------------+----------------------------+
  17. | :ref:`AABB<class_AABB>` | :ref:`custom_aabb<class_PrimitiveMesh_property_custom_aabb>` | ``AABB(0, 0, 0, 0, 0, 0)`` |
  18. +---------------------------------+--------------------------------------------------------------+----------------------------+
  19. | :ref:`bool<class_bool>` | :ref:`flip_faces<class_PrimitiveMesh_property_flip_faces>` | ``false`` |
  20. +---------------------------------+--------------------------------------------------------------+----------------------------+
  21. | :ref:`Material<class_Material>` | :ref:`material<class_PrimitiveMesh_property_material>` | |
  22. +---------------------------------+--------------------------------------------------------------+----------------------------+
  23. Methods
  24. -------
  25. +---------------------------+--------------------------------------------------------------------------------------------------------+
  26. | :ref:`Array<class_Array>` | :ref:`_create_mesh_array<class_PrimitiveMesh_method__create_mesh_array>` **(** **)** |virtual| |const| |
  27. +---------------------------+--------------------------------------------------------------------------------------------------------+
  28. | :ref:`Array<class_Array>` | :ref:`get_mesh_arrays<class_PrimitiveMesh_method_get_mesh_arrays>` **(** **)** |const| |
  29. +---------------------------+--------------------------------------------------------------------------------------------------------+
  30. Property Descriptions
  31. ---------------------
  32. .. _class_PrimitiveMesh_property_custom_aabb:
  33. - :ref:`AABB<class_AABB>` **custom_aabb**
  34. +-----------+----------------------------+
  35. | *Default* | ``AABB(0, 0, 0, 0, 0, 0)`` |
  36. +-----------+----------------------------+
  37. | *Setter* | set_custom_aabb(value) |
  38. +-----------+----------------------------+
  39. | *Getter* | get_custom_aabb() |
  40. +-----------+----------------------------+
  41. Overrides the :ref:`AABB<class_AABB>` with one defined by user for use with frustum culling. Especially useful to avoid unexpected culling when using a shader to offset vertices.
  42. ----
  43. .. _class_PrimitiveMesh_property_flip_faces:
  44. - :ref:`bool<class_bool>` **flip_faces**
  45. +-----------+-----------------------+
  46. | *Default* | ``false`` |
  47. +-----------+-----------------------+
  48. | *Setter* | set_flip_faces(value) |
  49. +-----------+-----------------------+
  50. | *Getter* | get_flip_faces() |
  51. +-----------+-----------------------+
  52. If set, the order of the vertices in each triangle are reversed resulting in the backside of the mesh being drawn.
  53. This gives the same result as using :ref:`BaseMaterial3D.CULL_FRONT<class_BaseMaterial3D_constant_CULL_FRONT>` in :ref:`BaseMaterial3D.cull_mode<class_BaseMaterial3D_property_cull_mode>`.
  54. ----
  55. .. _class_PrimitiveMesh_property_material:
  56. - :ref:`Material<class_Material>` **material**
  57. +----------+---------------------+
  58. | *Setter* | set_material(value) |
  59. +----------+---------------------+
  60. | *Getter* | get_material() |
  61. +----------+---------------------+
  62. The current :ref:`Material<class_Material>` of the primitive mesh.
  63. Method Descriptions
  64. -------------------
  65. .. _class_PrimitiveMesh_method__create_mesh_array:
  66. - :ref:`Array<class_Array>` **_create_mesh_array** **(** **)** |virtual| |const|
  67. ----
  68. .. _class_PrimitiveMesh_method_get_mesh_arrays:
  69. - :ref:`Array<class_Array>` **get_mesh_arrays** **(** **)** |const|
  70. Returns mesh arrays used to constitute surface of :ref:`Mesh<class_Mesh>`. The result can be passed to :ref:`ArrayMesh.add_surface_from_arrays<class_ArrayMesh_method_add_surface_from_arrays>` to create a new surface. For example:
  71. .. tabs::
  72. .. code-tab:: gdscript
  73. var c = CylinderMesh.new()
  74. var arr_mesh = ArrayMesh.new()
  75. arr_mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES, c.get_mesh_arrays())
  76. .. code-tab:: csharp
  77. var c = new CylinderMesh();
  78. var arrMesh = new ArrayMesh();
  79. arrMesh.AddSurfaceFromArrays(Mesh.PrimitiveType.Triangles, c.GetMeshArrays());
  80. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  81. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  82. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  83. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  84. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  85. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`