Blender  V3.3
overlay_fade.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2020 Blender Foundation. */
3 
8 #include "BKE_paint.h"
9 #include "DRW_render.h"
10 
11 #include "ED_view3d.h"
12 
13 #include "overlay_private.h"
14 
16 {
17 }
18 
20 {
21  OVERLAY_PassList *psl = vedata->psl;
22  OVERLAY_PrivateData *pd = vedata->stl->pd;
23 
24  for (int i = 0; i < 2; i++) {
25  /* Non Meshes Pass (Camera, empties, lights ...) */
28 
30  pd->fade_grp[i] = DRW_shgroup_create(sh, psl->fade_ps[i]);
31 
32  const DRWContextState *draw_ctx = DRW_context_state_get();
33  float color[4];
34  ED_view3d_background_color_get(draw_ctx->scene, draw_ctx->v3d, color);
35  color[3] = pd->overlay.fade_alpha;
38  }
40  }
41 
42  if (!pd->use_in_front) {
44  }
45 }
46 
48 {
49  OVERLAY_PrivateData *pd = vedata->stl->pd;
50 
51  if (pd->xray_enabled) {
52  return;
53  }
54 
55  const DRWContextState *draw_ctx = DRW_context_state_get();
56  const bool use_sculpt_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->rv3d) &&
58  const bool is_xray = (ob->dtx & OB_DRAW_IN_FRONT) != 0;
59 
60  if (use_sculpt_pbvh) {
61  DRW_shgroup_call_sculpt(pd->fade_grp[is_xray], ob, false, false);
62  }
63  else {
64  struct GPUBatch *geom = DRW_cache_object_surface_get(ob);
65  if (geom) {
66  DRW_shgroup_call(pd->fade_grp[is_xray], geom, ob);
67  }
68  }
69 }
70 
72 {
73  OVERLAY_PassList *psl = vedata->psl;
74 
76 }
77 
79 {
80  OVERLAY_PassList *psl = vedata->psl;
81 
83 }
bool BKE_sculptsession_use_pbvh_draw(const struct Object *ob, const struct RegionView3D *rv3d)
MINLINE void srgb_to_linearrgb_v4(float linear[4], const float srgb[4])
#define UNUSED(x)
@ OB_DRAW_IN_FRONT
@ V3D_SHADING_BACKGROUND_THEME
DRWState
Definition: DRW_render.h:298
@ DRW_STATE_BLEND_ALPHA
Definition: DRW_render.h:328
@ DRW_STATE_DEPTH_EQUAL
Definition: DRW_render.h:312
@ DRW_STATE_WRITE_COLOR
Definition: DRW_render.h:303
#define DRW_PASS_CREATE(pass, state)
Definition: DRW_render.h:690
#define DRW_shgroup_call(shgroup, geom, ob)
Definition: DRW_render.h:414
void ED_view3d_background_color_get(const struct Scene *scene, const struct View3D *v3d, float r_color[3])
GPUBatch
Definition: GPU_batch.h:78
struct GPUShader GPUShader
Definition: GPU_shader.h:20
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
GPUBatch * DRW_cache_object_surface_get(Object *ob)
Definition: draw_cache.c:887
const DRWContextState * DRW_context_state_get(void)
bool DRW_state_is_image_render(void)
void DRW_shgroup_call_sculpt(DRWShadingGroup *shgroup, Object *ob, bool use_wire, bool use_mask)
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_draw_pass(DRWPass *pass)
const int state
ccl_gpu_kernel_postfix ccl_global float int int int int sh
void OVERLAY_fade_cache_populate(OVERLAY_Data *vedata, Object *ob)
Definition: overlay_fade.c:47
void OVERLAY_fade_draw(OVERLAY_Data *vedata)
Definition: overlay_fade.c:71
void OVERLAY_fade_infront_draw(OVERLAY_Data *vedata)
Definition: overlay_fade.c:78
void OVERLAY_fade_init(OVERLAY_Data *UNUSED(vedata))
Definition: overlay_fade.c:15
void OVERLAY_fade_cache_init(OVERLAY_Data *vedata)
Definition: overlay_fade.c:19
#define IN_FRONT
#define NOT_IN_FRONT
GPUShader * OVERLAY_shader_uniform_color(void)
struct Scene * scene
Definition: DRW_render.h:979
struct View3D * v3d
Definition: DRW_render.h:976
struct RegionView3D * rv3d
Definition: DRW_render.h:975
OVERLAY_PassList * psl
OVERLAY_StorageList * stl
DRWPass * fade_ps[2]
View3DOverlay overlay
DRWShadingGroup * fade_grp[2]
struct OVERLAY_PrivateData * pd
View3DShading shading