32 bool enabled_ =
false;
33 bool use_selection_ =
false;
34 bool use_material_slot_selection_ =
false;
36 overlay::GreasePencil::ViewParameters grease_pencil_view;
43 use_selection_ = (selection_type_ != SelectionType::DISABLED);
51 point_cloud_ps_ =
nullptr;
71 state.clipping_plane_count);
74 auto &sub = ps_.
sub(
"Mesh");
81 auto &sub = ps_.
sub(
"Hair");
87 auto &sub = ps_.
sub(
"Curves");
93 auto &sub = ps_.
sub(
"PointCloud");
96 point_cloud_ps_ = ⊂
99 auto &sub = ps_.
sub(
"GreasePencil");
102 grease_pencil_ps_ = ⊂
124 if (handle.raw == 0u) {
129 select::ID select_id = use_material_slot_selection_ ?
130 res.
select_id(ob_ref, part->omat << 16) :
134 mesh_ps_->
draw(geom, handle, select_id.
get());
166 if (use_sculpt_pbvh) {
171 gpu::Batch *geom_single =
nullptr;
177 if (use_material_slot_selection_) {
181 materials.fill(
nullptr);
184 ob_ref.
object, materials.
data(), materials_len);
186 geom_list = {geom_per_mat, materials_len};
194 if (selection_type_ == SelectionType::DISABLED) {
204 pass = point_cloud_ps_;
211 if (selection_type_ == SelectionType::DISABLED) {
216 GreasePencil::draw_grease_pencil(*grease_pencil_ps_,
227 if (pass ==
nullptr) {
234 select::ID select_id = use_material_slot_selection_ ?
235 res.
select_id(ob_ref, (material_id + 1) << 16) :
238 if (use_selection_ && (pass == mesh_ps_)) {
244 pass->draw(geom_list[material_id], res_handle, select_id.
get());
256 manager.
submit(ps_, view);
bool BKE_sculptsession_use_pbvh_draw(const Object *ob, const RegionView3D *rv3d)
#define LISTBASE_FOREACH(type, var, list)
@ V3D_SHADING_BACKFACE_CULLING
void GPU_framebuffer_bind(GPUFrameBuffer *framebuffer)
constexpr IndexRange index_range() const
ResourceHandle unique_handle(const ObjectRef &ref)
ResourceHandle resource_handle_for_sculpt(const ObjectRef &ref)
ResourceHandle resource_handle_for_psys(const ObjectRef &ref, const float4x4 &model_matrix)
void submit(PassSimple &pass, View &view)
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 shader_set(GPUShader *shader)
static float4x4 dupli_matrix_get(const ObjectRef &ob_ref)
void begin_sync(Resources &res, const State &state)
void sculpt_sync(Manager &manager, const ObjectRef &ob_ref, Resources &res)
Prepass(const SelectionType selection_type)
void object_sync(Manager &manager, const ObjectRef &ob_ref, Resources &res, const State &state)
void particle_sync(Manager &manager, const ObjectRef &ob_ref, Resources &res, const State &state)
void draw(Framebuffer &framebuffer, Manager &manager, View &view)
ShaderPtr depth_mesh_conservative
ShaderPtr depth_grease_pencil
ShaderPtr depth_point_cloud
blender::gpu::Batch * DRW_cache_mesh_surface_get(Object *ob)
blender::gpu::Batch * DRW_cache_particles_get_hair(Object *object, ParticleSystem *psys, ModifierData *md)
blender::gpu::Batch ** DRW_cache_mesh_surface_shaded_get(Object *ob, GPUMaterial **gpumat_array, uint gpumat_array_len)
int DRW_cache_object_material_count_get(const Object *ob)
bool DRW_state_is_material_select()
bool DRW_state_is_image_render()
bool DRW_object_is_visible_psys_in_active_context(const Object *object, const ParticleSystem *psys)
bool DRW_view_is_persp_get(const DRWView *view)
void DRW_view_viewmat_get(const DRWView *view, float mat[4][4], bool inverse)
@ DRW_STATE_DEPTH_LESS_EQUAL
gpu::Batch * point_cloud_sub_pass_setup(PassMain::Sub &sub_ps, Object *object, GPUMaterial *gpu_material=nullptr)
gpu::Batch * curves_sub_pass_setup(PassMain::Sub &ps, const Scene *scene, Object *ob, GPUMaterial *gpu_material=nullptr)
Vector< SculptBatch > sculpt_batches_get(const Object *ob, SculptBatchFeature features)
blender::gpu::Batch * DRW_cache_volume_selection_surface_get(Object *ob)
const c_style_mat & ptr() const
GPUUniformBuf * globals_buf
void select_bind(PassSimple &pass)
const ID select_id(const ObjectRef &ob_ref, uint sub_object_id=0)