draw gpencil sculpt cursor with new imm mode

Part of T49043 and T49450.
This commit is contained in:
Mike Erwin 2016-10-05 13:45:28 -04:00
parent c462500618
commit e874f3cdc5
1 changed files with 16 additions and 15 deletions

View File

@ -75,9 +75,10 @@
#include "ED_screen.h"
#include "ED_view3d.h"
#include "BIF_gl.h"
#include "BIF_glutil.h"
#include "GPU_immediate.h"
#include "gpencil_intern.h"
/* ************************************************ */
@ -958,28 +959,28 @@ static bool gpsculpt_brush_apply_clone(bContext *C, tGP_BrushEditData *gso)
static void gp_brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata))
{
GP_EditBrush_Data *brush = gpsculpt_get_brush(CTX_data_scene(C));
if (brush) {
glPushMatrix();
glTranslatef((float)x, (float)y, 0.0f);
VertexFormat *format = immVertexFormat();
unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
glEnable(GL_LINE_SMOOTH);
glEnable(GL_BLEND);
/* Inner Ring: Light color for action of the brush */
/* TODO: toggle between add and remove? */
glColor4ub(255, 255, 255, 200);
glutil_draw_lined_arc(0.0, M_PI * 2.0, brush->size, 40);
immUniformColor4ub(255, 255, 255, 200);
imm_draw_lined_circle(pos, x, y, brush->size, 40);
/* Outer Ring: Dark color for contrast on light backgrounds (e.g. gray on white) */
glColor3ub(30, 30, 30);
glutil_draw_lined_arc(0.0, M_PI * 2.0, brush->size + 1, 40);
immUniformColor3ub(30, 30, 30);
imm_draw_lined_circle(pos, x, y, brush->size + 1, 40);
immUnbindProgram();
glDisable(GL_BLEND);
glDisable(GL_LINE_SMOOTH);
glPopMatrix();
}
}