Blender V4.3
view3d_draw.cc File Reference
#include <cmath>
#include "BLI_listbase.h"
#include "BLI_math_half.hh"
#include "BLI_math_matrix.h"
#include "BLI_math_rotation.h"
#include "BLI_rect.h"
#include "BLI_string.h"
#include "BLI_string_utils.hh"
#include "BLI_threads.h"
#include "BKE_armature.hh"
#include "BKE_camera.h"
#include "BKE_collection.hh"
#include "BKE_context.hh"
#include "BKE_customdata.hh"
#include "BKE_global.hh"
#include "BKE_image.hh"
#include "BKE_key.hh"
#include "BKE_layer.hh"
#include "BKE_main.hh"
#include "BKE_object.hh"
#include "BKE_paint.hh"
#include "BKE_scene.hh"
#include "BKE_unit.hh"
#include "BLF_api.hh"
#include "BLT_translation.hh"
#include "DNA_armature_types.h"
#include "DNA_camera_types.h"
#include "DNA_key_types.h"
#include "DNA_object_types.h"
#include "DNA_view3d_types.h"
#include "DNA_windowmanager_types.h"
#include "DRW_engine.hh"
#include "DRW_select_buffer.hh"
#include "ED_gpencil_legacy.hh"
#include "ED_info.hh"
#include "ED_keyframing.hh"
#include "ED_scene.hh"
#include "ED_screen.hh"
#include "ED_view3d_offscreen.hh"
#include "ED_viewer_path.hh"
#include "ANIM_bone_collections.hh"
#include "DEG_depsgraph_query.hh"
#include "GPU_batch.hh"
#include "GPU_framebuffer.hh"
#include "GPU_immediate.hh"
#include "GPU_immediate_util.hh"
#include "GPU_material.hh"
#include "GPU_matrix.hh"
#include "GPU_state.hh"
#include "GPU_viewport.hh"
#include "MEM_guardedalloc.h"
#include "UI_interface.hh"
#include "UI_resources.hh"
#include "RE_engine.h"
#include "WM_api.hh"
#include "WM_types.hh"
#include "IMB_imbuf.hh"
#include "IMB_imbuf_types.hh"
#include "view3d_intern.hh"

Go to the source code of this file.

Classes

struct  RV3DMatrixStore
 

Macros

#define M_GOLDEN_RATIO_CONJUGATE   0.618033988749895f
 
#define VIEW3D_OVERLAY_LINEHEIGHT   (UI_style_get()->widget.points * UI_SCALE_FAC * 1.6f)
 

Functions

General Functions
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)
 
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)
 
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 bool view3d_stereo3d_active (wmWindow *win, const Scene *scene, View3D *v3d, RegionView3D *rv3d)
 
static void view3d_stereo3d_setup (Depsgraph *depsgraph, Scene *scene, View3D *v3d, ARegion *region, const rcti *rect)
 
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)
 
Draw View Border
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 ED_view3d_calc_camera_border_size (const Scene *scene, Depsgraph *depsgraph, const ARegion *region, const View3D *v3d, const RegionView3D *rv3d, float r_size[2])
 
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 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)
 
static void drawviewborder (Scene *scene, Depsgraph *depsgraph, ARegion *region, View3D *v3d)
 
static void drawrenderborder (ARegion *region, View3D *v3d)
 
Draw Text & Info
static void view3d_draw_grease_pencil (const bContext *)
 
static const char * view3d_get_name (View3D *v3d, RegionView3D *rv3d)
 
static void draw_viewport_name (ARegion *region, View3D *v3d, int xoffset, int *yoffset)
 
static void draw_selected_name (const View3D *v3d, Scene *scene, ViewLayer *view_layer, Object *ob, int xoffset, int *yoffset)
 
static void draw_grid_unit_name (Scene *scene, ARegion *region, View3D *v3d, int xoffset, int *yoffset)
 
void view3d_draw_region_info (const bContext *C, ARegion *region)
 
