Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/gpencil/annotate_paint.c
| Show First 20 Lines • Show All 1,709 Lines • ▼ Show 20 Lines | |||||
| /* Helper callback for drawing the cursor itself */ | /* Helper callback for drawing the cursor itself */ | ||||
| static void annotation_draw_eraser(bContext *UNUSED(C), int x, int y, void *p_ptr) | static void annotation_draw_eraser(bContext *UNUSED(C), int x, int y, void *p_ptr) | ||||
| { | { | ||||
| tGPsdata *p = (tGPsdata *)p_ptr; | tGPsdata *p = (tGPsdata *)p_ptr; | ||||
| if (p->paintmode == GP_PAINTMODE_ERASER) { | if (p->paintmode == GP_PAINTMODE_ERASER) { | ||||
| GPUVertFormat *format = immVertexFormat(); | GPUVertFormat *format = immVertexFormat(); | ||||
| const uint shdr_pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | const uint shdr_pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| GPU_line_smooth(true); | GPU_line_smooth(true); | ||||
| GPU_blend(GPU_BLEND_ALPHA); | GPU_blend(GPU_BLEND_ALPHA); | ||||
| immUniformColor4ub(255, 100, 100, 20); | immUniformColor4ub(255, 100, 100, 20); | ||||
| imm_draw_circle_fill_2d(shdr_pos, x, y, p->radius, 40); | imm_draw_circle_fill_2d(shdr_pos, x, y, p->radius, 40); | ||||
| immUnbindProgram(); | immUnbindProgram(); | ||||
| ▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | static void annotation_draw_stabilizer(bContext *C, int x, int y, void *p_ptr) | ||||
| int totpoints = runtime.sbuffer_used; | int totpoints = runtime.sbuffer_used; | ||||
| if (totpoints < 2) { | if (totpoints < 2) { | ||||
| return; | return; | ||||
| } | } | ||||
| const tGPspoint *pt = &points[totpoints - 1]; | const tGPspoint *pt = &points[totpoints - 1]; | ||||
| GPUVertFormat *format = immVertexFormat(); | GPUVertFormat *format = immVertexFormat(); | ||||
| uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| GPU_line_smooth(true); | GPU_line_smooth(true); | ||||
| GPU_blend(GPU_BLEND_ALPHA); | GPU_blend(GPU_BLEND_ALPHA); | ||||
| GPU_line_width(1.25f); | GPU_line_width(1.25f); | ||||
| const float color[3] = {1.0f, 0.39f, 0.39f}; | const float color[3] = {1.0f, 0.39f, 0.39f}; | ||||
| /* default radius and color */ | /* default radius and color */ | ||||
| float darkcolor[3]; | float darkcolor[3]; | ||||
| const float radius = 4.0f; | const float radius = 4.0f; | ||||
| ▲ Show 20 Lines • Show All 1,036 Lines • Show Last 20 Lines | |||||