Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
ImmediateMesh
Eredita: Mesh < Resource < RefCounted < Object
Mesh ottimizzata per la creazione manuale della geometria.
Descrizione
Un tipo di mesh ottimizzato per la creazione manuale di geometrie, simile alla modalità immediata di OpenGL 1.x.
Ecco un esempio su come generare una faccia triangolare:
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();
Nota: Generare geometrie complesse con ImmediateMesh è estremamente inefficiente. Invece, è progettato per generare geometrie semplici che cambiano spesso.
Tutorial
Metodi
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) |
Descrizioni dei metodi
void clear_surfaces() 🔗
Cancella tutte le superfici.
void surface_add_vertex(vertex: Vector3) 🔗
Aggiungere un vertice 3D utilizzando gli attributi attuali impostati in precedenza.
void surface_add_vertex_2d(vertex: Vector2) 🔗
Aggiungere un vertice 2D utilizzando gli attributi attuali impostati in precedenza.
void surface_begin(primitive: PrimitiveType, material: Material = null) 🔗
Inizia una nuova superficie.
void surface_end() 🔗
Finisce e conferma la superficie attuale. Nota che la superficie creata non sarà visibile finché non verrà chiamata questa funzione.
void surface_set_color(color: Color) 🔗
Imposta l'attributo del colore che sarà trasferito al vertice successivo.
void surface_set_normal(normal: Vector3) 🔗
Imposta l'attributo della normale che sarà trasferito al vertice successivo.
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) 🔗
Imposta l'attributo dell'UV che sarà trasferito al vertice successivo.
void surface_set_uv2(uv2: Vector2) 🔗
Imposta l'attributo dell'UV2 che sarà trasferito al vertice successivo.