Blender V5.3
wm_gesture.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2008 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
10
11#include "DNA_screen_types.h"
12#include "DNA_userdef_types.h"
13#include "DNA_vec_types.h"
15
16#include "MEM_guardedalloc.h"
17
18#include "BLI_bitmap_draw_2d.hh"
19#include "BLI_lasso_2d.hh"
20#include "BLI_listbase.hh"
21#include "BLI_math_vector_c.hh"
22#include "BLI_rect.hh"
23#include "BLI_utildefines.hh"
24
25#include "WM_api.hh"
26#include "WM_types.hh"
27
28#include "wm.hh"
29
30#include "GPU_immediate.hh"
31#include "GPU_immediate_util.hh"
32#include "GPU_state.hh"
33
34#include "BIF_glutil.hh"
35
36#include "UI_view2d.hh"
37
38namespace blender {
39
40wmGesture *WM_gesture_new(wmWindow *window, const ARegion *region, const wmEvent *event, int type)
41{
42 wmGesture *gesture = MEM_new<wmGesture>("new gesture");
43
45
46 gesture->type = type;
47 gesture->event_type = event->type;
48 gesture->event_modifier = event->modifier;
49 gesture->event_keymodifier = event->keymodifier;
50 gesture->winrct = region->winrct;
51 gesture->user_data.use_free = true; /* Free if user-data is set. */
52 gesture->modal_state = GESTURE_MODAL_NOP;
53 gesture->move = false;
54
55 int xy[2];
56 WM_event_drag_start_xy(event, xy);
57
58 if (ELEM(type,
63 {
64 rcti *rect = MEM_new_zeroed<rcti>("gesture rect new");
65
66 gesture->customdata = rect;
67 rect->xmin = xy[0] - gesture->winrct.xmin;
68 rect->ymin = xy[1] - gesture->winrct.ymin;
69 if (type == WM_GESTURE_CIRCLE) {
70 /* Caller is responsible for initializing 'xmax' to radius. */
71 }
72 else {
73 rect->xmax = xy[0] - gesture->winrct.xmin;
74 rect->ymax = xy[1] - gesture->winrct.ymin;
75 }
76 }
77 else if (ELEM(type, WM_GESTURE_LINES, WM_GESTURE_LASSO)) {
78 float *lasso;
79 gesture->points_alloc = 1024;
80 gesture->customdata = lasso = MEM_new_array_uninitialized<float>(
81 size_t(2) * gesture->points_alloc, "lasso points");
82 lasso[0] = xy[0] - gesture->winrct.xmin;
83 lasso[1] = xy[1] - gesture->winrct.ymin;
84 gesture->points = 1;
85 }
86 else if (ELEM(type, WM_GESTURE_POLYLINE)) {
87 gesture->points_alloc = 64;
88 short *border = MEM_new_array_uninitialized<short>(size_t(2) * gesture->points_alloc,
89 "polyline points");
90 gesture->customdata = border;
91 border[0] = xy[0] - gesture->winrct.xmin;
92 border[1] = xy[1] - gesture->winrct.ymin;
93 gesture->mval.x = border[0];
94 gesture->mval.y = border[1];
95 gesture->points = 1;
96 }
97
98 return gesture;
99}
100
102{
104 MEM_delete_void(gesture->customdata);
106 MEM_delete(gesture->edge_pan_data);
107 MEM_delete(gesture);
108}
109
111{
112 while (win->runtime->gesture.first()) {
113 WM_gesture_end(win, win->runtime->gesture.first());
114 }
115}
116
118{
119 while (win->runtime->gesture.first()) {
120 WM_gesture_end(win, win->runtime->gesture.first());
121 }
122}
123
125{
126 if (gesture == nullptr) {
127 return true;
128 }
129 return (gesture->is_active_prev == false);
130}
131
132/* ******************* gesture draw ******************* */
133
134static void wm_gesture_draw_line_active_side(const rcti *rect, const bool flip)
135{
136 GPUVertFormat *format = immVertexFormat();
137 uint shdr_pos = GPU_vertformat_attr_add(format, "pos", gpu::VertAttrType::SFLOAT_32_32);
138 uint shdr_col = GPU_vertformat_attr_add(format, "color", gpu::VertAttrType::SFLOAT_32_32_32_32);
139
142
143 const float gradient_length = 150.0f * UI_SCALE_FAC;
144 float line_dir[2];
145 float gradient_dir[2];
146 float gradient_point[2][2];
147
148 const float line_start[2] = {float(rect->xmin), float(rect->ymin)};
149 const float line_end[2] = {float(rect->xmax), float(rect->ymax)};
150 const float color_line_gradient_start[4] = {0.2f, 0.2f, 0.2f, 0.4f};
151 const float color_line_gradient_end[4] = {0.0f, 0.0f, 0.0f, 0.0f};
152
153 sub_v2_v2v2(line_dir, line_end, line_start);
154 normalize_v2(line_dir);
155 ortho_v2_v2(gradient_dir, line_dir);
156 if (!flip) {
157 mul_v2_fl(gradient_dir, -1.0f);
158 }
159 mul_v2_fl(gradient_dir, gradient_length);
160 add_v2_v2v2(gradient_point[0], line_start, gradient_dir);
161 add_v2_v2v2(gradient_point[1], line_end, gradient_dir);
162
164 immAttr4f(shdr_col, UNPACK4(color_line_gradient_start));
165 immVertex2f(shdr_pos, line_start[0], line_start[1]);
166 immAttr4f(shdr_col, UNPACK4(color_line_gradient_start));
167 immVertex2f(shdr_pos, line_end[0], line_end[1]);
168 immAttr4f(shdr_col, UNPACK4(color_line_gradient_end));
169 immVertex2f(shdr_pos, gradient_point[1][0], gradient_point[1][1]);
170
171 immAttr4f(shdr_col, UNPACK4(color_line_gradient_start));
172 immVertex2f(shdr_pos, line_start[0], line_start[1]);
173 immAttr4f(shdr_col, UNPACK4(color_line_gradient_end));
174 immVertex2f(shdr_pos, gradient_point[1][0], gradient_point[1][1]);
175 immAttr4f(shdr_col, UNPACK4(color_line_gradient_end));
176 immVertex2f(shdr_pos, gradient_point[0][0], gradient_point[0][1]);
177 immEnd();
178
181}
182
184{
185 const rcti *rect = static_cast<rcti *>(gt->customdata);
186
187 if (gt->draw_active_side) {
189 }
190
191 uint shdr_pos = GPU_vertformat_attr_add(
192 immVertexFormat(), "pos", gpu::VertAttrType::SFLOAT_32_32);
193
195
196 float viewport_size[4];
197 GPU_viewport_size_get_f(viewport_size);
198 immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
199
200 immUniform1i("colors_len", 2); /* "advanced" mode. */
201 immUniform4f("color", 0.4f, 0.4f, 0.4f, 1.0f);
202 immUniform4f("color2", 1.0f, 1.0f, 1.0f, 1.0f);
203 immUniform1f("dash_width", 8.0f);
204 immUniform1f("udash_factor", 0.5f);
205
206 float xmin = float(rect->xmin);
207 float ymin = float(rect->ymin);
208
210 immVertex2f(shdr_pos, xmin, ymin);
211 immVertex2f(shdr_pos, float(rect->xmax), float(rect->ymax));
212 immEnd();
213
215}
216
218{
219 const rcti *rect = static_cast<const rcti *>(gt->customdata);
220
221 uint shdr_pos = GPU_vertformat_attr_add(
222 immVertexFormat(), "pos", gpu::VertAttrType::SFLOAT_32_32);
223
225
227 immUniformColor4f(1.0f, 1.0f, 1.0f, 0.05f);
228
229 immRectf(shdr_pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
230
232
234
235 shdr_pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", gpu::VertAttrType::SFLOAT_32_32);
236
238
239 float viewport_size[4];
240 GPU_viewport_size_get_f(viewport_size);
241 immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
242
243 immUniform1i("colors_len", 2); /* "advanced" mode. */
244 immUniform4f("color", 0.4f, 0.4f, 0.4f, 1.0f);
245 immUniform4f("color2", 1.0f, 1.0f, 1.0f, 1.0f);
246 immUniform1f("dash_width", 8.0f);
247 immUniform1f("udash_factor", 0.5f);
248
250 shdr_pos, float(rect->xmin), float(rect->ymin), float(rect->xmax), float(rect->ymax));
251
253
254 /* Draws a diagonal line in the lined box to test #wm_gesture_draw_line. */
255 // wm_gesture_draw_line(gt);
256}
257
259{
260 const rcti *rect = static_cast<const rcti *>(gt->customdata);
261
263
264 const uint shdr_pos = GPU_vertformat_attr_add(
265 immVertexFormat(), "pos", gpu::VertAttrType::SFLOAT_32_32);
266
268
269 immUniformColor4f(1.0f, 1.0f, 1.0f, 0.05f);
270 imm_draw_circle_fill_2d(shdr_pos, float(rect->xmin), float(rect->ymin), float(rect->xmax), 40);
271
273
275
277
278 float viewport_size[4];
279 GPU_viewport_size_get_f(viewport_size);
280 immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
281
282 immUniform1i("colors_len", 2); /* "advanced" mode. */
283 immUniform4f("color", 0.4f, 0.4f, 0.4f, 1.0f);
284 immUniform4f("color2", 1.0f, 1.0f, 1.0f, 1.0f);
285 immUniform1f("dash_width", 4.0f);
286 immUniform1f("udash_factor", 0.5f);
287
288 imm_draw_circle_wire_2d(shdr_pos, float(rect->xmin), float(rect->ymin), float(rect->xmax), 40);
289
291}
292
295 int width;
296};
297
298static void draw_filled_lasso_px_cb(int x, int x_end, int y, void *user_data)
299{
300 LassoFillData *data = static_cast<LassoFillData *>(user_data);
301 uchar *col = &(data->px[(y * data->width) + x]);
302 memset(col, 0x10, x_end - x);
303}
304
305static void draw_filled_lasso(wmGesture *gt, const int2 *lasso_pt_extra)
306{
307 const int mcoords_len = gt->points + (lasso_pt_extra ? 1 : 0);
308 Array<int2> mcoords(mcoords_len);
309 int i;
310 rcti rect;
311 const float red[4] = {1.0f, 0.0f, 0.0f, 0.0f};
312
313 if (gt->type == WM_GESTURE_POLYLINE) {
314 const short *lasso = static_cast<const short *>(gt->customdata);
315 for (i = 0; i < mcoords_len; i++, lasso += 2) {
316 mcoords[i][0] = lasso[0];
317 mcoords[i][1] = lasso[1];
318 }
319 }
320 else {
321 const float *lasso = static_cast<const float *>(gt->customdata);
322 for (i = 0; i < mcoords_len; i++, lasso += 2) {
323 mcoords[i][0] = lasso[0];
324 mcoords[i][1] = lasso[1];
325 }
326 }
327
328 if (lasso_pt_extra) {
329 mcoords[mcoords_len - 1][0] = lasso_pt_extra->x;
330 mcoords[mcoords_len - 1][1] = lasso_pt_extra->y;
331 }
332
333 BLI_lasso_boundbox(&rect, mcoords);
334
335 BLI_rcti_translate(&rect, gt->winrct.xmin, gt->winrct.ymin);
336 BLI_rcti_isect(&gt->winrct, &rect, &rect);
337 BLI_rcti_translate(&rect, -gt->winrct.xmin, -gt->winrct.ymin);
338
339 /* Highly unlikely this will fail, but could crash if (mcoords_len == 0). */
340 if (BLI_rcti_is_empty(&rect) == false) {
341 const int w = BLI_rcti_size_x(&rect);
342 const int h = BLI_rcti_size_y(&rect);
343 uchar *pixel_buf = MEM_new_array_zeroed<uchar>(size_t(w) * size_t(h), __func__);
344 LassoFillData lasso_fill_data = {pixel_buf, w};
345
347 rect.ymin,
348 rect.xmax,
349 rect.ymax,
350 mcoords,
352 &lasso_fill_data);
353
355
358 drawer.shader_get(), GPU_shader_get_uniform(drawer.shader_get(), "shuffle"), 4, 1, red);
359 drawer.draw(rect.xmin,
360 rect.ymin,
361 w,
362 h,
363 gpu::TextureFormat::UNORM_8,
364 false,
365 pixel_buf,
366 1.0f,
367 1.0f,
368 nullptr);
369
370 MEM_delete(pixel_buf);
371
373 }
374}
375
376/* TODO: Extract this common functionality so it can be shared between Sculpt brushes, the annotate
377 * tool, and this common logic. */
378static void draw_lasso_smooth_stroke_indicator(wmGesture *gt, const uint shdr_pos)
379{
380 float (*lasso)[2] = static_cast<float (*)[2]>(gt->customdata);
381 float last_x = lasso[gt->points - 1][0];
382 float last_y = lasso[gt->points - 1][1];
383
385 GPU_line_smooth(true);
387
388 GPU_line_width(1.25f);
389 const float color[3] = {1.0f, 0.39f, 0.39f};
390
391 const float radius = 4.0f;
392
393 /* Draw Inner Ring */
394 immUniformColor4f(color[0], color[1], color[2], 0.8f);
395 imm_draw_circle_wire_2d(shdr_pos, gt->mval.x, gt->mval.y, radius, 40);
396
397 /* Draw Outer Ring: Dark color for contrast on light backgrounds (e.g. gray on white) */
398 float darkcolor[3];
399 mul_v3_v3fl(darkcolor, color, 0.40f);
400 immUniformColor4f(darkcolor[0], darkcolor[1], darkcolor[2], 0.8f);
401 imm_draw_circle_wire_2d(shdr_pos, gt->mval.x, gt->mval.y, radius + 1, 40);
402
403 /* Draw line from the last saved position to the current mouse position. */
404 immUniformColor4f(color[0], color[1], color[2], 0.8f);
406 immVertex2f(shdr_pos, gt->mval.x, gt->mval.y);
407 immVertex2f(shdr_pos, last_x, last_y);
408 immEnd();
409
411 GPU_line_smooth(false);
413}
414
415static void wm_gesture_draw_lasso(wmGesture *gt, bool filled)
416{
417 const float *lasso = static_cast<float *>(gt->customdata);
418 int i;
419
420 if (filled) {
421 draw_filled_lasso(gt, nullptr);
422 }
423
424 const int numverts = gt->points;
425
426 /* Nothing to draw, do early output. */
427 if (numverts < 2) {
428 return;
429 }
430
431 const uint shdr_pos = GPU_vertformat_attr_add(
432 immVertexFormat(), "pos", gpu::VertAttrType::SFLOAT_32_32);
433
435
436 float viewport_size[4];
437 GPU_viewport_size_get_f(viewport_size);
438 immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
439
440 immUniform1i("colors_len", 2); /* "advanced" mode. */
441 immUniform4f("color", 0.4f, 0.4f, 0.4f, 1.0f);
442 immUniform4f("color2", 1.0f, 1.0f, 1.0f, 1.0f);
443 immUniform1f("dash_width", 2.0f);
444 immUniform1f("udash_factor", 0.5f);
445
447
448 for (i = 0; i < gt->points; i++, lasso += 2) {
449 immVertex2f(shdr_pos, lasso[0], lasso[1]);
450 }
451
452 immEnd();
454
455 if (gt->use_smooth) {
457 }
458}
459
460static void draw_start_vertex_circle(const wmGesture &gt, const uint shdr_pos)
461{
462 const int numverts = gt.points;
463
464 /* Draw the circle around the starting vertex. */
465 const short (*border)[2] = static_cast<short int (*)[2]>(gt.customdata);
466
467 const float start_pos[2] = {float(border[0][0]), float(border[0][1])};
468 const float current_pos[2] = {float(gt.mval.x), float(gt.mval.y)};
469
470 const float dist = len_v2v2(start_pos, current_pos);
472
473 if (dist < limit && numverts > 2) {
474 const float u = smoothstep(0.0f, limit, dist);
475 const float radius = interpf(
477
479
480 const float3 color = {1.0f, 1.0f, 1.0f};
481 immUniformColor4f(color.x, color.y, color.z, 0.8f);
482 imm_draw_circle_wire_2d(shdr_pos, start_pos[0], start_pos[1], radius, 15.0f);
483
484 const float3 darker_color = color * 0.4f;
485 immUniformColor4f(darker_color.x, darker_color.y, darker_color.z, 0.8f);
486 imm_draw_circle_wire_2d(shdr_pos, start_pos[0], start_pos[1], radius + 1, 15.0f);
487
489 }
490}
491
493{
494 draw_filled_lasso(gt, &gt->mval);
495
496 const int numverts = gt->points + 1;
497 if (numverts < 2) {
498 return;
499 }
500
501 const uint shdr_pos = GPU_vertformat_attr_add(
502 immVertexFormat(), "pos", gpu::VertAttrType::SFLOAT_32_32);
503
505
506 float viewport_size[4];
507 GPU_viewport_size_get_f(viewport_size);
508 immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
509
510 immUniform1i("colors_len", 2); /* "advanced" mode */
511 immUniform4f("color", 0.4f, 0.4f, 0.4f, 1.0f);
512 immUniform4f("color2", 1.0f, 1.0f, 1.0f, 1.0f);
513 immUniform1f("dash_width", 2.0f);
514 immUniform1f("udash_factor", 0.5f);
515
516 immBegin(GPU_PRIM_LINE_LOOP, numverts);
517
518 const short *border = static_cast<short *>(gt->customdata);
519 for (int i = 0; i < gt->points; i++, border += 2) {
520 immVertex2f(shdr_pos, float(border[0]), float(border[1]));
521 }
522 immVertex2f(shdr_pos, float(gt->mval.x), float(gt->mval.y));
523
524 immEnd();
525
527
528 draw_start_vertex_circle(*gt, shdr_pos);
529}
530
531static void wm_gesture_draw_cross(const wmWindow *win, const wmGesture *gt)
532{
533 const rcti *rect = static_cast<const rcti *>(gt->customdata);
534 const int2 win_size = WM_window_native_pixel_size(win);
535
536 float x1, x2, y1, y2;
537
538 const uint shdr_pos = GPU_vertformat_attr_add(
539 immVertexFormat(), "pos", gpu::VertAttrType::SFLOAT_32_32);
540
542
543 float viewport_size[4];
544 GPU_viewport_size_get_f(viewport_size);
545 immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
546
547 immUniform1i("colors_len", 2); /* "advanced" mode. */
548 immUniform4f("color", 0.4f, 0.4f, 0.4f, 1.0f);
549 immUniform4f("color2", 1.0f, 1.0f, 1.0f, 1.0f);
550 immUniform1f("dash_width", 8.0f);
551 immUniform1f("udash_factor", 0.5f);
552
554
555 x1 = float(rect->xmin - win_size[0]);
556 y1 = float(rect->ymin);
557 x2 = float(rect->xmin + win_size[0]);
558 y2 = y1;
559
560 immVertex2f(shdr_pos, x1, y1);
561 immVertex2f(shdr_pos, x2, y2);
562
563 x1 = float(rect->xmin);
564 y1 = float(rect->ymin - win_size[1]);
565 x2 = x1;
566 y2 = float(rect->ymin + win_size[1]);
567
568 immVertex2f(shdr_pos, x1, y1);
569 immVertex2f(shdr_pos, x2, y2);
570
571 immEnd();
572
574}
575
577{
578 wmGesture *gt = win->runtime->gesture.first();
579
580 GPU_line_width(1.0f);
581 for (; gt; gt = gt->next) {
582 /* All in sub-window space. */
583 wmViewport(&gt->winrct);
584
585 if (gt->type == WM_GESTURE_RECT) {
587 }
588 else if (gt->type == WM_GESTURE_CIRCLE) {
590 }
591 else if (gt->type == WM_GESTURE_CROSS_RECT) {
592 if (gt->is_active) {
594 }
595 else {
596 wm_gesture_draw_cross(win, gt);
597 }
598 }
599 else if (gt->type == WM_GESTURE_LINES) {
600 wm_gesture_draw_lasso(gt, false);
601 }
602 else if (gt->type == WM_GESTURE_LASSO) {
603 wm_gesture_draw_lasso(gt, true);
604 }
605 else if (gt->type == WM_GESTURE_STRAIGHTLINE) {
607 }
608 else if (gt->type == WM_GESTURE_POLYLINE) {
610 }
611 }
612}
613
615{
617
618 if (screen) {
619 screen->do_draw_gesture = true;
620 }
621}
622
623} // namespace blender
#define UI_SCALE_FAC
Read Blender memory allocation and freeing.
#define WM_GESTURE_RECT
Definition WM_types.hh:653
#define WM_GESTURE_STRAIGHTLINE
Definition WM_types.hh:657
#define WM_GESTURE_LINES
Definition WM_types.hh:652
#define WM_GESTURE_LASSO
Definition WM_types.hh:655
#define WM_GESTURE_CIRCLE
Definition WM_types.hh:656
#define WM_GESTURE_CROSS_RECT
Definition WM_types.hh:654
#define WM_GESTURE_POLYLINE
Definition WM_types.hh:658
#define UNPACK4(a)
#define ELEM(...)
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition btQuadWord.h:119
gpu::Shader * shader_get()
Definition BIF_glutil.hh:51
void draw(float x, float y, int img_w, int img_h, gpu::TextureFormat gpu_format, bool use_filter, const void *rect, float scale_x, float scale_y, const float color[4])
Definition glutil.cc:45
constexpr float POLYLINE_CLICK_RADIUS
Definition WM_types.hh:648
BMesh Iterators.
static void wm_gesture_draw_rect(wmGesture *gt)
void WM_gestures_free_all(wmWindow *win)
void wmViewport(const rcti *winrct)
void immAttr4f(uint attr_id, float x, float y, float z, float w)
static void wm_gesture_draw_lasso(wmGesture *gt, bool filled)
void immEnd()
static void wm_gesture_draw_cross(const wmWindow *win, const wmGesture *gt)
unsigned int uint
Definition BKE_text.h:55
void * MEM_new_array_uninitialized(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
MINLINE void add_v2_v2v2(float r[2], const float a[2], const float b[2])
bool BLI_rcti_isect(const struct rcti *src1, const struct rcti *src2, struct rcti *dest)
MINLINE void mul_v2_fl(float r[2], float f)
void immUniform2f(const char *name, float x, float y)
GPUVertFormat * immVertexFormat()
wmGesture * WM_gesture_new(wmWindow *window, const ARegion *region, const wmEvent *event, int type)
Definition wm_gesture.cc:40
void WM_event_drag_start_xy(const wmEvent *event, int r_xy[2])
void immBegin(GPUPrimType, uint vertex_len)
void ortho_v2_v2(float out[2], const float v[2])
void GPU_line_smooth(bool enable)
Definition gpu_state.cc:80
@ GPU_PRIM_LINE_STRIP
@ GPU_PRIM_LINE_LOOP
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2])
MINLINE float normalize_v2(float n[2])
static void draw_start_vertex_circle(const wmGesture &gt, const uint shdr_pos)
void MEM_delete_void(void *vmemh)
void immUnbindProgram()
MINLINE float pow2f(float x)
void GPU_line_width(float width)
Definition gpu_state.cc:151
@ GPU_BLEND_NONE
Definition GPU_state.hh:88
@ GPU_BLEND_ADDITIVE_PREMULT
Definition GPU_state.hh:93
@ GPU_BLEND_ALPHA
Definition GPU_state.hh:90
void immBindBuiltinProgram(GPUBuiltinShader shader_id)
void imm_draw_circle_wire_2d(uint shdr_pos, float x, float y, float radius, int nsegments)
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
Definition BLI_rect.hh:207
VecBase< int32_t, 2 > int2
void immUniform1f(const char *name, float x)
void * MEM_new_zeroed(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
void immVertex2f(uint attr_id, float x, float y)
unsigned char uchar
Definition BKE_text.h:58
static void wm_gesture_draw_line_active_side(const rcti *rect, const bool flip)
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:138
void GPU_viewport_size_get_f(float coords[4])
Definition gpu_state.cc:258
BMesh const char void * data
void BLI_bitmap_draw_2d_poly_v2i_n(int xmin, int ymin, int xmax, int ymax, Span< int2 > verts, void(*callback)(int x, int x_end, int y, void *), void *user_data)
@ GPU_SHADER_2D_IMAGE_SHUFFLE_COLOR
@ GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR
static void draw_filled_lasso(wmGesture *gt, const int2 *lasso_pt_extra)
void GPU_shader_uniform_float_ex(gpu::Shader *shader, int location, int length, int array_size, const float *value)
void BLI_rcti_translate(struct rcti *rect, int x, int y)
Definition rct.cc:580
void immUniformColor4f(float r, float g, float b, float a)
static void draw_filled_lasso_px_cb(int x, int x_end, int y, void *user_data)
static void draw_lasso_smooth_stroke_indicator(wmGesture *gt, const uint shdr_pos)
void wm_gesture_tag_redraw(wmWindow *win)
bool BLI_rcti_is_empty(const struct rcti *rect)
void WM_gesture_end(wmWindow *win, wmGesture *gesture)
MINLINE float smoothstep(float edge0, float edge1, float x)
uint GPU_vertformat_attr_add(GPUVertFormat *format, StringRef name, gpu::VertAttrType type)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
Definition BLI_rect.hh:203
static void wm_gesture_draw_polyline(wmGesture *gt)
int GPU_shader_get_uniform(gpu::Shader *shader, const char *name)
MINLINE void mul_v3_v3fl(float r[3], const float a[3], float f)
void immUniform4f(const char *name, float x, float y, float z, float w)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:118
void imm_draw_box_wire_2d(uint pos, float x1, float y1, float x2, float y2)
int2 WM_window_native_pixel_size(const wmWindow *win)
MINLINE float len_v2v2(const float v1[2], const float v2[2]) ATTR_WARN_UNUSED_RESULT
void WM_gestures_remove(wmWindow *win)
MINLINE float interpf(float target, float origin, float t)
void GPU_blend(GPUBlend blend)
Definition gpu_state.cc:44
void immUniform1i(const char *name, int x)
VecBase< float, 3 > float3
bool WM_gesture_is_modal_first(const wmGesture *gesture)
static void wm_gesture_draw_circle(wmGesture *gt)
void imm_draw_circle_fill_2d(uint shdr_pos, float x, float y, float radius, int nsegments)
bScreen * WM_window_get_active_screen(const wmWindow *win)
void WM_generic_user_data_free(wmGenericUserData *wm_userdata)
Definition wm_utils.cc:47
void wm_gesture_draw(wmWindow *win)
void immRectf(uint pos, float x1, float y1, float x2, float y2)
void BLI_lasso_boundbox(rcti *rect, Span< int2 > mcoords)
Definition lasso_2d.cc:21
static void wm_gesture_draw_line(wmGesture *gt)
void * MEM_new_array_zeroed(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
ListBaseT< wmGesture > gesture
wmGesture * next
Definition WM_types.hh:664
bke::WindowRuntime * runtime