Blender  V3.3
view3d_draw.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2008 Blender Foundation. All rights reserved. */
3 
8 #include <math.h>
9 
10 #include "BLI_jitter_2d.h"
11 #include "BLI_listbase.h"
12 #include "BLI_math.h"
13 #include "BLI_rect.h"
14 #include "BLI_string.h"
15 #include "BLI_string_utils.h"
16 #include "BLI_threads.h"
17 
18 #include "BKE_armature.h"
19 #include "BKE_camera.h"
20 #include "BKE_collection.h"
21 #include "BKE_context.h"
22 #include "BKE_customdata.h"
23 #include "BKE_global.h"
24 #include "BKE_image.h"
25 #include "BKE_key.h"
26 #include "BKE_layer.h"
27 #include "BKE_main.h"
28 #include "BKE_object.h"
29 #include "BKE_paint.h"
30 #include "BKE_scene.h"
31 #include "BKE_studiolight.h"
32 #include "BKE_unit.h"
33 
34 #include "BLF_api.h"
35 
36 #include "BLT_translation.h"
37 
38 #include "DNA_armature_types.h"
39 #include "DNA_brush_types.h"
40 #include "DNA_camera_types.h"
41 #include "DNA_key_types.h"
42 #include "DNA_mesh_types.h"
43 #include "DNA_object_types.h"
44 #include "DNA_view3d_types.h"
46 
47 #include "DRW_engine.h"
48 #include "DRW_select_buffer.h"
49 
50 #include "ED_gpencil.h"
51 #include "ED_info.h"
52 #include "ED_keyframing.h"
53 #include "ED_screen.h"
54 #include "ED_screen_types.h"
55 #include "ED_transform.h"
56 #include "ED_view3d_offscreen.h"
57 
58 #include "DEG_depsgraph_query.h"
59 
60 #include "GPU_batch.h"
61 #include "GPU_batch_presets.h"
62 #include "GPU_framebuffer.h"
63 #include "GPU_immediate.h"
64 #include "GPU_immediate_util.h"
65 #include "GPU_material.h"
66 #include "GPU_matrix.h"
67 #include "GPU_state.h"
68 #include "GPU_viewport.h"
69 
70 #include "MEM_guardedalloc.h"
71 
72 #include "UI_interface.h"
73 #include "UI_resources.h"
74 
75 #include "RE_engine.h"
76 
77 #include "WM_api.h"
78 #include "WM_types.h"
79 
80 #include "RNA_access.h"
81 
82 #include "IMB_imbuf.h"
83 #include "IMB_imbuf_types.h"
84 
85 #include "view3d_intern.h" /* own include */
86 
87 #define M_GOLDEN_RATIO_CONJUGATE 0.618033988749895f
88 
89 #define VIEW3D_OVERLAY_LINEHEIGHT (0.9f * U.widget_unit)
90 
91 /* -------------------------------------------------------------------- */
96  const Scene *scene,
97  View3D *v3d,
98  ARegion *region,
99  const float viewmat[4][4],
100  const float winmat[4][4],
101  const rcti *rect,
102  bool offscreen)
103 {
104  RegionView3D *rv3d = region->regiondata;
105 
106  /* setup window matrices */
107  if (winmat) {
108  copy_m4_m4(rv3d->winmat, winmat);
109  }
110  else {
111  view3d_winmatrix_set(depsgraph, region, v3d, rect);
112  }
113 
114  /* setup view matrix */
115  if (viewmat) {
116  copy_m4_m4(rv3d->viewmat, viewmat);
117  }
118  else {
119  float rect_scale[2];
120  if (rect) {
121  rect_scale[0] = (float)BLI_rcti_size_x(rect) / (float)region->winx;
122  rect_scale[1] = (float)BLI_rcti_size_y(rect) / (float)region->winy;
123  }
124  /* NOTE: calls BKE_object_where_is_calc for camera... */
125  view3d_viewmatrix_set(depsgraph, scene, v3d, rv3d, rect ? rect_scale : NULL);
126  }
127  /* update utility matrices */
128  mul_m4_m4m4(rv3d->persmat, rv3d->winmat, rv3d->viewmat);
129  invert_m4_m4(rv3d->persinv, rv3d->persmat);
130  invert_m4_m4(rv3d->viewinv, rv3d->viewmat);
131 
132  /* calculate GLSL view dependent values */
133 
134  /* store window coordinates scaling/offset */
135  if (!offscreen && rv3d->persp == RV3D_CAMOB && v3d->camera) {
136  rctf cameraborder;
137  ED_view3d_calc_camera_border(scene, depsgraph, region, v3d, rv3d, &cameraborder, false);
138  rv3d->viewcamtexcofac[0] = (float)region->winx / BLI_rctf_size_x(&cameraborder);
139  rv3d->viewcamtexcofac[1] = (float)region->winy / BLI_rctf_size_y(&cameraborder);
140 
141  rv3d->viewcamtexcofac[2] = -rv3d->viewcamtexcofac[0] * cameraborder.xmin / (float)region->winx;
142  rv3d->viewcamtexcofac[3] = -rv3d->viewcamtexcofac[1] * cameraborder.ymin / (float)region->winy;
143  }
144  else {
145  rv3d->viewcamtexcofac[0] = rv3d->viewcamtexcofac[1] = 1.0f;
146  rv3d->viewcamtexcofac[2] = rv3d->viewcamtexcofac[3] = 0.0f;
147  }
148 
149  /* Calculate pixel-size factor once, this is used for lights and object-centers. */
150  {
151  /* NOTE: '1.0f / len_v3(v1)' replaced 'len_v3(rv3d->viewmat[0])'
152  * because of float point precision problems at large values T23908. */
153  float v1[3], v2[3];
154  float len_px, len_sc;
155 
156  v1[0] = rv3d->persmat[0][0];
157  v1[1] = rv3d->persmat[1][0];
158  v1[2] = rv3d->persmat[2][0];
159 
160  v2[0] = rv3d->persmat[0][1];
161  v2[1] = rv3d->persmat[1][1];
162  v2[2] = rv3d->persmat[2][1];
163 
164  len_px = 2.0f / sqrtf(min_ff(len_squared_v3(v1), len_squared_v3(v2)));
165 
166  if (rect) {
167  len_sc = (float)max_ii(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect));
168  }
169  else {
170  len_sc = (float)MAX2(region->winx, region->winy);
171  }
172 
173  rv3d->pixsize = len_px / len_sc;
174  }
175 }
176 
178  Scene *scene,
179  View3D *v3d,
180  ARegion *region,
181  const float viewmat[4][4],
182  const float winmat[4][4],
183  const rcti *rect)
184 {
185  RegionView3D *rv3d = region->regiondata;
186 
187  ED_view3d_update_viewmat(depsgraph, scene, v3d, region, viewmat, winmat, rect, false);
188 
189  /* set for opengl */
191  GPU_matrix_set(rv3d->viewmat);
192 }
193 
195  const Scene *scene,
196  View3D *v3d,
197  ARegion *region,
198  const float viewmat[4][4],
199  const float winmat[4][4])
200 {
201  RegionView3D *rv3d = region->regiondata;
202  ED_view3d_update_viewmat(depsgraph, scene, v3d, region, viewmat, winmat, NULL, true);
203 
204  /* set for opengl */
206  GPU_matrix_set(rv3d->viewmat);
207 }
208 
210  const Scene *scene,
211  View3D *v3d,
212  RegionView3D *rv3d)
213 {
214  if ((scene->r.scemode & R_MULTIVIEW) == 0) {
215  return false;
216  }
217 
218  if ((v3d->camera == NULL) || (v3d->camera->type != OB_CAMERA) || rv3d->persp != RV3D_CAMOB) {
219  return false;
220  }
221 
222  switch (v3d->stereo3d_camera) {
223  case STEREO_MONO_ID:
224  return false;
225  break;
226  case STEREO_3D_ID:
227  /* win will be NULL when calling this from the selection or draw loop. */
228  if ((win == NULL) || (WM_stereo3d_enabled(win, true) == false)) {
229  return false;
230  }
233  return false;
234  }
235  break;
236  /* We always need the stereo calculation for left and right cameras. */
237  case STEREO_LEFT_ID:
238  case STEREO_RIGHT_ID:
239  default:
240  break;
241  }
242  return true;
243 }
244 
245 /* setup the view and win matrices for the multiview cameras
246  *
247  * unlike view3d_stereo3d_setup_offscreen, when view3d_stereo3d_setup is called
248  * we have no winmatrix (i.e., projection matrix) defined at that time.
249  * Since the camera and the camera shift are needed for the winmat calculation
250  * we do a small hack to replace it temporarily so we don't need to change the
251  * view3d)main_region_setup_view() code to account for that.
252  */
254  Depsgraph *depsgraph, Scene *scene, View3D *v3d, ARegion *region, const rcti *rect)
255 {
256  bool is_left;
257  const char *names[2] = {STEREO_LEFT_NAME, STEREO_RIGHT_NAME};
258  const char *viewname;
259 
260  /* show only left or right camera */
261  if (v3d->stereo3d_camera != STEREO_3D_ID) {
262  v3d->multiview_eye = v3d->stereo3d_camera;
263  }
264 
267 
268  /* update the viewport matrices with the new camera */
270  Camera *data, *data_eval;
271  float viewmat[4][4];
272  float shiftx;
273 
274  data = (Camera *)v3d->camera->data;
275  data_eval = (Camera *)DEG_get_evaluated_id(depsgraph, &data->id);
276 
277  shiftx = data_eval->shiftx;
278 
280  data_eval->shiftx = BKE_camera_multiview_shift_x(&scene->r, v3d->camera, viewname);
281 
283  view3d_main_region_setup_view(depsgraph, scene, v3d, region, viewmat, NULL, rect);
284 
285  data_eval->shiftx = shiftx;
287  }
288  else { /* SCE_VIEWS_FORMAT_MULTIVIEW */
289  float viewmat[4][4];
290  Object *view_ob = v3d->camera;
292 
294  v3d->camera = camera;
295 
296  BKE_camera_multiview_view_matrix(&scene->r, camera, false, viewmat);
297  view3d_main_region_setup_view(depsgraph, scene, v3d, region, viewmat, NULL, rect);
298 
299  v3d->camera = view_ob;
301  }
302 }
303 
304 #ifdef WITH_XR_OPENXR
305 static void view3d_xr_mirror_setup(const wmWindowManager *wm,
307  Scene *scene,
308  View3D *v3d,
309  ARegion *region,
310  const rcti *rect)
311 {
312  RegionView3D *rv3d = region->regiondata;
313  float viewmat[4][4];
314  const float lens_old = v3d->lens;
315 
316  if (!WM_xr_session_state_viewer_pose_matrix_info_get(&wm->xr, viewmat, &v3d->lens)) {
317  /* Can't get info from XR session, use fallback values. */
318  copy_m4_m4(viewmat, rv3d->viewmat);
319  v3d->lens = lens_old;
320  }
321  view3d_main_region_setup_view(depsgraph, scene, v3d, region, viewmat, NULL, rect);
322 
323  /* Set draw flags. */
329  0,
331  /* Hide navigation gizmo since it gets distorted if the view matrix has a scale factor. */
333 
334  /* Reset overridden View3D data. */
335  v3d->lens = lens_old;
336 }
337 #endif /* WITH_XR_OPENXR */
338 
340  wmWindow *win,
342  Scene *scene,
343  ARegion *region,
344  View3D *v3d,
345  const float viewmat[4][4],
346  const float winmat[4][4],
347  const rcti *rect)
348 {
349  RegionView3D *rv3d = region->regiondata;
350 
351 #ifdef WITH_XR_OPENXR
352  /* Setup the view matrix. */
353  if (ED_view3d_is_region_xr_mirror_active(wm, v3d, region)) {
354  view3d_xr_mirror_setup(wm, depsgraph, scene, v3d, region, rect);
355  }
356  else
357 #endif
358  if (view3d_stereo3d_active(win, scene, v3d, rv3d)) {
359  view3d_stereo3d_setup(depsgraph, scene, v3d, region, rect);
360  }
361  else {
362  view3d_main_region_setup_view(depsgraph, scene, v3d, region, viewmat, winmat, rect);
363  }
364 
365 #ifndef WITH_XR_OPENXR
366  UNUSED_VARS(wm);
367 #endif
368 }
369 
372 /* -------------------------------------------------------------------- */
376 static void view3d_camera_border(const Scene *scene,
377  struct Depsgraph *depsgraph,
378  const ARegion *region,
379  const View3D *v3d,
380  const RegionView3D *rv3d,
381  rctf *r_viewborder,
382  const bool no_shift,
383  const bool no_zoom)
384 {
386  rctf rect_view, rect_camera;
387  Object *camera_eval = DEG_get_evaluated_object(depsgraph, v3d->camera);
388 
389  /* get viewport viewplane */
392  if (no_zoom) {
393  params.zoom = 1.0f;
394  }
395  BKE_camera_params_compute_viewplane(&params, region->winx, region->winy, 1.0f, 1.0f);
396  rect_view = params.viewplane;
397 
398  /* get camera viewplane */
400  /* fallback for non camera objects */
401  params.clip_start = v3d->clip_start;
402  params.clip_end = v3d->clip_end;
403  BKE_camera_params_from_object(&params, camera_eval);
404  if (no_shift) {
405  params.shiftx = 0.0f;
406  params.shifty = 0.0f;
407  }
410  rect_camera = params.viewplane;
411 
412  /* get camera border within viewport */
413  r_viewborder->xmin = ((rect_camera.xmin - rect_view.xmin) / BLI_rctf_size_x(&rect_view)) *
414  region->winx;
415  r_viewborder->xmax = ((rect_camera.xmax - rect_view.xmin) / BLI_rctf_size_x(&rect_view)) *
416  region->winx;
417  r_viewborder->ymin = ((rect_camera.ymin - rect_view.ymin) / BLI_rctf_size_y(&rect_view)) *
418  region->winy;
419  r_viewborder->ymax = ((rect_camera.ymax - rect_view.ymin) / BLI_rctf_size_y(&rect_view)) *
420  region->winy;
421 }
422 
425  const ARegion *region,
426  const View3D *v3d,
427  const RegionView3D *rv3d,
428  float r_size[2])
429 {
430  rctf viewborder;
431 
432  view3d_camera_border(scene, depsgraph, region, v3d, rv3d, &viewborder, true, true);
433  r_size[0] = BLI_rctf_size_x(&viewborder);
434  r_size[1] = BLI_rctf_size_y(&viewborder);
435 }
436 
439  const ARegion *region,
440  const View3D *v3d,
441  const RegionView3D *rv3d,
442  rctf *r_viewborder,
443  const bool no_shift)
444 {
445  view3d_camera_border(scene, depsgraph, region, v3d, rv3d, r_viewborder, no_shift, false);
446 }
447 
448 static void drawviewborder_grid3(uint shdr_pos, float x1, float x2, float y1, float y2, float fac)
449 {
450  float x3, y3, x4, y4;
451 
452  x3 = x1 + fac * (x2 - x1);
453  y3 = y1 + fac * (y2 - y1);
454  x4 = x1 + (1.0f - fac) * (x2 - x1);
455  y4 = y1 + (1.0f - fac) * (y2 - y1);
456 
458 
459  immVertex2f(shdr_pos, x1, y3);
460  immVertex2f(shdr_pos, x2, y3);
461 
462  immVertex2f(shdr_pos, x1, y4);
463  immVertex2f(shdr_pos, x2, y4);
464 
465  immVertex2f(shdr_pos, x3, y1);
466  immVertex2f(shdr_pos, x3, y2);
467 
468  immVertex2f(shdr_pos, x4, y1);
469  immVertex2f(shdr_pos, x4, y2);
470 
471  immEnd();
472 }
473 
474 /* harmonious triangle */
476  uint shdr_pos, float x1, float x2, float y1, float y2, const char golden, const char dir)
477 {
478  float ofs;
479  float w = x2 - x1;
480  float h = y2 - y1;
481 
483 
484  if (w > h) {
485  if (golden) {
486  ofs = w * (1.0f - M_GOLDEN_RATIO_CONJUGATE);
487  }
488  else {
489  ofs = h * (h / w);
490  }
491  if (dir == 'B') {
492  SWAP(float, y1, y2);
493  }
494 
495  immVertex2f(shdr_pos, x1, y1);
496  immVertex2f(shdr_pos, x2, y2);
497 
498  immVertex2f(shdr_pos, x2, y1);
499  immVertex2f(shdr_pos, x1 + (w - ofs), y2);
500 
501  immVertex2f(shdr_pos, x1, y2);
502  immVertex2f(shdr_pos, x1 + ofs, y1);
503  }
504  else {
505  if (golden) {
506  ofs = h * (1.0f - M_GOLDEN_RATIO_CONJUGATE);
507  }
508  else {
509  ofs = w * (w / h);
510  }
511  if (dir == 'B') {
512  SWAP(float, x1, x2);
513  }
514 
515  immVertex2f(shdr_pos, x1, y1);
516  immVertex2f(shdr_pos, x2, y2);
517 
518  immVertex2f(shdr_pos, x2, y1);
519  immVertex2f(shdr_pos, x1, y1 + ofs);
520 
521  immVertex2f(shdr_pos, x1, y2);
522  immVertex2f(shdr_pos, x2, y1 + (h - ofs));
523  }
524 
525  immEnd();
526 }
527 
529 {
530  float x1, x2, y1, y2;
531  float x1i, x2i, y1i, y2i;
532 
533  rctf viewborder;
534  Camera *ca = NULL;
535  RegionView3D *rv3d = region->regiondata;
536 
537  if (v3d->camera == NULL) {
538  return;
539  }
540  if (v3d->camera->type == OB_CAMERA) {
541  ca = v3d->camera->data;
542  }
543 
544  ED_view3d_calc_camera_border(scene, depsgraph, region, v3d, rv3d, &viewborder, false);
545  /* the offsets */
546  x1 = viewborder.xmin;
547  y1 = viewborder.ymin;
548  x2 = viewborder.xmax;
549  y2 = viewborder.ymax;
550 
551  GPU_line_width(1.0f);
552 
553  /* apply offsets so the real 3D camera shows through */
554 
555  /* NOTE: quite un-scientific but without this bit extra
556  * 0.0001 on the lower left the 2D border sometimes
557  * obscures the 3D camera border */
558  /* NOTE: with VIEW3D_CAMERA_BORDER_HACK defined this error isn't noticeable
559  * but keep it here in case we need to remove the workaround */
560  x1i = (int)(x1 - 1.0001f);
561  y1i = (int)(y1 - 1.0001f);
562  x2i = (int)(x2 + (1.0f - 0.0001f));
563  y2i = (int)(y2 + (1.0f - 0.0001f));
564 
565  uint shdr_pos = GPU_vertformat_attr_add(
567 
568  /* First, solid lines. */
569  {
571 
572  /* passepartout, specified in camera edit buttons */
573  if (ca && (ca->flag & CAM_SHOWPASSEPARTOUT) && ca->passepartalpha > 0.000001f) {
574  const float winx = (region->winx + 1);
575  const float winy = (region->winy + 1);
576 
577  float alpha = 1.0f;
578 
579  if (ca->passepartalpha != 1.0f) {
581  alpha = ca->passepartalpha;
582  }
583 
584  immUniformColor4f(0.0f, 0.0f, 0.0f, alpha);
585 
586  if (x1i > 0.0f) {
587  immRectf(shdr_pos, 0.0f, winy, x1i, 0.0f);
588  }
589  if (x2i < winx) {
590  immRectf(shdr_pos, x2i, winy, winx, 0.0f);
591  }
592  if (y2i < winy) {
593  immRectf(shdr_pos, x1i, winy, x2i, y2i);
594  }
595  if (y2i > 0.0f) {
596  immRectf(shdr_pos, x1i, y1i, x2i, 0.0f);
597  }
598 
601  imm_draw_box_wire_2d(shdr_pos, x1i, y1i, x2i, y2i);
602  }
603 
604 #ifdef VIEW3D_CAMERA_BORDER_HACK
605  if (view3d_camera_border_hack_test == true) {
607  imm_draw_box_wire_2d(shdr_pos, x1i + 1, y1i + 1, x2i - 1, y2i - 1);
609  }
610 #endif
611 
613  }
614 
615  /* When overlays are disabled, only show camera outline & passepartout. */
616  if (v3d->flag2 & V3D_HIDE_OVERLAYS) {
617  return;
618  }
619 
620  /* And now, the dashed lines! */
622 
623  {
624  float viewport_size[4];
625  GPU_viewport_size_get_f(viewport_size);
626  immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
627 
628  immUniform1i("colors_len", 0); /* "simple" mode */
629  immUniform1f("dash_width", 6.0f);
630  immUniform1f("dash_factor", 0.5f);
631 
632  /* outer line not to confuse with object selection */
633  if (v3d->flag2 & V3D_LOCK_CAMERA) {
635  imm_draw_box_wire_2d(shdr_pos, x1i - 1, y1i - 1, x2i + 1, y2i + 1);
636  }
637 
639  imm_draw_box_wire_2d(shdr_pos, x1i, y1i, x2i, y2i);
640  }
641 
642  /* Render Border. */
643  if (scene->r.mode & R_BORDER) {
644  float x3, y3, x4, y4;
645 
646  x3 = floorf(x1 + (scene->r.border.xmin * (x2 - x1))) - 1;
647  y3 = floorf(y1 + (scene->r.border.ymin * (y2 - y1))) - 1;
648  x4 = floorf(x1 + (scene->r.border.xmax * (x2 - x1))) + (U.pixelsize - 1);
649  y4 = floorf(y1 + (scene->r.border.ymax * (y2 - y1))) + (U.pixelsize - 1);
650 
651  immUniformColor3f(1.0f, 0.25f, 0.25f);
652  imm_draw_box_wire_2d(shdr_pos, x3, y3, x4, y4);
653  }
654 
655  /* safety border */
656  if (ca) {
659 
660  if (ca->dtx & CAM_DTX_CENTER) {
661  float x3, y3;
662 
663  x3 = x1 + 0.5f * (x2 - x1);
664  y3 = y1 + 0.5f * (y2 - y1);
665 
667 
668  immVertex2f(shdr_pos, x1, y3);
669  immVertex2f(shdr_pos, x2, y3);
670 
671  immVertex2f(shdr_pos, x3, y1);
672  immVertex2f(shdr_pos, x3, y2);
673 
674  immEnd();
675  }
676 
677  if (ca->dtx & CAM_DTX_CENTER_DIAG) {
679 
680  immVertex2f(shdr_pos, x1, y1);
681  immVertex2f(shdr_pos, x2, y2);
682 
683  immVertex2f(shdr_pos, x1, y2);
684  immVertex2f(shdr_pos, x2, y1);
685 
686  immEnd();
687  }
688 
689  if (ca->dtx & CAM_DTX_THIRDS) {
690  drawviewborder_grid3(shdr_pos, x1, x2, y1, y2, 1.0f / 3.0f);
691  }
692 
693  if (ca->dtx & CAM_DTX_GOLDEN) {
694  drawviewborder_grid3(shdr_pos, x1, x2, y1, y2, 1.0f - M_GOLDEN_RATIO_CONJUGATE);
695  }
696 
697  if (ca->dtx & CAM_DTX_GOLDEN_TRI_A) {
698  drawviewborder_triangle(shdr_pos, x1, x2, y1, y2, 0, 'A');
699  }
700 
701  if (ca->dtx & CAM_DTX_GOLDEN_TRI_B) {
702  drawviewborder_triangle(shdr_pos, x1, x2, y1, y2, 0, 'B');
703  }
704 
705  if (ca->dtx & CAM_DTX_HARMONY_TRI_A) {
706  drawviewborder_triangle(shdr_pos, x1, x2, y1, y2, 1, 'A');
707  }
708 
709  if (ca->dtx & CAM_DTX_HARMONY_TRI_B) {
710  drawviewborder_triangle(shdr_pos, x1, x2, y1, y2, 1, 'B');
711  }
712 
713  if (ca->flag & CAM_SHOW_SAFE_MARGINS) {
714  UI_draw_safe_areas(shdr_pos,
715  &(const rctf){
716  .xmin = x1,
717  .xmax = x2,
718  .ymin = y1,
719  .ymax = y2,
720  },
723 
724  if (ca->flag & CAM_SHOW_SAFE_CENTER) {
725  UI_draw_safe_areas(shdr_pos,
726  &(const rctf){
727  .xmin = x1,
728  .xmax = x2,
729  .ymin = y1,
730  .ymax = y2,
731  },
734  }
735  }
736 
737  if (ca->flag & CAM_SHOWSENSOR) {
738  /* determine sensor fit, and get sensor x/y, for auto fit we
739  * assume and square sensor and only use sensor_x */
740  float sizex = scene->r.xsch * scene->r.xasp;
741  float sizey = scene->r.ysch * scene->r.yasp;
742  int sensor_fit = BKE_camera_sensor_fit(ca->sensor_fit, sizex, sizey);
743  float sensor_x = ca->sensor_x;
744  float sensor_y = (ca->sensor_fit == CAMERA_SENSOR_FIT_AUTO) ? ca->sensor_x : ca->sensor_y;
745 
746  /* determine sensor plane */
747  rctf rect;
748 
749  if (sensor_fit == CAMERA_SENSOR_FIT_HOR) {
750  float sensor_scale = (x2i - x1i) / sensor_x;
751  float sensor_height = sensor_scale * sensor_y;
752 
753  rect.xmin = x1i;
754  rect.xmax = x2i;
755  rect.ymin = (y1i + y2i) * 0.5f - sensor_height * 0.5f;
756  rect.ymax = rect.ymin + sensor_height;
757  }
758  else {
759  float sensor_scale = (y2i - y1i) / sensor_y;
760  float sensor_width = sensor_scale * sensor_x;
761 
762  rect.xmin = (x1i + x2i) * 0.5f - sensor_width * 0.5f;
763  rect.xmax = rect.xmin + sensor_width;
764  rect.ymin = y1i;
765  rect.ymax = y2i;
766  }
767 
768  /* draw */
770 
771  /* TODO: Was using:
772  * `UI_draw_roundbox_4fv(false, rect.xmin, rect.ymin, rect.xmax, rect.ymax, 2.0f, color);`
773  * We'll probably need a new imm_draw_line_roundbox_dashed or that - though in practice the
774  * 2.0f round corner effect was nearly not visible anyway. */
775  imm_draw_box_wire_2d(shdr_pos, rect.xmin, rect.ymin, rect.xmax, rect.ymax);
776  }
777 
779  }
780 
782  /* end dashed lines */
783 
784  /* camera name - draw in highlighted text color */
785  if (ca && ((v3d->overlay.flag & V3D_OVERLAY_HIDE_TEXT) == 0) && (ca->flag & CAM_SHOWNAME)) {
787  BLF_draw_default(x1i,
788  y1i - (0.7f * U.widget_unit),
789  0.0f,
790  v3d->camera->id.name + 2,
791  sizeof(v3d->camera->id.name) - 2);
792  }
793 }
794 
795 static void drawrenderborder(ARegion *region, View3D *v3d)
796 {
797  /* use the same program for everything */
798  uint shdr_pos = GPU_vertformat_attr_add(
800 
801  GPU_line_width(1.0f);
802 
804 
805  float viewport_size[4];
806  GPU_viewport_size_get_f(viewport_size);
807  immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
808 
809  immUniform1i("colors_len", 0); /* "simple" mode */
810  immUniform4f("color", 1.0f, 0.25f, 0.25f, 1.0f);
811  immUniform1f("dash_width", 6.0f);
812  immUniform1f("dash_factor", 0.5f);
813 
814  imm_draw_box_wire_2d(shdr_pos,
815  v3d->render_border.xmin * region->winx,
816  v3d->render_border.ymin * region->winy,
817  v3d->render_border.xmax * region->winx,
818  v3d->render_border.ymax * region->winy);
819 
821 }
822 
825 /* -------------------------------------------------------------------- */
829 float ED_scene_grid_scale(const Scene *scene, const char **r_grid_unit)
830 {
831  /* apply units */
832  if (scene->unit.system) {
833  const void *usys;
834  int len;
835 
837 
838  if (usys) {
839  int i = BKE_unit_base_get(usys);
840  if (r_grid_unit) {
841  *r_grid_unit = BKE_unit_display_name_get(usys, i);
842  }
843  return (float)BKE_unit_scalar_get(usys, i) / scene->unit.scale_length;
844  }
845  }
846 
847  return 1.0f;
848 }
849 
850 float ED_view3d_grid_scale(const Scene *scene, View3D *v3d, const char **r_grid_unit)
851 {
852  return v3d->grid * ED_scene_grid_scale(scene, r_grid_unit);
853 }
854 
855 #define STEPS_LEN 8
857  View3D *v3d,
858  RegionView3D *rv3d,
859  float r_grid_steps[STEPS_LEN])
860 {
861  const void *usys;
862  int len;
864  float grid_scale = v3d->grid;
866 
867  if (usys) {
868  if (rv3d->view == RV3D_VIEW_USER) {
869  /* Skip steps */
870  len = BKE_unit_base_get(usys) + 1;
871  }
872 
873  grid_scale /= scene->unit.scale_length;
874 
875  int i;
876  for (i = 0; i < len; i++) {
877  r_grid_steps[i] = (float)BKE_unit_scalar_get(usys, len - 1 - i) * grid_scale;
878  }
879  for (; i < STEPS_LEN; i++) {
880  /* Fill last slots */
881  r_grid_steps[i] = 10.0f * r_grid_steps[i - 1];
882  }
883  }
884  else {
885  if (rv3d->view != RV3D_VIEW_USER) {
886  /* Allow 3 more subdivisions. */
887  grid_scale /= powf(v3d->gridsubdiv, 3);
888  }
889  int subdiv = 1;
890  for (int i = 0;; i++) {
891  r_grid_steps[i] = grid_scale * subdiv;
892 
893  if (i == STEPS_LEN - 1) {
894  break;
895  }
896  subdiv *= v3d->gridsubdiv;
897  }
898  }
899 }
900 
902  View3D *v3d,
903  ARegion *region,
904  const char **r_grid_unit)
905 {
906  float grid_scale;
907  RegionView3D *rv3d = region->regiondata;
908  if (!rv3d->is_persp && RV3D_VIEW_IS_AXIS(rv3d->view)) {
909  /* Decrease the distance between grid snap points depending on zoom. */
910  float dist = 12.0f / (region->sizex * rv3d->winmat[0][0]);
911  float grid_steps[STEPS_LEN];
912  ED_view3d_grid_steps(scene, v3d, rv3d, grid_steps);
913  /* Skip last item, in case the 'mid_dist' is greater than the largest unit. */
914  int i;
915  for (i = 0; i < ARRAY_SIZE(grid_steps) - 1; i++) {
916  grid_scale = grid_steps[i];
917  if (grid_scale > dist) {
918  break;
919  }
920  }
921 
922  if (r_grid_unit) {
923  const void *usys;
924  int len;
926 
927  if (usys) {
928  *r_grid_unit = BKE_unit_display_name_get(usys, len - i - 1);
929  }
930  }
931  }
932  else {
933  grid_scale = ED_view3d_grid_scale(scene, v3d, r_grid_unit);
934  }
935 
936  return grid_scale;
937 }
938 
939 #undef STEPS_LEN
940 
941 static void draw_view_axis(RegionView3D *rv3d, const rcti *rect)
942 {
943  const float k = U.rvisize * U.pixelsize; /* axis size */
944  /* axis alpha offset (rvibright has range 0-10) */
945  const int bright = -20 * (10 - U.rvibright);
946 
947  /* Axis center in screen coordinates.
948  *
949  * - Unit size offset so small text doesn't draw outside the screen
950  * - Extra X offset because of the panel expander.
951  */
952  const float startx = rect->xmax - (k + UI_UNIT_X * 1.5);
953  const float starty = rect->ymax - (k + UI_UNIT_Y);
954 
955  float axis_pos[3][2];
956  uchar axis_col[3][4];
957 
958  int axis_order[3] = {0, 1, 2};
959  axis_sort_v3(rv3d->viewinv[2], axis_order);
960 
961  for (int axis_i = 0; axis_i < 3; axis_i++) {
962  int i = axis_order[axis_i];
963 
964  /* get position of each axis tip on screen */
965  float vec[3] = {0.0f};
966  vec[i] = 1.0f;
967  mul_qt_v3(rv3d->viewquat, vec);
968  axis_pos[i][0] = startx + vec[0] * k;
969  axis_pos[i][1] = starty + vec[1] * k;
970 
971  /* get color of each axis */
972  UI_GetThemeColorShade3ubv(TH_AXIS_X + i, bright, axis_col[i]); /* rgb */
973  axis_col[i][3] = 255 * hypotf(vec[0], vec[1]); /* alpha */
974  }
975 
976  /* draw axis lines */
977  GPU_line_width(2.0f);
978  GPU_line_smooth(true);
980 
984 
987 
988  for (int axis_i = 0; axis_i < 3; axis_i++) {
989  int i = axis_order[axis_i];
990 
991  immAttr4ubv(col, axis_col[i]);
992  immVertex2f(pos, startx, starty);
993  immAttr4ubv(col, axis_col[i]);
994  immVertex2fv(pos, axis_pos[i]);
995  }
996 
997  immEnd();
999  GPU_line_smooth(false);
1000 
1001  /* draw axis names */
1002  for (int axis_i = 0; axis_i < 3; axis_i++) {
1003  int i = axis_order[axis_i];
1004 
1005  const char axis_text[2] = {'x' + i, '\0'};
1006  BLF_color4ubv(BLF_default(), axis_col[i]);
1007  BLF_draw_default(axis_pos[i][0] + 2, axis_pos[i][1] + 2, 0.0f, axis_text, 1);
1008  }
1009 }
1010 
1011 #ifdef WITH_INPUT_NDOF
1012 /* draw center and axis of rotation for ongoing 3D mouse navigation */
1013 static void draw_rotation_guide(const RegionView3D *rv3d)
1014 {
1015  float o[3]; /* center of rotation */
1016  float end[3]; /* endpoints for drawing */
1017 
1018  uchar color[4] = {0, 108, 255, 255}; /* bright blue so it matches device LEDs */
1019 
1020  negate_v3_v3(o, rv3d->ofs);
1021 
1023  GPU_depth_mask(false); /* Don't overwrite the Z-buffer. */
1024 
1028 
1030 
1031  if (rv3d->rot_angle != 0.0f) {
1032  /* -- draw rotation axis -- */
1033  float scaled_axis[3];
1034  const float scale = rv3d->dist;
1035  mul_v3_v3fl(scaled_axis, rv3d->rot_axis, scale);
1036 
1038  color[3] = 0; /* more transparent toward the ends */
1039  immAttr4ubv(col, color);
1040  add_v3_v3v3(end, o, scaled_axis);
1041  immVertex3fv(pos, end);
1042 
1043 # if 0
1044  color[3] = 0.2f + fabsf(rv3d->rot_angle); /* modulate opacity with angle */
1045  /* ^^ neat idea, but angle is frame-rate dependent, so it's usually close to 0.2 */
1046 # endif
1047 
1048  color[3] = 127; /* more opaque toward the center */
1049  immAttr4ubv(col, color);
1050  immVertex3fv(pos, o);
1051 
1052  color[3] = 0;
1053  immAttr4ubv(col, color);
1054  sub_v3_v3v3(end, o, scaled_axis);
1055  immVertex3fv(pos, end);
1056  immEnd();
1057 
1058  /* -- draw ring around rotation center -- */
1059  {
1060 # define ROT_AXIS_DETAIL 13
1061 
1062  const float s = 0.05f * scale;
1063  const float step = 2.0f * (float)(M_PI / ROT_AXIS_DETAIL);
1064 
1065  float q[4]; /* rotate ring so it's perpendicular to axis */
1066  const int upright = fabsf(rv3d->rot_axis[2]) >= 0.95f;
1067  if (!upright) {
1068  const float up[3] = {0.0f, 0.0f, 1.0f};
1069  float vis_angle, vis_axis[3];
1070 
1071  cross_v3_v3v3(vis_axis, up, rv3d->rot_axis);
1072  vis_angle = acosf(dot_v3v3(up, rv3d->rot_axis));
1073  axis_angle_to_quat(q, vis_axis, vis_angle);
1074  }
1075 
1076  immBegin(GPU_PRIM_LINE_LOOP, ROT_AXIS_DETAIL);
1077  color[3] = 63; /* somewhat faint */
1078  immAttr4ubv(col, color);
1079  float angle = 0.0f;
1080  for (int i = 0; i < ROT_AXIS_DETAIL; i++, angle += step) {
1081  float p[3] = {s * cosf(angle), s * sinf(angle), 0.0f};
1082 
1083  if (!upright) {
1084  mul_qt_v3(q, p);
1085  }
1086 
1087  add_v3_v3(p, o);
1088  immVertex3fv(pos, p);
1089  }
1090  immEnd();
1091 
1092 # undef ROT_AXIS_DETAIL
1093  }
1094 
1095  color[3] = 255; /* solid dot */
1096  }
1097  else {
1098  color[3] = 127; /* see-through dot */
1099  }
1100 
1101  immUnbindProgram();
1102 
1103  /* -- draw rotation center -- */
1105  GPU_point_size(5.0f);
1107  immAttr4ubv(col, color);
1108  immVertex3fv(pos, o);
1109  immEnd();
1110  immUnbindProgram();
1111 
1113  GPU_depth_mask(true);
1114 }
1115 #endif /* WITH_INPUT_NDOF */
1116 
1120 static void view3d_draw_border(const bContext *C, ARegion *region)
1121 {
1124  RegionView3D *rv3d = region->regiondata;
1125  View3D *v3d = CTX_wm_view3d(C);
1126 
1127  if (rv3d->persp == RV3D_CAMOB) {
1128  drawviewborder(scene, depsgraph, region, v3d);
1129  }
1130  else if (v3d->flag2 & V3D_RENDER_BORDER) {
1131  drawrenderborder(region, v3d);
1132  }
1133 }
1134 
1137 /* -------------------------------------------------------------------- */
1145 {
1146  /* TODO: viewport. */
1147 }
1148 
1152 static const char *view3d_get_name(View3D *v3d, RegionView3D *rv3d)
1153 {
1154  const char *name = NULL;
1155 
1156  switch (rv3d->view) {
1157  case RV3D_VIEW_FRONT:
1158  if (rv3d->persp == RV3D_ORTHO) {
1159  name = IFACE_("Front Orthographic");
1160  }
1161  else {
1162  name = IFACE_("Front Perspective");
1163  }
1164  break;
1165  case RV3D_VIEW_BACK:
1166  if (rv3d->persp == RV3D_ORTHO) {
1167  name = IFACE_("Back Orthographic");
1168  }
1169  else {
1170  name = IFACE_("Back Perspective");
1171  }
1172  break;
1173  case RV3D_VIEW_TOP:
1174  if (rv3d->persp == RV3D_ORTHO) {
1175  name = IFACE_("Top Orthographic");
1176  }
1177  else {
1178  name = IFACE_("Top Perspective");
1179  }
1180  break;
1181  case RV3D_VIEW_BOTTOM:
1182  if (rv3d->persp == RV3D_ORTHO) {
1183  name = IFACE_("Bottom Orthographic");
1184  }
1185  else {
1186  name = IFACE_("Bottom Perspective");
1187  }
1188  break;
1189  case RV3D_VIEW_RIGHT:
1190  if (rv3d->persp == RV3D_ORTHO) {
1191  name = IFACE_("Right Orthographic");
1192  }
1193  else {
1194  name = IFACE_("Right Perspective");
1195  }
1196  break;
1197  case RV3D_VIEW_LEFT:
1198  if (rv3d->persp == RV3D_ORTHO) {
1199  name = IFACE_("Left Orthographic");
1200  }
1201  else {
1202  name = IFACE_("Left Perspective");
1203  }
1204  break;
1205 
1206  default:
1207  if (rv3d->persp == RV3D_CAMOB) {
1208  if ((v3d->camera) && (v3d->camera->type == OB_CAMERA)) {
1209  Camera *cam;
1210  cam = v3d->camera->data;
1211  if (cam->type == CAM_PERSP) {
1212  name = IFACE_("Camera Perspective");
1213  }
1214  else if (cam->type == CAM_ORTHO) {
1215  name = IFACE_("Camera Orthographic");
1216  }
1217  else {
1218  BLI_assert(cam->type == CAM_PANO);
1219  name = IFACE_("Camera Panoramic");
1220  }
1221  }
1222  else {
1223  name = IFACE_("Object as Camera");
1224  }
1225  }
1226  else {
1227  name = (rv3d->persp == RV3D_ORTHO) ? IFACE_("User Orthographic") :
1228  IFACE_("User Perspective");
1229  }
1230  }
1231 
1232  return name;
1233 }
1234 
1235 static void draw_viewport_name(ARegion *region, View3D *v3d, int xoffset, int *yoffset)
1236 {
1237  RegionView3D *rv3d = region->regiondata;
1238  const char *name = view3d_get_name(v3d, rv3d);
1239  const char *name_array[3] = {name, NULL, NULL};
1240  int name_array_len = 1;
1241  const int font_id = BLF_default();
1242 
1243  /* 6 is the maximum size of the axis roll text. */
1244  /* increase size for unicode languages (Chinese in utf-8...) */
1245  char tmpstr[96 + 6];
1246 
1247  BLF_enable(font_id, BLF_SHADOW);
1248  BLF_shadow(font_id, 5, (const float[4]){0.0f, 0.0f, 0.0f, 1.0f});
1249  BLF_shadow_offset(font_id, 1, -1);
1250 
1251  if (RV3D_VIEW_IS_AXIS(rv3d->view) && (rv3d->view_axis_roll != RV3D_VIEW_AXIS_ROLL_0)) {
1252  const char *axis_roll;
1253  switch (rv3d->view_axis_roll) {
1255  axis_roll = " 90\xC2\xB0";
1256  break;
1258  axis_roll = " 180\xC2\xB0";
1259  break;
1260  default:
1261  axis_roll = " -90\xC2\xB0";
1262  break;
1263  }
1264  name_array[name_array_len++] = axis_roll;
1265  }
1266 
1267  if (v3d->localvd) {
1268  name_array[name_array_len++] = IFACE_(" (Local)");
1269  }
1270 
1271  /* Indicate that clipping region is enabled. */
1272  if (rv3d->rflag & RV3D_CLIPPING) {
1273  name_array[name_array_len++] = IFACE_(" (Clipped)");
1274  }
1275 
1276  if (name_array_len > 1) {
1277  BLI_string_join_array(tmpstr, sizeof(tmpstr), name_array, name_array_len);
1278  name = tmpstr;
1279  }
1280 
1282 
1283  *yoffset -= VIEW3D_OVERLAY_LINEHEIGHT;
1284 
1285  BLF_draw_default(xoffset, *yoffset, 0.0f, name, sizeof(tmpstr));
1286 
1287  BLF_disable(font_id, BLF_SHADOW);
1288 }
1289 
1295  Scene *scene, ViewLayer *view_layer, Object *ob, int xoffset, int *yoffset)
1296 {
1297  const int cfra = scene->r.cfra;
1298  const char *msg_pin = " (Pinned)";
1299  const char *msg_sep = " : ";
1300 
1301  const int font_id = BLF_default();
1302 
1303  char info[300];
1304  char *s = info;
1305 
1306  s += sprintf(s, "(%d)", cfra);
1307 
1308  if ((ob == NULL) || (ob->mode == OB_MODE_OBJECT)) {
1309  LayerCollection *layer_collection = view_layer->active_collection;
1310  s += sprintf(s,
1311  " %s%s",
1312  BKE_collection_ui_name_get(layer_collection->collection),
1313  (ob == NULL) ? "" : " |");
1314  }
1315 
1316  /* Info can contain:
1317  * - A frame `(7 + 2)`.
1318  * - A collection name `(MAX_NAME + 3)`.
1319  * - 3 object names `(MAX_NAME)`.
1320  * - 2 BREAD_CRUMB_SEPARATOR(s) `(6)`.
1321  * - A SHAPE_KEY_PINNED marker and a trailing '\0' `(9+1)` - translated, so give some room!
1322  * - A marker name `(MAX_NAME + 3)`.
1323  */
1324 
1325  /* get name of marker on current frame (if available) */
1326  const char *markern = BKE_scene_find_marker_name(scene, cfra);
1327 
1328  /* check if there is an object */
1329  if (ob) {
1330  *s++ = ' ';
1331  s += BLI_strcpy_rlen(s, ob->id.name + 2);
1332 
1333  /* name(s) to display depends on type of object */
1334  if (ob->type == OB_ARMATURE) {
1335  bArmature *arm = ob->data;
1336 
1337  /* show name of active bone too (if possible) */
1338  if (arm->edbo) {
1339  if (arm->act_edbone) {
1340  s += BLI_strcpy_rlen(s, msg_sep);
1341  s += BLI_strcpy_rlen(s, arm->act_edbone->name);
1342  }
1343  }
1344  else if (ob->mode & OB_MODE_POSE) {
1345  if (arm->act_bone) {
1346 
1347  if (arm->act_bone->layer & arm->layer) {
1348  s += BLI_strcpy_rlen(s, msg_sep);
1349  s += BLI_strcpy_rlen(s, arm->act_bone->name);
1350  }
1351  }
1352  }
1353  }
1354  else if (ELEM(ob->type, OB_MESH, OB_LATTICE, OB_CURVES_LEGACY)) {
1355  /* try to display active bone and active shapekey too (if they exist) */
1356 
1357  if (ob->type == OB_MESH && ob->mode & OB_MODE_WEIGHT_PAINT) {
1358  Object *armobj = BKE_object_pose_armature_get(ob);
1359  if (armobj && armobj->mode & OB_MODE_POSE) {
1360  bArmature *arm = armobj->data;
1361  if (arm->act_bone) {
1362  if (arm->act_bone->layer & arm->layer) {
1363  s += BLI_strcpy_rlen(s, msg_sep);
1364  s += BLI_strcpy_rlen(s, arm->act_bone->name);
1365  }
1366  }
1367  }
1368  }
1369 
1370  Key *key = BKE_key_from_object(ob);
1371  if (key) {
1372  KeyBlock *kb = BLI_findlink(&key->block, ob->shapenr - 1);
1373  if (kb) {
1374  s += BLI_strcpy_rlen(s, msg_sep);
1375  s += BLI_strcpy_rlen(s, kb->name);
1376  if (ob->shapeflag & OB_SHAPE_LOCK) {
1377  s += BLI_strcpy_rlen(s, IFACE_(msg_pin));
1378  }
1379  }
1380  }
1381  }
1382 
1383  /* color depends on whether there is a keyframe */
1385  (ID *)ob, /* BKE_scene_ctime_get(scene) */ (float)cfra, ANIMFILTER_KEYS_LOCAL)) {
1387  }
1388  else if (ED_gpencil_has_keyframe_v3d(scene, ob, cfra)) {
1390  }
1391  else {
1392  UI_FontThemeColor(font_id, TH_TEXT_HI);
1393  }
1394  }
1395  else {
1396  /* no object */
1397  if (ED_gpencil_has_keyframe_v3d(scene, NULL, cfra)) {
1399  }
1400  else {
1401  UI_FontThemeColor(font_id, TH_TEXT_HI);
1402  }
1403  }
1404 
1405  if (markern) {
1406  s += sprintf(s, " <%s>", markern);
1407  }
1408 
1409  BLF_enable(font_id, BLF_SHADOW);
1410  BLF_shadow(font_id, 5, (const float[4]){0.0f, 0.0f, 0.0f, 1.0f});
1411  BLF_shadow_offset(font_id, 1, -1);
1412 
1413  *yoffset -= VIEW3D_OVERLAY_LINEHEIGHT;
1414  BLF_draw_default(xoffset, *yoffset, 0.0f, info, sizeof(info));
1415 
1416  BLF_disable(font_id, BLF_SHADOW);
1417 }
1418 
1420  Scene *scene, ARegion *region, View3D *v3d, int xoffset, int *yoffset)
1421 {
1422  RegionView3D *rv3d = region->regiondata;
1423  if (!rv3d->is_persp && RV3D_VIEW_IS_AXIS(rv3d->view)) {
1424  const char *grid_unit = NULL;
1425  int font_id = BLF_default();
1426  ED_view3d_grid_view_scale(scene, v3d, region, &grid_unit);
1427 
1428  if (grid_unit) {
1429  char numstr[32] = "";
1430  UI_FontThemeColor(font_id, TH_TEXT_HI);
1431  if (v3d->grid != 1.0f) {
1432  BLI_snprintf(numstr, sizeof(numstr), "%s x %.4g", grid_unit, v3d->grid);
1433  }
1434 
1435  *yoffset -= VIEW3D_OVERLAY_LINEHEIGHT;
1436  BLF_enable(font_id, BLF_SHADOW);
1437  BLF_shadow(font_id, 5, (const float[4]){0.0f, 0.0f, 0.0f, 1.0f});
1438  BLF_shadow_offset(font_id, 1, -1);
1439  BLF_draw_default(xoffset, *yoffset, 0.0f, numstr[0] ? numstr : grid_unit, sizeof(numstr));
1440  BLF_disable(font_id, BLF_SHADOW);
1441  }
1442  }
1443 }
1444 
1446 {
1447  RegionView3D *rv3d = region->regiondata;
1448  View3D *v3d = CTX_wm_view3d(C);
1451  Main *bmain = CTX_data_main(C);
1452  ViewLayer *view_layer = CTX_data_view_layer(C);
1453 
1454 #ifdef WITH_INPUT_NDOF
1455  if ((U.ndof_flag & NDOF_SHOW_GUIDE) && ((RV3D_LOCK_FLAGS(rv3d) & RV3D_LOCK_ROTATION) == 0) &&
1456  (rv3d->persp != RV3D_CAMOB)) {
1457  /* TODO: draw something else (but not this) during fly mode */
1458  draw_rotation_guide(rv3d);
1459  }
1460 #endif
1461 
1462  /* correct projection matrix */
1463  ED_region_pixelspace(region);
1464 
1465  /* local coordinate visible rect inside region, to accommodate overlapping ui */
1466  const rcti *rect = ED_region_visible_rect(region);
1467 
1468  view3d_draw_border(C, region);
1470 
1472 
1474  /* pass */
1475  }
1476  else {
1477  switch ((eUserpref_MiniAxisType)U.mini_axis_type) {
1479  /* The gizmo handles its own drawing. */
1480  break;
1482  draw_view_axis(rv3d, rect);
1484  break;
1485  }
1486  }
1487 
1488  int xoffset = rect->xmin + (0.5f * U.widget_unit);
1489  int yoffset = rect->ymax - (0.1f * U.widget_unit);
1490 
1491  if ((v3d->flag2 & V3D_HIDE_OVERLAYS) == 0 && (v3d->overlay.flag & V3D_OVERLAY_HIDE_TEXT) == 0) {
1492  if ((U.uiflag & USER_SHOW_FPS) && ED_screen_animation_no_scrub(wm)) {
1493  ED_scene_draw_fps(scene, xoffset, &yoffset);
1494  }
1495  else if (U.uiflag & USER_SHOW_VIEWPORTNAME) {
1496  draw_viewport_name(region, v3d, xoffset, &yoffset);
1497  }
1498 
1499  if (U.uiflag & USER_DRAWVIEWINFO) {
1500  Object *ob = OBACT(view_layer);
1501  draw_selected_name(scene, view_layer, ob, xoffset, &yoffset);
1502  }
1503 
1505  /* draw below the viewport name */
1506  draw_grid_unit_name(scene, region, v3d, xoffset, &yoffset);
1507  }
1508 
1510  }
1511 
1512  if ((v3d->flag2 & V3D_HIDE_OVERLAYS) == 0 && (v3d->overlay.flag & V3D_OVERLAY_STATS)) {
1513  View3D *v3d_local = v3d->localvd ? v3d : NULL;
1515  bmain, scene, view_layer, v3d_local, xoffset, &yoffset, VIEW3D_OVERLAY_LINEHEIGHT);
1516  }
1517 
1519 }
1520 
1523 /* -------------------------------------------------------------------- */
1527 static void view3d_draw_view(const bContext *C, ARegion *region)
1528 {
1530  CTX_wm_window(C),
1532  CTX_data_scene(C),
1533  region,
1534  CTX_wm_view3d(C),
1535  NULL,
1536  NULL,
1537  NULL);
1538 
1539  /* Only 100% compliant on new spec goes below */
1540  DRW_draw_view(C);
1541 }
1542 
1544 {
1545  /*
1546  * Temporary viewport draw modes until we have a proper system.
1547  * all modes are done in the draw manager, except external render
1548  * engines like Cycles.
1549  */
1551  if (drawtype == OB_MATERIAL && (type->flag & RE_USE_EEVEE_VIEWPORT)) {
1553  }
1554  return type;
1555 }
1556 
1558 {
1559  Main *bmain = CTX_data_main(C);
1560  View3D *v3d = CTX_wm_view3d(C);
1561 
1562  view3d_draw_view(C, region);
1563 
1568 
1569  /* No depth test for drawing action zones afterwards. */
1571 
1573  /* TODO: Clear cache? */
1574 }
1575 
1578 /* -------------------------------------------------------------------- */
1583  const Scene *scene,
1584  View3D *v3d,
1585  ARegion *region,
1586  const float winmat[4][4],
1587  const char *viewname)
1588 {
1589  /* update the viewport matrices with the new camera */
1591  float viewmat[4][4];
1592  const bool is_left = STREQ(viewname, STEREO_LEFT_NAME);
1593 
1595  view3d_main_region_setup_offscreen(depsgraph, scene, v3d, region, viewmat, winmat);
1596  }
1597  else { /* SCE_VIEWS_FORMAT_MULTIVIEW */
1598  float viewmat[4][4];
1600 
1601  BKE_camera_multiview_view_matrix(&scene->r, camera, false, viewmat);
1602  view3d_main_region_setup_offscreen(depsgraph, scene, v3d, region, viewmat, winmat);
1603  }
1604 }
1605 
1607  const Scene *scene,
1608  eDrawType drawtype,
1609  View3D *v3d,
1610  ARegion *region,
1611  int winx,
1612  int winy,
1613  const float viewmat[4][4],
1614  const float winmat[4][4],
1615  bool is_image_render,
1616  bool draw_background,
1617  const char *viewname,
1618  const bool do_color_management,
1619  const bool restore_rv3d_mats,
1620  GPUOffScreen *ofs,
1621  GPUViewport *viewport)
1622 {
1623  RegionView3D *rv3d = region->regiondata;
1624  RenderEngineType *engine_type = ED_view3d_engine_type(scene, drawtype);
1625 
1626  /* Store `orig` variables. */
1627  struct {
1628  struct bThemeState theme_state;
1629 
1630  /* #View3D */
1631  eDrawType v3d_shading_type;
1632 
1633  /* #Region */
1634  int region_winx, region_winy;
1635  rcti region_winrct;
1636 
1637  /* #RegionView3D */
1642  struct RV3DMatrixStore *rv3d_mats;
1643  } orig = {
1644  .v3d_shading_type = v3d->shading.type,
1645 
1646  .region_winx = region->winx,
1647  .region_winy = region->winy,
1648  .region_winrct = region->winrct,
1649 
1650  .rv3d_mats = ED_view3d_mats_rv3d_backup(region->regiondata),
1651  };
1652 
1653  UI_Theme_Store(&orig.theme_state);
1655 
1656  /* Set temporary new size. */
1657  region->winx = winx;
1658  region->winy = winy;
1659  region->winrct.xmin = 0;
1660  region->winrct.ymin = 0;
1661  region->winrct.xmax = winx;
1662  region->winrct.ymax = winy;
1663 
1664  /* There are too many functions inside the draw manager that check the shading type,
1665  * so use a temporary override instead. */
1666  v3d->shading.type = drawtype;
1667 
1668  /* Set flags. */
1670 
1671  {
1672  /* Free images which can have changed on frame-change.
1673  * WARNING(@campbellbarton): can be slow so only free animated images. */
1675  }
1676 
1679  GPU_matrix_push();
1681 
1682  if ((viewname != NULL && viewname[0] != '\0') && (viewmat == NULL) &&
1683  rv3d->persp == RV3D_CAMOB && v3d->camera) {
1684  view3d_stereo3d_setup_offscreen(depsgraph, scene, v3d, region, winmat, viewname);
1685  }
1686  else {
1688  }
1689 
1690  /* main drawing call */
1692  engine_type,
1693  region,
1694  v3d,
1695  is_image_render,
1697  do_color_management,
1698  ofs,
1699  viewport);
1702  GPU_matrix_pop();
1703 
1704  /* Restore all `orig` members. */
1705  region->winx = orig.region_winx;
1706  region->winy = orig.region_winy;
1707  region->winrct = orig.region_winrct;
1708 
1709  /* Optionally do _not_ restore rv3d matrices (e.g. they are used/stored in the ImBuff for
1710  * reprojection, see texture_paint_image_from_view_exec(). */
1711  if (restore_rv3d_mats) {
1712  ED_view3d_mats_rv3d_restore(region->regiondata, orig.rv3d_mats);
1713  }
1714  MEM_freeN(orig.rv3d_mats);
1715 
1716  UI_Theme_Restore(&orig.theme_state);
1717 
1718  v3d->shading.type = orig.v3d_shading_type;
1719 
1720  G.f &= ~G_FLAG_RENDER_VIEWPORT;
1721 }
1722 
1724  Scene *scene,
1725  View3DShading *shading_override,
1726  eDrawType drawtype,
1727  int object_type_exclude_viewport_override,
1728  int object_type_exclude_select_override,
1729  int winx,
1730  int winy,
1731  uint draw_flags,
1732  const float viewmat[4][4],
1733  const float winmat[4][4],
1734  float clip_start,
1735  float clip_end,
1736  bool is_xr_surface,
1737  bool is_image_render,
1738  bool draw_background,
1739  const char *viewname,
1740  const bool do_color_management,
1741  GPUOffScreen *ofs,
1742  GPUViewport *viewport)
1743 {
1744  View3D v3d = {NULL};
1745  ARegion ar = {NULL};
1746  RegionView3D rv3d = {{{0}}};
1747 
1748  v3d.regionbase.first = v3d.regionbase.last = &ar;
1749  ar.regiondata = &rv3d;
1751 
1752  View3DShading *source_shading_settings = &scene->display.shading;
1753  if (draw_flags & V3D_OFSDRAW_OVERRIDE_SCENE_SETTINGS && shading_override != NULL) {
1754  source_shading_settings = shading_override;
1755  }
1756  memcpy(&v3d.shading, source_shading_settings, sizeof(View3DShading));
1757  v3d.shading.type = drawtype;
1758 
1759  if (shading_override) {
1760  /* Pass. */
1761  }
1762  else if (drawtype == OB_MATERIAL) {
1764  }
1765 
1766  if ((draw_flags & ~V3D_OFSDRAW_OVERRIDE_SCENE_SETTINGS) == V3D_OFSDRAW_NONE) {
1767  v3d.flag2 = V3D_HIDE_OVERLAYS;
1768  }
1769  else {
1770  if (draw_flags & V3D_OFSDRAW_SHOW_ANNOTATION) {
1771  v3d.flag2 |= V3D_SHOW_ANNOTATION;
1772  }
1773  if (draw_flags & V3D_OFSDRAW_SHOW_GRIDFLOOR) {
1775  v3d.grid = 1.0f;
1776  v3d.gridlines = 16;
1777  v3d.gridsubdiv = 10;
1778  }
1779  if (draw_flags & V3D_OFSDRAW_SHOW_SELECTION) {
1780  v3d.flag |= V3D_SELECT_OUTLINE;
1781  }
1782  if (draw_flags & V3D_OFSDRAW_XR_SHOW_CONTROLLERS) {
1784  }
1785  if (draw_flags & V3D_OFSDRAW_XR_SHOW_CUSTOM_OVERLAYS) {
1787  }
1788  /* Disable other overlays (set all available _HIDE_ flags). */
1791  if ((draw_flags & V3D_OFSDRAW_SHOW_OBJECT_EXTRAS) == 0) {
1793  }
1794  if ((object_type_exclude_viewport_override & (1 << OB_ARMATURE)) != 0) {
1796  }
1797  v3d.flag |= V3D_HIDE_HELPLINES;
1798  }
1799 
1800  if (is_xr_surface) {
1802  }
1803 
1804  v3d.object_type_exclude_viewport = object_type_exclude_viewport_override;
1805  v3d.object_type_exclude_select = object_type_exclude_select_override;
1806 
1807  rv3d.persp = RV3D_PERSP;
1808  v3d.clip_start = clip_start;
1809  v3d.clip_end = clip_end;
1810  /* Actually not used since we pass in the projection matrix. */
1811  v3d.lens = 0;
1812 
1814  scene,
1815  drawtype,
1816  &v3d,
1817  &ar,
1818  winx,
1819  winy,
1820  viewmat,
1821  winmat,
1822  is_image_render,
1824  viewname,
1825  do_color_management,
1826  true,
1827  ofs,
1828  viewport);
1829 }
1830 
1832  Scene *scene,
1833  eDrawType drawtype,
1834  View3D *v3d,
1835  ARegion *region,
1836  int sizex,
1837  int sizey,
1838  eImBufFlags imbuf_flag,
1839  int alpha_mode,
1840  const char *viewname,
1841  const bool restore_rv3d_mats,
1842  /* output vars */
1843  GPUOffScreen *ofs,
1844  char err_out[256])
1845 {
1846  RegionView3D *rv3d = region->regiondata;
1847  const bool draw_sky = (alpha_mode == R_ADDSKY);
1848 
1849  /* view state */
1850  bool is_ortho = false;
1851  float winmat[4][4];
1852 
1853  if (ofs && ((GPU_offscreen_width(ofs) != sizex) || (GPU_offscreen_height(ofs) != sizey))) {
1854  /* sizes differ, can't reuse */
1855  ofs = NULL;
1856  }
1857 
1859 
1860  if (old_fb) {
1862  }
1863 
1864  const bool own_ofs = (ofs == NULL);
1866 
1867  if (own_ofs) {
1868  /* bind */
1869  ofs = GPU_offscreen_create(sizex, sizey, true, GPU_RGBA8, err_out);
1870  if (ofs == NULL) {
1872  return NULL;
1873  }
1874  }
1875 
1876  GPU_offscreen_bind(ofs, true);
1877 
1878  /* read in pixels & stamp */
1879  ImBuf *ibuf = IMB_allocImBuf(sizex, sizey, 32, imbuf_flag);
1880 
1881  /* render 3d view */
1882  if (rv3d->persp == RV3D_CAMOB && v3d->camera) {
1885  const Object *camera_eval = DEG_get_evaluated_object(depsgraph, camera);
1886 
1888  /* fallback for non camera objects */
1889  params.clip_start = v3d->clip_start;
1890  params.clip_end = v3d->clip_end;
1891  BKE_camera_params_from_object(&params, camera_eval);
1892  BKE_camera_multiview_params(&scene->r, &params, camera_eval, viewname);
1895 
1896  is_ortho = params.is_ortho;
1897  copy_m4_m4(winmat, params.winmat);
1898  }
1899  else {
1900  rctf viewplane;
1901  float clip_start, clipend;
1902 
1903  is_ortho = ED_view3d_viewplane_get(
1904  depsgraph, v3d, rv3d, sizex, sizey, &viewplane, &clip_start, &clipend, NULL);
1905  if (is_ortho) {
1907  viewplane.xmin,
1908  viewplane.xmax,
1909  viewplane.ymin,
1910  viewplane.ymax,
1911  -clipend,
1912  clipend);
1913  }
1914  else {
1916  viewplane.xmin,
1917  viewplane.xmax,
1918  viewplane.ymin,
1919  viewplane.ymax,
1920  clip_start,
1921  clipend);
1922  }
1923  }
1924 
1925  /* XXX(jbakker): `do_color_management` should be controlled by the caller. Currently when doing a
1926  * viewport render animation and saving to an 8bit file format, color management would be applied
1927  * twice. Once here, and once when saving the saving to disk. In this case the Save As Render
1928  * option cannot be controlled either. But when doing an off-screen render you want to do the
1929  * color management here.
1930  *
1931  * This option was added here to increase the performance for quick view-port preview renders.
1932  * When using workbench the color differences haven't been reported as a bug. But users also use
1933  * the viewport rendering to render Eevee scenes. In the later situation the saved colors are
1934  * totally wrong. */
1935  const bool do_color_management = (ibuf->rect_float == NULL);
1937  scene,
1938  drawtype,
1939  v3d,
1940  region,
1941  sizex,
1942  sizey,
1943  NULL,
1944  winmat,
1945  true,
1946  draw_sky,
1947  viewname,
1948  do_color_management,
1949  restore_rv3d_mats,
1950  ofs,
1951  NULL);
1952 
1953  if (ibuf->rect_float) {
1955  }
1956  else if (ibuf->rect) {
1958  }
1959 
1960  /* unbind */
1961  GPU_offscreen_unbind(ofs, true);
1962 
1963  if (own_ofs) {
1964  GPU_offscreen_free(ofs);
1965  }
1966 
1968 
1969  if (old_fb) {
1970  GPU_framebuffer_bind(old_fb);
1971  }
1972 
1973  if (ibuf->rect_float && ibuf->rect) {
1974  IMB_rect_from_float(ibuf);
1975  }
1976 
1977  return ibuf;
1978 }
1979 
1981  Scene *scene,
1982  View3DShading *shading_override,
1983  eDrawType drawtype,
1984  Object *camera,
1985  int width,
1986  int height,
1987  eImBufFlags imbuf_flag,
1988  eV3DOffscreenDrawFlag draw_flags,
1989  int alpha_mode,
1990  const char *viewname,
1991  GPUOffScreen *ofs,
1992  char err_out[256])
1993 {
1994  View3D v3d = {NULL};
1995  ARegion region = {NULL};
1996  RegionView3D rv3d = {{{0}}};
1997 
1998  /* connect data */
1999  v3d.regionbase.first = v3d.regionbase.last = &region;
2000  region.regiondata = &rv3d;
2001  region.regiontype = RGN_TYPE_WINDOW;
2002 
2003  v3d.camera = camera;
2004  View3DShading *source_shading_settings = &scene->display.shading;
2005  if (draw_flags & V3D_OFSDRAW_OVERRIDE_SCENE_SETTINGS && shading_override != NULL) {
2006  source_shading_settings = shading_override;
2007  }
2008  memcpy(&v3d.shading, source_shading_settings, sizeof(View3DShading));
2009 
2010  if (drawtype == OB_RENDER) {
2011  /* Don't use external engines for preview. Fall back to solid instead of Eevee as rendering
2012  * with Eevee is potentially slow due to compiling shaders and loading textures, and the
2013  * depsgraph may not have been updated to have all the right geometry attributes. */
2015  drawtype = OB_SOLID;
2016  }
2017  }
2018 
2019  if (drawtype == OB_MATERIAL) {
2022  }
2023  else if (drawtype == OB_RENDER) {
2026  }
2027  else if (drawtype == OB_TEXTURE) {
2028  drawtype = OB_SOLID;
2031  }
2032  v3d.shading.type = drawtype;
2033 
2034  v3d.flag2 = V3D_HIDE_OVERLAYS;
2035  /* HACK: When rendering gpencil objects this opacity is used to mix vertex colors in when not in
2036  * render mode. */
2038 
2039  if (draw_flags & V3D_OFSDRAW_SHOW_ANNOTATION) {
2040  v3d.flag2 |= V3D_SHOW_ANNOTATION;
2041  }
2042  if (draw_flags & V3D_OFSDRAW_SHOW_GRIDFLOOR) {
2044  }
2045 
2047 
2048  rv3d.persp = RV3D_CAMOB;
2049 
2050  copy_m4_m4(rv3d.viewinv, v3d.camera->obmat);
2051  normalize_m4(rv3d.viewinv);
2052  invert_m4_m4(rv3d.viewmat, rv3d.viewinv);
2053 
2054  {
2056  const Object *view_camera_eval = DEG_get_evaluated_object(
2058 
2060  BKE_camera_params_from_object(&params, view_camera_eval);
2061  BKE_camera_multiview_params(&scene->r, &params, view_camera_eval, viewname);
2064 
2065  copy_m4_m4(rv3d.winmat, params.winmat);
2066  v3d.clip_start = params.clip_start;
2067  v3d.clip_end = params.clip_end;
2068  v3d.lens = params.lens;
2069  }
2070 
2071  mul_m4_m4m4(rv3d.persmat, rv3d.winmat, rv3d.viewmat);
2072  invert_m4_m4(rv3d.persinv, rv3d.viewinv);
2073 
2075  scene,
2076  v3d.shading.type,
2077  &v3d,
2078  &region,
2079  width,
2080  height,
2081  imbuf_flag,
2082  alpha_mode,
2083  viewname,
2084  true,
2085  ofs,
2086  err_out);
2087 }
2088 
2091 /* -------------------------------------------------------------------- */
2095 static bool view3d_clipping_test(const float co[3], const float clip[6][4])
2096 {
2097  if (plane_point_side_v3(clip[0], co) > 0.0f) {
2098  if (plane_point_side_v3(clip[1], co) > 0.0f) {
2099  if (plane_point_side_v3(clip[2], co) > 0.0f) {
2100  if (plane_point_side_v3(clip[3], co) > 0.0f) {
2101  return false;
2102  }
2103  }
2104  }
2105  }
2106 
2107  return true;
2108 }
2109 
2110 bool ED_view3d_clipping_test(const RegionView3D *rv3d, const float co[3], const bool is_local)
2111 {
2112  return view3d_clipping_test(co, is_local ? rv3d->clip_local : rv3d->clip);
2113 }
2114 
2117 /* -------------------------------------------------------------------- */
2125  ViewLayer *view_layer,
2126  ARegion *region,
2127  View3D *v3d,
2128  Object *obact)
2129 {
2130  /* TODO: Use a flag in the selection engine itself. */
2132  return;
2133  }
2134  Object *obact_eval = DEG_get_evaluated_object(depsgraph, obact);
2135 
2137  UNUSED_VARS_NDEBUG(region);
2138 
2139  if (obact_eval && (obact_eval->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT) ||
2140  BKE_paint_select_face_test(obact_eval))) {
2141  /* do nothing */
2142  }
2143  /* texture paint mode sampling */
2144  else if (obact_eval && (obact_eval->mode & OB_MODE_TEXTURE_PAINT) &&
2145  (v3d->shading.type > OB_WIRE)) {
2146  /* do nothing */
2147  }
2148  else if ((obact_eval && (obact_eval->mode & OB_MODE_PARTICLE_EDIT)) && !XRAY_ENABLED(v3d)) {
2149  /* do nothing */
2150  }
2151  else {
2153  return;
2154  }
2155 
2156  if (obact_eval && ((obact_eval->base_flag & BASE_VISIBLE_DEPSGRAPH) != 0)) {
2157  Base *base = BKE_view_layer_base_find(view_layer, obact);
2158  DRW_select_buffer_context_create(&base, 1, -1);
2159  }
2160 
2162 }
2163 
2164 /* TODO: Creating, attaching texture, and destroying a framebuffer is quite slow.
2165  * Calling this function should be avoided during interactive drawing. */
2166 static void view3d_opengl_read_Z_pixels(GPUViewport *viewport, rcti *rect, void *data)
2167 {
2168  GPUTexture *depth_tx = GPU_viewport_depth_texture(viewport);
2169 
2170  GPUFrameBuffer *depth_read_fb = NULL;
2171  GPU_framebuffer_ensure_config(&depth_read_fb,
2172  {
2173  GPU_ATTACHMENT_TEXTURE(depth_tx),
2174  GPU_ATTACHMENT_NONE,
2175  });
2176 
2177  GPU_framebuffer_bind(depth_read_fb);
2178  GPU_framebuffer_read_depth(depth_read_fb,
2179  rect->xmin,
2180  rect->ymin,
2181  BLI_rcti_size_x(rect),
2182  BLI_rcti_size_y(rect),
2184  data);
2185 
2187  GPU_framebuffer_free(depth_read_fb);
2188 }
2189 
2191 {
2192  validate_object_select_id(vc->depsgraph, vc->view_layer, vc->region, vc->v3d, vc->obact);
2193 }
2194 
2195 int ED_view3d_backbuf_sample_size_clamp(ARegion *region, const float dist)
2196 {
2197  return (int)min_ff(ceilf(dist), (float)max_ii(region->winx, region->winx));
2198 }
2199 
2202 /* -------------------------------------------------------------------- */
2207 {
2208  /* clamp rect by region */
2209  rcti r = {
2210  .xmin = 0,
2211  .xmax = region->winx - 1,
2212  .ymin = 0,
2213  .ymax = region->winy - 1,
2214  };
2215 
2216  /* Constrain rect to depth bounds */
2217  BLI_rcti_isect(&r, rect, rect);
2218 
2219  /* assign values to compare with the ViewDepths */
2220  int x = rect->xmin;
2221  int y = rect->ymin;
2222 
2223  int w = BLI_rcti_size_x(rect);
2224  int h = BLI_rcti_size_y(rect);
2225 
2226  if (w <= 0 || h <= 0) {
2227  r_d->depths = NULL;
2228  return;
2229  }
2230 
2231  r_d->x = x;
2232  r_d->y = y;
2233  r_d->w = w;
2234  r_d->h = h;
2235 
2236  r_d->depths = MEM_mallocN(sizeof(float) * w * h, "View depths Subset");
2237 
2238  {
2239  GPUViewport *viewport = WM_draw_region_get_viewport(region);
2240  view3d_opengl_read_Z_pixels(viewport, rect, r_d->depths);
2241  /* Range is assumed to be this as they are never changed. */
2242  r_d->depth_range[0] = 0.0;
2243  r_d->depth_range[1] = 1.0;
2244  }
2245 }
2246 
2247 /* NOTE: with nouveau drivers the glReadPixels() is very slow. T24339. */
2249 {
2250  ViewDepths *d = MEM_callocN(sizeof(ViewDepths), "ViewDepths");
2251 
2252  {
2253  GPUViewport *viewport = WM_draw_region_get_viewport(region);
2254  GPUTexture *depth_tx = GPU_viewport_depth_texture(viewport);
2255  uint32_t *int_depths = GPU_texture_read(depth_tx, GPU_DATA_UINT_24_8, 0);
2256  d->w = GPU_texture_width(depth_tx);
2257  d->h = GPU_texture_height(depth_tx);
2258  d->depths = (float *)int_depths;
2259  /* Convert in-place. */
2260  int pixel_count = d->w * d->h;
2261  for (int i = 0; i < pixel_count; i++) {
2262  d->depths[i] = (int_depths[i] >> 8u) / (float)0xFFFFFF;
2263  }
2264  /* Assumed to be this as they are never changed. */
2265  d->depth_range[0] = 0.0;
2266  d->depth_range[1] = 1.0;
2267  }
2268  return d;
2269 }
2270 
2272 {
2273  /* Convert to float for comparisons. */
2274  const float near = (float)d->depth_range[0];
2275  const float far_real = (float)d->depth_range[1];
2276  float far = far_real;
2277 
2278  const float *depths = d->depths;
2279  float depth = FLT_MAX;
2280  int i = (int)d->w * (int)d->h; /* Cast to avoid short overflow. */
2281 
2282  /* Far is both the starting 'far' value
2283  * and the closest value found. */
2284  while (i--) {
2285  depth = *depths++;
2286  if ((depth < far) && (depth > near)) {
2287  far = depth;
2288  }
2289  }
2290 
2291  return far == far_real ? FLT_MAX : far;
2292 }
2293 
2295  ARegion *region,
2296  View3D *v3d,
2297  Object *obact,
2298  eV3DDepthOverrideMode mode,
2299  ViewDepths **r_depths)
2300 {
2302  /* Force redraw if `r_depths` is required. */
2303  if (!r_depths || *r_depths != NULL) {
2304  return;
2305  }
2306  }
2307  struct bThemeState theme_state;
2309  RegionView3D *rv3d = region->regiondata;
2310 
2311  short flag = v3d->flag;
2312  /* temp set drawtype to solid */
2313  /* Setting these temporarily is not nice */
2314  v3d->flag &= ~V3D_SELECT_OUTLINE;
2315 
2316  /* Tools may request depth outside of regular drawing code. */
2317  UI_Theme_Store(&theme_state);
2319 
2321  G_MAIN->wm.first, NULL, depsgraph, scene, region, v3d, NULL, NULL, NULL);
2322 
2323  /* get surface depth without bias */
2324  rv3d->rflag |= RV3D_ZOFFSET_DISABLED;
2325 
2326  /* Needed in cases the 3D Viewport isn't already setup. */
2329 
2330  GPUViewport *viewport = WM_draw_region_get_viewport(region);
2331  /* When Blender is starting, a click event can trigger a depth test while the viewport is not
2332  * yet available. */
2333  if (viewport != NULL) {
2334  switch (mode) {
2335  case V3D_DEPTH_NO_GPENCIL:
2337  depsgraph, region, v3d, viewport, false, true, (v3d->flag2 & V3D_HIDE_OVERLAYS) == 0);
2338  break;
2340  DRW_draw_depth_loop(depsgraph, region, v3d, viewport, true, false, false);
2341  break;
2342  case V3D_DEPTH_OBJECT_ONLY:
2344  scene, region, v3d, viewport, DEG_get_evaluated_object(depsgraph, obact));
2345  break;
2346  }
2347 
2348  if (r_depths) {
2349  if (*r_depths) {
2350  ED_view3d_depths_free(*r_depths);
2351  }
2352  *r_depths = view3d_depths_create(region);
2353  }
2354  }
2355 
2357 
2358  rv3d->rflag &= ~RV3D_ZOFFSET_DISABLED;
2359 
2360  v3d->flag = flag;
2362 
2363  UI_Theme_Restore(&theme_state);
2364 }
2365 
2367 {
2368  if (depths->depths) {
2369  MEM_freeN(depths->depths);
2370  }
2371  MEM_freeN(depths);
2372 }
2373 
2376 /* -------------------------------------------------------------------- */
2381  const Scene *UNUSED(scene),
2382  const View3D *v3d,
2383  CustomData_MeshMasks *r_cddata_masks)
2384 {
2386  r_cddata_masks->lmask |= CD_MASK_MLOOPUV | CD_MASK_PROP_BYTE_COLOR;
2387  r_cddata_masks->vmask |= CD_MASK_ORCO | CD_MASK_PROP_COLOR;
2388  }
2389  else if (v3d->shading.type == OB_SOLID) {
2391  r_cddata_masks->lmask |= CD_MASK_MLOOPUV;
2392  }
2394  r_cddata_masks->lmask |= CD_MASK_PROP_BYTE_COLOR;
2395  r_cddata_masks->vmask |= CD_MASK_ORCO | CD_MASK_PROP_COLOR;
2396  }
2397  }
2398 
2401  r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT;
2402  }
2403  if ((CTX_data_mode_enum(C) == CTX_MODE_SCULPT)) {
2404  r_cddata_masks->vmask |= CD_MASK_PAINT_MASK;
2405  r_cddata_masks->pmask |= CD_MASK_SCULPT_FACE_SETS;
2406  }
2407 }
2408 
2410  const Scene *scene,
2411  const bScreen *screen,
2412  CustomData_MeshMasks *r_cddata_masks)
2413 {
2415 
2416  /* Check if we need tfaces & mcols due to view mode. */
2417  LISTBASE_FOREACH (const ScrArea *, area, &screen->areabase) {
2418  if (area->spacetype == SPACE_VIEW3D) {
2419  ED_view3d_datamask(C, scene, area->spacedata.first, r_cddata_masks);
2420  }
2421  }
2422 }
2423 
2426 /* -------------------------------------------------------------------- */
2438  float winmat[4][4];
2439  float viewmat[4][4];
2440  float viewinv[4][4];
2441  float persmat[4][4];
2442  float persinv[4][4];
2444  float pixsize;
2445 };
2446 
2448 {
2449  struct RV3DMatrixStore *rv3dmat = MEM_mallocN(sizeof(*rv3dmat), __func__);
2450  copy_m4_m4(rv3dmat->winmat, rv3d->winmat);
2451  copy_m4_m4(rv3dmat->viewmat, rv3d->viewmat);
2452  copy_m4_m4(rv3dmat->persmat, rv3d->persmat);
2453  copy_m4_m4(rv3dmat->persinv, rv3d->persinv);
2454  copy_m4_m4(rv3dmat->viewinv, rv3d->viewinv);
2455  copy_v4_v4(rv3dmat->viewcamtexcofac, rv3d->viewcamtexcofac);
2456  rv3dmat->pixsize = rv3d->pixsize;
2457  return rv3dmat;
2458 }
2459 
2460 void ED_view3d_mats_rv3d_restore(struct RegionView3D *rv3d, struct RV3DMatrixStore *rv3dmat_pt)
2461 {
2462  struct RV3DMatrixStore *rv3dmat = rv3dmat_pt;
2463  copy_m4_m4(rv3d->winmat, rv3dmat->winmat);
2464  copy_m4_m4(rv3d->viewmat, rv3dmat->viewmat);
2465  copy_m4_m4(rv3d->persmat, rv3dmat->persmat);
2466  copy_m4_m4(rv3d->persinv, rv3dmat->persinv);
2467  copy_m4_m4(rv3d->viewinv, rv3dmat->viewinv);
2468  copy_v4_v4(rv3d->viewcamtexcofac, rv3dmat->viewcamtexcofac);
2469  rv3d->pixsize = rv3dmat->pixsize;
2470 }
2471 
2474 /* -------------------------------------------------------------------- */
2478 void ED_scene_draw_fps(const Scene *scene, int xoffset, int *yoffset)
2479 {
2481  char printable[16];
2482 
2483  if (!fpsi || !fpsi->lredrawtime || !fpsi->redrawtime) {
2484  return;
2485  }
2486 
2487  printable[0] = '\0';
2488 
2489  /* Doing an average for a more robust calculation. */
2490  fpsi->redrawtimes_fps[fpsi->redrawtime_index] = (float)(1.0 /
2491  (fpsi->lredrawtime - fpsi->redrawtime));
2492 
2493  float fps = 0.0f;
2494  int tot = 0;
2495  for (int i = 0; i < REDRAW_FRAME_AVERAGE; i++) {
2496  if (fpsi->redrawtimes_fps[i]) {
2497  fps += fpsi->redrawtimes_fps[i];
2498  tot++;
2499  }
2500  }
2501  if (tot) {
2503  fps = fps / tot;
2504  }
2505 
2506  const int font_id = BLF_default();
2507 
2508  /* Is this more than half a frame behind? */
2509  if (fps + 0.5f < (float)(FPS)) {
2510  UI_FontThemeColor(font_id, TH_REDALERT);
2511  BLI_snprintf(printable, sizeof(printable), IFACE_("fps: %.2f"), fps);
2512  }
2513  else {
2514  UI_FontThemeColor(font_id, TH_TEXT_HI);
2515  BLI_snprintf(printable, sizeof(printable), IFACE_("fps: %i"), (int)(fps + 0.5f));
2516  }
2517 
2518  BLF_enable(font_id, BLF_SHADOW);
2519  BLF_shadow(font_id, 5, (const float[4]){0.0f, 0.0f, 0.0f, 1.0f});
2520  BLF_shadow_offset(font_id, 1, -1);
2521 
2522  *yoffset -= VIEW3D_OVERLAY_LINEHEIGHT;
2523 
2524  BLF_draw_default(xoffset, *yoffset, 0.0f, printable, sizeof(printable));
2525 
2526  BLF_disable(font_id, BLF_SHADOW);
2527 }
2528 
2531 /* -------------------------------------------------------------------- */
2536 {
2538  return (type && type->view_update && type->view_draw);
2539 }
2540 
2542  const Scene *scene, Depsgraph *depsgraph, View3D *v3d, ARegion *region, rcti *rect)
2543 {
2544  RegionView3D *rv3d = region->regiondata;
2545  bool use_border;
2546 
2547  /* Test if there is a 3d view rendering. */
2549  return false;
2550  }
2551 
2552  /* Test if there is a border render. */
2553  if (rv3d->persp == RV3D_CAMOB) {
2554  use_border = (scene->r.mode & R_BORDER) != 0;
2555  }
2556  else {
2557  use_border = (v3d->flag2 & V3D_RENDER_BORDER) != 0;
2558  }
2559 
2560  if (!use_border) {
2561  return false;
2562  }
2563 
2564  /* Compute border. */
2565  if (rv3d->persp == RV3D_CAMOB) {
2566  rctf viewborder;
2567  ED_view3d_calc_camera_border(scene, depsgraph, region, v3d, rv3d, &viewborder, false);
2568 
2569  rect->xmin = viewborder.xmin + scene->r.border.xmin * BLI_rctf_size_x(&viewborder);
2570  rect->ymin = viewborder.ymin + scene->r.border.ymin * BLI_rctf_size_y(&viewborder);
2571  rect->xmax = viewborder.xmin + scene->r.border.xmax * BLI_rctf_size_x(&viewborder);
2572  rect->ymax = viewborder.ymin + scene->r.border.ymax * BLI_rctf_size_y(&viewborder);
2573  }
2574  else {
2575  rect->xmin = v3d->render_border.xmin * region->winx;
2576  rect->xmax = v3d->render_border.xmax * region->winx;
2577  rect->ymin = v3d->render_border.ymin * region->winy;
2578  rect->ymax = v3d->render_border.ymax * region->winy;
2579  }
2580 
2581  BLI_rcti_translate(rect, region->winrct.xmin, region->winrct.ymin);
2582  BLI_rcti_isect(&region->winrct, rect, rect);
2583 
2584  return true;
2585 }
2586 
typedef float(TangentPoint)[2]
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)
Definition: camera.c:246
void BKE_camera_params_init(CameraParams *params)
Definition: camera.c:265
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)
Definition: camera.c:364
void BKE_camera_params_compute_matrix(CameraParams *params)
Definition: camera.c:429
const char * BKE_collection_ui_name_get(struct Collection *collection)
Definition: collection.c:736
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1090
struct wmWindowManager * CTX_wm_manager(const bContext *C)
Definition: context.c:713
@ CTX_MODE_SCULPT
Definition: BKE_context.h:113
@ CTX_MODE_EDIT_MESH
Definition: BKE_context.h:104
struct ViewLayer * CTX_data_view_layer(const bContext *C)
Definition: context.c:1100
struct View3D * CTX_wm_view3d(const bContext *C)
Definition: context.c:784
struct Depsgraph * CTX_data_expect_evaluated_depsgraph(const bContext *C)
Definition: context.c:1519
struct Main * CTX_data_main(const bContext *C)
Definition: context.c:1074
struct wmWindow * CTX_wm_window(const bContext *C)
Definition: context.c:723
enum eContextObjectMode CTX_data_mode_enum(const bContext *C)
Definition: context.c:1228
CustomData interface, see also DNA_customdata_types.h.
void CustomData_MeshMasks_update(CustomData_MeshMasks *mask_dst, const CustomData_MeshMasks *mask_src)
Definition: customdata.cc:77
const CustomData_MeshMasks CD_MASK_BAREMESH
Definition: customdata.cc:2051
#define G_MAIN
Definition: BKE_global.h:267
@ G_FLAG_RENDER_VIEWPORT
Definition: BKE_global.h:148
void BKE_image_free_anim_gputextures(struct Main *bmain)
Definition: image_gpu.cc:530
void BKE_image_free_old_gputextures(struct Main *bmain)
Definition: image_gpu.cc:541
struct Key * BKE_key_from_object(struct Object *ob)
Definition: key.c:1803
struct Base * BKE_view_layer_base_find(struct ViewLayer *view_layer, struct Object *ob)
Definition: layer.c:379
General operations, lookup, etc. for blender objects.
struct Object * BKE_object_pose_armature_get(struct Object *ob)
Definition: object.cc:2511
bool BKE_paint_select_face_test(struct Object *ob)
Definition: paint.c:980
bool BKE_scene_multiview_is_stereo3d(const struct RenderData *rd)
bool BKE_scene_uses_blender_eevee(const struct Scene *scene)
bool BKE_scene_uses_blender_workbench(const struct Scene *scene)
const char * BKE_scene_find_marker_name(const struct Scene *scene, int frame)
const char * BKE_unit_display_name_get(const void *usys_pt, int index)
Definition: unit.c:1278
void BKE_unit_system_get(int system, int type, const void **r_usys_pt, int *r_len)
Definition: unit.c:1251
@ B_UNIT_LENGTH
Definition: BKE_unit.h:101
int BKE_unit_base_get(const void *usys_pt)
Definition: unit.c:1264
double BKE_unit_scalar_get(const void *usys_pt, int index)
Definition: unit.c:1291
@ BLF_SHADOW
Definition: BLF_api.h:336
int BLF_default(void)
Definition: blf_default.c:44
void BLF_shadow_offset(int fontid, int x, int y)
Definition: blf.c:806
void BLF_shadow(int fontid, int level, const float rgba[4]) ATTR_NONNULL(3)
Definition: blf.c:796
void BLF_disable(int fontid, int option)
Definition: blf.c:279
void BLF_batch_draw_begin(void)
Definition: blf.c:466
void BLF_enable(int fontid, int option)
Definition: blf.c:270
void BLF_batch_draw_end(void)
Definition: blf.c:479
void BLF_color4ubv(int fontid, const unsigned char rgba[4])
Definition: blf.c:383
void BLF_draw_default(float x, float y, float z, const char *str, size_t str_len) ATTR_NONNULL()
Definition: blf_default.c:59
#define BLI_assert(a)
Definition: BLI_assert.h:46
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:336
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE float min_ff(float a, float b)
MINLINE int max_ii(int a, int b)
#define M_PI
Definition: BLI_math_base.h:20
void orthographic_m4(float mat[4][4], float left, float right, float bottom, float top, float nearClip, float farClip)
Definition: math_geom.c:4517
void perspective_m4(float mat[4][4], float left, float right, float bottom, float top, float nearClip, float farClip)
Definition: math_geom.c:4542
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])
Definition: math_matrix.c:259
bool invert_m4_m4(float R[4][4], const float A[4][4])
Definition: math_matrix.c:1287
void copy_m4_m4(float m1[4][4], const float m2[4][4])
Definition: math_matrix.c:77
void normalize_m4(float R[4][4]) ATTR_NONNULL()
Definition: math_matrix.c:1945
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])
Definition: math_rotation.c:59
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])
Definition: math_vector.c:939
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])
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
Definition: BLI_rect.h:190
void BLI_rcti_translate(struct rcti *rect, int x, int y)
Definition: rct.c:559
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)
Definition: BLI_rect.h:186
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
Definition: BLI_rect.h:194
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
Definition: BLI_rect.h:198
size_t BLI_strcpy_rlen(char *__restrict dst, const char *__restrict src) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition: string.c:134
size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
char * BLI_string_join_array(char *result, size_t result_len, const char *strings[], uint strings_len) ATTR_NONNULL()
Definition: string_utils.c:347
unsigned char uchar
Definition: BLI_sys_types.h:70
unsigned int uint
Definition: BLI_sys_types.h:67
void BLI_thread_unlock(int type)
Definition: threads.cc:361
@ LOCK_VIEW3D
Definition: BLI_threads.h:74
void BLI_thread_lock(int type)
Definition: threads.cc:356
#define ARRAY_SIZE(arr)
#define UNUSED_VARS(...)
#define SWAP(type, a, b)
#define UNUSED_VARS_NDEBUG(...)
#define UNUSED(x)
#define SET_FLAG_FROM_TEST(value, test, flag)
#define MAX2(a, b)
#define ELEM(...)
#define STREQ(a, b)
#define IFACE_(msgid)
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:35
struct ID * DEG_get_evaluated_id(const struct Depsgraph *depsgraph, struct ID *id)
struct Object * DEG_get_evaluated_object(const struct Depsgraph *depsgraph, struct Object *object)
struct Scene * DEG_get_evaluated_scene(const struct Depsgraph *graph)
@ CAM_SHOWPASSEPARTOUT
@ CAM_SHOW_SAFE_MARGINS
@ CAM_SHOW_SAFE_CENTER
@ CAM_SHOWNAME
@ CAM_SHOWSENSOR
@ CAMERA_SENSOR_FIT_HOR
@ CAMERA_SENSOR_FIT_AUTO
@ CAM_DTX_GOLDEN_TRI_A
@ CAM_DTX_CENTER
@ CAM_DTX_HARMONY_TRI_A
@ CAM_DTX_GOLDEN
@ CAM_DTX_GOLDEN_TRI_B
@ CAM_DTX_HARMONY_TRI_B
@ CAM_DTX_CENTER_DIAG
@ CAM_DTX_THIRDS
@ CAM_PERSP
@ CAM_PANO
@ CAM_ORTHO
#define CD_MASK_SCULPT_FACE_SETS
#define CD_MASK_PROP_BYTE_COLOR
#define CD_MASK_PROP_COLOR
#define CD_MASK_ORCO
#define CD_MASK_MDEFORMVERT
#define CD_MASK_MLOOPUV
#define CD_MASK_PAINT_MASK
@ BASE_VISIBLE_DEPSGRAPH
eDrawType
@ OB_WIRE
@ OB_TEXTURE
@ OB_SOLID
@ OB_RENDER
@ OB_MATERIAL
@ OB_MODE_PARTICLE_EDIT
@ OB_MODE_WEIGHT_PAINT
@ OB_MODE_POSE
@ OB_MODE_TEXTURE_PAINT
@ OB_MODE_OBJECT
@ OB_MODE_VERTEX_PAINT
Object is a sort of wrapper for general info.
@ OB_SHAPE_LOCK
@ OB_LATTICE
@ OB_CAMERA
@ OB_ARMATURE
@ OB_MESH
@ OB_CURVES_LEGACY
#define STEREO_LEFT_NAME
#define R_BORDER
#define R_MULTIVIEW
#define OBACT(_view_layer)
@ R_ADDSKY
#define STEREO_RIGHT_NAME
@ STEREO_MONO_ID
@ STEREO_LEFT_ID
@ STEREO_RIGHT_ID
@ STEREO_3D_ID
#define FPS
@ SCE_PASS_COMBINED
@ SCE_VIEWS_FORMAT_STEREO_3D
@ SCE_VIEWS_FORMAT_MULTIVIEW
@ RGN_TYPE_WINDOW
@ SPACE_VIEW3D
@ USER_SHOW_VIEWPORTNAME
@ USER_DRAWVIEWINFO
@ USER_SHOW_FPS
@ NDOF_SHOW_GUIDE
eUserpref_MiniAxisType
@ USER_MINI_AXIS_TYPE_GIZMO
@ USER_MINI_AXIS_TYPE_MINIMAL
@ USER_MINI_AXIS_TYPE_NONE
eV3DOffscreenDrawFlag
@ V3D_OFSDRAW_NONE
@ V3D_OFSDRAW_SHOW_OBJECT_EXTRAS
@ V3D_OFSDRAW_OVERRIDE_SCENE_SETTINGS
@ V3D_OFSDRAW_XR_SHOW_CUSTOM_OVERLAYS
@ V3D_OFSDRAW_SHOW_GRIDFLOOR
@ 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
@ V3D_LIGHTING_STUDIO
#define V3D_SHOW_ANNOTATION
#define RV3D_VIEW_IS_AXIS(view)
@ V3D_OVERLAY_HIDE_OBJECT_ORIGINS
@ V3D_OVERLAY_HIDE_BONES
@ V3D_OVERLAY_HIDE_MOTION_PATHS
@ V3D_OVERLAY_HIDE_OBJECT_XTRAS
@ V3D_OVERLAY_HIDE_CURSOR
@ V3D_OVERLAY_HIDE_TEXT
@ V3D_OVERLAY_STATS
#define V3D_LOCK_CAMERA
#define RV3D_LOCK_FLAGS(rv3d)
@ RV3D_VIEW_AXIS_ROLL_180
@ RV3D_VIEW_AXIS_ROLL_90
@ RV3D_VIEW_AXIS_ROLL_0
@ V3D_RUNTIME_DEPTHBUF_OVERRIDDEN
#define RV3D_CAMOB
#define V3D_HIDE_HELPLINES
#define RV3D_ZOFFSET_DISABLED
#define RV3D_VIEW_BACK
#define V3D_SELECT_OUTLINE
@ RV3D_LOCK_ROTATION
#define RV3D_CLIPPING
@ V3D_SHADING_SCENE_WORLD_RENDER
@ V3D_SHADING_SCENE_WORLD
@ V3D_SHADING_SCENE_LIGHTS
@ V3D_SHADING_SCENE_LIGHTS_RENDER
@ V3D_GIZMO_HIDE
@ V3D_GIZMO_HIDE_NAVIGATE
#define V3D_SHOW_Z
@ V3D_OVERLAY_EDIT_WEIGHT
#define RV3D_VIEW_BOTTOM
#define V3D_RENDER_BORDER
#define V3D_SHOW_Y
#define RV3D_VIEW_LEFT
#define RV3D_VIEW_RIGHT
#define V3D_SHOW_X
#define RV3D_PERSP
#define V3D_XR_SHOW_CONTROLLERS
#define RV3D_VIEW_TOP
#define V3D_HIDE_OVERLAYS
#define V3D_XR_SESSION_SURFACE
#define RV3D_VIEW_USER
#define V3D_XR_SHOW_CUSTOM_OVERLAYS
#define RV3D_VIEW_FRONT
#define V3D_SHOW_FLOOR
#define RV3D_ORTHO
void DRW_draw_region_engine_info(int xoffset, int *yoffset, int line_height)
void DRW_draw_view(const struct bContext *C)
void DRW_opengl_context_enable(void)
void DRW_cache_free_old_subdiv(void)
void DRW_cache_free_old_batches(struct Main *bmain)
Definition: draw_manager.c:948
void DRW_draw_depth_object(struct Scene *scene, struct ARegion *region, struct View3D *v3d, struct GPUViewport *viewport, struct Object *object)
void DRW_draw_depth_loop(struct Depsgraph *depsgraph, struct ARegion *region, struct View3D *v3d, struct GPUViewport *viewport, const bool use_gpencil, const bool use_basic, const bool use_overlay)
void DRW_opengl_context_disable(void)
void DRW_draw_render_loop_offscreen(struct Depsgraph *depsgraph, struct RenderEngineType *engine_type, struct ARegion *region, struct View3D *v3d, bool is_image_render, bool draw_background, bool do_color_management, struct GPUOffScreen *ofs, struct GPUViewport *viewport)
void DRW_select_buffer_context_create(struct Base **bases, uint bases_len, short select_mode)
void ED_info_draw_stats(struct Main *bmain, struct Scene *scene, struct ViewLayer *view_layer, struct View3D *v3d_local, int x, int *y, int height)
Definition: info_stats.cc:721
@ ANIMFILTER_KEYS_LOCAL
bScreen * ED_screen_animation_no_scrub(const struct wmWindowManager *wm)
void ED_region_pixelspace(const struct ARegion *region)
const rcti * ED_region_visible_rect(ARegion *region)
Definition: area.c:3763
#define REDRAW_FRAME_AVERAGE
#define XRAY_ENABLED(v3d)
Definition: ED_view3d.h:1299
bool ED_view3d_viewplane_get(struct Depsgraph *depsgraph, const struct View3D *v3d, const struct RegionView3D *rv3d, int winxi, int winyi, struct rctf *r_viewplane, float *r_clipsta, float *r_clipend, float *r_pixsize)
eV3DDepthOverrideMode
Definition: ED_view3d.h:180
@ V3D_DEPTH_NO_GPENCIL
Definition: ED_view3d.h:182
@ V3D_DEPTH_GPENCIL_ONLY
Definition: ED_view3d.h:184
@ V3D_DEPTH_OBJECT_ONLY
Definition: ED_view3d.h:186
struct GPUFrameBuffer GPUFrameBuffer
void GPU_framebuffer_restore(void)
GPUFrameBuffer * GPU_framebuffer_active_get(void)
void GPU_framebuffer_free(GPUFrameBuffer *fb)
void GPU_framebuffer_bind(GPUFrameBuffer *fb)
void immUniform4f(const char *name, float x, float y, float z, float w)
void immUniformThemeColorAlpha(int color_id, float a)
void immUniform2f(const char *name, float x, float y)
void immUniformThemeColorShadeAlpha(int color_id, int color_offset, int alpha_offset)
void immAttr4ubv(uint attr_id, const unsigned char data[4])
void immUniformColor4f(float r, float g, float b, float a)
void immUnbindProgram(void)
void immVertex2f(uint attr_id, float x, float y)
void immUniformThemeColor(int color_id)
void immBindBuiltinProgram(eGPUBuiltinShader shader_id)
void immVertex2fv(uint attr_id, const float data[2])
void immUniformColor3ubv(const unsigned char rgb[3])
void immUniform1i(const char *name, int x)
void immUniformThemeColor3(int color_id)
void immUniform1f(const char *name, float x)
GPUVertFormat * immVertexFormat(void)
void immUniformColor3f(float r, float g, float b)
void immVertex3fv(uint attr_id, const float data[3])
void immBegin(GPUPrimType, uint vertex_len)
void immEnd(void)
void imm_draw_box_wire_2d(uint pos, float x1, float y1, float x2, float y2)
void immRectf(uint pos, float x1, float y1, float x2, float y2)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble y1
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble GLdouble r _GL_VOID_RET _GL_VOID GLfloat GLfloat r _GL_VOID_RET _GL_VOID GLint GLint r _GL_VOID_RET _GL_VOID GLshort GLshort r _GL_VOID_RET _GL_VOID GLdouble GLdouble r
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble x2
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble v1
void GPU_pass_cache_garbage_collect(void)
Definition: gpu_codegen.cc:756
void GPU_matrix_pop(void)
Definition: gpu_matrix.cc:126
void GPU_matrix_pop_projection(void)
Definition: gpu_matrix.cc:140
#define GPU_matrix_set(x)
Definition: GPU_matrix.h:225
void GPU_matrix_push(void)
Definition: gpu_matrix.cc:119
#define GPU_matrix_projection_set(x)
Definition: GPU_matrix.h:226
void GPU_matrix_identity_set(void)
Definition: gpu_matrix.cc:168
void GPU_matrix_push_projection(void)
Definition: gpu_matrix.cc:133
@ GPU_PRIM_LINE_LOOP
Definition: GPU_primitive.h:23
@ GPU_PRIM_LINES
Definition: GPU_primitive.h:20
@ GPU_PRIM_POINTS
Definition: GPU_primitive.h:19
@ GPU_PRIM_LINE_STRIP
Definition: GPU_primitive.h:22
@ GPU_SHADER_3D_SMOOTH_COLOR
Definition: GPU_shader.h:245
@ GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR
Definition: GPU_shader.h:349
@ GPU_SHADER_2D_UNIFORM_COLOR
Definition: GPU_shader.h:201
@ GPU_SHADER_3D_POINT_FIXED_SIZE_VARYING_COLOR
Definition: GPU_shader.h:329
@ GPU_SHADER_2D_FLAT_COLOR
Definition: GPU_shader.h:208
@ GPU_BLEND_NONE
Definition: GPU_state.h:60
@ GPU_BLEND_ALPHA
Definition: GPU_state.h:62
void GPU_blend(eGPUBlend blend)
Definition: gpu_state.cc:39
void GPU_line_width(float width)
Definition: gpu_state.cc:158
void GPU_line_smooth(bool enable)
Definition: gpu_state.cc:75
void GPU_depth_mask(bool depth)
Definition: gpu_state.cc:107
void GPU_point_size(float size)
Definition: gpu_state.cc:164
@ GPU_DEPTH_NONE
Definition: GPU_state.h:83
void GPU_depth_test(eGPUDepthTest test)
Definition: gpu_state.cc:65
void GPU_viewport_size_get_f(float coords[4])
Definition: gpu_state.cc:259
int GPU_texture_height(const GPUTexture *tex)
Definition: gpu_texture.cc:607
struct GPUTexture GPUTexture
Definition: GPU_texture.h:17
int GPU_texture_width(const GPUTexture *tex)
Definition: gpu_texture.cc:602
void * GPU_texture_read(GPUTexture *tex, eGPUDataFormat data_format, int miplvl)
Definition: gpu_texture.cc:432
@ GPU_DATA_UINT_24_8
Definition: GPU_texture.h:175
@ GPU_DATA_UBYTE
Definition: GPU_texture.h:174
@ GPU_DATA_FLOAT
Definition: GPU_texture.h:171
@ GPU_RGBA8
Definition: GPU_texture.h:87
@ GPU_FETCH_FLOAT
@ GPU_FETCH_INT_TO_FLOAT_UNIT
uint GPU_vertformat_attr_add(GPUVertFormat *, const char *name, GPUVertCompType, uint comp_len, GPUVertFetchMode)
@ GPU_COMP_F32
@ GPU_COMP_U8
GPUTexture * GPU_viewport_depth_texture(GPUViewport *viewport)
Definition: gpu_viewport.c:569
struct ImBuf * IMB_allocImBuf(unsigned int x, unsigned int y, unsigned char planes, unsigned int flags)
Definition: allocimbuf.c:500
void IMB_rect_from_float(struct ImBuf *ibuf)
Definition: divers.c:696
Contains defines and structs used throughout the imbuf module.
eImBufFlags
Read Guarded memory(de)allocation.
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between camera
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert a color
#define RE_USE_EEVEE_VIEWPORT
Definition: RE_engine.h:47
#define C
Definition: RandGen.cpp:25
#define UI_UNIT_Y
#define UI_UNIT_X
void UI_draw_safe_areas(uint pos, const struct rctf *rect, const float title_aspect[2], const float action_aspect[2])
@ TH_TIME_KEYFRAME
Definition: UI_resources.h:101
@ TH_BACK
Definition: UI_resources.h:39
@ TH_TIME_GP_KEYFRAME
Definition: UI_resources.h:102
@ TH_REDALERT
Definition: UI_resources.h:34
@ TH_AXIS_X
Definition: UI_resources.h:300
@ TH_VIEW_OVERLAY
Definition: UI_resources.h:327
@ TH_TEXT_HI
Definition: UI_resources.h:43
void UI_Theme_Restore(struct bThemeState *theme_state)
Definition: resources.c:1076
void UI_FontThemeColor(int fontid, int colorid)
Definition: resources.c:1134
void UI_GetThemeColorShade3ubv(int colorid, int offset, unsigned char col[3])
Definition: resources.c:1208
void UI_SetTheme(int spacetype, int regionid)
Definition: resources.c:1045
void UI_Theme_Store(struct bThemeState *theme_state)
Definition: resources.c:1072
ATTR_WARN_UNUSED_RESULT const BMVert * v2
unsigned int U
Definition: btGjkEpa3.h:78
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition: btQuadWord.h:119
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
Definition: btVector3.h:356
static float is_left(const float p0[2], const float p1[2], const float p2[2])
Definition: convexhull_2d.c:37
#define sinf(x)
Definition: cuda/compat.h:102
#define cosf(x)
Definition: cuda/compat.h:101
#define powf(x, y)
Definition: cuda/compat.h:103
Scene scene
const Depsgraph * depsgraph
int len
Definition: draw_manager.c:108
uchar view3d_camera_border_hack_col[3]
Definition: drawobject.c:38
bool view3d_camera_border_hack_test
Definition: drawobject.c:39
RenderEngineType * RE_engines_find(const char *idname)
Definition: engine.c:98
bool ED_gpencil_has_keyframe_v3d(Scene *UNUSED(scene), Object *ob, int cfra)
uint pos
uint col
void GPU_offscreen_free(GPUOffScreen *ofs)
void GPU_offscreen_unbind(GPUOffScreen *UNUSED(ofs), bool restore)
GPUOffScreen * GPU_offscreen_create(int width, int height, bool depth, eGPUTextureFormat format, char err_out[256])
void GPU_offscreen_read_pixels(GPUOffScreen *ofs, eGPUDataFormat format, void *pixels)
int GPU_offscreen_width(const GPUOffScreen *ofs)
void GPU_offscreen_bind(GPUOffScreen *ofs, bool save)
int GPU_offscreen_height(const GPUOffScreen *ofs)
void GPU_framebuffer_read_depth(GPUFrameBuffer *gpu_fb, int x, int y, int w, int h, eGPUDataFormat format, void *data)
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
bool id_frame_has_keyframe(ID *id, float frame, short filter)
Main Keyframe Checking API call.
Definition: keyframing.c:3036
format
Definition: logImageCore.h:38
static char ** names
Definition: makesdna.c:65
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:27
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:31
void *(* MEM_mallocN)(size_t len, const char *str)
Definition: mallocn.c:33
#define G(x, y, z)
#define ceilf(x)
Definition: metal/compat.h:225
#define hypotf(x, y)
Definition: metal/compat.h:226
#define floorf(x)
Definition: metal/compat.h:224
#define acosf(x)
Definition: metal/compat.h:222
#define fabsf(x)
Definition: metal/compat.h:219
#define sqrtf(x)
Definition: metal/compat.h:243
static void area(int d1, int d2, int e1, int e2, float weights[2])
const char * RE_engine_id_BLENDER_EEVEE
Definition: scene.cc:1695
unsigned int uint32_t
Definition: stdint.h:80
void * regiondata
short regiontype
char name[64]
char sensor_fit
float sensor_y
float shiftx
float passepartalpha
float sensor_x
short flag
char name[64]
Definition: BKE_armature.h:43
Definition: DNA_ID.h:368
char name[66]
Definition: DNA_ID.h:378
unsigned int * rect
float * rect_float
char name[64]
Definition: DNA_key_types.h:52
ListBase block
Definition: DNA_key_types.h:84
struct Collection * collection
void * last
Definition: DNA_listBase.h:31
void * first
Definition: DNA_listBase.h:31
Definition: BKE_main.h:121
short base_flag
short shapenr
float obmat[4][4]
void * data
char shapeflag
float viewinv[4][4]
Definition: view3d_draw.c:2440
float persinv[4][4]
Definition: view3d_draw.c:2442
float viewmat[4][4]
Definition: view3d_draw.c:2439
float persmat[4][4]
Definition: view3d_draw.c:2441
float viewcamtexcofac[4]
Definition: view3d_draw.c:2443
float winmat[4][4]
Definition: view3d_draw.c:2438
float viewcamtexcofac[4]
float viewquat[4]
float persmat[4][4]
float clip[6][4]
float persinv[4][4]
float viewmat[4][4]
float clip_local[6][4]
float viewinv[4][4]
float winmat[4][4]
char engine[32]
short views_format
View3DShading shading
struct SceneDisplay display
void * fps_info
struct RenderData r
struct UnitSettings unit
struct DisplaySafeAreas safe_areas
float redrawtimes_fps[REDRAW_FRAME_AVERAGE]
float gpencil_vertex_paint_opacity
char multiview_eye
View3DOverlay overlay
rctf render_border
float clip_end
View3D_Runtime runtime
struct Object * camera
short gridsubdiv
char stereo3d_camera
struct View3D * localvd
short gridlines
int object_type_exclude_select
int object_type_exclude_viewport
ListBase regionbase
char gizmo_flag
View3DShading shading
float clip_start
struct Depsgraph * depsgraph
Definition: ED_view3d.h:64
struct ARegion * region
Definition: ED_view3d.h:69
struct ViewLayer * view_layer
Definition: ED_view3d.h:66
struct Object * obact
Definition: ED_view3d.h:67
struct View3D * v3d
Definition: ED_view3d.h:70
short y
Definition: ED_view3d.h:79
unsigned short w
Definition: ED_view3d.h:78
float * depths
Definition: ED_view3d.h:80
short x
Definition: ED_view3d.h:79
double depth_range[2]
Definition: ED_view3d.h:81
unsigned short h
Definition: ED_view3d.h:78
LayerCollection * active_collection
struct EditBone * act_edbone
unsigned int layer
ListBase * edbo
ListBase areabase
float xmax
Definition: DNA_vec_types.h:69
float xmin
Definition: DNA_vec_types.h:69
float ymax
Definition: DNA_vec_types.h:70
float ymin
Definition: DNA_vec_types.h:70
int ymin
Definition: DNA_vec_types.h:64
int ymax
Definition: DNA_vec_types.h:64
int xmin
Definition: DNA_vec_types.h:63
int xmax
Definition: DNA_vec_types.h:63
XrSessionSettings session_settings
static void draw_background(const rcti *rect)
Definition: time_scrub_ui.c:48
static void draw_viewport_name(ARegion *region, View3D *v3d, int xoffset, int *yoffset)
Definition: view3d_draw.c:1235
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])
Definition: view3d_draw.c:423
static void view3d_draw_border(const bContext *C, ARegion *region)
Definition: view3d_draw.c:1120
float ED_view3d_grid_scale(const Scene *scene, View3D *v3d, const char **r_grid_unit)
Definition: view3d_draw.c:850
bool ED_view3d_calc_render_border(const Scene *scene, Depsgraph *depsgraph, View3D *v3d, ARegion *region, rcti *rect)
Definition: view3d_draw.c:2541
static ViewDepths * view3d_depths_create(ARegion *region)
Definition: view3d_draw.c:2248
static void drawviewborder(Scene *scene, Depsgraph *depsgraph, ARegion *region, View3D *v3d)
Definition: view3d_draw.c:528
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)
Definition: view3d_draw.c:177
static bool view3d_stereo3d_active(wmWindow *win, const Scene *scene, View3D *v3d, RegionView3D *rv3d)
Definition: view3d_draw.c:209
static void view3d_draw_grease_pencil(const bContext *UNUSED(C))
Definition: view3d_draw.c:1144
void view3d_draw_region_info(const bContext *C, ARegion *region)
Definition: view3d_draw.c:1445
static void view3d_stereo3d_setup(Depsgraph *depsgraph, Scene *scene, View3D *v3d, ARegion *region, const rcti *rect)
Definition: view3d_draw.c:253
void view3d_main_region_draw(const bContext *C, ARegion *region)
Definition: view3d_draw.c:1557
RenderEngineType * ED_view3d_engine_type(const Scene *scene, int drawtype)
Definition: view3d_draw.c:1543
static void view3d_stereo3d_setup_offscreen(Depsgraph *depsgraph, const Scene *scene, View3D *v3d, ARegion *region, const float winmat[4][4], const char *viewname)
Definition: view3d_draw.c:1582
void view3d_depths_rect_create(ARegion *region, rcti *rect, ViewDepths *r_d)
Definition: view3d_draw.c:2206
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])
Definition: view3d_draw.c:194
float view3d_depth_near(ViewDepths *d)
Definition: view3d_draw.c:2271
#define VIEW3D_OVERLAY_LINEHEIGHT
Definition: view3d_draw.c:89
void ED_view3d_depth_override(Depsgraph *depsgraph, ARegion *region, View3D *v3d, Object *obact, eV3DDepthOverrideMode mode, ViewDepths **r_depths)
Definition: view3d_draw.c:2294
static void draw_selected_name(Scene *scene, ViewLayer *view_layer, Object *ob, int xoffset, int *yoffset)
Definition: view3d_draw.c:1294
static void view3d_camera_border(const Scene *scene, struct Depsgraph *depsgraph, const ARegion *region, const View3D *v3d, const RegionView3D *rv3d, rctf *r_viewborder, const bool no_shift, const bool no_zoom)
Definition: view3d_draw.c:376
void ED_view3d_calc_camera_border(const Scene *scene, Depsgraph *depsgraph, const ARegion *region, const View3D *v3d, const RegionView3D *rv3d, rctf *r_viewborder, const bool no_shift)
Definition: view3d_draw.c:437
static bool view3d_clipping_test(const float co[3], const float clip[6][4])
Definition: view3d_draw.c:2095
static void view3d_draw_view(const bContext *C, ARegion *region)
Definition: view3d_draw.c:1527
void ED_view3d_datamask(const bContext *C, const Scene *UNUSED(scene), const View3D *v3d, CustomData_MeshMasks *r_cddata_masks)
Definition: view3d_draw.c:2380
static void validate_object_select_id(struct Depsgraph *depsgraph, ViewLayer *view_layer, ARegion *region, View3D *v3d, Object *obact)
Definition: view3d_draw.c:2124
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)
Definition: view3d_draw.c:339
static void draw_grid_unit_name(Scene *scene, ARegion *region, View3D *v3d, int xoffset, int *yoffset)
Definition: view3d_draw.c:1419
void ED_view3d_grid_steps(const Scene *scene, View3D *v3d, RegionView3D *rv3d, float r_grid_steps[STEPS_LEN])
Definition: view3d_draw.c:856
#define STEPS_LEN
Definition: view3d_draw.c:855
int ED_view3d_backbuf_sample_size_clamp(ARegion *region, const float dist)
Definition: view3d_draw.c:2195
void ED_view3d_depths_free(ViewDepths *depths)
Definition: view3d_draw.c:2366
void ED_view3d_select_id_validate(ViewContext *vc)
Definition: view3d_draw.c:2190
float ED_view3d_grid_view_scale(Scene *scene, View3D *v3d, ARegion *region, const char **r_grid_unit)
Definition: view3d_draw.c:901
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)
Definition: view3d_draw.c:1606
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, char err_out[256])
Definition: view3d_draw.c:1831
static bool view3d_main_region_do_render_draw(const Scene *scene)
Definition: view3d_draw.c:2535
bool ED_view3d_clipping_test(const RegionView3D *rv3d, const float co[3], const bool is_local)
Definition: view3d_draw.c:2110
static void draw_view_axis(RegionView3D *rv3d, const rcti *rect)
Definition: view3d_draw.c:941
static void drawviewborder_grid3(uint shdr_pos, float x1, float x2, float y1, float y2, float fac)
Definition: view3d_draw.c:448
void ED_view3d_screen_datamask(const bContext *C, const Scene *scene, const bScreen *screen, CustomData_MeshMasks *r_cddata_masks)
Definition: view3d_draw.c:2409
void ED_view3d_mats_rv3d_restore(struct RegionView3D *rv3d, struct RV3DMatrixStore *rv3dmat_pt)
Definition: view3d_draw.c:2460
static void drawviewborder_triangle(uint shdr_pos, float x1, float x2, float y1, float y2, const char golden, const char dir)
Definition: view3d_draw.c:475
struct RV3DMatrixStore * ED_view3d_mats_rv3d_backup(struct RegionView3D *rv3d)
Definition: view3d_draw.c:2447
void ED_view3d_update_viewmat(Depsgraph *depsgraph, const Scene *scene, View3D *v3d, ARegion *region, const float viewmat[4][4], const float winmat[4][4], const rcti *rect, bool offscreen)
Definition: view3d_draw.c:95
#define M_GOLDEN_RATIO_CONJUGATE
Definition: view3d_draw.c:87
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)
Definition: view3d_draw.c:1723
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, char err_out[256])
Definition: view3d_draw.c:1980
void ED_scene_draw_fps(const Scene *scene, int xoffset, int *yoffset)
Definition: view3d_draw.c:2478
static void drawrenderborder(ARegion *region, View3D *v3d)
Definition: view3d_draw.c:795
static const char * view3d_get_name(View3D *v3d, RegionView3D *rv3d)
Definition: view3d_draw.c:1152
float ED_scene_grid_scale(const Scene *scene, const char **r_grid_unit)
Definition: view3d_draw.c:829
static void view3d_opengl_read_Z_pixels(GPUViewport *viewport, rcti *rect, void *data)
Definition: view3d_draw.c:2166
void view3d_winmatrix_set(struct Depsgraph *depsgraph, struct ARegion *region, const View3D *v3d, const rcti *rect)
Definition: view3d_view.c:306
void view3d_viewmatrix_set(struct Depsgraph *depsgraph, const struct Scene *scene, const View3D *v3d, RegionView3D *rv3d, const float rect_scale[2])
void WM_draw_region_viewport_unbind(ARegion *region)
Definition: wm_draw.c:1416
void WM_draw_region_viewport_bind(ARegion *region)
Definition: wm_draw.c:1411
GPUViewport * WM_draw_region_get_viewport(ARegion *region)
Definition: wm_draw.c:846
void WM_draw_region_viewport_ensure(ARegion *region, short space_type)
Definition: wm_draw.c:1405
bool WM_stereo3d_enabled(wmWindow *win, bool skip_stereo3d_check)
Definition: wm_stereo.c:141
bool WM_xr_session_state_viewer_pose_matrix_info_get(const wmXrData *xr, float r_viewmat[4][4], float *r_focal_len)