2021-06-30 03:55:11 +02:00
<?xml version="1.0" encoding="UTF-8" ?>
2023-07-06 10:08:05 +02:00
<class name= "ImmediateMesh" inherits= "Mesh" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "../class.xsd" >
2021-06-30 03:55:11 +02:00
<brief_description >
Mesh optimized for creating geometry manually.
</brief_description>
<description >
2023-04-26 11:58:13 +02:00
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]
2023-05-18 14:20:53 +02:00
[gdscript]
2023-04-26 11:58:13 +02:00
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()
2023-05-18 14:20:53 +02:00
[/gdscript]
2023-10-23 14:50:07 +02:00
[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]
2023-04-26 11:58:13 +02:00
[/codeblocks]
[b]Note:[/b] Generating complex geometries with [ImmediateMesh] is highly inefficient. Instead, it is designed to generate simple geometry that changes often.
2021-06-30 03:55:11 +02:00
</description>
<tutorials >
2023-04-26 11:58:13 +02:00
<link title= "Using ImmediateMesh" > $DOCS_URL/tutorials/3d/procedural_geometry/immediatemesh.html</link>
2021-06-30 03:55:11 +02:00
</tutorials>
<methods >
<method name= "clear_surfaces" >
2021-07-30 15:28:05 +02:00
<return type= "void" />
2021-06-30 03:55:11 +02:00
<description >
Clear all surfaces.
</description>
</method>
<method name= "surface_add_vertex" >
2021-07-30 15:28:05 +02:00
<return type= "void" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "vertex" type= "Vector3" />
2021-06-30 03:55:11 +02:00
<description >
Add a 3D vertex using the current attributes previously set.
</description>
</method>
<method name= "surface_add_vertex_2d" >
2021-07-30 15:28:05 +02:00
<return type= "void" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "vertex" type= "Vector2" />
2021-06-30 03:55:11 +02:00
<description >
Add a 2D vertex using the current attributes previously set.
</description>
</method>
<method name= "surface_begin" >
2021-07-30 15:28:05 +02:00
<return type= "void" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "primitive" type= "int" enum= "Mesh.PrimitiveType" />
<param index= "1" name= "material" type= "Material" default= "null" />
2021-06-30 03:55:11 +02:00
<description >
Begin a new surface.
</description>
</method>
<method name= "surface_end" >
2021-07-30 15:28:05 +02:00
<return type= "void" />
2021-06-30 03:55:11 +02:00
<description >
End and commit current surface. Note that surface being created will not be visible until this function is called.
</description>
</method>
<method name= "surface_set_color" >
2021-07-30 15:28:05 +02:00
<return type= "void" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "color" type= "Color" />
2021-06-30 03:55:11 +02:00
<description >
Set the color attribute that will be pushed with the next vertex.
</description>
</method>
<method name= "surface_set_normal" >
2021-07-30 15:28:05 +02:00
<return type= "void" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "normal" type= "Vector3" />
2021-06-30 03:55:11 +02:00
<description >
Set the normal attribute that will be pushed with the next vertex.
</description>
</method>
<method name= "surface_set_tangent" >
2021-07-30 15:28:05 +02:00
<return type= "void" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "tangent" type= "Plane" />
2021-06-30 03:55:11 +02:00
<description >
Set the tangent attribute that will be pushed with the next vertex.
</description>
</method>
<method name= "surface_set_uv" >
2021-07-30 15:28:05 +02:00
<return type= "void" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "uv" type= "Vector2" />
2021-06-30 03:55:11 +02:00
<description >
Set the UV attribute that will be pushed with the next vertex.
</description>
</method>
<method name= "surface_set_uv2" >
2021-07-30 15:28:05 +02:00
<return type= "void" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "uv2" type= "Vector2" />
2021-06-30 03:55:11 +02:00
<description >
Set the UV2 attribute that will be pushed with the next vertex.
</description>
</method>
</methods>
</class>