Created
February 5, 2017 07:04
-
-
Save iondune/83d9a0599625dc946427171443c08639 to your computer and use it in GitHub Desktop.
How to build index data for clipmaps with degenerate triangles.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Standard LL | |
| IndexData.push_back(x + 0 + (GeometrySize + 1) * (y + 1)); | |
| IndexData.push_back(x + 1 + (GeometrySize + 1) * (y + 1)); | |
| IndexData.push_back(x + 0 + (GeometrySize + 1) * (y + 0)); | |
| // Standard UR | |
| IndexData.push_back(x + 1 + (GeometrySize + 1) * (y + 1)); | |
| IndexData.push_back(x + 1 + (GeometrySize + 1) * (y + 0)); | |
| IndexData.push_back(x + 0 + (GeometrySize + 1) * (y + 0)); | |
| // Bridge Up | |
| if (TopEdge && IsEven(x)) | |
| { | |
| IndexData.push_back(x + 1 + (GeometrySize + 1) * (y + 0)); | |
| IndexData.push_back(x + 2 + (GeometrySize + 1) * (y + 0)); | |
| IndexData.push_back(x + 0 + (GeometrySize + 1) * (y + 0)); | |
| } | |
| // Bridge Down | |
| if (BottomEdge && IsEven(x)) | |
| { | |
| IndexData.push_back(x + 0 + (GeometrySize + 1) * (y + 1)); | |
| IndexData.push_back(x + 2 + (GeometrySize + 1) * (y + 1)); | |
| IndexData.push_back(x + 1 + (GeometrySize + 1) * (y + 1)); | |
| } | |
| // Bridge Left | |
| if (LeftEdge && IsEven(y)) | |
| { | |
| IndexData.push_back(x + 0 + (GeometrySize + 1) * (y + 2)); | |
| IndexData.push_back(x + 0 + (GeometrySize + 1) * (y + 1)); | |
| IndexData.push_back(x + 0 + (GeometrySize + 1) * (y + 0)); | |
| } | |
| // Bridge Right | |
| if (RightEdge && IsEven(y)) | |
| { | |
| IndexData.push_back(x + 1 + (GeometrySize + 1) * (y + 2)); | |
| IndexData.push_back(x + 1 + (GeometrySize + 1) * (y + 0)); | |
| IndexData.push_back(x + 1 + (GeometrySize + 1) * (y + 1)); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment