80 bool use_software_cursor_dummy =
false;
85 &use_software_cursor_dummy);
108 if (wm->
runtime->is_interface_locked) {
112 if (!region->visible || region != screen->active_region) {
117 if ((pc->space_type !=
SPACE_TYPE_ANY) && (area->spacetype != pc->space_type)) {
125 if (pc->poll ==
nullptr || pc->poll(C)) {
149 pc->draw(C,
xy[0],
xy[1], pc->customdata);
197 bool use_software_cursor;
202 &use_software_cursor);
203 if (use_software_cursor) {
244 float gl_matrix[4][4];
253 const int scale =
int(
U.pixelsize);
257 gl_matrix[3][0] = event_xy[0] - (bitmap->
hot_spot[0] * scale);
258 gl_matrix[3][1] = event_xy[1] - ((bitmap->
data_size[1] - bitmap->
hot_spot[1]) * scale);
260 gl_matrix[0][0] = bitmap->
data_size[0] * scale;
261 gl_matrix[1][1] = bitmap->
data_size[1] * scale;
312 const int ofs_line = (8 * unit);
313 const int ofs_size = (2 * unit);
315 event_xy[0] - ofs_line,
316 event_xy[1] - ofs_size,
317 event_xy[0] + ofs_line,
318 event_xy[1] + ofs_size);
320 event_xy[0] - ofs_size,
321 event_xy[1] - ofs_line,
322 event_xy[0] + ofs_size,
323 event_xy[1] + ofs_line);
327 const int ofs_line = (7 * unit);
328 const int ofs_size = (1 * unit);
330 event_xy[0] - ofs_line,
331 event_xy[1] - ofs_size,
332 event_xy[0] + ofs_line,
333 event_xy[1] + ofs_size);
335 event_xy[0] - ofs_size,
336 event_xy[1] - ofs_line,
337 event_xy[0] + ofs_size,
338 event_xy[1] + ofs_line);
349 const int max = grab_state->
bounds[2];
356 const int min = height - grab_state->
bounds[1];
357 const int max = height - grab_state->
bounds[3];
359 event_xy[1] =
mod_i(event_xy[1] - max,
min - max) +
max;
386 region->type->draw_overlay(C, region);
407 switch (area->spacetype) {
418 View3D *v3d =
static_cast<View3D *
>(area->spacedata.first);
470 if (region->gizmo_map ==
nullptr) {
515 View3D *v3d =
static_cast<View3D *
>(area->spacedata.first);
526 engine->
flag &= ~RE_ENGINE_DO_DRAW;
540 if (ED_view3d_is_region_xr_mirror_active(
541 wm,
static_cast<const View3D *
>(area->spacedata.first), region))
563#define SPACE_NAME(space) \
567 switch (area->spacetype) {
588 return "Unknown Space";
608 void (*draw)(
const wmWindow *win,
void *customdata),
634 wdc->draw(win, wdc->customdata);
651 if (region->draw_buffer) {
652 if (region->draw_buffer->viewport) {
655 if (region->draw_buffer->offscreen) {
660 region->draw_buffer =
nullptr;
675 bool use_hdr =
false;
680 return desired_format;
692 if (region->draw_buffer) {
693 if (region->draw_buffer->stereo != stereo) {
699 GPUOffScreen *offscreen = region->draw_buffer->offscreen;
709 if (!region->draw_buffer) {
736 region->draw_buffer->
offscreen = offscreen;
739 region->draw_buffer->bound_view = -1;
740 region->draw_buffer->stereo = stereo;
746 if (!region->draw_buffer) {
750 if (region->draw_buffer->viewport) {
762 region->draw_buffer->bound_view =
view;
767 if (!region->draw_buffer) {
771 region->draw_buffer->bound_view = -1;
773 if (region->draw_buffer->viewport) {
784 if (!region->draw_buffer) {
793 if (region->draw_buffer->viewport ==
nullptr) {
799 if (region->draw_buffer->viewport) {
804 region->draw_buffer->offscreen, region->winrct.xmin, region->winrct.ymin);
810 if (!region->draw_buffer) {
814 GPUViewport *viewport = region->draw_buffer->viewport;
823 if (!region->draw_buffer) {
841 rcti rect_geo = region->winrct;
846 rect_tex.
xmin = halfx;
847 rect_tex.
ymin = halfy;
848 rect_tex.
xmax = 1.0f + halfx;
849 rect_tex.
ymax = 1.0f + halfy;
851 float alpha_easing = 1.0f - alpha;
852 alpha_easing = 1.0f - alpha_easing * alpha_easing;
855 float ofs_x =
BLI_rcti_size_x(®ion->winrct) * (1.0f - alpha_easing);
857 rect_geo.
xmin += ofs_x;
858 rect_tex.
xmax *= alpha_easing;
862 rect_geo.
xmax -= ofs_x;
863 rect_tex.
xmin += 1.0f - alpha_easing;
868 const float rectt[4] = {rect_tex.
xmin, rect_tex.
ymin, rect_tex.
xmax, rect_tex.
ymax};
869 const float rectg[4] = {
907 if (!region->draw_buffer) {
911 GPUViewport *viewport = region->draw_buffer->viewport;
917 if (!region->draw_buffer || region->draw_buffer->bound_view == -1) {
921 GPUViewport *viewport = region->draw_buffer->viewport;
948 if ((region->visible || ignore_visibility) && region->do_draw && region->type &&
949 region->type->layout)
964 area->flag &= ~AREA_FLAG_ACTIVE_TOOL_UPDATE;
969 if (!region->visible || !region->do_draw) {
982 for (
int view = 0; view < 2; view++) {
997 GPUViewport *viewport = region->draw_buffer->viewport;
1012 region->do_draw = 0;
1023 if (!region->visible) {
1030 if (region->type && region->type->layout) {
1034 region->type->layout(C, region);
1046 region->do_draw = 0;
1071 if (!region->visible) {
1075 if (region->overlap ==
false) {
1085 if (!region->visible) {
1088 const bool do_paint_cursor = (wm->
paintcursors.
first && region == screen->active_region);
1089 const bool do_draw_overlay = (region->type && region->type->draw_overlay);
1090 if (!(do_paint_cursor || do_draw_overlay)) {
1096 if (do_draw_overlay) {
1099 if (do_paint_cursor) {
1111 if (!region->visible) {
1114 if (region->overlap) {
1132 if (!region->visible) {
1212 for (
int view = 0; view < 2; view++) {
1240 screen->do_draw =
false;
1286 if (setup_context) {
1292 const uint rect_len = win_size[0] * win_size[1];
1297 if (setup_context) {
1308 for (i = 0, cp += 3; i < rect_len; i++, cp += 4) {
1312 r_size[0] = win_size[0];
1313 r_size[1] = win_size[1];
1325 if (setup_context) {
1332 if (setup_context) {
1367 const uint rect_len = win_size[0] * win_size[1];
1375 r_size[0] = win_size[0];
1376 r_size[1] = win_size[1];
1401 float rect_pixel[4];
1447 bool do_draw =
false;
1450 if (region->do_draw_paintcursor) {
1451 screen->do_draw_paintcursor =
true;
1452 region->do_draw_paintcursor =
false;
1454 if (region->visible && region->do_draw) {
1463#ifdef WITH_XR_OPENXR
1464 wm_region_test_xr_do_draw(wm, area, region);
1467 if (region->visible && region->do_draw) {
1477 if (screen->do_refresh) {
1480 if (screen->do_draw) {
1483 if (screen->do_draw_gesture) {
1486 if (screen->do_draw_paintcursor) {
1489 if (screen->do_draw_drag) {
1509#ifndef WITH_XR_OPENXR
1528 screen->do_draw_gesture =
false;
1529 screen->do_draw_paintcursor =
false;
1530 screen->do_draw_drag =
false;
1537 screen->do_draw_paintcursor =
true;
1553#ifdef WITH_METAL_BACKEND
1563 static_cast<GHOST_WindowHandle
>(win->
ghostwin));
1600 screen->do_draw =
true;
1618 region->do_draw = 0;
WorkSpace * CTX_wm_workspace(const bContext *C)
ScrArea * CTX_wm_area(const bContext *C)
wmWindow * CTX_wm_window(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
void CTX_wm_window_set(bContext *C, wmWindow *win)
Main * CTX_data_main(const bContext *C)
void CTX_wm_area_set(bContext *C, ScrArea *area)
void CTX_wm_region_set(bContext *C, ARegion *region)
ARegion * CTX_wm_region(const bContext *C)
wmWindowManager * CTX_wm_manager(const bContext *C)
void CTX_wm_region_popup_set(bContext *C, ARegion *region_popup)
ViewLayer * CTX_data_view_layer(const bContext *C)
Image * BKE_image_ensure_viewer(Main *bmain, int type, const char *name)
void BKE_image_free_unused_gpu_textures(void)
Depsgraph * BKE_scene_ensure_depsgraph(Main *bmain, Scene *scene, ViewLayer *view_layer)
#define LISTBASE_FOREACH(type, var, list)
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
MINLINE float max_ff(float a, float b)
MINLINE int mod_i(int i, int n)
void unit_m4(float m[4][4])
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void zero_v3(float r[3])
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
@ COLORMANAGE_VIEW_USE_HDR
These structs are the foundation for all linked lists in the library system.
Object is a sort of wrapper for general info.
#define RGN_ALIGN_ENUM_FROM_MASK(align)
@ AREA_FLAG_ACTIVE_TOOL_UPDATE
bool ED_node_is_compositor(const SpaceNode *snode)
float ED_region_blend_alpha(ARegion *region)
void ED_screen_ensure_updated(bContext *C, wmWindowManager *wm, wmWindow *win)
#define ED_screen_areas_iter(win, screen, area_name)
void ED_region_tag_redraw_no_rebuild(ARegion *region)
void ED_region_tag_redraw_partial(ARegion *region, const rcti *rct, bool rebuild)
void ED_screen_draw_edges(wmWindow *win)
void ED_region_do_layout(bContext *C, ARegion *region)
void ED_area_update_region_sizes(wmWindowManager *wm, wmWindow *win, ScrArea *area)
void ED_region_tag_redraw_editor_overlays(ARegion *region)
void ED_region_do_draw(bContext *C, ARegion *region)
bool ED_view3d_calc_render_border(const Scene *scene, Depsgraph *depsgraph, View3D *v3d, ARegion *region, rcti *r_rect)
GHOST C-API function and type declarations.
GHOST_TWindowState GHOST_GetWindowState(GHOST_WindowHandle windowhandle)
GHOST_TSuccess GHOST_GetPixelAtCursor(float r_color[3])
void GHOST_GetCursorGrabState(GHOST_WindowHandle windowhandle, GHOST_TGrabCursorMode *r_mode, GHOST_TAxisFlag *r_axis_flag, int r_bounds[4], bool *r_use_software_cursor)
GHOST_TSuccess GHOST_GetCursorBitmap(GHOST_WindowHandle windowhandle, GHOST_CursorBitmapRef *bitmap)
bool GHOST_GetCursorVisibility(GHOST_WindowHandle windowhandle)
GHOST_TSuccess GHOST_ActivateWindowDrawingContext(GHOST_WindowHandle windowhandle)
@ GHOST_kWindowStateMinimized
void GPU_batch_set_shader(blender::gpu::Batch *batch, GPUShader *shader)
void GPU_batch_draw(blender::gpu::Batch *batch)
blender::gpu::Batch * GPU_batch_preset_quad()
void GPU_context_main_lock()
void GPU_context_begin_frame(GPUContext *ctx)
void GPU_context_main_unlock()
void GPU_context_end_frame(GPUContext *ctx)
void GPU_context_active_set(GPUContext *)
void GPU_debug_group_end()
void GPU_debug_group_begin(const char *name)
void GPU_offscreen_draw_to_screen(GPUOffScreen *offscreen, int x, int y)
GPUOffScreen * GPU_offscreen_create(int width, int height, bool with_depth_buffer, eGPUTextureFormat format, eGPUTextureUsage usage, char err_out[256])
int GPU_offscreen_width(const GPUOffScreen *offscreen)
void GPU_offscreen_bind(GPUOffScreen *offscreen, bool save)
void GPU_frontbuffer_read_color(int x, int y, int width, int height, int channels, eGPUDataFormat data_format, void *r_data)
int GPU_offscreen_height(const GPUOffScreen *offscreen)
GPUTexture * GPU_offscreen_color_texture(const GPUOffScreen *offscreen)
void GPU_clear_color(float red, float green, float blue, float alpha)
void GPU_offscreen_read_color_region(GPUOffScreen *offscreen, eGPUDataFormat data_format, int x, int y, int w, int h, void *r_data)
void GPU_offscreen_free(GPUOffScreen *offscreen)
void GPU_backbuffer_bind(eGPUBackBuffer back_buffer_type)
eGPUTextureFormat GPU_offscreen_format(const GPUOffScreen *offscreen)
void GPU_offscreen_read_color(GPUOffScreen *offscreen, eGPUDataFormat data_format, void *r_data)
void GPU_offscreen_unbind(GPUOffScreen *offscreen, bool restore)
#define GPU_matrix_mul(x)
int GPU_shader_get_sampler_binding(GPUShader *shader, const char *name)
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)
int GPU_shader_get_builtin_uniform(GPUShader *shader, int builtin)
GPUShader * GPU_shader_get_builtin_shader(eGPUBuiltinShader shader)
@ GPU_SHADER_3D_UNIFORM_COLOR
@ GPU_SHADER_2D_IMAGE_RECT_COLOR
@ GPU_BLEND_ALPHA_PREMULT
void GPU_blend(eGPUBlend blend)
void GPU_scissor_test(bool enable)
void GPU_scissor(int x, int y, int width, int height)
void GPU_texture_bind(GPUTexture *texture, int unit)
GPUTexture * GPU_texture_create_2d(const char *name, int width, int height, int mip_len, eGPUTextureFormat format, eGPUTextureUsage usage, const float *data)
void GPU_texture_free(GPUTexture *texture)
void GPU_texture_unbind(GPUTexture *texture)
@ GPU_TEXTURE_USAGE_SHADER_READ
@ GPU_TEXTURE_USAGE_GENERAL
void GPU_texture_mipmap_mode(GPUTexture *texture, bool use_mipmap, bool use_filter)
void GPU_texture_filter_mode(GPUTexture *texture, bool use_filter)
void GPU_texture_update(GPUTexture *texture, eGPUDataFormat data_format, const void *data)
void GPU_viewport_bind(GPUViewport *viewport, int view, const rcti *rect)
GPUTexture * GPU_viewport_color_texture(GPUViewport *viewport, int view)
void GPU_viewport_draw_to_screen(GPUViewport *viewport, int view, const rcti *rect)
GPUViewport * GPU_viewport_create()
GPUViewport * GPU_viewport_stereo_create()
bool GPU_viewport_do_update(GPUViewport *viewport)
void GPU_viewport_free(GPUViewport *viewport)
void GPU_viewport_stereo_composite(GPUViewport *viewport, Stereo3dFormat *stereo_format)
void GPU_viewport_unbind(GPUViewport *viewport)
Read Guarded memory(de)allocation.
void UI_SetTheme(int spacetype, int regionid)
@ WM_CAPABILITY_CURSOR_WARP
@ WM_CAPABILITY_GPU_FRONT_BUFFER_READ
@ WM_GIZMOGROUPTYPE_VR_REDRAWS
struct GPUContext GPUContext
struct GPUShader GPUShader
static btDbvtVolume bounds(btDbvtNode **leaves, int count)
const Depsgraph * depsgraph
draw_view in_light_buf[] float
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
RAYTRACE_GROUP_SIZE additional_info("eevee_shared", "eevee_gbuffer_data", "eevee_global_ubo", "eevee_sampling_data", "eevee_utility_texture", "eevee_hiz_data", "draw_view") .specialization_constant(Type RAYTRACE_GROUP_SIZE in_sh_0_tx in_sh_2_tx screen_normal_tx GPU_RGBA8
blender::gpu::Batch * quad
RenderEngine * RE_view_engine_get(const ViewRender *view_render)
void *(* MEM_mallocN)(size_t len, const char *str)
void MEM_freeN(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
struct ListBase bg_images
GHOST_TAxisFlag wrap_axis
GHOST_TGrabCursorMode mode
struct ViewRender * view_render
void(* draw)(const wmWindow *win, void *customdata)
WindowManagerRuntimeHandle * runtime
struct wmWindow * windrawable
struct wmEvent * eventstate
struct Stereo3dFormat * stereo3d_format
void wm_drags_draw(bContext *C, wmWindow *win)
static void wm_draw_callbacks(wmWindow *win)
void WM_draw_region_viewport_unbind(ARegion *region)
static void wm_draw_offscreen_texture_parameters(GPUOffScreen *offscreen)
uint8_t * WM_window_pixels_read_from_frontbuffer(const wmWindowManager *wm, const wmWindow *win, int r_size[2])
static void wm_draw_region_unbind(ARegion *region)
static void wm_draw_region_bind(ARegion *region, int view)
static bool wm_software_cursor_needed_for_window(const wmWindow *win, GrabState *grab_state)
static const char * wm_area_name(ScrArea *area)
uint8_t * WM_window_pixels_read(bContext *C, wmWindow *win, int r_size[2])
static bool wm_region_use_viewport_by_type(short space_type, short region_type)
static void wm_draw_surface(bContext *C, wmSurface *surface)
void WM_window_pixels_read_sample_from_frontbuffer(const wmWindowManager *wm, const wmWindow *win, const int pos[2], float r_col[3])
static void wm_draw_window_offscreen(bContext *C, wmWindow *win, bool stereo)
void WM_draw_region_viewport_ensure(Scene *scene, ARegion *region, short space_type)
void WM_redraw_windows(bContext *C)
static void wm_draw_region_buffer_free(ARegion *region)
static void wm_draw_region_buffer_create(Scene *scene, ARegion *region, bool stereo, bool use_viewport)
GPUViewport * WM_draw_region_get_viewport(ARegion *region)
void * WM_draw_cb_activate(wmWindow *win, void(*draw)(const wmWindow *win, void *customdata), void *customdata)
static void wm_paintcursor_draw(bContext *C, ScrArea *area, ARegion *region)
void wm_draw_region_blend(ARegion *region, int view, bool blend)
static void wm_draw_update_clear_window(bContext *C, wmWindow *win)
static bool wm_software_cursor_needed()
GPUTexture * wm_draw_region_texture(ARegion *region, int view)
static eGPUTextureFormat get_hdr_framebuffer_format(const Scene *scene)
bool WM_region_use_viewport(ScrArea *area, ARegion *region)
#define SPACE_NAME(space)
static void wm_region_test_render_do_draw(const Scene *scene, Depsgraph *depsgraph, ScrArea *area, ARegion *region)
static bool wm_draw_region_stereo_set(Main *bmain, ScrArea *area, ARegion *region, eStereoViews sview)
bool WM_window_pixels_read_sample_from_offscreen(bContext *C, wmWindow *win, const int pos[2], float r_col[3])
void WM_draw_cb_exit(wmWindow *win, void *handle)
void wm_draw_region_clear(wmWindow *win, ARegion *)
static void wm_region_test_gizmo_do_draw(bContext *C, ScrArea *area, ARegion *region, bool tag_redraw)
void WM_paint_cursor_tag_redraw(wmWindow *win, ARegion *)
static void wm_software_cursor_draw(wmWindow *win, const GrabState *grab_state)
static struct @1377 g_software_cursor
static bool wm_software_cursor_motion_test(const wmWindow *win)
static void wm_software_cursor_motion_clear_with_window(const wmWindow *win)
void WM_draw_region_viewport_bind(ARegion *region)
GPUViewport * WM_draw_region_get_bound_viewport(ARegion *region)
static void wm_software_cursor_draw_crosshair(const int event_xy[2])
void wm_draw_region_test(bContext *C, ScrArea *area, ARegion *region)
static void wm_draw_region_blit(ARegion *region, int view)
uint8_t * WM_window_pixels_read_from_offscreen(bContext *C, wmWindow *win, int r_size[2])
void WM_draw_region_free(ARegion *region)
static void wm_software_cursor_motion_update(const wmWindow *win)
static void wm_region_draw_overlay(bContext *C, const ScrArea *area, ARegion *region)
static void wm_draw_window(bContext *C, wmWindow *win)
static void wm_software_cursor_draw_bitmap(const int event_xy[2], const GHOST_CursorBitmapRef *bitmap)
static bool wm_window_grab_warp_region_is_set(const wmWindow *win)
bool WM_desktop_cursor_sample_read(float r_col[3])
void wm_draw_update(bContext *C)
static bool wm_draw_update_test_window(Main *bmain, bContext *C, wmWindow *win)
static void wm_draw_window_onscreen(bContext *C, wmWindow *win, int view)
static void wm_software_cursor_motion_clear()
bool WM_window_pixels_read_sample(bContext *C, wmWindow *win, const int pos[2], float r_col[3])
void WM_report(eReportType type, const char *message)
void wm_gesture_draw(wmWindow *win)
bool WM_gizmo_group_type_poll(const bContext *C, const wmGizmoGroupType *gzgt)
const ListBase * WM_gizmomap_group_list(wmGizmoMap *gzmap)
void wm_stereo3d_draw_sidebyside(wmWindow *win, int view)
bool WM_stereo3d_enabled(wmWindow *win, bool skip_stereo3d_check)
void wm_stereo3d_draw_topbottom(wmWindow *win, int view)
void wmViewport(const rcti *winrct)
void wmWindowViewport(const wmWindow *win)
void wmWindowViewport_ex(const wmWindow *win, float offset)
void wm_surface_make_drawable(wmSurface *surface)
void wm_surface_clear_drawable()
void wm_surfaces_iter(bContext *C, void(*cb)(bContext *C, wmSurface *))
blender::int2 WM_window_native_pixel_size(const wmWindow *win)
void wm_window_swap_buffers(wmWindow *win)
Push rendered buffer to the screen.
bool wm_cursor_position_get(wmWindow *win, int *r_x, int *r_y)
int WM_window_native_pixel_y(const wmWindow *win)
void wm_window_clear_drawable(wmWindowManager *wm)
void wm_window_make_drawable(wmWindowManager *wm, wmWindow *win)
eWM_CapabilitiesFlag WM_capabilities_flag()
ViewLayer * WM_window_get_active_view_layer(const wmWindow *win)
Scene * WM_window_get_active_scene(const wmWindow *win)
bScreen * WM_window_get_active_screen(const wmWindow *win)