Table of Contents

Class ImmediateMesh

Namespace
Godot
Assembly
GodotSharp.dll

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 = 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.

public class ImmediateMesh : Mesh, IDisposable
Inheritance
ImmediateMesh
Implements
Inherited Members

Constructors

ImmediateMesh()

public ImmediateMesh()

Methods

ClearSurfaces()

Clear all surfaces.

public void ClearSurfaces()

HasGodotClassMethod(in godot_string_name)

Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.

protected override bool HasGodotClassMethod(in godot_string_name method)

Parameters

method godot_string_name

Name of the method to check for.

Returns

bool

HasGodotClassSignal(in godot_string_name)

Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.

protected override bool HasGodotClassSignal(in godot_string_name signal)

Parameters

signal godot_string_name

Name of the signal to check for.

Returns

bool

InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)

Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.

protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)

Parameters

method godot_string_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool

SurfaceAddVertex(Vector3)

Add a 3D vertex using the current attributes previously set.

public void SurfaceAddVertex(Vector3 vertex)

Parameters

vertex Vector3

SurfaceAddVertex2D(Vector2)

Add a 2D vertex using the current attributes previously set.

public void SurfaceAddVertex2D(Vector2 vertex)

Parameters

vertex Vector2

SurfaceBegin(PrimitiveType, Material)

Begin a new surface.

public void SurfaceBegin(Mesh.PrimitiveType primitive, Material material = null)

Parameters

primitive Mesh.PrimitiveType
material Material

SurfaceEnd()

End and commit current surface. Note that surface being created will not be visible until this function is called.

public void SurfaceEnd()

SurfaceSetColor(Color)

Set the color attribute that will be pushed with the next vertex.

public void SurfaceSetColor(Color color)

Parameters

color Color

SurfaceSetNormal(Vector3)

Set the normal attribute that will be pushed with the next vertex.

public void SurfaceSetNormal(Vector3 normal)

Parameters

normal Vector3

SurfaceSetTangent(Plane)

Set the tangent attribute that will be pushed with the next vertex.

public void SurfaceSetTangent(Plane tangent)

Parameters

tangent Plane

SurfaceSetUV(Vector2)

Set the UV attribute that will be pushed with the next vertex.

public void SurfaceSetUV(Vector2 uV)

Parameters

uV Vector2

SurfaceSetUV2(Vector2)

Set the UV2 attribute that will be pushed with the next vertex.

public void SurfaceSetUV2(Vector2 uV2)

Parameters

uV2 Vector2