31 PassSimple edit_legacy_curve_ps_ = {
"Legacy Curve Edit"};
37 PassSimple edit_legacy_surface_handles_ps = {
"Surface Edit"};
44 View view_edit_cage = {
"view_edit_cage"};
45 float view_dist = 0.0f;
47 bool enabled_ =
false;
58 view_dist =
state.view_dist_get(view.winmat());
61 auto &pass = edit_curves_ps_;
64 auto &sub = pass.sub(
"Lines");
67 state.clipping_plane_count);
71 sub.push_constant(
"useWeight",
false);
72 sub.push_constant(
"useGreasePencil",
false);
73 edit_curves_lines_ = ⊂
76 auto &sub = pass.
sub(
"Handles");
81 sub.push_constant(
"curveHandleDisplay",
int(
state.overlay.handle_display));
82 edit_curves_handles_ = ⊂
85 auto &sub = pass.
sub(
"Points");
88 state.clipping_plane_count);
92 sub.push_constant(
"useWeight",
false);
93 sub.push_constant(
"useGreasePencil",
false);
94 sub.push_constant(
"doStrokeEndpoints",
false);
95 sub.push_constant(
"curveHandleDisplay",
int(
state.overlay.handle_display));
96 edit_curves_points_ = ⊂
105 auto &pass = edit_legacy_curve_ps_;
108 auto &sub = pass.sub(
"Wires");
110 state.clipping_plane_count);
113 sub.push_constant(
"normalSize", 0.0f);
114 edit_legacy_curve_wires_ = ⊂
117 auto &sub = pass.
sub(
"Normals");
119 state.clipping_plane_count);
122 sub.push_constant(
"normalSize",
state.overlay.normals_length);
123 sub.push_constant(
"use_hq_normals", use_hq_normals);
124 edit_legacy_curve_normals_ = ⊂
127 edit_legacy_curve_normals_ =
nullptr;
130 auto &sub = pass.
sub(
"Handles");
135 sub.push_constant(
"curveHandleDisplay",
int(
state.overlay.handle_display));
136 sub.push_constant(
"alpha", 1.0f);
137 edit_legacy_curve_handles_ = ⊂
141 auto &sub = pass.
sub(
"Points");
146 sub.push_constant(
"curveHandleDisplay",
int(
state.overlay.handle_display));
147 sub.push_constant(
"useGreasePencil",
false);
148 sub.push_constant(
"doStrokeEndpoints",
false);
149 edit_legacy_curve_points_ = ⊂
154 auto &pass = edit_legacy_surface_handles_ps;
157 auto create_sub = [&](
const char *name,
DRWState drw_state,
float alpha) {
158 auto &sub = pass.sub(name);
159 sub.state_set(drw_state,
state.clipping_plane_count);
163 sub.push_constant(
"curveHandleDisplay",
int(
state.overlay.handle_display));
164 sub.push_constant(
"alpha", alpha);
170 edit_legacy_surface_xray_handles_ = create_sub(
"SurfaceXrayHandles", state_xray, 0.2f);
174 edit_legacy_surface_handles_ = create_sub(
"SurfaceHandles", state_front, 1.0f);
216 edit_legacy_curve_wires_->
draw(geom, res_handle);
218 if (edit_legacy_curve_normals_ && (curve.flag &
CU_3D)) {
234 edit_legacy_curve_points_->
draw(geom, res_handle);
247 manager.
submit(edit_legacy_surface_handles_ps, view);
259 manager.
submit(edit_curves_ps_, view_edit_cage);
260 manager.
submit(edit_legacy_curve_ps_, view);
Low-level operations for curves that cannot be defined in the C++ header yet.
@ V3D_OVERLAY_EDIT_CU_NORMALS
bool GPU_use_hq_normals_workaround()
void GPU_framebuffer_bind(GPUFrameBuffer *framebuffer)
ResourceHandle unique_handle(const ObjectRef &ref)
void submit(PassSimple &pass, View &view)
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, ResourceHandle 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, ResourceHandle handle={0}, uint custom_id=0)
void begin_sync(Resources &res, const State &state, const View &view)
void draw_color_only(Framebuffer &framebuffer, Manager &manager, View &view)
void edit_object_sync_legacy(Manager &manager, const ObjectRef &ob_ref, Resources &)
void draw(Framebuffer &framebuffer, Manager &manager, View &view)
void edit_object_sync(Manager &manager, const ObjectRef &ob_ref, Resources &)
ShaderPtr legacy_curve_edit_points
ShaderPtr legacy_curve_edit_handles
ShaderPtr legacy_curve_edit_normals
ShaderPtr curve_edit_line
ShaderPtr legacy_curve_edit_wires
ShaderPtr curve_edit_points
ShaderPtr curve_edit_handles
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_STATE_DEPTH_LESS_EQUAL
@ DRW_STATE_DEPTH_GREATER
static float4x4 winmat_polygon_offset(float4x4 winmat, float view_dist, float offset)
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)
blender::gpu::Batch * DRW_curves_batch_cache_get_edit_curves_lines(Curves *curves)
TextureRef weight_ramp_tx
GPUUniformBuf * globals_buf