36 ObjectHandle &handle = ob_handles.lookup_or_add_cb(key, [&]() {
42 handle.
recalc = inst_.get_recalc_flags(ob_ref);
50 handle.
recalc = inst_.get_recalc_flags(world);
64 if (sub_pass !=
nullptr) {
65 sub_pass->
draw(geom, resource_handle);
74 if (object_pass !=
nullptr) {
75 object_pass->
draw(geom, res_handle);
88 if (!inst_.use_surfaces) {
99 bool has_motion = inst_.velocity.step_object_sync(
110 bool is_alpha_blend =
false;
111 bool has_transparent_shadows =
false;
112 bool has_volume =
false;
113 float inflate_bounds = 0.0f;
115 gpu::Batch *geom = mat_geom[
i];
116 if (geom ==
nullptr) {
149 inst_.cryptomatte.sync_material(mat);
157 inst_.volume.object_sync(ob_handle);
160 if (inflate_bounds != 0.0f) {
161 inst_.manager->update_handle_bounds(res_handle, ob_ref, inflate_bounds);
164 inst_.manager->extract_object_attributes(res_handle, ob_ref, material_array.
gpu_materials);
166 inst_.shadows.sync_object(ob, ob_handle, res_handle, is_alpha_blend, has_transparent_shadows);
167 inst_.cryptomatte.sync_object(ob, res_handle);
172 if (!inst_.use_surfaces) {
183 bool has_motion =
false;
186 bool is_alpha_blend =
false;
187 bool has_transparent_shadows =
false;
188 bool has_volume =
false;
189 float inflate_bounds = 0.0f;
193 gpu::Batch *geom =
batch.batch;
194 if (geom ==
nullptr) {
227 inst_.cryptomatte.sync_material(mat);
235 inst_.volume.object_sync(ob_handle);
242 const float3 half_extent =
bounds.max - center + inflate_bounds;
243 inst_.manager->update_handle_bounds(res_handle, center, half_extent);
245 inst_.manager->extract_object_attributes(res_handle, ob_ref, material_array.
gpu_materials);
247 inst_.shadows.sync_object(ob, ob_handle, res_handle, is_alpha_blend, has_transparent_shadows);
248 inst_.cryptomatte.sync_object(ob, res_handle);
265 bool has_motion = inst_.velocity.step_object_sync(
268 Material &material = inst_.materials.material_get(
272 if (matpass.sub_pass ==
nullptr) {
275 PassMain::Sub &object_pass = matpass.sub_pass->sub(
"Point Cloud Sub Pass");
284 inst_.volume.object_sync(ob_handle);
293 drawcall_add(material.
capture);
295 drawcall_add(material.
prepass);
296 drawcall_add(material.
shading);
297 drawcall_add(material.
shadow);
304 inst_.cryptomatte.sync_object(ob, res_handle);
307 inst_.cryptomatte.sync_material(mat);
310 inst_.manager->update_handle_bounds(res_handle, ob_ref, mat->
inflate_bounds);
313 inst_.manager->extract_object_attributes(res_handle, ob_ref, material.
shading.
gpumat);
315 inst_.shadows.sync_object(ob,
330 if (!inst_.use_volumes) {
339 const bool has_motion =
false;
341 Material &material = inst_.materials.material_get(
361 if (object_pass !=
nullptr) {
362 object_pass->
draw(geom, res_handle);
369 gpu::Batch *geom = inst_.volume.unit_cube_batch_get();
371 bool is_rendered =
false;
373 is_rendered |= drawcall_add(material.
volume_material, geom, res_handle);
381 inst_.volume.object_sync(ob_handle);
397 if (!inst_.use_curves) {
402 if (particle_sys !=
nullptr) {
406 if (res_handle.
raw == 0) {
408 res_handle = inst_.manager->unique_handle(ob_ref);
411 bool has_motion = inst_.velocity.step_object_sync(
412 ob_handle.
object_key, ob_ref, ob_handle.
recalc, res_handle, modifier_data, particle_sys);
416 if (matpass.sub_pass ==
nullptr) {
419 if (particle_sys !=
nullptr) {
420 PassMain::Sub &sub_pass = matpass.sub_pass->sub(
"Hair SubPass");
422 sub_pass, inst_.scene, ob_ref, particle_sys, modifier_data, matpass.gpumat);
426 PassMain::Sub &sub_pass = matpass.sub_pass->sub(
"Curves SubPass");
436 inst_.volume.object_sync(ob_handle);
444 drawcall_add(material.
capture);
446 drawcall_add(material.
prepass);
447 drawcall_add(material.
shading);
448 drawcall_add(material.
shadow);
455 inst_.cryptomatte.sync_object(ob, res_handle);
458 inst_.cryptomatte.sync_material(mat);
461 inst_.manager->update_handle_bounds(res_handle, ob_ref, mat->
inflate_bounds);
464 inst_.manager->extract_object_attributes(res_handle, ob_ref, material.
shading.
gpumat);
466 inst_.shadows.sync_object(ob,
497 callback(particle_sys_handle, *md, *particle_sys);
bool BKE_sculptsession_use_pbvh_draw(const Object *ob, const RegionView3D *rv3d)
A BVH for high poly meshes.
#define LISTBASE_FOREACH(type, var, list)
BLI_INLINE bool BLI_listbase_is_empty(const ListBase *lb)
#define CURVES_MATERIAL_NR
@ eModifierType_ParticleSystem
#define POINTCLOUD_MATERIAL_NR
#define VOLUME_MATERIAL_NR
ListBase GPU_material_attributes(const GPUMaterial *material)
Material * GPU_material_get_material(GPUMaterial *material)
bool GPU_material_has_displacement_output(GPUMaterial *mat)
bool GPU_material_has_volume_output(GPUMaterial *mat)
IndexRange index_range() const
constexpr bool is_empty() const
void draw(gpu::Batch *batch, uint instance_len=-1, uint vertex_len=-1, uint vertex_first=-1, ResourceHandleRange handle={0}, uint custom_id=0)
detail::PassBase< command::DrawMultiBuf > Sub
ObjectHandle & sync_object(const ObjectRef &ob_ref)
void sync_mesh(Object *ob, ObjectHandle &ob_handle, const ObjectRef &ob_ref)
void sync_curves(Object *ob, ObjectHandle &ob_handle, const ObjectRef &ob_ref, ResourceHandle res_handle=0, ModifierData *modifier_data=nullptr, ParticleSystem *particle_sys=nullptr)
void sync_volume(Object *ob, ObjectHandle &ob_handle, const ObjectRef &ob_ref)
WorldHandle sync_world(const ::World &world)
bool sync_sculpt(Object *ob, ObjectHandle &ob_handle, const ObjectRef &ob_ref)
void sync_pointcloud(Object *ob, ObjectHandle &ob_handle, const ObjectRef &ob_ref)
bool DRW_object_is_visible_psys_in_active_context(const Object *object, const ParticleSystem *psys)
struct @064345207361167251075330302113175271221317160336::@113254110077376341056327177062323111323010325277 batch
pbvh::Tree * pbvh_get(Object &object)
Bounds< float3 > bounds_get(const Tree &pbvh)
PassMain::Sub * volume_sub_pass(PassMain::Sub &ps, Scene *scene, Object *ob, GPUMaterial *gpu_material)
gpu::Batch * curves_sub_pass_setup(PassMain::Sub &ps, const Scene *scene, Object *ob, GPUMaterial *gpu_material=nullptr)
gpu::Batch * pointcloud_sub_pass_setup(PassMain::Sub &sub_ps, Object *object, GPUMaterial *gpu_material=nullptr)
gpu::Batch * hair_sub_pass_setup(PassMain::Sub &sub_ps, const Scene *scene, const ObjectRef &ob_ref, ParticleSystem *psys, ModifierData *md, GPUMaterial *gpu_material=nullptr)
Vector< SculptBatch > sculpt_batches_per_material_get(const Object *ob, Span< const GPUMaterial * > materials)
Span< gpu::Batch * > DRW_cache_object_surface_material_get(Object *ob, const Span< const GPUMaterial * > materials)
static void geometry_call(PassMain::Sub *sub_pass, gpu::Batch *geom, ResourceHandle resource_handle)
FunctionRef< void(ObjectHandle, ModifierData &, ParticleSystem &)> HairHandleCallback
void foreach_hair_particle_handle(ObjectRef &ob_ref, ObjectHandle ob_handle, HairHandleCallback callback)
static void volume_call(MaterialPass &matpass, Scene *scene, Object *ob, gpu::Batch *geom, ResourceHandle res_handle)
T midpoint(const T &a, const T &b)
T max(const T &a, const T &b)
VecBase< float, 3 > float3
Vector< GPUMaterial * > gpu_materials
Vector< Material > materials
bool is_alpha_blend_transparent
MaterialPass overlap_masking
MaterialPass volume_material
MaterialPass planar_probe_prepass
bool has_transparent_shadows
MaterialPass planar_probe_shading
MaterialPass volume_occupancy
MaterialPass lightprobe_sphere_shading
MaterialPass lightprobe_sphere_prepass