Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c
| Show First 20 Lines • Show All 540 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | ||||
| void (*circle_fn)(uint, float, float, float, float, int) = (solid) ? | void (*circle_fn)(uint, float, float, float, float, int) = (solid) ? | ||||
| imm_draw_circle_fill_aspect_2d : | imm_draw_circle_fill_aspect_2d : | ||||
| imm_draw_circle_wire_aspect_2d; | imm_draw_circle_wire_aspect_2d; | ||||
| const int resolu = 12; | const int resolu = 12; | ||||
| const float rad[2] = {margin[0] / 3, margin[1] / 3}; | const float rad[2] = {margin[0] / 3, margin[1] / 3}; | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| immUniformColor3fv(color); | immUniformColor3fv(color); | ||||
| /* should really divide by two, but looks too bulky. */ | /* should really divide by two, but looks too bulky. */ | ||||
| { | { | ||||
| imm_draw_point_aspect_2d(pos, r->xmin, r->ymin, rad[0], rad[1], solid); | imm_draw_point_aspect_2d(pos, r->xmin, r->ymin, rad[0], rad[1], solid); | ||||
| imm_draw_point_aspect_2d(pos, r->xmax, r->ymin, rad[0], rad[1], solid); | imm_draw_point_aspect_2d(pos, r->xmax, r->ymin, rad[0], rad[1], solid); | ||||
| imm_draw_point_aspect_2d(pos, r->xmax, r->ymax, rad[0], rad[1], solid); | imm_draw_point_aspect_2d(pos, r->xmax, r->ymax, rad[0], rad[1], solid); | ||||
| imm_draw_point_aspect_2d(pos, r->xmin, r->ymax, rad[0], rad[1], solid); | imm_draw_point_aspect_2d(pos, r->xmin, r->ymax, rad[0], rad[1], solid); | ||||
| Show All 35 Lines | static void gizmo_cage2d_draw_intern(wmGizmo *gz, | ||||
| float margin[2]; | float margin[2]; | ||||
| gizmo_calc_rect_view_margin(gz, dims, margin); | gizmo_calc_rect_view_margin(gz, dims, margin); | ||||
| /* Handy for quick testing draw (if it's outside bounds). */ | /* Handy for quick testing draw (if it's outside bounds). */ | ||||
| if (false) { | if (false) { | ||||
| GPU_blend(GPU_BLEND_ALPHA); | GPU_blend(GPU_BLEND_ALPHA); | ||||
| uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| immUniformColor4fv((const float[4]){1, 1, 1, 0.5f}); | immUniformColor4fv((const float[4]){1, 1, 1, 0.5f}); | ||||
| float s = 0.5f; | float s = 0.5f; | ||||
| immRectf(pos, -s, -s, s, s); | immRectf(pos, -s, -s, s, s); | ||||
| immUnbindProgram(); | immUnbindProgram(); | ||||
| GPU_blend(GPU_BLEND_NONE); | GPU_blend(GPU_BLEND_NONE); | ||||
| } | } | ||||
| if (select) { | if (select) { | ||||
| ▲ Show 20 Lines • Show All 626 Lines • Show Last 20 Lines | |||||