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);
77 if (object_pass !=
nullptr) {
78 object_pass->
draw(geom, res_handle);
91 if (!inst_.use_surfaces) {
102 bool has_motion = inst_.velocity.step_object_sync(
113 bool is_alpha_blend =
false;
114 bool has_transparent_shadows =
false;
115 bool has_volume =
false;
116 float inflate_bounds = 0.0f;
118 gpu::Batch *geom = mat_geom[
i];
119 if (geom ==
nullptr) {
152 inst_.cryptomatte.sync_material(mat);
160 inst_.volume.object_sync(ob_handle);
163 if (inflate_bounds != 0.0f) {
164 inst_.manager->update_handle_bounds(res_handle, ob_ref, inflate_bounds);
167 inst_.manager->extract_object_attributes(res_handle, ob_ref, material_array.
gpu_materials);
169 inst_.shadows.sync_object(ob, ob_handle, res_handle, is_alpha_blend, has_transparent_shadows);
170 inst_.cryptomatte.sync_object(ob, res_handle);
175 if (!inst_.use_surfaces) {
186 bool has_motion =
false;
189 bool is_alpha_blend =
false;
190 bool has_transparent_shadows =
false;
191 bool has_volume =
false;
192 float inflate_bounds = 0.0f;
196 gpu::Batch *geom =
batch.batch;
197 if (geom ==
nullptr) {
230 inst_.cryptomatte.sync_material(mat);
238 inst_.volume.object_sync(ob_handle);
241 inst_.manager->extract_object_attributes(res_handle, ob_ref, material_array.
gpu_materials);
243 inst_.shadows.sync_object(ob, ob_handle, res_handle, is_alpha_blend, has_transparent_shadows);
244 inst_.cryptomatte.sync_object(ob, res_handle);
261 bool has_motion = inst_.velocity.step_object_sync(
264 Material &material = inst_.materials.material_get(
267 auto drawcall_add = [&](
MaterialPass &matpass,
bool dual_sided =
false) {
291 inst_.volume.object_sync(ob_handle);
300 drawcall_add(material.
capture);
302 drawcall_add(material.
prepass);
303 drawcall_add(material.
shading);
304 drawcall_add(material.
shadow);
311 inst_.cryptomatte.sync_object(ob, res_handle);
314 inst_.cryptomatte.sync_material(mat);
317 inst_.manager->update_handle_bounds(res_handle, ob_ref, mat->
inflate_bounds);
320 inst_.manager->extract_object_attributes(res_handle, ob_ref, material.
shading.
gpumat);
322 inst_.shadows.sync_object(ob,
337 if (!inst_.use_volumes) {
346 const bool has_motion =
false;
348 Material &material = inst_.materials.material_get(
369 if (object_pass !=
nullptr) {
370 object_pass->
draw(geom, res_handle);
377 gpu::Batch *geom = inst_.volume.unit_cube_batch_get();
379 bool is_rendered =
false;
381 is_rendered |= drawcall_add(material.
volume_material, geom, res_handle);
389 inst_.volume.object_sync(ob_handle);
405 if (!inst_.use_curves) {
410 if (particle_sys !=
nullptr) {
416 res_handle = inst_.manager->unique_handle(ob_ref);
419 bool has_motion = inst_.velocity.step_object_sync(
420 ob_handle.
object_key, ob_ref, ob_handle.
recalc, res_handle, modifier_data, particle_sys);
424 if (matpass.sub_pass ==
nullptr) {
427 if (particle_sys !=
nullptr) {
428 PassMain::Sub &sub_pass = matpass.sub_pass->sub(
"Hair SubPass");
430 sub_pass, inst_.scene, ob_ref, particle_sys, modifier_data, matpass.gpumat);
434 PassMain::Sub &sub_pass = matpass.sub_pass->sub(
"Curves SubPass");
435 const char *
error =
nullptr;
437 sub_pass, inst_.scene, ob,
error, matpass.gpumat);
439 inst_.info_append(
error);
449 inst_.volume.object_sync(ob_handle);
457 drawcall_add(material.
capture);
459 drawcall_add(material.
prepass);
460 drawcall_add(material.
shading);
461 drawcall_add(material.
shadow);
468 inst_.cryptomatte.sync_object(ob, res_handle);
471 inst_.cryptomatte.sync_material(mat);
474 inst_.manager->update_handle_bounds(res_handle, ob_ref, mat->
inflate_bounds);
477 inst_.manager->extract_object_attributes(res_handle, ob_ref, material.
shading.
gpumat);
479 inst_.shadows.sync_object(ob,
513 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
PassBase< DrawCommandBufType > & sub(const char *name)
void draw(gpu::Batch *batch, uint instance_len=-1, uint vertex_len=-1, uint vertex_first=-1, ResourceIndexRange res_index={}, uint custom_id=0)
void push_constant(const char *name, const float &data)
detail::PassBase< command::DrawMultiBuf > Sub
A running instance of the engine.
ObjectHandle & sync_object(const ObjectRef &ob_ref)
void sync_mesh(Object *ob, ObjectHandle &ob_handle, const ObjectRef &ob_ref)
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_curves(Object *ob, ObjectHandle &ob_handle, const ObjectRef &ob_ref, ResourceHandleRange res_handle={}, ModifierData *modifier_data=nullptr, ParticleSystem *particle_sys=nullptr)
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 @021025263243242147216143265077100330027142264337::@225245033123204053237120173316075113304004012000 batch
static void error(const char *str)
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, const char *&r_error, 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 volume_call(MaterialPass &matpass, Scene *scene, Object *ob, gpu::Batch *geom, ResourceHandleRange res_handle)
static void geometry_call(PassMain::Sub *sub_pass, gpu::Batch *geom, ResourceHandleRange resource_handle)
void foreach_hair_particle_handle(Instance &inst, ObjectRef &ob_ref, ObjectHandle ob_handle, HairHandleCallback callback)
FunctionRef< void(ObjectHandle, ModifierData &, ParticleSystem &)> HairHandleCallback
T max(const T &a, const T &b)
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