Draw Viewport Contents
static void view3d_draw_view (const bContext *C, ARegion *region)
 
RenderEngineTypeED_view3d_engine_type (const Scene *scene, int drawtype)
 
static void view3d_update_viewer_path (const bContext *C)
 
void view3d_main_region_draw (const bContext *C, ARegion *region)
 
Off-screen Drawing
static void view3d_stereo3d_setup_offscreen (Depsgraph *depsgraph, const Scene *scene, View3D *v3d, ARegion *region, const float winmat[4][4], const char *viewname)
 
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)
 
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)
 
ImBufED_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, char err_out[256])
 
ImBufED_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])
 
bool ED_view3d_draw_offscreen_check_nested ()
 
Viewport Clipping
static bool view3d_clipping_test (const float co[3], const float clip[6][4])
 
bool ED_view3d_clipping_test (const RegionView3D *rv3d, const float co[3], const bool is_local)
 
Back-Draw for Selection
static void validate_object_select_id (Depsgraph *depsgraph, const Scene *scene, ViewLayer *view_layer, ARegion *region, View3D *v3d, Object *obact)
 
static void view3d_opengl_read_Z_pixels (GPUViewport *viewport, rcti *rect, void *data)
 
void ED_view3d_select_id_validate (const ViewContext *vc)
 
int ED_view3d_backbuf_sample_size_clamp (ARegion *region, const float dist)
 
Z-Depth Utilities
void view3d_depths_rect_create (ARegion *region, rcti *rect, ViewDepths *r_d)
 
static ViewDepthsview3d_depths_create (ARegion *region)
 
float view3d_depth_near (ViewDepths *d)
 
void ED_view3d_depth_override (Depsgraph *depsgraph, ARegion *region, View3D *v3d, Object *obact, eV3DDepthOverrideMode mode, ViewDepths **r_depths)
 
void ED_view3d_depths_free (ViewDepths *depths)
 
bool ED_view3d_has_depth_buffer_updated (const Depsgraph *depsgraph, const View3D *v3d)
 
Custom-data Utilities
void ED_view3d_datamask (const Scene *scene, ViewLayer *view_layer, const View3D *v3d, CustomData_MeshMasks *r_cddata_masks)
 
void ED_view3d_screen_datamask (const Scene *scene, ViewLayer *view_layer, const bScreen *screen, CustomData_MeshMasks *r_cddata_masks)
 
Region View Matrix Backup/Restore
RV3DMatrixStoreED_view3d_mats_rv3d_backup (RegionView3D *rv3d)
 
void ED_view3d_mats_rv3d_restore (RegionView3D *rv3d, RV3DMatrixStore *rv3dmat_pt)
 
FPS Drawing
void ED_scene_draw_fps (const Scene *scene, int xoffset, int *yoffset)
 
Calculate Render Border
static bool view3d_main_region_do_render_draw (const Scene *scene)
 
bool ED_view3d_calc_render_border (const Scene *scene, Depsgraph *depsgraph, View3D *v3d, ARegion *region, rcti *r_rect)
 

Other Elements

#define STEPS_LEN   8
 
float ED_scene_grid_scale (const Scene *scene, const char **r_grid_unit)
 
