summaryrefslogtreecommitdiff
path: root/doc/classes/Mesh.xml
blob: 8e98efa6fc3481dee6d1028dc783d9ff07bd3656 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
<?xml version="1.0" encoding="UTF-8" ?>
<class name="Mesh" inherits="Resource" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
	<brief_description>
		A [Resource] that contains vertex array-based geometry.
	</brief_description>
	<description>
		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.
	</description>
	<tutorials>
		<link title="3D Material Testers Demo">https://godotengine.org/asset-library/asset/123</link>
		<link title="3D Kinematic Character Demo">https://godotengine.org/asset-library/asset/126</link>
		<link title="3D Platformer Demo">https://godotengine.org/asset-library/asset/125</link>
		<link title="Third Person Shooter Demo">https://godotengine.org/asset-library/asset/678</link>
	</tutorials>
	<methods>
		<method name="_get_aabb" qualifiers="virtual const">
			<return type="AABB" />
			<description>
			</description>
		</method>
		<method name="_get_blend_shape_count" qualifiers="virtual const">
			<return type="int" />
			<description>
			</description>
		</method>
		<method name="_get_blend_shape_name" qualifiers="virtual const">
			<return type="StringName" />
			<param index="0" name="index" type="int" />
			<description>
			</description>
		</method>
		<method name="_get_surface_count" qualifiers="virtual const">
			<return type="int" />
			<description>
			</description>
		</method>
		<method name="_set_blend_shape_name" qualifiers="virtual">
			<return type="void" />
			<param index="0" name="index" type="int" />
			<param index="1" name="name" type="StringName" />
			<description>
			</description>
		</method>
		<method name="_surface_get_array_index_len" qualifiers="virtual const">
			<return type="int" />
			<param index="0" name="index" type="int" />
			<description>
			</description>
		</method>
		<method name="_surface_get_array_len" qualifiers="virtual const">
			<return type="int" />
			<param index="0" name="index" type="int" />
			<description>
			</description>
		</method>
		<method name="_surface_get_arrays" qualifiers="virtual const">
			<return type="Array" />
			<param index="0" name="index" type="int" />
			<description>
			</description>
		</method>
		<method name="_surface_get_blend_shape_arrays" qualifiers="virtual const">
			<return type="Array" />
			<param index="0" name="index" type="int" />
			<description>
			</description>
		</method>
		<method name="_surface_get_format" qualifiers="virtual const">
			<return type="int" />
			<param index="0" name="index" type="int" />
			<description>
			</description>
		</method>
		<method name="_surface_get_lods" qualifiers="virtual const">
			<return type="Dictionary" />
			<param index="0" name="index" type="int" />
			<description>
			</description>
		</method>
		<method name="_surface_get_material" qualifiers="virtual const">
			<return type="Material" />
			<param index="0" name="index" type="int" />
			<description>
			</description>
		</method>
		<method name="_surface_get_primitive_type" qualifiers="virtual const">
			<return type="int" />
			<param index="0" name="index" type="int" />
			<description>
			</description>
		</method>
		<method name="_surface_set_material" qualifiers="virtual">
			<return type="void" />
			<param index="0" name="index" type="int" />
			<param index="1" name="material" type="Material" />
			<description>
			</description>
		</method>
		<method name="create_convex_shape" qualifiers="const">
			<return type="Shape3D" />
			<param index="0" name="clean" type="bool" default="true" />
			<param index="1" name="simplify" type="bool" default="false" />
			<description>
				Calculate a [ConvexPolygonShape3D] from the mesh.
				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.
				If [param simplify] is [code]true[/code], the geometry can be further simplified to reduce the number of vertices. Disabled by default.
			</description>
		</method>
		<method name="create_outline" qualifiers="const">
			<return type="Mesh" />
			<param index="0" name="margin" type="float" />
			<description>
				Calculate an outline mesh at a defined offset (margin) from the original mesh.
				[b]Note:[/b] This method typically returns the vertices in reverse order (e.g. clockwise to counterclockwise).
			</description>
		</method>
		<method name="create_trimesh_shape" qualifiers="const">
			<return type="Shape3D" />
			<description>
				Calculate a [ConcavePolygonShape3D] from the mesh.
			</description>
		</method>
		<method name="generate_triangle_mesh" qualifiers="const">
			<return type="TriangleMesh" />
			<description>
				Generate a [TriangleMesh] from the mesh. Considers only surfaces using one of these primitive types: [constant PRIMITIVE_TRIANGLES], [constant PRIMITIVE_TRIANGLE_STRIP].
			</description>
		</method>
		<method name="get_aabb" qualifiers="const">
			<return type="AABB" />
			<description>
				Returns the smallest [AABB] enclosing this mesh in local space. Not affected by [code]custom_aabb[/code]. See also [method VisualInstance3D.get_transformed_aabb].
				[b]Note:[/b] This is only implemented for [ArrayMesh] and [PrimitiveMesh].
			</description>
		</method>
		<method name="get_faces" qualifiers="const">
			<return type="PackedVector3Array" />
			<description>
				Returns all the vertices that make up the faces of the mesh. Each three vertices represent one triangle.
			</description>
		</method>
		<method name="get_surface_count" qualifiers="const">
			<return type="int" />
			<description>
				Returns the number of surfaces that the [Mesh] holds.
			</description>
		</method>
		<method name="surface_get_arrays" qualifiers="const">
			<return type="Array" />
			<param index="0" name="surf_idx" type="int" />
			<description>
				Returns the arrays for the vertices, normals, uvs, etc. that make up the requested surface (see [method ArrayMesh.add_surface_from_arrays]).
			</description>
		</method>
		<method name="surface_get_blend_shape_arrays" qualifiers="const">
			<return type="Array" />
			<param index="0" name="surf_idx" type="int" />
			<description>
				Returns the blend shape arrays for the requested surface.
			</description>
		</method>
		<method name="surface_get_material" qualifiers="const">
			<return type="Material" />
			<param index="0" name="surf_idx" type="int" />
			<description>
				Returns a [Material] in a given surface. Surface is rendered using this material.
			</description>
		</method>
		<method name="surface_set_material">
			<return type="void" />
			<param index="0" name="surf_idx" type="int" />
			<param index="1" name="material" type="Material" />
			<description>
				Sets a [Material] for a given surface. Surface will be rendered using this material.
			</description>
		</method>
	</methods>
	<members>
		<member name="lightmap_size_hint" type="Vector2i" setter="set_lightmap_size_hint" getter="get_lightmap_size_hint">
			Sets a hint to be used for lightmap resolution.
		</member>
	</members>
	<constants>
		<constant name="PRIMITIVE_POINTS" value="0" enum="PrimitiveType">
			Render array as points (one vertex equals one point).
		</constant>
		<constant name="PRIMITIVE_LINES" value="1" enum="PrimitiveType">
			Render array as lines (every two vertices a line is created).
		</constant>
		<constant name="PRIMITIVE_LINE_STRIP" value="2" enum="PrimitiveType">
			Render array as line strip.
		</constant>
		<constant name="PRIMITIVE_TRIANGLES" value="3" enum="PrimitiveType">
			Render array as triangles (every three vertices a triangle is created).
		</constant>
		<constant name="PRIMITIVE_TRIANGLE_STRIP" value="4" enum="PrimitiveType">
			Render array as triangle strips.
		</constant>
		<constant name="ARRAY_VERTEX" value="0" enum="ArrayType">
			[PackedVector3Array], [PackedVector2Array], or [Array] of vertex positions.
		</constant>
		<constant name="ARRAY_NORMAL" value="1" enum="ArrayType">
			[PackedVector3Array] of vertex normals.
		</constant>
		<constant name="ARRAY_TANGENT" value="2" enum="ArrayType">
			[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.
		</constant>
		<constant name="ARRAY_COLOR" value="3" enum="ArrayType">
			[PackedColorArray] of vertex colors.
		</constant>
		<constant name="ARRAY_TEX_UV" value="4" enum="ArrayType">
			[PackedVector2Array] for UV coordinates.
		</constant>
		<constant name="ARRAY_TEX_UV2" value="5" enum="ArrayType">
			[PackedVector2Array] for second UV coordinates.
		</constant>
		<constant name="ARRAY_CUSTOM0" value="6" enum="ArrayType">
			Contains custom color channel 0. [PackedByteArray] if [code](format &gt;&gt; [constant ARRAY_FORMAT_CUSTOM0_SHIFT]) &amp; [constant ARRAY_FORMAT_CUSTOM_MASK])[/code] is [constant ARRAY_CUSTOM_RGBA8_UNORM], [constant ARRAY_CUSTOM_RGBA8_UNORM], [constant ARRAY_CUSTOM_RG_HALF] or [constant ARRAY_CUSTOM_RGBA_HALF]. [PackedFloat32Array] otherwise.
		</constant>
		<constant name="ARRAY_CUSTOM1" value="7" enum="ArrayType">
			Contains custom color channel 1. [PackedByteArray] if [code](format &gt;&gt; [constant ARRAY_FORMAT_CUSTOM1_SHIFT]) &amp; [constant ARRAY_FORMAT_CUSTOM_MASK])[/code] is [constant ARRAY_CUSTOM_RGBA8_UNORM], [constant ARRAY_CUSTOM_RGBA8_UNORM], [constant ARRAY_CUSTOM_RG_HALF] or [constant ARRAY_CUSTOM_RGBA_HALF]. [PackedFloat32Array] otherwise.
		</constant>
		<constant name="ARRAY_CUSTOM2" value="8" enum="ArrayType">
			Contains custom color channel 2. [PackedByteArray] if [code](format &gt;&gt; [constant ARRAY_FORMAT_CUSTOM2_SHIFT]) &amp; [constant ARRAY_FORMAT_CUSTOM_MASK])[/code] is [constant ARRAY_CUSTOM_RGBA8_UNORM], [constant ARRAY_CUSTOM_RGBA8_UNORM], [constant ARRAY_CUSTOM_RG_HALF] or [constant ARRAY_CUSTOM_RGBA_HALF]. [PackedFloat32Array] otherwise.
		</constant>
		<constant name="ARRAY_CUSTOM3" value="9" enum="ArrayType">
			Contains custom color channel 3. [PackedByteArray] if [code](format &gt;&gt; [constant ARRAY_FORMAT_CUSTOM3_SHIFT]) &amp; [constant ARRAY_FORMAT_CUSTOM_MASK])[/code] is [constant ARRAY_CUSTOM_RGBA8_UNORM], [constant ARRAY_CUSTOM_RGBA8_UNORM], [constant ARRAY_CUSTOM_RG_HALF] or [constant ARRAY_CUSTOM_RGBA_HALF]. [PackedFloat32Array] otherwise.
		</constant>
		<constant name="ARRAY_BONES" value="10" enum="ArrayType">
			[PackedFloat32Array] or [PackedInt32Array] of bone indices. Each element is a group of 4 numbers.
		</constant>
		<constant name="ARRAY_WEIGHTS" value="11" enum="ArrayType">
			[PackedFloat32Array] of bone weights. Each element in groups of 4 floats.
		</constant>
		<constant name="ARRAY_INDEX" value="12" enum="ArrayType">
			[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*'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.
			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.
		</constant>
		<constant name="ARRAY_MAX" value="13" enum="ArrayType">
			Represents the size of the [enum ArrayType] enum.
		</constant>
		<constant name="ARRAY_CUSTOM_RGBA8_UNORM" value="0" enum="ArrayCustomFormat">
			Indicates this custom channel contains unsigned normalized byte colors from 0 to 1, encoded as [PackedByteArray].
		</constant>
		<constant name="ARRAY_CUSTOM_RGBA8_SNORM" value="1" enum="ArrayCustomFormat">
			Indicates this custom channel contains signed normalized byte colors from -1 to 1, encoded as [PackedByteArray].
		</constant>
		<constant name="ARRAY_CUSTOM_RG_HALF" value="2" enum="ArrayCustomFormat">
			Indicates this custom channel contains half precision float colors, encoded as [PackedByteArray]. Only red and green channels are used.
		</constant>
		<constant name="ARRAY_CUSTOM_RGBA_HALF" value="3" enum="ArrayCustomFormat">
			Indicates this custom channel contains half precision float colors, encoded as [PackedByteArray].
		</constant>
		<constant name="ARRAY_CUSTOM_R_FLOAT" value="4" enum="ArrayCustomFormat">
			Indicates this custom channel contains full float colors, in a [PackedFloat32Array]. Only the red green channel is used.
		</constant>
		<constant name="ARRAY_CUSTOM_RG_FLOAT" value="5" enum="ArrayCustomFormat">
			Indicates this custom channel contains full float colors, in a [PackedFloat32Array]. Only red and green channels are used.
		</constant>
		<constant name="ARRAY_CUSTOM_RGB_FLOAT" value="6" enum="ArrayCustomFormat">
			Indicates this custom channel contains full float colors, in a [PackedFloat32Array]. Only red, green and blue channels are used.
		</constant>
		<constant name="ARRAY_CUSTOM_RGBA_FLOAT" value="7" enum="ArrayCustomFormat">
			Indicates this custom channel contains full float colors, in a [PackedFloat32Array].
		</constant>
		<constant name="ARRAY_CUSTOM_MAX" value="8" enum="ArrayCustomFormat">
			Represents the size of the [enum ArrayCustomFormat] enum.
		</constant>
		<constant name="ARRAY_FORMAT_VERTEX" value="1" enum="ArrayFormat">
			Mesh array contains vertices. All meshes require a vertex array so this should always be present.
		</constant>
		<constant name="ARRAY_FORMAT_NORMAL" value="2" enum="ArrayFormat">
			Mesh array contains normals.
		</constant>
		<constant name="ARRAY_FORMAT_TANGENT" value="4" enum="ArrayFormat">
			Mesh array contains tangents.
		</constant>
		<constant name="ARRAY_FORMAT_COLOR" value="8" enum="ArrayFormat">
			Mesh array contains colors.
		</constant>
		<constant name="ARRAY_FORMAT_TEX_UV" value="16" enum="ArrayFormat">
			Mesh array contains UVs.
		</constant>
		<constant name="ARRAY_FORMAT_TEX_UV2" value="32" enum="ArrayFormat">
			Mesh array contains second UV.
		</constant>
		<constant name="ARRAY_FORMAT_CUSTOM0" value="64" enum="ArrayFormat">
			Mesh array contains custom channel index 0.
		</constant>
		<constant name="ARRAY_FORMAT_CUSTOM1" value="128" enum="ArrayFormat">
			Mesh array contains custom channel index 1.
		</constant>
		<constant name="ARRAY_FORMAT_CUSTOM2" value="256" enum="ArrayFormat">
			Mesh array contains custom channel index 2.
		</constant>
		<constant name="ARRAY_FORMAT_CUSTOM3" value="512" enum="ArrayFormat">
			Mesh array contains custom channel index 3.
		</constant>
		<constant name="ARRAY_FORMAT_BONES" value="1024" enum="ArrayFormat">
			Mesh array contains bones.
		</constant>
		<constant name="ARRAY_FORMAT_WEIGHTS" value="2048" enum="ArrayFormat">
			Mesh array contains bone weights.
		</constant>
		<constant name="ARRAY_FORMAT_INDEX" value="4096" enum="ArrayFormat">
			Mesh array uses indices.
		</constant>
		<constant name="ARRAY_FORMAT_BLEND_SHAPE_MASK" value="7" enum="ArrayFormat">
			Mask of mesh channels permitted in blend shapes.
		</constant>
		<constant name="ARRAY_FORMAT_CUSTOM_BASE" value="13" enum="ArrayFormat">
			Shift of first custom channel.
		</constant>
		<constant name="ARRAY_FORMAT_CUSTOM_BITS" value="3" enum="ArrayFormat">
			Number of format bits per custom channel. See [enum ArrayCustomFormat].
		</constant>
		<constant name="ARRAY_FORMAT_CUSTOM0_SHIFT" value="13" enum="ArrayFormat">
			Amount to shift [enum ArrayCustomFormat] for custom channel index 0.
		</constant>
		<constant name="ARRAY_FORMAT_CUSTOM1_SHIFT" value="16" enum="ArrayFormat">
			Amount to shift [enum ArrayCustomFormat] for custom channel index 1.
		</constant>
		<constant name="ARRAY_FORMAT_CUSTOM2_SHIFT" value="19" enum="ArrayFormat">
			Amount to shift [enum ArrayCustomFormat] for custom channel index 2.
		</constant>
		<constant name="ARRAY_FORMAT_CUSTOM3_SHIFT" value="22" enum="ArrayFormat">
			Amount to shift [enum ArrayCustomFormat] for custom channel index 3.
		</constant>
		<constant name="ARRAY_FORMAT_CUSTOM_MASK" value="7" enum="ArrayFormat">
			Mask of custom format bits per custom channel. Must be shifted by one of the SHIFT constants. See [enum ArrayCustomFormat].
		</constant>
		<constant name="ARRAY_COMPRESS_FLAGS_BASE" value="25" enum="ArrayFormat">
			Shift of first compress flag. Compress flags should be passed to [method ArrayMesh.add_surface_from_arrays] and [method SurfaceTool.commit].
		</constant>
		<constant name="ARRAY_FLAG_USE_2D_VERTICES" value="33554432" enum="ArrayFormat">
			Flag used to mark that the array contains 2D vertices.
		</constant>
		<constant name="ARRAY_FLAG_USE_DYNAMIC_UPDATE" value="67108864" enum="ArrayFormat">
			Flag indices that the mesh data will use [code]GL_DYNAMIC_DRAW[/code] on GLES. Unused on Vulkan.
		</constant>
		<constant name="ARRAY_FLAG_USE_8_BONE_WEIGHTS" value="134217728" enum="ArrayFormat">
			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.
		</constant>
		<constant name="BLEND_SHAPE_MODE_NORMALIZED" value="0" enum="BlendShapeMode">
			Blend shapes are normalized.
		</constant>
		<constant name="BLEND_SHAPE_MODE_RELATIVE" value="1" enum="BlendShapeMode">
			Blend shapes are relative to base weight.
		</constant>
	</constants>
</class>