Blender  V2.93
overlay_image.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 "BKE_camera.h"
26 #include "BKE_image.h"
27 #include "BKE_movieclip.h"
28 #include "BKE_object.h"
29 
30 #include "BLI_listbase.h"
31 
32 #include "DNA_camera_types.h"
33 #include "DNA_screen_types.h"
34 
35 #include "DEG_depsgraph_query.h"
36 
37 #include "ED_view3d.h"
38 
39 #include "IMB_imbuf_types.h"
40 
41 #include "overlay_private.h"
42 
44 {
45  const DRWContextState *draw_ctx = DRW_context_state_get();
46  OVERLAY_PrivateData *pd = vedata->stl->pd;
47 
48  DRWView *default_view = (DRWView *)DRW_view_default_get();
49  pd->view_reference_images = DRW_view_create_with_zoffset(default_view, draw_ctx->rv3d, -1.0f);
50 }
51 
53 {
54  OVERLAY_PassList *psl = vedata->psl;
55  OVERLAY_PrivateData *pd = vedata->stl->pd;
57 
62 
65 
69 
74 }
75 
76 static void overlay_image_calc_aspect(Image *ima, const int size[2], float r_image_aspect[2])
77 {
78  float ima_x, ima_y;
79  if (ima) {
80  ima_x = size[0];
81  ima_y = size[1];
82  }
83  else {
84  /* if no image, make it a 1x1 empty square, honor scale & offset */
85  ima_x = ima_y = 1.0f;
86  }
87  /* Get the image aspect even if the buffer is invalid */
88  float sca_x = 1.0f, sca_y = 1.0f;
89  if (ima) {
90  if (ima->aspx > ima->aspy) {
91  sca_y = ima->aspy / ima->aspx;
92  }
93  else if (ima->aspx < ima->aspy) {
94  sca_x = ima->aspx / ima->aspy;
95  }
96  }
97 
98  const float scale_x_inv = ima_x * sca_x;
99  const float scale_y_inv = ima_y * sca_y;
100  if (scale_x_inv > scale_y_inv) {
101  r_image_aspect[0] = 1.0f;
102  r_image_aspect[1] = scale_y_inv / scale_x_inv;
103  }
104  else {
105  r_image_aspect[0] = scale_x_inv / scale_y_inv;
106  r_image_aspect[1] = 1.0f;
107  }
108 }
109 
111 {
112  if ((scene->r.scemode & R_MULTIVIEW) == 0) {
113  return STEREO_LEFT_ID;
114  }
115  if (v3d->stereo3d_camera != STEREO_3D_ID) {
116  /* show only left or right camera */
117  return v3d->stereo3d_camera;
118  }
119 
120  return v3d->multiview_eye;
121 }
122 
124  const View3D *v3d,
125  Image *ima,
126  ImageUser *iuser)
127 {
128  if (BKE_image_is_stereo(ima)) {
129  iuser->flag |= IMA_SHOW_STEREO;
131  BKE_image_multiview_index(ima, iuser);
132  }
133  else {
134  iuser->flag &= ~IMA_SHOW_STEREO;
135  }
136 }
137 
139  const DRWContextState *draw_ctx,
141  float *r_aspect,
142  bool *r_use_alpha_premult,
143  bool *r_use_view_transform)
144 {
145  void *lock;
146  Image *image = bgpic->ima;
147  ImageUser *iuser = &bgpic->iuser;
148  MovieClip *clip = NULL;
149  GPUTexture *tex = NULL;
150  Scene *scene = draw_ctx->scene;
151  float aspect_x, aspect_y;
152  int width, height;
153  int ctime = (int)DEG_get_ctime(draw_ctx->depsgraph);
154  *r_use_alpha_premult = false;
155  *r_use_view_transform = false;
156 
157  switch (bgpic->source) {
159  if (image == NULL) {
160  return NULL;
161  }
162  *r_use_alpha_premult = (image->alpha_mode == IMA_ALPHA_PREMUL);
163  *r_use_view_transform = (image->flag & IMA_VIEW_AS_RENDER) != 0;
164 
165  BKE_image_user_frame_calc(image, iuser, ctime);
166  if (image->source == IMA_SRC_SEQUENCE && !(iuser->flag & IMA_USER_FRAME_IN_RANGE)) {
167  /* Frame is out of range, don't show. */
168  return NULL;
169  }
170 
171  camera_background_images_stereo_setup(scene, draw_ctx->v3d, image, iuser);
172 
173  iuser->scene = draw_ctx->scene;
174  ImBuf *ibuf = BKE_image_acquire_ibuf(image, iuser, &lock);
175  if (ibuf == NULL) {
176  BKE_image_release_ibuf(image, ibuf, lock);
177  iuser->scene = NULL;
178  return NULL;
179  }
180  width = ibuf->x;
181  height = ibuf->y;
182  tex = BKE_image_get_gpu_texture(image, iuser, ibuf);
183  BKE_image_release_ibuf(image, ibuf, lock);
184  iuser->scene = NULL;
185 
186  if (tex == NULL) {
187  return NULL;
188  }
189 
190  aspect_x = bgpic->ima->aspx;
191  aspect_y = bgpic->ima->aspy;
192  break;
193 
195  if (bgpic->flag & CAM_BGIMG_FLAG_CAMERACLIP) {
196  if (scene->camera) {
197  clip = BKE_object_movieclip_get(scene, scene->camera, true);
198  }
199  }
200  else {
201  clip = bgpic->clip;
202  }
203 
204  if (clip == NULL) {
205  return NULL;
206  }
207 
208  BKE_movieclip_user_set_frame(&bgpic->cuser, ctime);
209  tex = BKE_movieclip_get_gpu_texture(clip, &bgpic->cuser);
210  if (tex == NULL) {
211  return NULL;
212  }
213 
214  aspect_x = clip->aspx;
215  aspect_y = clip->aspy;
216  *r_use_view_transform = true;
217 
218  BKE_movieclip_get_size(clip, &bgpic->cuser, &width, &height);
219 
220  /* Save for freeing. */
222  break;
223 
224  default:
225  /* Unsupported type. */
226  return NULL;
227  }
228 
229  *r_aspect = (width * aspect_x) / (height * aspect_y);
230  return tex;
231 }
232 
234 {
235  /* Free Movie clip textures after rendering */
236  LinkData *link;
237  while ((link = BLI_pophead(&data->stl->pd->bg_movie_clips))) {
238  MovieClip *clip = (MovieClip *)link->data;
240  MEM_freeN(link);
241  }
242 }
243 
245  const CameraBGImage *bgpic,
246  const DRWContextState *draw_ctx,
247  const float image_aspect,
248  float rmat[4][4])
249 {
250  float rotate[4][4], scale[4][4], translate[4][4];
251 
253  unit_m4(scale);
254  unit_m4(translate);
255 
256  /* Normalized Object space camera frame corners. */
257  float cam_corners[4][3];
258  BKE_camera_view_frame(draw_ctx->scene, cam, cam_corners);
259  float cam_width = fabsf(cam_corners[0][0] - cam_corners[3][0]);
260  float cam_height = fabsf(cam_corners[0][1] - cam_corners[1][1]);
261  float cam_aspect = cam_width / cam_height;
262 
263  if (bgpic->flag & CAM_BGIMG_FLAG_CAMERA_CROP) {
264  /* Crop. */
265  if (image_aspect > cam_aspect) {
266  scale[0][0] *= cam_height * image_aspect;
267  scale[1][1] *= cam_height;
268  }
269  else {
270  scale[0][0] *= cam_width;
271  scale[1][1] *= cam_width / image_aspect;
272  }
273  }
274  else if (bgpic->flag & CAM_BGIMG_FLAG_CAMERA_ASPECT) {
275  /* Fit. */
276  if (image_aspect > cam_aspect) {
277  scale[0][0] *= cam_width;
278  scale[1][1] *= cam_width / image_aspect;
279  }
280  else {
281  scale[0][0] *= cam_height * image_aspect;
282  scale[1][1] *= cam_height;
283  }
284  }
285  else {
286  /* Stretch. */
287  scale[0][0] *= cam_width;
288  scale[1][1] *= cam_height;
289  }
290 
291  translate[3][0] = bgpic->offset[0];
292  translate[3][1] = bgpic->offset[1];
293  translate[3][2] = cam_corners[0][2];
294  if (cam->type == CAM_ORTHO) {
295  mul_v2_fl(translate[3], cam->ortho_scale);
296  }
297  /* These lines are for keeping 2.80 behavior and could be removed to keep 2.79 behavior. */
298  translate[3][0] *= min_ff(1.0f, cam_aspect);
299  translate[3][1] /= max_ff(1.0f, cam_aspect) * (image_aspect / cam_aspect);
300  /* quad is -1..1 so divide by 2. */
301  scale[0][0] *= 0.5f * bgpic->scale * ((bgpic->flag & CAM_BGIMG_FLAG_FLIP_X) ? -1.0 : 1.0);
302  scale[1][1] *= 0.5f * bgpic->scale * ((bgpic->flag & CAM_BGIMG_FLAG_FLIP_Y) ? -1.0 : 1.0);
303  /* Camera shift. (middle of cam_corners) */
304  translate[3][0] += (cam_corners[0][0] + cam_corners[2][0]) * 0.5f;
305  translate[3][1] += (cam_corners[0][1] + cam_corners[2][1]) * 0.5f;
306 
307  mul_m4_series(rmat, translate, rotate, scale);
308 }
309 
311 {
312  OVERLAY_PrivateData *pd = vedata->stl->pd;
313  OVERLAY_PassList *psl = vedata->psl;
314  const DRWContextState *draw_ctx = DRW_context_state_get();
315  const View3D *v3d = draw_ctx->v3d;
316  const Scene *scene = draw_ctx->scene;
317  Camera *cam = ob->data;
318 
319  const bool show_frame = BKE_object_empty_image_frame_is_visible_in_view3d(ob, draw_ctx->rv3d);
320 
321  if (!show_frame || DRW_state_is_select()) {
322  return;
323  }
324 
325  const bool stereo_eye = camera_background_images_stereo_eye(scene, v3d) == STEREO_LEFT_ID;
326  const char *viewname = (stereo_eye == STEREO_LEFT_ID) ? STEREO_RIGHT_NAME : STEREO_LEFT_NAME;
327  float modelmat[4][4];
328  BKE_camera_multiview_model_matrix(&scene->r, ob, viewname, modelmat);
329 
330  LISTBASE_FOREACH (CameraBGImage *, bgpic, &cam->bg_images) {
331  if (bgpic->flag & CAM_BGIMG_FLAG_DISABLED) {
332  continue;
333  }
334 
335  float aspect = 1.0;
336  bool use_alpha_premult;
337  bool use_view_transform = false;
338  float mat[4][4];
339 
340  /* retrieve the image we want to show, continue to next when no image could be found */
342  bgpic, draw_ctx, pd, &aspect, &use_alpha_premult, &use_view_transform);
343 
344  if (tex) {
345  image_camera_background_matrix_get(cam, bgpic, draw_ctx, aspect, mat);
346 
347  const bool is_foreground = (bgpic->flag & CAM_BGIMG_FLAG_FOREGROUND) != 0;
348  /* Alpha is clamped just below 1.0 to fix background images to interfere with foreground
349  * images. Without this a background image with 1.0 will be rendered on top of a transparent
350  * foreground image due to the different blending modes they use. */
351  const float color_premult_alpha[4] = {1.0f, 1.0f, 1.0f, MIN2(bgpic->alpha, 0.999999)};
352 
353  DRWPass *pass = is_foreground ? (use_view_transform ? psl->image_foreground_scene_ps :
354  psl->image_foreground_ps) :
355  (use_view_transform ? psl->image_background_scene_ps :
356  psl->image_background_ps);
357 
359  DRWShadingGroup *grp = DRW_shgroup_create(sh, pass);
360  DRW_shgroup_uniform_texture(grp, "imgTexture", tex);
361  DRW_shgroup_uniform_bool_copy(grp, "imgPremultiplied", use_alpha_premult);
362  DRW_shgroup_uniform_bool_copy(grp, "imgAlphaBlend", true);
363  DRW_shgroup_uniform_bool_copy(grp, "isCameraBackground", true);
364  DRW_shgroup_uniform_bool_copy(grp, "depthSet", true);
365  DRW_shgroup_uniform_vec4_copy(grp, "color", color_premult_alpha);
367  }
368  }
369 }
370 
372 {
373  OVERLAY_PassList *psl = vedata->psl;
374  const DRWContextState *draw_ctx = DRW_context_state_get();
375  const RegionView3D *rv3d = draw_ctx->rv3d;
376  GPUTexture *tex = NULL;
377  Image *ima = ob->data;
378  float mat[4][4];
379 
380  const bool show_frame = BKE_object_empty_image_frame_is_visible_in_view3d(ob, rv3d);
381  const bool show_image = show_frame && BKE_object_empty_image_data_is_visible_in_view3d(ob, rv3d);
382  const bool use_alpha_blend = (ob->empty_image_flag & OB_EMPTY_IMAGE_USE_ALPHA_BLEND) != 0;
383  const bool use_alpha_premult = ima && (ima->alpha_mode == IMA_ALPHA_PREMUL);
384 
385  if (!show_frame) {
386  return;
387  }
388 
389  {
390  /* Calling 'BKE_image_get_size' may free the texture. Get the size from 'tex' instead,
391  * see: T59347 */
392  int size[2] = {0};
393  if (ima != NULL) {
394  ImageUser iuser = *ob->iuser;
395  camera_background_images_stereo_setup(draw_ctx->scene, draw_ctx->v3d, ima, &iuser);
396  tex = BKE_image_get_gpu_texture(ima, &iuser, NULL);
397  if (tex) {
400  }
401  }
402  CLAMP_MIN(size[0], 1);
403  CLAMP_MIN(size[1], 1);
404 
405  float image_aspect[2];
406  overlay_image_calc_aspect(ob->data, size, image_aspect);
407 
408  copy_m4_m4(mat, ob->obmat);
409  mul_v3_fl(mat[0], image_aspect[0] * 0.5f * ob->empty_drawsize);
410  mul_v3_fl(mat[1], image_aspect[1] * 0.5f * ob->empty_drawsize);
411  madd_v3_v3fl(mat[3], mat[0], ob->ima_ofs[0] * 2.0f + 1.0f);
412  madd_v3_v3fl(mat[3], mat[1], ob->ima_ofs[1] * 2.0f + 1.0f);
413  }
414 
415  /* Use the actual depth if we are doing depth tests to determine the distance to the object */
417  DRWPass *pass = NULL;
418  if ((ob->dtx & OB_DRAW_IN_FRONT) != 0) {
419  /* Object In Front overrides image empty depth mode. */
420  pass = psl->image_empties_front_ps;
421  }
422  else {
423  switch (depth_mode) {
425  pass = (use_alpha_blend) ? psl->image_empties_blend_ps : psl->image_empties_ps;
426  break;
428  pass = psl->image_empties_back_ps;
429  break;
431  pass = psl->image_empties_front_ps;
432  break;
433  }
434  }
435 
436  if (show_frame) {
438  float *color;
439  DRW_object_wire_theme_get(ob, draw_ctx->view_layer, &color);
440  OVERLAY_empty_shape(cb, mat, 1.0f, OB_EMPTY_IMAGE, color);
441  }
442 
443  if (show_image && tex && ((ob->color[3] > 0.0f) || !use_alpha_blend)) {
445  DRWShadingGroup *grp = DRW_shgroup_create(sh, pass);
446  DRW_shgroup_uniform_texture(grp, "imgTexture", tex);
447  DRW_shgroup_uniform_bool_copy(grp, "imgPremultiplied", use_alpha_premult);
448  DRW_shgroup_uniform_bool_copy(grp, "imgAlphaBlend", use_alpha_blend);
449  DRW_shgroup_uniform_bool_copy(grp, "isCameraBackground", false);
450  DRW_shgroup_uniform_bool_copy(grp, "depthSet", depth_mode != OB_EMPTY_IMAGE_DEPTH_DEFAULT);
451  DRW_shgroup_uniform_vec4_copy(grp, "color", ob->color);
453  }
454 }
455 
457 {
458  OVERLAY_PassList *psl = vedata->psl;
459 
463 }
464 
465 /* This function draws images that needs the view transform applied.
466  * It draws these images directly into the scene color buffer. */
468 {
469  OVERLAY_PassList *psl = vedata->psl;
470 
475 
478  }
479 }
480 
482 {
483  OVERLAY_PassList *psl = vedata->psl;
484 
487 }
488 
490 {
491  OVERLAY_PassList *psl = vedata->psl;
492  OVERLAY_PrivateData *pd = vedata->stl->pd;
493 
495 
498 
500 }
501 
503 {
504  OVERLAY_PassList *psl = vedata->psl;
505  OVERLAY_PrivateData *pd = vedata->stl->pd;
506 
508 
511 
513 
515 }
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_multiview_index(struct Image *ima, struct ImageUser *iuser)
Definition: image.c:3846
void BKE_image_release_ibuf(struct Image *ima, struct ImBuf *ibuf, void *lock)
Definition: image.c:5113
bool BKE_image_is_stereo(struct Image *ima)
Definition: image.c:3889
struct ImBuf * BKE_image_acquire_ibuf(struct Image *ima, struct ImageUser *iuser, void **r_lock)
Definition: image.c:5100
struct GPUTexture * BKE_image_get_gpu_texture(struct Image *image, struct ImageUser *iuser, struct ImBuf *ibuf)
Definition: image_gpu.c:439
void BKE_image_user_frame_calc(struct Image *ima, struct ImageUser *iuser, int cfra)
Definition: image.c:5335
void BKE_movieclip_user_set_frame(struct MovieClipUser *user, int framenr)
Definition: movieclip.c:1633
void BKE_movieclip_get_size(struct MovieClip *clip, struct MovieClipUser *user, int *width, int *height)
Definition: movieclip.c:1540
struct GPUTexture * BKE_movieclip_get_gpu_texture(struct MovieClip *clip, struct MovieClipUser *cuser)
Definition: movieclip.c:2096
void BKE_movieclip_free_gputexture(struct MovieClip *clip)
Definition: movieclip.c:2129
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.c:5079
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: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_ff(float a, float b)
MINLINE float min_ff(float a, float b)
void unit_m4(float m[4][4])
Definition: rct.c:1140
#define mul_m4_series(...)
void copy_m4_m4(float m1[4][4], const float m2[4][4])
Definition: math_matrix.c:95
void axis_angle_to_mat4_single(float R[4][4], const char axis, const 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_SOURCE_IMAGE
@ CAM_BGIMG_SOURCE_MOVIE
@ 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_ORTHO
@ IMA_USER_FRAME_IN_RANGE
@ IMA_VIEW_AS_RENDER
@ IMA_ALPHA_PREMUL
@ IMA_SRC_SEQUENCE
#define IMA_SHOW_STEREO
@ OB_DRAW_IN_FRONT
#define OB_EMPTY_IMAGE_DEPTH_BACK
@ OB_EMPTY_IMAGE
#define OB_EMPTY_IMAGE_DEPTH_FRONT
@ OB_EMPTY_IMAGE_USE_ALPHA_BLEND
#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:312
@ DRW_STATE_DEPTH_LESS
Definition: DRW_render.h:322
@ DRW_STATE_WRITE_DEPTH
Definition: DRW_render.h:314
@ DRW_STATE_WRITE_COLOR
Definition: DRW_render.h:315
@ DRW_STATE_BLEND_ALPHA_UNDER_PREMUL
Definition: DRW_render.h:350
@ DRW_STATE_DEPTH_LESS_EQUAL
Definition: DRW_render.h:323
@ DRW_STATE_BLEND_ALPHA_PREMUL
Definition: DRW_render.h:342
@ DRW_STATE_DEPTH_GREATER
Definition: DRW_render.h:325
#define DRW_PASS_CREATE(pass, state)
Definition: DRW_render.h:593
#define DRW_shgroup_call_obmat(shgroup, geom, obmat)
Definition: DRW_render.h:424
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 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 height
struct GPUShader GPUShader
Definition: GPU_shader.h:33
struct GPUTexture GPUTexture
Definition: GPU_texture.h:33
int GPU_texture_orig_width(const GPUTexture *tex)
Definition: gpu_texture.cc:537
int GPU_texture_orig_height(const GPUTexture *tex)
Definition: gpu_texture.cc:542
Contains defines and structs used throughout the imbuf module.
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
short source
float aspx
char alpha_mode
Scene scene
GPUBatch * DRW_cache_quad_get(void)
Definition: draw_cache.c:392
int DRW_object_wire_theme_get(Object *ob, ViewLayer *view_layer, float **r_color)
Definition: draw_common.c:299
DRWView * DRW_view_create_with_zoffset(const DRWView *parent_view, const RegionView3D *rv3d, float offset)
Definition: draw_common.c:271
bool DRW_state_is_select(void)
bool DRW_state_is_depth(void)
DefaultFramebufferList * DRW_viewport_framebuffer_list_get(void)
Definition: draw_manager.c:697
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_view_set_active(DRWView *view)
void DRW_draw_pass(DRWPass *pass)
#define fabsf(x)
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:41
static ulong state[N]
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)
static void OVERLAY_image_free_movieclips_textures(OVERLAY_Data *data)
void OVERLAY_image_cache_init(OVERLAY_Data *vedata)
Definition: overlay_image.c:52
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:76
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:43
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:745
struct Depsgraph * depsgraph
Definition: DRW_render.h:753
struct ViewLayer * view_layer
Definition: DRW_render.h:746
struct View3D * v3d
Definition: DRW_render.h:742
struct RegionView3D * rv3d
Definition: DRW_render.h:741
struct GPUFrameBuffer * default_fb
char multiview_eye
struct Scene * scene
void * data
Definition: DNA_listBase.h:42
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