terrain

Real-time terrain generation using marching cubes
git clone git://git.christianermann.dev/terrain
Log | Files | Refs | README | LICENSE

commit 5128b23bed1cf012ba92e19104784009d6274763
parent 009c2505e27cac7facef7653bd897f30ed9c3e9b
Author: Christian Ermann <christianermann@gmail.com>
Date:   Mon, 16 Aug 2021 14:53:19 -0500

Moved mesh_origin declaration and initialization out of loop

Diffstat:
Msrc/chunk.c | 7++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/chunk.c b/src/chunk.c @@ -81,15 +81,16 @@ static void Chunk_updateMeshData(Chunk *c, SDF f, float isolevel) { c->mesh.vertex_count = 0; c->mesh.index_count = 0; + + Vec3 mesh_origin; + worldOrigin(c->origin, mesh_origin); + for (int i = 0; i < CHUNK_PWIDTH; i++) { for (int j = 0; j < CHUNK_PWIDTH; j++) { for (int k = 0; k < CHUNK_PWIDTH; k++) { - Vec3 mesh_origin; - worldOrigin(c->origin, mesh_origin); - Vec3 cell_origin = { mesh_origin[0] + k, mesh_origin[1] + i,