-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Clarify SurfaceTool example with index #11529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
|
||
| .. code-tab:: csharp | ||
|
|
||
| # Suppose we have a quad defined by 6 vertices as follows |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| # Suppose we have a quad defined by 6 vertices as follows | |
| // Suppose we have a quad defined by 6 vertices as follows. |
| st.AddVertex(Vector3(1, -1, 0)); | ||
| st.AddVertex(Vector3(-1, -1, 0)); | ||
|
|
||
| # We can make the quad more efficient by using an index array and only utilizing 4 vertices: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| # 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: |
| st.AddVertex(Vector3(-1, 1, 0)); | ||
| st.AddVertex(Vector3(1, 1, 0)); | ||
| st.AddVertex(Vector3(-1, -1, 0)); | ||
|
|
||
| st.AddVertex(Vector3(1, 1, 0)); | ||
| st.AddVertex(Vector3(1, -1, 0)); | ||
| st.AddVertex(Vector3(-1, -1, 0)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| st.AddVertex(Vector3(-1, 1, 0)); | |
| st.AddVertex(Vector3(1, 1, 0)); | |
| st.AddVertex(Vector3(-1, -1, 0)); | |
| st.AddVertex(Vector3(1, 1, 0)); | |
| st.AddVertex(Vector3(1, -1, 0)); | |
| st.AddVertex(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)); | |
| st.AddVertex(new Vector3(-1, -1, 0)); |
| st.AddIndex(2); | ||
|
|
||
| // Alternatively: | ||
| // Alternatively we can use `st.Index()` which will create the quad for us and remove the duplicate vertices |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // Alternatively we can use `st.Index()` which will create the quad for us and remove the duplicate vertices | |
| // Alternatively we can use `st.Index()` which will create the quad for us and remove the duplicate vertices. |
The current example looks like an accidental copy paste without adapting the code. I fixed that and made the C# version more consistent.