47 gesture->
winrct = region->winrct;
50 gesture->
move =
false;
77 gesture->
customdata = lasso =
static_cast<float *
>(
85 short *border =
static_cast<short int *
>(
90 gesture->
mval.x = border[0];
91 gesture->
mval.y = border[1];
122 if (gesture ==
nullptr) {
139 const float gradient_length = 150.0f *
U.pixelsize;
141 float gradient_dir[2];
142 float gradient_point[2][2];
146 const float color_line_gradient_start[4] = {0.2f, 0.2f, 0.2f, 0.4f};
147 const float color_line_gradient_end[4] = {0.0f, 0.0f, 0.0f, 0.0f};
155 mul_v2_fl(gradient_dir, gradient_length);
156 add_v2_v2v2(gradient_point[0], line_start, gradient_dir);
157 add_v2_v2v2(gradient_point[1], line_end, gradient_dir);
161 immVertex2f(shdr_pos, line_start[0], line_start[1]);
165 immVertex2f(shdr_pos, gradient_point[1][0], gradient_point[1][1]);
168 immVertex2f(shdr_pos, line_start[0], line_start[1]);
170 immVertex2f(shdr_pos, gradient_point[1][0], gradient_point[1][1]);
172 immVertex2f(shdr_pos, gradient_point[0][0], gradient_point[0][1]);
192 float viewport_size[4];
194 immUniform2f(
"viewport_size", viewport_size[2], viewport_size[3]);
235 float viewport_size[4];
237 immUniform2f(
"viewport_size", viewport_size[2], viewport_size[3]);
246 shdr_pos,
float(rect->
xmin),
float(rect->
ymin),
float(rect->
xmax),
float(rect->
ymax));
274 float viewport_size[4];
276 immUniform2f(
"viewport_size", viewport_size[2], viewport_size[3]);
297 uchar *
col = &(data->px[(y * data->width) + x]);
298 memset(
col, 0x10, x_end - x);
304 const int mcoords_len = gt->
points;
308 const float red[4] = {1.0f, 0.0f, 0.0f, 0.0f};
310 for (i = 0; i < mcoords_len; i++, lasso += 2) {
311 mcoords[i][0] = lasso[0];
312 mcoords[i][1] = lasso[1];
344 &
state, rect.
xmin, rect.
ymin,
w, h,
GPU_R8,
false, pixel_buf, 1.0f, 1.0f,
nullptr);
359 float last_x = lasso[gt->
points - 1][0];
360 float last_y = lasso[gt->
points - 1][1];
367 const float color[3] = {1.0f, 0.39f, 0.39f};
369 const float radius = 4.0f;
402 const int numverts = gt->
points;
414 float viewport_size[4];
416 immUniform2f(
"viewport_size", viewport_size[2], viewport_size[3]);
426 for (i = 0; i < gt->
points; i++, lasso += 2) {
440 const int numverts = gt.
points;
443 const short(*border)[2] =
static_cast<short int(*)[2]
>(gt.
customdata);
445 const float start_pos[2] = {
float(border[0][0]),
float(border[0][1])};
448 const float dist =
len_v2v2(start_pos, current_pos);
451 if (dist < limit && numverts > 2) {
452 const float u =
smoothstep(0.0f, limit, dist);
474 const int numverts = gt->
points + 1;
484 float viewport_size[4];
486 immUniform2f(
"viewport_size", viewport_size[2], viewport_size[3]);
496 const short *border = (
short *)gt->
customdata;
497 for (
int i = 0; i < gt->
points; i++, border += 2) {
498 immVertex2f(shdr_pos,
float(border[0]),
float(border[1]));
514 float x1, x2, y1, y2;
521 float viewport_size[4];
523 immUniform2f(
"viewport_size", viewport_size[2], viewport_size[3]);
559 for (; gt; gt = gt->
next) {
597 screen->do_draw_gesture =
true;
void immDrawPixelsTexTiled(IMMDrawPixelsTexState *state, float x, float y, int img_w, int img_h, eGPUTextureFormat gpu_format, bool use_filter, const void *rect, float xzoom, float yzoom, const float color[4])
IMMDrawPixelsTexState immDrawPixelsTexSetup(int builtin)
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(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
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)
void BLI_rcti_translate(struct rcti *rect, int x, int y)
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)
bool BLI_rcti_is_empty(const struct rcti *rect)
int GPU_shader_get_uniform(GPUShader *shader, const char *name)
void GPU_shader_uniform_float_ex(GPUShader *shader, int location, int length, int array_size, const float *value)
void GPU_shader_bind(GPUShader *shader)
@ GPU_SHADER_3D_SMOOTH_COLOR
@ GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR
@ GPU_SHADER_3D_UNIFORM_COLOR
@ GPU_SHADER_2D_IMAGE_SHUFFLE_COLOR
@ GPU_BLEND_ADDITIVE_PREMULT
void GPU_blend(eGPUBlend blend)
void GPU_line_width(float width)
void GPU_line_smooth(bool enable)
void GPU_viewport_size_get_f(float coords[4])
Read Guarded memory(de)allocation.
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Brightness Control the brightness and contrast of the input color Vector Map input vector components with curves Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert Invert a producing a negative Combine Generate a color from its red
#define WM_GESTURE_STRAIGHTLINE
#define WM_GESTURE_CIRCLE
#define WM_GESTURE_CROSS_RECT
#define WM_GESTURE_POLYLINE
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
draw_view in_light_buf[] float
void *(* MEM_mallocN)(size_t len, const char *str)
void MEM_freeN(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
MINLINE float smoothstep(float edge0, float edge1, float x)
constexpr float POLYLINE_CLICK_RADIUS
wmGenericUserData user_data
void WM_event_drag_start_xy(const wmEvent *event, int r_xy[2])
static void wm_gesture_draw_circle(wmGesture *gt)
static void draw_start_vertex_circle(const wmGesture >, 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)
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)
bool WM_gesture_is_modal_first(const wmGesture *gesture)
void WM_gestures_free_all(wmWindow *win)
static void draw_filled_lasso(wmGesture *gt)
void WM_gesture_end(wmWindow *win, wmGesture *gesture)
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)
blender::int2 WM_window_native_pixel_size(const wmWindow *win)
bScreen * WM_window_get_active_screen(const wmWindow *win)