52 gesture->
move =
false;
91 gesture->
mval.x = border[0];
92 gesture->
mval.y = border[1];
123 if (gesture ==
nullptr) {
136 format,
"color", blender::gpu::VertAttrType::SFLOAT_32_32_32_32);
143 float gradient_dir[2];
144 float gradient_point[2][2];
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};
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);
163 immVertex2f(shdr_pos, line_start[0], line_start[1]);
167 immVertex2f(shdr_pos, gradient_point[1][0], gradient_point[1][1]);
170 immVertex2f(shdr_pos, line_start[0], line_start[1]);
172 immVertex2f(shdr_pos, gradient_point[1][0], gradient_point[1][1]);
174 immVertex2f(shdr_pos, gradient_point[0][0], gradient_point[0][1]);
194 float viewport_size[4];
196 immUniform2f(
"viewport_size", viewport_size[2], viewport_size[3]);
238 float viewport_size[4];
240 immUniform2f(
"viewport_size", viewport_size[2], viewport_size[3]);
249 shdr_pos,
float(rect->
xmin),
float(rect->
ymin),
float(rect->
xmax),
float(rect->
ymax));
277 float viewport_size[4];
279 immUniform2f(
"viewport_size", viewport_size[2], viewport_size[3]);
301 memset(
col, 0x10, x_end -
x);
306 const int mcoords_len = gt->
points + (lasso_pt_extra ? 1 : 0);
310 const float red[4] = {1.0f, 0.0f, 0.0f, 0.0f};
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];
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];
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;
365 blender::gpu::TextureFormat::UNORM_8,
385 float last_x = lasso[gt->
points - 1][0];
386 float last_y = lasso[gt->
points - 1][1];
393 const float color[3] = {1.0f, 0.39f, 0.39f};
395 const float radius = 4.0f;
428 const int numverts = gt->
points;
440 float viewport_size[4];
442 immUniform2f(
"viewport_size", viewport_size[2], viewport_size[3]);
452 for (
i = 0;
i < gt->
points;
i++, lasso += 2) {
466 const int numverts = gt.
points;
469 const short (*border)[2] =
static_cast<short int (*)[2]
>(gt.
customdata);
471 const float start_pos[2] = {
float(border[0][0]),
float(border[0][1])};
474 const float dist =
len_v2v2(start_pos, current_pos);
477 if (dist < limit && numverts > 2) {
478 const float u =
smoothstep(0.0f, limit, dist);
500 const int numverts = gt->
points + 1;
510 float viewport_size[4];
512 immUniform2f(
"viewport_size", viewport_size[2], viewport_size[3]);
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]));
540 float x1, x2, y1, y2;
547 float viewport_size[4];
549 immUniform2f(
"viewport_size", viewport_size[2], viewport_size[3]);
585 for (; gt; gt = gt->
next) {
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])
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(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_remlink(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)
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_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)
void GPU_line_smooth(bool enable)
@ GPU_BLEND_ADDITIVE_PREMULT
void GPU_blend(GPUBlend blend)
void GPU_viewport_size_get_f(float coords[4])
Read Guarded memory(de)allocation.
#define WM_GESTURE_STRAIGHTLINE
#define WM_GESTURE_CIRCLE
#define WM_GESTURE_CROSS_RECT
#define WM_GESTURE_POLYLINE
BMesh const char void * data
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
void * MEM_calloc_arrayN(size_t len, size_t size, const char *str)
void * MEM_callocN(size_t len, const char *str)
void * MEM_malloc_arrayN(size_t len, size_t size, const char *str)
void MEM_freeN(void *vmemh)
MINLINE float smoothstep(float edge0, float edge1, float x)
constexpr float POLYLINE_CLICK_RADIUS
VecBase< int32_t, 2 > int2
VecBase< float, 3 > float3
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)
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)
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)