ImmediateMesh
Hereda: Mesh < Resource < RefCounted < Object
Malla optimizada para crear geometría manualmente.
Descripción
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()
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.
Tutoriales
Métodos
void |
|
void |
surface_add_vertex(vertex: Vector3) |
void |
surface_add_vertex_2d(vertex: Vector2) |
void |
surface_begin(primitive: PrimitiveType, material: Material = null) |
void |
|
void |
surface_set_color(color: Color) |
void |
surface_set_normal(normal: Vector3) |
void |
surface_set_tangent(tangent: Plane) |
void |
surface_set_uv(uv: Vector2) |
void |
surface_set_uv2(uv2: Vector2) |
Descripciones de Métodos
void clear_surfaces() 🔗
Despeja todas las superficies.
void surface_add_vertex(vertex: Vector3) 🔗
Añade un vértice 3D usando los atributos actuales previamente establecidos.
void surface_add_vertex_2d(vertex: Vector2) 🔗
Añade un vértice 2D usando los atributos actuales previamente establecidos.
void surface_begin(primitive: PrimitiveType, material: Material = null) 🔗
Inicia una nueva superficie.
void surface_end() 🔗
Finaliza y confirma la superficie actual. Ten en cuenta que la superficie que se está creando no será visible hasta que se llame a esta función.
void surface_set_color(color: Color) 🔗
Establece el atributo de color que se enviará con el siguiente vértice.
void surface_set_normal(normal: Vector3) 🔗
Establece el atributo normal que se enviará con el siguiente vértice.
void surface_set_tangent(tangent: Plane) 🔗
Set the tangent attribute that will be pushed with the next vertex.
Note: Even though tangent is a Plane, it does not directly represent the tangent plane. Its Plane.x, Plane.y, and Plane.z represent the tangent vector and Plane.d should be either -1 or 1. See also Mesh.ARRAY_TANGENT.
void surface_set_uv(uv: Vector2) 🔗
Establece el atributo UV que se enviará con el siguiente vértice.
void surface_set_uv2(uv2: Vector2) 🔗
Establece el atributo UV2 que se enviará con el siguiente vértice.