Blender  V2.93
overlay_extra.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * Copyright 2019, Blender Foundation.
17  */
18 
23 #include "DRW_render.h"
24 
25 #include "UI_resources.h"
26 
27 #include "BKE_anim_path.h"
28 #include "BKE_camera.h"
29 #include "BKE_constraint.h"
30 #include "BKE_curve.h"
31 #include "BKE_global.h"
32 #include "BKE_mball.h"
33 #include "BKE_mesh.h"
34 #include "BKE_modifier.h"
35 #include "BKE_movieclip.h"
36 #include "BKE_object.h"
37 #include "BKE_tracking.h"
38 
39 #include "BLI_listbase.h"
40 
41 #include "DNA_camera_types.h"
42 #include "DNA_constraint_types.h"
43 #include "DNA_curve_types.h"
44 #include "DNA_fluid_types.h"
46 #include "DNA_lightprobe_types.h"
47 #include "DNA_mesh_types.h"
48 #include "DNA_meta_types.h"
49 #include "DNA_modifier_types.h"
50 #include "DNA_pointcache_types.h"
51 #include "DNA_rigidbody_types.h"
52 
53 #include "DEG_depsgraph_query.h"
54 
55 #include "ED_view3d.h"
56 
57 #include "overlay_private.h"
58 
59 #include "draw_common.h"
60 #include "draw_manager_text.h"
61 
63 {
64  OVERLAY_PassList *psl = vedata->psl;
65  OVERLAY_TextureList *txl = vedata->txl;
66  OVERLAY_PrivateData *pd = vedata->stl->pd;
67  const bool is_select = DRW_state_is_select();
68 
70  DRW_PASS_CREATE(psl->extra_blend_ps, state_blend | pd->clipping_state);
71  DRW_PASS_CREATE(psl->extra_centers_ps, state_blend | pd->clipping_state);
72 
73  {
75 
78  DRWShadingGroup *grp;
79  struct GPUShader *sh = OVERLAY_shader_extra_grid();
80  struct GPUTexture *tex = DRW_state_is_fbo() ? dtxl->depth : txl->dummy_depth_tx;
81 
82  pd->extra_grid_grp = grp = DRW_shgroup_create(sh, psl->extra_grid_ps);
83  DRW_shgroup_uniform_texture(grp, "depthBuffer", tex);
84  DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
85  DRW_shgroup_uniform_bool_copy(grp, "isTransform", (G.moving & G_TRANSFORM_OBJ) != 0);
86  }
87 
88  for (int i = 0; i < 2; i++) {
89  /* Non Meshes Pass (Camera, empties, lights ...) */
90  struct GPUShader *sh;
91  struct GPUVertFormat *format;
92  DRWShadingGroup *grp, *grp_sub;
93 
96  DRWPass **p_extra_ps = &psl->extra_ps[i];
97 
98  DRWState infront_state = (DRW_state_is_select() && (i == 1)) ? DRW_STATE_IN_FRONT_SELECT : 0;
100  DRW_PASS_CREATE(*p_extra_ps, state | pd->clipping_state | infront_state);
101 
102  DRWPass *extra_ps = *p_extra_ps;
103 
104 #define BUF_INSTANCE DRW_shgroup_call_buffer_instance
105 #define BUF_POINT(grp, format) DRW_shgroup_call_buffer(grp, format, GPU_PRIM_POINTS)
106 #define BUF_LINE(grp, format) DRW_shgroup_call_buffer(grp, format, GPU_PRIM_LINES)
107 
108  /* Sorted by shader to avoid state changes during render. */
109  {
110  format = formats->instance_extra;
111  sh = OVERLAY_shader_extra(is_select);
112 
113  grp = DRW_shgroup_create(sh, extra_ps);
114  DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
115 
116  grp_sub = DRW_shgroup_create_sub(grp);
150 
151  grp_sub = DRW_shgroup_create_sub(grp);
155  }
156  {
157  format = formats->instance_extra;
158  grp = DRW_shgroup_create(sh, psl->extra_blend_ps); /* NOTE: not the same pass! */
159  DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
160 
161  grp_sub = DRW_shgroup_create_sub(grp);
166 
167  grp_sub = DRW_shgroup_create_sub(grp);
170  }
171  {
172  format = formats->instance_pos;
174 
175  grp = DRW_shgroup_create(sh, extra_ps);
176  DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
178 
180  }
181  {
182  sh = OVERLAY_shader_extra_wire(false, is_select);
183 
184  grp = DRW_shgroup_create(sh, extra_ps);
185  DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
186 
187  cb->extra_dashed_lines = BUF_LINE(grp, formats->pos_color);
188  cb->extra_lines = BUF_LINE(grp, formats->wire_extra);
189  }
190  {
191  sh = OVERLAY_shader_extra_wire(true, is_select);
192 
193  cb->extra_wire = grp = DRW_shgroup_create(sh, extra_ps);
194  DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
195  }
196  {
198 
199  cb->extra_loose_points = grp = DRW_shgroup_create(sh, extra_ps);
200  DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
201 
202  /* Buffer access for drawing isolated points, matching `extra_lines`. */
203  cb->extra_points = BUF_POINT(grp, formats->point_extra);
204  }
205  {
206  format = formats->pos;
208 
209  grp = DRW_shgroup_create(sh, psl->extra_centers_ps); /* NOTE: not the same pass! */
210  DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
211 
212  grp_sub = DRW_shgroup_create_sub(grp);
214  cb->center_active = BUF_POINT(grp_sub, format);
215 
216  grp_sub = DRW_shgroup_create_sub(grp);
218  cb->center_selected = BUF_POINT(grp_sub, format);
219 
220  grp_sub = DRW_shgroup_create_sub(grp);
222  cb->center_deselected = BUF_POINT(grp_sub, format);
223 
224  grp_sub = DRW_shgroup_create_sub(grp);
226  cb->center_selected_lib = BUF_POINT(grp_sub, format);
227 
228  grp_sub = DRW_shgroup_create_sub(grp);
230  cb->center_deselected_lib = BUF_POINT(grp_sub, format);
231  }
232  }
233 }
234 
235 void OVERLAY_extra_point(OVERLAY_ExtraCallBuffers *cb, const float point[3], const float color[4])
236 {
237  DRW_buffer_add_entry(cb->extra_points, point, color);
238 }
239 
241  const float start[3],
242  const float end[3],
243  const float color[4])
244 {
245  DRW_buffer_add_entry(cb->extra_dashed_lines, end, color);
246  DRW_buffer_add_entry(cb->extra_dashed_lines, start, color);
247 }
248 
250  const float start[3],
251  const float end[3],
252  const int color_id)
253 {
254  DRW_buffer_add_entry(cb->extra_lines, start, &color_id);
255  DRW_buffer_add_entry(cb->extra_lines, end, &color_id);
256 }
257 
259 {
260  bool do_in_front = (ob->dtx & OB_DRAW_IN_FRONT) != 0;
261  OVERLAY_PrivateData *pd = vedata->stl->pd;
262  return &pd->extra_call_buffers[do_in_front];
263 }
264 
266  struct GPUBatch *geom,
267  const float mat[4][4],
268  const float color[4])
269 {
270  float draw_mat[4][4];
271  pack_v4_in_mat4(draw_mat, mat, color);
272  DRW_shgroup_call_obmat(cb->extra_loose_points, geom, draw_mat);
273 }
274 
276  struct GPUBatch *geom,
277  const float mat[4][4],
278  const float color[4])
279 {
280  float draw_mat[4][4];
281  const float col[4] = {UNPACK3(color), 0.0f /* No stipples. */};
282  pack_v4_in_mat4(draw_mat, mat, col);
283  DRW_shgroup_call_obmat(cb->extra_wire, geom, draw_mat);
284 }
285 
286 /* -------------------------------------------------------------------- */
291  const float mat[4][4],
292  const float draw_size,
293  const char draw_type,
294  const float color[4])
295 {
296  float instdata[4][4];
297  pack_fl_in_mat4(instdata, mat, draw_size);
298 
299  switch (draw_type) {
300  case OB_PLAINAXES:
301  DRW_buffer_add_entry(cb->empty_plain_axes, color, instdata);
302  break;
303  case OB_SINGLE_ARROW:
304  DRW_buffer_add_entry(cb->empty_single_arrow, color, instdata);
305  break;
306  case OB_CUBE:
307  DRW_buffer_add_entry(cb->empty_cube, color, instdata);
308  break;
309  case OB_CIRCLE:
310  DRW_buffer_add_entry(cb->empty_circle, color, instdata);
311  break;
312  case OB_EMPTY_SPHERE:
313  DRW_buffer_add_entry(cb->empty_sphere, color, instdata);
314  break;
315  case OB_EMPTY_CONE:
316  DRW_buffer_add_entry(cb->empty_cone, color, instdata);
317  break;
318  case OB_ARROWS:
319  DRW_buffer_add_entry(cb->empty_axes, color, instdata);
320  break;
321  case OB_EMPTY_IMAGE:
322  /* This only show the frame. See OVERLAY_image_empty_cache_populate() for the image. */
323  DRW_buffer_add_entry(cb->empty_image_frame, color, instdata);
324  break;
325  }
326 }
327 
329 {
330  if (((ob->base_flag & BASE_FROM_DUPLI) != 0) && ((ob->transflag & OB_DUPLICOLLECTION) != 0) &&
331  ob->instance_collection) {
332  return;
333  }
334 
336  const DRWContextState *draw_ctx = DRW_context_state_get();
337  ViewLayer *view_layer = draw_ctx->view_layer;
338  float *color;
339 
340  switch (ob->empty_drawtype) {
341  case OB_PLAINAXES:
342  case OB_SINGLE_ARROW:
343  case OB_CUBE:
344  case OB_CIRCLE:
345  case OB_EMPTY_SPHERE:
346  case OB_EMPTY_CONE:
347  case OB_ARROWS:
348  DRW_object_wire_theme_get(ob, view_layer, &color);
349  OVERLAY_empty_shape(cb, ob->obmat, ob->empty_drawsize, ob->empty_drawtype, color);
350  break;
351  case OB_EMPTY_IMAGE:
353  break;
354  }
355 }
356 
358  Object *ob,
359  const float *color,
360  char boundtype,
361  bool around_origin)
362 {
363  float center[3], size[3], tmp[4][4], final_mat[4][4];
364  BoundBox bb_local;
365 
366  if (ob->type == OB_MBALL && !BKE_mball_is_basis(ob)) {
367  return;
368  }
369 
371 
372  if (bb == NULL) {
373  const float min[3] = {-1.0f, -1.0f, -1.0f}, max[3] = {1.0f, 1.0f, 1.0f};
374  bb = &bb_local;
376  }
377 
379 
380  if (around_origin) {
381  zero_v3(center);
382  }
383  else {
385  }
386 
387  switch (boundtype) {
388  case OB_BOUND_BOX:
389  size_to_mat4(tmp, size);
390  copy_v3_v3(tmp[3], center);
391  mul_m4_m4m4(tmp, ob->obmat, tmp);
392  DRW_buffer_add_entry(cb->empty_cube, color, tmp);
393  break;
394  case OB_BOUND_SPHERE:
395  size[0] = max_fff(size[0], size[1], size[2]);
396  size[1] = size[2] = size[0];
397  size_to_mat4(tmp, size);
398  copy_v3_v3(tmp[3], center);
399  mul_m4_m4m4(tmp, ob->obmat, tmp);
400  DRW_buffer_add_entry(cb->empty_sphere, color, tmp);
401  break;
402  case OB_BOUND_CYLINDER:
403  size[0] = max_ff(size[0], size[1]);
404  size[1] = size[0];
405  size_to_mat4(tmp, size);
406  copy_v3_v3(tmp[3], center);
407  mul_m4_m4m4(tmp, ob->obmat, tmp);
408  DRW_buffer_add_entry(cb->empty_cylinder, color, tmp);
409  break;
410  case OB_BOUND_CONE:
411  size[0] = max_ff(size[0], size[1]);
412  size[1] = size[0];
413  size_to_mat4(tmp, size);
414  copy_v3_v3(tmp[3], center);
415  /* Cone batch has base at 0 and is pointing towards +Y. */
416  swap_v3_v3(tmp[1], tmp[2]);
417  tmp[3][2] -= size[2];
418  mul_m4_m4m4(tmp, ob->obmat, tmp);
419  DRW_buffer_add_entry(cb->empty_cone, color, tmp);
420  break;
421  case OB_BOUND_CAPSULE:
422  size[0] = max_ff(size[0], size[1]);
423  size[1] = size[0];
424  scale_m4_fl(tmp, size[0]);
425  copy_v2_v2(tmp[3], center);
426  tmp[3][2] = center[2] + max_ff(0.0f, size[2] - size[0]);
427  mul_m4_m4m4(final_mat, ob->obmat, tmp);
428  DRW_buffer_add_entry(cb->empty_capsule_cap, color, final_mat);
429  negate_v3(tmp[2]);
430  tmp[3][2] = center[2] - max_ff(0.0f, size[2] - size[0]);
431  mul_m4_m4m4(final_mat, ob->obmat, tmp);
432  DRW_buffer_add_entry(cb->empty_capsule_cap, color, final_mat);
433  tmp[2][2] = max_ff(0.0f, size[2] * 2.0f - size[0] * 2.0f);
434  mul_m4_m4m4(final_mat, ob->obmat, tmp);
435  DRW_buffer_add_entry(cb->empty_capsule_body, color, final_mat);
436  break;
437  }
438 }
439 
440 static void OVERLAY_collision(OVERLAY_ExtraCallBuffers *cb, Object *ob, const float *color)
441 {
442  switch (ob->rigidbody_object->shape) {
443  case RB_SHAPE_BOX:
444  OVERLAY_bounds(cb, ob, color, OB_BOUND_BOX, true);
445  break;
446  case RB_SHAPE_SPHERE:
447  OVERLAY_bounds(cb, ob, color, OB_BOUND_SPHERE, true);
448  break;
449  case RB_SHAPE_CONE:
450  OVERLAY_bounds(cb, ob, color, OB_BOUND_CONE, true);
451  break;
452  case RB_SHAPE_CYLINDER:
453  OVERLAY_bounds(cb, ob, color, OB_BOUND_CYLINDER, true);
454  break;
455  case RB_SHAPE_CAPSULE:
456  OVERLAY_bounds(cb, ob, color, OB_BOUND_CAPSULE, true);
457  break;
458  }
459 }
460 
461 static void OVERLAY_texture_space(OVERLAY_ExtraCallBuffers *cb, Object *ob, const float *color)
462 {
463  if (ob->data == NULL) {
464  return;
465  }
466 
467  ID *ob_data = ob->data;
468  float *texcoloc = NULL;
469  float *texcosize = NULL;
470 
471  switch (GS(ob_data->name)) {
472  case ID_ME:
473  BKE_mesh_texspace_get_reference((Mesh *)ob_data, NULL, &texcoloc, &texcosize);
474  break;
475  case ID_CU: {
476  Curve *cu = (Curve *)ob_data;
478  texcoloc = cu->loc;
479  texcosize = cu->size;
480  break;
481  }
482  case ID_MB: {
483  MetaBall *mb = (MetaBall *)ob_data;
484  texcoloc = mb->loc;
485  texcosize = mb->size;
486  break;
487  }
488  case ID_HA:
489  case ID_PT:
490  case ID_VO: {
491  /* No user defined texture space support. */
492  break;
493  }
494  default:
495  BLI_assert(0);
496  }
497 
498  float mat[4][4];
499 
500  if (texcoloc != NULL && texcosize != NULL) {
501  size_to_mat4(mat, texcosize);
502  copy_v3_v3(mat[3], texcoloc);
503  }
504  else {
505  unit_m4(mat);
506  }
507 
508  mul_m4_m4m4(mat, ob->obmat, mat);
509 
510  DRW_buffer_add_entry(cb->empty_cube, color, mat);
511 }
512 
514 {
515  int theme_id = DRW_object_wire_theme_get(ob, view_layer, NULL);
516  float *color = DRW_color_background_blend_get(theme_id);
517  PartDeflect *pd = ob->pd;
518  Curve *cu = (ob->type == OB_CURVE) ? ob->data : NULL;
519 
520  union {
521  float mat[4][4];
522  struct {
523  float _pad00[3], size_x;
524  float _pad01[3], size_y;
525  float _pad02[3], size_z;
526  float pos[3], _pad03[1];
527  };
528  } instdata;
529 
530  copy_m4_m4(instdata.mat, ob->obmat);
531  instdata.size_x = instdata.size_y = instdata.size_z = ob->empty_drawsize;
532 
533  switch (pd->forcefield) {
534  case PFIELD_FORCE:
535  DRW_buffer_add_entry(cb->field_force, color, &instdata);
536  break;
537  case PFIELD_WIND:
538  instdata.size_z = pd->f_strength;
539  DRW_buffer_add_entry(cb->field_wind, color, &instdata);
540  break;
541  case PFIELD_VORTEX:
542  instdata.size_y = (pd->f_strength < 0.0f) ? -instdata.size_y : instdata.size_y;
543  DRW_buffer_add_entry(cb->field_vortex, color, &instdata);
544  break;
545  case PFIELD_GUIDE:
546  if (cu && (cu->flag & CU_PATH) && ob->runtime.curve_cache->anim_path_accum_length) {
547  instdata.size_x = instdata.size_y = instdata.size_z = pd->f_strength;
548  float pos[4], tmp[3];
549  BKE_where_on_path(ob, 0.0f, pos, tmp, NULL, NULL, NULL);
550  copy_v3_v3(instdata.pos, ob->obmat[3]);
551  translate_m4(instdata.mat, pos[0], pos[1], pos[2]);
552  DRW_buffer_add_entry(cb->field_curve, color, &instdata);
553 
554  BKE_where_on_path(ob, 1.0f, pos, tmp, NULL, NULL, NULL);
555  copy_v3_v3(instdata.pos, ob->obmat[3]);
556  translate_m4(instdata.mat, pos[0], pos[1], pos[2]);
557  DRW_buffer_add_entry(cb->field_sphere_limit, color, &instdata);
558  /* Restore */
559  copy_v3_v3(instdata.pos, ob->obmat[3]);
560  }
561  break;
562  }
563 
564  if (pd->falloff == PFIELD_FALL_TUBE) {
565  if (pd->flag & (PFIELD_USEMAX | PFIELD_USEMAXR)) {
566  instdata.size_z = (pd->flag & PFIELD_USEMAX) ? pd->maxdist : 0.0f;
567  instdata.size_x = (pd->flag & PFIELD_USEMAXR) ? pd->maxrad : 1.0f;
568  instdata.size_y = instdata.size_x;
569  DRW_buffer_add_entry(cb->field_tube_limit, color, &instdata);
570  }
571  if (pd->flag & (PFIELD_USEMIN | PFIELD_USEMINR)) {
572  instdata.size_z = (pd->flag & PFIELD_USEMIN) ? pd->mindist : 0.0f;
573  instdata.size_x = (pd->flag & PFIELD_USEMINR) ? pd->minrad : 1.0f;
574  instdata.size_y = instdata.size_x;
575  DRW_buffer_add_entry(cb->field_tube_limit, color, &instdata);
576  }
577  }
578  else if (pd->falloff == PFIELD_FALL_CONE) {
579  if (pd->flag & (PFIELD_USEMAX | PFIELD_USEMAXR)) {
580  float radius = DEG2RADF((pd->flag & PFIELD_USEMAXR) ? pd->maxrad : 1.0f);
581  float distance = (pd->flag & PFIELD_USEMAX) ? pd->maxdist : 0.0f;
582  instdata.size_x = distance * sinf(radius);
583  instdata.size_z = distance * cosf(radius);
584  instdata.size_y = instdata.size_x;
585  DRW_buffer_add_entry(cb->field_cone_limit, color, &instdata);
586  }
587  if (pd->flag & (PFIELD_USEMIN | PFIELD_USEMINR)) {
588  float radius = DEG2RADF((pd->flag & PFIELD_USEMINR) ? pd->minrad : 1.0f);
589  float distance = (pd->flag & PFIELD_USEMIN) ? pd->mindist : 0.0f;
590  instdata.size_x = distance * sinf(radius);
591  instdata.size_z = distance * cosf(radius);
592  instdata.size_y = instdata.size_x;
593  DRW_buffer_add_entry(cb->field_cone_limit, color, &instdata);
594  }
595  }
596  else if (pd->falloff == PFIELD_FALL_SPHERE) {
597  if (pd->flag & PFIELD_USEMAX) {
598  instdata.size_x = instdata.size_y = instdata.size_z = pd->maxdist;
599  DRW_buffer_add_entry(cb->field_sphere_limit, color, &instdata);
600  }
601  if (pd->flag & PFIELD_USEMIN) {
602  instdata.size_x = instdata.size_y = instdata.size_z = pd->mindist;
603  DRW_buffer_add_entry(cb->field_sphere_limit, color, &instdata);
604  }
605  }
606 }
607 
610 /* -------------------------------------------------------------------- */
615 {
617  const DRWContextState *draw_ctx = DRW_context_state_get();
618  ViewLayer *view_layer = draw_ctx->view_layer;
619 
620  Light *la = ob->data;
621  float *color_p;
622  DRW_object_wire_theme_get(ob, view_layer, &color_p);
623  /* Remove the alpha. */
624  float color[4] = {UNPACK3(color_p), 1.0f};
625  /* Pack render data into object matrix. */
626  union {
627  float mat[4][4];
628  struct {
629  float _pad00[3];
630  union {
631  float area_size_x;
632  float spot_cosine;
633  };
634  float _pad01[3];
635  union {
636  float area_size_y;
637  float spot_blend;
638  };
639  float _pad02[3], clip_sta;
640  float pos[3], clip_end;
641  };
642  } instdata;
643 
644  copy_m4_m4(instdata.mat, ob->obmat);
645  /* FIXME / TODO: clip_end has no meaning nowadays.
646  * In EEVEE, Only clip_sta is used shadow-mapping.
647  * Clip end is computed automatically based on light power.
648  * For now, always use the custom distance as clip_end. */
649  instdata.clip_end = la->att_dist;
650  instdata.clip_sta = la->clipsta;
651 
652  DRW_buffer_add_entry(cb->groundline, instdata.pos);
653 
654  if (la->type == LA_LOCAL) {
655  instdata.area_size_x = instdata.area_size_y = la->area_size;
656  DRW_buffer_add_entry(cb->light_point, color, &instdata);
657  }
658  else if (la->type == LA_SUN) {
659  DRW_buffer_add_entry(cb->light_sun, color, &instdata);
660  }
661  else if (la->type == LA_SPOT) {
662  /* Previous implementation was using the clipend distance as cone size.
663  * We cannot do this anymore so we use a fixed size of 10. (see T72871) */
664  rescale_m4(instdata.mat, (float[3]){10.0f, 10.0f, 10.0f});
665  /* For cycles and eevee the spot attenuation is
666  * y = (1/(1 + x^2) - a)/((1 - a) b)
667  * We solve the case where spot attenuation y = 1 and y = 0
668  * root for y = 1 is (-1 - c) / c
669  * root for y = 0 is (1 - a) / a
670  * and use that to position the blend circle. */
671  float a = cosf(la->spotsize * 0.5f);
672  float b = la->spotblend;
673  float c = a * b - a - b;
674  /* Optimized version or root1 / root0 */
675  instdata.spot_blend = sqrtf((-a - c * a) / (c - c * a));
676  instdata.spot_cosine = a;
677  /* HACK: We pack the area size in alpha color. This is decoded by the shader. */
678  color[3] = -max_ff(la->area_size, FLT_MIN);
679  DRW_buffer_add_entry(cb->light_spot, color, &instdata);
680 
681  if ((la->mode & LA_SHOW_CONE) && !DRW_state_is_select()) {
682  const float color_inside[4] = {0.0f, 0.0f, 0.0f, 0.5f};
683  const float color_outside[4] = {1.0f, 1.0f, 1.0f, 0.3f};
684  DRW_buffer_add_entry(cb->light_spot_cone_front, color_inside, &instdata);
685  DRW_buffer_add_entry(cb->light_spot_cone_back, color_outside, &instdata);
686  }
687  }
688  else if (la->type == LA_AREA) {
689  bool uniform_scale = !ELEM(la->area_shape, LA_AREA_RECT, LA_AREA_ELLIPSE);
691  instdata.area_size_x = la->area_size;
692  instdata.area_size_y = uniform_scale ? la->area_size : la->area_sizey;
693  DRW_buffer_add_entry(cb->light_area[sqr], color, &instdata);
694  }
695 }
696 
699 /* -------------------------------------------------------------------- */
704 {
706  const DRWContextState *draw_ctx = DRW_context_state_get();
707  ViewLayer *view_layer = draw_ctx->view_layer;
708  float *color_p;
709  int theme_id = DRW_object_wire_theme_get(ob, view_layer, &color_p);
710  const LightProbe *prb = (LightProbe *)ob->data;
711  const bool show_clipping = (prb->flag & LIGHTPROBE_FLAG_SHOW_CLIP_DIST) != 0;
712  const bool show_parallax = (prb->flag & LIGHTPROBE_FLAG_SHOW_PARALLAX) != 0;
713  const bool show_influence = (prb->flag & LIGHTPROBE_FLAG_SHOW_INFLUENCE) != 0;
714  const bool show_data = (ob->base_flag & BASE_SELECTED) || DRW_state_is_select();
715 
716  union {
717  float mat[4][4];
718  struct {
719  float _pad00[4];
720  float _pad01[4];
721  float _pad02[3], clip_sta;
722  float pos[3], clip_end;
723  };
724  } instdata;
725 
726  copy_m4_m4(instdata.mat, ob->obmat);
727 
728  switch (prb->type) {
730  instdata.clip_sta = show_clipping ? prb->clipsta : -1.0;
731  instdata.clip_end = show_clipping ? prb->clipend : -1.0;
732  DRW_buffer_add_entry(cb->probe_cube, color_p, &instdata);
733  DRW_buffer_add_entry(cb->groundline, instdata.pos);
734 
735  if (show_influence) {
737  float f = 1.0f - prb->falloff;
738  OVERLAY_empty_shape(cb, ob->obmat, prb->distinf, shape, color_p);
739  OVERLAY_empty_shape(cb, ob->obmat, prb->distinf * f, shape, color_p);
740  }
741 
742  if (show_parallax) {
743  char shape = (prb->parallax_type == LIGHTPROBE_SHAPE_BOX) ? OB_CUBE : OB_EMPTY_SPHERE;
744  float dist = ((prb->flag & LIGHTPROBE_FLAG_CUSTOM_PARALLAX) != 0) ? prb->distpar :
745  prb->distinf;
746  OVERLAY_empty_shape(cb, ob->obmat, dist, shape, color_p);
747  }
748  break;
750  instdata.clip_sta = show_clipping ? prb->clipsta : -1.0;
751  instdata.clip_end = show_clipping ? prb->clipend : -1.0;
752  DRW_buffer_add_entry(cb->probe_grid, color_p, &instdata);
753 
754  if (show_influence) {
755  float f = 1.0f - prb->falloff;
756  OVERLAY_empty_shape(cb, ob->obmat, 1.0 + prb->distinf, OB_CUBE, color_p);
757  OVERLAY_empty_shape(cb, ob->obmat, 1.0 + prb->distinf * f, OB_CUBE, color_p);
758  }
759 
760  /* Data dots */
761  if (show_data) {
762  instdata.mat[0][3] = prb->grid_resolution_x;
763  instdata.mat[1][3] = prb->grid_resolution_y;
764  instdata.mat[2][3] = prb->grid_resolution_z;
765  /* Put theme id in matrix. */
766  if (UNLIKELY(ob->base_flag & BASE_FROM_DUPLI)) {
767  instdata.mat[3][3] = 0.0;
768  }
769  else if (theme_id == TH_ACTIVE) {
770  instdata.mat[3][3] = 1.0;
771  }
772  else /* TH_SELECT */ {
773  instdata.mat[3][3] = 2.0;
774  }
775 
776  uint cell_count = prb->grid_resolution_x * prb->grid_resolution_y * prb->grid_resolution_z;
778  DRW_shgroup_uniform_vec4_array_copy(grp, "gridModelMatrix", instdata.mat, 4);
779  DRW_shgroup_call_procedural_points(grp, NULL, cell_count);
780  }
781  break;
783  DRW_buffer_add_entry(cb->probe_planar, color_p, &instdata);
784 
786  DRW_buffer_add_entry(cb->solid_quad, color_p, &instdata);
787  }
788 
789  if (show_influence) {
790  normalize_v3_length(instdata.mat[2], prb->distinf);
791  DRW_buffer_add_entry(cb->empty_cube, color_p, &instdata);
792  mul_v3_fl(instdata.mat[2], 1.0f - prb->falloff);
793  DRW_buffer_add_entry(cb->empty_cube, color_p, &instdata);
794  }
795  zero_v3(instdata.mat[2]);
796  DRW_buffer_add_entry(cb->empty_cube, color_p, &instdata);
797 
798  normalize_m4_m4(instdata.mat, ob->obmat);
799  OVERLAY_empty_shape(cb, instdata.mat, ob->empty_drawsize, OB_SINGLE_ARROW, color_p);
800  break;
801  }
802 }
803 
806 /* -------------------------------------------------------------------- */
811 {
813  const DRWContextState *draw_ctx = DRW_context_state_get();
814  ViewLayer *view_layer = draw_ctx->view_layer;
815  float *color_p;
816  DRW_object_wire_theme_get(ob, view_layer, &color_p);
817 
818  DRW_buffer_add_entry(cb->speaker, color_p, ob->obmat);
819 }
820 
823 /* -------------------------------------------------------------------- */
828  /* Pack render data into object matrix and object color. */
829  struct {
830  float color[4];
831  float mat[4][4];
832  };
833  struct {
834  float _pad0[2];
835  float volume_sta;
836  union {
837  float depth;
838  float focus;
839  float volume_end;
840  };
841  float _pad00[3];
842  union {
843  float corner_x;
845  };
846  float _pad01[3];
847  union {
848  float corner_y;
849  };
850  float _pad02[3];
851  union {
852  float center_x;
853  float clip_sta;
854  float mist_sta;
855  };
856  float pos[3];
857  union {
858  float center_y;
859  float clip_end;
860  float mist_end;
861  };
862  };
864 
866  Scene *scene,
867  View3D *v3d,
868  Object *ob,
869  const float color[4])
870 {
871  const DRWContextState *draw_ctx = DRW_context_state_get();
872  const bool is_select = DRW_state_is_select();
873 
874  MovieClip *clip = BKE_object_movieclip_get(scene, ob, false);
875  if (clip == NULL) {
876  return;
877  }
878 
879  const bool is_solid_bundle = (v3d->bundle_drawtype == OB_EMPTY_SPHERE) &&
880  ((v3d->shading.type != OB_SOLID) || !XRAY_FLAG_ENABLED(v3d));
881 
882  MovieTracking *tracking = &clip->tracking;
883  /* Index must start in 1, to mimic BKE_tracking_track_get_indexed. */
884  int track_index = 1;
885 
886  float bundle_color_custom[3];
887  float *bundle_color_solid = G_draw.block.colorBundleSolid;
888  float *bundle_color_unselected = G_draw.block.colorWire;
889  uchar text_color_selected[4], text_color_unselected[4];
890  /* Color Management: Exception here as texts are drawn in sRGB space directly. */
891  UI_GetThemeColor4ubv(TH_SELECT, text_color_selected);
892  UI_GetThemeColor4ubv(TH_TEXT, text_color_unselected);
893 
894  float camera_mat[4][4];
896 
897  LISTBASE_FOREACH (MovieTrackingObject *, tracking_object, &tracking->objects) {
898  float tracking_object_mat[4][4];
899 
900  if (tracking_object->flag & TRACKING_OBJECT_CAMERA) {
901  copy_m4_m4(tracking_object_mat, camera_mat);
902  }
903  else {
904  const int framenr = BKE_movieclip_remap_scene_to_clip_frame(
905  clip, DEG_get_ctime(draw_ctx->depsgraph));
906 
907  float object_mat[4][4];
909  tracking, tracking_object, framenr, object_mat);
910 
911  float object_imat[4][4];
912  invert_m4_m4(object_imat, object_mat);
913 
914  mul_m4_m4m4(tracking_object_mat, ob->obmat, object_imat);
915  }
916 
917  ListBase *tracksbase = BKE_tracking_object_get_tracks(tracking, tracking_object);
918  LISTBASE_FOREACH (MovieTrackingTrack *, track, tracksbase) {
919  if ((track->flag & TRACK_HAS_BUNDLE) == 0) {
920  continue;
921  }
922  bool is_selected = TRACK_SELECTED(track);
923 
924  float bundle_mat[4][4];
925  copy_m4_m4(bundle_mat, tracking_object_mat);
926  translate_m4(bundle_mat, track->bundle_pos[0], track->bundle_pos[1], track->bundle_pos[2]);
927 
928  const float *bundle_color;
929  if (track->flag & TRACK_CUSTOMCOLOR) {
930  /* Meh, hardcoded srgb transform here. */
931  /* TODO change the actual DNA color to be linear. */
932  srgb_to_linearrgb_v3_v3(bundle_color_custom, track->color);
933  bundle_color = bundle_color_custom;
934  }
935  else if (is_solid_bundle) {
936  bundle_color = bundle_color_solid;
937  }
938  else if (is_selected) {
939  bundle_color = color;
940  }
941  else {
942  bundle_color = bundle_color_unselected;
943  }
944 
945  if (is_select) {
946  DRW_select_load_id(ob->runtime.select_id | (track_index << 16));
947  track_index++;
948  }
949 
950  if (is_solid_bundle) {
951  if (is_selected) {
952  OVERLAY_empty_shape(cb, bundle_mat, v3d->bundle_size, v3d->bundle_drawtype, color);
953  }
954 
955  const float bundle_color_v4[4] = {
956  bundle_color[0],
957  bundle_color[1],
958  bundle_color[2],
959  1.0f,
960  };
961 
962  bundle_mat[3][3] = v3d->bundle_size; /* See shader. */
963  DRW_buffer_add_entry(cb->empty_sphere_solid, bundle_color_v4, bundle_mat);
964  }
965  else {
966  OVERLAY_empty_shape(cb, bundle_mat, v3d->bundle_size, v3d->bundle_drawtype, bundle_color);
967  }
968 
969  if ((v3d->flag2 & V3D_SHOW_BUNDLENAME) && !is_select) {
970  struct DRWTextStore *dt = DRW_text_cache_ensure();
971 
973  bundle_mat[3],
974  track->name,
975  strlen(track->name),
976  10,
977  0,
979  is_selected ? text_color_selected : text_color_unselected);
980  }
981  }
982 
983  if ((v3d->flag2 & V3D_SHOW_CAMERAPATH) && (tracking_object->flag & TRACKING_OBJECT_CAMERA) &&
984  !is_select) {
986  reconstruction = BKE_tracking_object_get_reconstruction(tracking, tracking_object);
987 
988  if (reconstruction->camnr) {
989  MovieReconstructedCamera *camera = reconstruction->cameras;
990  float v0[3], v1[3];
991  for (int a = 0; a < reconstruction->camnr; a++, camera++) {
992  copy_v3_v3(v0, v1);
993  copy_v3_v3(v1, camera->mat[3]);
994  mul_m4_v3(camera_mat, v1);
995  if (a > 0) {
996  /* This one is suboptimal (gl_lines instead of gl_line_strip)
997  * but we keep this for simplicity */
999  }
1000  }
1001  }
1002  }
1003  }
1004 }
1005 
1007  Object *ob,
1008  const OVERLAY_CameraInstanceData *instdata,
1009  bool right_eye)
1010 {
1011  Camera *cam = ob->data;
1012  if (cam->stereo.convergence_mode == CAM_S3D_OFFAXIS) {
1013  const char *viewnames[2] = {STEREO_LEFT_NAME, STEREO_RIGHT_NAME};
1014  const float shiftx = BKE_camera_multiview_shift_x(&scene->r, ob, viewnames[right_eye]);
1015  const float delta_shiftx = shiftx - cam->shiftx;
1016  const float width = instdata->corner_x * 2.0f;
1017  return delta_shiftx * width;
1018  }
1019 
1020  return 0.0;
1021 }
1027  Scene *scene,
1028  View3D *v3d,
1029  Object *ob,
1030  const OVERLAY_CameraInstanceData *instdata)
1031 {
1032  OVERLAY_CameraInstanceData stereodata = *instdata;
1033  Camera *cam = ob->data;
1034  const bool is_select = DRW_state_is_select();
1035  const char *viewnames[2] = {STEREO_LEFT_NAME, STEREO_RIGHT_NAME};
1036 
1037  const bool is_stereo3d_cameras = (v3d->stereo3d_flag & V3D_S3D_DISPCAMERAS) != 0;
1038  const bool is_stereo3d_plane = (v3d->stereo3d_flag & V3D_S3D_DISPPLANE) != 0;
1039  const bool is_stereo3d_volume = (v3d->stereo3d_flag & V3D_S3D_DISPVOLUME) != 0;
1040 
1041  if (!is_stereo3d_cameras) {
1042  /* Draw single camera. */
1044  }
1045 
1046  for (int eye = 0; eye < 2; eye++) {
1047  ob = BKE_camera_multiview_render(scene, ob, viewnames[eye]);
1048  BKE_camera_multiview_model_matrix(&scene->r, ob, viewnames[eye], stereodata.mat);
1049 
1050  stereodata.corner_x = instdata->corner_x;
1051  stereodata.corner_y = instdata->corner_y;
1052  stereodata.center_x = instdata->center_x + camera_offaxis_shiftx_get(scene, ob, instdata, eye);
1053  stereodata.center_y = instdata->center_y;
1054  stereodata.depth = instdata->depth;
1055 
1056  if (is_stereo3d_cameras) {
1057  DRW_buffer_add_entry_struct(cb->camera_frame, &stereodata);
1058 
1059  /* Connecting line between cameras. */
1060  OVERLAY_extra_line_dashed(cb, stereodata.pos, instdata->pos, G_draw.block.colorWire);
1061  }
1062 
1063  if (is_stereo3d_volume && !is_select) {
1064  float r = (eye == 1) ? 2.0f : 1.0f;
1065 
1066  stereodata.volume_sta = -cam->clip_start;
1067  stereodata.volume_end = -cam->clip_end;
1068  /* Encode eye + intensity and alpha (see shader) */
1069  copy_v2_fl2(stereodata.color, r + 0.15f, 1.0f);
1071 
1072  if (v3d->stereo3d_volume_alpha > 0.0f) {
1073  /* Encode eye + intensity and alpha (see shader) */
1074  copy_v2_fl2(stereodata.color, r + 0.999f, v3d->stereo3d_volume_alpha);
1075  DRW_buffer_add_entry_struct(cb->camera_volume, &stereodata);
1076  }
1077  /* restore */
1078  copy_v3_v3(stereodata.color, instdata->color);
1079  }
1080  }
1081 
1082  if (is_stereo3d_plane && !is_select) {
1083  if (cam->stereo.convergence_mode == CAM_S3D_TOE) {
1084  /* There is no real convergence plane but we highlight the center
1085  * point where the views are pointing at. */
1086  // zero_v3(stereodata.mat[0]); /* We reconstruct from Z and Y */
1087  // zero_v3(stereodata.mat[1]); /* Y doesn't change */
1088  zero_v3(stereodata.mat[2]);
1089  zero_v3(stereodata.mat[3]);
1090  for (int i = 0; i < 2; i++) {
1091  float mat[4][4];
1092  /* Need normalized version here. */
1093  BKE_camera_multiview_model_matrix(&scene->r, ob, viewnames[i], mat);
1094  add_v3_v3(stereodata.mat[2], mat[2]);
1095  madd_v3_v3fl(stereodata.mat[3], mat[3], 0.5f);
1096  }
1097  normalize_v3(stereodata.mat[2]);
1098  cross_v3_v3v3(stereodata.mat[0], stereodata.mat[1], stereodata.mat[2]);
1099  }
1100  else if (cam->stereo.convergence_mode == CAM_S3D_PARALLEL) {
1101  /* Show plane at the given distance between the views even if it makes no sense. */
1102  zero_v3(stereodata.pos);
1103  for (int i = 0; i < 2; i++) {
1104  float mat[4][4];
1105  BKE_camera_multiview_model_matrix_scaled(&scene->r, ob, viewnames[i], mat);
1106  madd_v3_v3fl(stereodata.pos, mat[3], 0.5f);
1107  }
1108  }
1109  else if (cam->stereo.convergence_mode == CAM_S3D_OFFAXIS) {
1110  /* Nothing to do. Everything is already setup. */
1111  }
1112  stereodata.volume_sta = -cam->stereo.convergence_distance;
1113  stereodata.volume_end = -cam->stereo.convergence_distance;
1114  /* Encode eye + intensity and alpha (see shader) */
1115  copy_v2_fl2(stereodata.color, 0.1f, 1.0f);
1117 
1118  if (v3d->stereo3d_convergence_alpha > 0.0f) {
1119  /* Encode eye + intensity and alpha (see shader) */
1120  copy_v2_fl2(stereodata.color, 0.0f, v3d->stereo3d_convergence_alpha);
1121  DRW_buffer_add_entry_struct(cb->camera_volume, &stereodata);
1122  }
1123  }
1124 }
1125 
1127 {
1129  OVERLAY_CameraInstanceData instdata;
1130 
1131  const DRWContextState *draw_ctx = DRW_context_state_get();
1132  ViewLayer *view_layer = draw_ctx->view_layer;
1133  View3D *v3d = draw_ctx->v3d;
1134  Scene *scene = draw_ctx->scene;
1135  RegionView3D *rv3d = draw_ctx->rv3d;
1136 
1137  Camera *cam = ob->data;
1138  Object *camera_object = DEG_get_evaluated_object(draw_ctx->depsgraph, v3d->camera);
1139  const bool is_select = DRW_state_is_select();
1140  const bool is_active = (ob == camera_object);
1141  const bool look_through = (is_active && (rv3d->persp == RV3D_CAMOB));
1142 
1143  const bool is_multiview = (scene->r.scemode & R_MULTIVIEW) != 0;
1144  const bool is_stereo3d_view = (scene->r.views_format == SCE_VIEWS_FORMAT_STEREO_3D);
1145  const bool is_stereo3d_display_extra = is_active && is_multiview && (!look_through) &&
1146  ((v3d->stereo3d_flag) != 0);
1147  const bool is_selection_camera_stereo = is_select && look_through && is_multiview &&
1148  is_stereo3d_view;
1149 
1150  float vec[4][3], asp[2], shift[2], scale[3], drawsize, center[2], corner[2];
1151 
1152  float *color_p;
1153  DRW_object_wire_theme_get(ob, view_layer, &color_p);
1154  copy_v4_v4(instdata.color, color_p);
1155 
1156  normalize_m4_m4(instdata.mat, ob->obmat);
1157 
1158  /* BKE_camera_multiview_model_matrix already accounts for scale, don't do it here. */
1159  if (is_selection_camera_stereo) {
1160  copy_v3_fl(scale, 1.0f);
1161  }
1162  else {
1163  copy_v3_fl3(scale, len_v3(ob->obmat[0]), len_v3(ob->obmat[1]), len_v3(ob->obmat[2]));
1164  /* Avoid division by 0. */
1165  if (ELEM(0.0f, scale[0], scale[1], scale[2])) {
1166  return;
1167  }
1168  invert_v3(scale);
1169  }
1170 
1172  scene, cam, cam->drawsize, look_through, scale, asp, shift, &drawsize, vec);
1173 
1174  /* Apply scale to simplify the rest of the drawing. */
1175  invert_v3(scale);
1176  for (int i = 0; i < 4; i++) {
1177  mul_v3_v3(vec[i], scale);
1178  /* Project to z=-1 plane. Makes positioning / scaling easier. (see shader) */
1179  mul_v2_fl(vec[i], 1.0f / fabsf(vec[i][2]));
1180  }
1181 
1182  /* Frame coords */
1183  mid_v2_v2v2(center, vec[0], vec[2]);
1184  sub_v2_v2v2(corner, vec[0], center);
1185  instdata.corner_x = corner[0];
1186  instdata.corner_y = corner[1];
1187  instdata.center_x = center[0];
1188  instdata.center_y = center[1];
1189  instdata.depth = vec[0][2];
1190 
1191  if (look_through) {
1192  if (!DRW_state_is_image_render()) {
1193  /* Only draw the frame. */
1194  if (is_multiview) {
1195  float mat[4][4];
1196  const bool is_right = v3d->multiview_eye == STEREO_RIGHT_ID;
1197  const char *view_name = is_right ? STEREO_RIGHT_NAME : STEREO_LEFT_NAME;
1198  BKE_camera_multiview_model_matrix(&scene->r, ob, view_name, mat);
1199  instdata.center_x += camera_offaxis_shiftx_get(scene, ob, &instdata, is_right);
1200  for (int i = 0; i < 4; i++) {
1201  /* Partial copy to avoid overriding packed data. */
1202  copy_v3_v3(instdata.mat[i], mat[i]);
1203  }
1204  }
1205  instdata.depth = -instdata.depth; /* Hides the back of the camera wires (see shader). */
1206  DRW_buffer_add_entry_struct(cb->camera_frame, &instdata);
1207  }
1208  }
1209  else {
1210  /* Stereo cameras, volumes, plane drawing. */
1211  if (is_stereo3d_display_extra) {
1212  camera_stereoscopy_extra(cb, scene, v3d, ob, &instdata);
1213  }
1214  else {
1215  DRW_buffer_add_entry_struct(cb->camera_frame, &instdata);
1216  }
1217  }
1218 
1219  if (!look_through) {
1220  /* Triangle. */
1221  float tria_size = 0.7f * drawsize / fabsf(instdata.depth);
1222  float tria_margin = 0.1f * drawsize / fabsf(instdata.depth);
1223  instdata.center_x = center[0];
1224  instdata.center_y = center[1] + instdata.corner_y + tria_margin + tria_size;
1225  instdata.corner_x = instdata.corner_y = -tria_size;
1226  DRW_buffer_add_entry_struct(cb->camera_tria[is_active], &instdata);
1227  }
1228 
1229  if (cam->flag & CAM_SHOWLIMITS) {
1230  /* Scale focus point. */
1231  mul_v3_fl(instdata.mat[0], cam->drawsize);
1232  mul_v3_fl(instdata.mat[1], cam->drawsize);
1233 
1234  instdata.dist_color_id = (is_active) ? 3 : 2;
1235  instdata.focus = -BKE_camera_object_dof_distance(ob);
1236  instdata.clip_sta = cam->clip_start;
1237  instdata.clip_end = cam->clip_end;
1239  }
1240 
1241  if (cam->flag & CAM_SHOWMIST) {
1242  World *world = scene->world;
1243  if (world) {
1244  instdata.dist_color_id = (is_active) ? 1 : 0;
1245  instdata.focus = 1.0f; /* Disable */
1246  instdata.mist_sta = world->miststa;
1247  instdata.mist_end = world->miststa + world->mistdist;
1249  }
1250  }
1251 
1252  /* Motion Tracking. */
1253  if ((v3d->flag2 & V3D_SHOW_RECONSTRUCTION) != 0) {
1254  camera_view3d_reconstruction(cb, scene, v3d, ob, color_p);
1255  }
1256 
1257  /* Background images. */
1258  if (look_through && (cam->flag & CAM_SHOW_BG_IMAGE) && !BLI_listbase_is_empty(&cam->bg_images)) {
1260  }
1261 }
1262 
1265 /* -------------------------------------------------------------------- */
1271  Scene *scene,
1272  Object *ob)
1273 {
1274  float *relation_color = G_draw.block.colorWire;
1275  float *constraint_color = G_draw.block.colorGridAxisZ; /* ? */
1276 
1278  float *parent_pos = ob->runtime.parent_display_origin;
1279  OVERLAY_extra_line_dashed(cb, parent_pos, ob->obmat[3], relation_color);
1280  }
1281 
1282  /* Drawing the hook lines. */
1283  for (ModifierData *md = ob->modifiers.first; md; md = md->next) {
1284  if (md->type == eModifierType_Hook) {
1285  HookModifierData *hmd = (HookModifierData *)md;
1286  float center[3];
1287  mul_v3_m4v3(center, ob->obmat, hmd->cent);
1288  if (hmd->object) {
1289  OVERLAY_extra_line_dashed(cb, hmd->object->obmat[3], center, relation_color);
1290  }
1291  OVERLAY_extra_point(cb, center, relation_color);
1292  }
1293  }
1294  for (GpencilModifierData *md = ob->greasepencil_modifiers.first; md; md = md->next) {
1295  if (md->type == eGpencilModifierType_Hook) {
1297  float center[3];
1298  mul_v3_m4v3(center, ob->obmat, hmd->cent);
1299  if (hmd->object) {
1300  OVERLAY_extra_line_dashed(cb, hmd->object->obmat[3], center, relation_color);
1301  }
1302  OVERLAY_extra_point(cb, center, relation_color);
1303  }
1304  }
1305 
1306  if (ob->rigidbody_constraint) {
1307  Object *rbc_ob1 = ob->rigidbody_constraint->ob1;
1308  Object *rbc_ob2 = ob->rigidbody_constraint->ob2;
1309  if (rbc_ob1 && (DRW_object_visibility_in_active_context(rbc_ob1) & OB_VISIBLE_SELF)) {
1310  OVERLAY_extra_line_dashed(cb, rbc_ob1->obmat[3], ob->obmat[3], relation_color);
1311  }
1312  if (rbc_ob2 && (DRW_object_visibility_in_active_context(rbc_ob2) & OB_VISIBLE_SELF)) {
1313  OVERLAY_extra_line_dashed(cb, rbc_ob2->obmat[3], ob->obmat[3], relation_color);
1314  }
1315  }
1316 
1317  /* Drawing the constraint lines */
1318  if (!BLI_listbase_is_empty(&ob->constraints)) {
1319  bConstraint *curcon;
1320  bConstraintOb *cob;
1321  ListBase *list = &ob->constraints;
1322 
1324 
1325  for (curcon = list->first; curcon; curcon = curcon->next) {
1327  /* special case for object solver and follow track constraints because they don't fill
1328  * constraint targets properly (design limitation -- scene is needed for their target
1329  * but it can't be accessed from get_targets callback) */
1330  Object *camob = NULL;
1331 
1332  if (curcon->type == CONSTRAINT_TYPE_FOLLOWTRACK) {
1334  camob = data->camera ? data->camera : scene->camera;
1335  }
1336  else if (curcon->type == CONSTRAINT_TYPE_OBJECTSOLVER) {
1338  camob = data->camera ? data->camera : scene->camera;
1339  }
1340 
1341  if (camob) {
1342  OVERLAY_extra_line_dashed(cb, camob->obmat[3], ob->obmat[3], constraint_color);
1343  }
1344  }
1345  else {
1346  const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(curcon);
1347 
1348  if ((cti && cti->get_constraint_targets) && (curcon->ui_expand_flag & (1 << 0))) {
1349  ListBase targets = {NULL, NULL};
1350  bConstraintTarget *ct;
1351 
1352  cti->get_constraint_targets(curcon, &targets);
1353 
1354  for (ct = targets.first; ct; ct = ct->next) {
1355  /* calculate target's matrix */
1356  if (cti->get_target_matrix) {
1357  cti->get_target_matrix(depsgraph, curcon, cob, ct, DEG_get_ctime(depsgraph));
1358  }
1359  else {
1360  unit_m4(ct->matrix);
1361  }
1362  OVERLAY_extra_line_dashed(cb, ct->matrix[3], ob->obmat[3], constraint_color);
1363  }
1364 
1365  if (cti->flush_constraint_targets) {
1366  cti->flush_constraint_targets(curcon, &targets, 1);
1367  }
1368  }
1369  }
1370  }
1372  }
1373 }
1374 
1377 /* -------------------------------------------------------------------- */
1382  OVERLAY_Data *data,
1383  Object *ob,
1384  ModifierData *md,
1385  Scene *scene,
1386  const float *color)
1387 {
1388  FluidModifierData *fmd = (FluidModifierData *)md;
1389  FluidDomainSettings *fds = fmd->domain;
1390 
1391  /* Don't show smoke before simulation starts, this could be made an option in the future. */
1392  const bool draw_velocity = (fds->draw_velocity && fds->fluid &&
1393  CFRA >= fds->point_cache[0]->startframe);
1394 
1395  /* Show gridlines only for slices with no interpolation. */
1396  const bool show_gridlines = (fds->show_gridlines && fds->fluid &&
1400 
1401  const bool color_with_flags = (fds->gridlines_color_field == FLUID_GRIDLINE_COLOR_TYPE_FLAGS);
1402 
1403  const bool color_range = (fds->gridlines_color_field == FLUID_GRIDLINE_COLOR_TYPE_RANGE &&
1404  fds->use_coba && fds->coba_field != FLUID_DOMAIN_FIELD_FLAGS);
1405 
1406  /* Small cube showing voxel size. */
1407  {
1408  float min[3];
1409  madd_v3fl_v3fl_v3fl_v3i(min, fds->p0, fds->cell_size, fds->res_min);
1410  float voxel_cubemat[4][4] = {{0.0f}};
1411  /* scale small cube to voxel size */
1412  voxel_cubemat[0][0] = fds->cell_size[0] / 2.0f;
1413  voxel_cubemat[1][1] = fds->cell_size[1] / 2.0f;
1414  voxel_cubemat[2][2] = fds->cell_size[2] / 2.0f;
1415  voxel_cubemat[3][3] = 1.0f;
1416  /* translate small cube to corner */
1417  copy_v3_v3(voxel_cubemat[3], min);
1418  /* move small cube into the domain (otherwise its centered on vertex of domain object) */
1419  translate_m4(voxel_cubemat, 1.0f, 1.0f, 1.0f);
1420  mul_m4_m4m4(voxel_cubemat, ob->obmat, voxel_cubemat);
1421 
1422  DRW_buffer_add_entry(cb->empty_cube, color, voxel_cubemat);
1423  }
1424 
1425  int slice_axis = -1;
1426 
1427  if (fds->axis_slice_method == AXIS_SLICE_SINGLE) {
1428  float viewinv[4][4];
1429  DRW_view_viewmat_get(NULL, viewinv, true);
1430 
1431  const int axis = (fds->slice_axis == SLICE_AXIS_AUTO) ? axis_dominant_v3_single(viewinv[2]) :
1432  fds->slice_axis - 1;
1433  slice_axis = axis;
1434  }
1435 
1436  if (draw_velocity) {
1437  const bool use_needle = (fds->vector_draw_type == VECTOR_DRAW_NEEDLE);
1438  const bool use_mac = (fds->vector_draw_type == VECTOR_DRAW_MAC);
1439  const bool draw_mac_x = (fds->vector_draw_mac_components & VECTOR_DRAW_MAC_X);
1440  const bool draw_mac_y = (fds->vector_draw_mac_components & VECTOR_DRAW_MAC_Y);
1441  const bool draw_mac_z = (fds->vector_draw_mac_components & VECTOR_DRAW_MAC_Z);
1442  const bool cell_centered = (fds->vector_field == FLUID_DOMAIN_VECTOR_FIELD_FORCE);
1443  int line_count = 1;
1444  if (use_needle) {
1445  line_count = 6;
1446  }
1447  else if (use_mac) {
1448  line_count = 3;
1449  }
1450  line_count *= fds->res[0] * fds->res[1] * fds->res[2];
1451 
1452  if (fds->axis_slice_method == AXIS_SLICE_SINGLE) {
1453  line_count /= fds->res[slice_axis];
1454  }
1455 
1457 
1458  GPUShader *sh = OVERLAY_shader_volume_velocity(use_needle, use_mac);
1459  DRWShadingGroup *grp = DRW_shgroup_create(sh, data->psl->extra_ps[0]);
1460  DRW_shgroup_uniform_texture(grp, "velocityX", fds->tex_velocity_x);
1461  DRW_shgroup_uniform_texture(grp, "velocityY", fds->tex_velocity_y);
1462  DRW_shgroup_uniform_texture(grp, "velocityZ", fds->tex_velocity_z);
1463  DRW_shgroup_uniform_float_copy(grp, "displaySize", fds->vector_scale);
1464  DRW_shgroup_uniform_float_copy(grp, "slicePosition", fds->slice_depth);
1465  DRW_shgroup_uniform_vec3_copy(grp, "cellSize", fds->cell_size);
1466  DRW_shgroup_uniform_vec3_copy(grp, "domainOriginOffset", fds->p0);
1467  DRW_shgroup_uniform_ivec3_copy(grp, "adaptiveCellOffset", fds->res_min);
1468  DRW_shgroup_uniform_int_copy(grp, "sliceAxis", slice_axis);
1469  DRW_shgroup_uniform_bool_copy(grp, "scaleWithMagnitude", fds->vector_scale_with_magnitude);
1470  DRW_shgroup_uniform_bool_copy(grp, "isCellCentered", cell_centered);
1471 
1472  if (use_mac) {
1473  DRW_shgroup_uniform_bool_copy(grp, "drawMACX", draw_mac_x);
1474  DRW_shgroup_uniform_bool_copy(grp, "drawMACY", draw_mac_y);
1475  DRW_shgroup_uniform_bool_copy(grp, "drawMACZ", draw_mac_z);
1476  }
1477 
1478  DRW_shgroup_call_procedural_lines(grp, ob, line_count);
1479  }
1480 
1481  if (show_gridlines) {
1482  GPUShader *sh = OVERLAY_shader_volume_gridlines(color_with_flags, color_range);
1483  DRWShadingGroup *grp = DRW_shgroup_create(sh, data->psl->extra_ps[0]);
1484  DRW_shgroup_uniform_ivec3_copy(grp, "volumeSize", fds->res);
1485  DRW_shgroup_uniform_float_copy(grp, "slicePosition", fds->slice_depth);
1486  DRW_shgroup_uniform_vec3_copy(grp, "cellSize", fds->cell_size);
1487  DRW_shgroup_uniform_vec3_copy(grp, "domainOriginOffset", fds->p0);
1488  DRW_shgroup_uniform_ivec3_copy(grp, "adaptiveCellOffset", fds->res_min);
1489  DRW_shgroup_uniform_int_copy(grp, "sliceAxis", slice_axis);
1490 
1491  if (color_with_flags || color_range) {
1493  DRW_shgroup_uniform_texture(grp, "flagTexture", fds->tex_flags);
1494  }
1495 
1496  if (color_range) {
1498  DRW_shgroup_uniform_texture(grp, "fieldTexture", fds->tex_range_field);
1499  DRW_shgroup_uniform_float_copy(grp, "lowerBound", fds->gridlines_lower_bound);
1500  DRW_shgroup_uniform_float_copy(grp, "upperBound", fds->gridlines_upper_bound);
1501  DRW_shgroup_uniform_vec4_copy(grp, "rangeColor", fds->gridlines_range_color);
1502  DRW_shgroup_uniform_int_copy(grp, "cellFilter", fds->gridlines_cell_filter);
1503  }
1504 
1505  const int line_count = 4 * fds->res[0] * fds->res[1] * fds->res[2] / fds->res[slice_axis];
1506  DRW_shgroup_call_procedural_lines(grp, ob, line_count);
1507  }
1508 
1509  if (draw_velocity || show_gridlines) {
1510  BLI_addtail(&data->stl->pd->smoke_domains, BLI_genericNodeN(fmd));
1511  }
1512 }
1513 
1515 {
1516  /* Free Smoke Textures after rendering */
1517  /* XXX This is a waste of processing and GPU bandwidth if nothing
1518  * is updated. But the problem is since Textures are stored in the
1519  * modifier we don't want them to take precious VRAM if the
1520  * modifier is not used for display. We should share them for
1521  * all viewport in a redraw at least. */
1522  LinkData *link;
1523  while ((link = BLI_pophead(&data->stl->pd->smoke_domains))) {
1524  FluidModifierData *fmd = (FluidModifierData *)link->data;
1526  MEM_freeN(link);
1527  }
1528 }
1529 
1532 /* -------------------------------------------------------------------- */
1533 
1535  Object *ob,
1536  OVERLAY_PrivateData *pd,
1537  ViewLayer *view_layer)
1538 {
1539  const bool is_library = ID_REAL_USERS(&ob->id) > 1 || ID_IS_LINKED(ob);
1540 
1541  if (ob == OBACT(view_layer)) {
1543  }
1544  else if (ob->base_flag & BASE_SELECTED) {
1545  DRWCallBuffer *cbuf = (is_library) ? cb->center_selected_lib : cb->center_selected;
1546  DRW_buffer_add_entry(cbuf, ob->obmat[3]);
1547  }
1548  else if (pd->v3d_flag & V3D_DRAW_CENTERS) {
1549  DRWCallBuffer *cbuf = (is_library) ? cb->center_deselected_lib : cb->center_deselected;
1550  DRW_buffer_add_entry(cbuf, ob->obmat[3]);
1551  }
1552 }
1553 
1554 static void OVERLAY_object_name(Object *ob, int theme_id)
1555 {
1556  struct DRWTextStore *dt = DRW_text_cache_ensure();
1557  uchar color[4];
1558  /* Color Management: Exception here as texts are drawn in sRGB space directly. */
1559  UI_GetThemeColor4ubv(theme_id, color);
1560 
1561  DRW_text_cache_add(dt,
1562  ob->obmat[3],
1563  ob->id.name + 2,
1564  strlen(ob->id.name + 2),
1565  10,
1566  0,
1568  color);
1569 }
1570 
1572 {
1574  OVERLAY_PrivateData *pd = vedata->stl->pd;
1575  const DRWContextState *draw_ctx = DRW_context_state_get();
1576  ViewLayer *view_layer = draw_ctx->view_layer;
1577  Scene *scene = draw_ctx->scene;
1578  ModifierData *md = NULL;
1579 
1580  const bool is_select_mode = DRW_state_is_select();
1581  const bool is_paint_mode = (draw_ctx->object_mode &
1583  const bool from_dupli = (ob->base_flag & (BASE_FROM_SET | BASE_FROM_DUPLI)) != 0;
1584  const bool has_bounds = !ELEM(ob->type, OB_LAMP, OB_CAMERA, OB_EMPTY, OB_SPEAKER, OB_LIGHTPROBE);
1585  const bool has_texspace = has_bounds &&
1587 
1588  const bool draw_relations = ((pd->v3d_flag & V3D_HIDE_HELPLINES) == 0) && !is_select_mode;
1589  const bool draw_obcenters = !is_paint_mode &&
1591  const bool draw_texspace = (ob->dtx & OB_TEXSPACE) && has_texspace;
1592  const bool draw_obname = (ob->dtx & OB_DRAWNAME) && DRW_state_show_text();
1593  const bool draw_bounds = has_bounds && ((ob->dt == OB_BOUNDBOX) ||
1594  ((ob->dtx & OB_DRAWBOUNDOX) && !from_dupli));
1595  const bool draw_xform = draw_ctx->object_mode == OB_MODE_OBJECT &&
1597  (ob->base_flag & BASE_SELECTED) && !is_select_mode;
1598  /* Don't show fluid domain overlay extras outside of cache range. */
1599  const bool draw_volume = !from_dupli &&
1602  (((FluidModifierData *)md)->domain != NULL) &&
1603  (CFRA >= (((FluidModifierData *)md)->domain->cache_frame_start)) &&
1604  (CFRA <= (((FluidModifierData *)md)->domain->cache_frame_end));
1605 
1606  float *color;
1607  int theme_id = DRW_object_wire_theme_get(ob, view_layer, &color);
1608 
1609  if (ob->pd && ob->pd->forcefield) {
1610  OVERLAY_forcefield(cb, ob, view_layer);
1611  }
1612 
1613  if (draw_bounds) {
1614  OVERLAY_bounds(cb, ob, color, ob->boundtype, false);
1615  }
1616  /* Helpers for when we're transforming origins. */
1617  if (draw_xform) {
1618  const float color_xform[4] = {0.15f, 0.15f, 0.15f, 0.7f};
1619  DRW_buffer_add_entry(cb->origin_xform, color_xform, ob->obmat);
1620  }
1621  /* don't show object extras in set's */
1622  if (!from_dupli) {
1623  if (draw_obcenters) {
1624  OVERLAY_object_center(cb, ob, pd, view_layer);
1625  }
1626  if (draw_relations) {
1627  OVERLAY_relationship_lines(cb, draw_ctx->depsgraph, draw_ctx->scene, ob);
1628  }
1629  if (draw_obname) {
1630  OVERLAY_object_name(ob, theme_id);
1631  }
1632  if (draw_texspace) {
1633  OVERLAY_texture_space(cb, ob, color);
1634  }
1635  if (ob->rigidbody_object != NULL) {
1636  OVERLAY_collision(cb, ob, color);
1637  }
1638  if (ob->dtx & OB_AXIS) {
1639  DRW_buffer_add_entry(cb->empty_axes, color, ob->obmat);
1640  }
1641  if (draw_volume) {
1642  OVERLAY_volume_extra(cb, vedata, ob, md, scene, color);
1643  }
1644  }
1645 }
1646 
1648 {
1649  DRW_draw_pass(vedata->psl->extra_blend_ps);
1650 }
1651 
1653 {
1654  DRW_draw_pass(vedata->psl->extra_ps[0]);
1655 }
1656 
1658 {
1659  DRW_draw_pass(vedata->psl->extra_ps[1]);
1660 
1662 }
1663 
1665 {
1666  OVERLAY_PassList *psl = vedata->psl;
1667 
1670 }
bool BKE_where_on_path(const struct Object *ob, float ctime, float r_vec[4], float r_dir[3], float r_quat[4], float *r_radius, float *r_weight)
Camera data-block and utility functions.
void BKE_camera_view_frame_ex(const struct Scene *scene, const struct Camera *camera, const float drawsize, const bool do_clip, const float scale[3], float r_asp[2], float r_shift[2], float *r_drawsize, float r_vec[4][3])
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)
float BKE_camera_object_dof_distance(struct Object *ob)
Definition: camera.c:227
void BKE_camera_multiview_model_matrix(const struct RenderData *rd, const struct Object *camera, const char *viewname, float r_modelmat[4][4])
void BKE_camera_multiview_model_matrix_scaled(const struct RenderData *rd, const struct Object *camera, const char *viewname, float r_modelmat[4][4])
struct bConstraintOb * BKE_constraints_make_evalob(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, void *subdata, short datatype)
Definition: constraint.c:133
const bConstraintTypeInfo * BKE_constraint_typeinfo_get(struct bConstraint *con)
Definition: constraint.c:5435
void BKE_constraints_clear_evalob(struct bConstraintOb *cob)
Definition: constraint.c:211
void BKE_curve_texspace_ensure(struct Curve *cu)
Definition: curve.c:554
@ G_TRANSFORM_OBJ
Definition: BKE_global.h:218
bool BKE_mball_is_basis(struct Object *ob)
Test, if ob is a basis meta-ball.
Definition: mball.c:398
void BKE_mesh_texspace_get_reference(struct Mesh *me, short **r_texflag, float **r_loc, float **r_size)
Definition: mesh.c:1135
bool BKE_modifier_is_enabled(const struct Scene *scene, struct ModifierData *md, int required_mode)
struct ModifierData * BKE_modifiers_findby_type(const struct Object *ob, ModifierType type)
float BKE_movieclip_remap_scene_to_clip_frame(const struct MovieClip *clip, float framenr)
General operations, lookup, etc. for blender objects.
struct MovieClip * BKE_object_movieclip_get(struct Scene *scene, struct Object *ob, bool use_default)
Definition: object.c:5079
void BKE_boundbox_calc_size_aabb(const struct BoundBox *bb, float r_size[3])
void BKE_boundbox_init_from_minmax(struct BoundBox *bb, const float min[3], const float max[3])
Definition: object.c:3778
@ OB_VISIBLE_SELF
Definition: BKE_object.h:125
void BKE_boundbox_calc_center_aabb(const struct BoundBox *bb, float r_cent[3])
struct BoundBox * BKE_object_boundbox_get(struct Object *ob)
Definition: object.c:3817
struct MovieTrackingReconstruction * BKE_tracking_object_get_reconstruction(struct MovieTracking *tracking, struct MovieTrackingObject *object)
Definition: tracking.c:2237
void BKE_tracking_get_camera_object_matrix(struct Object *camera_object, float mat[4][4])
Definition: tracking.c:399
void BKE_tracking_camera_get_reconstructed_interpolate(struct MovieTracking *tracking, struct MovieTrackingObject *object, float framenr, float mat[4][4])
Definition: tracking.c:2374
#define TRACK_SELECTED(track)
Definition: BKE_tracking.h:489
struct ListBase * BKE_tracking_object_get_tracks(struct MovieTracking *tracking, struct MovieTrackingObject *object)
Definition: tracking.c:2218
#define BLI_assert(a)
Definition: BLI_assert.h:58
BLI_INLINE bool BLI_listbase_is_empty(const struct ListBase *lb)
Definition: BLI_listbase.h:124
void * BLI_pophead(ListBase *listbase) ATTR_NONNULL(1)
Definition: listbase.c:257
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:172
struct LinkData * BLI_genericNodeN(void *data)
Definition: listbase.c:923
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:110
MINLINE float max_fff(float a, float b, float c)
MINLINE float max_ff(float a, float b)
MINLINE void srgb_to_linearrgb_v3_v3(float linear[3], const float srgb[3])
MINLINE int axis_dominant_v3_single(const float vec[3])
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
Definition: math_matrix.c:262
void unit_m4(float m[4][4])
Definition: rct.c:1140
void translate_m4(float mat[4][4], float tx, float ty, float tz)
Definition: math_matrix.c:2325
bool invert_m4_m4(float R[4][4], const float A[4][4])
Definition: math_matrix.c:1278
void rescale_m4(float mat[4][4], const float scale[3])
Definition: math_matrix.c:2396
void size_to_mat4(float R[4][4], const float size[3])
Definition: math_matrix.c:2118
void mul_m4_v3(const float M[4][4], float r[3])
Definition: math_matrix.c:732
void scale_m4_fl(float R[4][4], float scale)
Definition: math_matrix.c:2309
void normalize_m4_m4(float R[4][4], const float M[4][4]) ATTR_NONNULL()
Definition: math_matrix.c:1972
void copy_m4_m4(float m1[4][4], const float m2[4][4])
Definition: math_matrix.c:95
void mul_v3_m4v3(float r[3], const float M[4][4], const float v[3])
Definition: math_matrix.c:742
#define DEG2RADF(_deg)
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE void madd_v3_v3fl(float r[3], const float a[3], float f)
MINLINE void copy_v2_fl2(float v[2], float x, float y)
MINLINE void madd_v3fl_v3fl_v3fl_v3i(float r[3], const float a[3], const float b[3], const int c[3])
MINLINE float normalize_v3(float r[3])
MINLINE void mul_v3_v3(float r[3], const float a[3])
MINLINE void mul_v2_fl(float r[2], float f)
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void copy_v3_fl3(float v[3], float x, float y, float z)
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void negate_v3(float r[3])
MINLINE void invert_v3(float r[3])
void mid_v2_v2v2(float r[2], const float a[2], const float b[2])
Definition: math_vector.c:277
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2])
MINLINE void swap_v3_v3(float a[3], float b[3])
MINLINE float normalize_v3_length(float r[3], const float unit_scale)
MINLINE void copy_v3_fl(float r[3], float f)
MINLINE void zero_v3(float r[3])
MINLINE void add_v3_v3(float r[3], const float a[3])
MINLINE float len_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
unsigned char uchar
Definition: BLI_sys_types.h:86
unsigned int uint
Definition: BLI_sys_types.h:83
#define UNPACK3(a)
#define UNLIKELY(x)
#define ELEM(...)
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:51
float DEG_get_ctime(const Depsgraph *graph)
struct Object * DEG_get_evaluated_object(const struct Depsgraph *depsgraph, struct Object *object)
#define ID_IS_LINKED(_id)
Definition: DNA_ID.h:426
#define ID_REAL_USERS(id)
Definition: DNA_ID.h:413
@ ID_VO
Definition: DNA_ID_enums.h:95
@ ID_HA
Definition: DNA_ID_enums.h:93
@ ID_ME
Definition: DNA_ID_enums.h:60
@ ID_MB
Definition: DNA_ID_enums.h:62
@ ID_PT
Definition: DNA_ID_enums.h:94
@ ID_CU
Definition: DNA_ID_enums.h:61
@ CAM_SHOWLIMITS
@ CAM_SHOW_BG_IMAGE
@ CAM_SHOWMIST
@ CAM_S3D_PARALLEL
@ CAM_S3D_OFFAXIS
@ CAM_S3D_TOE
@ CONSTRAINT_TYPE_FOLLOWTRACK
@ CONSTRAINT_TYPE_OBJECTSOLVER
@ CONSTRAINT_OBTYPE_OBJECT
@ CU_PATH
@ AXIS_SLICE_SINGLE
@ VECTOR_DRAW_NEEDLE
@ VECTOR_DRAW_MAC
@ SLICE_AXIS_AUTO
@ FLUID_DOMAIN_FIELD_FLAGS
@ FLUID_DISPLAY_INTERP_CLOSEST
@ VECTOR_DRAW_MAC_X
@ VECTOR_DRAW_MAC_Y
@ VECTOR_DRAW_MAC_Z
@ FLUID_GRIDLINE_COLOR_TYPE_FLAGS
@ FLUID_GRIDLINE_COLOR_TYPE_RANGE
@ FLUID_DOMAIN_VECTOR_FIELD_FORCE
@ eGpencilModifierType_Hook
@ BASE_FROM_DUPLI
@ BASE_FROM_SET
@ BASE_SELECTED
#define LA_AREA
#define LA_SPOT
#define LA_AREA_SQUARE
#define LA_AREA_ELLIPSE
#define LA_SUN
#define LA_LOCAL
#define LA_SHOW_CONE
#define LA_AREA_RECT
@ LIGHTPROBE_SHAPE_BOX
@ LIGHTPROBE_FLAG_SHOW_PARALLAX
@ LIGHTPROBE_FLAG_SHOW_CLIP_DIST
@ LIGHTPROBE_FLAG_SHOW_INFLUENCE
@ LIGHTPROBE_FLAG_SHOW_DATA
@ LIGHTPROBE_FLAG_CUSTOM_PARALLAX
@ LIGHTPROBE_TYPE_CUBE
@ LIGHTPROBE_TYPE_PLANAR
@ LIGHTPROBE_TYPE_GRID
@ eModifierMode_Realtime
@ eModifierType_Fluid
@ eModifierType_Hook
#define OB_MODE_ALL_PAINT
@ OB_BOUNDBOX
@ OB_SOLID
#define OB_MODE_ALL_PAINT_GPENCIL
@ OB_MODE_OBJECT
#define PFIELD_USEMINR
#define PFIELD_FALL_CONE
#define PFIELD_USEMIN
@ PFIELD_FORCE
@ PFIELD_GUIDE
@ PFIELD_VORTEX
#define PFIELD_FALL_TUBE
#define PFIELD_USEMAXR
#define PFIELD_FALL_SPHERE
#define PFIELD_USEMAX
@ OB_BOUND_CAPSULE
@ OB_BOUND_SPHERE
@ OB_BOUND_CONE
@ OB_BOUND_BOX
@ OB_BOUND_CYLINDER
@ OB_DUPLICOLLECTION
@ OB_DRAWNAME
@ OB_DRAWBOUNDOX
@ OB_AXIS
@ OB_DRAW_IN_FRONT
@ OB_TEXSPACE
@ OB_EMPTY_CONE
@ OB_SINGLE_ARROW
@ OB_PLAINAXES
@ OB_ARROWS
@ OB_CIRCLE
@ OB_CUBE
@ OB_EMPTY_IMAGE
@ OB_EMPTY_SPHERE
@ OB_SPEAKER
@ OB_LATTICE
@ OB_MBALL
@ OB_EMPTY
@ OB_CAMERA
@ OB_ARMATURE
@ OB_LAMP
@ OB_CURVE
@ OB_GPENCIL
@ OB_LIGHTPROBE
Types and defines for representing Rigid Body entities.
@ RB_SHAPE_CAPSULE
@ RB_SHAPE_BOX
@ RB_SHAPE_SPHERE
@ RB_SHAPE_CYLINDER
@ RB_SHAPE_CONE
#define STEREO_LEFT_NAME
#define R_MULTIVIEW
#define CFRA
@ SCE_XFORM_DATA_ORIGIN
#define OBACT(_view_layer)
@ SCE_VIEWS_FORMAT_STEREO_3D
#define STEREO_RIGHT_NAME
@ STEREO_RIGHT_ID
@ TRACK_CUSTOMCOLOR
@ TRACK_HAS_BUNDLE
@ TRACKING_OBJECT_CAMERA
#define V3D_S3D_DISPCAMERAS
#define RV3D_CAMOB
#define V3D_HIDE_HELPLINES
#define V3D_DRAW_CENTERS
#define V3D_SHOW_BUNDLENAME
#define V3D_SHOW_CAMERAPATH
#define V3D_SHOW_RECONSTRUCTION
#define V3D_S3D_DISPVOLUME
@ V3D_OVERLAY_HIDE_OBJECT_ORIGINS
#define V3D_S3D_DISPPLANE
#define DRW_buffer_add_entry(buffer,...)
Definition: DRW_render.h:468
DRWState
Definition: DRW_render.h:312
@ DRW_STATE_BLEND_ALPHA
Definition: DRW_render.h:340
@ DRW_STATE_CULL_FRONT
Definition: DRW_render.h:329
@ DRW_STATE_IN_FRONT_SELECT
Definition: DRW_render.h:352
@ DRW_STATE_WRITE_DEPTH
Definition: DRW_render.h:314
@ DRW_STATE_WRITE_COLOR
Definition: DRW_render.h:315
@ DRW_STATE_DEPTH_LESS_EQUAL
Definition: DRW_render.h:323
@ DRW_STATE_CULL_BACK
Definition: DRW_render.h:328
@ DRW_STATE_DEPTH_ALWAYS
Definition: DRW_render.h:321
#define DRW_PASS_CREATE(pass, state)
Definition: DRW_render.h:593
#define DRW_shgroup_call_obmat(shgroup, geom, obmat)
Definition: DRW_render.h:424
#define XRAY_FLAG_ENABLED(v3d)
Definition: ED_view3d.h:709
NSNotificationCenter * center
GPUBatch
Definition: GPU_batch.h:93
_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 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
struct GPUShader GPUShader
Definition: GPU_shader.h:33
struct GPUTexture GPUTexture
Definition: GPU_texture.h:33
@ TH_CAMERA_PATH
Definition: UI_resources.h:254
@ TH_SELECT
Definition: UI_resources.h:88
@ TH_TEXT
Definition: UI_resources.h:58
@ TH_ACTIVE
Definition: UI_resources.h:89
void UI_GetThemeColor4ubv(int colorid, unsigned char col[4])
Definition: resources.c:1381
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
Scene scene
World world
const Depsgraph * depsgraph
GPUBatch * DRW_cache_camera_frame_get(void)
Definition: draw_cache.c:2678
GPUBatch * DRW_cache_empty_capsule_body_get(void)
Definition: draw_cache.c:1170
GPUBatch * DRW_cache_groundline_get(void)
Definition: draw_cache.c:1476
GPUBatch * DRW_cache_circle_get(void)
Definition: draw_cache.c:733
GPUBatch * DRW_cache_plain_axes_get(void)
Definition: draw_cache.c:1001
GPUBatch * DRW_cache_empty_sphere_get(void)
Definition: draw_cache.c:1081
GPUBatch * DRW_cache_quad_get(void)
Definition: draw_cache.c:392
GPUBatch * DRW_cache_lightprobe_grid_get(void)
Definition: draw_cache.c:1828
GPUBatch * DRW_cache_light_area_disk_lines_get(void)
Definition: draw_cache.c:1628
GPUBatch * DRW_cache_empty_cylinder_get(void)
Definition: draw_cache.c:1129
GPUBatch * DRW_cache_field_force_get(void)
Definition: draw_cache.c:1283
GPUBatch * DRW_cache_field_tube_limit_get(void)
Definition: draw_cache.c:1356
GPUBatch * DRW_cache_field_cone_limit_get(void)
Definition: draw_cache.c:1390
GPUBatch * DRW_cache_field_sphere_limit_get(void)
Definition: draw_cache.c:1425
GPUBatch * DRW_cache_field_vortex_get(void)
Definition: draw_cache.c:1306
GPUBatch * DRW_cache_light_area_square_lines_get(void)
Definition: draw_cache.c:1660
GPUBatch * DRW_cache_light_spot_lines_get(void)
Definition: draw_cache.c:1555
GPUBatch * DRW_cache_speaker_get(void)
Definition: draw_cache.c:1709
GPUBatch * DRW_cache_camera_volume_wire_get(void)
Definition: draw_cache.c:2735
GPUBatch * DRW_cache_light_spot_volume_get(void)
Definition: draw_cache.c:1601
GPUBatch * DRW_cache_field_wind_get(void)
Definition: draw_cache.c:1260
GPUBatch * DRW_cache_lightprobe_planar_get(void)
Definition: draw_cache.c:1890
GPUBatch * DRW_cache_field_curve_get(void)
Definition: draw_cache.c:1336
GPUBatch * DRW_cache_camera_tria_get(void)
Definition: draw_cache.c:2783
GPUBatch * DRW_cache_camera_volume_get(void)
Definition: draw_cache.c:2710
GPUBatch * DRW_cache_sphere_get(const eDRWLevelOfDetail level_of_detail)
Definition: draw_cache.c:487
GPUBatch * DRW_cache_light_sun_lines_get(void)
Definition: draw_cache.c:1521
GPUBatch * DRW_cache_lightprobe_cube_get(void)
Definition: draw_cache.c:1774
GPUBatch * DRW_cache_camera_tria_wire_get(void)
Definition: draw_cache.c:2759
GPUBatch * DRW_cache_quad_wires_get(void)
Definition: draw_cache.c:413
GPUBatch * DRW_cache_empty_capsule_cap_get(void)
Definition: draw_cache.c:1203
GPUBatch * DRW_cache_single_arrow_get(void)
Definition: draw_cache.c:1043
GPUBatch * DRW_cache_camera_distances_get(void)
Definition: draw_cache.c:2803
GPUBatch * DRW_cache_empty_cone_get(void)
Definition: draw_cache.c:1090
GPUBatch * DRW_cache_light_point_lines_get(void)
Definition: draw_cache.c:1497
GPUBatch * DRW_cache_bone_arrows_get(void)
Definition: draw_cache.c:2519
GPUBatch * DRW_cache_empty_cube_get(void)
Definition: draw_cache.c:1023
@ DRW_LOD_LOW
Definition: draw_cache.h:37
float * DRW_color_background_blend_get(int theme_id)
Definition: draw_common.c:401
int DRW_object_wire_theme_get(Object *ob, ViewLayer *view_layer, float **r_color)
Definition: draw_common.c:299
struct DRW_Global G_draw
Definition: draw_common.c:45
void DRW_fluid_ensure_flags(struct FluidModifierData *fmd)
Definition: draw_fluid.c:560
void DRW_smoke_free_velocity(struct FluidModifierData *fmd)
Definition: draw_fluid.c:593
void DRW_smoke_ensure_velocity(struct FluidModifierData *fmd)
Definition: draw_fluid.c:530
void DRW_fluid_ensure_range_field(struct FluidModifierData *fmd)
Definition: draw_fluid.c:577
bool DRW_state_is_select(void)
bool DRW_state_show_text(void)
int DRW_object_visibility_in_active_context(const Object *ob)
Definition: draw_manager.c:235
bool DRW_state_is_fbo(void)
const DRWContextState * DRW_context_state_get(void)
bool DRW_state_is_image_render(void)
struct DRWTextStore * DRW_text_cache_ensure(void)
DefaultTextureList * DRW_viewport_texture_list_get(void)
Definition: draw_manager.c:702
void DRW_shgroup_uniform_float_copy(DRWShadingGroup *shgroup, const char *name, const float value)
void DRW_shgroup_uniform_block(DRWShadingGroup *shgroup, const char *name, const GPUUniformBuf *ubo)
void DRW_shgroup_state_disable(DRWShadingGroup *shgroup, DRWState state)
void DRW_shgroup_uniform_texture(DRWShadingGroup *shgroup, const char *name, const GPUTexture *tex)
void DRW_shgroup_uniform_ivec3_copy(DRWShadingGroup *shgroup, const char *name, const int *value)
void DRW_shgroup_call_procedural_lines(DRWShadingGroup *shgroup, Object *ob, uint line_count)
void DRW_buffer_add_entry_struct(DRWCallBuffer *callbuf, const void *data)
void DRW_shgroup_state_enable(DRWShadingGroup *shgroup, DRWState state)
void DRW_shgroup_uniform_vec3_copy(DRWShadingGroup *shgroup, const char *name, const float *value)
void DRW_shgroup_call_procedural_points(DRWShadingGroup *shgroup, Object *ob, uint point_count)
void DRW_shgroup_uniform_vec4_array_copy(DRWShadingGroup *shgroup, const char *name, const float(*value)[4], int arraysize)
void DRW_shgroup_uniform_int_copy(DRWShadingGroup *shgroup, const char *name, const int value)
DRWShadingGroup * DRW_shgroup_create(struct GPUShader *shader, DRWPass *pass)
DRWShadingGroup * DRW_shgroup_create_sub(DRWShadingGroup *shgroup)
void DRW_shgroup_uniform_vec4_copy(DRWShadingGroup *shgroup, const char *name, const float *value)
void DRW_shgroup_uniform_bool_copy(DRWShadingGroup *shgroup, const char *name, const bool value)
void DRW_view_viewmat_get(const DRWView *view, float mat[4][4], bool inverse)
void DRW_draw_pass(DRWPass *pass)
void DRW_select_load_id(uint id)
void DRW_text_cache_add(DRWTextStore *dt, const float co[3], const char *str, const int str_len, short xoffs, short yoffs, short flag, const uchar col[4])
@ DRW_TEXT_CACHE_GLOBALSPACE
@ DRW_TEXT_CACHE_STRING_PTR
uint pos
uint col
const ProjectiveReconstruction & reconstruction
Definition: intersect.cc:198
#define GS(x)
Definition: iris.c:241
#define sinf(x)
#define cosf(x)
#define fabsf(x)
#define sqrtf(x)
format
Definition: logImageCore.h:47
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:41
static ulong state[N]
static unsigned c
Definition: RandGen.cpp:97
static unsigned a[3]
Definition: RandGen.cpp:92
void OVERLAY_empty_shape(OVERLAY_ExtraCallBuffers *cb, const float mat[4][4], const float draw_size, const char draw_type, const float color[4])
OVERLAY_ExtraCallBuffers * OVERLAY_extra_call_buffer_get(OVERLAY_Data *vedata, Object *ob)
static void camera_view3d_reconstruction(OVERLAY_ExtraCallBuffers *cb, Scene *scene, View3D *v3d, Object *ob, const float color[4])
static void OVERLAY_forcefield(OVERLAY_ExtraCallBuffers *cb, Object *ob, ViewLayer *view_layer)
void OVERLAY_extra_centers_draw(OVERLAY_Data *vedata)
void OVERLAY_extra_in_front_draw(OVERLAY_Data *vedata)
void OVERLAY_extra_loose_points(OVERLAY_ExtraCallBuffers *cb, struct GPUBatch *geom, const float mat[4][4], const float color[4])
static void OVERLAY_collision(OVERLAY_ExtraCallBuffers *cb, Object *ob, const float *color)
#define BUF_INSTANCE
void OVERLAY_extra_cache_init(OVERLAY_Data *vedata)
Definition: overlay_extra.c:62
void OVERLAY_extra_line(OVERLAY_ExtraCallBuffers *cb, const float start[3], const float end[3], const int color_id)
void OVERLAY_extra_wire(OVERLAY_ExtraCallBuffers *cb, struct GPUBatch *geom, const float mat[4][4], const float color[4])
void OVERLAY_camera_cache_populate(OVERLAY_Data *vedata, Object *ob)
static void OVERLAY_object_name(Object *ob, int theme_id)
void OVERLAY_light_cache_populate(OVERLAY_Data *vedata, Object *ob)
void OVERLAY_extra_line_dashed(OVERLAY_ExtraCallBuffers *cb, const float start[3], const float end[3], const float color[4])
union OVERLAY_CameraInstanceData OVERLAY_CameraInstanceData
static void OVERLAY_relationship_lines(OVERLAY_ExtraCallBuffers *cb, Depsgraph *depsgraph, Scene *scene, Object *ob)
static void camera_stereoscopy_extra(OVERLAY_ExtraCallBuffers *cb, Scene *scene, View3D *v3d, Object *ob, const OVERLAY_CameraInstanceData *instdata)
#define BUF_POINT(grp, format)
#define BUF_LINE(grp, format)
void OVERLAY_extra_point(OVERLAY_ExtraCallBuffers *cb, const float point[3], const float color[4])
static void OVERLAY_bounds(OVERLAY_ExtraCallBuffers *cb, Object *ob, const float *color, char boundtype, bool around_origin)
static void OVERLAY_volume_extra(OVERLAY_ExtraCallBuffers *cb, OVERLAY_Data *data, Object *ob, ModifierData *md, Scene *scene, const float *color)
static void OVERLAY_volume_free_smoke_textures(OVERLAY_Data *data)
void OVERLAY_lightprobe_cache_populate(OVERLAY_Data *vedata, Object *ob)
static void OVERLAY_texture_space(OVERLAY_ExtraCallBuffers *cb, Object *ob, const float *color)
static float camera_offaxis_shiftx_get(Scene *scene, Object *ob, const OVERLAY_CameraInstanceData *instdata, bool right_eye)
void OVERLAY_extra_cache_populate(OVERLAY_Data *vedata, Object *ob)
static void OVERLAY_object_center(OVERLAY_ExtraCallBuffers *cb, Object *ob, OVERLAY_PrivateData *pd, ViewLayer *view_layer)
void OVERLAY_extra_blend_draw(OVERLAY_Data *vedata)
void OVERLAY_extra_draw(OVERLAY_Data *vedata)
void OVERLAY_empty_cache_populate(OVERLAY_Data *vedata, Object *ob)
void OVERLAY_speaker_cache_populate(OVERLAY_Data *vedata, Object *ob)
void OVERLAY_image_camera_cache_populate(OVERLAY_Data *vedata, Object *ob)
void OVERLAY_image_empty_cache_populate(OVERLAY_Data *vedata, Object *ob)
GPUShader * OVERLAY_shader_extra_groundline(void)
GPUShader * OVERLAY_shader_extra_loose_point(void)
GPUShader * OVERLAY_shader_extra_grid(void)
GPUShader * OVERLAY_shader_extra(bool is_select)
GPUShader * OVERLAY_shader_volume_velocity(bool use_needle, bool use_mac)
GPUShader * OVERLAY_shader_extra_wire(bool use_object, bool is_select)
BLI_INLINE void pack_v4_in_mat4(float rmat[4][4], const float mat[4][4], const float v[4])
GPUShader * OVERLAY_shader_extra_point(void)
OVERLAY_InstanceFormats * OVERLAY_shader_instance_formats_get(void)
GPUShader * OVERLAY_shader_volume_gridlines(bool color_with_flags, bool color_range)
BLI_INLINE void pack_fl_in_mat4(float rmat[4][4], const float mat[4][4], float a)
#define min(a, b)
Definition: sort.c:51
float clip_end
struct ListBase bg_images
float shiftx
struct CameraStereoSettings stereo
float clip_start
float drawsize
float loc[3]
float size[3]
struct Scene * scene
Definition: DRW_render.h:745
struct Depsgraph * depsgraph
Definition: DRW_render.h:753
struct ViewLayer * view_layer
Definition: DRW_render.h:746
eObjectMode object_mode
Definition: DRW_render.h:757
struct View3D * v3d
Definition: DRW_render.h:742
struct RegionView3D * rv3d
Definition: DRW_render.h:741
GlobalsUboStorage block
Definition: draw_common.h:208
struct GPUUniformBuf * block_ubo
Definition: draw_common.h:210
struct GPUTexture * depth
struct GPUTexture * tex_range_field
struct GPUTexture * tex_velocity_x
struct GPUTexture * tex_velocity_y
struct MANTA * fluid
struct GPUTexture * tex_velocity_z
struct PointCache * point_cache[2]
struct GPUTexture * tex_flags
float gridlines_range_color[4]
struct FluidDomainSettings * domain
float colorGridAxisZ[4]
Definition: draw_common.h:137
float colorSelect[4]
Definition: draw_common.h:44
float colorDeselect[4]
Definition: draw_common.h:78
float colorLibrary[4]
Definition: draw_common.h:48
float colorBundleSolid[4]
Definition: draw_common.h:124
float colorLibrarySelect[4]
Definition: draw_common.h:47
float colorWire[4]
Definition: draw_common.h:41
float colorActive[4]
Definition: draw_common.h:43
struct Object * object
Definition: DNA_ID.h:273
char name[66]
Definition: DNA_ID.h:283
float att_dist
float area_sizey
short area_shape
float clipsta
float spotblend
float spotsize
float area_size
short type
void * data
Definition: DNA_listBase.h:42
void * first
Definition: DNA_listBase.h:47
float size[3]
float loc[3]
struct MovieTracking tracking
OVERLAY_PassList * psl
OVERLAY_StorageList * stl
OVERLAY_TextureList * txl
DRWCallBuffer * camera_volume
DRWCallBuffer * empty_image_frame
DRWCallBuffer * field_vortex
DRWCallBuffer * extra_dashed_lines
DRWCallBuffer * empty_cone
DRWCallBuffer * empty_cylinder
DRWCallBuffer * empty_circle
DRWCallBuffer * center_selected
DRWCallBuffer * light_spot
DRWCallBuffer * light_area[2]
DRWCallBuffer * probe_grid
DRWCallBuffer * empty_single_arrow
DRWCallBuffer * camera_distances
DRWCallBuffer * center_deselected
DRWCallBuffer * solid_quad
DRWCallBuffer * light_spot_cone_front
DRWCallBuffer * camera_volume_frame
DRWShadingGroup * extra_wire
DRWCallBuffer * field_force
DRWCallBuffer * origin_xform
DRWCallBuffer * empty_axes
DRWCallBuffer * light_spot_cone_back
DRWCallBuffer * field_curve
DRWCallBuffer * probe_cube
DRWCallBuffer * extra_lines
DRWCallBuffer * camera_frame
DRWCallBuffer * field_sphere_limit
DRWCallBuffer * empty_sphere_solid
DRWCallBuffer * center_active
DRWCallBuffer * empty_capsule_body
DRWCallBuffer * center_deselected_lib
DRWCallBuffer * empty_sphere
DRWCallBuffer * empty_capsule_cap
DRWCallBuffer * field_tube_limit
DRWCallBuffer * field_wind
DRWCallBuffer * extra_points
DRWShadingGroup * extra_loose_points
DRWCallBuffer * probe_planar
DRWCallBuffer * camera_tria[2]
DRWCallBuffer * field_cone_limit
DRWCallBuffer * center_selected_lib
DRWCallBuffer * empty_cube
DRWCallBuffer * light_point
DRWCallBuffer * groundline
DRWCallBuffer * empty_plain_axes
struct GPUVertFormat * point_extra
struct GPUVertFormat * pos
struct GPUVertFormat * pos_color
struct GPUVertFormat * instance_extra
struct GPUVertFormat * wire_extra
struct GPUVertFormat * instance_pos
DRWPass * extra_grid_ps
DRWPass * extra_blend_ps
DRWPass * extra_ps[2]
DRWPass * extra_centers_ps
OVERLAY_ExtraCallBuffers extra_call_buffers[2]
View3DOverlay overlay
DRWShadingGroup * extra_grid_grp
struct OVERLAY_PrivateData * pd
struct GPUTexture * dummy_depth_tx
float parent_display_origin[3]
short transflag
ListBase constraints
struct Collection * instance_collection
short base_flag
ListBase modifiers
struct RigidBodyOb * rigidbody_object
char boundtype
ListBase greasepencil_modifiers
struct PartDeflect * pd
char empty_drawtype
Object_Runtime runtime
float empty_drawsize
float obmat[4][4]
struct Object * parent
struct RigidBodyCon * rigidbody_constraint
void * data
short views_format
struct Object * ob1
struct Object * ob2
struct ToolSettings * toolsettings
struct RenderData r
struct Object * camera
struct World * world
char multiview_eye
float bundle_size
struct Object * camera
float stereo3d_volume_alpha
View3DShading shading
char bundle_drawtype
short stereo3d_flag
float stereo3d_convergence_alpha
float miststa
float mistdist
struct bConstraintTarget * next
int(* get_constraint_targets)(struct bConstraint *con, struct ListBase *list)
void(* flush_constraint_targets)(struct bConstraint *con, struct ListBase *list, bool no_copy)
void(* get_target_matrix)(struct Depsgraph *depsgraph, struct bConstraint *con, struct bConstraintOb *cob, struct bConstraintTarget *ct, float ctime)
struct bConstraint * next
float max
ccl_device_inline float sqr(float a)
Definition: util_math.h:651
ccl_device_inline float distance(const float2 &a, const float2 &b)
#define G(x, y, z)