The [code]SurfaceTool[/code] is used to construct a [Mesh] by specifying vertex attributes individually. It can be used to construct a [Mesh] from script. All properties except index need to be added before a call to [method add_vertex]. For example adding vertex colors and UVs looks like
The [code]SurfaceTool[/code] now contains one vertex of a triangle which has a UV coordinate and a specified [Color]. If another vertex were added without calls to [method add_uv] or [method add_color] then the last values would be used.
It is very important that vertex attributes are passed [b]before[/b] the call to [method add_vertex], failure to do this will result in an error when committing the vertex information to a mesh.
Adds an index to index array if you are using indexed Vertices. Does not need to be called before adding Vertex.
</description>
</method>
<methodname="add_normal">
<returntype="void">
</return>
<argumentindex="0"name="normal"type="Vector3">
</argument>
<description>
Specify a normal for the next Vertex to use.
</description>
</method>
<methodname="add_smooth_group">
<returntype="void">
</return>
<argumentindex="0"name="smooth"type="bool">
</argument>
<description>
Specify whether current Vertex (if using only Vertex arrays) or current index (if also using index arrays) should utilize smooth normals for normal calculation.
Returns a constructed [ArrayMesh] from current information passed in. If an existing [ArrayMesh] is passed in as an argument, will add an extra surface to the existing [ArrayMesh].
</description>
</method>
<methodname="create_from">
<returntype="void">
</return>
<argumentindex="0"name="existing"type="Mesh">
</argument>
<argumentindex="1"name="surface"type="int">
</argument>
<description>
</description>
</method>
<methodname="deindex">
<returntype="void">
</return>
<description>
Removes index array by expanding Vertex array.
</description>
</method>
<methodname="generate_normals">
<returntype="void">
</return>
<description>
Generates normals from Vertices so you do not have to do it manually.
</description>
</method>
<methodname="generate_tangents">
<returntype="void">
</return>
<description>
</description>
</method>
<methodname="index">
<returntype="void">
</return>
<description>
Shrinks Vertex array by creating an index array. Avoids reusing Vertices.
</description>
</method>
<methodname="set_material">
<returntype="void">
</return>
<argumentindex="0"name="material"type="Material">
</argument>
<description>
Sets [Material] to be used by the [Mesh] you are constructing.