10#include <fmt/format.h>
96#define VIEW3D_OVERLAY_LINEHEIGHT (ui::style_get()->widget.points * UI_SCALE_FAC * 1.6f)
106 const float viewmat[4][4],
107 const float winmat[4][4],
145 scene, depsgraph, v3d, rv3d, region->
winx, region->
winy,
false,
false,
false);
162 float len_px, len_sc;
181 rv3d->
pixsize = len_px / len_sc;
189 const float viewmat[4][4],
190 const float winmat[4][4],
206 const float viewmat[4][4],
207 const float winmat[4][4])
268 const char *viewname;
287 shiftx = data_eval->shiftx;
295 data_eval->shiftx = shiftx;
316static void view3d_xr_mirror_setup(
const wmWindowManager *wm,
317 Depsgraph *depsgraph,
323 RegionView3D *rv3d =
static_cast<RegionView3D *
>(region->regiondata);
325 const float lens_old = v3d->lens;
330 v3d->lens = lens_old;
346 v3d->lens = lens_old;
352 Depsgraph *depsgraph,
356 const float viewmat[4][4],
357 const float winmat[4][4],
364 if (ED_view3d_is_region_xr_mirror_active(
wm, v3d, region)) {
365 view3d_xr_mirror_setup(
wm, depsgraph, scene, v3d, region, rect);
377#ifndef WITH_XR_OPENXR
390 float x1, x2, y1, y2;
391 float x1i, x2i, y1i, y2i;
396 if (v3d->
camera ==
nullptr) {
404 scene, depsgraph, v3d, rv3d, region->
winx, region->
winy,
false,
false,
true);
406 x1 = viewborder.
xmin;
407 y1 = viewborder.
ymin;
408 x2 = viewborder.
xmax;
409 y2 = viewborder.
ymax;
411 const float roll = rv3d->
camroll;
422 x1i = int(x1 - 1.0001f);
423 y1i = int(y1 - 1.0001f);
424 x2i = int(x2 + (1.0f - 0.0001f));
425 y2i = int(y2 + (1.0f - 0.0001f));
435 if (roll != 0.0f || is_flipped_x) {
437 const int center_x = region->
winx / 2;
438 const int center_y = region->
winy / 2;
453 const float winx = (region->
winx + 1);
454 const float winy = (region->
winy + 1);
458 if (ca->passepartalpha != 1.0f) {
460 alpha = ca->passepartalpha;
467 immRectf(shdr_pos, 0.0f, winy, x1i, 0.0f);
470 immRectf(shdr_pos, x2i, winy, winx, 0.0f);
473 immRectf(shdr_pos, x1i, winy, x2i, y2i);
476 immRectf(shdr_pos, x1i, y1i, x2i, 0.0f);
493#ifdef VIEW3D_CAMERA_BORDER_HACK
506 if (roll != 0.0f || is_flipped_x) {
516 float viewport_size[4];
518 immUniform2f(
"viewport_size", viewport_size[2], viewport_size[3]);
536 float x3, y3, x4, y4;
552 shdr_pos, ca->composition_guide_flags, &viewborder, ca->composition_guide_color);
556 margins_rect.
xmin = x1;
557 margins_rect.
xmax = x2;
558 margins_rect.
ymin = y1;
559 margins_rect.
ymax = y2;
569 center_rect.
xmin = x1;
570 center_rect.
xmax = x2;
571 center_rect.
ymin = y1;
572 center_rect.
ymax = y2;
586 float sensor_x = ca->sensor_x;
593 float sensor_scale = (x2i - x1i) / sensor_x;
594 float sensor_height = sensor_scale * sensor_y;
598 rect.
ymin = (y1i + y2i) * 0.5f - sensor_height * 0.5f;
599 rect.
ymax = rect.
ymin + sensor_height;
602 float sensor_scale = (y2i - y1i) / sensor_y;
603 float sensor_width = sensor_scale * sensor_x;
605 rect.
xmin = (x1i + x2i) * 0.5f - sensor_width * 0.5f;
606 rect.
xmax = rect.
xmin + sensor_width;
631 y1i - (0.7f *
U.widget_unit),
637 if (roll != 0.0f || is_flipped_x) {
652 float viewport_size[4];
654 immUniform2f(
"viewport_size", viewport_size[2], viewport_size[3]);
707 void const **r_usys_pt,
713 float grid_scale = v3d->
grid;
725 for (i = 0; i <
len; i++) {
730 r_grid_steps[i] = r_grid_steps[
len - 1];
740 for (
int i = 0;; i++) {
741 r_grid_steps[i] = grid_scale *
subdiv;
768 const char **r_grid_unit)
774 float dist = 12.0f / (region->
sizex * rv3d->
winmat[0][0]);
781 grid_scale = grid_steps[i];
782 if (grid_scale > dist || i == (grid_steps_len - 1)) {
788 if (r_grid_unit && usys) {
805 const int bright = -20 * (10 -
U.rvibright);
815 float axis_pos[3][2];
816 float axis_col[3][4];
818 int axis_order[3] = {0, 1, 2};
821 for (
int axis_i = 0; axis_i < 3; axis_i++) {
822 int i = axis_order[axis_i];
825 float vec[3] = {0.0f};
828 axis_pos[i][0] = startx + vec[0] * k;
829 axis_pos[i][1] = starty + vec[1] * k;
833 axis_col[i][3] =
hypotf(vec[0], vec[1]);
848 for (
int axis_i = 0; axis_i < 3; axis_i++) {
849 int i = axis_order[axis_i];
862 for (
int axis_i = 0; axis_i < 3; axis_i++) {
863 int i = axis_order[axis_i];
865 const char axis_text[2] = {char(
'x' + i),
'\0'};
867 BLF_draw_default(axis_pos[i][0] + 2, axis_pos[i][1] + 2, 0.0f, axis_text, 1);
871#ifdef WITH_INPUT_NDOF
875static void draw_ndof_guide_orbit_axis(
const RegionView3D *rv3d)
880 float color[4] = {0.0f, 0.42f, 1.0f, 1.0f};
893 if (rv3d->ndof_rot_angle != 0.0f) {
895 float scaled_axis[3];
896 const float scale = rv3d->dist;
922# define ROT_AXIS_DETAIL 13
924 const float s = 0.05f *
scale;
928 const int upright =
fabsf(rv3d->ndof_rot_axis[2]) >= 0.95f;
930 const float up[3] = {0.0f, 0.0f, 1.0f};
931 float vis_angle, vis_axis[3];
942 for (
int i = 0; i < ROT_AXIS_DETAIL; i++,
angle +=
step) {
954# undef ROT_AXIS_DETAIL
979static void draw_ndof_guide_orbit_center(
const RegionView3D *rv3d)
1043 const char *name =
nullptr;
1046 switch (rv3d->
view) {
1052 name =
IFACE_(
"Front Orthographic");
1055 name =
IFACE_(
"Front Perspective");
1063 name =
IFACE_(
"Back Orthographic");
1066 name =
IFACE_(
"Back Perspective");
1074 name =
IFACE_(
"Top Orthographic");
1077 name =
IFACE_(
"Top Perspective");
1085 name =
IFACE_(
"Bottom Orthographic");
1088 name =
IFACE_(
"Bottom Perspective");
1096 name =
IFACE_(
"Right Orthographic");
1099 name =
IFACE_(
"Right Perspective");
1107 name =
IFACE_(
"Left Orthographic");
1110 name =
IFACE_(
"Left Perspective");
1119 name =
IFACE_(
"Camera Perspective");
1122 name =
IFACE_(
"Camera Orthographic");
1125 name =
IFACE_(
"Camera Panoramic");
1129 name =
IFACE_(
"Camera Custom");
1133 name =
IFACE_(
"Object as Camera");
1138 IFACE_(
"User Perspective");
1149 fmt::memory_buffer name;
1153 const char *axis_roll;
1156 axis_roll =
" 90\xC2\xB0";
1159 axis_roll =
" 180\xC2\xB0";
1162 axis_roll =
" -90\xC2\xB0";
1181 switch (flip_roll) {
1221 if (!
layer->frames().is_empty()) {
1240 const int cfra = scene->
r.
cfra;
1241 const char *msg_pin =
" (Soloed)";
1242 const char *msg_sep =
" : ";
1243 const char *msg_space =
" ";
1247 const char *info_array[16];
1266 info_array[i++] = info_buffers.frame;
1271 info_array[i++] = msg_space;
1273 if (ob !=
nullptr) {
1274 info_array[i++] =
" |";
1283 info_array[i++] = msg_space;
1284 info_array[i++] = ob->
id.
name + 2;
1288 if (
const ID *data_id =
static_cast<const ID *
>(ob->
data)) {
1289 info_array[i++] =
" | ";
1290 info_array[i++] = data_id->name + 2;
1301 info_array[i++] = msg_sep;
1309 info_array[i++] = msg_sep;
1324 info_array[i++] = msg_sep;
1335 info_array[i++] = msg_sep;
1336 info_array[i++] = kb->
name;
1338 info_array[i++] =
IFACE_(msg_pin);
1357 info_array[i++] =
" <";
1358 info_array[i++] = markern;
1359 info_array[i++] =
">";
1364 info_array[i++] =
IFACE_(
" (Viewer)");
1386 const char *grid_unit =
nullptr;
1390 char numstr[32] =
"";
1391 if (v3d->
grid != 1.0f) {
1397 BLF_draw_default(xoffset, *yoffset, 0.0f, numstr[0] ? numstr : grid_unit,
sizeof(numstr));
1409 col_alert[3] = 1.0f;
1417 const float text_color[4],
1420 const int line_height)
1422 const float fps_target =
float(scene->frames_per_second());
1423 const float target_time = 1.0f / fps_target;
1428 const float total_time = (last_eval_time ? *last_eval_time : 0.0f) + sync_time + submission_time;
1431 enum { EVAL_TIME, SYNC_TIME, TOTAL, MAX_LABELS_COUNT };
1432 std::string labels[MAX_LABELS_COUNT];
1433 labels[EVAL_TIME] =
IFACE_(
"Evaluation");
1434 labels[SYNC_TIME] =
IFACE_(
"Synchronization");
1435 labels[TOTAL] =
IFACE_(
"Total");
1438 float longest_label = 0;
1439 for (
int i = 0; i < MAX_LABELS_COUNT; ++i) {
1440 longest_label = std::max(longest_label,
1441 BLF_width(font_id, labels[i].c_str(), labels[i].size()));
1444 const int xoffset2 = xoffset + int(longest_label) + (0.5f *
U.widget_unit);
1446 const auto draw_time_stat = [&](
const StringRef label,
const std::optional<float> time_value) {
1447 *yoffset -= line_height;
1451 if (*time_value > target_time) {
1455 std::string value_string = fmt::format(
"{:.2f} ms", *time_value * 1000.0f);
1456 BLF_draw_default(xoffset2, *yoffset, 0.0f, value_string.c_str(), value_string.size());
1462 *yoffset -= line_height;
1463 draw_time_stat(labels[EVAL_TIME], last_eval_time);
1464 draw_time_stat(labels[SYNC_TIME], sync_time);
1465 draw_time_stat(labels[TOTAL], total_time);
1478#ifdef WITH_INPUT_NDOF
1484 draw_ndof_guide_orbit_axis(rv3d);
1497 draw_ndof_guide_orbit_center(rv3d);
1536 int xoffset = rect->
xmin + (0.5f *
U.widget_unit);
1537 int yoffset = rect->
ymax - (0.1f *
U.widget_unit);
1545 float text_color[4], shadow_color[4];
1680 const float winmat[4][4],
1681 const char *viewname)
1685 float viewmat[4][4];
1692 float viewmat[4][4];
1709 const float viewmat[4][4],
1710 const float winmat[4][4],
1711 bool is_image_render,
1712 bool draw_background,
1713 const char *viewname,
1714 const bool do_color_management,
1715 const bool restore_rv3d_mats,
1731 int region_winx, region_winy;
1743 orig.region_winx = region->
winx;
1744 orig.region_winy = region->
winy;
1745 orig.region_winrct = region->
winrct;
1746 orig.rv3d_persp = rv3d->
persp;
1753 region->
winx = winx;
1754 region->
winy = winy;
1778 if ((viewname !=
nullptr && viewname[0] !=
'\0') && (viewmat ==
nullptr) &&
1799 do_color_management,
1807 region->
winx = orig.region_winx;
1808 region->
winy = orig.region_winy;
1809 region->
winrct = orig.region_winrct;
1813 if (restore_rv3d_mats) {
1816 MEM_delete(orig.rv3d_mats);
1817 rv3d->
persp = orig.rv3d_persp;
1840 int object_type_exclude_viewport_override,
1841 int object_type_exclude_select_override,
1845 const float viewmat[4][4],
1846 const float winmat[4][4],
1849 float xr_vignette_aperture,
1851 bool is_image_render,
1852 bool draw_background,
1853 const char *viewname,
1854 const bool do_color_management,
1862 region.
runtime = ®ion_runtime;
1871 source_shading_settings = shading_override;
1877 if (shading_override) {
1915 if ((object_type_exclude_viewport_override & (1 <<
OB_ARMATURE)) != 0) {
1921 if (is_xr_surface) {
1928 if (camera_override !=
nullptr) {
1931 v3d.
camera = camera_override;
1955 do_color_management,
1970 const char *viewname,
1971 const bool restore_rv3d_mats,
1974 const bool use_camera_view_bounds,
1979 const bool draw_sky = (alpha_mode ==
R_ADDSKY);
1982 bool is_ortho =
false;
1987 gpu::TextureFormat::SFLOAT_16_16_16_16 :
1988 gpu::TextureFormat::UNORM_8_8_8_8;
2003 const bool own_ofs = (ofs ==
nullptr);
2015 if (ofs ==
nullptr) {
2047 float clip_start, clipend;
2050 depsgraph, v3d, rv3d, sizex, sizey, &viewplane, &clip_start, &clipend,
nullptr);
2081 const bool do_color_management = (ibuf->
float_data() ==
nullptr);
2095 do_color_management,
2137 const char *viewname,
2147 region.
runtime = ®ion_runtime;
2158 source_shading_settings = shading_override;
2279 Depsgraph *depsgraph,
2385 if (
w <= 0 || h <= 0) {
2428 float far = far_real;
2430 const float *depths = d->
depths;
2431 const int depth_num = int(d->
w) * int(d->
h);
2435 if (r_xy !=
nullptr) {
2436 int index_found = -1;
2437 for (
int i = 0; i < depth_num; i++) {
2438 const float depth = *depths++;
2439 if ((depth < far) && (depth > near)) {
2444 if (index_found != -1) {
2445 r_xy[0] = d->
x + (index_found % int(d->
w));
2446 r_xy[1] = d->
y + (index_found / int(d->
w));
2450 for (
int i = 0; i < depth_num; i++) {
2451 const float depth = depths[i];
2452 if ((depth < far) && (depth > near)) {
2458 return far == far_real ?
FLT_MAX : far;
2476 if (!r_depths || *r_depths !=
nullptr) {
2490 use_overlay =
false;
2502 G_MAIN->wm.first(),
nullptr, depsgraph, scene, region, v3d,
nullptr,
nullptr,
nullptr);
2514 if (viewport !=
nullptr) {
2556 MEM_delete(depths->
depths);
2563#ifdef REUSE_DEPTH_BUFFER
2584 return is_viewport_preview_solid || is_viewport_preview_material || is_viewport_wire_no_xray ||
2585 is_viewport_render_eevee || is_viewport_render_workbench ||
2586 is_viewport_render_external_with_overlay;
2625 switch (obact->
type) {
2627 switch (obact->
mode) {
2657 bmain, scene, view_layer, area.
spacedata.first_as<
View3D>(), r_cddata_masks);
2712 MEM_delete(rv3d_mat);
2732 printable[0] =
'\0';
2734 bool show_fractional =
state.fps_target_is_fractional;
2739 if (
state.fps_average + 0.5f <
state.fps_target) {
2741 show_fractional =
true;
2746 if (show_fractional) {
2780 scene, depsgraph, v3d, rv3d, region->
winx, region->
winy, &border,
nullptr))
2802 if (viewport ==
nullptr) {
2807 if (color_tex ==
nullptr) {
2825 gpu::TextureFormat::SFLOAT_16_16_16_16,
2828 if (tex ==
nullptr) {
2841 if (tex ==
nullptr || data ==
nullptr) {
2849 ushort4 pixel = data[mval[1] * tex_w + mval[0]];
2866 if (data !=
nullptr) {
2869 if (tex !=
nullptr) {
C++ functions to deal with Armature collections (i.e. the successor of bone layers).
Functions to insert, delete or modify keyframes.
Camera data-block and utility functions.
CustomData interface, see also DNA_customdata_types.h.
Low-level operations for grease pencil.
General operations, lookup, etc. for blender objects.
#define SNPRINTF_UTF8(dst, format,...)
#define BLI_STR_UTF8_MULTIPLICATION_SIGN
Platform independent time functions.
Object is a sort of wrapper for general info.
#define STEREO_RIGHT_NAME
#define NDOF_IS_ORBIT_AROUND_CENTER_MODE(userdef)
#define RV3D_VIEW_IS_AXIS(view)
#define RV3D_LOCK_FLAGS(rv3d)
#define RV3D_CLIPPING_ENABLED(v3d, rv3d)
#define XRAY_ENABLED(v3d)
#define GPU_ATTACHMENT_TEXTURE(_texture)
#define GPU_ATTACHMENT_NONE
#define GPU_framebuffer_ensure_config(_fb,...)
Read Blender memory allocation and freeing.
#define UI_DEFAULT_TEXT_POINTS
#define UNUSED_VARS_NDEBUG(...)
#define SET_FLAG_FROM_TEST(value, test, flag)
#define CD_MASK_PROP_BYTE_COLOR
#define CD_MASK_PROP_COLOR
#define CD_MASK_MDEFORMVERT
#define CD_MASK_PROP_FLOAT2
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
bool init(ARegion *region)
~ViewportColorSampleSession()
bool sample(const int mval[2], float r_col[3])
constexpr int64_t size() const
constexpr const char * data() const
VecBase< float, D > step(VecOp< float, D >, VecOp< float, D >) RET
void camera(KernelGlobals &kg, const ShadingData &sd, float3 &outview, float &outdepth, float &outdist)
float3x3 scale(float3x3 mat, float2 scale)
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
bool id_frame_has_keyframe(ID *id, float frame)
internal::ShallowZeroInitializeTag shallow_zero_initialize()
void DRW_cache_free_old_subdiv()
T max(const T &a, const T &b)
float half_to_float(uint16_t v)
void font_theme_color_set(int fontid, int colorid)
void theme_store(bThemeState *theme_state)
void theme_set(int spacetype, int regionid)
void get_color_4fv(int colorid, float col[4])
void get_color_shade_3fv(int colorid, int offset, float col[3])
void get_color_blend_3f(int colorid1, int colorid2, float fac, float r_col[3])
void theme_restore(const bThemeState *theme_state)
void draw_safe_areas(uint pos, const rctf *rect, const float title_aspect[2], const float action_aspect[2])
void fontstyle_set(const uiFontStyle *fs)
void DRW_gpu_context_enable()
@ V3D_OVERLAY_HIDE_OBJECT_ORIGINS
@ V3D_OVERLAY_HIDE_MOTION_PATHS
@ V3D_OVERLAY_PERFORMANCE
@ V3D_OVERLAY_HIDE_OBJECT_XTRAS
@ V3D_OVERLAY_HIDE_CURSOR
MINLINE float min_ff(float a, float b)
void CustomData_MeshMasks_update(CustomData_MeshMasks *mask_dst, const CustomData_MeshMasks *mask_src)
void GPU_framebuffer_bind(gpu::FrameBuffer *fb)
void * MEM_new_uninitialized(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
void view3d_viewmatrix_set(const Depsgraph *depsgraph, const Scene *scene, const View3D *v3d, RegionView3D *rv3d, const float rect_scale[2])
bool ED_view3d_viewplane_get(const Depsgraph *depsgraph, const View3D *v3d, const RegionView3D *rv3d, int winx, int winy, rctf *r_viewplane, float *r_clip_start, float *r_clip_end, float *r_pixsize)
MINLINE void negate_v3_v3(float r[3], const float a[3])
gpu::Texture * GPU_viewport_color_texture(GPUViewport *viewport, int view)
static void draw_viewport_name(ARegion *region, View3D *v3d, int xoffset, int *yoffset)
double BKE_unit_scalar_get(const void *usys_pt, int index)
@ V3D_RUNTIME_DEPTHBUF_OVERRIDDEN
bool WM_xr_session_state_viewer_pose_matrix_info_get(const wmXrData *xr, float r_viewmat[4][4], float *r_focal_len)
gpu::FrameBuffer * GPU_framebuffer_active_get()
ImBuf * ED_view3d_draw_offscreen_imbuf(Depsgraph *depsgraph, Scene *scene, eDrawType drawtype, View3D *v3d, ARegion *region, int sizex, int sizey, ImBufFlags imbuf_flag, int alpha_mode, const char *viewname, bool restore_rv3d_mats, GPUOffScreen *ofs, GPUViewport *viewport, bool use_camera_view_bounds, char err_out[256])
bool ED_view3d_draw_offscreen_check_nested()
std::optional< double > DEG_get_last_evaluation_time(const Depsgraph *depsgraph)
static void draw_performance_stats(Depsgraph *depsgraph, Scene *scene, View3D *v3d, const float text_color[4], const int xoffset, int *yoffset, const int line_height)
static void validate_object_select_id(const Main &bmain, Depsgraph *depsgraph, const Scene *scene, ViewLayer *view_layer, ARegion *region, View3D *v3d, Object *obact)
void GPU_offscreen_free(GPUOffScreen *offscreen)
void DRW_draw_view(const bContext *C)
uint padding(uint offset, uint alignment)
Object * BKE_view_layer_active_object_get(const ViewLayer *view_layer)
void BLF_shadow_offset(int fontid, int x, int y)
const CustomData_MeshMasks CD_MASK_BAREMESH
void BKE_camera_multiview_view_matrix(const struct RenderData *rd, const struct Object *camera, bool is_left, float r_viewmat[4][4])
void GPU_framebuffer_restore()
void ED_draw_composition_guides(uint shdr_pos, eCompositionGuideFlags flag, const rctf *rect, const float color[4])
float BLF_width(int fontid, const char *str, size_t str_len, ResultBLF *r_info=nullptr) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(2)
void immUniformColor3f(float r, float g, float b)
void * MEM_new_array_uninitialized(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
const char * BKE_collection_ui_name_get(Collection *collection)
void immAttr4ubv(uint attr_id, const unsigned char data[4])
WorkSpace * CTX_wm_workspace(const bContext *C)
void BLF_shadow(int fontid, FontShadowType type, const float rgba[4]=nullptr)
void GPU_framebuffer_free(gpu::FrameBuffer *fb)
void ED_view3d_depths_free(ViewDepths *depths)
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
bool BLI_rcti_isect(const struct rcti *src1, const struct rcti *src2, struct rcti *dest)
void immUniform2f(const char *name, float x, float y)
@ BASE_ENABLED_AND_MAYBE_VISIBLE_IN_VIEWPORT
Depsgraph * CTX_data_depsgraph_pointer(const bContext *C)
void GPU_matrix_identity_set()
void GPU_viewport_tag_update(GPUViewport *viewport)
static bool view3d_stereo3d_active(wmWindow *win, const Scene *scene, View3D *v3d, RegionView3D *rv3d)
static void drawviewborder(Scene *scene, Depsgraph *depsgraph, ARegion *region, View3D *v3d)
@ NDOF_SHOW_GUIDE_ORBIT_CENTER
@ NDOF_SHOW_GUIDE_ORBIT_AXIS
GPUVertFormat * immVertexFormat()
void view3d_depths_rect_create(ARegion *region, rcti *rect, ViewDepths *r_d)
bool BKE_camera_view_render_border(const struct Scene *scene, const struct Depsgraph *depsgraph, const struct View3D *v3d, const struct RegionView3D *rv3d, int winx, int winy, rctf *r_border, rctf *r_unrolled_border)
static void view3d_main_region_setup_offscreen(Depsgraph *depsgraph, const Scene *scene, View3D *v3d, ARegion *region, const float viewmat[4][4], const float winmat[4][4])
float view3d_depth_near_ex(ViewDepths *d, int r_xy[2])
static ViewDepths * view3d_depths_create(ARegion *region)
void BLF_batch_draw_begin()
static const char * view3d_get_name(View3D *v3d, RegionView3D *rv3d)
bool invert_m4_m4(float inverse[4][4], const float mat[4][4])
void ED_view3d_update_viewmat(const Depsgraph *depsgraph, const Scene *scene, View3D *v3d, ARegion *region, const float viewmat[4][4], const float winmat[4][4], const rcti *rect, bool offscreen)
void immBegin(GPUPrimType, uint vertex_len)
void GPU_texture_copy(gpu::Texture *dst, gpu::Texture *src)
void BKE_camera_params_compute_viewplane(CameraParams *params, int winx, int winy, float aspx, float aspy)
@ V3D_OFSDRAW_SHOW_OBJECT_EXTRAS
@ V3D_OFSDRAW_XR_SHOW_PASSTHROUGH
@ V3D_OFSDRAW_SHOW_SELECTION
@ V3D_OFSDRAW_OVERRIDE_SCENE_SETTINGS
@ V3D_OFSDRAW_XR_SHOW_CONTROLLERS
@ V3D_OFSDRAW_XR_SHOW_CUSTOM_OVERLAYS
@ V3D_OFSDRAW_NO_WORLD_BACKGROUND_OVERRIDE
@ V3D_OFSDRAW_SHOW_ANNOTATION
@ V3D_OFSDRAW_SHOW_GRIDFLOOR
static void view3d_draw_grease_pencil(const bContext *)
static void view3d_update_viewer_path(const bContext *C)
void GPU_line_smooth(bool enable)
void axis_angle_to_quat(float r[4], const float axis[3], float angle)
void ED_view3d_grid_steps(const Scene *scene, const View3D *v3d, const RegionView3D *rv3d, float r_grid_steps[8])
void GPU_depth_mask(bool depth)
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
wmWindow * CTX_wm_window(const bContext *C)
bool WM_stereo3d_enabled(wmWindow *win, bool skip_stereo3d_check)
RenderEngineType * ED_view3d_engine_type(const Scene *scene, int drawtype)
MINLINE int max_ii(int a, int b)
@ TH_KEYTYPE_KEYFRAME_SELECT
static bool view3d_clipping_test(const float co[3], const float clip[6][4])
void GPU_matrix_rotate_2d(float deg)
bool ANIM_bonecoll_is_visible_actbone(const bArmature *armature)
const rcti * ED_region_visible_rect(ARegion *region)
static void view3d_stereo3d_setup_offscreen(Depsgraph *depsgraph, const Scene *scene, View3D *v3d, ARegion *region, const float winmat[4][4], const char *viewname)
int GPU_offscreen_width(const GPUOffScreen *offscreen)
void immUniformThemeColorAlpha(int color_id, float a)
void BLF_disable(int fontid, FontFlags flag)
@ V3D_SHADING_SCENE_WORLD
@ V3D_SHADING_SCENE_LIGHTS
@ V3D_SHADING_SCENE_LIGHTS_RENDER
@ V3D_SHADING_SCENE_WORLD_RENDER
const char * RE_engine_id_BLENDER_WORKBENCH
static void view3d_main_region_setup_view(Depsgraph *depsgraph, Scene *scene, View3D *v3d, ARegion *region, const float viewmat[4][4], const float winmat[4][4], const rcti *rect)
void perspective_m4(float mat[4][4], float left, float right, float bottom, float top, float nearClip, float farClip)
@ V3D_XR_SHOW_CONTROLLERS
@ V3D_XR_SHOW_CUSTOM_OVERLAYS
@ V3D_SHOW_CAMERA_PASSEPARTOUT
@ V3D_XR_SHOW_PASSTHROUGH
void DRW_cache_free_old_batches(Main *bmain)
void immUniformColor3ubv(const unsigned char rgb[3])
ViewLayer * CTX_data_view_layer(const bContext *C)
void WM_draw_region_viewport_bind(ARegion *region)
void GPU_line_width(float width)
void GPU_matrix_scale_2f(float x, float y)
void normalize_m4(float R[4][4]) ATTR_NONNULL()
void BKE_camera_multiview_params(const struct RenderData *rd, struct CameraParams *params, const struct Object *camera, const char *viewname)
const char * RE_engine_id_BLENDER_EEVEE
static void view3d_draw_offscreen_set_overlay_defaults(View3D &v3d)
@ USER_MINI_AXIS_TYPE_GIZMO
@ USER_MINI_AXIS_TYPE_MINIMAL
@ USER_MINI_AXIS_TYPE_NONE
VecBase< float, 4 > float4
void mul_qt_v3(const float q[4], float r[3])
void orthographic_m4(float mat[4][4], float left, float right, float bottom, float top, float nearClip, float farClip)
void immBindBuiltinProgram(GPUBuiltinShader shader_id)
@ RV3D_VIEW_AXIS_ROLL_180
void BKE_camera_params_compute_matrix(CameraParams *params)
float BKE_camera_multiview_shift_x(const struct RenderData *rd, const struct Object *camera, const char *viewname)
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void DRW_gpu_context_disable()
void immUniformThemeColor(int color_id)
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
bool DRW_draw_in_progress()
void ED_view3d_mats_rv3d_restore(RegionView3D *rv3d, RV3DMatrixStore *rv3dmat)
void immUniform1f(const char *name, float x)
LayerCollection * BKE_view_layer_active_collection_get(ViewLayer *view_layer)
int GPU_offscreen_height(const GPUOffScreen *offscreen)
bool BKE_scene_uses_blender_eevee(const Scene *scene)
void * MEM_new_zeroed(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
struct Object * BKE_camera_multiview_render(const Main &bmain, const struct Scene *scene, struct Object *camera, const char *viewname)
void DRW_select_buffer_context_create(Depsgraph *depsgraph, Span< Base * > bases, short select_mode)
void immVertex2f(uint attr_id, float x, float y)
void ED_scene_draw_fps(const Scene *scene, int xoffset, int *yoffset)
void GPU_offscreen_unbind(GPUOffScreen *offscreen, bool restore)
@ GPU_TEXTURE_USAGE_SHADER_READ
@ GPU_TEXTURE_USAGE_HOST_READ
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
void GPU_memory_barrier(GPUBarrier barrier)
void GPU_viewport_size_get_f(float coords[4])
Main * DEG_get_bmain(const Depsgraph *graph)
void immAttr4fv(uint attr_id, const float data[4])
BMesh const char void * data
void ED_view3D_mats_rv3d_free(RV3DMatrixStore *rv3d_mat)
Object * BKE_object_pose_armature_get(Object *ob)
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
@ GPU_SHADER_3D_SMOOTH_COLOR
@ GPU_SHADER_3D_UNIFORM_COLOR
@ GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR
@ GPU_SHADER_3D_FLAT_COLOR
@ GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA
void immUniform4fv(const char *name, const float data[4])
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
wmWindowManager * CTX_wm_manager(const bContext *C)
static bool is_grease_pencil_with_layer_keyframe(const Object &ob)
void immUniformThemeColor3(int color_id)
void BKE_camera_params_from_object(CameraParams *params, const struct Object *cam_ob)
bool ED_view3d_calc_render_border(const Scene *scene, Depsgraph *depsgraph, View3D *v3d, ARegion *region, rcti *r_rect)
rctf BKE_camera_view_border(const struct Scene *scene, const struct Depsgraph *depsgraph, const struct View3D *v3d, const struct RegionView3D *rv3d, int winx, int winy, bool no_shift, bool no_zoom, bool no_roll)
void BKE_viewer_path_copy(ViewerPath *dst, const ViewerPath *src)
void DRW_draw_depth_loop(Depsgraph *depsgraph, ARegion *region, View3D *v3d, GPUViewport *viewport, const bool use_gpencil, const bool use_only_selected, const bool use_only_active_object)
float ED_view3d_grid_view_scale(const Scene *scene, const View3D *v3d, const ARegion *region, const char **r_grid_unit)
void BLI_rcti_translate(struct rcti *rect, int x, int y)
int GPU_texture_width(const gpu::Texture *texture)
void DRW_draw_render_loop_offscreen(Depsgraph *depsgraph, RenderEngineType *engine_type, ARegion *region, View3D *v3d, bContext *context, bool is_image_render, bool draw_background, bool do_color_management, GPUOffScreen *ofs, GPUViewport *viewport)
constexpr size_t ARRAY_SIZE(const T(&arg)[N]) noexcept
bool BKE_view_layer_synced_ensure(const Main &bmain, const Scene *scene, ViewLayer *view_layer)
float ED_scene_grid_scale(const Scene *scene, const char **r_grid_unit)
MINLINE float plane_point_side_v3(const float plane[4], const float co[3])
float ED_view3d_grid_scale(const Scene *scene, const View3D *v3d, const char **r_grid_unit)
void DRW_draw_region_engine_info(int xoffset, int *yoffset, int line_height)
void ED_view3d_draw_offscreen_simple(Depsgraph *depsgraph, Scene *scene, View3DShading *shading_override, bContext *context, eDrawType drawtype, int object_type_exclude_viewport_override, int object_type_exclude_select_override, int winx, int winy, unsigned int draw_flags, const float viewmat[4][4], const float winmat[4][4], float clip_start, float clip_end, float xr_vignette_aperture, bool is_xr_surface, bool is_image_render, bool draw_background, const char *viewname, bool do_color_management, Object *camera_override, GPUOffScreen *ofs, GPUViewport *viewport)
static void draw_grid_unit_name(Scene *scene, ARegion *region, View3D *v3d, int xoffset, int *yoffset)
bool ED_scene_fps_average_calc(const Scene *scene, SceneFPS_State *r_state) ATTR_NONNULL(1
@ GPU_BARRIER_TEXTURE_UPDATE
void immUniformThemeColorShadeAlpha(int color_id, int color_offset, int alpha_offset)
bool view3d_camera_border_hack_test
void BKE_image_free_old_buffers(Main *bmain)
void BKE_unit_system_get(int system, int type, const void **r_usys_pt, int *r_len)
bool BKE_paint_select_face_test(const Object *ob)
void GPU_offscreen_bind(GPUOffScreen *offscreen, bool save)
void ED_view3d_datamask(const Main &bmain, const Scene *scene, ViewLayer *view_layer, const View3D *v3d, CustomData_MeshMasks *r_cddata_masks)
void GPU_matrix_projection_set(const float m[4][4])
static float4 get_low_fps_color()
void WM_draw_region_viewport_ensure(Scene *scene, ARegion *region, short space_type)
@ V3D_SHADING_VERTEX_COLOR
@ V3D_SHADING_TEXTURE_COLOR
void GPU_matrix_translate_2f(float x, float y)
void BLF_batch_draw_end()
uint GPU_vertformat_attr_add(GPUVertFormat *format, StringRef name, gpu::VertAttrType type)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
int BKE_camera_sensor_fit(int sensor_fit, float sizex, float sizey)
bool BKE_scene_multiview_is_stereo3d(const RenderData *rd)
bool ED_view3d_has_depth_buffer_updated(const Depsgraph *depsgraph, const View3D *v3d)
RenderEngineType * RE_engines_find(const char *idname)
bool BKE_viewer_path_equal(const ViewerPath *a, const ViewerPath *b, ViewerPathEqualFlag flag=ViewerPathEqualFlag(0))
static void view3d_draw_view(const bContext *C, ARegion *region)
ImBuf * IMB_allocImBuf(unsigned int x, unsigned int y, ImBufFlags flags)
void BLI_rcti_init(struct rcti *rect, int xmin, int xmax, int ymin, int ymax)
void ED_view3d_select_id_validate(const ViewContext *vc)
MINLINE void mul_v3_v3fl(float r[3], const float a[3], float f)
RV3DMatrixStore * ED_view3d_mats_rv3d_backup(RegionView3D *rv3d)
void BLF_draw_default(float x, float y, float z, const char *str, size_t str_len) ATTR_NONNULL()
static void view3d_gpu_read_Z_pixels(GPUViewport *viewport, rcti *rect, void *data)
@ V3D_SHADING_BACKGROUND_WORLD
MINLINE void add_v3_v3(float r[3], const float a[3])
void immVertex3fv(uint attr_id, const float data[3])
bScreen * ED_screen_animation_no_scrub(const wmWindowManager *wm)
void view3d_winmatrix_set(const Depsgraph *depsgraph, ARegion *region, const View3D *v3d, const rcti *rect)
void view3d_draw_region_info(const bContext *C, ARegion *region)
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
void ED_region_pixelspace(const ARegion *region)
bool ED_view3d_clipping_test(const RegionView3D *rv3d, const float co[3], bool is_local)
Depsgraph * CTX_data_expect_evaluated_depsgraph(const bContext *C)
void immUniform4f(const char *name, float x, float y, float z, float w)
bool BKE_scene_uses_blender_workbench(const Scene *scene)
Main * CTX_data_main(const bContext *C)
void size_t BLI_string_len_array(const char *strings[], uint strings_num) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
ATTR_WARN_UNUSED_RESULT const BMVert * v2
gpu::Texture * GPU_viewport_depth_texture(GPUViewport *viewport)
void IMB_byte_from_float(ImBuf *ibuf)
void GPU_matrix_pop_projection()
int BKE_unit_base_get(const void *usys_pt)
void imm_draw_box_wire_2d(uint pos, float x1, float y1, float x2, float y2)
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
static bool view3d_main_region_do_render_draw(const Scene *scene)
int GPU_texture_height(const gpu::Texture *texture)
int ED_view3d_backbuf_sample_size_clamp(ARegion *region, float dist)
static void drawrenderborder(ARegion *region, View3D *v3d)
uchar view3d_camera_border_hack_col[3]
void ED_view3d_depth_override(Depsgraph *depsgraph, ARegion *region, View3D *v3d, Object *obact, eV3DDepthOverrideMode mode, bool use_overlay, ViewDepths **r_depths)
void GPU_texture_free(gpu::Texture *texture)
static void view3d_grid_steps_ex(const Scene *scene, const View3D *v3d, const RegionView3D *rv3d, float r_grid_steps[STEPS_LEN], void const **r_usys_pt, int *r_len)
void axis_sort_v3(const float axis_values[3], int r_axis_order[3])
gpu::TextureFormat GPU_offscreen_format(const GPUOffScreen *offscreen)
MINLINE float len_squared_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
Base * BKE_view_layer_base_find(ViewLayer *view_layer, Object *ob)
@ V3D_DEPTH_SELECTED_ONLY
@ V3D_OVERLAY_EDIT_WEIGHT
void BKE_image_free_anim_gpu_texture_caches(Main *bmain)
float view3d_depth_near(ViewDepths *d)
static void view3d_draw_border(const bContext *C, ARegion *region)
static void view3d_stereo3d_setup(Depsgraph *depsgraph, Scene *scene, View3D *v3d, ARegion *region, const rcti *rect)
Scene * CTX_data_scene(const bContext *C)
bool BLI_rcti_isect_pt_v(const struct rcti *rect, const int xy[2])
@ SCE_VIEWS_FORMAT_MULTIVIEW
@ SCE_VIEWS_FORMAT_STEREO_3D
void ED_view3d_draw_setup_view(const wmWindowManager *wm, wmWindow *win, Depsgraph *depsgraph, Scene *scene, ARegion *region, View3D *v3d, const float viewmat[4][4], const float winmat[4][4], const rcti *rect)
MINLINE void copy_v4_v4(float r[4], const float a[4])
void ED_info_draw_stats(Main *bmain, Scene *scene, ViewLayer *view_layer, View3D *v3d_local, int x, int *y, int height)
GPUOffScreen * GPU_offscreen_create(int width, int height, bool with_depth_buffer, gpu::TextureFormat format, eGPUTextureUsage usage, bool clear, char err_out[256])
void GPU_blend(GPUBlend blend)
static void draw_view_axis(RegionView3D *rv3d, const rcti *rect)
void * GPU_texture_read(gpu::Texture *texture, eGPUDataFormat data_format, int mip_level)
void copy_m4_m4(float m1[4][4], const float m2[4][4])
void immUniform1i(const char *name, int x)
ImBuf * ED_view3d_draw_offscreen_imbuf_simple(Depsgraph *depsgraph, Scene *scene, View3DShading *shading_override, eDrawType drawtype, Object *camera, int width, int height, ImBufFlags imbuf_flags, eV3DOffscreenDrawFlag draw_flags, int alpha_mode, const char *viewname, GPUOffScreen *ofs, GPUViewport *viewport, char err_out[256])
const char * BKE_unit_display_name_get(const void *usys_pt, int index)
Key * BKE_key_from_object(Object *ob)
eRegionView3D_ViewFlipRoll
size_t BLI_string_join_array(char *result, size_t result_maxncpy, const char *strings[], uint strings_num) ATTR_NONNULL()
VecBase< uint16_t, 4 > ushort4
void BKE_camera_params_init(CameraParams *params)
void GPU_framebuffer_read_depth(gpu::FrameBuffer *fb, int x, int y, int width, int height, eGPUDataFormat data_format, void *r_data)
void ED_view3d_text_colors_get(const Scene *scene, const View3D *v3d, float r_text_color[4], float r_shadow_color[4])
void BKE_viewer_path_clear(ViewerPath *viewer_path)
void BLI_thread_unlock(int type)
Scene * DEG_get_evaluated_scene(const Depsgraph *graph)
void immVertex2fv(uint attr_id, const float data[2])
void view3d_main_region_draw(const bContext *C, ARegion *region)
void BLF_default_size(float size)
void GPU_matrix_push_projection()
GPUViewport * WM_draw_region_get_viewport(ARegion *region)
static void draw_selected_name(const Main &bmain, const View3D *v3d, Scene *scene, ViewLayer *view_layer, Object *ob, int xoffset, int *yoffset)
MINLINE int min_ii(int a, int b)
void GPU_depth_test(GPUDepthTest test)
void ED_view3d_screen_datamask(const Main &bmain, const Scene *scene, ViewLayer *view_layer, const bScreen *screen, CustomData_MeshMasks *r_cddata_masks)
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
void immRectf(uint pos, float x1, float y1, float x2, float y2)
eRegionView3D_ViewFlipRoll ED_view3d_effective_flip_axis(const RegionView3D *rv3d)
void GPU_matrix_set(const float m[4][4])
@ V3D_GIZMO_HIDE_NAVIGATE
void WM_draw_region_viewport_unbind(ARegion *region)
void BLF_enable(int fontid, FontFlags flag)
const char * BKE_scene_find_marker_name(const Scene *scene, int frame)
View3D * CTX_wm_view3d(const bContext *C)
void ED_view3d_draw_offscreen(Depsgraph *depsgraph, const Scene *scene, eDrawType drawtype, View3D *v3d, ARegion *region, bContext *context, int winx, int winy, const float viewmat[4][4], const float winmat[4][4], bool is_image_render, bool draw_background, const char *viewname, bool do_color_management, bool restore_rv3d_mats, GPUOffScreen *ofs, GPUViewport *viewport)
gpu::Texture * GPU_texture_create_2d(const char *name, int width, int height, int mip_len, gpu::TextureFormat format, eGPUTextureUsage usage, const float *data)
void BLI_thread_lock(int type)
void BLF_color4fv(int fontid, const float rgba[4])
void BLI_rcti_rctf_copy_floor(struct rcti *dst, const struct rctf *src)
void GPU_offscreen_read_color(GPUOffScreen *offscreen, eGPUDataFormat data_format, void *r_data)
std::string format(const std::string &fmt, Args &&...args)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
bke::ARegionRuntime * runtime
eRegion_Alignment alignment
const uint8_t * byte_data() const
uint8_t * byte_data_for_write()
const float * float_data() const
float * float_data_for_write()
ListBaseT< KeyBlock > block
struct Collection * collection
eObject_ShapeFlag shapeflag
eRegionView3D_ViewAxisRoll view_axis_roll
eRegionView3D_Persp persp
eRegionView3D_NDOFFlag ndof_flag
eSceneViews_Format views_format
void(*) view_update(struct RenderEngine *engine, const struct bContext *context, struct Depsgraph *depsgraph)
void(*) view_draw(struct RenderEngine *engine, const struct bContext *context, struct Depsgraph *depsgraph)
struct SceneDisplay display
struct DisplaySafeAreas safe_areas
ListBaseT< SpaceLink > spacedata
float wireframe_threshold
float gpencil_vertex_paint_opacity
eView3DOverlay_EditFlag edit_flag
eV3DShadingColorType color_type
eV3DShadingBackgroundType background_type
eV3DShadingLightingMode light
float last_submission_time
eView3D_GridFlag gridflag
int object_type_exclude_select
struct Object * ob_center
ListBaseT< ARegion > regionbase
float xr_vignette_aperture
eView3D_GizmoFlag gizmo_flag
int object_type_exclude_viewport
ListBaseT< ViewerPathElem > path
ListBaseT< EditBone > * edbo
struct EditBone * act_edbone
ListBaseT< struct ScrArea > areabase
ARegionQuadviewIndex quadview_index
#define VIEW3D_OVERLAY_LINEHEIGHT