[Bf-blender-cvs] [346964eb3f3] blender2.8: Merge branch 'master' into blender2.8
Bastien Montagne
noreply at git.blender.org
Mon Apr 10 16:53:24 CEST 2017
Commit: 346964eb3f3c3074d30676f27ed477ce542299ea
Author: Bastien Montagne
Date: Mon Apr 10 16:53:12 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB346964eb3f3c3074d30676f27ed477ce542299ea
Merge branch 'master' into blender2.8
Conflicts:
source/blender/editors/gpencil/drawgpencil.c
===================================================================
===================================================================
diff --cc source/blender/editors/gpencil/drawgpencil.c
index 19c717b4ecb,f091609da49..11881a4a019
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@@ -730,33 -700,29 +730,34 @@@ static void gp_draw_stroke_2d(const bGP
* edges rotated to minimize shrinking artifacts, and rounded endcaps
*/
{
- bGPDspoint *pt1, *pt2;
+ const bGPDspoint *pt1, *pt2;
- float pm[2];
+ float s0[2], s1[2]; /* segment 'center' points */
+ float pm[2]; /* normal from previous segment. */
int i;
float fpt[3];
-
- glShadeModel(GL_FLAT);
- glBegin(GL_QUADS);
+
+ VertexFormat *format = immVertexFormat();
+ unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT);
+
+ immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR);
+#ifdef WITH_GL_PROFILE_COMPAT
+ immBegin(PRIM_QUADS_XXX, (totpoints - 2) * 4 + 12);
+ /* get x and y coordinates from first point */
+ mul_v3_m4v3(fpt, diff_mat, &points->x);
+ gp_calc_2d_stroke_fxy(fpt, sflag, offsx, offsy, winx, winy, s0);
+
for (i = 0, pt1 = points, pt2 = points + 1; i < (totpoints - 1); i++, pt1++, pt2++) {
- float s0[2], s1[2]; /* segment 'center' points */
float t0[2], t1[2]; /* tessellated coordinates */
float m1[2], m2[2]; /* gradient and normal */
float mt[2], sc[2]; /* gradient for thickness, point for end-cap */
float pthick; /* thickness at segment point */
- /* get x and y coordinates from points */
- mul_v3_m4v3(fpt, diff_mat, &pt1->x);
- gp_calc_2d_stroke_fxy(fpt, sflag, offsx, offsy, winx, winy, s0);
-
+ /* get x and y coordinates from point2 (point1 has already been computed in previous iteration). */
mul_v3_m4v3(fpt, diff_mat, &pt2->x);
gp_calc_2d_stroke_fxy(fpt, sflag, offsx, offsy, winx, winy, s1);
-
+
/* calculate gradient and normal - 'angle'=(ny/nx) */
m1[1] = s1[1] - s0[1];
m1[0] = s1[0] - s0[0];
@@@ -875,11 -842,13 +876,13 @@@
t0[1] = sc[1] - mt[1];
t1[0] = sc[0] + mt[0];
t1[1] = sc[1] + mt[1];
-
- glVertex2fv(t1);
- glVertex2fv(t0);
+
+ immVertex2fv(pos, t1);
+ immVertex2fv(pos, t0);
}
-
+
+ /* store computed point2 coordinates as point1 ones of next segment. */
+ copy_v2_v2(s0, s1);
/* store stroke's 'natural' normal for next stroke to use */
copy_v2_v2(pm, m2);
}
More information about the Bf-blender-cvs
mailing list