diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-06-19 13:18:04 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-06-19 13:18:04 +0300 |
commit | b4d053efc75424fca4b413ac1bc7a7e826fac629 (patch) | |
tree | 80647d9ca9109e997fce9911f202f98d7f8577d4 /source/blender/editors/gpencil/drawgpencil.c | |
parent | 349946bd010b1112b13c8594aabfb318c330bc0d (diff) |
Gawain API naming refactor
Use consistent prefix for gawain API names as well as
some abbreviations to avoid over-long names, see: D2678
Diffstat (limited to 'source/blender/editors/gpencil/drawgpencil.c')
-rw-r--r-- | source/blender/editors/gpencil/drawgpencil.c | 92 |
1 files changed, 46 insertions, 46 deletions
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index a868b47053c..96f9959af02 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -149,14 +149,14 @@ static void gp_draw_stroke_buffer_fill(const tGPspoint *points, int totpoints, f /* draw triangulation data */ if (tot_triangles > 0) { - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); - unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); /* Draw all triangles for filling the polygon */ - immBegin(PRIM_TRIANGLES, tot_triangles * 3); + immBegin(GWN_PRIM_TRIS, tot_triangles * 3); /* TODO: use batch instead of immediate mode, to share vertices */ const tGPspoint *pt; @@ -207,9 +207,9 @@ static void gp_draw_stroke_buffer(const tGPspoint *points, int totpoints, short return; } - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); - unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); const tGPspoint *pt = points; @@ -217,7 +217,7 @@ static void gp_draw_stroke_buffer(const tGPspoint *points, int totpoints, short /* if drawing a single point, draw it larger */ glPointSize((float)(thickness + 2) * points->pressure); immBindBuiltinProgram(GPU_SHADER_3D_POINT_FIXED_SIZE_VARYING_COLOR); - immBegin(PRIM_POINTS, 1); + immBegin(GWN_PRIM_POINTS, 1); gp_set_tpoint_varying_color(pt, ink, color); immVertex2iv(pos, &pt->x); } @@ -227,7 +227,7 @@ static void gp_draw_stroke_buffer(const tGPspoint *points, int totpoints, short /* draw stroke curve */ glLineWidth(max_ff(oldpressure * thickness, 1.0)); immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); - immBeginAtMost(PRIM_LINE_STRIP, totpoints); + immBeginAtMost(GWN_PRIM_LINE_STRIP, totpoints); /* TODO: implement this with a geometry shader to draw one continuous tapered stroke */ @@ -246,7 +246,7 @@ static void gp_draw_stroke_buffer(const tGPspoint *points, int totpoints, short draw_points = 0; glLineWidth(max_ff(pt->pressure * thickness, 1.0f)); - immBeginAtMost(PRIM_LINE_STRIP, totpoints - i + 1); + immBeginAtMost(GWN_PRIM_LINE_STRIP, totpoints - i + 1); /* need to roll-back one point to ensure that there are no gaps in the stroke */ if (i != 0) { @@ -318,14 +318,14 @@ static void gp_draw_stroke_volumetric_buffer(const tGPspoint *points, int totpoi if (dflag & (GP_DRAWDATA_ONLY3D | GP_DRAWDATA_ONLYV2D)) return; - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int size = VertexFormat_add_attrib(format, "size", COMP_F32, 1, KEEP_FLOAT); - unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + unsigned int size = GWN_vertformat_attr_add(format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT); + unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_3D_POINT_VARYING_SIZE_VARYING_COLOR); GPU_enable_program_point_size(); - immBegin(PRIM_POINTS, totpoints); + immBegin(GWN_PRIM_POINTS, totpoints); const tGPspoint *pt = points; for (int i = 0; i < totpoints; i++, pt++) { @@ -345,14 +345,14 @@ static void gp_draw_stroke_volumetric_2d(const bGPDspoint *points, int totpoints int offsx, int offsy, int winx, int winy, const float diff_mat[4][4], const float ink[4]) { - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int size = VertexFormat_add_attrib(format, "size", COMP_F32, 1, KEEP_FLOAT); - unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + unsigned int size = GWN_vertformat_attr_add(format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT); + unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_3D_POINT_VARYING_SIZE_VARYING_COLOR); GPU_enable_program_point_size(); - immBegin(PRIM_POINTS, totpoints); + immBegin(GWN_PRIM_POINTS, totpoints); const bGPDspoint *pt = points; for (int i = 0; i < totpoints; i++, pt++) { @@ -378,14 +378,14 @@ static void gp_draw_stroke_volumetric_3d( const bGPDspoint *points, int totpoints, short thickness, const float ink[4]) { - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); - unsigned int size = VertexFormat_add_attrib(format, "size", COMP_F32, 1, KEEP_FLOAT); - unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + unsigned int size = GWN_vertformat_attr_add(format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT); + unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_3D_POINT_VARYING_SIZE_VARYING_COLOR); GPU_enable_program_point_size(); - immBegin(PRIM_POINTS, totpoints); + immBegin(GWN_PRIM_POINTS, totpoints); const bGPDspoint *pt = points; for (int i = 0; i < totpoints && pt; i++, pt++) { @@ -521,18 +521,18 @@ static void gp_draw_stroke_fill( unsigned int pos; if (gps->flag & GP_STROKE_3DSPACE) { - pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); } else { - pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); } immUniformColor4fv(color); /* Draw all triangles for filling the polygon (cache must be calculated before) */ - immBegin(PRIM_TRIANGLES, gps->tot_triangles * 3); + immBegin(GWN_PRIM_TRIS, gps->tot_triangles * 3); /* TODO: use batch instead of immediate mode, to share vertices */ bGPDtriangle *stroke_triangle = gps->triangles; @@ -591,8 +591,8 @@ static void gp_draw_stroke_point( float fpt[3]; mul_v3_m4v3(fpt, diff_mat, &pt->x); - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); if (sflag & GP_STROKE_3DSPACE) { immBindBuiltinProgram(GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA); @@ -610,7 +610,7 @@ static void gp_draw_stroke_point( /* set point thickness (since there's only one of these) */ immUniform1f("size", (float)(thickness + 2) * pt->pressure); - immBegin(PRIM_POINTS, 1); + immBegin(GWN_PRIM_POINTS, 1); immVertex3fv(pos, fpt); immEnd(); @@ -633,9 +633,9 @@ static void gp_draw_stroke_3d(const bGPDspoint *points, int totpoints, short thi } - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); - unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_3D_SMOOTH_COLOR); @@ -643,7 +643,7 @@ static void gp_draw_stroke_3d(const bGPDspoint *points, int totpoints, short thi /* draw stroke curve */ glLineWidth(max_ff(curpressure * thickness, 1.0f)); - immBeginAtMost(PRIM_LINE_STRIP, totpoints + cyclic_add); + immBeginAtMost(GWN_PRIM_LINE_STRIP, totpoints + cyclic_add); const bGPDspoint *pt = points; for (int i = 0; i < totpoints; i++, pt++) { gp_set_point_varying_color(pt, ink, color); @@ -664,7 +664,7 @@ static void gp_draw_stroke_3d(const bGPDspoint *points, int totpoints, short thi curpressure = pt->pressure; glLineWidth(max_ff(curpressure * thickness, 1.0f)); - immBeginAtMost(PRIM_LINE_STRIP, totpoints - i + 1 + cyclic_add); + immBeginAtMost(GWN_PRIM_LINE_STRIP, totpoints - i + 1 + cyclic_add); /* need to roll-back one point to ensure that there are no gaps in the stroke */ if (i != 0) { @@ -732,12 +732,12 @@ static void gp_draw_stroke_2d(const bGPDspoint *points, int totpoints, short thi int i; float fpt[3]; - 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); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); - immBegin(PRIM_TRIANGLE_STRIP, totpoints * 2 + 4); + immBegin(GWN_PRIM_TRI_STRIP, totpoints * 2 + 4); /* get x and y coordinates from first point */ mul_v3_m4v3(fpt, diff_mat, &points->x); @@ -1166,21 +1166,21 @@ static void gp_draw_strokes_edit( UI_GetThemeColor3fv(TH_GP_VERTEX_SELECT, selectColor); selectColor[3] = alpha; - VertexFormat *format = immVertexFormat(); + Gwn_VertFormat *format = immVertexFormat(); unsigned int pos; /* specified later */ - unsigned int size = VertexFormat_add_attrib(format, "size", COMP_F32, 1, KEEP_FLOAT); - unsigned int color = VertexFormat_add_attrib(format, "color", COMP_F32, 3, KEEP_FLOAT); + unsigned int size = GWN_vertformat_attr_add(format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT); + unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); if (gps->flag & GP_STROKE_3DSPACE) { - pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); + pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_POINT_VARYING_SIZE_VARYING_COLOR); } else { - pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_POINT_VARYING_SIZE_VARYING_COLOR); } - immBegin(PRIM_POINTS, gps->totpoints); + immBegin(GWN_PRIM_POINTS, gps->totpoints); /* Draw start and end point differently if enabled stroke direction hint */ bool show_direction_hint = (gpd->flag & GP_DATA_SHOW_DIRECTION) && (gps->totpoints > 1); |