Blender  V3.3
overlay_edit_curves.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2022 Blender Foundation. */
3 
8 #include "DRW_render.h"
9 
10 #include "ED_view3d.h"
11 
12 #include "draw_cache_impl.h"
13 
14 #include "overlay_private.h"
15 
17 {
18  OVERLAY_PrivateData *pd = vedata->stl->pd;
19  const DRWContextState *draw_ctx = DRW_context_state_get();
20 
22 
23  /* Create view with depth offset. */
24  DRWView *default_view = (DRWView *)DRW_view_default_get();
25  pd->view_edit_curves_points = default_view;
26 }
27 
29 {
30  OVERLAY_TextureList *txl = vedata->txl;
31  OVERLAY_PassList *psl = vedata->psl;
32  OVERLAY_PrivateData *pd = vedata->stl->pd;
33 
34  /* Desired masks (write to color and depth) and blend mode for rendering. */
37 
38  /* Common boilerplate for shading groups. */
40  const DRWContextState *draw_ctx = DRW_context_state_get();
41  const View3D *v3d = draw_ctx->v3d;
42  GPUTexture **depth_tex = (pd->edit_curves.do_zbufclip) ? &dtxl->depth : &txl->dummy_depth_tx;
43  const float backwire_opacity = (pd->edit_curves.do_zbufclip) ? v3d->overlay.backwire_opacity :
44  1.0f;
45 
46  /* Run Twice for in-front passes. */
47  for (int i = 0; i < 2; i++) {
49 
52  sh, psl->edit_curves_points_ps[i]);
53  DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
54  DRW_shgroup_uniform_float_copy(grp, "alpha", backwire_opacity);
55  DRW_shgroup_uniform_texture_ref(grp, "depthTex", depth_tex);
56  }
57 }
58 
60 {
61  Curves *curves = static_cast<Curves *>(ob->data);
62  DRWShadingGroup *point_shgrp = pd->edit_curves_points_grp[in_front];
64  DRW_shgroup_call_no_cull(point_shgrp, geom_points, ob);
65 }
66 
68 {
69  OVERLAY_PrivateData *pd = vedata->stl->pd;
70 
71  if (pd->edit_curves.do_zbufclip) {
73  }
74  else {
76  }
77 }
78 
80 {
81  OVERLAY_PassList *psl = vedata->psl;
82  OVERLAY_PrivateData *pd = vedata->stl->pd;
83 
84  if (pd->edit_curves.do_zbufclip) {
87  }
88  else {
91  }
92 }
#define DRW_shgroup_call_no_cull(shgroup, geom, ob)
Definition: DRW_render.h:431
DRWState
Definition: DRW_render.h:298
@ DRW_STATE_BLEND_ALPHA
Definition: DRW_render.h:328
@ DRW_STATE_WRITE_DEPTH
Definition: DRW_render.h:302
@ DRW_STATE_WRITE_COLOR
Definition: DRW_render.h:303
@ DRW_STATE_DEPTH_LESS_EQUAL
Definition: DRW_render.h:311
#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 XRAY_FLAG_ENABLED(v3d)
Definition: ED_view3d.h:1298
GPUBatch
Definition: GPU_batch.h:78
struct GPUShader GPUShader
Definition: GPU_shader.h:20
struct GPUTexture GPUTexture
Definition: GPU_texture.h:17
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 curves
struct GPUBatch * DRW_curves_batch_cache_get_edit_points(struct Curves *curves)
struct DRW_Global G_draw
Definition: draw_common.c:32
const DRWContextState * DRW_context_state_get(void)
DefaultTextureList * DRW_viewport_texture_list_get(void)
Definition: draw_manager.c:638
void DRW_shgroup_uniform_float_copy(DRWShadingGroup *shgroup, const char *name, const float value)
const DRWView * DRW_view_default_get(void)
DRWShadingGroup * DRW_shgroup_create(struct GPUShader *shader, DRWPass *pass)
void DRW_shgroup_uniform_texture_ref(DRWShadingGroup *shgroup, const char *name, GPUTexture **tex)
void DRW_draw_pass(DRWPass *pass)
void DRW_view_set_active(const DRWView *view)
const int state
ccl_gpu_kernel_postfix ccl_global float int int int int sh
void OVERLAY_edit_curves_draw(OVERLAY_Data *vedata)
static void overlay_edit_curves_add_ob_to_pass(OVERLAY_PrivateData *pd, Object *ob, bool in_front)
void OVERLAY_edit_curves_init(OVERLAY_Data *vedata)
void OVERLAY_edit_curves_cache_populate(OVERLAY_Data *vedata, Object *ob)
void OVERLAY_edit_curves_cache_init(OVERLAY_Data *vedata)
#define IN_FRONT
GPUShader * OVERLAY_shader_edit_curve_point(void)
#define NOT_IN_FRONT
struct View3D * v3d
Definition: DRW_render.h:976
struct GPUUniformBuf * block_ubo
Definition: draw_common.h:129
struct GPUTexture * depth
OVERLAY_PassList * psl
OVERLAY_StorageList * stl
OVERLAY_TextureList * txl
DRWPass * edit_curves_points_ps[2]
DRWView * view_edit_curves_points
DRWShadingGroup * edit_curves_points_grp[2]
struct OVERLAY_PrivateData::@253 edit_curves
struct OVERLAY_PrivateData * pd
struct GPUTexture * dummy_depth_tx
void * data
View3DOverlay overlay