[Bf-blender-cvs] [a895e8e512b] greasepencil-object: Use different points for stroke ends calculation

Antonio Vazquez noreply at git.blender.org
Tue May 9 21:54:22 CEST 2017


Commit: a895e8e512b0842e24ff3717168caface881689c
Author: Antonio Vazquez
Date:   Tue May 9 21:54:05 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rBa895e8e512b0842e24ff3717168caface881689c

Use different points for stroke ends calculation

With old method the end of the stroke sometimes looked weird

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

M	source/blender/draw/engines/gpencil/gpencil_draw.c

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

diff --git a/source/blender/draw/engines/gpencil/gpencil_draw.c b/source/blender/draw/engines/gpencil/gpencil_draw.c
index e174b3464d7..70e51039115 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw.c
@@ -53,7 +53,7 @@
 static void gpencil_set_stroke_point(RegionView3D *rv3d, VertexBuffer *vbo, float matrix[4][4], const bGPDspoint *pt, int idx,
 						    unsigned int pos_id, unsigned int color_id,
 							unsigned int thickness_id, short thickness,
-	                        const float ink[4], bool inverse)
+	                        const float ink[4])
 {
 	float fpt[3];
 	float viewfpt[3];
@@ -81,9 +81,6 @@ static void gpencil_set_stroke_point(RegionView3D *rv3d, VertexBuffer *vbo, floa
 	float thick = max_ff(pt->pressure * thickness * scale_thickness, 1.0f);
 	VertexBuffer_set_attrib(vbo, thickness_id, idx, &thick);
 	
-	if (inverse) {
-		mul_v3_fl(fpt, -1.0f);
-	}
 	VertexBuffer_set_attrib(vbo, pos_id, idx, fpt);
 }
 
@@ -142,27 +139,27 @@ Batch *gpencil_get_stroke_geom(bGPDframe *gpf, bGPDstroke *gps, short thickness,
 	for (int i = 0; i < totpoints; i++, pt++) {
 		/* first point for adjacency (not drawn) */
 		if (i == 0) {
-			gpencil_set_stroke_point(rv3d, vbo, gpf->matrix, pt, idx, pos_id, color_id, thickness_id, thickness, ink, true);
+			gpencil_set_stroke_point(rv3d, vbo, gpf->matrix, &points[1], idx, pos_id, color_id, thickness_id, thickness, ink);
 			++idx;
 		}
 		/* set point */
-		gpencil_set_stroke_point(rv3d, vbo, gpf->matrix, pt, idx, pos_id, color_id, thickness_id, thickness, ink, false);
+		gpencil_set_stroke_point(rv3d, vbo, gpf->matrix, pt, idx, pos_id, color_id, thickness_id, thickness, ink);
 		++idx;
 	}
 
 	if (gps->flag & GP_STROKE_CYCLIC && totpoints > 2) {
 		/* draw line to first point to complete the cycle */
-		gpencil_set_stroke_point(rv3d, vbo, gpf->matrix, &points[0], idx, pos_id, color_id, thickness_id, thickness, ink, false);
+		gpencil_set_stroke_point(rv3d, vbo, gpf->matrix, &points[0], idx, pos_id, color_id, thickness_id, thickness, ink);
 		++idx;
 		/* now add adjacency points using 2nd & 3rd point to get smooth transition */
-		gpencil_set_stroke_point(rv3d, vbo, gpf->matrix, &points[1], idx, pos_id, color_id, thickness_id, thickness, ink, false);
+		gpencil_set_stroke_point(rv3d, vbo, gpf->matrix, &points[1], idx, pos_id, color_id, thickness_id, thickness, ink);
 		++idx;
-		gpencil_set_stroke_point(rv3d, vbo, gpf->matrix, &points[2], idx, pos_id, color_id, thickness_id, thickness, ink, false);
+		gpencil_set_stroke_point(rv3d, vbo, gpf->matrix, &points[2], idx, pos_id, color_id, thickness_id, thickness, ink);
 		++idx;
 	}
 	/* last adjacency point (not drawn) */
 	else {
-		gpencil_set_stroke_point(rv3d, vbo, gpf->matrix, &points[totpoints - 1], idx, pos_id, color_id, thickness_id, thickness, ink, true);
+		gpencil_set_stroke_point(rv3d, vbo, gpf->matrix, &points[totpoints - 2], idx, pos_id, color_id, thickness_id, thickness, ink);
 	}
 
 	return Batch_create(PRIM_LINE_STRIP_ADJACENCY, vbo, NULL);
@@ -279,16 +276,16 @@ Batch *gpencil_get_buffer_stroke_geom(bGPdata *gpd, float matrix[4][4], short th
 
 		/* first point for adjacency (not drawn) */
 		if (i == 0) {
-			gpencil_set_stroke_point(rv3d, vbo, matrix, &pt, idx, pos_id, color_id, thickness_id, thickness, gpd->scolor, true);
+			gpencil_set_stroke_point(rv3d, vbo, matrix, &pt, idx, pos_id, color_id, thickness_id, thickness, gpd->scolor);
 			++idx;
 		}
 		/* set point */
-		gpencil_set_stroke_point(rv3d, vbo, matrix, &pt, idx, pos_id, color_id, thickness_id, thickness, gpd->scolor, false);
+		gpencil_set_stroke_point(rv3d, vbo, matrix, &pt, idx, pos_id, color_id, thickness_id, thickness, gpd->scolor);
 		++idx;
 	}
 
 	/* last adjacency point (not drawn) */
-	gpencil_set_stroke_point(rv3d, vbo, matrix, &pt, idx, pos_id, color_id, thickness_id, thickness, gpd->scolor, true);
+	gpencil_set_stroke_point(rv3d, vbo, matrix, &pt, idx, pos_id, color_id, thickness_id, thickness, gpd->scolor);
 
 	return Batch_create(PRIM_LINE_STRIP_ADJACENCY, vbo, NULL);
 }




More information about the Bf-blender-cvs mailing list