[Bf-blender-cvs] [0790976b6c] blender2.8: OpenGL immediate mode: fix inverted normal in sphere batch

Clément Foucault noreply at git.blender.org
Tue Feb 14 00:54:02 CET 2017


Commit: 0790976b6c37b4d6d688b196093358a0369a2ee0
Author: Clément Foucault
Date:   Sun Feb 12 19:25:49 2017 +0100
Branches: blender2.8
https://developer.blender.org/rB0790976b6c37b4d6d688b196093358a0369a2ee0

OpenGL immediate mode: fix inverted normal in sphere batch

===================================================================

M	source/blender/editors/interface/interface_draw.c
M	source/blender/gpu/intern/gpu_batch.c

===================================================================

diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 7b17c3d644..efd920aef6 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -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();
diff --git a/source/blender/gpu/intern/gpu_batch.c b/source/blender/gpu/intern/gpu_batch.c
index 716c5e55b3..5e86f1e26b 100644
--- a/source/blender/gpu/intern/gpu_batch.c
+++ b/source/blender/gpu/intern/gpu_batch.c
@@ -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);
 }




More information about the Bf-blender-cvs mailing list