Blender V4.3
overlay_edit_curve.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2019 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
9#include "DRW_render.hh"
10
11#include "DNA_curve_types.h"
12
13#include "overlay_private.hh"
14
16{
17 OVERLAY_PassList *psl = vedata->psl;
18 OVERLAY_PrivateData *pd = vedata->stl->pd;
19 const DRWContextState *draw_ctx = DRW_context_state_get();
20 View3D *v3d = draw_ctx->v3d;
21 DRWShadingGroup *grp;
22 GPUShader *sh;
24
28
29 /* Run Twice for in-front passes. */
30 for (int i = 0; i < 2; i++) {
34
37 DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
39
41 DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
42 DRW_shgroup_uniform_float_copy(grp, "normalSize", 0.0f);
43 }
44 {
47
50 DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
51 DRW_shgroup_uniform_bool_copy(grp, "showCurveHandles", pd->edit_curve.show_handles);
52 DRW_shgroup_uniform_int_copy(grp, "curveHandleDisplay", pd->edit_curve.handle_display);
54
57 DRW_shgroup_uniform_bool_copy(grp, "showCurveHandles", pd->edit_curve.show_handles);
58 DRW_shgroup_uniform_int_copy(grp, "curveHandleDisplay", pd->edit_curve.handle_display);
59 DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
60 }
61}
62
64{
65 OVERLAY_PrivateData *pd = vedata->stl->pd;
66 bool draw_normals = (pd->overlay.edit_flag & V3D_OVERLAY_EDIT_CU_NORMALS) != 0;
67 bool do_xray = (ob->dtx & OB_DRAW_IN_FRONT) != 0;
68
69 Curve *cu = static_cast<Curve *>(ob->data);
70 blender::gpu::Batch *geom;
71
73 if (geom) {
74 DRW_shgroup_call_no_cull(pd->edit_curve_wire_grp[do_xray], geom, ob);
75 }
76
77 if ((cu->flag & CU_3D) && draw_normals) {
79 DRW_shgroup_call_instances(pd->edit_curve_normal_grp[do_xray], ob, geom, 3);
80 }
81
83 if (geom) {
85 }
86
88 if (geom) {
90 }
91}
92
94{
95 OVERLAY_PrivateData *pd = vedata->stl->pd;
96 blender::gpu::Batch *geom;
97
99 if (geom) {
101 }
102
104 if (geom) {
106 }
107}
108
110{
111 OVERLAY_PassList *psl = vedata->psl;
112 OVERLAY_FramebufferList *fbl = vedata->fbl;
113
114 if (DRW_state_is_fbo()) {
116 }
117
120
122}
@ CU_3D
@ OB_DRAW_IN_FRONT
@ V3D_OVERLAY_EDIT_CU_NORMALS
@ CURVE_HANDLE_NONE
#define DRW_shgroup_call_no_cull(shgroup, geom, ob)
#define DRW_PASS_CREATE(pass, state)
#define DRW_shgroup_uniform_block(shgroup, name, ubo)
void GPU_framebuffer_bind(GPUFrameBuffer *framebuffer)
struct GPUShader GPUShader
blender::gpu::Batch * DRW_cache_curve_edge_wire_get(Object *ob)
blender::gpu::Batch * DRW_cache_curve_edge_overlay_get(Object *ob)
blender::gpu::Batch * DRW_cache_curve_vert_overlay_get(Object *ob)
blender::gpu::Batch * DRW_cache_curve_edge_normal_get(Object *ob)
DRW_Global G_draw
const DRWContextState * DRW_context_state_get()
bool DRW_state_is_fbo()
DRWShadingGroup * DRW_shgroup_create(GPUShader *shader, DRWPass *pass)
void DRW_shgroup_uniform_float_copy(DRWShadingGroup *shgroup, const char *name, const float value)
void DRW_shgroup_call_instances(DRWShadingGroup *shgroup, const Object *ob, blender::gpu::Batch *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)
void DRW_shgroup_uniform_bool_copy(DRWShadingGroup *shgroup, const char *name, const bool value)
void DRW_draw_pass(DRWPass *pass)
DRWState
Definition draw_state.hh:25
@ DRW_STATE_BLEND_ALPHA
Definition draw_state.hh:55
@ DRW_STATE_WRITE_DEPTH
Definition draw_state.hh:29
@ DRW_STATE_WRITE_COLOR
Definition draw_state.hh:30
@ DRW_STATE_DEPTH_LESS_EQUAL
Definition draw_state.hh:38
@ DRW_STATE_DEPTH_ALWAYS
Definition draw_state.hh:36
static ulong state[N]
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()
GPUShader * OVERLAY_shader_edit_curve_wire()
GPUShader * OVERLAY_shader_edit_curve_point()
GPUUniformBuf * block_ubo
OVERLAY_PassList * psl
OVERLAY_StorageList * stl
OVERLAY_FramebufferList * fbl
GPUFrameBuffer * overlay_default_fb
DRWPass * edit_curve_handle_ps
DRWPass * edit_curve_wire_ps[2]
OVERLAY_ShadingData shdata
struct OVERLAY_PrivateData::@228 edit_curve
DRWShadingGroup * edit_curve_wire_grp[2]
DRWShadingGroup * edit_curve_normal_grp[2]
DRWShadingGroup * edit_curve_points_grp
DRWShadingGroup * edit_curve_handle_grp
OVERLAY_PrivateData * pd
View3DOverlay overlay