summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2018-09-28 10:36:36 +0200
committerGitHub <noreply@github.com>2018-09-28 10:36:36 +0200
commitf87fb2c795f93fa4171c8ab0b6a5af49b013dcd7 (patch)
tree302958a889ad8656e05f687f4fe769df5f22fbb3
parentc7e646c30a5ca9abcd04383381d9a216cd2ee185 (diff)
parent9b85866c0757b2169ec318882e55fae4461d4166 (diff)
Merge pull request #22413 from lupoDharkael/array-mesh-docs
Add code example to ArrayMesh class docs
-rw-r--r--doc/classes/ArrayMesh.xml17
1 files changed, 17 insertions, 0 deletions
diff --git a/doc/classes/ArrayMesh.xml b/doc/classes/ArrayMesh.xml
index 453f28fe5a..ed3d2d2205 100644
--- a/doc/classes/ArrayMesh.xml
+++ b/doc/classes/ArrayMesh.xml
@@ -3,6 +3,23 @@
<brief_description>
</brief_description>
<description>
+ The [code]ArrayMesh[/code] is used to construct a [Mesh] by specifying the attributes as arrays. The most basic example is the creation of a single triangle
+ [codeblock]
+ var vertices = PoolVector3Array()
+ vertices.push_back(Vector3(0,1,0))
+ vertices.push_back(Vector3(1,0,0))
+ vertices.push_back(Vector3(0,0,1))
+ # Initialize the ArrayMesh.
+ var arr_mesh = ArrayMesh.new()
+ var arrays = []
+ arrays.resize(ArrayMesh.ARRAY_MAX)
+ arrays[ArrayMesh.ARRAY_VERTEX] = vertices
+ # Create the Mesh.
+ arr_mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES, arrays)
+ var m = MeshInstance.new()
+ m.mesh = arr_mesh
+ [/codeblock]
+ The [code]MeshInstance[/code] is ready to be added to the SceneTree to be shown.
</description>
<tutorials>
</tutorials>