123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- :github_url: hide
- .. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
- .. DO NOT EDIT THIS FILE, but the ImmediateGeometry.xml source instead.
- .. The source is found in doc/classes or modules/<name>/doc_classes.
- .. _class_ImmediateGeometry:
- ImmediateGeometry
- =================
- **Inherits:** :ref:`GeometryInstance<class_GeometryInstance>` **<** :ref:`VisualInstance<class_VisualInstance>` **<** :ref:`CullInstance<class_CullInstance>` **<** :ref:`Spatial<class_Spatial>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
- Draws simple geometry from code.
- Description
- -----------
- Draws simple geometry from code. Uses a drawing mode similar to OpenGL 1.x.
- See also :ref:`ArrayMesh<class_ArrayMesh>`, :ref:`MeshDataTool<class_MeshDataTool>` and :ref:`SurfaceTool<class_SurfaceTool>` for procedural geometry generation.
- **Note:** ImmediateGeometry3D is best suited to small amounts of mesh data that change every frame. It will be slow when handling large amounts of mesh data. If mesh data doesn't change often, use :ref:`ArrayMesh<class_ArrayMesh>`, :ref:`MeshDataTool<class_MeshDataTool>` or :ref:`SurfaceTool<class_SurfaceTool>` instead.
- **Note:** Godot uses clockwise `winding order <https://learnopengl.com/Advanced-OpenGL/Face-culling>`__ for front faces of triangle primitive modes.
- **Note:** In case of missing points when handling large amounts of mesh data, try increasing its buffer size limit under :ref:`ProjectSettings.rendering/limits/buffers/immediate_buffer_size_kb<class_ProjectSettings_property_rendering/limits/buffers/immediate_buffer_size_kb>`.
- Methods
- -------
- +------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`add_sphere<class_ImmediateGeometry_method_add_sphere>` **(** :ref:`int<class_int>` lats, :ref:`int<class_int>` lons, :ref:`float<class_float>` radius, :ref:`bool<class_bool>` add_uv=true **)** |
- +------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`add_vertex<class_ImmediateGeometry_method_add_vertex>` **(** :ref:`Vector3<class_Vector3>` position **)** |
- +------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`begin<class_ImmediateGeometry_method_begin>` **(** :ref:`PrimitiveType<enum_Mesh_PrimitiveType>` primitive, :ref:`Texture<class_Texture>` texture=null **)** |
- +------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`clear<class_ImmediateGeometry_method_clear>` **(** **)** |
- +------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`end<class_ImmediateGeometry_method_end>` **(** **)** |
- +------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_color<class_ImmediateGeometry_method_set_color>` **(** :ref:`Color<class_Color>` color **)** |
- +------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_normal<class_ImmediateGeometry_method_set_normal>` **(** :ref:`Vector3<class_Vector3>` normal **)** |
- +------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_tangent<class_ImmediateGeometry_method_set_tangent>` **(** :ref:`Plane<class_Plane>` tangent **)** |
- +------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_uv<class_ImmediateGeometry_method_set_uv>` **(** :ref:`Vector2<class_Vector2>` uv **)** |
- +------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_uv2<class_ImmediateGeometry_method_set_uv2>` **(** :ref:`Vector2<class_Vector2>` uv **)** |
- +------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- Method Descriptions
- -------------------
- .. _class_ImmediateGeometry_method_add_sphere:
- - void **add_sphere** **(** :ref:`int<class_int>` lats, :ref:`int<class_int>` lons, :ref:`float<class_float>` radius, :ref:`bool<class_bool>` add_uv=true **)**
- Simple helper to draw an UV sphere with given latitude, longitude and radius.
- ----
- .. _class_ImmediateGeometry_method_add_vertex:
- - void **add_vertex** **(** :ref:`Vector3<class_Vector3>` position **)**
- Adds a vertex in local coordinate space with the currently set color/uv/etc.
- ----
- .. _class_ImmediateGeometry_method_begin:
- - void **begin** **(** :ref:`PrimitiveType<enum_Mesh_PrimitiveType>` primitive, :ref:`Texture<class_Texture>` texture=null **)**
- Begin drawing (and optionally pass a texture override). When done call :ref:`end<class_ImmediateGeometry_method_end>`. For more information on how this works, search for ``glBegin()`` and ``glEnd()`` references.
- For the type of primitive, see the :ref:`PrimitiveType<enum_Mesh_PrimitiveType>` enum.
- ----
- .. _class_ImmediateGeometry_method_clear:
- - void **clear** **(** **)**
- Clears everything that was drawn using begin/end.
- ----
- .. _class_ImmediateGeometry_method_end:
- - void **end** **(** **)**
- Ends a drawing context and displays the results.
- ----
- .. _class_ImmediateGeometry_method_set_color:
- - void **set_color** **(** :ref:`Color<class_Color>` color **)**
- The current drawing color.
- ----
- .. _class_ImmediateGeometry_method_set_normal:
- - void **set_normal** **(** :ref:`Vector3<class_Vector3>` normal **)**
- The next vertex's normal.
- ----
- .. _class_ImmediateGeometry_method_set_tangent:
- - void **set_tangent** **(** :ref:`Plane<class_Plane>` tangent **)**
- The next vertex's tangent (and binormal facing).
- ----
- .. _class_ImmediateGeometry_method_set_uv:
- - void **set_uv** **(** :ref:`Vector2<class_Vector2>` uv **)**
- The next vertex's UV.
- ----
- .. _class_ImmediateGeometry_method_set_uv2:
- - void **set_uv2** **(** :ref:`Vector2<class_Vector2>` uv **)**
- The next vertex's second layer UV.
- .. |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.)`
|