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: [codeblocks] [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() [/gdscript] [csharp] var mesh = new ImmediateMesh(); mesh.SurfaceBegin(Mesh.PrimitiveType.Triangles); mesh.SurfaceAddVertex(Vector3.Left); mesh.SurfaceAddVertex(Vector3.Forward); mesh.SurfaceAddVertex(Vector3.Zero); mesh.SurfaceEnd(); [/csharp] [/codeblocks] [b]Note:[/b] Generating complex geometries with [ImmediateMesh] is highly inefficient. Instead, it is designed to generate simple geometry that changes often.
$DOCS_URL/tutorials/3d/procedural_geometry/immediatemesh.html
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. [b]Note:[/b] Even though [param tangent] is a [Plane], it does not directly represent the tangent plane. Its [member Plane.x], [member Plane.y], and [member Plane.z] represent the tangent vector and [member Plane.d] should be either [code]-1[/code] or [code]1[/code]. See also [constant Mesh.ARRAY_TANGENT].
Set the UV attribute that will be pushed with the next vertex.
Set the UV2 attribute that will be pushed with the next vertex.