Eevee-Next: World Reflective Light #108149

Merged
Jeroen Bakker merged 33 commits from Jeroen-Bakker/blender:eevee-next-world-shader into main 2023-06-29 15:25:04 +02:00
5 changed files with 1 additions and 70 deletions
Showing only changes of commit f8dd84911f - Show all commits

View File

@ -147,7 +147,6 @@ void Instance::begin_sync()
hiz_buffer.sync();
main_view.sync();
world.sync();
reflection_probes.sync();
film.sync();
render_buffers.sync();
irradiance_cache.sync();

View File

@ -27,44 +27,4 @@ void ReflectionProbeModule::init()
}
}
void ReflectionProbeModule::sync()
{
for (int index : IndexRange(max_probes)) {
ReflectionProbe &cubemap = cubemaps_[index];
if (!cubemap.needs_update()) {
continue;
}
sync(cubemap);
cubemap.is_dirty = false;
}
}
void ReflectionProbeModule::sync(const ReflectionProbe &cubemap)
{
if (cubemap.type == ReflectionProbe::Type::WORLD) {
GPUMaterial *world_material = instance_.world.get_world_material();
instance_.pipelines.world.sync(world_material);
}
else {
BLI_assert_unreachable();
}
}
void ReflectionProbeModule::set_world_dirty()
{
cubemaps_[world_slot].is_dirty = true;
}
/* -------------------------------------------------------------------- */
/** \name World
*
* \{ */
bool ReflectionProbe::needs_update() const
{
return type != Type::UNUSED && is_dirty;
}
/** \} */
} // namespace blender::eevee

View File

@ -73,9 +73,6 @@ class ReflectionProbeModule {
ReflectionProbeModule(Instance &instance) : instance_(instance) {}
void init();
void set_world_dirty();
void sync();
template<typename T> void bind_resources(draw::detail::PassBase<T> *pass)
{
@ -83,9 +80,6 @@ class ReflectionProbeModule {
}
private:
void sync(const ReflectionProbe &cubemap);
friend class WorldPipeline;
/* Capture View requires access to the cubemaps texture for framebuffer configuration. */
friend class CaptureView;
};

View File

@ -90,7 +90,6 @@ void World::sync()
WorldHandle &wo_handle = inst_.sync.sync_world(bl_world);
if (wo_handle.recalc != 0) {
inst_.reflection_probes.set_world_dirty();
inst_.capture_view.world_capture_enable(true);
}
wo_handle.reset_recalc_flag();
@ -110,21 +109,7 @@ void World::sync()
inst_.manager->register_layer_attributes(gpumat);
inst_.pipelines.background.sync(gpumat);
}
GPUMaterial *World::get_world_material()
{
::World *bl_world = inst_.scene->world;
if (bl_world == nullptr) {
bl_world = default_world_get();
}
bNodeTree *ntree = (bl_world->nodetree && bl_world->use_nodes) ?
bl_world->nodetree :
default_tree.nodetree_get(bl_world);
GPUMaterial *gpumat = inst_.shaders.world_shader_get(bl_world, ntree);
return gpumat;
inst_.pipelines.world.sync(gpumat);
}
/** \} */

View File

@ -62,13 +62,6 @@ class World {
~World();
void sync();
/**
* Get the world material.
*
* NOTE: this function should only be called after World::sync has been executed.
*/
GPUMaterial *get_world_material();
};
/** \} */