123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221 |
- :github_url: hide
- .. DO NOT EDIT THIS FILE!!!
- .. Generated automatically from Godot engine sources.
- .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
- .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/ImmediateMesh.xml.
- .. _class_ImmediateMesh:
- ImmediateMesh
- =============
- **Inherits:** :ref:`Mesh<class_Mesh>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
- Mesh optimized for creating geometry manually.
- .. rst-class:: classref-introduction-group
- Description
- -----------
- A mesh type optimized for creating geometry manually, similar to OpenGL 1.x immediate mode.
- Here's a sample on how to generate a triangular face:
- .. tabs::
- .. code-tab:: gdscript
- var mesh = ImmediateMesh.new()
- mesh.surface_begin(Mesh.PRIMITIVE_TRIANGLES)
- mesh.surface_add_vertex(Vector3.LEFT)
- mesh.surface_add_vertex(Vector3.FORWARD)
- mesh.surface_add_vertex(Vector3.ZERO)
- mesh.surface_end()
- .. code-tab:: csharp
- var mesh = new ImmediateMesh();
- mesh.SurfaceBegin(Mesh.PrimitiveType.Triangles);
- mesh.SurfaceAddVertex(Vector3.Left);
- mesh.SurfaceAddVertex(Vector3.Forward);
- mesh.SurfaceAddVertex(Vector3.Zero);
- mesh.SurfaceEnd();
- \ **Note:** Generating complex geometries with **ImmediateMesh** is highly inefficient. Instead, it is designed to generate simple geometry that changes often.
- .. rst-class:: classref-introduction-group
- Tutorials
- ---------
- - :doc:`Using ImmediateMesh <../tutorials/3d/procedural_geometry/immediatemesh>`
- .. rst-class:: classref-reftable-group
- Methods
- -------
- .. table::
- :widths: auto
- +--------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`clear_surfaces<class_ImmediateMesh_method_clear_surfaces>`\ (\ ) |
- +--------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`surface_add_vertex<class_ImmediateMesh_method_surface_add_vertex>`\ (\ vertex\: :ref:`Vector3<class_Vector3>`\ ) |
- +--------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`surface_add_vertex_2d<class_ImmediateMesh_method_surface_add_vertex_2d>`\ (\ vertex\: :ref:`Vector2<class_Vector2>`\ ) |
- +--------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`surface_begin<class_ImmediateMesh_method_surface_begin>`\ (\ primitive\: :ref:`PrimitiveType<enum_Mesh_PrimitiveType>`, material\: :ref:`Material<class_Material>` = null\ ) |
- +--------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`surface_end<class_ImmediateMesh_method_surface_end>`\ (\ ) |
- +--------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`surface_set_color<class_ImmediateMesh_method_surface_set_color>`\ (\ color\: :ref:`Color<class_Color>`\ ) |
- +--------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`surface_set_normal<class_ImmediateMesh_method_surface_set_normal>`\ (\ normal\: :ref:`Vector3<class_Vector3>`\ ) |
- +--------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`surface_set_tangent<class_ImmediateMesh_method_surface_set_tangent>`\ (\ tangent\: :ref:`Plane<class_Plane>`\ ) |
- +--------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`surface_set_uv<class_ImmediateMesh_method_surface_set_uv>`\ (\ uv\: :ref:`Vector2<class_Vector2>`\ ) |
- +--------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`surface_set_uv2<class_ImmediateMesh_method_surface_set_uv2>`\ (\ uv2\: :ref:`Vector2<class_Vector2>`\ ) |
- +--------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Method Descriptions
- -------------------
- .. _class_ImmediateMesh_method_clear_surfaces:
- .. rst-class:: classref-method
- |void| **clear_surfaces**\ (\ ) :ref:`🔗<class_ImmediateMesh_method_clear_surfaces>`
- Clear all surfaces.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ImmediateMesh_method_surface_add_vertex:
- .. rst-class:: classref-method
- |void| **surface_add_vertex**\ (\ vertex\: :ref:`Vector3<class_Vector3>`\ ) :ref:`🔗<class_ImmediateMesh_method_surface_add_vertex>`
- Add a 3D vertex using the current attributes previously set.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ImmediateMesh_method_surface_add_vertex_2d:
- .. rst-class:: classref-method
- |void| **surface_add_vertex_2d**\ (\ vertex\: :ref:`Vector2<class_Vector2>`\ ) :ref:`🔗<class_ImmediateMesh_method_surface_add_vertex_2d>`
- Add a 2D vertex using the current attributes previously set.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ImmediateMesh_method_surface_begin:
- .. rst-class:: classref-method
- |void| **surface_begin**\ (\ primitive\: :ref:`PrimitiveType<enum_Mesh_PrimitiveType>`, material\: :ref:`Material<class_Material>` = null\ ) :ref:`🔗<class_ImmediateMesh_method_surface_begin>`
- Begin a new surface.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ImmediateMesh_method_surface_end:
- .. rst-class:: classref-method
- |void| **surface_end**\ (\ ) :ref:`🔗<class_ImmediateMesh_method_surface_end>`
- End and commit current surface. Note that surface being created will not be visible until this function is called.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ImmediateMesh_method_surface_set_color:
- .. rst-class:: classref-method
- |void| **surface_set_color**\ (\ color\: :ref:`Color<class_Color>`\ ) :ref:`🔗<class_ImmediateMesh_method_surface_set_color>`
- Set the color attribute that will be pushed with the next vertex.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ImmediateMesh_method_surface_set_normal:
- .. rst-class:: classref-method
- |void| **surface_set_normal**\ (\ normal\: :ref:`Vector3<class_Vector3>`\ ) :ref:`🔗<class_ImmediateMesh_method_surface_set_normal>`
- Set the normal attribute that will be pushed with the next vertex.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ImmediateMesh_method_surface_set_tangent:
- .. rst-class:: classref-method
- |void| **surface_set_tangent**\ (\ tangent\: :ref:`Plane<class_Plane>`\ ) :ref:`🔗<class_ImmediateMesh_method_surface_set_tangent>`
- Set the tangent attribute that will be pushed with the next vertex.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ImmediateMesh_method_surface_set_uv:
- .. rst-class:: classref-method
- |void| **surface_set_uv**\ (\ uv\: :ref:`Vector2<class_Vector2>`\ ) :ref:`🔗<class_ImmediateMesh_method_surface_set_uv>`
- Set the UV attribute that will be pushed with the next vertex.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ImmediateMesh_method_surface_set_uv2:
- .. rst-class:: classref-method
- |void| **surface_set_uv2**\ (\ uv2\: :ref:`Vector2<class_Vector2>`\ ) :ref:`🔗<class_ImmediateMesh_method_surface_set_uv2>`
- Set the UV2 attribute that will be pushed with the next vertex.
- .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
- .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
- .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
- .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
- .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
- .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
- .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
- .. |void| replace:: :abbr:`void (No return value.)`
|