Blender  V3.3
overlay_image.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2019 Blender Foundation. */
3 
8 #include "DRW_render.h"
9 
10 #include "BKE_camera.h"
11 #include "BKE_image.h"
12 #include "BKE_movieclip.h"
13 #include "BKE_object.h"
14 
15 #include "BLI_listbase.h"
16 
17 #include "DNA_camera_types.h"
18 #include "DNA_screen_types.h"
19 
20 #include "DEG_depsgraph_query.h"
21 
22 #include "ED_view3d.h"
23 
24 #include "IMB_imbuf_types.h"
25 
26 #include "overlay_private.h"
27 
29 {
30  const DRWContextState *draw_ctx = DRW_context_state_get();
31  OVERLAY_PrivateData *pd = vedata->stl->pd;
32 
33  DRWView *default_view = (DRWView *)DRW_view_default_get();
34  pd->view_reference_images = DRW_view_create_with_zoffset(default_view, draw_ctx->rv3d, -1.0f);
35 }
36 
38 {
39  OVERLAY_PassList *psl = vedata->psl;
40  OVERLAY_PrivateData *pd = vedata->stl->pd;
42 
47 
50 
54 
59 }
60 
61 static void overlay_image_calc_aspect(Image *ima, const int size[2], float r_image_aspect[2])
62 {
63  float ima_x, ima_y;
64  if (ima) {
65  ima_x = size[0];
66  ima_y = size[1];
67  }
68  else {
69  /* if no image, make it a 1x1 empty square, honor scale & offset */
70  ima_x = ima_y = 1.0f;
71  }
72  /* Get the image aspect even if the buffer is invalid */
73  float sca_x = 1.0f, sca_y = 1.0f;
74  if (ima) {
75  if (ima->aspx > ima->aspy) {
76  sca_y = ima->aspy / ima->aspx;
77  }
78  else if (ima->aspx < ima->aspy) {
79  sca_x = ima->aspx / ima->aspy;
80  }
81  }
82 
83  const float scale_x_inv = ima_x * sca_x;
84  const float scale_y_inv = ima_y * sca_y;
85  if (scale_x_inv > scale_y_inv) {
86  r_image_aspect[0] = 1.0f;
87  r_image_aspect[1] = scale_y_inv / scale_x_inv;
88  }
89  else {
90  r_image_aspect[0] = scale_x_inv / scale_y_inv;
91  r_image_aspect[1] = 1.0f;
92  }
93 }
94 
96 {
97  if ((scene->r.scemode & R_MULTIVIEW) == 0) {
98  return STEREO_LEFT_ID;
99  }
100  if (v3d->stereo3d_camera != STEREO_3D_ID) {
101  /* show only left or right camera */
102  return v3d->stereo3d_camera;
103  }
104 
105  return v3d->multiview_eye;
106 }
107 
109  const View3D *v3d,
110  Image *ima,
111  ImageUser *iuser)
112 {
113  if (BKE_image_is_stereo(ima)) {
114  iuser->flag |= IMA_SHOW_STEREO;
116  BKE_image_multiview_index(ima, iuser);
117  }
118  else {
119  iuser->flag &= ~IMA_SHOW_STEREO;
120  }
121 }
122 
124  const DRWContextState *draw_ctx,
126  float *r_aspect,
127  bool *r_use_alpha_premult,
128  bool *r_use_view_transform)
129 {
130  void *lock;
131  Image *image = bgpic->ima;
132  ImageUser *iuser = &bgpic->iuser;
133  MovieClip *clip = NULL;
134  GPUTexture *tex = NULL;
135  Scene *scene = draw_ctx->scene;
136  float aspect_x, aspect_y;
137  int width, height;
138  int ctime = (int)DEG_get_ctime(draw_ctx->depsgraph);
139  *r_use_alpha_premult = false;
140  *r_use_view_transform = false;
141 
142  switch (bgpic->source) {
144  if (image == NULL) {
145  return NULL;
146  }
147  *r_use_alpha_premult = (image->alpha_mode == IMA_ALPHA_PREMUL);
148  *r_use_view_transform = (image->flag & IMA_VIEW_AS_RENDER) != 0;
149 
150  BKE_image_user_frame_calc(image, iuser, ctime);
151  if (image->source == IMA_SRC_SEQUENCE && !(iuser->flag & IMA_USER_FRAME_IN_RANGE)) {
152  /* Frame is out of range, don't show. */
153  return NULL;
154  }
155 
157 
158  iuser->scene = draw_ctx->scene;
159  ImBuf *ibuf = BKE_image_acquire_ibuf(image, iuser, &lock);
160  if (ibuf == NULL) {
162  iuser->scene = NULL;
163  return NULL;
164  }
165  width = ibuf->x;
166  height = ibuf->y;
167  tex = BKE_image_get_gpu_texture(image, iuser, ibuf);
169  iuser->scene = NULL;
170 
171  if (tex == NULL) {
172  return NULL;
173  }
174 
175  aspect_x = bgpic->ima->aspx;
176  aspect_y = bgpic->ima->aspy;
177  break;
178 
180  if (bgpic->flag & CAM_BGIMG_FLAG_CAMERACLIP) {
181  if (scene->camera) {
182  clip = BKE_object_movieclip_get(scene, scene->camera, true);
183  }
184  }
185  else {
186  clip = bgpic->clip;
187  }
188 
189  if (clip == NULL) {
190  return NULL;
191  }
192 
193  BKE_movieclip_user_set_frame(&bgpic->cuser, ctime);
194  tex = BKE_movieclip_get_gpu_texture(clip, &bgpic->cuser);
195  if (tex == NULL) {
196  return NULL;
197  }
198 
199  aspect_x = clip->aspx;
200  aspect_y = clip->aspy;
201  *r_use_view_transform = true;
202 
203  BKE_movieclip_get_size(clip, &bgpic->cuser, &width, &height);
204 
205  /* Save for freeing. */
207  break;
208 
209  default:
210  /* Unsupported type. */
211  return NULL;
212  }
213 
214  *r_aspect = (width * aspect_x) / (height * aspect_y);
215  return tex;
216 }
217 
219 {
220  /* Free Movie clip textures after rendering */
221  LinkData *link;
222  while ((link = BLI_pophead(&data->stl->pd->bg_movie_clips))) {
223  MovieClip *clip = (MovieClip *)link->data;
225  MEM_freeN(link);
226  }
227 }
228 
230  const CameraBGImage *bgpic,
231  const DRWContextState *draw_ctx,
232  const float image_aspect,
233  float rmat[4][4])
234 {
235  float rotate[4][4], scale[4][4], translate[4][4];
236 
238  unit_m4(scale);
239  unit_m4(translate);
240 
241  /* Normalized Object space camera frame corners. */
242  float cam_corners[4][3];
243  BKE_camera_view_frame(draw_ctx->scene, cam, cam_corners);
244  float cam_width = fabsf(cam_corners[0][0] - cam_corners[3][0]);
245  float cam_height = fabsf(cam_corners[0][1] - cam_corners[1][1]);
246  float cam_aspect = cam_width / cam_height;
247 
248  if (bgpic->flag & CAM_BGIMG_FLAG_CAMERA_CROP) {
249  /* Crop. */
250  if (image_aspect > cam_aspect) {
251  scale[0][0] *= cam_height * image_aspect;
252  scale[1][1] *= cam_height;
253  }
254  else {
255  scale[0][0] *= cam_width;
256  scale[1][1] *= cam_width / image_aspect;
257  }
258  }
259  else if (bgpic->flag & CAM_BGIMG_FLAG_CAMERA_ASPECT) {
260  /* Fit. */
261  if (image_aspect > cam_aspect) {
262  scale[0][0] *= cam_width;
263  scale[1][1] *= cam_width / image_aspect;
264  }
265  else {
266  scale[0][0] *= cam_height * image_aspect;
267  scale[1][1] *= cam_height;
268  }
269  }
270  else {
271  /* Stretch. */
272  scale[0][0] *= cam_width;
273  scale[1][1] *= cam_height;
274  }
275 
276  translate[3][0] = bgpic->offset[0];
277  translate[3][1] = bgpic->offset[1];
278  translate[3][2] = cam_corners[0][2];
279  if (cam->type == CAM_ORTHO) {
280  mul_v2_fl(translate[3], cam->ortho_scale);
281  }
282  /* These lines are for keeping 2.80 behavior and could be removed to keep 2.79 behavior. */
283  translate[3][0] *= min_ff(1.0f, cam_aspect);
284  translate[3][1] /= max_ff(1.0f, cam_aspect) * (image_aspect / cam_aspect);
285  /* quad is -1..1 so divide by 2. */
286  scale[0][0] *= 0.5f * bgpic->scale * ((bgpic->flag & CAM_BGIMG_FLAG_FLIP_X) ? -1.0 : 1.0);
287  scale[1][1] *= 0.5f * bgpic->scale * ((bgpic->flag & CAM_BGIMG_FLAG_FLIP_Y) ? -1.0 : 1.0);
288  /* Camera shift. (middle of cam_corners) */
289  translate[3][0] += (cam_corners[0][0] + cam_corners[2][0]) * 0.5f;
290  translate[3][1] += (cam_corners[0][1] + cam_corners[2][1]) * 0.5f;
291 
292  mul_m4_series(rmat, translate, rotate, scale);
293 }
294 
296 {
297  OVERLAY_PrivateData *pd = vedata->stl->pd;
298  OVERLAY_PassList *psl = vedata->psl;
299  const DRWContextState *draw_ctx = DRW_context_state_get();
300  const View3D *v3d = draw_ctx->v3d;
301  const Scene *scene = draw_ctx->scene;
302  Camera *cam = ob->data;
303 
304  const bool show_frame = BKE_object_empty_image_frame_is_visible_in_view3d(ob, draw_ctx->rv3d);
305 
306  if (!show_frame || DRW_state_is_select()) {
307  return;
308  }
309 
310  const bool stereo_eye = camera_background_images_stereo_eye(scene, v3d) == STEREO_LEFT_ID;
311  const char *viewname = (stereo_eye == STEREO_LEFT_ID) ? STEREO_RIGHT_NAME : STEREO_LEFT_NAME;
312  float modelmat[4][4];
313  BKE_camera_multiview_model_matrix(&scene->r, ob, viewname, modelmat);
314 
315  LISTBASE_FOREACH (CameraBGImage *, bgpic, &cam->bg_images) {
316  if (bgpic->flag & CAM_BGIMG_FLAG_DISABLED) {
317  continue;
318  }
319 
320  float aspect = 1.0;
321  bool use_alpha_premult;
322  bool use_view_transform = false;
323  float mat[4][4];
324 
325  /* retrieve the image we want to show, continue to next when no image could be found */
327  bgpic, draw_ctx, pd, &aspect, &use_alpha_premult, &use_view_transform);
328 
329  if (tex) {
330  image_camera_background_matrix_get(cam, bgpic, draw_ctx, aspect, mat);
331 
332  const bool is_foreground = (bgpic->flag & CAM_BGIMG_FLAG_FOREGROUND) != 0;
333  /* Alpha is clamped just below 1.0 to fix background images to interfere with foreground
334  * images. Without this a background image with 1.0 will be rendered on top of a transparent
335  * foreground image due to the different blending modes they use. */
336  const float color_premult_alpha[4] = {1.0f, 1.0f, 1.0f, MIN2(bgpic->alpha, 0.999999)};
337 
338  DRWPass *pass = is_foreground ? (use_view_transform ? psl->image_foreground_scene_ps :
339  psl->image_foreground_ps) :
340  (use_view_transform ? psl->image_background_scene_ps :
341  psl->image_background_ps);
342 
344  DRWShadingGroup *grp = DRW_shgroup_create(sh, pass);
345  DRW_shgroup_uniform_texture(grp, "imgTexture", tex);
346  DRW_shgroup_uniform_bool_copy(grp, "imgPremultiplied", use_alpha_premult);
347  DRW_shgroup_uniform_bool_copy(grp, "imgAlphaBlend", true);
348  DRW_shgroup_uniform_bool_copy(grp, "isCameraBackground", true);
349  DRW_shgroup_uniform_bool_copy(grp, "depthSet", true);
350  DRW_shgroup_uniform_vec4_copy(grp, "color", color_premult_alpha);
352  }
353  }
354 }
355 
357 {
358  OVERLAY_PassList *psl = vedata->psl;
359  const DRWContextState *draw_ctx = DRW_context_state_get();
360  const RegionView3D *rv3d = draw_ctx->rv3d;
361  GPUTexture *tex = NULL;
362  Image *ima = ob->data;
363  float mat[4][4];
364 
365  const bool show_frame = BKE_object_empty_image_frame_is_visible_in_view3d(ob, rv3d);
366  const bool show_image = show_frame && BKE_object_empty_image_data_is_visible_in_view3d(ob, rv3d);
367  const bool use_alpha_blend = (ob->empty_image_flag & OB_EMPTY_IMAGE_USE_ALPHA_BLEND) != 0;
368  const bool use_alpha_premult = ima && (ima->alpha_mode == IMA_ALPHA_PREMUL);
369 
370  if (!show_frame) {
371  return;
372  }
373 
374  {
375  /* Calling 'BKE_image_get_size' may free the texture. Get the size from 'tex' instead,
376  * see: T59347 */
377  int size[2] = {0};
378  if (ima != NULL) {
379  ImageUser iuser = *ob->iuser;
380  camera_background_images_stereo_setup(draw_ctx->scene, draw_ctx->v3d, ima, &iuser);
381  tex = BKE_image_get_gpu_texture(ima, &iuser, NULL);
382  if (tex) {
385  }
386  }
387  CLAMP_MIN(size[0], 1);
388  CLAMP_MIN(size[1], 1);
389 
390  float image_aspect[2];
391  overlay_image_calc_aspect(ob->data, size, image_aspect);
392 
393  copy_m4_m4(mat, ob->obmat);
394  mul_v3_fl(mat[0], image_aspect[0] * 0.5f * ob->empty_drawsize);
395  mul_v3_fl(mat[1], image_aspect[1] * 0.5f * ob->empty_drawsize);
396  madd_v3_v3fl(mat[3], mat[0], ob->ima_ofs[0] * 2.0f + 1.0f);
397  madd_v3_v3fl(mat[3], mat[1], ob->ima_ofs[1] * 2.0f + 1.0f);
398  }
399 
400  /* Use the actual depth if we are doing depth tests to determine the distance to the object */
402  DRWPass *pass = NULL;
403  if ((ob->dtx & OB_DRAW_IN_FRONT) != 0) {
404  /* Object In Front overrides image empty depth mode. */
405  pass = psl->image_empties_front_ps;
406  }
407  else {
408  switch (depth_mode) {
410  pass = (use_alpha_blend) ? psl->image_empties_blend_ps : psl->image_empties_ps;
411  break;
413  pass = psl->image_empties_back_ps;
414  break;
416  pass = psl->image_empties_front_ps;
417  break;
418  }
419  }
420 
421  if (show_frame) {
423  float *color;
424  DRW_object_wire_theme_get(ob, draw_ctx->view_layer, &color);
425  OVERLAY_empty_shape(cb, mat, 1.0f, OB_EMPTY_IMAGE, color);
426  }
427 
428  if (show_image && tex && ((ob->color[3] > 0.0f) || !use_alpha_blend)) {
430  DRWShadingGroup *grp = DRW_shgroup_create(sh, pass);
431  DRW_shgroup_uniform_texture(grp, "imgTexture", tex);
432  DRW_shgroup_uniform_bool_copy(grp, "imgPremultiplied", use_alpha_premult);
433  DRW_shgroup_uniform_bool_copy(grp, "imgAlphaBlend", use_alpha_blend);
434  DRW_shgroup_uniform_bool_copy(grp, "isCameraBackground", false);
435  DRW_shgroup_uniform_bool_copy(grp, "depthSet", depth_mode != OB_EMPTY_IMAGE_DEPTH_DEFAULT);
436  DRW_shgroup_uniform_vec4_copy(grp, "color", ob->color);
438  }
439 }
440 
442 {
443  OVERLAY_PassList *psl = vedata->psl;
444 
448 }
449 
451 {
452  OVERLAY_PassList *psl = vedata->psl;
453 
458 
461  }
462 }
463 
465 {
466  OVERLAY_PassList *psl = vedata->psl;
467 
470 }
471 
473 {
474  OVERLAY_PassList *psl = vedata->psl;
475  OVERLAY_PrivateData *pd = vedata->stl->pd;
476 
478 
481 
483 }
484 
486 {
487  OVERLAY_PassList *psl = vedata->psl;
488  OVERLAY_PrivateData *pd = vedata->stl->pd;
489 
491 
494 
496 
498 }
Camera data-block and utility functions.
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_view_frame(const struct Scene *scene, const struct Camera *camera, float r_vec[4][3])
void BKE_image_release_ibuf(struct Image *ima, struct ImBuf *ibuf, void *lock)
struct ImBuf * BKE_image_acquire_ibuf(struct Image *ima, struct ImageUser *iuser, void **r_lock)
bool BKE_image_is_stereo(const struct Image *ima)
void BKE_image_multiview_index(const struct Image *ima, struct ImageUser *iuser)
struct GPUTexture * BKE_image_get_gpu_texture(struct Image *image, struct ImageUser *iuser, struct ImBuf *ibuf)
Definition: image_gpu.cc:438
void BKE_image_user_frame_calc(struct Image *ima, struct ImageUser *iuser, int cfra)
void BKE_movieclip_user_set_frame(struct MovieClipUser *user, int framenr)
Definition: movieclip.c:1614
void BKE_movieclip_get_size(struct MovieClip *clip, struct MovieClipUser *user, int *width, int *height)
Definition: movieclip.c:1520
struct GPUTexture * BKE_movieclip_get_gpu_texture(struct MovieClip *clip, struct MovieClipUser *cuser)
Definition: movieclip.c:2066
void BKE_movieclip_free_gputexture(struct MovieClip *clip)
Definition: movieclip.c:2098
General operations, lookup, etc. for blender objects.
bool BKE_object_empty_image_data_is_visible_in_view3d(const struct Object *ob, const struct RegionView3D *rv3d)
struct MovieClip * BKE_object_movieclip_get(struct Scene *scene, struct Object *ob, bool use_default)
Definition: object.cc:5042
bool BKE_object_empty_image_frame_is_visible_in_view3d(const struct Object *ob, const struct RegionView3D *rv3d)
void * BLI_pophead(ListBase *listbase) ATTR_NONNULL(1)
Definition: listbase.c:221
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:336
struct LinkData * BLI_genericNodeN(void *data)
Definition: listbase.c:842
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:80
MINLINE float max_ff(float a, float b)
MINLINE float min_ff(float a, float b)
void unit_m4(float m[4][4])
Definition: rct.c:1090
#define mul_m4_series(...)
void copy_m4_m4(float m1[4][4], const float m2[4][4])
Definition: math_matrix.c:77
void axis_angle_to_mat4_single(float R[4][4], char axis, float angle)
MINLINE void madd_v3_v3fl(float r[3], const float a[3], float f)
MINLINE void mul_v2_fl(float r[2], float f)
MINLINE void mul_v3_fl(float r[3], float f)
#define MIN2(a, b)
#define CLAMP_MIN(a, b)
float DEG_get_ctime(const Depsgraph *graph)
@ CAM_BGIMG_FLAG_FLIP_X
@ CAM_BGIMG_FLAG_FLIP_Y
@ CAM_BGIMG_FLAG_CAMERA_CROP
@ CAM_BGIMG_FLAG_CAMERACLIP
@ CAM_BGIMG_FLAG_CAMERA_ASPECT
@ CAM_BGIMG_FLAG_DISABLED
@ CAM_BGIMG_FLAG_FOREGROUND
@ CAM_BGIMG_SOURCE_IMAGE
@ CAM_BGIMG_SOURCE_MOVIE
@ CAM_ORTHO
@ IMA_USER_FRAME_IN_RANGE
@ IMA_VIEW_AS_RENDER
@ IMA_ALPHA_PREMUL
@ IMA_SRC_SEQUENCE
#define IMA_SHOW_STEREO
@ OB_EMPTY_IMAGE_USE_ALPHA_BLEND
@ OB_EMPTY_IMAGE
@ OB_DRAW_IN_FRONT
#define OB_EMPTY_IMAGE_DEPTH_BACK
#define OB_EMPTY_IMAGE_DEPTH_FRONT
#define OB_EMPTY_IMAGE_DEPTH_DEFAULT
#define STEREO_LEFT_NAME
#define R_MULTIVIEW
#define STEREO_RIGHT_NAME
eStereoViews
@ STEREO_LEFT_ID
@ STEREO_3D_ID
DRWState
Definition: DRW_render.h:298
@ DRW_STATE_DEPTH_LESS
Definition: DRW_render.h:310
@ DRW_STATE_WRITE_DEPTH
Definition: DRW_render.h:302
@ DRW_STATE_WRITE_COLOR
Definition: DRW_render.h:303
@ DRW_STATE_BLEND_ALPHA_UNDER_PREMUL
Definition: DRW_render.h:338
@ DRW_STATE_DEPTH_LESS_EQUAL
Definition: DRW_render.h:311
@ DRW_STATE_BLEND_ALPHA_PREMUL
Definition: DRW_render.h:330
@ DRW_STATE_DEPTH_GREATER
Definition: DRW_render.h:313
#define DRW_PASS_CREATE(pass, state)
Definition: DRW_render.h:690
#define DRW_shgroup_call_obmat(shgroup, geom, obmat)
Definition: DRW_render.h:420
void GPU_framebuffer_bind(GPUFrameBuffer *fb)
_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 GLsizei width
struct GPUShader GPUShader
Definition: GPU_shader.h:20
struct GPUTexture GPUTexture
Definition: GPU_texture.h:17
int GPU_texture_orig_width(const GPUTexture *tex)
Definition: gpu_texture.cc:622
int GPU_texture_orig_height(const GPUTexture *tex)
Definition: gpu_texture.cc:627
Contains defines and structs used throughout the imbuf module.
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
volatile int lock
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
SIMD_FORCE_INLINE btVector3 rotate(const btVector3 &wAxis, const btScalar angle) const
Return a rotated version of this vector.
float aspy
float aspx
char alpha_mode
Scene scene
GPUBatch * DRW_cache_quad_get(void)
Definition: draw_cache.c:389
int DRW_object_wire_theme_get(Object *ob, ViewLayer *view_layer, float **r_color)
Definition: draw_common.c:279
DRWView * DRW_view_create_with_zoffset(const DRWView *parent_view, const RegionView3D *rv3d, float offset)
Definition: draw_common.c:255
bool DRW_state_is_select(void)
bool DRW_state_is_depth(void)
DefaultFramebufferList * DRW_viewport_framebuffer_list_get(void)
Definition: draw_manager.c:633
bool DRW_state_is_fbo(void)
const DRWContextState * DRW_context_state_get(void)
void DRW_shgroup_uniform_texture(DRWShadingGroup *shgroup, const char *name, const GPUTexture *tex)
const DRWView * DRW_view_default_get(void)
void DRW_pass_sort_shgroup_z(DRWPass *pass)
bool DRW_pass_is_empty(DRWPass *pass)
DRWShadingGroup * DRW_shgroup_create(struct GPUShader *shader, DRWPass *pass)
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_draw_pass(DRWPass *pass)
void DRW_view_set_active(const DRWView *view)
depth_tx normal_tx diffuse_light_tx specular_light_tx volume_light_tx environment_tx ambient_occlusion_tx aov_value_tx in_weight_img image(1, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D_ARRAY, "out_weight_img") .image(3
const int state
ccl_gpu_kernel_postfix ccl_global float int int int int sh
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:27
#define fabsf(x)
Definition: metal/compat.h:219
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 eStereoViews camera_background_images_stereo_eye(const Scene *scene, const View3D *v3d)
Definition: overlay_image.c:95
static void OVERLAY_image_free_movieclips_textures(OVERLAY_Data *data)
void OVERLAY_image_cache_init(OVERLAY_Data *vedata)
Definition: overlay_image.c:37
void OVERLAY_image_background_draw(OVERLAY_Data *vedata)
void OVERLAY_image_in_front_draw(OVERLAY_Data *vedata)
void OVERLAY_image_scene_background_draw(OVERLAY_Data *vedata)
void OVERLAY_image_camera_cache_populate(OVERLAY_Data *vedata, Object *ob)
void OVERLAY_image_cache_finish(OVERLAY_Data *vedata)
static void overlay_image_calc_aspect(Image *ima, const int size[2], float r_image_aspect[2])
Definition: overlay_image.c:61
void OVERLAY_image_draw(OVERLAY_Data *vedata)
static void image_camera_background_matrix_get(const Camera *cam, const CameraBGImage *bgpic, const DRWContextState *draw_ctx, const float image_aspect, float rmat[4][4])
void OVERLAY_image_empty_cache_populate(OVERLAY_Data *vedata, Object *ob)
void OVERLAY_image_init(OVERLAY_Data *vedata)
Definition: overlay_image.c:28
static void camera_background_images_stereo_setup(const Scene *scene, const View3D *v3d, Image *ima, ImageUser *iuser)
static struct GPUTexture * image_camera_background_texture_get(CameraBGImage *bgpic, const DRWContextState *draw_ctx, OVERLAY_PrivateData *pd, float *r_aspect, bool *r_use_alpha_premult, bool *r_use_view_transform)
GPUShader * OVERLAY_shader_image(void)
struct MovieClip * clip
struct ImageUser iuser
struct MovieClipUser cuser
struct Image * ima
struct ListBase bg_images
float ortho_scale
struct Scene * scene
Definition: DRW_render.h:979
struct Depsgraph * depsgraph
Definition: DRW_render.h:987
struct ViewLayer * view_layer
Definition: DRW_render.h:980
struct View3D * v3d
Definition: DRW_render.h:976
struct RegionView3D * rv3d
Definition: DRW_render.h:975
struct GPUFrameBuffer * default_fb
char multiview_eye
struct Scene * scene
void * data
Definition: DNA_listBase.h:26
OVERLAY_PassList * psl
OVERLAY_StorageList * stl
DRWPass * image_background_scene_ps
DRWPass * image_empties_front_ps
DRWPass * image_empties_ps
DRWPass * image_foreground_scene_ps
DRWPass * image_background_ps
DRWPass * image_empties_blend_ps
DRWPass * image_foreground_ps
DRWPass * image_empties_back_ps
DRWView * view_reference_images
struct OVERLAY_PrivateData * pd
ImageUser * iuser
char empty_image_flag
float empty_drawsize
float obmat[4][4]
float color[4]
char empty_image_depth
void * data
float ima_ofs[2]
struct RenderData r
struct Object * camera
char multiview_eye
char stereo3d_camera