Blender  V3.3
overlay_edit_curve.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 "DNA_curve_types.h"
11 
12 #include "overlay_private.h"
13 
15 {
16  OVERLAY_PassList *psl = vedata->psl;
17  OVERLAY_PrivateData *pd = vedata->stl->pd;
18  const DRWContextState *draw_ctx = DRW_context_state_get();
19  View3D *v3d = draw_ctx->v3d;
20  DRWShadingGroup *grp;
21  GPUShader *sh;
23 
27 
28  /* Run Twice for in-front passes. */
29  for (int i = 0; i < 2; i++) {
33 
36  DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
38 
40  DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
41  DRW_shgroup_uniform_float_copy(grp, "normalSize", 0.0f);
42  }
43  {
46 
49  DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
50  DRW_shgroup_uniform_bool_copy(grp, "showCurveHandles", pd->edit_curve.show_handles);
51  DRW_shgroup_uniform_int_copy(grp, "curveHandleDisplay", pd->edit_curve.handle_display);
53 
56  DRW_shgroup_uniform_bool_copy(grp, "showCurveHandles", pd->edit_curve.show_handles);
57  DRW_shgroup_uniform_int_copy(grp, "curveHandleDisplay", pd->edit_curve.handle_display);
58  DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
59  }
60 }
61 
63 {
64  OVERLAY_PrivateData *pd = vedata->stl->pd;
65  bool draw_normals = (pd->overlay.edit_flag & V3D_OVERLAY_EDIT_CU_NORMALS) != 0;
66  bool do_xray = (ob->dtx & OB_DRAW_IN_FRONT) != 0;
67 
68  Curve *cu = ob->data;
69  struct GPUBatch *geom;
70 
72  if (geom) {
73  DRW_shgroup_call_no_cull(pd->edit_curve_wire_grp[do_xray], geom, ob);
74  }
75 
76  if ((cu->flag & CU_3D) && draw_normals) {
78  DRW_shgroup_call_instances(pd->edit_curve_normal_grp[do_xray], ob, geom, 3);
79  }
80 
82  if (geom) {
84  }
85 
87  if (geom) {
89  }
90 }
91 
93 {
94  OVERLAY_PrivateData *pd = vedata->stl->pd;
95  struct GPUBatch *geom;
96 
98  if (geom) {
100  }
101 
103  if (geom) {
105  }
106 }
107 
109 {
110  OVERLAY_PassList *psl = vedata->psl;
111  OVERLAY_FramebufferList *fbl = vedata->fbl;
112 
113  if (DRW_state_is_fbo()) {
115  }
116 
119 
121 }
@ CU_3D
@ OB_DRAW_IN_FRONT
@ V3D_OVERLAY_EDIT_CU_NORMALS
@ CURVE_HANDLE_NONE
#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
@ DRW_STATE_DEPTH_ALWAYS
Definition: DRW_render.h:309
#define DRW_PASS_CREATE(pass, state)
Definition: DRW_render.h:690
#define DRW_shgroup_uniform_block(shgroup, name, ubo)
Definition: DRW_render.h:651
GPUBatch
Definition: GPU_batch.h:78
void GPU_framebuffer_bind(GPUFrameBuffer *fb)
struct GPUShader GPUShader
Definition: GPU_shader.h:20
GPUBatch * DRW_cache_curve_edge_normal_get(Object *ob)
Definition: draw_cache.c:2933
GPUBatch * DRW_cache_curve_edge_wire_get(Object *ob)
Definition: draw_cache.c:2926
GPUBatch * DRW_cache_curve_vert_overlay_get(Object *ob)
Definition: draw_cache.c:2948
GPUBatch * DRW_cache_curve_edge_overlay_get(Object *ob)
Definition: draw_cache.c:2940
struct DRW_Global G_draw
Definition: draw_common.c:32
bool DRW_state_is_fbo(void)
const DRWContextState * DRW_context_state_get(void)
void DRW_shgroup_uniform_float_copy(DRWShadingGroup *shgroup, const char *name, const float value)
void DRW_shgroup_call_instances(DRWShadingGroup *shgroup, Object *ob, struct GPUBatch *geom, uint count)
void DRW_shgroup_state_enable(DRWShadingGroup *shgroup, DRWState state)
void DRW_shgroup_uniform_int_copy(DRWShadingGroup *shgroup, const char *name, const int value)
DRWShadingGroup * DRW_shgroup_create(struct GPUShader *shader, DRWPass *pass)
void DRW_shgroup_uniform_bool_copy(DRWShadingGroup *shgroup, const char *name, const bool value)
void DRW_draw_pass(DRWPass *pass)
const int state
ccl_gpu_kernel_postfix ccl_global float int int int int sh
void OVERLAY_edit_curve_draw(OVERLAY_Data *vedata)
void OVERLAY_edit_curve_cache_populate(OVERLAY_Data *vedata, Object *ob)
void OVERLAY_edit_curve_cache_init(OVERLAY_Data *vedata)
void OVERLAY_edit_surf_cache_populate(OVERLAY_Data *vedata, Object *ob)
GPUShader * OVERLAY_shader_edit_curve_handle(void)
GPUShader * OVERLAY_shader_edit_curve_wire(void)
GPUShader * OVERLAY_shader_edit_curve_point(void)
struct View3D * v3d
Definition: DRW_render.h:976
struct GPUUniformBuf * block_ubo
Definition: draw_common.h:129
OVERLAY_PassList * psl
OVERLAY_StorageList * stl
OVERLAY_FramebufferList * fbl
struct GPUFrameBuffer * overlay_default_fb
DRWPass * edit_curve_handle_ps
DRWPass * edit_curve_wire_ps[2]
OVERLAY_ShadingData shdata
View3DOverlay overlay
DRWShadingGroup * edit_curve_wire_grp[2]
DRWShadingGroup * edit_curve_normal_grp[2]
DRWShadingGroup * edit_curve_points_grp
DRWShadingGroup * edit_curve_handle_grp
struct OVERLAY_PrivateData::@250 edit_curve
struct OVERLAY_PrivateData * pd
void * data
View3DOverlay overlay