Gizmo: add central point to circular 2D cage
This commit is contained in:
parent
7f958217ad
commit
23506622a5
Notes:
blender-bot
2023-02-14 05:36:11 +01:00
Referenced by issue #104363, Regression: Assert on rendering spot light gizmo for old file
|
@ -590,6 +590,20 @@ static void cage2d_draw_rect_handles(const rctf *r,
|
|||
immUnbindProgram();
|
||||
}
|
||||
|
||||
static void cage2d_draw_central_handle(const float color[3], const float margin[2])
|
||||
{
|
||||
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
|
||||
const float rad[2] = {margin[0] * 0.25f, margin[1] * 0.25f};
|
||||
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
immUniformColor3fv(color);
|
||||
|
||||
imm_draw_circle_fill_aspect_3d(pos, 0.0f, 0.0f, rad[0], rad[1], CIRCLE_RESOL);
|
||||
|
||||
immUnbindProgram();
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
static void gizmo_cage2d_draw_intern(wmGizmo *gz,
|
||||
|
@ -636,6 +650,8 @@ static void gizmo_cage2d_draw_intern(wmGizmo *gz,
|
|||
GPU_select_load_id(select_id | ED_GIZMO_CAGE2D_PART_SCALE);
|
||||
cage2d_draw_circle_wire(
|
||||
gz->color, size_real, 0.5f * (margin[0] + margin[1]), gz->line_width);
|
||||
|
||||
cage2d_draw_central_handle(gz->color, margin);
|
||||
}
|
||||
else {
|
||||
if (transform_flag & ED_GIZMO_CAGE_XFORM_FLAG_SCALE) {
|
||||
|
@ -736,6 +752,8 @@ static void gizmo_cage2d_draw_intern(wmGizmo *gz,
|
|||
else if (draw_style == ED_GIZMO_CAGE2D_STYLE_CIRCLE) {
|
||||
cage2d_draw_circle_wire(black, size_real, 0.0f, outline_line_width);
|
||||
cage2d_draw_circle_wire(color, size_real, 0.0f, gz->line_width);
|
||||
|
||||
cage2d_draw_central_handle(color, margin);
|
||||
}
|
||||
else {
|
||||
BLI_assert(0);
|
||||
|
|
|
@ -76,6 +76,8 @@ void imm_draw_circle_wire_aspect_3d(
|
|||
uint pos, float x, float y, float radius_x, float radius_y, int nsegments);
|
||||
void imm_draw_circle_dashed_3d(uint pos, float x, float y, float radius, int nsegments);
|
||||
void imm_draw_circle_fill_3d(uint pos, float x, float y, float radius, int nsegments);
|
||||
void imm_draw_circle_fill_aspect_3d(
|
||||
uint pos, float x, float y, float radius_x, float radius_y, int nsegments);
|
||||
|
||||
/**
|
||||
* Same as 'imm_draw_disk_partial_fill_2d', except it draws a wire arc.
|
||||
|
|
|
@ -398,6 +398,12 @@ void imm_draw_circle_fill_3d(uint pos, float x, float y, float radius, int nsegm
|
|||
imm_draw_circle_3D(GPU_PRIM_TRI_FAN, pos, x, y, radius, radius, nsegments);
|
||||
}
|
||||
|
||||
void imm_draw_circle_fill_aspect_3d(
|
||||
uint pos, float x, float y, float radius_x, float radius_y, int nsegments)
|
||||
{
|
||||
imm_draw_circle_3D(GPU_PRIM_TRI_FAN, pos, x, y, radius_x, radius_y, nsegments);
|
||||
}
|
||||
|
||||
void imm_draw_box_wire_2d(uint pos, float x1, float y1, float x2, float y2)
|
||||
{
|
||||
/* NOTE(Metal/AMD): For small primitives, line list more efficient than line-strip. */
|
||||
|
|
Loading…
Reference in New Issue