Add detail to doc for add_surface_from_arrays (#17911)

Includes review comments from #17911 from @cbscribe and @Noshyaar
This commit is contained in:
GaryO 2018-04-22 09:23:33 -04:00 committed by Max Hilbrunner
parent d0699b34d7
commit 06c5a9ed5f
1 changed files with 7 additions and 3 deletions

View File

@ -29,8 +29,11 @@
<argument index="3" name="compress_flags" type="int" default="97792"> <argument index="3" name="compress_flags" type="int" default="97792">
</argument> </argument>
<description> <description>
Create a new surface ([method get_surface_count] that will become surf_idx for this. Creates a new surface.
Surfaces are created to be rendered using a "primitive", which may be PRIMITIVE_POINTS, PRIMITIVE_LINES, PRIMITIVE_LINE_STRIP, PRIMITIVE_LINE_LOOP, PRIMITIVE_TRIANGLES, PRIMITIVE_TRIANGLE_STRIP, PRIMITIVE_TRIANGLE_FAN. (As a note, when using indices, it is recommended to only use just points, lines or triangles). Surfaces are created to be rendered using a "primitive", which may be PRIMITIVE_POINTS, PRIMITIVE_LINES, PRIMITIVE_LINE_STRIP, PRIMITIVE_LINE_LOOP, PRIMITIVE_TRIANGLES, PRIMITIVE_TRIANGLE_STRIP, PRIMITIVE_TRIANGLE_FAN. See [Mesh] for details. (As a note, when using indices, it is recommended to only use points, lines or triangles). [method get_surface_count] will become the surf_idx for this new surface.
The [code]arrays[/code] argument is an array of arrays. See [enum ArrayType] for the values used in this array. For example, [code]arrays[0][/code] is the array of vertices. That first vertex sub-array is always required; the others are optional. Adding an index array puts this function into "index mode" where the vertex and other arrays become the sources of data and the index array defines the vertex order. All sub-arrays must have the same length as the vertex array or be empty, except for [code]ARRAY_INDEX[/code] if it is used.
Adding an index array puts this function into "index mode" where the vertex and other arrays become the sources of data, and the index array defines the order of the vertices.
Godot uses clockwise winding order for front faces of triangle primitive modes.
</description> </description>
</method> </method>
<method name="center_geometry"> <method name="center_geometry">
@ -232,7 +235,8 @@
Array of bone weights, as a float array. Each element in groups of 4 floats. Array of bone weights, as a float array. Each element in groups of 4 floats.
</constant> </constant>
<constant name="ARRAY_INDEX" value="8" enum="ArrayType"> <constant name="ARRAY_INDEX" value="8" enum="ArrayType">
Array of integers, used as indices referencing vertices. No index can be beyond the vertex array size. [Array] 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>
<constant name="ARRAY_MAX" value="9" enum="ArrayType"> <constant name="ARRAY_MAX" value="9" enum="ArrayType">
</constant> </constant>