float ED_view3d_grid_scale (const Scene *scene, const View3D *v3d, 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 ED_view3d_grid_steps (const Scene *scene, const View3D *v3d, const RegionView3D *rv3d, float r_grid_steps[STEPS_LEN])
 
float ED_view3d_grid_view_scale (const Scene *scene, const View3D *v3d, const ARegion *region, const char **r_grid_unit)
 
static void draw_view_axis (RegionView3D *rv3d, const rcti *rect)
 
static void view3d_draw_border (const bContext *C, ARegion *region)
 

Macro Definition Documentation

◆ M_GOLDEN_RATIO_CONJUGATE

#define M_GOLDEN_RATIO_CONJUGATE   0.618033988749895f

Definition at line 87 of file view3d_draw.cc.

Referenced by drawviewborder(), and drawviewborder_triangle().

◆ STEPS_LEN

#define STEPS_LEN   8

Definition at line 858 of file view3d_draw.cc.

Referenced by ED_view3d_grid_view_scale(), and view3d_grid_steps_ex().

◆ VIEW3D_OVERLAY_LINEHEIGHT

#define VIEW3D_OVERLAY_LINEHEIGHT   (UI_style_get()->widget.points * UI_SCALE_FAC * 1.6f)

Function Documentation

◆ draw_grid_unit_name()

static void draw_grid_unit_name ( Scene * scene,
ARegion * region,
View3D * v3d,
int xoffset,
int * yoffset )
static

◆ draw_selected_name()

◆ draw_view_axis()

◆ draw_viewport_name()

◆ drawrenderborder()

◆ drawviewborder()

static void drawviewborder ( Scene * scene,
Depsgraph * depsgraph,
ARegion * region,
View3D * v3d )
static

Definition at line 530 of file view3d_draw.cc.

References BKE_camera_sensor_fit(), BLF_default(), BLF_draw_default(), CAM_DTX_CENTER, CAM_DTX_CENTER_DIAG, CAM_DTX_GOLDEN, CAM_DTX_GOLDEN_TRI_A, CAM_DTX_GOLDEN_TRI_B, CAM_DTX_HARMONY_TRI_A, CAM_DTX_HARMONY_TRI_B, CAM_DTX_THIRDS, CAM_SHOW_SAFE_CENTER, CAM_SHOW_SAFE_MARGINS, CAM_SHOWNAME, CAM_SHOWPASSEPARTOUT, CAM_SHOWSENSOR, View3D::camera, CAMERA_SENSOR_FIT_AUTO, CAMERA_SENSOR_FIT_HOR, Object::data, depsgraph, drawviewborder_grid3(), drawviewborder_triangle(), Camera::dtx, ED_view3d_calc_camera_border(), Camera::flag, View3DOverlay::flag, View3D::flag2, floorf, GPU_blend(), GPU_BLEND_ALPHA, GPU_BLEND_NONE, GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_line_width(), GPU_PRIM_LINES, GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR, GPU_SHADER_3D_UNIFORM_COLOR, GPU_vertformat_attr_add(), GPU_viewport_size_get_f(), Object::id, imm_draw_box_wire_2d(), immBegin(), immBindBuiltinProgram(), immEnd(), immRectf(), immUnbindProgram(), immUniform1f(), immUniform1i(), immUniform2f(), immUniformColor3f(), immUniformColor3ubv(), immUniformThemeColor(), immUniformThemeColor3(), immUniformThemeColorAlpha(), immUniformThemeColorShadeAlpha(), immVertex2f(), immVertexFormat(), int, M_GOLDEN_RATIO_CONJUGATE, ID::name, OB_CAMERA, View3D::overlay, Camera::passepartalpha, R_BORDER, Camera::sensor_fit, Camera::sensor_x, Camera::sensor_y, TH_BACK, TH_CAMERA_PASSEPARTOUT, TH_REDALERT, TH_TEXT_HI, TH_VIEW_OVERLAY, Object::type, UI_draw_safe_areas(), UI_FontThemeColor(), V3D_HIDE_OVERLAYS, V3D_LOCK_CAMERA, V3D_OVERLAY_HIDE_TEXT, V3D_SHOW_CAMERA_GUIDES, V3D_SHOW_CAMERA_PASSEPARTOUT, view3d_camera_border_hack_col, view3d_camera_border_hack_test, rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.

Referenced by view3d_draw_border().

◆ drawviewborder_grid3()

static void drawviewborder_grid3 ( uint shdr_pos,
float x1,
float x2,
float y1,
float y2,
float fac )
static

Definition at line 450 of file view3d_draw.cc.

References GPU_PRIM_LINES, immBegin(), immEnd(), and immVertex2f().

Referenced by drawviewborder().

◆ drawviewborder_triangle()

static void drawviewborder_triangle ( uint shdr_pos,
float x1,
float x2,
float y1,
float y2,
const char golden,
const char dir )
static

Definition at line 477 of file view3d_draw.cc.

References GPU_PRIM_LINES, immBegin(), immEnd(), immVertex2f(), M_GOLDEN_RATIO_CONJUGATE, and w().

Referenced by drawviewborder().

◆ ED_scene_draw_fps()

void ED_scene_draw_fps ( const Scene * scene,
int xoffset,
int * yoffset )

◆ ED_scene_grid_scale()

◆ ED_view3d_backbuf_sample_size_clamp()

int ED_view3d_backbuf_sample_size_clamp ( ARegion * region,
float dist )

allow for small values [0.5 - 2.5], and large values, FLT_MAX by clamping by the area size

Definition at line 2269 of file view3d_draw.cc.

References ceilf, int, max_ii(), and min_ff().

Referenced by EDBM_edge_find_nearest_ex(), EDBM_face_find_nearest_ex(), and EDBM_vert_find_nearest_ex().

◆ ED_view3d_calc_camera_border()

◆ ED_view3d_calc_camera_border_size()

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] )

