From a4c25644cabd5ce00816f0759193619b4d624026 Mon Sep 17 00:00:00 2001 From: Martin Felis Date: Sun, 1 Nov 2020 21:37:23 +0100 Subject: [PATCH] Using proper y rotation when building uvsphere triangles --- src/srender.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/srender.h b/src/srender.h index a4a576a..d1e5496 100644 --- a/src/srender.h +++ b/src/srender.h @@ -543,8 +543,8 @@ void init_debug_meshes() { for (int j = 0; j < sector_count + 1; j++) { float theta = -M_PI + j * sector_step; float x = cos(theta) * cos(phi); - float z = sin(theta) * cos(phi); - // gLog ("idx: %d # phi: %f, theta %f, p = %f, %f, %f", vert_index, phi * 180 / M_PI, theta * 180 / M_PI, x, y, z); + float z = -sin(theta) * cos(phi); +// gLog ("idx: %d # phi: %f, theta %f, p = %f, %f, %f", vert_index, phi * 180 / M_PI, theta * 180 / M_PI, x, y, z); srvrtxdata* vertex = &uvsphere_vertices[vert_index++]; vertex->x = x; @@ -586,14 +586,14 @@ void init_debug_meshes() { for (int j = 0; j < sector_count; ++j, ++k1, ++k2) { if (i != 0) { uvsphere_indices[indices_index++] = k1; - uvsphere_indices[indices_index++] = k2 + 1; uvsphere_indices[indices_index++] = k1 + 1; + uvsphere_indices[indices_index++] = k2 + 1; } if (i != stack_count - 1) { uvsphere_indices[indices_index++] = k2 + 1; - uvsphere_indices[indices_index++] = k1; uvsphere_indices[indices_index++] = k2; + uvsphere_indices[indices_index++] = k1; } } }