Using proper y rotation when building uvsphere triangles

master
Martin Felis 2020-11-01 21:37:23 +01:00
parent cd1130afd3
commit a4c25644ca
1 changed files with 4 additions and 4 deletions

View File

@ -543,7 +543,7 @@ 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);
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++];
@ -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;
}
}
}