90#define M_GOLDEN_RATIO_CONJUGATE 0.618033988749895f
92#define VIEW3D_OVERLAY_LINEHEIGHT (UI_style_get()->widget.points * UI_SCALE_FAC * 1.6f)
102 const float viewmat[4][4],
103 const float winmat[4][4],
157 float len_px, len_sc;
173 len_sc = float(std::max(region->
winx, region->
winy));
176 rv3d->
pixsize = len_px / len_sc;
184 const float viewmat[4][4],
185 const float winmat[4][4],
201 const float viewmat[4][4],
202 const float winmat[4][4])
262 const char *viewname;
281 shiftx = data_eval->
shiftx;
289 data_eval->
shiftx = shiftx;
318 const float lens_old = v3d->
lens;
323 v3d->
lens = lens_old;
339 v3d->
lens = lens_old;
349 const float viewmat[4][4],
350 const float winmat[4][4],
357 if (ED_view3d_is_region_xr_mirror_active(wm, v3d, region)) {
358 view3d_xr_mirror_setup(wm,
depsgraph, scene, v3d, region, rect);
370#ifndef WITH_XR_OPENXR
391 rctf rect_view, rect_camera;
401 rect_view =
params.viewplane;
415 rect_camera =
params.viewplane;
455 float x3, y3, x4, y4;
457 x3 = x1 + fac * (x2 - x1);
458 y3 = y1 + fac * (y2 - y1);
459 x4 = x1 + (1.0f - fac) * (x2 - x1);
460 y4 = y1 + (1.0f - fac) * (y2 - y1);
481 uint shdr_pos,
float x1,
float x2,
float y1,
float y2,
const char golden,
const char dir)
535 float x1, x2, y1, y2;
536 float x1i, x2i, y1i, y2i;
542 if (v3d->
camera ==
nullptr) {
551 x1 = viewborder.
xmin;
552 y1 = viewborder.
ymin;
553 x2 = viewborder.
xmax;
554 y2 = viewborder.
ymax;
565 x1i = int(x1 - 1.0001f);
566 y1i = int(y1 - 1.0001f);
567 x2i = int(x2 + (1.0f - 0.0001f));
568 y2i = int(y2 + (1.0f - 0.0001f));
581 const float winx = (region->
winx + 1);
582 const float winy = (region->
winy + 1);
594 immRectf(shdr_pos, 0.0f, winy, x1i, 0.0f);
597 immRectf(shdr_pos, x2i, winy, winx, 0.0f);
600 immRectf(shdr_pos, x1i, winy, x2i, y2i);
603 immRectf(shdr_pos, x1i, y1i, x2i, 0.0f);
611#ifdef VIEW3D_CAMERA_BORDER_HACK
631 float viewport_size[4];
633 immUniform2f(
"viewport_size", viewport_size[2], viewport_size[3]);
651 float x3, y3, x4, y4;
670 x3 = x1 + 0.5f * (x2 - x1);
671 y3 = y1 + 0.5f * (y2 - y1);
722 margins_rect.
xmin = x1;
723 margins_rect.
xmax = x2;
724 margins_rect.
ymin = y1;
725 margins_rect.
ymax = y2;
732 center_rect.
xmin = x1;
733 center_rect.
xmax = x2;
734 center_rect.
ymin = y1;
735 center_rect.
ymax = y2;
756 float sensor_scale = (x2i - x1i) / sensor_x;
757 float sensor_height = sensor_scale * sensor_y;
761 rect.
ymin = (y1i + y2i) * 0.5f - sensor_height * 0.5f;
762 rect.
ymax = rect.
ymin + sensor_height;
765 float sensor_scale = (y2i - y1i) / sensor_y;
766 float sensor_width = sensor_scale * sensor_x;
768 rect.
xmin = (x1i + x2i) * 0.5f - sensor_width * 0.5f;
769 rect.
xmax = rect.
xmin + sensor_width;
794 y1i - (0.7f *
U.widget_unit),
811 float viewport_size[4];
813 immUniform2f(
"viewport_size", viewport_size[2], viewport_size[3]);
866 void const **r_usys_pt,
872 float grid_scale = v3d->
grid;
884 for (
i = 0;
i <
len;
i++) {
889 r_grid_steps[
i] = r_grid_steps[
len - 1];
898 for (
int i = 0;;
i++) {
899 r_grid_steps[
i] = grid_scale * subdiv;
926 const char **r_grid_unit)
932 float dist = 12.0f / (region->
sizex * rv3d->
winmat[0][0]);
939 grid_scale = grid_steps[
i];
940 if (grid_scale > dist ||
i == (grid_steps_len - 1)) {
946 if (r_grid_unit && usys) {
963 const int bright = -20 * (10 -
U.rvibright);
973 float axis_pos[3][2];
974 float axis_col[3][4];
976 int axis_order[3] = {0, 1, 2};
979 for (
int axis_i = 0; axis_i < 3; axis_i++) {
980 int i = axis_order[axis_i];
983 float vec[3] = {0.0f};
986 axis_pos[
i][0] = startx + vec[0] * k;
987 axis_pos[
i][1] = starty + vec[1] * k;
991 axis_col[
i][3] =
hypotf(vec[0], vec[1]);
1006 for (
int axis_i = 0; axis_i < 3; axis_i++) {
1007 int i = axis_order[axis_i];
1020 for (
int axis_i = 0; axis_i < 3; axis_i++) {
1021 int i = axis_order[axis_i];
1023 const char axis_text[2] = {char(
'x' +
i),
'\0'};
1029#ifdef WITH_INPUT_NDOF
1033static void draw_ndof_guide_orbit_axis(
const RegionView3D *rv3d)
1038 float color[4] = {0.0f, 0.42f, 1.0f, 1.0f};
1053 float scaled_axis[3];
1064 color[3] = 0.2f +
fabsf(rv3d->rot_angle);
1080# define ROT_AXIS_DETAIL 13
1082 const float s = 0.05f *
scale;
1083 const float step = 2.0f * float(
M_PI / ROT_AXIS_DETAIL);
1088 const float up[3] = {0.0f, 0.0f, 1.0f};
1089 float vis_angle, vis_axis[3];
1100 for (
int i = 0;
i < ROT_AXIS_DETAIL;
i++,
angle +=
step) {
1112# undef ROT_AXIS_DETAIL
1137static void draw_ndof_guide_orbit_center(
const RegionView3D *rv3d)
1139 uchar color[4] = {0, 108, 255, 255};
1201 const char *name =
nullptr;
1203 switch (rv3d->
view) {
1206 name =
IFACE_(
"Front Orthographic");
1209 name =
IFACE_(
"Front Perspective");
1214 name =
IFACE_(
"Back Orthographic");
1217 name =
IFACE_(
"Back Perspective");
1222 name =
IFACE_(
"Top Orthographic");
1225 name =
IFACE_(
"Top Perspective");
1230 name =
IFACE_(
"Bottom Orthographic");
1233 name =
IFACE_(
"Bottom Perspective");
1238 name =
IFACE_(
"Right Orthographic");
1241 name =
IFACE_(
"Right Perspective");
1246 name =
IFACE_(
"Left Orthographic");
1249 name =
IFACE_(
"Left Perspective");
1258 name =
IFACE_(
"Camera Perspective");
1261 name =
IFACE_(
"Camera Orthographic");
1264 name =
IFACE_(
"Camera Panoramic");
1268 name =
IFACE_(
"Camera Custom");
1272 name =
IFACE_(
"Object as Camera");
1277 IFACE_(
"User Perspective");
1288 const char *name_array[3] = {name,
nullptr,
nullptr};
1289 int name_array_len = 1;
1293 char tmpstr[96 + 6];
1296 const char *axis_roll;
1299 axis_roll =
" 90\xC2\xB0";
1302 axis_roll =
" 180\xC2\xB0";
1305 axis_roll =
" -90\xC2\xB0";
1308 name_array[name_array_len++] = axis_roll;
1312 name_array[name_array_len++] =
IFACE_(
" (Local)");
1317 name_array[name_array_len++] =
IFACE_(
" (Clipped)");
1320 if (name_array_len > 1) {
1336 for (
const Layer *layer : grease_pencil.layers()) {
1337 if (!layer->frames().is_empty()) {
1351 const int cfra = scene->
r.
cfra;
1352 const char *msg_pin =
" (Soloed)";
1353 const char *msg_sep =
" : ";
1354 const char *msg_space =
" ";
1358 const char *info_array[16];
1365 SNPRINTF(info_buffers.frame,
"(%d)", cfra);
1366 info_array[
i++] = info_buffers.frame;
1371 info_array[
i++] = msg_space;
1373 if (ob !=
nullptr) {
1374 info_array[
i++] =
" |";
1392 info_array[
i++] = msg_space;
1393 info_array[
i++] = ob->
id.
name + 2;
1397 if (
const ID *data_id =
static_cast<const ID *
>(ob->
data)) {
1398 info_array[
i++] =
" | ";
1399 info_array[
i++] = data_id->name + 2;
1410 info_array[
i++] = msg_sep;
1418 info_array[
i++] = msg_sep;
1433 info_array[
i++] = msg_sep;
1444 info_array[
i++] = msg_sep;
1445 info_array[
i++] = kb->
name;
1447 info_array[
i++] =
IFACE_(msg_pin);
1466 info_array[
i++] =
" <";
1467 info_array[
i++] = markern;
1468 info_array[
i++] =
">";
1473 info_array[
i++] =
IFACE_(
" (Viewer)");
1492 const char *grid_unit =
nullptr;
1496 char numstr[32] =
"";
1497 if (v3d->
grid != 1.0f) {
1502 BLF_draw_default(xoffset, *yoffset, 0.0f, numstr[0] ? numstr : grid_unit,
sizeof(numstr));
1516#ifdef WITH_INPUT_NDOF
1522 draw_ndof_guide_orbit_axis(rv3d);
1535 draw_ndof_guide_orbit_center(rv3d);
1570 int xoffset = rect->
xmin + (0.5f *
U.widget_unit);
1571 int yoffset = rect->
ymax - (0.1f *
U.widget_unit);
1579 float text_color[4], shadow_color[4];
1703 const float winmat[4][4],
1704 const char *viewname)
1708 float viewmat[4][4];
1715 float viewmat[4][4];
1730 const float viewmat[4][4],
1731 const float winmat[4][4],
1732 bool is_image_render,
1734 const char *viewname,
1735 const bool do_color_management,
1736 const bool restore_rv3d_mats,
1754 int region_winx, region_winy;
1766 orig.v3d_camera = v3d->
camera;
1767 orig.v3d_lens = v3d->
lens;
1768 orig.region_winx = region->
winx;
1769 orig.region_winy = region->
winy;
1770 orig.region_winrct = region->
winrct;
1771 orig.rv3d_persp = rv3d->
persp;
1778 region->
winx = winx;
1779 region->
winy = winy;
1813 if ((viewname !=
nullptr && viewname[0] !=
'\0') && (viewmat ==
nullptr) &&
1833 do_color_management,
1841 region->
winx = orig.region_winx;
1842 region->
winy = orig.region_winy;
1843 region->
winrct = orig.region_winrct;
1847 if (restore_rv3d_mats) {
1851 rv3d->
persp = orig.rv3d_persp;
1856 v3d->
camera = orig.v3d_camera;
1857 v3d->
lens = orig.v3d_lens;
1866 int object_type_exclude_viewport_override,
1867 int object_type_exclude_select_override,
1871 const float viewmat[4][4],
1872 const float winmat[4][4],
1876 bool is_image_render,
1878 const char *viewname,
1879 const bool do_color_management,
1883 View3D v3d = blender::dna::shallow_zero_initialize();
1895 source_shading_settings = shading_override;
1900 if (shading_override) {
1938 if ((object_type_exclude_viewport_override & (1 <<
OB_ARMATURE)) != 0) {
1944 if (is_xr_surface) {
1974 do_color_management,
1992 const char *viewname,
1993 const bool restore_rv3d_mats,
1996 const bool use_camera_view_bounds,
2001 const bool draw_sky = (alpha_mode ==
R_ADDSKY);
2004 bool is_ortho =
false;
2023 const bool own_ofs = (ofs ==
nullptr);
2035 if (ofs ==
nullptr) {
2061 is_ortho =
params.is_ortho;
2066 float clip_start, clipend;
2069 depsgraph, v3d, rv3d, sizex, sizey, &viewplane, &clip_start, &clipend,
nullptr);
2113 do_color_management,
2155 const char *viewname,
2160 View3D v3d = blender::dna::shallow_zero_initialize();
2163 region.
runtime = ®ion_runtime;
2174 source_shading_settings = shading_override;
2350 GPUFrameBuffer *depth_read_fb =
nullptr;
2406 if (
w <= 0 || h <= 0) {
2435 uint32_t *int_depths =
static_cast<uint32_t *
>(
2439 d->
depths = (
float *)int_depths;
2441 int pixel_count = d->
w * d->
h;
2442 for (
int i = 0;
i < pixel_count;
i++) {
2443 d->
depths[
i] = (int_depths[
i] >> 8u) /
float(0xFFFFFF);
2457 float far = far_real;
2459 const float *depths = d->
depths;
2461 int i = int(d->
w) * int(d->
h);
2467 if ((depth < far) && (depth > near)) {
2472 return far == far_real ?
FLT_MAX : far;
2485 if (!r_depths || *r_depths !=
nullptr) {
2494 int flag2 = v3d->
flag2;
2499 use_overlay =
false;
2530 if (viewport !=
nullptr) {
2579#ifdef REUSE_DEPTH_BUFFER
2600 return is_viewport_preview_solid || is_viewport_preview_material || is_viewport_wire_no_xray ||
2601 is_viewport_render_eevee || is_viewport_render_workbench ||
2602 is_viewport_render_external_with_overlay;
2640 switch (obact->
type) {
2642 switch (obact->
mode) {
2667 scene, view_layer,
static_cast<View3D *
>(area->spacedata.first), r_cddata_masks);
2743 printable[0] =
'\0';
2745 bool show_fractional =
state.fps_target_is_fractional;
2750 if (
state.fps_average + 0.5f <
state.fps_target) {
2752 show_fractional =
true;
2764 if (show_fractional) {
2841 if (viewport ==
nullptr) {
2846 if (color_tex ==
nullptr) {
2862 if (tex ==
nullptr) {
2875 if (tex ==
nullptr || data ==
nullptr) {
2900 if (data !=
nullptr) {
2903 if (tex !=
nullptr) {
C++ functions to deal with Armature collections (i.e. the successor of bone layers).
bool ANIM_bonecoll_is_visible_actbone(const bArmature *armature)
Functions to insert, delete or modify keyframes.
Camera data-block and utility functions.
void BKE_camera_multiview_params(const struct RenderData *rd, struct CameraParams *params, const struct Object *camera, const char *viewname)
float BKE_camera_multiview_shift_x(const struct RenderData *rd, const struct Object *camera, const char *viewname)
struct Object * BKE_camera_multiview_render(const struct Scene *scene, struct Object *camera, const char *viewname)
int BKE_camera_sensor_fit(int sensor_fit, float sizex, float sizey)
void BKE_camera_params_init(CameraParams *params)
void BKE_camera_multiview_view_matrix(const struct RenderData *rd, const struct Object *camera, bool is_left, float r_viewmat[4][4])
void BKE_camera_params_from_view3d(CameraParams *params, const struct Depsgraph *depsgraph, const struct View3D *v3d, const struct RegionView3D *rv3d)
void BKE_camera_params_from_object(CameraParams *params, const struct Object *cam_ob)
void BKE_camera_params_compute_viewplane(CameraParams *params, int winx, int winy, float aspx, float aspy)
void BKE_camera_params_compute_matrix(CameraParams *params)
const char * BKE_collection_ui_name_get(Collection *collection)
Depsgraph * CTX_data_expect_evaluated_depsgraph(const bContext *C)
WorkSpace * CTX_wm_workspace(const bContext *C)
wmWindow * CTX_wm_window(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
Main * CTX_data_main(const bContext *C)
wmWindowManager * CTX_wm_manager(const bContext *C)
View3D * CTX_wm_view3d(const bContext *C)
ViewLayer * CTX_data_view_layer(const bContext *C)
CustomData interface, see also DNA_customdata_types.h.
void CustomData_MeshMasks_update(CustomData_MeshMasks *mask_dst, const CustomData_MeshMasks *mask_src)
const CustomData_MeshMasks CD_MASK_BAREMESH
Low-level operations for grease pencil.
void BKE_image_free_anim_gputextures(Main *bmain)
void BKE_image_free_old_gputextures(Main *bmain)
Key * BKE_key_from_object(Object *ob)
void BKE_view_layer_synced_ensure(const Scene *scene, ViewLayer *view_layer)
LayerCollection * BKE_view_layer_active_collection_get(ViewLayer *view_layer)
Object * BKE_view_layer_active_object_get(const ViewLayer *view_layer)
Base * BKE_view_layer_base_find(ViewLayer *view_layer, Object *ob)
General operations, lookup, etc. for blender objects.
Object * BKE_object_pose_armature_get(Object *ob)
bool BKE_paint_select_face_test(const Object *ob)
bool BKE_scene_multiview_is_stereo3d(const RenderData *rd)
bool BKE_scene_uses_blender_workbench(const Scene *scene)
bool BKE_scene_uses_blender_eevee(const Scene *scene)
const char * BKE_scene_find_marker_name(const Scene *scene, int frame)
void BKE_unit_system_get(int system, int type, const void **r_usys_pt, int *r_len)
const char * BKE_unit_display_name_get(const void *usys_pt, int index)
int BKE_unit_base_get(const void *usys_pt)
double BKE_unit_scalar_get(const void *usys_pt, int index)
void BKE_viewer_path_copy(ViewerPath *dst, const ViewerPath *src)
void BKE_viewer_path_clear(ViewerPath *viewer_path)
bool BKE_viewer_path_equal(const ViewerPath *a, const ViewerPath *b, ViewerPathEqualFlag flag=ViewerPathEqualFlag(0))
void BLF_shadow(int fontid, FontShadowType type, const float rgba[4]=nullptr)
void BLF_color4fv(int fontid, const float rgba[4])
void BLF_shadow_offset(int fontid, int x, int y)
void BLF_batch_draw_begin()
void BLF_disable(int fontid, int option)
void BLF_batch_draw_end()
void BLF_default_size(float size)
void BLF_enable(int fontid, int option)
void BLF_draw_default(float x, float y, float z, const char *str, size_t str_len) ATTR_NONNULL()
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define LISTBASE_FOREACH(type, var, list)
BLI_INLINE bool BLI_listbase_is_empty(const ListBase *lb)
MINLINE int min_ii(int a, int b)
MINLINE float min_ff(float a, float b)
MINLINE int max_ii(int a, int b)
void hsv_to_rgb_v(const float hsv[3], float r_rgb[3])
void rgb_to_hsv_v(const float rgb[3], float r_hsv[3])
void orthographic_m4(float mat[4][4], float left, float right, float bottom, float top, float nearClip, float farClip)
void perspective_m4(float mat[4][4], float left, float right, float bottom, float top, float nearClip, float farClip)
MINLINE float plane_point_side_v3(const float plane[4], const float co[3])
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
void copy_m4_m4(float m1[4][4], const float m2[4][4])
bool invert_m4_m4(float inverse[4][4], const float mat[4][4])
void normalize_m4(float R[4][4]) ATTR_NONNULL()
void axis_angle_to_quat(float r[4], const float axis[3], float angle)
void mul_qt_v3(const float q[4], float r[3])
MINLINE void copy_v4_v4(float r[4], const float a[4])
void axis_sort_v3(const float axis_values[3], int r_axis_order[3])
MINLINE float len_squared_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void negate_v3_v3(float r[3], const float a[3])
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void mul_v3_v3fl(float r[3], const float a[3], float f)
MINLINE void add_v3_v3(float r[3], const float a[3])
bool BLI_rcti_isect_pt_v(const struct rcti *rect, const int xy[2])
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
void BLI_rcti_translate(struct rcti *rect, int x, int y)
void BLI_rcti_init(struct rcti *rect, int xmin, int xmax, int ymin, int ymax)
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)
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
#define SNPRINTF(dst, format,...)
#define BLI_STR_UTF8_MULTIPLICATION_SIGN
size_t BLI_string_join_array(char *result, size_t result_maxncpy, const char *strings[], uint strings_num) ATTR_NONNULL()
void size_t BLI_string_len_array(const char *strings[], uint strings_num) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void BLI_thread_unlock(int type)
void BLI_thread_lock(int type)
#define UNUSED_VARS_NDEBUG(...)
#define SET_FLAG_FROM_TEST(value, test, flag)
Scene * DEG_get_evaluated_scene(const Depsgraph *graph)
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
@ BASE_ENABLED_AND_MAYBE_VISIBLE_IN_VIEWPORT
Object is a sort of wrapper for general info.
#define STEREO_RIGHT_NAME
@ SCE_VIEWS_FORMAT_STEREO_3D
@ SCE_VIEWS_FORMAT_MULTIVIEW
#define NDOF_IS_ORBIT_AROUND_CENTER_MODE(userdef)
@ NDOF_SHOW_GUIDE_ORBIT_AXIS
@ NDOF_SHOW_GUIDE_ORBIT_CENTER
@ USER_MINI_AXIS_TYPE_GIZMO
@ USER_MINI_AXIS_TYPE_MINIMAL
@ USER_MINI_AXIS_TYPE_NONE
@ V3D_OFSDRAW_SHOW_OBJECT_EXTRAS
@ V3D_OFSDRAW_OVERRIDE_SCENE_SETTINGS
@ V3D_OFSDRAW_XR_SHOW_CUSTOM_OVERLAYS
@ V3D_OFSDRAW_SHOW_GRIDFLOOR
@ V3D_OFSDRAW_XR_SHOW_PASSTHROUGH
@ V3D_OFSDRAW_SHOW_ANNOTATION
@ V3D_OFSDRAW_SHOW_SELECTION
@ V3D_OFSDRAW_XR_SHOW_CONTROLLERS
@ V3D_SHADING_BACKGROUND_WORLD
@ V3D_SHADING_TEXTURE_COLOR
@ V3D_SHADING_VERTEX_COLOR
#define RV3D_VIEW_IS_AXIS(view)
#define RV3D_LOCK_FLAGS(rv3d)
@ V3D_GIZMO_HIDE_NAVIGATE
@ V3D_SHOW_CAMERA_PASSEPARTOUT
@ V3D_XR_SHOW_CUSTOM_OVERLAYS
@ V3D_XR_SHOW_PASSTHROUGH
@ V3D_XR_SHOW_CONTROLLERS
@ V3D_OVERLAY_EDIT_WEIGHT
@ RV3D_VIEW_AXIS_ROLL_180
@ V3D_SHADING_SCENE_WORLD_RENDER
@ V3D_SHADING_SCENE_WORLD
@ V3D_SHADING_SCENE_LIGHTS
@ V3D_SHADING_SCENE_LIGHTS_RENDER
@ V3D_RUNTIME_DEPTHBUF_OVERRIDDEN
@ V3D_OVERLAY_HIDE_OBJECT_ORIGINS
@ V3D_OVERLAY_HIDE_MOTION_PATHS
@ V3D_OVERLAY_HIDE_OBJECT_XTRAS
@ V3D_OVERLAY_HIDE_CURSOR
void DRW_draw_region_engine_info(int xoffset, int *yoffset, int line_height)
bool DRW_draw_in_progress()
void DRW_draw_view(const bContext *C)
void DRW_gpu_context_disable()
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)
void DRW_cache_free_old_batches(Main *bmain)
void DRW_draw_render_loop_offscreen(Depsgraph *depsgraph, RenderEngineType *engine_type, ARegion *region, View3D *v3d, bool is_image_render, bool draw_background, bool do_color_management, GPUOffScreen *ofs, GPUViewport *viewport)
void DRW_gpu_context_enable()
void DRW_select_buffer_context_create(Depsgraph *depsgraph, blender::Span< Base * > bases, short select_mode)
void ED_info_draw_stats(Main *bmain, Scene *scene, ViewLayer *view_layer, View3D *v3d_local, int x, int *y, int height)
bool ED_scene_fps_average_calc(const Scene *scene, SceneFPS_State *r_state) ATTR_NONNULL(1
const rcti * ED_region_visible_rect(ARegion *region)
bScreen * ED_screen_animation_no_scrub(const wmWindowManager *wm)
void ED_region_pixelspace(const ARegion *region)
#define XRAY_ENABLED(v3d)
@ V3D_DEPTH_SELECTED_ONLY
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)
void ED_view3d_text_colors_get(const Scene *scene, const View3D *v3d, float r_text_color[4], float r_shadow_color[4])
#define GPU_ATTACHMENT_TEXTURE(_texture)
GPUFrameBuffer * GPU_framebuffer_active_get()
int GPU_offscreen_width(const GPUOffScreen *offscreen)
void GPU_offscreen_bind(GPUOffScreen *offscreen, bool save)
void GPU_framebuffer_restore()
void GPU_framebuffer_read_depth(GPUFrameBuffer *fb, int x, int y, int width, int height, eGPUDataFormat data_format, void *r_data)
#define GPU_ATTACHMENT_NONE
int GPU_offscreen_height(const GPUOffScreen *offscreen)
GPUOffScreen * GPU_offscreen_create(int width, int height, bool with_depth_buffer, eGPUTextureFormat format, eGPUTextureUsage usage, bool clear, char err_out[256])
void GPU_framebuffer_free(GPUFrameBuffer *fb)
void GPU_framebuffer_bind(GPUFrameBuffer *fb)
void GPU_offscreen_free(GPUOffScreen *offscreen)
eGPUTextureFormat GPU_offscreen_format(const GPUOffScreen *offscreen)
#define GPU_framebuffer_ensure_config(_fb,...)
void GPU_offscreen_read_color(GPUOffScreen *offscreen, eGPUDataFormat data_format, void *r_data)
void GPU_offscreen_unbind(GPUOffScreen *offscreen, bool restore)
void GPU_matrix_identity_set()
#define GPU_matrix_set(x)
void GPU_matrix_push_projection()
void GPU_matrix_pop_projection()
#define GPU_matrix_projection_set(x)
@ GPU_SHADER_3D_SMOOTH_COLOR
@ GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR
@ GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA
@ GPU_SHADER_3D_UNIFORM_COLOR
@ GPU_SHADER_3D_FLAT_COLOR
void GPU_memory_barrier(eGPUBarrier barrier)
void GPU_blend(eGPUBlend blend)
void GPU_line_width(float width)
void GPU_line_smooth(bool enable)
void GPU_depth_mask(bool depth)
@ GPU_BARRIER_TEXTURE_UPDATE
void GPU_depth_test(eGPUDepthTest test)
void GPU_viewport_size_get_f(float coords[4])
int GPU_texture_height(const GPUTexture *texture)
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)
int GPU_texture_width(const GPUTexture *texture)
void GPU_texture_copy(GPUTexture *dst, GPUTexture *src)
void * GPU_texture_read(GPUTexture *texture, eGPUDataFormat data_format, int mip_level)
@ GPU_TEXTURE_USAGE_SHADER_READ
@ GPU_TEXTURE_USAGE_HOST_READ
GPUTexture * GPU_viewport_color_texture(GPUViewport *viewport, int view)
GPUTexture * GPU_viewport_depth_texture(GPUViewport *viewport)
void GPU_viewport_tag_update(GPUViewport *viewport)
static double angle(const Eigen::Vector3d &v1, const Eigen::Vector3d &v2)
void IMB_byte_from_float(ImBuf *ibuf)
ImBuf * IMB_allocImBuf(unsigned int x, unsigned int y, unsigned char planes, unsigned int flags)
Read Guarded memory(de)allocation.
void UI_draw_safe_areas(uint pos, const rctf *rect, const float title_aspect[2], const float action_aspect[2])
void UI_fontstyle_set(const uiFontStyle *fs)
#define UI_DEFAULT_TEXT_POINTS
void UI_Theme_Store(bThemeState *theme_state)
void UI_Theme_Restore(const bThemeState *theme_state)
void UI_GetThemeColorShade3fv(int colorid, int offset, float col[3])
void UI_GetThemeColor4fv(int colorid, float col[4])
void UI_FontThemeColor(int fontid, int colorid)
void UI_SetTheme(int spacetype, int regionid)
BMesh const char void * data
ATTR_WARN_UNUSED_RESULT const BMVert * v2
BPy_StructRNA * depsgraph
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
bool init(ARegion *region)
~ViewportColorSampleSession()
bool sample(const int mval[2], float r_col[3])
static float is_left(const float p0[2], const float p1[2], const float p2[2])
uchar view3d_camera_border_hack_col[3]
bool view3d_camera_border_hack_test
VecBase< float, D > step(VecOp< float, D >, VecOp< float, D >) RET
#define CD_MASK_PROP_BYTE_COLOR
#define CD_MASK_PROP_COLOR
#define CD_MASK_MDEFORMVERT
#define CD_MASK_PROP_FLOAT2
RenderEngineType * RE_engines_find(const char *idname)
void * MEM_mallocN(size_t len, 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)
bool id_frame_has_keyframe(ID *id, float frame)
void DRW_cache_free_old_subdiv()
MatBase< T, NumCol, NumRow > scale(const MatBase< T, NumCol, NumRow > &mat, const VectorT &scale)
float half_to_float(uint16_t v)
VecBase< float, 4 > float4
blender::VecBase< uint16_t, 4 > ushort4
const char * RE_engine_id_BLENDER_EEVEE_NEXT
const char * RE_engine_id_BLENDER_WORKBENCH
ARegionRuntimeHandle * runtime
ImBufFloatBuffer float_buffer
ImBufByteBuffer byte_buffer
struct Collection * collection
void(* view_draw)(struct RenderEngine *engine, const struct bContext *context, struct Depsgraph *depsgraph)
void(* view_update)(struct RenderEngine *engine, const struct bContext *context, struct Depsgraph *depsgraph)
struct SceneDisplay display
struct DisplaySafeAreas safe_areas
float wireframe_threshold
float gpencil_vertex_paint_opacity
int object_type_exclude_select
struct Object * ob_center
int object_type_exclude_viewport
struct EditBone * act_edbone
XrSessionSettings session_settings
static void draw_background(const rcti *rect)
static void draw_viewport_name(ARegion *region, View3D *v3d, int xoffset, int *yoffset)
void ED_view3d_calc_camera_border_size(const Scene *scene, Depsgraph *depsgraph, const ARegion *region, const View3D *v3d, const RegionView3D *rv3d, float r_size[2])
static void draw_selected_name(const View3D *v3d, Scene *scene, ViewLayer *view_layer, Object *ob, int xoffset, int *yoffset)
void ED_view3d_datamask(const Scene *scene, ViewLayer *view_layer, const View3D *v3d, CustomData_MeshMasks *r_cddata_masks)
RV3DMatrixStore * ED_view3d_mats_rv3d_backup(RegionView3D *rv3d)
float ED_view3d_grid_scale(const Scene *scene, const View3D *v3d, const char **r_grid_unit)
static void view3d_draw_border(const bContext *C, ARegion *region)
static void drawviewborder(Scene *scene, Depsgraph *depsgraph, ARegion *region, View3D *v3d)
float ED_view3d_grid_view_scale(const Scene *scene, const View3D *v3d, const ARegion *region, const char **r_grid_unit)
void ED_view3d_depth_override(Depsgraph *depsgraph, ARegion *region, View3D *v3d, Object *, eV3DDepthOverrideMode mode, bool use_overlay, ViewDepths **r_depths)
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)
ImBuf * ED_view3d_draw_offscreen_imbuf_simple(Depsgraph *depsgraph, Scene *scene, View3DShading *shading_override, eDrawType drawtype, Object *camera, int width, int height, eImBufFlags imbuf_flag, eV3DOffscreenDrawFlag draw_flags, int alpha_mode, const char *viewname, GPUOffScreen *ofs, GPUViewport *viewport, char err_out[256])
static bool view3d_stereo3d_active(wmWindow *win, const Scene *scene, View3D *v3d, RegionView3D *rv3d)
static void view3d_update_viewer_path(const bContext *C)
void view3d_draw_region_info(const bContext *C, ARegion *region)
void ED_view3d_screen_datamask(const Scene *scene, ViewLayer *view_layer, const bScreen *screen, CustomData_MeshMasks *r_cddata_masks)
static void view3d_gpu_read_Z_pixels(GPUViewport *viewport, rcti *rect, void *data)
ImBuf * ED_view3d_draw_offscreen_imbuf(Depsgraph *depsgraph, Scene *scene, eDrawType drawtype, View3D *v3d, ARegion *region, int sizex, int sizey, eImBufFlags imbuf_flag, int alpha_mode, const char *viewname, const bool restore_rv3d_mats, GPUOffScreen *ofs, GPUViewport *viewport, const bool use_camera_view_bounds, char err_out[256])
static void validate_object_select_id(Depsgraph *depsgraph, const Scene *scene, ViewLayer *view_layer, ARegion *region, View3D *v3d, Object *obact)
bool ED_view3d_draw_offscreen_check_nested()
static void view3d_stereo3d_setup(Depsgraph *depsgraph, Scene *scene, View3D *v3d, ARegion *region, const rcti *rect)
void view3d_main_region_draw(const bContext *C, 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)
static void view3d_camera_border(const Scene *scene, const Depsgraph *depsgraph, const ARegion *region, const View3D *v3d, const RegionView3D *rv3d, rctf *r_viewborder, const bool no_shift, const bool no_zoom)
void view3d_depths_rect_create(ARegion *region, rcti *rect, ViewDepths *r_d)
static ViewDepths * view3d_depths_create(ARegion *region)
bool ED_view3d_has_depth_buffer_updated(const Depsgraph *depsgraph, const View3D *v3d)
void ED_view3d_select_id_validate(const ViewContext *vc)
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])
static void view3d_draw_grease_pencil(const bContext *)
float view3d_depth_near(ViewDepths *d)
#define VIEW3D_OVERLAY_LINEHEIGHT
void ED_view3d_grid_steps(const Scene *scene, const View3D *v3d, const RegionView3D *rv3d, float r_grid_steps[STEPS_LEN])
void ED_view3D_mats_rv3d_free(RV3DMatrixStore *rv3d_mat)
static bool view3d_clipping_test(const float co[3], const float clip[6][4])
void ED_view3d_calc_camera_border(const Scene *scene, const Depsgraph *depsgraph, const ARegion *region, const View3D *v3d, const RegionView3D *rv3d, const bool no_shift, rctf *r_viewborder)
static void view3d_draw_view(const bContext *C, ARegion *region)
void ED_view3d_mats_rv3d_restore(RegionView3D *rv3d, RV3DMatrixStore *rv3dmat_pt)
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)
static void draw_grid_unit_name(Scene *scene, ARegion *region, View3D *v3d, int xoffset, int *yoffset)
int ED_view3d_backbuf_sample_size_clamp(ARegion *region, const float dist)
void ED_view3d_depths_free(ViewDepths *depths)
void ED_view3d_draw_offscreen(Depsgraph *depsgraph, const Scene *scene, eDrawType drawtype, View3D *v3d, ARegion *region, int winx, int winy, const float viewmat[4][4], const float winmat[4][4], bool is_image_render, bool draw_background, const char *viewname, const bool do_color_management, const bool restore_rv3d_mats, GPUOffScreen *ofs, GPUViewport *viewport)
static const char * view3d_get_name(View3D *v3d, RegionView3D *rv3d)
static bool view3d_main_region_do_render_draw(const Scene *scene)
bool ED_view3d_clipping_test(const RegionView3D *rv3d, const float co[3], const bool is_local)
static void draw_view_axis(RegionView3D *rv3d, const rcti *rect)
static void drawviewborder_grid3(uint shdr_pos, float x1, float x2, float y1, float y2, float fac)
static void drawviewborder_triangle(uint shdr_pos, float x1, float x2, float y1, float y2, const char golden, const char dir)
RenderEngineType * ED_view3d_engine_type(const Scene *scene, int drawtype)
bool ED_view3d_calc_render_border(const Scene *scene, Depsgraph *depsgraph, View3D *v3d, ARegion *region, rcti *r_rect)
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)
#define M_GOLDEN_RATIO_CONJUGATE
void ED_view3d_draw_offscreen_simple(Depsgraph *depsgraph, Scene *scene, View3DShading *shading_override, eDrawType drawtype, int object_type_exclude_viewport_override, int object_type_exclude_select_override, int winx, int winy, uint draw_flags, const float viewmat[4][4], const float winmat[4][4], float clip_start, float clip_end, bool is_xr_surface, bool is_image_render, bool draw_background, const char *viewname, const bool do_color_management, GPUOffScreen *ofs, GPUViewport *viewport)
void ED_scene_draw_fps(const Scene *scene, int xoffset, int *yoffset)
static void drawrenderborder(ARegion *region, View3D *v3d)
static bool is_grease_pencil_with_layer_keyframe(const Object &ob)
float ED_scene_grid_scale(const Scene *scene, const char **r_grid_unit)
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 view3d_viewmatrix_set(const Depsgraph *depsgraph, const Scene *scene, const View3D *v3d, RegionView3D *rv3d, const float rect_scale[2])
void view3d_winmatrix_set(const Depsgraph *depsgraph, ARegion *region, const View3D *v3d, const rcti *rect)
void WM_draw_region_viewport_unbind(ARegion *region)
void WM_draw_region_viewport_ensure(Scene *scene, ARegion *region, short space_type)
GPUViewport * WM_draw_region_get_viewport(ARegion *region)
void WM_draw_region_viewport_bind(ARegion *region)
bool WM_stereo3d_enabled(wmWindow *win, bool skip_stereo3d_check)
bool WM_xr_session_state_viewer_pose_matrix_info_get(const wmXrData *xr, float r_viewmat[4][4], float *r_focal_len)