[Bf-blender-cvs] [56c0a3f] master: Fix T43953, make opengl render work like before, basically, if we render transparent, it will render sky/transparent, regardless of the "show world setting".

Antony Riakiotakis noreply at git.blender.org
Tue Mar 10 16:49:11 CET 2015


Commit: 56c0a3faef74658fec4769d986253023958e6c36
Author: Antony Riakiotakis
Date:   Tue Mar 10 16:34:40 2015 +0100
Branches: master
https://developer.blender.org/rB56c0a3faef74658fec4769d986253023958e6c36

Fix T43953, make opengl render work like before, basically, if we render
transparent, it will render sky/transparent, regardless of the "show
world setting".

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

M	source/blender/editors/include/UI_resources.h
M	source/blender/editors/interface/resources.c
M	source/blender/editors/render/render_opengl.c
M	source/blender/editors/space_view3d/view3d_draw.c

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

diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h
index 4a6d991..4a48421 100644
--- a/source/blender/editors/include/UI_resources.h
+++ b/source/blender/editors/include/UI_resources.h
@@ -361,6 +361,9 @@ void    UI_GetColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned
 // clear the openGL ClearColor using the input colorid
 void    UI_ThemeClearColor(int colorid);
 
+// clear the openGL ClearColor using the input colorid using optional transparency
+void    UI_ThemeClearColorAlpha(int colorid, float alpha);
+
 // internal (blender) usage only, for init and set active
 void    UI_SetTheme(int spacetype, int regionid);
 
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index ab237e7..a9cc538 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -1531,6 +1531,14 @@ void UI_ThemeClearColor(int colorid)
 	glClearColor(col[0], col[1], col[2], 0.0f);
 }
 
+void UI_ThemeClearColorAlpha(int colorid, float alpha)
+{
+	float col[3];
+	UI_GetThemeColor3fv(colorid, col);
+	glClearColor(col[0], col[1], col[2], alpha);
+}
+
+
 int UI_ThemeMenuShadowWidth(void)
 {
 	bTheme *btheme = UI_GetTheme();
diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index d5cf7dd..402e72d 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -136,7 +136,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
 	int sizey = oglrender->sizey;
 	const short view_context = (v3d != NULL);
 	bool draw_bgpic = true;
-	bool draw_sky = (scene->r.alphamode == R_ADDSKY) && v3d && (v3d->flag3 & V3D_SHOW_WORLD);
+	bool draw_sky = (scene->r.alphamode == R_ADDSKY);
 	unsigned char *rect = NULL;
 
 	rr = RE_AcquireResultRead(oglrender->re);
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 8e516e1..7b3f869 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -2879,11 +2879,9 @@ void ED_view3d_draw_offscreen_init(Scene *scene, View3D *v3d)
 /*
  * Function to clear the view
  */
-static void view3d_main_area_clear(Scene *scene, View3D *v3d, ARegion *ar, bool force)
+static void view3d_main_area_clear(Scene *scene, View3D *v3d, ARegion *ar)
 {
-	/* clear background */
-	if (scene->world && ((v3d->flag3 & V3D_SHOW_WORLD) || force)) {
-		float alpha = (force) ? 1.0f : 0.0f;
+	if (scene->world && (v3d->flag3 & V3D_SHOW_WORLD)) {
 		bool glsl = GPU_glsl_support() && BKE_scene_use_new_shading_nodes(scene) && scene->world->nodetree && scene->world->use_nodes;
 		
 		if (glsl) {
@@ -2996,7 +2994,7 @@ static void view3d_main_area_clear(Scene *scene, View3D *v3d, ARegion *ar, bool
 					interp_v3_v3v3(col_fl, col_hor, col_zen, col_fac);
 
 					rgb_float_to_uchar(col_ub, col_fl);
-					col_ub[3] = alpha * 255;
+					col_ub[3] = 255;
 				}
 			}
 
@@ -3031,7 +3029,7 @@ static void view3d_main_area_clear(Scene *scene, View3D *v3d, ARegion *ar, bool
 			IMB_colormanagement_pixel_to_display_space_v3(col_hor, &scene->world->horr, &scene->view_settings,
 			                                              &scene->display_settings);
 
-			glClearColor(col_hor[0], col_hor[1], col_hor[2], alpha);
+			glClearColor(col_hor[0], col_hor[1], col_hor[2], 1.0);
 			glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 		}
 	}
@@ -3067,7 +3065,7 @@ static void view3d_main_area_clear(Scene *scene, View3D *v3d, ARegion *ar, bool
 			glPopMatrix();
 		}
 		else {
-			UI_ThemeClearColor(TH_HIGH_GRAD);
+			UI_ThemeClearColorAlpha(TH_HIGH_GRAD, 1.0f);
 			glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 		}
 	}
@@ -3125,7 +3123,7 @@ void ED_view3d_draw_offscreen(
 
 	/* clear opengl buffers */
 	if (do_sky) {
-		view3d_main_area_clear(scene, v3d, ar, true);
+		view3d_main_area_clear(scene, v3d, ar);
 	}
 	else {
 		glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
@@ -3555,7 +3553,7 @@ static void view3d_main_area_draw_objects(const bContext *C, Scene *scene, View3
 	}
 	
 	/* clear the background */
-	view3d_main_area_clear(scene, v3d, ar, false);
+	view3d_main_area_clear(scene, v3d, ar);
 
 	/* enables anti-aliasing for 3D view drawing */
 	if (U.ogl_multisamples != USER_MULTISAMPLE_NONE) {




More information about the Bf-blender-cvs mailing list