◆ ED_view3d_calc_render_border()

◆ ED_view3d_clipping_test()

bool ED_view3d_clipping_test ( const RegionView3D * rv3d,
const float co[3],
bool is_local )

Return true when co is hidden by the 3D views clipping planes.

Parameters
is_localWhen true use local (object-space) ED_view3d_clipping_local must run first, then all comparisons can be done in local-space.
Returns
True when co is outside all clipping planes.
Note
Callers should check RV3D_CLIPPING_ENABLED first.

Definition at line 2179 of file view3d_draw.cc.

References RegionView3D::clip, RegionView3D::clip_local, and view3d_clipping_test().

Referenced by ed_view3d_project__internal(), blender::ed::sculpt_paint::filter_region_clip_factors(), blender::ed::sculpt_paint::filter_region_clip_factors(), find_nearest_edge__doClosest(), knife_bvh_raycast_cb(), knife_find_closest_edge_of_face(), knife_find_closest_vert_of_edge(), knife_sample_screen_density_from_closest_face(), point_is_visible(), project_paint_face_init(), and project_paint_occlude_ptv_clip().

◆ ED_view3d_datamask()

◆ ED_view3d_depth_override()

void ED_view3d_depth_override ( Depsgraph * depsgraph,
ARegion * region,
View3D * v3d,
Object * obact,
eV3DDepthOverrideMode mode,
ViewDepths ** r_depths )

◆ ED_view3d_depths_free()

◆ ED_view3d_draw_offscreen()

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 )

◆ ED_view3d_draw_offscreen_check_nested()

bool ED_view3d_draw_offscreen_check_nested ( )

Drawing off-screen is not supported while drawing, this is a simple check to use when the code path may occur within a draw call (Python scripting for example).

Definition at line 2158 of file view3d_draw.cc.

References DRW_draw_in_progress().

Referenced by pygpu_offscreen_draw_view3d().

◆ ED_view3d_draw_offscreen_imbuf()

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,
bool restore_rv3d_mats,
GPUOffScreen * ofs,
GPUViewport * viewport,
char err_out[256] )

Utility func for ED_view3d_draw_offscreen

Parameters
ofsOptional off-screen buffer, can be NULL. (avoids re-creating when doing multiple GL renders).
viewportOptional viewport data, can be NULL. (avoids re-creating when doing multiple GL renders, allows keeping track of state across frames).

Definition at line 1881 of file view3d_draw.cc.

