[Bf-blender-cvs] [75e9d59b96f] blender2.8: Getting rid of setlinestyle: non-camera 3DView render border.

Bastien Montagne noreply at git.blender.org
Wed Apr 26 15:25:29 CEST 2017


Commit: 75e9d59b96f40f353cb6cb0a427cd179fd9e5f24
Author: Bastien Montagne
Date:   Wed Apr 26 13:02:13 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB75e9d59b96f40f353cb6cb0a427cd179fd9e5f24

Getting rid of setlinestyle: non-camera 3DView render border.

Also fixed wrong color for in-camera render border, and added a comment
to imm_cpack about expected color components order in integer parameter.

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

M	source/blender/editors/space_view3d/view3d_draw.c
M	source/blender/gpu/intern/gpu_immediate_util.c

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

diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 6d8243ca4b3..1313d8245a7 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -621,7 +621,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
 			x4 = floorf(x1 + (scene->r.border.xmax * (x2 - x1))) + (U.pixelsize - 1);
 			y4 = floorf(y1 + (scene->r.border.ymax * (y2 - y1))) + (U.pixelsize - 1);
 
-			immUniform4f("color1", 0.25f, 0.25f, 1.0f, 1.0f);
+			immUniform4f("color1", 1.0f, 0.25f, 0.25f, 1.0f);
 			imm_draw_line_box_dashed(pos, line_origin, x3, y3, x4, y4);
 		}
 
@@ -760,18 +760,26 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
 static void drawrenderborder(ARegion *ar, View3D *v3d)
 {
 	/* use the same program for everything */
-	unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
-	immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
+	VertexFormat *format = immVertexFormat();
+	unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+	unsigned int line_origin = VertexFormat_add_attrib(format, "line_origin", COMP_F32, 2, KEEP_FLOAT);
 
 	glLineWidth(1.0f);
-	setlinestyle(3);
-	imm_cpack(0x4040FF);
+	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+	glEnable(GL_BLEND);
+
+	immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR);
+
+	immUniform1f("view_scale", 1.0f);
 
-	imm_draw_line_box(
-	    pos, v3d->render_border.xmin * ar->winx, v3d->render_border.ymin * ar->winy,
-	    v3d->render_border.xmax * ar->winx, v3d->render_border.ymax * ar->winy);
+	immUniform4f("color1", 1.0f, 0.25f, 0.25f, 1.0f);
+	immUniform4f("color2", 0.0f, 0.0f, 0.0f, 0.0f);
+	immUniform1f("dash_width", 6.0f);
+	immUniform1f("dash_width_on", 3.0f);
 
-	setlinestyle(0);
+	imm_draw_line_box_dashed(pos, line_origin,
+	                         v3d->render_border.xmin * ar->winx, v3d->render_border.ymin * ar->winy,
+	                         v3d->render_border.xmax * ar->winx, v3d->render_border.ymax * ar->winy);
 
 	immUnbindProgram();
 }
diff --git a/source/blender/gpu/intern/gpu_immediate_util.c b/source/blender/gpu/intern/gpu_immediate_util.c
index 49ced32cd51..ba1a7633063 100644
--- a/source/blender/gpu/intern/gpu_immediate_util.c
+++ b/source/blender/gpu/intern/gpu_immediate_util.c
@@ -36,6 +36,8 @@
 /**
 * Pack color into 3 bytes
 *
+* \Note BGR format (i.e. 0xBBGGRR)...
+*
 * \param x color.
 */
 void imm_cpack(unsigned int x)




More information about the Bf-blender-cvs mailing list