Debian Codegraph @

doc/classes/Mesh.xml

raw symbols SCIP
1 <?xml version="1.0" encoding="UTF-8" ?>
2 <class name="Mesh" inherits="Resource" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
3 <brief_description>
4 A [Resource] that contains vertex array-based geometry.
5 </brief_description>
6 <description>
7 Mesh is a type of [Resource] that contains vertex array-based geometry, divided in [i]surfaces[/i]. Each surface contains a completely separate array and a material used to draw it. Design wise, a mesh with multiple surfaces is preferred to a single surface, because objects created in 3D editing software commonly contain multiple materials. The maximum number of surfaces per mesh is [constant RenderingServer.MAX_MESH_SURFACES].
8 </description>
9 <tutorials>
10 <link title="3D Material Testers Demo">https://godotengine.org/asset-library/asset/2742</link>
11 <link title="3D Kinematic Character Demo">https://godotengine.org/asset-library/asset/2739</link>
12 <link title="3D Platformer Demo">https://godotengine.org/asset-library/asset/2748</link>
13 <link title="Third Person Shooter (TPS) Demo">https://godotengine.org/asset-library/asset/2710</link>
14 </tutorials>
15 <methods>
16 <method name="_get_aabb" qualifiers="virtual required const">
17 <return type="AABB" />
18 <description>
19 Virtual method to override the [AABB] for a custom class extending [Mesh].
20 </description>
21 </method>
22 <method name="_get_blend_shape_count" qualifiers="virtual required const">
23 <return type="int" />
24 <description>
25 Virtual method to override the number of blend shapes for a custom class extending [Mesh].
26 </description>
27 </method>
28 <method name="_get_blend_shape_name" qualifiers="virtual required const">
29 <return type="StringName" />
30 <param index="0" name="index" type="int" />
31 <description>
32 Virtual method to override the retrieval of blend shape names for a custom class extending [Mesh].
33 </description>
34 </method>
35 <method name="_get_surface_count" qualifiers="virtual required const">
36 <return type="int" />
37 <description>
38 Virtual method to override the surface count for a custom class extending [Mesh].
39 </description>
40 </method>
41 <method name="_set_blend_shape_name" qualifiers="virtual required">
42 <return type="void" />
43 <param index="0" name="index" type="int" />
44 <param index="1" name="name" type="StringName" />
45 <description>
46 Virtual method to override the names of blend shapes for a custom class extending [Mesh].
47 </description>
48 </method>
49 <method name="_surface_get_array_index_len" qualifiers="virtual required const">
50 <return type="int" />
51 <param index="0" name="index" type="int" />
52 <description>
53 Virtual method to override the surface array index length for a custom class extending [Mesh].
54 </description>
55 </method>
56 <method name="_surface_get_array_len" qualifiers="virtual required const">
57 <return type="int" />
58 <param index="0" name="index" type="int" />
59 <description>
60 Virtual method to override the surface array length for a custom class extending [Mesh].
61 </description>
62 </method>
63 <method name="_surface_get_arrays" qualifiers="virtual required const">
64 <return type="Array" />
65 <param index="0" name="index" type="int" />
66 <description>
67 Virtual method to override the surface arrays for a custom class extending [Mesh].
68 </description>
69 </method>
70 <method name="_surface_get_blend_shape_arrays" qualifiers="virtual required const">
71 <return type="Array[]" />
72 <param index="0" name="index" type="int" />
73 <description>
74 Virtual method to override the blend shape arrays for a custom class extending [Mesh].
75 </description>
76 </method>
77 <method name="_surface_get_format" qualifiers="virtual required const">
78 <return type="int" />
79 <param index="0" name="index" type="int" />
80 <description>
81 Virtual method to override the surface format for a custom class extending [Mesh].
82 </description>
83 </method>
84 <method name="_surface_get_lods" qualifiers="virtual required const">
85 <return type="Dictionary" />
86 <param index="0" name="index" type="int" />
87 <description>
88 Virtual method to override the surface LODs for a custom class extending [Mesh].
89 </description>
90 </method>
91 <method name="_surface_get_material" qualifiers="virtual required const">
92 <return type="Material" />
93 <param index="0" name="index" type="int" />
94 <description>
95 Virtual method to override the surface material for a custom class extending [Mesh].
96 </description>
97 </method>
98 <method name="_surface_get_primitive_type" qualifiers="virtual required const">
99 <return type="int" />
100 <param index="0" name="index" type="int" />
101 <description>
102 Virtual method to override the surface primitive type for a custom class extending [Mesh].
103 </description>
104 </method>
105 <method name="_surface_set_material" qualifiers="virtual required">
106 <return type="void" />
107 <param index="0" name="index" type="int" />
108 <param index="1" name="material" type="Material" />
109 <description>
110 Virtual method to override the setting of a [param material] at the given [param index] for a custom class extending [Mesh].
111 </description>
112 </method>
113 <method name="create_convex_shape" qualifiers="const">
114 <return type="ConvexPolygonShape3D" />
115 <param index="0" name="clean" type="bool" default="true" />
116 <param index="1" name="simplify" type="bool" default="false" />
117 <description>
118 Calculate a [ConvexPolygonShape3D] from the mesh.
119 If [param clean] is [code]true[/code] (default), duplicate and interior vertices are removed automatically. You can set it to [code]false[/code] to make the process faster if not needed.
120 If [param simplify] is [code]true[/code], the geometry can be further simplified to reduce the number of vertices. Disabled by default.
121 </description>
122 </method>
123 <method name="create_outline" qualifiers="const">
124 <return type="Mesh" />
125 <param index="0" name="margin" type="float" />
126 <description>
127 Calculate an outline mesh at a defined offset (margin) from the original mesh.
128 [b]Note:[/b] This method typically returns the vertices in reverse order (e.g. clockwise to counterclockwise).
129 </description>
130 </method>
131 <method name="create_placeholder" qualifiers="const">
132 <return type="Resource" />
133 <description>
134 Creates a placeholder version of this resource ([PlaceholderMesh]).
135 </description>
136 </method>
137 <method name="create_trimesh_shape" qualifiers="const">
138 <return type="ConcavePolygonShape3D" />
139 <description>
140 Calculate a [ConcavePolygonShape3D] from the mesh.
141 </description>
142 </method>
143 <method name="generate_triangle_mesh" qualifiers="const">
144 <return type="TriangleMesh" />
145 <description>
146 Generate a [TriangleMesh] from the mesh. Considers only surfaces using one of these primitive types: [constant PRIMITIVE_TRIANGLES], [constant PRIMITIVE_TRIANGLE_STRIP].
147 </description>
148 </method>
149 <method name="get_aabb" qualifiers="const">
150 <return type="AABB" />
151 <description>
152 Returns the smallest [AABB] enclosing this mesh in local space. Not affected by [code]custom_aabb[/code].
153 [b]Note:[/b] This is only implemented for [ArrayMesh] and [PrimitiveMesh].
154 </description>
155 </method>
156 <method name="get_faces" qualifiers="const">
157 <return type="PackedVector3Array" />
158 <description>
159 Returns all the vertices that make up the faces of the mesh. Each three vertices represent one triangle.
160 </description>
161 </method>
162 <method name="get_surface_count" qualifiers="const">
163 <return type="int" />
164 <description>
165 Returns the number of surfaces that the [Mesh] holds. This is equivalent to [method MeshInstance3D.get_surface_override_material_count].
166 </description>
167 </method>
168 <method name="surface_get_arrays" qualifiers="const">
169 <return type="Array" />
170 <param index="0" name="surf_idx" type="int" />
171 <description>
172 Returns the arrays for the vertices, normals, UVs, etc. that make up the requested surface (see [method ArrayMesh.add_surface_from_arrays]).
173 </description>
174 </method>
175 <method name="surface_get_blend_shape_arrays" qualifiers="const">
176 <return type="Array[]" />
177 <param index="0" name="surf_idx" type="int" />
178 <description>
179 Returns the blend shape arrays for the requested surface.
180 </description>
181 </method>
182 <method name="surface_get_material" qualifiers="const">
183 <return type="Material" />
184 <param index="0" name="surf_idx" type="int" />
185 <description>
186 Returns a [Material] in a given surface. Surface is rendered using this material.
187 [b]Note:[/b] This returns the material within the [Mesh] resource, not the [Material] associated to the [MeshInstance3D]'s Surface Material Override properties. To get the [Material] associated to the [MeshInstance3D]'s Surface Material Override properties, use [method MeshInstance3D.get_surface_override_material] instead.
188 </description>
189 </method>
190 <method name="surface_set_material">
191 <return type="void" />
192 <param index="0" name="surf_idx" type="int" />
193 <param index="1" name="material" type="Material" />
194 <description>
195 Sets a [Material] for a given surface. Surface will be rendered using this material.
196 [b]Note:[/b] This assigns the material within the [Mesh] resource, not the [Material] associated to the [MeshInstance3D]'s Surface Material Override properties. To set the [Material] associated to the [MeshInstance3D]'s Surface Material Override properties, use [method MeshInstance3D.set_surface_override_material] instead.
197 </description>
198 </method>
199 </methods>
200 <members>
201 <member name="lightmap_size_hint" type="Vector2i" setter="set_lightmap_size_hint" getter="get_lightmap_size_hint" default="Vector2i(0, 0)">
202 Sets a hint to be used for lightmap resolution.
203 </member>
204 </members>
205 <constants>
206 <constant name="PRIMITIVE_POINTS" value="0" enum="PrimitiveType">
207 Render array as points (one vertex equals one point).
208 </constant>
209 <constant name="PRIMITIVE_LINES" value="1" enum="PrimitiveType">
210 Render array as lines (every two vertices a line is created).
211 </constant>
212 <constant name="PRIMITIVE_LINE_STRIP" value="2" enum="PrimitiveType">
213 Render array as line strip.
214 </constant>
215 <constant name="PRIMITIVE_TRIANGLES" value="3" enum="PrimitiveType">
216 Render array as triangles (every three vertices a triangle is created).
217 </constant>
218 <constant name="PRIMITIVE_TRIANGLE_STRIP" value="4" enum="PrimitiveType">
219 Render array as triangle strips.
220 </constant>
221 <constant name="ARRAY_VERTEX" value="0" enum="ArrayType">
222 [PackedVector3Array], [PackedVector2Array], or [Array] of vertex positions.
223 </constant>
224 <constant name="ARRAY_NORMAL" value="1" enum="ArrayType">
225 [PackedVector3Array] of vertex normals.
226 [b]Note:[/b] The array has to consist of normal vectors, otherwise they will be normalized by the engine, potentially causing visual discrepancies.
227 </constant>
228 <constant name="ARRAY_TANGENT" value="2" enum="ArrayType">
229 [PackedFloat32Array] of vertex tangents. Each element in groups of 4 floats, first 3 floats determine the tangent, and the last the binormal direction as -1 or 1.
230 </constant>
231 <constant name="ARRAY_COLOR" value="3" enum="ArrayType">
232 [PackedColorArray] of vertex colors.
233 </constant>
234 <constant name="ARRAY_TEX_UV" value="4" enum="ArrayType">
235 [PackedVector2Array] for UV coordinates.
236 </constant>
237 <constant name="ARRAY_TEX_UV2" value="5" enum="ArrayType">
238 [PackedVector2Array] for second UV coordinates.
239 </constant>
240 <constant name="ARRAY_CUSTOM0" value="6" enum="ArrayType">
241 Contains custom color channel 0. [PackedByteArray] if [code](format &gt;&gt; Mesh.ARRAY_FORMAT_CUSTOM0_SHIFT) &amp; Mesh.ARRAY_FORMAT_CUSTOM_MASK[/code] is [constant ARRAY_CUSTOM_RGBA8_UNORM], [constant ARRAY_CUSTOM_RGBA8_SNORM], [constant ARRAY_CUSTOM_RG_HALF], or [constant ARRAY_CUSTOM_RGBA_HALF]. [PackedFloat32Array] otherwise.
242 </constant>
243 <constant name="ARRAY_CUSTOM1" value="7" enum="ArrayType">
244 Contains custom color channel 1. [PackedByteArray] if [code](format &gt;&gt; Mesh.ARRAY_FORMAT_CUSTOM1_SHIFT) &amp; Mesh.ARRAY_FORMAT_CUSTOM_MASK[/code] is [constant ARRAY_CUSTOM_RGBA8_UNORM], [constant ARRAY_CUSTOM_RGBA8_SNORM], [constant ARRAY_CUSTOM_RG_HALF], or [constant ARRAY_CUSTOM_RGBA_HALF]. [PackedFloat32Array] otherwise.
245 </constant>
246 <constant name="ARRAY_CUSTOM2" value="8" enum="ArrayType">
247 Contains custom color channel 2. [PackedByteArray] if [code](format &gt;&gt; Mesh.ARRAY_FORMAT_CUSTOM2_SHIFT) &amp; Mesh.ARRAY_FORMAT_CUSTOM_MASK[/code] is [constant ARRAY_CUSTOM_RGBA8_UNORM], [constant ARRAY_CUSTOM_RGBA8_SNORM], [constant ARRAY_CUSTOM_RG_HALF], or [constant ARRAY_CUSTOM_RGBA_HALF]. [PackedFloat32Array] otherwise.
248 </constant>
249 <constant name="ARRAY_CUSTOM3" value="9" enum="ArrayType">
250 Contains custom color channel 3. [PackedByteArray] if [code](format &gt;&gt; Mesh.ARRAY_FORMAT_CUSTOM3_SHIFT) &amp; Mesh.ARRAY_FORMAT_CUSTOM_MASK[/code] is [constant ARRAY_CUSTOM_RGBA8_UNORM], [constant ARRAY_CUSTOM_RGBA8_SNORM], [constant ARRAY_CUSTOM_RG_HALF], or [constant ARRAY_CUSTOM_RGBA_HALF]. [PackedFloat32Array] otherwise.
251 </constant>
252 <constant name="ARRAY_BONES" value="10" enum="ArrayType">
253 [PackedFloat32Array] or [PackedInt32Array] of bone indices. Contains either 4 or 8 numbers per vertex depending on the presence of the [constant ARRAY_FLAG_USE_8_BONE_WEIGHTS] flag.
254 </constant>
255 <constant name="ARRAY_WEIGHTS" value="11" enum="ArrayType">
256 [PackedFloat32Array] or [PackedFloat64Array] of bone weights in the range [code]0.0[/code] to [code]1.0[/code] (inclusive). Contains either 4 or 8 numbers per vertex depending on the presence of the [constant ARRAY_FLAG_USE_8_BONE_WEIGHTS] flag.
257 </constant>
258 <constant name="ARRAY_INDEX" value="12" enum="ArrayType">
259 [PackedInt32Array] of integers used as indices referencing vertices, colors, normals, tangents, and textures. All of those arrays must have the same number of elements as the vertex array. No index can be beyond the vertex array size. When this index array is present, it puts the function into "index mode," where the index selects the [i]i[/i]'th vertex, normal, tangent, color, UV, etc. This means if you want to have different normals or colors along an edge, you have to duplicate the vertices.
260 For triangles, the index array is interpreted as triples, referring to the vertices of each triangle. For lines, the index array is in pairs indicating the start and end of each line.
261 </constant>
262 <constant name="ARRAY_MAX" value="13" enum="ArrayType">
263 Represents the size of the [enum ArrayType] enum.
264 </constant>
265 <constant name="ARRAY_CUSTOM_RGBA8_UNORM" value="0" enum="ArrayCustomFormat">
266 Indicates this custom channel contains unsigned normalized byte colors from 0 to 1, encoded as [PackedByteArray].
267 </constant>
268 <constant name="ARRAY_CUSTOM_RGBA8_SNORM" value="1" enum="ArrayCustomFormat">
269 Indicates this custom channel contains signed normalized byte colors from -1 to 1, encoded as [PackedByteArray].
270 </constant>
271 <constant name="ARRAY_CUSTOM_RG_HALF" value="2" enum="ArrayCustomFormat">
272 Indicates this custom channel contains half precision float colors, encoded as [PackedByteArray]. Only red and green channels are used.
273 </constant>
274 <constant name="ARRAY_CUSTOM_RGBA_HALF" value="3" enum="ArrayCustomFormat">
275 Indicates this custom channel contains half precision float colors, encoded as [PackedByteArray].
276 </constant>
277 <constant name="ARRAY_CUSTOM_R_FLOAT" value="4" enum="ArrayCustomFormat">
278 Indicates this custom channel contains full float colors, in a [PackedFloat32Array]. Only the red channel is used.
279 </constant>
280 <constant name="ARRAY_CUSTOM_RG_FLOAT" value="5" enum="ArrayCustomFormat">
281 Indicates this custom channel contains full float colors, in a [PackedFloat32Array]. Only red and green channels are used.
282 </constant>
283 <constant name="ARRAY_CUSTOM_RGB_FLOAT" value="6" enum="ArrayCustomFormat">
284 Indicates this custom channel contains full float colors, in a [PackedFloat32Array]. Only red, green and blue channels are used.
285 </constant>
286 <constant name="ARRAY_CUSTOM_RGBA_FLOAT" value="7" enum="ArrayCustomFormat">
287 Indicates this custom channel contains full float colors, in a [PackedFloat32Array].
288 </constant>
289 <constant name="ARRAY_CUSTOM_MAX" value="8" enum="ArrayCustomFormat">
290 Represents the size of the [enum ArrayCustomFormat] enum.
291 </constant>
292 <constant name="ARRAY_FORMAT_VERTEX" value="1" enum="ArrayFormat" is_bitfield="true">
293 Mesh array contains vertices. All meshes require a vertex array so this should always be present.
294 </constant>
295 <constant name="ARRAY_FORMAT_NORMAL" value="2" enum="ArrayFormat" is_bitfield="true">
296 Mesh array contains normals.
297 </constant>
298 <constant name="ARRAY_FORMAT_TANGENT" value="4" enum="ArrayFormat" is_bitfield="true">
299 Mesh array contains tangents.
300 </constant>
301 <constant name="ARRAY_FORMAT_COLOR" value="8" enum="ArrayFormat" is_bitfield="true">
302 Mesh array contains colors.
303 </constant>
304 <constant name="ARRAY_FORMAT_TEX_UV" value="16" enum="ArrayFormat" is_bitfield="true">
305 Mesh array contains UVs.
306 </constant>
307 <constant name="ARRAY_FORMAT_TEX_UV2" value="32" enum="ArrayFormat" is_bitfield="true">
308 Mesh array contains second UV.
309 </constant>
310 <constant name="ARRAY_FORMAT_CUSTOM0" value="64" enum="ArrayFormat" is_bitfield="true">
311 Mesh array contains custom channel index 0.
312 </constant>
313 <constant name="ARRAY_FORMAT_CUSTOM1" value="128" enum="ArrayFormat" is_bitfield="true">
314 Mesh array contains custom channel index 1.
315 </constant>
316 <constant name="ARRAY_FORMAT_CUSTOM2" value="256" enum="ArrayFormat" is_bitfield="true">
317 Mesh array contains custom channel index 2.
318 </constant>
319 <constant name="ARRAY_FORMAT_CUSTOM3" value="512" enum="ArrayFormat" is_bitfield="true">
320 Mesh array contains custom channel index 3.
321 </constant>
322 <constant name="ARRAY_FORMAT_BONES" value="1024" enum="ArrayFormat" is_bitfield="true">
323 Mesh array contains bones.
324 </constant>
325 <constant name="ARRAY_FORMAT_WEIGHTS" value="2048" enum="ArrayFormat" is_bitfield="true">
326 Mesh array contains bone weights.
327 </constant>
328 <constant name="ARRAY_FORMAT_INDEX" value="4096" enum="ArrayFormat" is_bitfield="true">
329 Mesh array uses indices.
330 </constant>
331 <constant name="ARRAY_FORMAT_BLEND_SHAPE_MASK" value="7" enum="ArrayFormat" is_bitfield="true">
332 Mask of mesh channels permitted in blend shapes.
333 </constant>
334 <constant name="ARRAY_FORMAT_CUSTOM_BASE" value="13" enum="ArrayFormat" is_bitfield="true">
335 Shift of first custom channel.
336 </constant>
337 <constant name="ARRAY_FORMAT_CUSTOM_BITS" value="3" enum="ArrayFormat" is_bitfield="true">
338 Number of format bits per custom channel. See [enum ArrayCustomFormat].
339 </constant>
340 <constant name="ARRAY_FORMAT_CUSTOM0_SHIFT" value="13" enum="ArrayFormat" is_bitfield="true">
341 Amount to shift [enum ArrayCustomFormat] for custom channel index 0.
342 </constant>
343 <constant name="ARRAY_FORMAT_CUSTOM1_SHIFT" value="16" enum="ArrayFormat" is_bitfield="true">
344 Amount to shift [enum ArrayCustomFormat] for custom channel index 1.
345 </constant>
346 <constant name="ARRAY_FORMAT_CUSTOM2_SHIFT" value="19" enum="ArrayFormat" is_bitfield="true">
347 Amount to shift [enum ArrayCustomFormat] for custom channel index 2.
348 </constant>
349 <constant name="ARRAY_FORMAT_CUSTOM3_SHIFT" value="22" enum="ArrayFormat" is_bitfield="true">
350 Amount to shift [enum ArrayCustomFormat] for custom channel index 3.
351 </constant>
352 <constant name="ARRAY_FORMAT_CUSTOM_MASK" value="7" enum="ArrayFormat" is_bitfield="true">
353 Mask of custom format bits per custom channel. Must be shifted by one of the SHIFT constants. See [enum ArrayCustomFormat].
354 </constant>
355 <constant name="ARRAY_COMPRESS_FLAGS_BASE" value="25" enum="ArrayFormat" is_bitfield="true">
356 Shift of first compress flag. Compress flags should be passed to [method ArrayMesh.add_surface_from_arrays] and [method SurfaceTool.commit].
357 </constant>
358 <constant name="ARRAY_FLAG_USE_2D_VERTICES" value="33554432" enum="ArrayFormat" is_bitfield="true">
359 Flag used to mark that the array contains 2D vertices.
360 </constant>
361 <constant name="ARRAY_FLAG_USE_DYNAMIC_UPDATE" value="67108864" enum="ArrayFormat" is_bitfield="true">
362 Flag used to mark that the mesh data will use [code]GL_DYNAMIC_DRAW[/code] on GLES. Unused on Vulkan.
363 </constant>
364 <constant name="ARRAY_FLAG_USE_8_BONE_WEIGHTS" value="134217728" enum="ArrayFormat" is_bitfield="true">
365 Flag used to mark that the mesh contains up to 8 bone influences per vertex. This flag indicates that [constant ARRAY_BONES] and [constant ARRAY_WEIGHTS] elements will have double length.
366 </constant>
367 <constant name="ARRAY_FLAG_USES_EMPTY_VERTEX_ARRAY" value="268435456" enum="ArrayFormat" is_bitfield="true">
368 Flag used to mark that the mesh intentionally contains no vertex array.
369 </constant>
370 <constant name="ARRAY_FLAG_COMPRESS_ATTRIBUTES" value="536870912" enum="ArrayFormat" is_bitfield="true">
371 Flag used to mark that a mesh is using compressed attributes (vertices, normals, tangents, UVs). When this form of compression is enabled, vertex positions will be packed into an RGBA16UNORM attribute and scaled in the vertex shader. The normal and tangent will be packed into an RG16UNORM representing an axis, and a 16-bit float stored in the A-channel of the vertex. UVs will use 16-bit normalized floats instead of full 32-bit signed floats. When using this compression mode you must use either vertices, normals, and tangents or only vertices. You cannot use normals without tangents. Importers will automatically enable this compression if they can.
372 </constant>
373 <constant name="BLEND_SHAPE_MODE_NORMALIZED" value="0" enum="BlendShapeMode">
374 Blend shapes are normalized.
375 </constant>
376 <constant name="BLEND_SHAPE_MODE_RELATIVE" value="1" enum="BlendShapeMode">
377 Blend shapes are relative to base weight.
378 </constant>
379 </constants>
380 </class>