41 ps_.shader_set(res.shaders->mesh_edit_depth.get());
42 ps_.push_constant(
"retopology_offset", 0.0f);
44 ps_.draw(res.shapes.image_quad.get());
54 manager.submit(ps_, view);
73 bool use_material_slot_selection_ =
false;
85 pointcloud_ps_ =
nullptr;
90 use_material_slot_selection_ =
state.is_material_select;
92 bool use_cull = res.globals_buf.backface_culling;
99 state.clipping_plane_count);
100 res.select_bind(ps_);
102 auto &sub = ps_.sub(
"Mesh");
103 sub.shader_set(res.is_selection() ? res.shaders->depth_mesh_conservative.get() :
104 res.shaders->depth_mesh.get());
108 auto &sub = ps_.sub(
"MeshFlat");
109 sub.shader_set(res.shaders->depth_mesh.get());
110 mesh_flat_ps_ = ⊂
113 auto &sub = ps_.sub(
"Hair");
114 sub.shader_set(res.shaders->depth_mesh.get());
118 auto &sub = ps_.sub(
"Curves");
119 sub.shader_set(res.shaders->depth_curves.get());
123 auto &sub = ps_.sub(
"PointCloud");
124 sub.shader_set(res.shaders->depth_pointcloud.get());
125 pointcloud_ps_ = ⊂
128 auto &sub = ps_.sub(
"GSplat");
129 sub.shader_set(res.shaders->depth_gsplat.get());
134 sub.shader_set(res.shaders->depth_grease_pencil.get());
135 grease_pencil_ps_ = ⊂
141 if (
state.skip_particles) {
165 select::ID select_id = use_material_slot_selection_ ?
175 mesh_ps_->draw(geom, handle, select_id.
get());
192 select::ID select_id = use_material_slot_selection_ ?
193 res.
select_id(ob_ref, (batch.material_slot + 1) << 16) :
198 mesh_ps_->draw_expand(batch.batch,
GPU_PRIM_TRIS, 1, 1, handle, select_id.
get());
201 mesh_ps_->draw(batch.batch, handle, select_id.
get());
211 bool is_solid = ob_ref.object->dt >=
OB_SOLID ||
222 !
state.is_image_render;
224 if (use_sculpt_pbvh) {
229 gpu::Batch *geom_single =
nullptr;
235 switch (ob_ref.object->type) {
237 if (use_material_slot_selection_) {
246 if (res.is_selection() && !use_material_slot_selection_ &&
251 manager.unique_handle(ob_ref),
252 res.select_id(ob_ref).get());
258 if (!res.is_selection()) {
266 if (geom_single ==
nullptr) {
275 const char *error =
nullptr;
283 if (!res.is_selection() &&
state.is_render_depth_available) {
292 manager.unique_handle(ob_ref),
293 res.select_id(ob_ref));
299 if (pass ==
nullptr) {
307 if (geom_list[material_id] ==
nullptr) {
311 select::ID select_id = use_material_slot_selection_ ?
312 res.select_id(ob_ref, (material_id + 1) << 16) :
313 res.select_id(ob_ref);
314 if (res.is_selection() && (pass == mesh_ps_)) {
320 pass->
draw(geom_list[material_id], res_handle, select_id.
get());
331 manager.generate_commands(ps_, view);
341 manager.submit_only(ps_, view);
#define RE_PASSNAME_GREASE_PENCIL
constexpr IndexRange index_range() const
ResourceHandle resource_handle_for_psys(const ObjectRef &ref, const float4x4 &model_matrix)
ResourceHandleRange unique_handle_for_sculpt(const ObjectRef &ref)
float4x4 particles_matrix() const
void draw_expand(gpu::Batch *batch, GPUPrimType primitive_type, uint primitive_len, uint instance_len, uint vertex_len, uint vertex_first, ResourceIDRange res_id={}, uint custom_id=0)
void draw(gpu::Batch *batch, uint instance_len=-1, uint vertex_len=-1, uint vertex_first=-1, ResourceIDRange res_id={}, uint custom_id=0)
detail::PassBase< command::DrawMultiBuf > Sub
static void draw_grease_pencil(Resources &res, PassMain::Sub &pass, const Scene *scene, Object *ob, ResourceHandleRange res_handle, select::ID select_id=select::SelectMap::select_invalid_id())
void begin_sync(Resources &res, const State &state) final
void draw_on_render(gpu::FrameBuffer *framebuffer, Manager &manager, View &view) final
void sculpt_sync(Manager &manager, const ObjectRef &ob_ref, Resources &res)
void object_sync(Manager &manager, const ObjectRef &ob_ref, Resources &res, const State &state) final
void begin_sync(Resources &res, const State &state) final
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view) final
void pre_draw(Manager &manager, View &view) final
void particle_sync(Manager &manager, const ObjectRef &ob_ref, Resources &res, const State &state)
#define DRW_CLIPPING_UBO_SLOT
#define OVERLAY_GLOBALS_SLOT
detail::Pass< command::DrawCommandBuf > PassSimple
detail::Pass< command::DrawMultiBuf > PassMain
gpu::Batch * curves_sub_pass_setup(PassMain::Sub &ps, const Scene *scene, Object *ob, const char *&r_error, GPUMaterial *gpu_material=nullptr)
Vector< SculptBatch > sculpt_batches_get(const Object *ob, SculptBatchFeature features)
bool pointcloud_is_gsplat(Object *ob)
Span< gpu::Batch * > DRW_cache_mesh_surface_shaded_get(Object *ob, const Span< const GPUMaterial * > materials)
gpu::Batch * pointcloud_sub_pass_setup(PassMain::Sub &sub_ps, const ObjectRef &ob_ref, const ResourceHandleRange &res_handle, GPUMaterial *gpu_material=nullptr)
gpu::Batch * DRW_cache_particles_get_hair(Object *object, ParticleSystem *psys, ModifierData *md)
gpu::Batch * DRW_cache_volume_selection_surface_get(Object *ob)
gpu::Batch * DRW_cache_mesh_surface_get(Object *ob)
gpu::Batch * DRW_cache_mesh_all_edges_get(Object *ob)
void GPU_framebuffer_bind(gpu::FrameBuffer *fb)
int BKE_object_material_used_with_fallback_eval(const Object &ob)
bool DRW_object_is_visible_psys_in_active_context(const Object *object, const ParticleSystem *psys)
@ DRW_STATE_DEPTH_LESS_EQUAL
bool BKE_sculptsession_use_pbvh_draw(const Object *ob, const RegionView3D *rv3d)
ListBaseT< struct ParticleSystem > particlesystem
static int flat_axis_index_get(const ObjectRef &ob_ref)
bool is_selection() const
const ID select_id(const ObjectRef &ob_ref, uint sub_object_id=0)