Table of Contents

Class ImmediateMesh

Mesh optimized for creating geometry manually.

Inheritance
ImmediateMesh

Remarks

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()

Note: Generating complex geometries with ImmediateMesh is highly inefficient. Instead, it is designed to generate simple geometry that changes often.

See Also

Methods

clear_surfaces

Clear all surfaces.

void clear_surfaces

surface_add_vertex(Vector3)

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

void surface_add_vertex(Vector3 vertex)

Parameters

vertex Vector3

surface_add_vertex_2d(Vector2)

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

void surface_add_vertex_2d(Vector2 vertex)

Parameters

vertex Vector2

surface_begin(int, Material)

Begin a new surface.

void surface_begin(int primitive, Material material)

Parameters

primitive int
material Material

surface_end

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

void surface_end

surface_set_color(Color)

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

void surface_set_color(Color color)

Parameters

color Color

surface_set_normal(Vector3)

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

void surface_set_normal(Vector3 normal)

Parameters

normal Vector3

surface_set_tangent(Plane)

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

void surface_set_tangent(Plane tangent)

Parameters

tangent Plane

surface_set_uv(Vector2)

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

void surface_set_uv(Vector2 uv)

Parameters

uv Vector2

surface_set_uv2(Vector2)

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

void surface_set_uv2(Vector2 uv2)

Parameters

uv2 Vector2