Inherits: Mesh < Resource < RefCounted < Object
Mesh optimized for creating geometry manually.
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:
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()C#
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.
void | clear_surfaces ( ) |
void | surface_add_vertex ( Vector3 vertex ) |
void | surface_add_vertex_2d ( Vector2 vertex ) |
void | surface_begin ( PrimitiveType primitive, Material material=null ) |
void | surface_end ( ) |
void | surface_set_color ( Color color ) |
void | surface_set_normal ( Vector3 normal ) |
void | surface_set_tangent ( Plane tangent ) |
void | surface_set_uv ( Vector2 uv ) |
void | surface_set_uv2 ( Vector2 uv2 ) |
Clear all surfaces.
Add a 3D vertex using the current attributes previously set.
Add a 2D vertex using the current attributes previously set.
Begin a new surface.
End and commit current surface. Note that surface being created will not be visible until this function is called.
Set the color attribute that will be pushed with the next vertex.
Set the normal attribute that will be pushed with the next vertex.
Set the tangent attribute that will be pushed with the next vertex.
Set the UV attribute that will be pushed with the next vertex.
Set the UV2 attribute that will be pushed with the next vertex.
© 2014–present Juan Linietsky, Ariel Manzur and the Godot community
Licensed under the Creative Commons Attribution Unported License v3.0.
https://docs.godotengine.org/en/4.2/classes/class_immediatemesh.html