References BKE_camera_multiview_params(), BKE_camera_multiview_render(), BKE_camera_params_compute_matrix(), BKE_camera_params_compute_viewplane(), BKE_camera_params_from_object(), BKE_camera_params_init(), ImBuf::byte_buffer, View3D::camera, View3D::clip_end, View3D::clip_start, copy_m4_m4(), ImBufByteBuffer::data, ImBufFloatBuffer::data, DEG_get_evaluated_object(), depsgraph, DRW_gpu_context_disable(), DRW_gpu_context_enable(), ED_view3d_draw_offscreen(), ED_view3d_viewplane_get(), ImBuf::float_buffer, GPU_DATA_FLOAT, GPU_DATA_UBYTE, GPU_framebuffer_active_get(), GPU_framebuffer_bind(), GPU_framebuffer_restore(), GPU_offscreen_bind(), GPU_offscreen_create(), GPU_offscreen_format(), GPU_offscreen_free(), GPU_offscreen_height(), GPU_offscreen_read_color(), GPU_offscreen_unbind(), GPU_offscreen_width(), GPU_RGBA16F, GPU_RGBA8, GPU_TEXTURE_USAGE_HOST_READ, GPU_TEXTURE_USAGE_SHADER_READ, IB_rectfloat, IMB_allocImBuf(), IMB_rect_from_float(), orthographic_m4(), params, RegionView3D::persp, perspective_m4(), R_ADDSKY, RV3D_CAMOB, rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.

Referenced by blend_file_thumb_from_camera(), ED_view3d_draw_offscreen_imbuf_simple(), screen_opengl_render_doit(), and texture_paint_image_from_view_exec().

◆ ED_view3d_draw_offscreen_imbuf_simple()

ImBuf * ED_view3d_draw_offscreen_imbuf_simple ( Depsgraph * depsgraph,
Scene * scene,
View3DShading * shading_override,
eDrawType drawtype,
Object * camera,
int width,
int height,
eImBufFlags imbuf_flags,
eV3DOffscreenDrawFlag draw_flags,
int alpha_mode,
const char * viewname,
GPUOffScreen * ofs,
GPUViewport * viewport,
char err_out[256] )

Creates separate fake 3d views (wrapping ED_view3d_draw_offscreen_imbuf)

Parameters
ofsOptional off-screen buffer can be NULL. (avoids re-creating when doing multiple GL renders).
viewportOptional viewport data, can be NULL. (avoids re-creating when doing multiple GL renders, allows keeping track of state across frames).
Note
used by the sequencer

Definition at line 2041 of file view3d_draw.cc.

References View3DShading::background_type, BKE_camera_multiview_params(), BKE_camera_multiview_render(), BKE_camera_params_compute_matrix(), BKE_camera_params_compute_viewplane(), BKE_camera_params_from_object(), BKE_camera_params_init(), BKE_scene_uses_blender_eevee(), BKE_scene_uses_blender_workbench(), camera, View3D::camera, View3D::clip_end, View3D::clip_start, View3DShading::color_type, copy_m4_m4(), DEG_get_evaluated_object(), depsgraph, ED_view3d_draw_offscreen_imbuf(), ListBase::first, View3DShading::flag, View3D::flag2, View3DOverlay::gpencil_vertex_paint_opacity, View3D::gridflag, invert_m4_m4(), ListBase::last, View3D::lens, View3DShading::light, mul_m4_m4m4(), normalize_m4(), OB_MATERIAL, OB_RENDER, OB_SOLID, OB_TEXTURE, View3D::overlay, params, RegionView3D::persinv, RegionView3D::persmat, RegionView3D::persp, View3D::regionbase, View3DShading::render_pass, RGN_TYPE_WINDOW, RV3D_CAMOB, SCE_PASS_COMBINED, View3D::shading, View3DShading::type, V3D_HIDE_OVERLAYS, V3D_LIGHTING_STUDIO, V3D_OFSDRAW_OVERRIDE_SCENE_SETTINGS, V3D_OFSDRAW_SHOW_ANNOTATION, V3D_OFSDRAW_SHOW_GRIDFLOOR, V3D_SHADING_BACKGROUND_WORLD, V3D_SHADING_SCENE_LIGHTS, V3D_SHADING_SCENE_LIGHTS_RENDER, V3D_SHADING_SCENE_WORLD, V3D_SHADING_SCENE_WORLD_RENDER, V3D_SHADING_TEXTURE_COLOR, V3D_SHOW_ANNOTATION, V3D_SHOW_FLOOR, V3D_SHOW_X, V3D_SHOW_Y, RegionView3D::viewinv, RegionView3D::viewmat, RegionView3D::winmat, View3DOverlay::wireframe_opacity, and View3DOverlay::wireframe_threshold.

