Blender V5.0
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.h"
19#include "BLI_lasso_2d.hh"
20#include "BLI_listbase.h"
21#include "BLI_math_vector.h"
22#include "BLI_rect.h"
23#include "BLI_utildefines.h"
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
36using blender::Array;
37using blender::int2;
38
39wmGesture *WM_gesture_new(wmWindow *window, const ARegion *region, const wmEvent *event, int type)
40{
41 wmGesture *gesture = MEM_callocN<wmGesture>("new gesture");
42
43 BLI_addtail(&window->gesture, gesture);
44
45 gesture->type = type;
46 gesture->event_type = event->type;
47 gesture->event_modifier = event->modifier;
48 gesture->event_keymodifier = event->keymodifier;
49 gesture->winrct = region->winrct;
50 gesture->user_data.use_free = true; /* Free if user-data is set. */
52 gesture->move = false;
53
54 int xy[2];
56
57 if (ELEM(type,
62 {
63 rcti *rect = MEM_callocN<rcti>("gesture rect new");
64
65 gesture->customdata = rect;
66 rect->xmin = xy[0] - gesture->winrct.xmin;
67 rect->ymin = xy[1] - gesture->winrct.ymin;
68 if (type == WM_GESTURE_CIRCLE) {
69 /* Caller is responsible for initializing 'xmax' to radius. */
70 }
71 else {
72 rect->xmax = xy[0] - gesture->winrct.xmin;
73 rect->ymax = xy[1] - gesture->winrct.ymin;
74 }
75 }
76 else if (ELEM(type, WM_GESTURE_LINES, WM_GESTURE_LASSO)) {
77 float *lasso;
78 gesture->points_alloc = 1024;
79 gesture->customdata = lasso = MEM_malloc_arrayN<float>(size_t(2 * gesture->points_alloc),
80 "lasso points");
81 lasso[0] = xy[0] - gesture->winrct.xmin;
82 lasso[1] = xy[1] - gesture->winrct.ymin;
83 gesture->points = 1;
84 }
85 else if (ELEM(type, WM_GESTURE_POLYLINE)) {
86 gesture->points_alloc = 64;
87 short *border = MEM_malloc_arrayN<short>(size_t(2 * gesture->points_alloc), "polyline points");
88 gesture->customdata = border;
89 border[0] = xy[0] - gesture->winrct.xmin;
90 border[1] = xy[1] - gesture->winrct.ymin;
91 gesture->mval.x = border[0];
92 gesture->mval.y = border[1];
93 gesture->points = 1;
94 }
95
96 return gesture;
97}
98
99void WM_gesture_end(wmWindow *win, wmGesture *gesture)
100{
101 BLI_remlink(&win->gesture, gesture);
102 MEM_freeN(gesture->customdata);
104 MEM_freeN(gesture);
105}
106
108{
109 while (win->gesture.first) {
110 WM_gesture_end(win, static_cast<wmGesture *>(win->gesture.first));
111 }
112}
113
115{
116 while (win->gesture.first) {
117 WM_gesture_end(win, static_cast<wmGesture *>(win->gesture.first));
118 }
119}
120
122{
123 if (gesture == nullptr) {
124 return true;
125 }
126 return (gesture->is_active_prev == false);
127}
128
129/* ******************* gesture draw ******************* */
130
131static void wm_gesture_draw_line_active_side(const rcti *rect, const bool flip)
132{
134 uint shdr_pos = GPU_vertformat_attr_add(format, "pos", blender::gpu::VertAttrType::SFLOAT_32_32);
135 uint shdr_col = GPU_vertformat_attr_add(
136 format, "color", blender::gpu::VertAttrType::SFLOAT_32_32_32_32);
137
140
141 const float gradient_length = 150.0f * UI_SCALE_FAC;
142 float line_dir[2];
143 float gradient_dir[2];
144 float gradient_point[2][2];
145
146 const float line_start[2] = {float(rect->xmin), float(rect->ymin)};
147 const float line_end[2] = {float(rect->xmax), float(rect->ymax)};
148 const float color_line_gradient_start[4] = {0.2f, 0.2f, 0.2f, 0.4f};
149 const float color_line_gradient_end[4] = {0.0f, 0.0f, 0.0f, 0.0f};
150
151 sub_v2_v2v2(line_dir, line_end, line_start);
152 normalize_v2(line_dir);
153 ortho_v2_v2(gradient_dir, line_dir);
154 if (!flip) {
155 mul_v2_fl(gradient_dir, -1.0f);
156 }
157 mul_v2_fl(gradient_dir, gradient_length);
158 add_v2_v2v2(gradient_point[0], line_start, gradient_dir);
159 add_v2_v2v2(gradient_point[1], line_end, gradient_dir);
160
162 immAttr4f(shdr_col, UNPACK4(color_line_gradient_start));
163 immVertex2f(shdr_pos, line_start[0], line_start[1]);
164 immAttr4f(shdr_col, UNPACK4(color_line_gradient_start));
165 immVertex2f(shdr_pos, line_end[0], line_end[1]);
166 immAttr4f(shdr_col, UNPACK4(color_line_gradient_end));
167 immVertex2f(shdr_pos, gradient_point[1][0], gradient_point[1][1]);
168
169 immAttr4f(shdr_col, UNPACK4(color_line_gradient_start));
170 immVertex2f(shdr_pos, line_start[0], line_start[1]);
171 immAttr4f(shdr_col, UNPACK4(color_line_gradient_end));
172 immVertex2f(shdr_pos, gradient_point[1][0], gradient_point[1][1]);
173 immAttr4f(shdr_col, UNPACK4(color_line_gradient_end));
174 immVertex2f(shdr_pos, gradient_point[0][0], gradient_point[0][1]);
175 immEnd();
176
179}
180
182{
183 const rcti *rect = (rcti *)gt->customdata;
184
185 if (gt->draw_active_side) {
187 }
188
189 uint shdr_pos = GPU_vertformat_attr_add(
190 immVertexFormat(), "pos", blender::gpu::VertAttrType::SFLOAT_32_32);
191
193
194 float viewport_size[4];
195 GPU_viewport_size_get_f(viewport_size);
196 immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
197
198 immUniform1i("colors_len", 2); /* "advanced" mode. */
199 immUniform4f("color", 0.4f, 0.4f, 0.4f, 1.0f);
200 immUniform4f("color2", 1.0f, 1.0f, 1.0f, 1.0f);
201 immUniform1f("dash_width", 8.0f);
202 immUniform1f("udash_factor", 0.5f);
203
204 float xmin = float(rect->xmin);
205 float ymin = float(rect->ymin);
206
208 immVertex2f(shdr_pos, xmin, ymin);
209 immVertex2f(shdr_pos, float(rect->xmax), float(rect->ymax));
210 immEnd();
211
213}
214
216{
217 const rcti *rect = static_cast<const rcti *>(gt->customdata);
218
219 uint shdr_pos = GPU_vertformat_attr_add(
220 immVertexFormat(), "pos", blender::gpu::VertAttrType::SFLOAT_32_32);
221
223
225 immUniformColor4f(1.0f, 1.0f, 1.0f, 0.05f);
226
227 immRectf(shdr_pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
228
230
232
233 shdr_pos = GPU_vertformat_attr_add(
234 immVertexFormat(), "pos", blender::gpu::VertAttrType::SFLOAT_32_32);
235
237
238 float viewport_size[4];
239 GPU_viewport_size_get_f(viewport_size);
240 immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
241
242 immUniform1i("colors_len", 2); /* "advanced" mode. */
243 immUniform4f("color", 0.4f, 0.4f, 0.4f, 1.0f);
244 immUniform4f("color2", 1.0f, 1.0f, 1.0f, 1.0f);
245 immUniform1f("dash_width", 8.0f);
246 immUniform1f("udash_factor", 0.5f);
247
249 shdr_pos, float(rect->xmin), float(rect->ymin), float(rect->xmax), float(rect->ymax));
250
252
253 /* Draws a diagonal line in the lined box to test #wm_gesture_draw_line. */
254 // wm_gesture_draw_line(gt);
255}
256
258{
259 const rcti *rect = static_cast<const rcti *>(gt->customdata);
260
262
263 const uint shdr_pos = GPU_vertformat_attr_add(
264 immVertexFormat(), "pos", blender::gpu::VertAttrType::SFLOAT_32_32);
265
267
268 immUniformColor4f(1.0f, 1.0f, 1.0f, 0.05f);
269 imm_draw_circle_fill_2d(shdr_pos, float(rect->xmin), float(rect->ymin), float(rect->xmax), 40);
270
272
274
276
277 float viewport_size[4];
278 GPU_viewport_size_get_f(viewport_size);
279 immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
280
281 immUniform1i("colors_len", 2); /* "advanced" mode. */
282 immUniform4f("color", 0.4f, 0.4f, 0.4f, 1.0f);
283 immUniform4f("color2", 1.0f, 1.0f, 1.0f, 1.0f);
284 immUniform1f("dash_width", 4.0f);
285 immUniform1f("udash_factor", 0.5f);
286
287 imm_draw_circle_wire_2d(shdr_pos, float(rect->xmin), float(rect->ymin), float(rect->xmax), 40);
288
290}
291
294 int width;
295};
296
297static void draw_filled_lasso_px_cb(int x, int x_end, int y, void *user_data)
298{
299 LassoFillData *data = static_cast<LassoFillData *>(user_data);
300 uchar *col = &(data->px[(y * data->width) + x]);
301 memset(col, 0x10, x_end - x);
302}
303
304static void draw_filled_lasso(wmGesture *gt, const blender::int2 *lasso_pt_extra)
305{
306 const int mcoords_len = gt->points + (lasso_pt_extra ? 1 : 0);
307 Array<int2> mcoords(mcoords_len);
308 int i;
309 rcti rect;
310 const float red[4] = {1.0f, 0.0f, 0.0f, 0.0f};
311
312 if (gt->type == WM_GESTURE_POLYLINE) {
313 const short *lasso = static_cast<const short *>(gt->customdata);
314 for (i = 0; i < mcoords_len; i++, lasso += 2) {
315 mcoords[i][0] = lasso[0];
316 mcoords[i][1] = lasso[1];
317 }
318 }
319 else {
320 const float *lasso = static_cast<const float *>(gt->customdata);
321 for (i = 0; i < mcoords_len; i++, lasso += 2) {
322 mcoords[i][0] = lasso[0];
323 mcoords[i][1] = lasso[1];
324 }
325 }
326
327 if (lasso_pt_extra) {
328 mcoords[mcoords_len - 1][0] = lasso_pt_extra->x;
329 mcoords[mcoords_len - 1][1] = lasso_pt_extra->y;
330 }
331
332 BLI_lasso_boundbox(&rect, mcoords);
333
334 BLI_rcti_translate(&rect, gt->winrct.xmin, gt->winrct.ymin);
335 BLI_rcti_isect(&gt->winrct, &rect, &rect);
336 BLI_rcti_translate(&rect, -gt->winrct.xmin, -gt->winrct.ymin);
337
338 /* Highly unlikely this will fail, but could crash if (mcoords_len == 0). */
339 if (BLI_rcti_is_empty(&rect) == false) {
340 const int w = BLI_rcti_size_x(&rect);
341 const int h = BLI_rcti_size_y(&rect);
342 uchar *pixel_buf = MEM_calloc_arrayN<uchar>(size_t(w) * size_t(h), __func__);
343 LassoFillData lasso_fill_data = {pixel_buf, w};
344
346 rect.ymin,
347 rect.xmax,
348 rect.ymax,
349 mcoords,
351 &lasso_fill_data);
352
354
356 GPU_shader_bind(state.shader);
358 state.shader, GPU_shader_get_uniform(state.shader, "shuffle"), 4, 1, red);
359
361 rect.xmin,
362 rect.ymin,
363 w,
364 h,
365 blender::gpu::TextureFormat::UNORM_8,
366 false,
367 pixel_buf,
368 1.0f,
369 1.0f,
370 nullptr);
371
373
374 MEM_freeN(pixel_buf);
375
377 }
378}
379
380/* TODO: Extract this common functionality so it can be shared between Sculpt brushes, the annotate
381 * tool, and this common logic. */
382static void draw_lasso_smooth_stroke_indicator(wmGesture *gt, const uint shdr_pos)
383{
384 float (*lasso)[2] = static_cast<float (*)[2]>(gt->customdata);
385 float last_x = lasso[gt->points - 1][0];
386 float last_y = lasso[gt->points - 1][1];
387
389 GPU_line_smooth(true);
391
392 GPU_line_width(1.25f);
393 const float color[3] = {1.0f, 0.39f, 0.39f};
394
395 const float radius = 4.0f;
396
397 /* Draw Inner Ring */
398 immUniformColor4f(color[0], color[1], color[2], 0.8f);
399 imm_draw_circle_wire_2d(shdr_pos, gt->mval.x, gt->mval.y, radius, 40);
400
401 /* Draw Outer Ring: Dark color for contrast on light backgrounds (e.g. gray on white) */
402 float darkcolor[3];
403 mul_v3_v3fl(darkcolor, color, 0.40f);
404 immUniformColor4f(darkcolor[0], darkcolor[1], darkcolor[2], 0.8f);
405 imm_draw_circle_wire_2d(shdr_pos, gt->mval.x, gt->mval.y, radius + 1, 40);
406
407 /* Draw line from the last saved position to the current mouse position. */
408 immUniformColor4f(color[0], color[1], color[2], 0.8f);
410 immVertex2f(shdr_pos, gt->mval.x, gt->mval.y);
411 immVertex2f(shdr_pos, last_x, last_y);
412 immEnd();
413
415 GPU_line_smooth(false);
417}
418
419static void wm_gesture_draw_lasso(wmGesture *gt, bool filled)
420{
421 const float *lasso = (float *)gt->customdata;
422 int i;
423
424 if (filled) {
425 draw_filled_lasso(gt, nullptr);
426 }
427
428 const int numverts = gt->points;
429
430 /* Nothing to draw, do early output. */
431 if (numverts < 2) {
432 return;
433 }
434
435 const uint shdr_pos = GPU_vertformat_attr_add(
436 immVertexFormat(), "pos", blender::gpu::VertAttrType::SFLOAT_32_32);
437
439
440 float viewport_size[4];
441 GPU_viewport_size_get_f(viewport_size);
442 immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
443
444 immUniform1i("colors_len", 2); /* "advanced" mode. */
445 immUniform4f("color", 0.4f, 0.4f, 0.4f, 1.0f);
446 immUniform4f("color2", 1.0f, 1.0f, 1.0f, 1.0f);
447 immUniform1f("dash_width", 2.0f);
448 immUniform1f("udash_factor", 0.5f);
449
451
452 for (i = 0; i < gt->points; i++, lasso += 2) {
453 immVertex2f(shdr_pos, lasso[0], lasso[1]);
454 }
455
456 immEnd();
458
459 if (gt->use_smooth) {
461 }
462}
463
464static void draw_start_vertex_circle(const wmGesture &gt, const uint shdr_pos)
465{
466 const int numverts = gt.points;
467
468 /* Draw the circle around the starting vertex. */
469 const short (*border)[2] = static_cast<short int (*)[2]>(gt.customdata);
470
471 const float start_pos[2] = {float(border[0][0]), float(border[0][1])};
472 const float current_pos[2] = {float(gt.mval.x), float(gt.mval.y)};
473
474 const float dist = len_v2v2(start_pos, current_pos);
476
477 if (dist < limit && numverts > 2) {
478 const float u = smoothstep(0.0f, limit, dist);
479 const float radius = interpf(
481
483
484 const blender::float3 color = {1.0f, 1.0f, 1.0f};
485 immUniformColor4f(color.x, color.y, color.z, 0.8f);
486 imm_draw_circle_wire_2d(shdr_pos, start_pos[0], start_pos[1], radius, 15.0f);
487
488 const blender::float3 darker_color = color * 0.4f;
489 immUniformColor4f(darker_color.x, darker_color.y, darker_color.z, 0.8f);
490 imm_draw_circle_wire_2d(shdr_pos, start_pos[0], start_pos[1], radius + 1, 15.0f);
491
493 }
494}
495
497{
498 draw_filled_lasso(gt, &gt->mval);
499
500 const int numverts = gt->points + 1;
501 if (numverts < 2) {
502 return;
503 }
504
505 const uint shdr_pos = GPU_vertformat_attr_add(
506 immVertexFormat(), "pos", blender::gpu::VertAttrType::SFLOAT_32_32);
507
509
510 float viewport_size[4];
511 GPU_viewport_size_get_f(viewport_size);
512 immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
513
514 immUniform1i("colors_len", 2); /* "advanced" mode */
515 immUniform4f("color", 0.4f, 0.4f, 0.4f, 1.0f);
516 immUniform4f("color2", 1.0f, 1.0f, 1.0f, 1.0f);
517 immUniform1f("dash_width", 2.0f);
518 immUniform1f("udash_factor", 0.5f);
519
520 immBegin(GPU_PRIM_LINE_LOOP, numverts);
521
522 const short *border = (short *)gt->customdata;
523 for (int i = 0; i < gt->points; i++, border += 2) {
524 immVertex2f(shdr_pos, float(border[0]), float(border[1]));
525 }
526 immVertex2f(shdr_pos, float(gt->mval.x), float(gt->mval.y));
527
528 immEnd();
529
531
532 draw_start_vertex_circle(*gt, shdr_pos);
533}
534
535static void wm_gesture_draw_cross(const wmWindow *win, const wmGesture *gt)
536{
537 const rcti *rect = static_cast<const rcti *>(gt->customdata);
538 const blender::int2 win_size = WM_window_native_pixel_size(win);
539
540 float x1, x2, y1, y2;
541
542 const uint shdr_pos = GPU_vertformat_attr_add(
543 immVertexFormat(), "pos", blender::gpu::VertAttrType::SFLOAT_32_32);
544
546
547 float viewport_size[4];
548 GPU_viewport_size_get_f(viewport_size);
549 immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
550
551 immUniform1i("colors_len", 2); /* "advanced" mode. */
552 immUniform4f("color", 0.4f, 0.4f, 0.4f, 1.0f);
553 immUniform4f("color2", 1.0f, 1.0f, 1.0f, 1.0f);
554 immUniform1f("dash_width", 8.0f);
555 immUniform1f("udash_factor", 0.5f);
556
558
559 x1 = float(rect->xmin - win_size[0]);
560 y1 = float(rect->ymin);
561 x2 = float(rect->xmin + win_size[0]);
562 y2 = y1;
563
564 immVertex2f(shdr_pos, x1, y1);
565 immVertex2f(shdr_pos, x2, y2);
566
567 x1 = float(rect->xmin);
568 y1 = float(rect->ymin - win_size[1]);
569 x2 = x1;
570 y2 = float(rect->ymin + win_size[1]);
571
572 immVertex2f(shdr_pos, x1, y1);
573 immVertex2f(shdr_pos, x2, y2);
574
575 immEnd();
576
578}
579
581{
582 wmGesture *gt = (wmGesture *)win->gesture.first;
583
584 GPU_line_width(1.0f);
585 for (; gt; gt = gt->next) {
586 /* All in sub-window space. */
587 wmViewport(&gt->winrct);
588
589 if (gt->type == WM_GESTURE_RECT) {
591 }
592 else if (gt->type == WM_GESTURE_CIRCLE) {
594 }
595 else if (gt->type == WM_GESTURE_CROSS_RECT) {
596 if (gt->is_active) {
598 }
599 else {
600 wm_gesture_draw_cross(win, gt);
601 }
602 }
603 else if (gt->type == WM_GESTURE_LINES) {
604 wm_gesture_draw_lasso(gt, false);
605 }
606 else if (gt->type == WM_GESTURE_LASSO) {
607 wm_gesture_draw_lasso(gt, true);
608 }
609 else if (gt->type == WM_GESTURE_STRAIGHTLINE) {
611 }
612 else if (gt->type == WM_GESTURE_POLYLINE) {
614 }
615 }
616}
617
619{
621
622 if (screen) {
623 screen->do_draw_gesture = true;
624 }
625}
void immDrawPixelsTexTiled(IMMDrawPixelsTexState *state, float x, float y, int img_w, int img_h, blender::gpu::TextureFormat gpu_format, bool use_filter, const void *rect, float xzoom, float yzoom, const float color[4])
Definition glutil.cc:342
IMMDrawPixelsTexState immDrawPixelsTexSetup(int builtin)
Definition glutil.cc:37
void BLI_bitmap_draw_2d_poly_v2i_n(int xmin, int ymin, int xmax, int ymax, blender::Span< blender::int2 > verts, void(*callback)(int x, int x_end, int y, void *), void *user_data)
void BLI_lasso_boundbox(rcti *rect, blender::Span< blender::int2 > mcoords)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:111
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:131
MINLINE float pow2f(float x)
MINLINE float interpf(float target, float origin, float t)
MINLINE float len_v2v2(const float v1[2], const float v2[2]) ATTR_WARN_UNUSED_RESULT
MINLINE void mul_v2_fl(float r[2], float f)
MINLINE void add_v2_v2v2(float r[2], const float a[2], const float b[2])
void ortho_v2_v2(float out[2], const float v[2])
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2])
MINLINE float normalize_v2(float n[2])
MINLINE void mul_v3_v3fl(float r[3], const float a[3], float f)
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
Definition BLI_rect.h:198
void BLI_rcti_translate(struct rcti *rect, int x, int y)
Definition rct.cc:566
bool BLI_rcti_isect(const struct rcti *src1, const struct rcti *src2, struct rcti *dest)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
Definition BLI_rect.h:194
bool BLI_rcti_is_empty(const struct rcti *rect)
unsigned char uchar
unsigned int uint
#define UNPACK4(a)
#define ELEM(...)
#define UI_SCALE_FAC
void immUniform4f(const char *name, float x, float y, float z, float w)
void immEnd()
void immUnbindProgram()
void immBindBuiltinProgram(GPUBuiltinShader shader_id)
void immUniform2f(const char *name, float x, float y)
void immUniformColor4f(float r, float g, float b, float a)
void immVertex2f(uint attr_id, float x, float y)
void immUniform1i(const char *name, int x)
void immUniform1f(const char *name, float x)
GPUVertFormat * immVertexFormat()
void immAttr4f(uint attr_id, float x, float y, float z, float w)
void immBegin(GPUPrimType, uint vertex_len)
void imm_draw_box_wire_2d(uint pos, float x1, float y1, float x2, float y2)
void imm_draw_circle_fill_2d(uint shdr_pos, float x, float y, float radius, int nsegments)
void immRectf(uint pos, float x1, float y1, float x2, float y2)
void imm_draw_circle_wire_2d(uint shdr_pos, float x, float y, float radius, int nsegments)
@ GPU_PRIM_LINE_LOOP
@ GPU_PRIM_LINES
@ GPU_PRIM_LINE_STRIP
@ GPU_PRIM_TRIS
void GPU_shader_bind(blender::gpu::Shader *shader, const blender::gpu::shader::SpecializationConstants *constants_state=nullptr)
int GPU_shader_get_uniform(blender::gpu::Shader *shader, const char *name)
void GPU_shader_unbind()
void GPU_shader_uniform_float_ex(blender::gpu::Shader *shader, int location, int length, int array_size, const float *value)
@ GPU_SHADER_3D_SMOOTH_COLOR
@ GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR
@ GPU_SHADER_3D_UNIFORM_COLOR
@ GPU_SHADER_2D_IMAGE_SHUFFLE_COLOR
void GPU_line_width(float width)
Definition gpu_state.cc:166
void GPU_line_smooth(bool enable)
Definition gpu_state.cc:78
@ GPU_BLEND_ADDITIVE_PREMULT
Definition GPU_state.hh:90
@ GPU_BLEND_NONE
Definition GPU_state.hh:85
@ GPU_BLEND_ALPHA
Definition GPU_state.hh:87
void GPU_blend(GPUBlend blend)
Definition gpu_state.cc:42
void GPU_viewport_size_get_f(float coords[4])
Definition gpu_state.cc:273
uint GPU_vertformat_attr_add(GPUVertFormat *format, blender::StringRef name, blender::gpu::VertAttrType type)
Read Guarded memory(de)allocation.
#define WM_GESTURE_RECT
Definition WM_types.hh:602
#define WM_GESTURE_STRAIGHTLINE
Definition WM_types.hh:606
#define WM_GESTURE_LINES
Definition WM_types.hh:601
#define WM_GESTURE_LASSO
Definition WM_types.hh:604
#define WM_GESTURE_CIRCLE
Definition WM_types.hh:605
#define WM_GESTURE_CROSS_RECT
Definition WM_types.hh:603
#define WM_GESTURE_POLYLINE
Definition WM_types.hh:607
BMesh const char void * data
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition btQuadWord.h:119
nullptr float
uint col
format
void * MEM_calloc_arrayN(size_t len, size_t size, const char *str)
Definition mallocn.cc:123
void * MEM_callocN(size_t len, const char *str)
Definition mallocn.cc:118
void * MEM_malloc_arrayN(size_t len, size_t size, const char *str)
Definition mallocn.cc:133
void MEM_freeN(void *vmemh)
Definition mallocn.cc:113
MINLINE float smoothstep(float edge0, float edge1, float x)
static ulong state[N]
constexpr float POLYLINE_CLICK_RADIUS
Definition WM_types.hh:597
VecBase< int32_t, 2 > int2
VecBase< float, 3 > float3
void * first
char do_draw_gesture
int ymin
int ymax
int xmin
int xmax
int event_type
Definition WM_types.hh:615
uint is_active_prev
Definition WM_types.hh:641
int modal_state
Definition WM_types.hh:628
void * customdata
Definition WM_types.hh:663
int points_alloc
Definition WM_types.hh:627
wmGenericUserData user_data
Definition WM_types.hh:666
uint move
Definition WM_types.hh:645
bool draw_active_side
Definition WM_types.hh:630
uint use_flip
Definition WM_types.hh:651
uint is_active
Definition WM_types.hh:639
short event_keymodifier
Definition WM_types.hh:619
uint8_t event_modifier
Definition WM_types.hh:617
wmGesture * next
Definition WM_types.hh:613
rcti winrct
Definition WM_types.hh:623
uint use_smooth
Definition WM_types.hh:654
blender::int2 mval
Definition WM_types.hh:632
i
Definition text_draw.cc:230
int xy[2]
Definition wm_draw.cc:178
void WM_event_drag_start_xy(const wmEvent *event, int r_xy[2])
@ GESTURE_MODAL_NOP
static void wm_gesture_draw_circle(wmGesture *gt)
static void draw_start_vertex_circle(const wmGesture &gt, const uint shdr_pos)
static void wm_gesture_draw_polyline(wmGesture *gt)
static void draw_filled_lasso_px_cb(int x, int x_end, int y, void *user_data)
static void wm_gesture_draw_cross(const wmWindow *win, const wmGesture *gt)
wmGesture * WM_gesture_new(wmWindow *window, const ARegion *region, const wmEvent *event, int type)
Definition wm_gesture.cc:39
void wm_gesture_draw(wmWindow *win)
static void wm_gesture_draw_rect(wmGesture *gt)
void wm_gesture_tag_redraw(wmWindow *win)
static void wm_gesture_draw_lasso(wmGesture *gt, bool filled)
static void draw_lasso_smooth_stroke_indicator(wmGesture *gt, const uint shdr_pos)
static void wm_gesture_draw_line(wmGesture *gt)
static void draw_filled_lasso(wmGesture *gt, const blender::int2 *lasso_pt_extra)
bool WM_gesture_is_modal_first(const wmGesture *gesture)
void WM_gestures_free_all(wmWindow *win)
void WM_gesture_end(wmWindow *win, wmGesture *gesture)
Definition wm_gesture.cc:99
void WM_gestures_remove(wmWindow *win)
static void wm_gesture_draw_line_active_side(const rcti *rect, const bool flip)
void wmViewport(const rcti *winrct)
void WM_generic_user_data_free(wmGenericUserData *wm_userdata)
Definition wm_utils.cc:45
blender::int2 WM_window_native_pixel_size(const wmWindow *win)
bScreen * WM_window_get_active_screen(const wmWindow *win)