41 ObjectHandle &handle = ob_handles.lookup_or_add_cb(key, [&]() {
47 handle.
recalc = inst_.get_recalc_flags(ob_ref);
69 if (sub_pass !=
nullptr) {
70 sub_pass->
draw(geom, resource_handle);
79 if (object_pass !=
nullptr) {
80 object_pass->
draw(geom, res_handle);
96 if (!inst_.use_surfaces) {
100 bool has_motion = inst_.velocity.step_object_sync(
108 if (mat_geom ==
nullptr) {
112 if ((ob->
dt <
OB_SOLID) && (inst_.is_viewport() && inst_.v3d->shading.type !=
OB_RENDER)) {
117 bool is_alpha_blend =
false;
118 bool has_transparent_shadows =
false;
119 bool has_volume =
false;
120 float inflate_bounds = 0.0f;
122 gpu::Batch *geom = mat_geom[i];
123 if (geom ==
nullptr) {
156 inst_.cryptomatte.sync_material(mat);
164 inst_.volume.object_sync(ob_handle);
167 if (inflate_bounds != 0.0f) {
168 inst_.manager->update_handle_bounds(res_handle, ob_ref, inflate_bounds);
171 inst_.manager->extract_object_attributes(res_handle, ob_ref, material_array.
gpu_materials);
173 inst_.shadows.sync_object(ob, ob_handle, res_handle, is_alpha_blend, has_transparent_shadows);
174 inst_.cryptomatte.sync_object(ob, res_handle);
182 if (!inst_.use_surfaces) {
191 bool has_motion =
false;
194 bool is_alpha_blend =
false;
195 bool has_transparent_shadows =
false;
196 bool has_volume =
false;
197 float inflate_bounds = 0.0f;
201 gpu::Batch *geom =
batch.batch;
202 if (geom ==
nullptr) {
235 inst_.cryptomatte.sync_material(mat);
243 inst_.volume.object_sync(ob_handle);
250 const float3 half_extent =
bounds.max - center + inflate_bounds;
251 inst_.manager->update_handle_bounds(res_handle, center, half_extent);
253 inst_.manager->extract_object_attributes(res_handle, ob_ref, material_array.
gpu_materials);
255 inst_.shadows.sync_object(ob, ob_handle, res_handle, is_alpha_blend, has_transparent_shadows);
256 inst_.cryptomatte.sync_object(ob, res_handle);
274 bool has_motion = inst_.velocity.step_object_sync(
277 Material &material = inst_.materials.material_get(
281 if (matpass.sub_pass ==
nullptr) {
284 PassMain::Sub &object_pass = matpass.sub_pass->sub(
"Point Cloud Sub Pass");
293 inst_.volume.object_sync(ob_handle);
302 drawcall_add(material.
capture);
304 drawcall_add(material.
prepass);
305 drawcall_add(material.
shading);
306 drawcall_add(material.
shadow);
313 inst_.cryptomatte.sync_object(ob, res_handle);
316 inst_.cryptomatte.sync_material(mat);
319 inst_.manager->update_handle_bounds(res_handle, ob_ref, mat->
inflate_bounds);
322 inst_.manager->extract_object_attributes(res_handle, ob_ref, material.
shading.
gpumat);
324 inst_.shadows.sync_object(ob,
342 if (!inst_.use_volumes) {
349 const bool has_motion =
false;
351 Material &material = inst_.materials.material_get(
371 if (object_pass !=
nullptr) {
372 object_pass->
draw(geom, res_handle);
381 bool is_rendered =
false;
383 is_rendered |= drawcall_add(material.
volume_material, geom, res_handle);
391 inst_.volume.object_sync(ob_handle);
407 if (!inst_.use_curves) {
412 if (particle_sys !=
nullptr) {
416 bool has_motion = inst_.velocity.step_object_sync(
417 ob, ob_handle.
object_key, res_handle, ob_handle.
recalc, modifier_data, particle_sys);
421 if (matpass.sub_pass ==
nullptr) {
424 if (particle_sys !=
nullptr) {
425 PassMain::Sub &sub_pass = matpass.sub_pass->sub(
"Hair SubPass");
427 sub_pass, inst_.scene, ob, particle_sys, modifier_data, matpass.gpumat);
431 PassMain::Sub &sub_pass = matpass.sub_pass->sub(
"Curves SubPass");
441 inst_.volume.object_sync(ob_handle);
449 drawcall_add(material.
capture);
451 drawcall_add(material.
prepass);
452 drawcall_add(material.
shading);
453 drawcall_add(material.
shadow);
460 inst_.cryptomatte.sync_object(ob, res_handle);
463 inst_.cryptomatte.sync_material(mat);
466 inst_.manager->update_handle_bounds(res_handle, ob_ref, mat->
inflate_bounds);
469 inst_.manager->extract_object_attributes(res_handle, ob_ref, material.
shading.
gpumat);
471 inst_.shadows.sync_object(ob,
500 callback(particle_sys_handle, *md, *particle_sys);
General operations, lookup, etc. for blender objects.
bool BKE_sculptsession_use_pbvh_draw(const Object *ob, const RegionView3D *rv3d)
A BVH for high poly meshes.
BLI_INLINE bool BLI_listbase_is_empty(const struct ListBase *lb)
#define LISTBASE_FOREACH(type, var, list)
#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)
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Gabor Generate Gabor noise Gradient Generate interpolated color and intensity values based on the input vector Magic Generate a psychedelic color texture Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between world
IndexRange index_range() const
void draw(gpu::Batch *batch, uint instance_len=-1, uint vertex_len=-1, uint vertex_first=-1, ResourceHandle handle={0}, uint custom_id=0)
detail::PassBase< command::DrawMultiBuf > Sub
void sync_point_cloud(Object *ob, ObjectHandle &ob_handle, ResourceHandle res_handle, const ObjectRef &ob_ref)
ObjectHandle & sync_object(const ObjectRef &ob_ref)
void sync_mesh(Object *ob, ObjectHandle &ob_handle, ResourceHandle res_handle, const ObjectRef &ob_ref)
void sync_volume(Object *ob, ObjectHandle &ob_handle, ResourceHandle res_handle, const ObjectRef &ob_ref)
void sync_curves(Object *ob, ObjectHandle &ob_handle, ResourceHandle res_handle, const ObjectRef &ob_ref, ModifierData *modifier_data=nullptr, ParticleSystem *particle_sys=nullptr)
WorldHandle sync_world(const ::World &world)
bool sync_sculpt(Object *ob, ObjectHandle &ob_handle, ResourceHandle res_handle, const ObjectRef &ob_ref)
blender::gpu::Batch ** DRW_cache_object_surface_material_get(Object *ob, GPUMaterial **gpumat_array, uint gpumat_array_len)
blender::gpu::Batch * DRW_cache_cube_get()
bool DRW_state_is_image_render()
bool DRW_object_is_visible_psys_in_active_context(const Object *object, const ParticleSystem *psys)
struct @157336070235062372277311340362362342103123126032::@262166344314164341202215145112231240022370055142 batch
pbvh::Tree * pbvh_get(Object &object)
Bounds< float3 > bounds_get(const Tree &pbvh)
gpu::Batch * point_cloud_sub_pass_setup(PassMain::Sub &sub_ps, Object *object, GPUMaterial *gpu_material=nullptr)
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 * hair_sub_pass_setup(PassMain::Sub &sub_ps, const Scene *scene, Object *object, ParticleSystem *psys, ModifierData *md, GPUMaterial *gpu_material=nullptr)
Vector< SculptBatch > sculpt_batches_per_material_get(const Object *ob, 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(Object *ob, 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