Referenced by action_preview_render(), blend_file_thumb_from_camera(), ED_spacetype_sequencer(), object_preview_render(), and screen_opengl_render_doit().

◆ ED_view3d_draw_offscreen_simple()

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,
unsigned int 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,
bool do_color_management,
GPUOffScreen * ofs,
GPUViewport * viewport )

Creates separate fake 3d views (wrapping ED_view3d_draw_offscreen). Similar too #ED_view_draw_offscreen_imbuf_simple, but takes view/projection matrices as arguments.

Definition at line 1762 of file view3d_draw.cc.

References View3D::clip_end, View3D::clip_start, depsgraph, draw_background(), ED_view3d_draw_offscreen(), ListBase::first, View3D::flag, View3DOverlay::flag, View3DShading::flag, View3D::flag2, View3D::grid, View3D::gridflag, View3D::gridlines, View3D::gridsubdiv, ListBase::last, View3D::lens, OB_ARMATURE, OB_MATERIAL, View3D::object_type_exclude_select, View3D::object_type_exclude_viewport, View3D::overlay, RegionView3D::persp, View3D::regionbase, ARegion::regiondata, ARegion::regiontype, RGN_TYPE_WINDOW, RV3D_PERSP, View3D::shading, View3DShading::type, V3D_HIDE_HELPLINES, V3D_HIDE_OVERLAYS, V3D_OFSDRAW_NONE, V3D_OFSDRAW_OVERRIDE_SCENE_SETTINGS, V3D_OFSDRAW_SHOW_ANNOTATION, V3D_OFSDRAW_SHOW_GRIDFLOOR, V3D_OFSDRAW_SHOW_OBJECT_EXTRAS, V3D_OFSDRAW_SHOW_SELECTION, V3D_OFSDRAW_XR_SHOW_CONTROLLERS, V3D_OFSDRAW_XR_SHOW_CUSTOM_OVERLAYS, V3D_OFSDRAW_XR_SHOW_PASSTHROUGH, V3D_OVERLAY_HIDE_BONES, V3D_OVERLAY_HIDE_CURSOR, V3D_OVERLAY_HIDE_MOTION_PATHS, V3D_OVERLAY_HIDE_OBJECT_ORIGINS, V3D_OVERLAY_HIDE_OBJECT_XTRAS, V3D_OVERLAY_HIDE_TEXT, V3D_SELECT_OUTLINE, V3D_SHADING_SCENE_LIGHTS, V3D_SHADING_SCENE_WORLD, V3D_SHOW_ANNOTATION, V3D_SHOW_FLOOR, V3D_SHOW_X, V3D_SHOW_Y, V3D_XR_SESSION_SURFACE, V3D_XR_SHOW_CONTROLLERS, V3D_XR_SHOW_CUSTOM_OVERLAYS, and V3D_XR_SHOW_PASSTHROUGH.

Referenced by wm_xr_draw_view().

◆ ED_view3d_draw_setup_view()

◆ ED_view3d_engine_type()

◆ ED_view3d_grid_scale()

float ED_view3d_grid_scale ( const Scene * scene,
const View3D * v3d,
const char ** r_grid_unit )

◆ ED_view3d_grid_steps()

void ED_view3d_grid_steps ( const Scene * scene,
const View3D * v3d,
const RegionView3D * rv3d,
float r_grid_steps[STEPS_LEN] )

Definition at line 912 of file view3d_draw.cc.

References view3d_grid_steps_ex().

◆ ED_view3d_grid_view_scale()

float ED_view3d_grid_view_scale ( const Scene * scene,
const View3D * v3d,
const ARegion * region,
const char ** r_grid_unit )

