Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/mask/mask_draw.c
| Show First 20 Lines • Show All 104 Lines • ▼ Show 20 Lines | static void draw_single_handle(const MaskLayer *mask_layer, | ||||
| if (handle_type == HD_VECT) { | if (handle_type == HD_VECT) { | ||||
| return; | return; | ||||
| } | } | ||||
| 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); | ||||
| const uchar rgb_gray[4] = {0x60, 0x60, 0x60, 0xff}; | const uchar rgb_gray[4] = {0x60, 0x60, 0x60, 0xff}; | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| immUniformColor3ubv(rgb_gray); | immUniformColor3ubv(rgb_gray); | ||||
| /* this could be split into its own loop */ | /* this could be split into its own loop */ | ||||
| if (draw_type == MASK_DT_OUTLINE) { | if (draw_type == MASK_DT_OUTLINE) { | ||||
| GPU_line_width(3.0f); | GPU_line_width(3.0f); | ||||
| immBegin(GPU_PRIM_LINES, 2); | immBegin(GPU_PRIM_LINES, 2); | ||||
| immVertex2fv(pos, point_pos); | immVertex2fv(pos, point_pos); | ||||
| immVertex2fv(pos, handle_pos); | immVertex2fv(pos, handle_pos); | ||||
| ▲ Show 20 Lines • Show All 281 Lines • ▼ Show 20 Lines | static void mask_draw_curve_type(const bContext *C, | ||||
| 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); | ||||
| switch (draw_type) { | switch (draw_type) { | ||||
| case MASK_DT_OUTLINE: | case MASK_DT_OUTLINE: | ||||
| /* TODO(merwin): use fancy line shader here | /* TODO(merwin): use fancy line shader here | ||||
| * probably better with geometry shader (after core profile switch) | * probably better with geometry shader (after core profile switch) | ||||
| */ | */ | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| GPU_line_width(3.0f); | GPU_line_width(3.0f); | ||||
| mask_color_active_tint(rgb_tmp, rgb_black, is_active); | mask_color_active_tint(rgb_tmp, rgb_black, is_active); | ||||
| immUniformColor4ubv(rgb_tmp); | immUniformColor4ubv(rgb_tmp); | ||||
| mask_draw_array(pos, draw_method, points, tot_point); | mask_draw_array(pos, draw_method, points, tot_point); | ||||
| GPU_line_width(1.0f); | GPU_line_width(1.0f); | ||||
| mask_color_active_tint(rgb_tmp, rgb_spline, is_active); | mask_color_active_tint(rgb_tmp, rgb_spline, is_active); | ||||
| immUniformColor4ubv(rgb_tmp); | immUniformColor4ubv(rgb_tmp); | ||||
| mask_draw_array(pos, draw_method, points, tot_point); | mask_draw_array(pos, draw_method, points, tot_point); | ||||
| immUnbindProgram(); | immUnbindProgram(); | ||||
| break; | break; | ||||
| case MASK_DT_BLACK: | case MASK_DT_BLACK: | ||||
| case MASK_DT_WHITE: | case MASK_DT_WHITE: | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| GPU_line_width(1.0f); | GPU_line_width(1.0f); | ||||
| if (draw_type == MASK_DT_BLACK) { | if (draw_type == MASK_DT_BLACK) { | ||||
| rgb_tmp[0] = rgb_tmp[1] = rgb_tmp[2] = 0; | rgb_tmp[0] = rgb_tmp[1] = rgb_tmp[2] = 0; | ||||
| } | } | ||||
| else { | else { | ||||
| rgb_tmp[0] = rgb_tmp[1] = rgb_tmp[2] = 255; | rgb_tmp[0] = rgb_tmp[1] = rgb_tmp[2] = 255; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 348 Lines • ▼ Show 20 Lines | void ED_mask_draw_frames( | ||||
| /* Local coordinate visible rect inside region, to accommodate overlapping ui. */ | /* Local coordinate visible rect inside region, to accommodate overlapping ui. */ | ||||
| const rcti *rect_visible = ED_region_visible_rect(region); | const rcti *rect_visible = ED_region_visible_rect(region); | ||||
| const int region_bottom = rect_visible->ymin; | const int region_bottom = rect_visible->ymin; | ||||
| uint pos = GPU_vertformat_attr_add( | uint pos = GPU_vertformat_attr_add( | ||||
| immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); | immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| immUniformColor4ub(255, 175, 0, 255); | immUniformColor4ub(255, 175, 0, 255); | ||||
| immBegin(GPU_PRIM_LINES, 2 * num_lines); | immBegin(GPU_PRIM_LINES, 2 * num_lines); | ||||
| for (MaskLayerShape *mask_layer_shape = mask_layer->splines_shapes.first; | for (MaskLayerShape *mask_layer_shape = mask_layer->splines_shapes.first; | ||||
| mask_layer_shape != NULL; | mask_layer_shape != NULL; | ||||
| mask_layer_shape = mask_layer_shape->next) { | mask_layer_shape = mask_layer_shape->next) { | ||||
| int frame = mask_layer_shape->frame; | int frame = mask_layer_shape->frame; | ||||
| Show All 10 Lines | |||||