Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions tutorials/3d/procedural_geometry/surfacetool.rst
Original file line number Diff line number Diff line change
Expand Up @@ -121,18 +121,12 @@ shrinks the vertex array to remove duplicate vertices.
st.add_vertex(Vector3(1, -1, 0))
st.add_vertex(Vector3(-1, -1, 0))

# We can make the quad more efficient by using an index array and only utilizing 4 vertices
# We can make the quad more efficient by using an index array and only utilizing 4 vertices:

# Suppose we have a quad defined by 6 vertices as follows
st.add_vertex(Vector3(-1, 1, 0))
st.add_vertex(Vector3(1, 1, 0))
st.add_vertex(Vector3(-1, -1, 0))

st.add_vertex(Vector3(1, 1, 0))
st.add_vertex(Vector3(1, -1, 0))
st.add_vertex(Vector3(-1, -1, 0))

# We can make the quad more efficient by using an index array and only utilizing 4 vertices

# Creates a quad from four corner vertices.
# add_index() can be called before or after add_vertex()
Expand All @@ -150,6 +144,21 @@ shrinks the vertex array to remove duplicate vertices.

.. code-tab:: csharp

// Suppose we have a quad defined by 6 vertices as follows.
st.AddVertex(new Vector3(-1, 1, 0));
st.AddVertex(new Vector3(1, 1, 0));
st.AddVertex(new Vector3(-1, -1, 0));

st.AddVertex(new Vector3(1, 1, 0));
st.AddVertex(new Vector3(1, -1, 0));
st.AddVertex(new Vector3(-1, -1, 0));

// We can make the quad more efficient by using an index array and only utilizing 4 vertices:
st.AddVertex(new Vector3(-1, -1, 0));
st.AddVertex(new Vector3(1, 1, 0));
st.AddVertex(new Vector3(-1, -1, 0));
st.AddVertex(new Vector3(1, 1, 0));

// Creates a quad from four corner vertices.
// AddIndex does not need to be called before AddVertex.
st.AddIndex(0);
Expand All @@ -160,7 +169,7 @@ shrinks the vertex array to remove duplicate vertices.
st.AddIndex(3);
st.AddIndex(2);

// Alternatively:
// Alternatively we can use `st.Index()` which will create the quad for us and remove the duplicate vertices.
st.Index();

Similarly, if you have an index array, but you want each vertex to be unique (e.g. because
Expand Down
Loading