Simulates the grid scale that is actually viewed. The actual code is seen in object_grid_frag.glsl (see grid_res). Currently the simulation is only done when RV3D_VIEW_IS_AXIS.

Definition at line 920 of file view3d_draw.cc.

References BKE_unit_display_name_get(), ED_view3d_grid_scale(), IFACE_, RegionView3D::is_persp, RV3D_VIEW_IS_AXIS, STEPS_LEN, RegionView3D::view, view3d_grid_steps_ex(), and RegionView3D::winmat.

Referenced by draw_grid_unit_name(), blender::ed::greasepencil::grease_pencil_snap_to_grid_exec(), idp_snap_calc_incremental(), snap_curs_to_grid_exec(), snap_object_context_runtime_init(), snap_sel_to_grid_exec(), and transform_snap_grid_init().

◆ ED_view3d_has_depth_buffer_updated()

◆ ED_view3d_mats_rv3d_backup()

◆ ED_view3d_mats_rv3d_restore()

◆ ED_view3d_screen_datamask()

void ED_view3d_screen_datamask ( const Scene * scene,
ViewLayer * view_layer,
const bScreen * screen,
CustomData_MeshMasks * r_cddata_masks )

Goes over all modes and view3d settings.

Definition at line 2539 of file view3d_draw.cc.

References CD_MASK_BAREMESH, CustomData_MeshMasks_update(), ED_view3d_datamask(), LISTBASE_FOREACH, and SPACE_VIEW3D.

Referenced by wm_event_do_depsgraph().

◆ ED_view3d_select_id_validate()

◆ ED_view3d_update_viewmat()

◆ validate_object_select_id()

◆ view3d_camera_border()

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 )
static

◆ view3d_clipping_test()

static bool view3d_clipping_test ( const float co[3],
const float clip[6][4] )
static

Definition at line 2169 of file view3d_draw.cc.

References plane_point_side_v3().

Referenced by ED_view3d_clipping_test().

◆ view3d_depth_near()

float view3d_depth_near ( ViewDepths * d)

Utility function to find the closest Z value, use for auto-depth.

Definition at line 2345 of file view3d_draw.cc.

References ViewDepths::depth_range, ViewDepths::depths, float, FLT_MAX, ViewDepths::h, int, and ViewDepths::w.

Referenced by view3d_zoom_border_exec(), and view_autodist_depth_margin().

◆ view3d_depths_create()

◆ view3d_depths_rect_create()

◆ view3d_draw_border()

static void view3d_draw_border ( const bContext * C,
ARegion * region )
static

◆ view3d_draw_grease_pencil()

static void view3d_draw_grease_pencil ( const bContext * )
static

Draw Info

Definition at line 1160 of file view3d_draw.cc.

Referenced by view3d_draw_region_info().

◆ view3d_draw_region_info()

void view3d_draw_region_info ( const bContext * C,
ARegion * region )

◆ view3d_draw_view()

static void view3d_draw_view ( const bContext * C,
ARegion * region )
static

◆ view3d_get_name()

◆ view3d_grid_steps_ex()

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 )
static

◆ view3d_main_region_do_render_draw()

static bool view3d_main_region_do_render_draw ( const Scene * scene)
static

Definition at line 2650 of file view3d_draw.cc.

References RE_engines_find().

Referenced by ED_view3d_calc_render_border().

◆ view3d_main_region_draw()

◆ view3d_main_region_setup_offscreen()

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

◆ view3d_main_region_setup_view()

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 )
static

◆ view3d_opengl_read_Z_pixels()

◆ view3d_stereo3d_active()

◆ view3d_stereo3d_setup()

◆ view3d_stereo3d_setup_offscreen()

static void view3d_stereo3d_setup_offscreen ( Depsgraph * depsgraph,
const Scene * scene,
View3D * v3d,
ARegion * region,
const float winmat[4][4],
const char * viewname )
static

◆ view3d_update_viewer_path()

static void view3d_update_viewer_path ( const bContext * C)
static