Blender  V3.3
overlay_facing.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 "BKE_paint.h"
9 #include "DRW_render.h"
10 
11 #include "overlay_private.h"
12 
14 {
15 }
16 
18 {
19  OVERLAY_PassList *psl = vedata->psl;
20  OVERLAY_PrivateData *pd = vedata->stl->pd;
21 
22  for (int i = 0; i < 2; i++) {
23  /* Non Meshes Pass (Camera, empties, lights ...) */
26 
28  pd->facing_grp[i] = DRW_shgroup_create(sh, psl->facing_ps[i]);
29  DRW_shgroup_uniform_block(pd->facing_grp[i], "globalsBlock", G_draw.block_ubo);
30  }
31 
32  if (!pd->use_in_front) {
34  }
35 }
36 
38 {
39  OVERLAY_PrivateData *pd = vedata->stl->pd;
40 
41  if (pd->xray_enabled) {
42  return;
43  }
44 
45  const DRWContextState *draw_ctx = DRW_context_state_get();
46  const bool use_sculpt_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->rv3d) &&
48  const bool is_xray = (ob->dtx & OB_DRAW_IN_FRONT) != 0;
49 
50  if (use_sculpt_pbvh) {
51  DRW_shgroup_call_sculpt(pd->facing_grp[is_xray], ob, false, false);
52  }
53  else {
54  struct GPUBatch *geom = DRW_cache_object_surface_get(ob);
55  if (geom) {
56  DRW_shgroup_call(pd->facing_grp[is_xray], geom, ob);
57  }
58  }
59 }
60 
62 {
63  OVERLAY_PassList *psl = vedata->psl;
64 
66 }
67 
69 {
70  OVERLAY_PassList *psl = vedata->psl;
71 
73 }
bool BKE_sculptsession_use_pbvh_draw(const struct Object *ob, const struct RegionView3D *rv3d)
#define UNUSED(x)
@ OB_DRAW_IN_FRONT
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_uniform_block(shgroup, name, ubo)
Definition: DRW_render.h:651
#define DRW_shgroup_call(shgroup, geom, ob)
Definition: DRW_render.h:414
GPUBatch
Definition: GPU_batch.h:78
struct GPUShader GPUShader
Definition: GPU_shader.h:20
GPUBatch * DRW_cache_object_surface_get(Object *ob)
Definition: draw_cache.c:887
struct DRW_Global G_draw
Definition: draw_common.c:32
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_draw_pass(DRWPass *pass)
const int state
ccl_gpu_kernel_postfix ccl_global float int int int int sh
void OVERLAY_facing_infront_draw(OVERLAY_Data *vedata)
void OVERLAY_facing_draw(OVERLAY_Data *vedata)
void OVERLAY_facing_init(OVERLAY_Data *UNUSED(vedata))
void OVERLAY_facing_cache_init(OVERLAY_Data *vedata)
void OVERLAY_facing_cache_populate(OVERLAY_Data *vedata, Object *ob)
#define IN_FRONT
#define NOT_IN_FRONT
GPUShader * OVERLAY_shader_facing(void)
struct RegionView3D * rv3d
Definition: DRW_render.h:975
struct GPUUniformBuf * block_ubo
Definition: draw_common.h:129
OVERLAY_PassList * psl
OVERLAY_StorageList * stl
DRWPass * facing_ps[2]
DRWShadingGroup * facing_grp[2]
struct OVERLAY_PrivateData * pd