OpenGL immediate mode: fix inverted normal in sphere batch

This commit is contained in:
Clément Foucault 2017-02-12 19:25:49 +01:00
parent 8c09fa3be2
commit 0790976b6c
2 changed files with 5 additions and 6 deletions

View File

@ -1301,7 +1301,6 @@ void ui_draw_but_UNITVEC(uiBut *but, uiWidgetColors *wcol, const rcti *rect)
/* setup lights */
ui_but_v3_get(but, light);
light[2] = -light[2];
/* transform to button */
gpuMatrixBegin3D_legacy();

View File

@ -78,15 +78,15 @@ static Batch *batch_sphere(int lat_res, int lon_res)
lat = 0.0f;
for(int j = 0; j < lat_res; j++, lat += lat_inc) {
if (j != lat_res - 1) { /* Pole */
batch_sphere_lat_lon_vert(lat, lon);
batch_sphere_lat_lon_vert(lat+lat_inc, lon);
batch_sphere_lat_lon_vert(lat+lat_inc, lon+lon_inc);
batch_sphere_lat_lon_vert(lat+lat_inc, lon);
batch_sphere_lat_lon_vert(lat, lon);
}
if (j != 0) { /* Pole */
batch_sphere_lat_lon_vert(lat, lon);
batch_sphere_lat_lon_vert(lat+lat_inc, lon+lon_inc);
batch_sphere_lat_lon_vert(lat, lon+lon_inc);
batch_sphere_lat_lon_vert(lat+lat_inc, lon+lon_inc);
batch_sphere_lat_lon_vert(lat, lon);
}
}
}
@ -109,7 +109,7 @@ Batch *Batch_get_sphere(int lod)
void gpu_batch_init(void)
{
/* Hard coded resolution */
sphere_low = batch_sphere(8, 8);
sphere_low = batch_sphere(8, 16);
sphere_med = batch_sphere(16, 10);
sphere_high = batch_sphere(32, 24);
}