Merge pull request #8539 from clayjohn/doc_surfacetool

Added documentation for SurfaceTool
This commit is contained in:
Rémi Verschelde 2017-04-26 07:38:07 +02:00 committed by GitHub
commit 692b99fa0c

View file

@ -43086,43 +43086,58 @@
Helper tool to create geometry. Helper tool to create geometry.
</brief_description> </brief_description>
<description> <description>
Helper tool to create geometry. The [SurfaceTool] 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
[codeblock]
var st = SurfaceTool.new()
st.begin(Mesh.PRIMITIVE_TRIANGLES)
st.add_color(Color(1, 0, 0))
st.add_uv(Vector2(0, 0))
st.add_vertex(Vector3(0, 0, 0))
[/codeblock]
The [SurfaceTool] 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.
</description> </description>
<methods> <methods>
<method name="add_bones"> <method name="add_bones">
<argument index="0" name="bones" type="PoolIntArray"> <argument index="0" name="bones" type="PoolIntArray">
</argument> </argument>
<description> <description>
Add an array of bones for the next Vertex to use.
</description> </description>
</method> </method>
<method name="add_color"> <method name="add_color">
<argument index="0" name="color" type="Color"> <argument index="0" name="color" type="Color">
</argument> </argument>
<description> <description>
Specify a [Color] for the next Vertex to use.
</description> </description>
</method> </method>
<method name="add_index"> <method name="add_index">
<argument index="0" name="index" type="int"> <argument index="0" name="index" type="int">
</argument> </argument>
<description> <description>
Adds an index to index array if you are using indexed Vertices. Does not need to be called before adding Vertex.
</description> </description>
</method> </method>
<method name="add_normal"> <method name="add_normal">
<argument index="0" name="normal" type="Vector3"> <argument index="0" name="normal" type="Vector3">
</argument> </argument>
<description> <description>
Specify a normal for the next Vertex to use.
</description> </description>
</method> </method>
<method name="add_smooth_group"> <method name="add_smooth_group">
<argument index="0" name="smooth" type="bool"> <argument index="0" name="smooth" type="bool">
</argument> </argument>
<description> <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.
</description> </description>
</method> </method>
<method name="add_tangent"> <method name="add_tangent">
<argument index="0" name="tangent" type="Plane"> <argument index="0" name="tangent" type="Plane">
</argument> </argument>
<description> <description>
Specify a Tangent for the next Vertex to use.
</description> </description>
</method> </method>
<method name="add_triangle_fan"> <method name="add_triangle_fan">
@ -43139,40 +43154,47 @@
<argument index="5" name="tangents" type="Array" default="Array()"> <argument index="5" name="tangents" type="Array" default="Array()">
</argument> </argument>
<description> <description>
Insert a triangle fan made of array data into [Mesh] being constructed.
</description> </description>
</method> </method>
<method name="add_uv"> <method name="add_uv">
<argument index="0" name="uv" type="Vector2"> <argument index="0" name="uv" type="Vector2">
</argument> </argument>
<description> <description>
Specify UV Coordinate for next Vertex to use.
</description> </description>
</method> </method>
<method name="add_uv2"> <method name="add_uv2">
<argument index="0" name="uv2" type="Vector2"> <argument index="0" name="uv2" type="Vector2">
</argument> </argument>
<description> <description>
Specify an optional second set of UV coordinates for next Vertex to use.
</description> </description>
</method> </method>
<method name="add_vertex"> <method name="add_vertex">
<argument index="0" name="vertex" type="Vector3"> <argument index="0" name="vertex" type="Vector3">
</argument> </argument>
<description> <description>
Specify position of current Vertex. Should be called after specifying other vertex properties (e.g. Color, UV).
</description> </description>
</method> </method>
<method name="add_weights"> <method name="add_weights">
<argument index="0" name="weights" type="PoolRealArray"> <argument index="0" name="weights" type="PoolRealArray">
</argument> </argument>
<description> <description>
Specify weight value for next Vertex to use.
</description> </description>
</method> </method>
<method name="begin"> <method name="begin">
<argument index="0" name="primitive" type="int"> <argument index="0" name="primitive" type="int">
</argument> </argument>
<description> <description>
Called before adding any Vertices. Takes the primitive type as an argument (e.g. Mesh.PRIMITIVE_TRIANGLES).
</description> </description>
</method> </method>
<method name="clear"> <method name="clear">
<description> <description>
Clear all information passed into the surface tool so far.
</description> </description>
</method> </method>
<method name="commit"> <method name="commit">
@ -43181,24 +43203,29 @@
<argument index="0" name="existing" type="Mesh" default="NULL"> <argument index="0" name="existing" type="Mesh" default="NULL">
</argument> </argument>
<description> <description>
Returns a constructed [Mesh] from current information passed in. If an existing [Mesh] is passed in as an argument, will add an extra surface to the existing [Mesh].
</description> </description>
</method> </method>
<method name="deindex"> <method name="deindex">
<description> <description>
Removes index array by expanding Vertex array.
</description> </description>
</method> </method>
<method name="generate_normals"> <method name="generate_normals">
<description> <description>
Generates normals from Vertices so you do not have to do it manually.
</description> </description>
</method> </method>
<method name="index"> <method name="index">
<description> <description>
Shrinks Vertex array by creating an index array. Avoids reusing Vertices.
</description> </description>
</method> </method>
<method name="set_material"> <method name="set_material">
<argument index="0" name="material" type="Material"> <argument index="0" name="material" type="Material">
</argument> </argument>
<description> <description>
Sets [Material] to be used by the [Mesh] you are constructing.
</description> </description>
</method> </method>
</methods> </methods>