32 PassSimple edit_legacy_curve_handles_ps_ = {
"Curve Edit Handles"};
36 PassSimple edit_legacy_curve_ps_ = {
"Legacy Curve Edit"};
40 PassSimple edit_curves_handles_ps_ = {
"Legacy Curve Edit Handles"};
44 PassSimple edit_legacy_surface_handles_ps = {
"Surface Edit"};
51 View view_edit_cage = {
"view_edit_cage"};
63 offset_data_ =
state.offset_data_get();
66 auto &pass = edit_curves_ps_;
71 auto &sub = pass.sub(
"Lines");
74 state.clipping_plane_count);
75 sub.shader_set(res.shaders->curve_edit_line.get());
76 sub.bind_texture(
"weight_tx", &res.weight_ramp_tx);
77 sub.push_constant(
"use_weight",
false);
78 sub.push_constant(
"use_grease_pencil",
false);
79 edit_curves_lines_ = ⊂
84 auto &pass = edit_curves_handles_ps_;
89 auto &sub = pass.sub(
"Handles");
91 sub.shader_set(res.shaders->curve_edit_handles.get());
92 sub.push_constant(
"curve_handle_display",
int(
state.overlay.handle_display));
93 edit_curves_handles_ = ⊂
96 auto &sub = pass.
sub(
"Points");
99 state.clipping_plane_count);
100 sub.shader_set(res.shaders->curve_edit_points.get());
101 sub.bind_texture(
"weight_tx", &res.weight_ramp_tx);
102 sub.push_constant(
"use_weight",
false);
103 sub.push_constant(
"use_grease_pencil",
false);
104 sub.push_constant(
"do_stroke_endpoints",
false);
105 sub.push_constant(
"curve_handle_display",
int(
state.overlay.handle_display));
106 edit_curves_points_ = ⊂
115 auto &pass = edit_legacy_curve_ps_;
120 auto &sub = pass.sub(
"Wires");
122 state.clipping_plane_count);
123 sub.shader_set(res.shaders->legacy_curve_edit_wires.get());
124 sub.push_constant(
"normal_size", 0.0f);
125 edit_legacy_curve_wires_ = ⊂
128 auto &sub = pass.
sub(
"Normals");
130 state.clipping_plane_count);
131 sub.shader_set(res.shaders->legacy_curve_edit_normals.get());
132 sub.push_constant(
"normal_size",
state.overlay.normals_length);
133 sub.push_constant(
"use_hq_normals", use_hq_normals);
134 edit_legacy_curve_normals_ = ⊂
137 edit_legacy_curve_normals_ =
nullptr;
142 auto &pass = edit_legacy_curve_handles_ps_;
147 auto &sub = pass.sub(
"Handles");
149 sub.shader_set(res.shaders->legacy_curve_edit_handles.get());
151 sub.push_constant(
"curve_handle_display",
int(
state.overlay.handle_display));
152 sub.push_constant(
"alpha", 1.0f);
153 edit_legacy_curve_handles_ = ⊂
157 auto &sub = pass.
sub(
"Points");
159 sub.shader_set(res.shaders->legacy_curve_edit_points.get());
161 sub.push_constant(
"curve_handle_display",
int(
state.overlay.handle_display));
162 sub.push_constant(
"use_grease_pencil",
false);
163 sub.push_constant(
"do_stroke_endpoints",
false);
164 edit_legacy_curve_points_ = ⊂
169 auto &pass = edit_legacy_surface_handles_ps;
174 auto create_sub = [&](
const char *
name,
DRWState drw_state,
float alpha) {
175 auto &sub = pass.sub(
name);
176 sub.state_set(drw_state,
state.clipping_plane_count);
177 sub.shader_set(res.shaders->legacy_curve_edit_handles.get());
179 sub.push_constant(
"curve_handle_display",
int(
state.overlay.handle_display));
180 sub.push_constant(
"alpha", alpha);
186 edit_legacy_surface_xray_handles_ = create_sub(
"SurfaceXrayHandles", state_xray, 0.2f);
190 edit_legacy_surface_handles_ = create_sub(
"SurfaceHandles", state_front, 1.0f);
197 const State & )
final
203 Object *ob = ob_ref.object;
209 edit_curves_points_->
draw(geom, manager.unique_handle(ob_ref));
217 edit_curves_lines_->
draw(geom, manager.unique_handle(ob_ref));
235 edit_legacy_curve_wires_->
draw(geom, res_handle);
253 edit_legacy_curve_points_->
draw(geom, res_handle);
266 manager.submit(edit_legacy_curve_ps_,
view);
267 manager.submit(edit_curves_ps_, view_edit_cage);
268 manager.submit(edit_legacy_surface_handles_ps,
view);
280 manager.submit(edit_legacy_curve_handles_ps_,
view);
281 manager.submit(edit_curves_handles_ps_, view_edit_cage);
@ V3D_OVERLAY_EDIT_CU_NORMALS
bool GPU_use_hq_normals_workaround()
void GPU_framebuffer_bind(GPUFrameBuffer *fb)
ResourceHandleRange unique_handle(const ObjectRef &ref)
void sync(const float4x4 &view_mat, const float4x4 &win_mat, int view_id=0)
void draw(gpu::Batch *batch, uint instance_len=-1, uint vertex_len=-1, uint vertex_first=-1, ResourceHandleRange handle={0}, uint custom_id=0)
PassBase< DrawCommandBufType > & sub(const char *name)
void state_set(DRWState state, int clip_plane_count=0)
void draw_expand(gpu::Batch *batch, GPUPrimType primitive_type, uint primitive_len, uint instance_len, uint vertex_len=-1, uint vertex_first=-1, ResourceHandleRange handle={0}, uint custom_id=0)
void edit_object_sync_legacy(Manager &manager, const ObjectRef &ob_ref, Resources &)
void begin_sync(Resources &res, const State &state) final
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view) final
void draw_color_only(Framebuffer &framebuffer, Manager &manager, View &view) final
void edit_object_sync(Manager &manager, const ObjectRef &ob_ref, Resources &, const State &) final
Mesh & DRW_object_get_data_for_drawing(const Object &object)
#define DRW_CLIPPING_UBO_SLOT
#define OVERLAY_GLOBALS_SLOT
@ DRW_STATE_DEPTH_LESS_EQUAL
@ DRW_STATE_DEPTH_GREATER
blender::gpu::Batch * DRW_curves_batch_cache_get_edit_points(Curves *curves)
blender::gpu::Batch * DRW_curves_batch_cache_get_edit_curves_handles(Curves *curves)
gpu::Batch * DRW_cache_curve_edge_overlay_get(Object *ob)
gpu::Batch * DRW_cache_curve_edge_wire_get(Object *ob)
gpu::Batch * DRW_cache_curve_edge_normal_get(Object *ob)
blender::gpu::Batch * DRW_curves_batch_cache_get_edit_curves_lines(Curves *curves)
gpu::Batch * DRW_cache_curve_vert_overlay_get(Object *ob)
float4x4 winmat_polygon_offset(float4x4 winmat, float offset)