summaryrefslogtreecommitdiff
path: root/servers/rendering/renderer_scene_cull.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'servers/rendering/renderer_scene_cull.cpp')
-rw-r--r--servers/rendering/renderer_scene_cull.cpp68
1 files changed, 34 insertions, 34 deletions
diff --git a/servers/rendering/renderer_scene_cull.cpp b/servers/rendering/renderer_scene_cull.cpp
index 37bbab86ff..89bd12ea3d 100644
--- a/servers/rendering/renderer_scene_cull.cpp
+++ b/servers/rendering/renderer_scene_cull.cpp
@@ -653,8 +653,8 @@ void RendererSceneCull::instance_set_base(RID p_instance, RID p_base) {
scene_render->geometry_instance_set_lightmap_capture(geom->geometry_instance, instance->lightmap_sh.ptr());
}
- for (RBSet<Instance *>::Element *E = instance->visibility_dependencies.front(); E; E = E->next()) {
- Instance *dep_instance = E->get();
+ for (Instance *E : instance->visibility_dependencies) {
+ Instance *dep_instance = E;
ERR_CONTINUE(dep_instance->array_index == -1);
ERR_CONTINUE(dep_instance->scenario->instance_data[dep_instance->array_index].parent_array_index != -1);
dep_instance->scenario->instance_data[dep_instance->array_index].parent_array_index = instance->array_index;
@@ -1299,8 +1299,8 @@ bool RendererSceneCull::_update_instance_visibility_depth(Instance *p_instance)
while (instance) {
if (!instance->visibility_dependencies.is_empty()) {
uint32_t depth = 0;
- for (RBSet<Instance *>::Element *E = instance->visibility_dependencies.front(); E; E = E->next()) {
- depth = MAX(depth, E->get()->visibility_dependencies_depth);
+ for (const Instance *E : instance->visibility_dependencies) {
+ depth = MAX(depth, E->visibility_dependencies_depth);
}
instance->visibility_dependencies_depth = depth + 1;
} else {
@@ -1559,8 +1559,8 @@ void RendererSceneCull::_update_instance(Instance *p_instance) {
InstanceLightmapData *lightmap_data = static_cast<InstanceLightmapData *>(p_instance->base_data);
//erase dependencies, since no longer a lightmap
- for (RBSet<Instance *>::Element *E = lightmap_data->geometries.front(); E; E = E->next()) {
- Instance *geom = E->get();
+ for (Instance *E : lightmap_data->geometries) {
+ Instance *geom = E;
_instance_queue_update(geom, true, false);
}
}
@@ -1574,8 +1574,8 @@ void RendererSceneCull::_update_instance(Instance *p_instance) {
//make sure lights are updated if it casts shadow
if (geom->can_cast_shadows) {
- for (RBSet<Instance *>::Element *E = geom->lights.front(); E; E = E->next()) {
- InstanceLightData *light = static_cast<InstanceLightData *>(E->get()->base_data);
+ for (const Instance *E : geom->lights) {
+ InstanceLightData *light = static_cast<InstanceLightData *>(E->base_data);
light->shadow_dirty = true;
}
}
@@ -1632,8 +1632,8 @@ void RendererSceneCull::_update_instance(Instance *p_instance) {
idata.parent_array_index = p_instance->visibility_parent ? p_instance->visibility_parent->array_index : -1;
idata.visibility_index = p_instance->visibility_index;
- for (RBSet<Instance *>::Element *E = p_instance->visibility_dependencies.front(); E; E = E->next()) {
- Instance *dep_instance = E->get();
+ for (Instance *E : p_instance->visibility_dependencies) {
+ Instance *dep_instance = E;
if (dep_instance->array_index != -1) {
dep_instance->scenario->instance_data[dep_instance->array_index].parent_array_index = p_instance->array_index;
}
@@ -1800,8 +1800,8 @@ void RendererSceneCull::_unpair_instance(Instance *p_instance) {
swapped_instance->scenario->instance_visibility[swapped_instance->visibility_index].array_index = swapped_instance->array_index;
}
- for (RBSet<Instance *>::Element *E = swapped_instance->visibility_dependencies.front(); E; E = E->next()) {
- Instance *dep_instance = E->get();
+ for (Instance *E : swapped_instance->visibility_dependencies) {
+ Instance *dep_instance = E;
if (dep_instance != p_instance && dep_instance->array_index != -1) {
dep_instance->scenario->instance_data[dep_instance->array_index].parent_array_index = swapped_instance->array_index;
}
@@ -1824,8 +1824,8 @@ void RendererSceneCull::_unpair_instance(Instance *p_instance) {
scene_render->geometry_instance_pair_voxel_gi_instances(geom->geometry_instance, nullptr, 0);
}
- for (RBSet<Instance *>::Element *E = p_instance->visibility_dependencies.front(); E; E = E->next()) {
- Instance *dep_instance = E->get();
+ for (Instance *E : p_instance->visibility_dependencies) {
+ Instance *dep_instance = E;
if (dep_instance->array_index != -1) {
dep_instance->scenario->instance_data[dep_instance->array_index].parent_array_index = -1;
if ((1 << dep_instance->base_type) & RS::INSTANCE_GEOMETRY_MASK) {
@@ -1923,8 +1923,8 @@ void RendererSceneCull::_update_instance_lightmap_captures(Instance *p_instance)
float accum_blend = 0.0;
InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(p_instance->base_data);
- for (RBSet<Instance *>::Element *E = geom->lightmap_captures.front(); E; E = E->next()) {
- Instance *lightmap = E->get();
+ for (Instance *E : geom->lightmap_captures) {
+ Instance *lightmap = E;
bool interior = RSG::light_storage->lightmap_is_interior(lightmap->base);
@@ -2744,8 +2744,8 @@ void RendererSceneCull::_scene_cull(CullData &cull_data, InstanceCullResult &cul
InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(idata.instance->base_data);
uint32_t idx = 0;
- for (RBSet<Instance *>::Element *E = geom->lights.front(); E; E = E->next()) {
- InstanceLightData *light = static_cast<InstanceLightData *>(E->get()->base_data);
+ for (const Instance *E : geom->lights) {
+ InstanceLightData *light = static_cast<InstanceLightData *>(E->base_data);
instance_pair_buffer[idx++] = light->instance;
if (idx == MAX_INSTANCE_PAIRS) {
break;
@@ -2767,8 +2767,8 @@ void RendererSceneCull::_scene_cull(CullData &cull_data, InstanceCullResult &cul
InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(idata.instance->base_data);
uint32_t idx = 0;
- for (RBSet<Instance *>::Element *E = geom->reflection_probes.front(); E; E = E->next()) {
- InstanceReflectionProbeData *reflection_probe = static_cast<InstanceReflectionProbeData *>(E->get()->base_data);
+ for (const Instance *E : geom->reflection_probes) {
+ InstanceReflectionProbeData *reflection_probe = static_cast<InstanceReflectionProbeData *>(E->base_data);
instance_pair_buffer[idx++] = reflection_probe->instance;
if (idx == MAX_INSTANCE_PAIRS) {
@@ -2784,8 +2784,8 @@ void RendererSceneCull::_scene_cull(CullData &cull_data, InstanceCullResult &cul
InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(idata.instance->base_data);
uint32_t idx = 0;
- for (RBSet<Instance *>::Element *E = geom->decals.front(); E; E = E->next()) {
- InstanceDecalData *decal = static_cast<InstanceDecalData *>(E->get()->base_data);
+ for (const Instance *E : geom->decals) {
+ InstanceDecalData *decal = static_cast<InstanceDecalData *>(E->base_data);
instance_pair_buffer[idx++] = decal->instance;
if (idx == MAX_INSTANCE_PAIRS) {
@@ -2799,8 +2799,8 @@ void RendererSceneCull::_scene_cull(CullData &cull_data, InstanceCullResult &cul
if (idata.flags & InstanceData::FLAG_GEOM_VOXEL_GI_DIRTY) {
InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(idata.instance->base_data);
uint32_t idx = 0;
- for (RBSet<Instance *>::Element *E = geom->voxel_gi_instances.front(); E; E = E->next()) {
- InstanceVoxelGIData *voxel_gi = static_cast<InstanceVoxelGIData *>(E->get()->base_data);
+ for (const Instance *E : geom->voxel_gi_instances) {
+ InstanceVoxelGIData *voxel_gi = static_cast<InstanceVoxelGIData *>(E->base_data);
instance_pair_buffer[idx++] = voxel_gi->probe_instance;
if (idx == MAX_INSTANCE_PAIRS) {
@@ -3420,8 +3420,8 @@ void RendererSceneCull::render_probes() {
const RID *instance_caches = probe->light_instances.ptr();
int idx = 0; //must count visible lights
- for (RBSet<Instance *>::Element *E = probe->lights.front(); E; E = E->next()) {
- Instance *instance = E->get();
+ for (Instance *E : probe->lights) {
+ Instance *instance = E;
InstanceLightData *instance_light = (InstanceLightData *)instance->base_data;
if (!instance->visible) {
continue;
@@ -3502,8 +3502,8 @@ void RendererSceneCull::render_probes() {
RID *instance_caches = probe->light_instances.ptrw();
int idx = 0; //must count visible lights
- for (RBSet<Instance *>::Element *E = probe->lights.front(); E; E = E->next()) {
- Instance *instance = E->get();
+ for (Instance *E : probe->lights) {
+ Instance *instance = E;
InstanceLightData *instance_light = (InstanceLightData *)instance->base_data;
if (!instance->visible) {
continue;
@@ -3557,8 +3557,8 @@ void RendererSceneCull::render_probes() {
RID instance_pair_buffer[MAX_INSTANCE_PAIRS];
- for (RBSet<Instance *>::Element *E = probe->dynamic_geometries.front(); E; E = E->next()) {
- Instance *ins = E->get();
+ for (Instance *E : probe->dynamic_geometries) {
+ Instance *ins = E;
if (!ins->visible) {
continue;
}
@@ -3566,8 +3566,8 @@ void RendererSceneCull::render_probes() {
if (ins->scenario && ins->array_index >= 0 && (ins->scenario->instance_data[ins->array_index].flags & InstanceData::FLAG_GEOM_VOXEL_GI_DIRTY)) {
uint32_t idx = 0;
- for (RBSet<Instance *>::Element *F = geom->voxel_gi_instances.front(); F; F = F->next()) {
- InstanceVoxelGIData *voxel_gi2 = static_cast<InstanceVoxelGIData *>(F->get()->base_data);
+ for (const Instance *F : geom->voxel_gi_instances) {
+ InstanceVoxelGIData *voxel_gi2 = static_cast<InstanceVoxelGIData *>(F->base_data);
instance_pair_buffer[idx++] = voxel_gi2->probe_instance;
if (idx == MAX_INSTANCE_PAIRS) {
@@ -3823,8 +3823,8 @@ void RendererSceneCull::_update_dirty_instance(Instance *p_instance) {
if (can_cast_shadows != geom->can_cast_shadows) {
//ability to cast shadows change, let lights now
- for (RBSet<Instance *>::Element *E = geom->lights.front(); E; E = E->next()) {
- InstanceLightData *light = static_cast<InstanceLightData *>(E->get()->base_data);
+ for (const Instance *E : geom->lights) {
+ InstanceLightData *light = static_cast<InstanceLightData *>(E->base_data);
light->shadow_dirty = true;
}