diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-10-20 01:40:08 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-10-20 01:40:08 +0300 |
commit | aa7e76b2e35c6ff6c58ccd4373b68dde8283a3a3 (patch) | |
tree | 5b1bf92ebe488833668589d3a101311ef3b08faa /source/blender/editors/gpencil/drawgpencil.c | |
parent | fc10484f7c55d425f8374f2ea64f6b525cff2b7d (diff) | |
parent | cb957fd8e0e2e0d0dbbebc3e7e3fcc5bfa8b51a8 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/editors/gpencil/drawgpencil.c')
-rw-r--r-- | source/blender/editors/gpencil/drawgpencil.c | 53 |
1 files changed, 18 insertions, 35 deletions
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index 63c15744388..659c0c99fcb 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -475,10 +475,7 @@ static void gp_triangulate_stroke_fill(bGPDstroke *gps) } for (int i = 0; i < gps->tot_triangles; i++) { - bGPDtriangle *stroke_triangle = &gps->triangles[i]; - stroke_triangle->v1 = tmp_triangles[i][0]; - stroke_triangle->v2 = tmp_triangles[i][1]; - stroke_triangle->v3 = tmp_triangles[i][2]; + memcpy(gps->triangles[i].verts, tmp_triangles[i], sizeof(uint[3])); } } else { @@ -538,38 +535,24 @@ static void gp_draw_stroke_fill( bGPDtriangle *stroke_triangle = gps->triangles; bGPDspoint *pt; - for (int i = 0; i < gps->tot_triangles; i++, stroke_triangle++) { - if (gps->flag & GP_STROKE_3DSPACE) { - /* vertex 1 */ - pt = &gps->points[stroke_triangle->v1]; - mul_v3_m4v3(fpt, diff_mat, &pt->x); - immVertex3fv(pos, fpt); - /* vertex 2 */ - pt = &gps->points[stroke_triangle->v2]; - mul_v3_m4v3(fpt, diff_mat, &pt->x); - immVertex3fv(pos, fpt); - /* vertex 3 */ - pt = &gps->points[stroke_triangle->v3]; - mul_v3_m4v3(fpt, diff_mat, &pt->x); - immVertex3fv(pos, fpt); + if (gps->flag & GP_STROKE_3DSPACE) { + for (int i = 0; i < gps->tot_triangles; i++, stroke_triangle++) { + for (int j = 0; j < 3; j++) { + pt = &gps->points[stroke_triangle->verts[j]]; + mul_v3_m4v3(fpt, diff_mat, &pt->x); + immVertex3fv(pos, fpt); + } } - else { - float co[2]; - /* vertex 1 */ - pt = &gps->points[stroke_triangle->v1]; - mul_v3_m4v3(fpt, diff_mat, &pt->x); - gp_calc_2d_stroke_fxy(fpt, gps->flag, offsx, offsy, winx, winy, co); - immVertex2fv(pos, co); - /* vertex 2 */ - pt = &gps->points[stroke_triangle->v2]; - mul_v3_m4v3(fpt, diff_mat, &pt->x); - gp_calc_2d_stroke_fxy(fpt, gps->flag, offsx, offsy, winx, winy, co); - immVertex2fv(pos, co); - /* vertex 3 */ - pt = &gps->points[stroke_triangle->v3]; - mul_v3_m4v3(fpt, diff_mat, &pt->x); - gp_calc_2d_stroke_fxy(fpt, gps->flag, offsx, offsy, winx, winy, co); - immVertex2fv(pos, co); + } + else { + for (int i = 0; i < gps->tot_triangles; i++, stroke_triangle++) { + for (int j = 0; j < 3; j++) { + float co[2]; + pt = &gps->points[stroke_triangle->verts[j]]; + mul_v3_m4v3(fpt, diff_mat, &pt->x); + gp_calc_2d_stroke_fxy(fpt, gps->flag, offsx, offsy, winx, winy, co); + immVertex3fv(pos, fpt); + } } } |