Skip to content
0.2.0-dev Download ZIP
104 lines ·3.8 KB Raw
1<?xml version="1.0" encoding="UTF-8" ?>
2<class name="ImmediateMesh" inherits="Mesh" api_type="core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
3 <brief_description>
4 Mesh optimized for creating geometry manually.
5 </brief_description>
6 <description>
7 A mesh type optimized for creating geometry manually, similar to OpenGL 1.x immediate mode.
8 Here's a sample on how to generate a triangular face:
9 [codeblocks]
10 [gdscript]
11 var mesh = ImmediateMesh.new()
12 mesh.surface_begin(Mesh.PRIMITIVE_TRIANGLES)
13 mesh.surface_add_vertex(Vector3.LEFT)
14 mesh.surface_add_vertex(Vector3.FORWARD)
15 mesh.surface_add_vertex(Vector3.ZERO)
16 mesh.surface_end()
17 [/gdscript]
18 [csharp]
19 var mesh = new ImmediateMesh();
20 mesh.SurfaceBegin(Mesh.PrimitiveType.Triangles);
21 mesh.SurfaceAddVertex(Vector3.Left);
22 mesh.SurfaceAddVertex(Vector3.Forward);
23 mesh.SurfaceAddVertex(Vector3.Zero);
24 mesh.SurfaceEnd();
25 [/csharp]
26 [/codeblocks]
27 [b]Note:[/b] Generating complex geometries with [ImmediateMesh] is highly inefficient. Instead, it is designed to generate simple geometry that changes often.
28 </description>
29 <tutorials>
30 <link title="Using ImmediateMesh">$DOCS_URL/tutorials/3d/procedural_geometry/immediatemesh.html</link>
31 </tutorials>
32 <methods>
33 <method name="clear_surfaces">
34 <return type="void" />
35 <description>
36 Clear all surfaces.
37 </description>
38 </method>
39 <method name="surface_add_vertex">
40 <return type="void" />
41 <param index="0" name="vertex" type="Vector3" />
42 <description>
43 Add a 3D vertex using the current attributes previously set.
44 </description>
45 </method>
46 <method name="surface_add_vertex_2d">
47 <return type="void" />
48 <param index="0" name="vertex" type="Vector2" />
49 <description>
50 Add a 2D vertex using the current attributes previously set.
51 </description>
52 </method>
53 <method name="surface_begin">
54 <return type="void" />
55 <param index="0" name="primitive" type="int" enum="Mesh.PrimitiveType" />
56 <param index="1" name="material" type="Material" default="null" />
57 <description>
58 Begin a new surface.
59 </description>
60 </method>
61 <method name="surface_end">
62 <return type="void" />
63 <description>
64 End and commit current surface. Note that surface being created will not be visible until this function is called.
65 </description>
66 </method>
67 <method name="surface_set_color">
68 <return type="void" />
69 <param index="0" name="color" type="Color" />
70 <description>
71 Set the color attribute that will be pushed with the next vertex.
72 </description>
73 </method>
74 <method name="surface_set_normal">
75 <return type="void" />
76 <param index="0" name="normal" type="Vector3" />
77 <description>
78 Set the normal attribute that will be pushed with the next vertex.
79 </description>
80 </method>
81 <method name="surface_set_tangent">
82 <return type="void" />
83 <param index="0" name="tangent" type="Plane" />
84 <description>
85 Set the tangent attribute that will be pushed with the next vertex.
86 [b]Note:[/b] Even though [param tangent] is a [Plane], it does not directly represent the tangent plane. Its [member Plane.x], [member Plane.y], and [member Plane.z] represent the tangent vector and [member Plane.d] should be either [code]-1[/code] or [code]1[/code]. See also [constant Mesh.ARRAY_TANGENT].
87 </description>
88 </method>
89 <method name="surface_set_uv">
90 <return type="void" />
91 <param index="0" name="uv" type="Vector2" />
92 <description>
93 Set the UV attribute that will be pushed with the next vertex.
94 </description>
95 </method>
96 <method name="surface_set_uv2">
97 <return type="void" />
98 <param index="0" name="uv2" type="Vector2" />
99 <description>
100 Set the UV2 attribute that will be pushed with the next vertex.
101 </description>
102 </method>
103 </methods>
104</class>