Last active
July 5, 2021 17:11
-
-
Save mattdesl/6c421c2d678b000fe9c208a254c7d504 to your computer and use it in GitHub Desktop.
This file contains 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
// Number of horizontal and vertical slices | |
const subdivisions = 20; | |
// Calculate vertices at each grid point and gather the triangle indices of the mesh | |
// We pass our 'parametricTerrain' function in as an input to the generator | |
const [ vertices, cells ] = generateGeometry(parametricTerrain, subdivisions); | |
// vertices are 3D positions on the surface | |
// [ [ x0, y0, z0 ], [ x1, y1, z1 ], ... ] | |
// cells are indices into the above array, defining triangles | |
// [ [ 0, 1, 3 ], [ 1, 4, 3 ], [ 1, 2, 4 ], ... ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment