Cleanup: EEVEE-Next: Split display sync function
This commit is contained in:
@@ -254,27 +254,36 @@ void SphereProbeModule::set_view(View & /*view*/)
|
||||
}
|
||||
data_buf_.push_update();
|
||||
|
||||
do_display_draw_ = DRW_state_draw_support() && probe_active.size() > 0;
|
||||
if (do_display_draw_) {
|
||||
int display_index = 0;
|
||||
for (int i : probe_active.index_range()) {
|
||||
if (probe_active[i]->viewport_display) {
|
||||
display_data_buf_.get_or_resize(display_index++) = {
|
||||
i, probe_active[i]->viewport_display_size};
|
||||
}
|
||||
}
|
||||
do_display_draw_ = display_index > 0;
|
||||
if (do_display_draw_) {
|
||||
display_data_buf_.resize(display_index);
|
||||
display_data_buf_.push_update();
|
||||
}
|
||||
}
|
||||
|
||||
/* Add one for world probe. */
|
||||
reflection_probe_count_ = probe_active.size() + 1;
|
||||
reflection_probe_count_ = probe_id;
|
||||
dispatch_probe_select_.x = divide_ceil_u(reflection_probe_count_,
|
||||
SPHERE_PROBE_SELECT_GROUP_SIZE);
|
||||
instance_.manager->submit(select_ps_);
|
||||
|
||||
sync_display(probe_active);
|
||||
}
|
||||
|
||||
void SphereProbeModule::sync_display(Vector<SphereProbe *> &probe_active)
|
||||
{
|
||||
do_display_draw_ = false;
|
||||
if (!DRW_state_draw_support()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int display_index = 0;
|
||||
for (int i : probe_active.index_range()) {
|
||||
if (probe_active[i]->viewport_display) {
|
||||
SphereProbeDisplayData &sph_data = display_data_buf_.get_or_resize(display_index++);
|
||||
sph_data.probe_index = i;
|
||||
sph_data.display_size = probe_active[i]->viewport_display_size;
|
||||
}
|
||||
}
|
||||
|
||||
if (display_index == 0) {
|
||||
return;
|
||||
}
|
||||
do_display_draw_ = true;
|
||||
display_data_buf_.resize(display_index);
|
||||
display_data_buf_.push_update();
|
||||
}
|
||||
|
||||
void SphereProbeModule::viewport_draw(View &view, GPUFrameBuffer *view_fb)
|
||||
|
||||
@@ -169,6 +169,8 @@ class SphereProbeModule {
|
||||
void remap_to_octahedral_projection(const SphereProbeAtlasCoord &atlas_coord);
|
||||
void update_probes_texture_mipmaps();
|
||||
void update_world_irradiance();
|
||||
|
||||
void sync_display(Vector<SphereProbe *> &probe_active);
|
||||
};
|
||||
|
||||
/** \} */
|
||||
|
||||
Reference in New Issue
Block a user