diff options
Diffstat (limited to 'servers/rendering')
-rw-r--r-- | servers/rendering/renderer_canvas_cull.cpp | 16 | ||||
-rw-r--r-- | servers/rendering/renderer_rd/renderer_scene_render_rd.cpp | 4 | ||||
-rw-r--r-- | servers/rendering/renderer_rd/storage_rd/material_storage.cpp | 24 | ||||
-rw-r--r-- | servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp | 12 | ||||
-rw-r--r-- | servers/rendering/renderer_rd/storage_rd/particles_storage.cpp | 4 | ||||
-rw-r--r-- | servers/rendering/renderer_scene_cull.cpp | 68 | ||||
-rw-r--r-- | servers/rendering/renderer_storage.h | 8 | ||||
-rw-r--r-- | servers/rendering/renderer_viewport.cpp | 46 | ||||
-rw-r--r-- | servers/rendering/shader_compiler.cpp | 4 | ||||
-rw-r--r-- | servers/rendering/shader_language.cpp | 20 |
10 files changed, 103 insertions, 103 deletions
diff --git a/servers/rendering/renderer_canvas_cull.cpp b/servers/rendering/renderer_canvas_cull.cpp index 46bc22ad54..9291a89333 100644 --- a/servers/rendering/renderer_canvas_cull.cpp +++ b/servers/rendering/renderer_canvas_cull.cpp @@ -1831,8 +1831,8 @@ void RendererCanvasCull::canvas_occluder_polygon_set_shape(RID p_occluder_polygo RSG::canvas_render->occluder_polygon_set_shape(occluder_poly->occluder, p_shape, p_closed); - for (RBSet<RendererCanvasRender::LightOccluderInstance *>::Element *E = occluder_poly->owners.front(); E; E = E->next()) { - E->get()->aabb_cache = occluder_poly->aabb; + for (RendererCanvasRender::LightOccluderInstance *E : occluder_poly->owners) { + E->aabb_cache = occluder_poly->aabb; } } @@ -1841,8 +1841,8 @@ void RendererCanvasCull::canvas_occluder_polygon_set_cull_mode(RID p_occluder_po ERR_FAIL_COND(!occluder_poly); occluder_poly->cull_mode = p_mode; RSG::canvas_render->occluder_polygon_set_cull_mode(occluder_poly->occluder, p_mode); - for (RBSet<RendererCanvasRender::LightOccluderInstance *>::Element *E = occluder_poly->owners.front(); E; E = E->next()) { - E->get()->cull_cache = p_mode; + for (RendererCanvasRender::LightOccluderInstance *E : occluder_poly->owners) { + E->cull_cache = p_mode; } } @@ -1942,12 +1942,12 @@ bool RendererCanvasCull::free(RID p_rid) { canvas->child_items[i].item->parent = RID(); } - for (RBSet<RendererCanvasRender::Light *>::Element *E = canvas->lights.front(); E; E = E->next()) { - E->get()->canvas = RID(); + for (RendererCanvasRender::Light *E : canvas->lights) { + E->canvas = RID(); } - for (RBSet<RendererCanvasRender::LightOccluderInstance *>::Element *E = canvas->occluders.front(); E; E = E->next()) { - E->get()->canvas = RID(); + for (RendererCanvasRender::LightOccluderInstance *E : canvas->occluders) { + E->canvas = RID(); } canvas_owner.free(p_rid); diff --git a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp index e3bf2e3dda..3f3b087edb 100644 --- a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp +++ b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp @@ -5464,8 +5464,8 @@ bool RendererSceneRenderRD::free(RID p_rid) { LightInstance *light_instance = light_instance_owner.get_or_null(p_rid); //remove from shadow atlases.. - for (RBSet<RID>::Element *E = light_instance->shadow_atlases.front(); E; E = E->next()) { - ShadowAtlas *shadow_atlas = shadow_atlas_owner.get_or_null(E->get()); + for (const RID &E : light_instance->shadow_atlases) { + ShadowAtlas *shadow_atlas = shadow_atlas_owner.get_or_null(E); ERR_CONTINUE(!shadow_atlas->shadow_owners.has(p_rid)); uint32_t key = shadow_atlas->shadow_owners[p_rid]; uint32_t q = (key >> ShadowAtlas::QUADRANT_SHIFT) & 0x3; diff --git a/servers/rendering/renderer_rd/storage_rd/material_storage.cpp b/servers/rendering/renderer_rd/storage_rd/material_storage.cpp index 27f0c5f273..93f1f4e0d9 100644 --- a/servers/rendering/renderer_rd/storage_rd/material_storage.cpp +++ b/servers/rendering/renderer_rd/storage_rd/material_storage.cpp @@ -1979,8 +1979,8 @@ void MaterialStorage::global_variable_set(const StringName &p_name, const Varian } else { //texture MaterialStorage *material_storage = MaterialStorage::get_singleton(); - for (RBSet<RID>::Element *E = gv.texture_materials.front(); E; E = E->next()) { - Material *material = material_storage->get_material(E->get()); + for (const RID &E : gv.texture_materials) { + Material *material = material_storage->get_material(E); ERR_CONTINUE(!material); material_storage->_material_queue_update(material, false, true); } @@ -2011,8 +2011,8 @@ void MaterialStorage::global_variable_set_override(const StringName &p_name, con } else { //texture MaterialStorage *material_storage = MaterialStorage::get_singleton(); - for (RBSet<RID>::Element *E = gv.texture_materials.front(); E; E = E->next()) { - Material *material = material_storage->get_material(E->get()); + for (const RID &E : gv.texture_materials) { + Material *material = material_storage->get_material(E); ERR_CONTINUE(!material); material_storage->_material_queue_update(material, false, true); } @@ -2305,8 +2305,8 @@ void MaterialStorage::shader_set_code(RID p_shader, const String &p_code) { shader->data = nullptr; } - for (RBSet<Material *>::Element *E = shader->owners.front(); E; E = E->next()) { - Material *material = E->get(); + for (Material *E : shader->owners) { + Material *material = E; material->shader_type = new_type; if (material->data) { memdelete(material->data); @@ -2322,8 +2322,8 @@ void MaterialStorage::shader_set_code(RID p_shader, const String &p_code) { shader->type = SHADER_TYPE_MAX; //invalid } - for (RBSet<Material *>::Element *E = shader->owners.front(); E; E = E->next()) { - Material *material = E->get(); + for (Material *E : shader->owners) { + Material *material = E; if (shader->data) { material->data = material_get_data_request_function(new_type)(shader->data); material->data->self = material->self; @@ -2346,8 +2346,8 @@ void MaterialStorage::shader_set_code(RID p_shader, const String &p_code) { shader->data->set_code(p_code); } - for (RBSet<Material *>::Element *E = shader->owners.front(); E; E = E->next()) { - Material *material = E->get(); + for (Material *E : shader->owners) { + Material *material = E; material->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MATERIAL); _material_queue_update(material, true, true); } @@ -2388,8 +2388,8 @@ void MaterialStorage::shader_set_default_texture_param(RID p_shader, const Strin if (shader->data) { shader->data->set_default_texture_param(p_name, p_texture, p_index); } - for (RBSet<Material *>::Element *E = shader->owners.front(); E; E = E->next()) { - Material *material = E->get(); + for (Material *E : shader->owners) { + Material *material = E; _material_queue_update(material, false, true); } } diff --git a/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp b/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp index fa051c92ed..1e0d67f269 100644 --- a/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp +++ b/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp @@ -215,8 +215,8 @@ void MeshStorage::mesh_free(RID p_rid) { ERR_PRINT("deleting mesh with active instances"); } if (mesh->shadow_owners.size()) { - for (RBSet<Mesh *>::Element *E = mesh->shadow_owners.front(); E; E = E->next()) { - Mesh *shadow_owner = E->get(); + for (Mesh *E : mesh->shadow_owners) { + Mesh *shadow_owner = E; shadow_owner->shadow_mesh = RID(); shadow_owner->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MESH); } @@ -431,8 +431,8 @@ void MeshStorage::mesh_add_surface(RID p_mesh, const RS::SurfaceData &p_surface) mesh->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MESH); - for (RBSet<Mesh *>::Element *E = mesh->shadow_owners.front(); E; E = E->next()) { - Mesh *shadow_owner = E->get(); + for (Mesh *E : mesh->shadow_owners) { + Mesh *shadow_owner = E; shadow_owner->shadow_mesh = RID(); shadow_owner->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MESH); } @@ -742,8 +742,8 @@ void MeshStorage::mesh_clear(RID p_mesh) { mesh->has_bone_weights = false; mesh->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MESH); - for (RBSet<Mesh *>::Element *E = mesh->shadow_owners.front(); E; E = E->next()) { - Mesh *shadow_owner = E->get(); + for (Mesh *E : mesh->shadow_owners) { + Mesh *shadow_owner = E; shadow_owner->shadow_mesh = RID(); shadow_owner->dependency.changed_notify(RendererStorage::DEPENDENCY_CHANGED_MESH); } diff --git a/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp b/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp index 1701b56b0b..e15d3e13a9 100644 --- a/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp +++ b/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp @@ -838,8 +838,8 @@ void ParticlesStorage::_particles_process(Particles *p_particles, double p_delta } uint32_t collision_3d_textures_used = 0; - for (const RBSet<RID>::Element *E = p_particles->collisions.front(); E; E = E->next()) { - ParticlesCollisionInstance *pci = particles_collision_instance_owner.get_or_null(E->get()); + for (const RID &E : p_particles->collisions) { + ParticlesCollisionInstance *pci = particles_collision_instance_owner.get_or_null(E); if (!pci || !pci->active) { continue; } 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; } diff --git a/servers/rendering/renderer_storage.h b/servers/rendering/renderer_storage.h index 7f35d2ca99..672fd4e4f1 100644 --- a/servers/rendering/renderer_storage.h +++ b/servers/rendering/renderer_storage.h @@ -85,8 +85,8 @@ public: void update_end() { //call after updating dependencies List<Pair<Dependency *, DependencyTracker *>> to_clean_up; - for (RBSet<Dependency *>::Element *E = dependencies.front(); E; E = E->next()) { - Dependency *dep = E->get(); + for (Dependency *E : dependencies) { + Dependency *dep = E; HashMap<DependencyTracker *, uint32_t>::Iterator F = dep->instances.find(this); ERR_CONTINUE(!F); if (F->value != instance_version) { @@ -105,8 +105,8 @@ public: } void clear() { // clear all dependencies - for (RBSet<Dependency *>::Element *E = dependencies.front(); E; E = E->next()) { - Dependency *dep = E->get(); + for (Dependency *E : dependencies) { + Dependency *dep = E; dep->instances.erase(this); } dependencies.clear(); diff --git a/servers/rendering/renderer_viewport.cpp b/servers/rendering/renderer_viewport.cpp index d612fb4aa7..7c2d7a1e1d 100644 --- a/servers/rendering/renderer_viewport.cpp +++ b/servers/rendering/renderer_viewport.cpp @@ -247,15 +247,15 @@ void RendererViewport::_draw_viewport(Viewport *p_viewport) { RendererCanvasCull::Canvas *canvas = static_cast<RendererCanvasCull::Canvas *>(E.value.canvas); Transform2D xf = _canvas_get_transform(p_viewport, canvas, &E.value, clip_rect.size); - for (RBSet<RendererCanvasRender::LightOccluderInstance *>::Element *F = canvas->occluders.front(); F; F = F->next()) { - if (!F->get()->enabled) { + for (RendererCanvasRender::LightOccluderInstance *F : canvas->occluders) { + if (!F->enabled) { continue; } - F->get()->xform_cache = xf * F->get()->xform; + F->xform_cache = xf * F->xform; - if (sdf_rect.intersects_transformed(F->get()->xform_cache, F->get()->aabb_cache)) { - F->get()->next = occluders; - occluders = F->get(); + if (sdf_rect.intersects_transformed(F->xform_cache, F->aabb_cache)) { + F->next = occluders; + occluders = F; } } } @@ -281,8 +281,8 @@ void RendererViewport::_draw_viewport(Viewport *p_viewport) { // Find lights in canvas. - for (RBSet<RendererCanvasRender::Light *>::Element *F = canvas->lights.front(); F; F = F->next()) { - RendererCanvasRender::Light *cl = F->get(); + for (RendererCanvasRender::Light *F : canvas->lights) { + RendererCanvasRender::Light *cl = F; if (cl->enabled && cl->texture.is_valid()) { //not super efficient.. Size2 tsize = RSG::texture_storage->texture_size_with_proxy(cl->texture); @@ -313,8 +313,8 @@ void RendererViewport::_draw_viewport(Viewport *p_viewport) { } } - for (RBSet<RendererCanvasRender::Light *>::Element *F = canvas->directional_lights.front(); F; F = F->next()) { - RendererCanvasRender::Light *cl = F->get(); + for (RendererCanvasRender::Light *F : canvas->directional_lights) { + RendererCanvasRender::Light *cl = F; if (cl->enabled) { cl->filter_next_ptr = directional_lights; directional_lights = cl; @@ -349,14 +349,14 @@ void RendererViewport::_draw_viewport(Viewport *p_viewport) { RendererCanvasCull::Canvas *canvas = static_cast<RendererCanvasCull::Canvas *>(E.value.canvas); Transform2D xf = _canvas_get_transform(p_viewport, canvas, &E.value, clip_rect.size); - for (RBSet<RendererCanvasRender::LightOccluderInstance *>::Element *F = canvas->occluders.front(); F; F = F->next()) { - if (!F->get()->enabled) { + for (RendererCanvasRender::LightOccluderInstance *F : canvas->occluders) { + if (!F->enabled) { continue; } - F->get()->xform_cache = xf * F->get()->xform; - if (shadow_rect.intersects_transformed(F->get()->xform_cache, F->get()->aabb_cache)) { - F->get()->next = occluders; - occluders = F->get(); + F->xform_cache = xf * F->xform; + if (shadow_rect.intersects_transformed(F->xform_cache, F->aabb_cache)) { + F->next = occluders; + occluders = F; } } } @@ -429,19 +429,19 @@ void RendererViewport::_draw_viewport(Viewport *p_viewport) { RendererCanvasCull::Canvas *canvas = static_cast<RendererCanvasCull::Canvas *>(E.value.canvas); Transform2D xf = _canvas_get_transform(p_viewport, canvas, &E.value, clip_rect.size); - for (RBSet<RendererCanvasRender::LightOccluderInstance *>::Element *F = canvas->occluders.front(); F; F = F->next()) { - if (!F->get()->enabled) { + for (RendererCanvasRender::LightOccluderInstance *F : canvas->occluders) { + if (!F->enabled) { continue; } - F->get()->xform_cache = xf * F->get()->xform; - Transform2D localizer = F->get()->xform_cache.affine_inverse(); + F->xform_cache = xf * F->xform; + Transform2D localizer = F->xform_cache.affine_inverse(); for (int j = 0; j < point_count; j++) { xf_points[j] = localizer.xform(points[j]); } - if (F->get()->aabb_cache.intersects_filled_polygon(xf_points, point_count)) { - F->get()->next = occluders; - occluders = F->get(); + if (F->aabb_cache.intersects_filled_polygon(xf_points, point_count)) { + F->next = occluders; + occluders = F; } } } diff --git a/servers/rendering/shader_compiler.cpp b/servers/rendering/shader_compiler.cpp index c88d9e8222..662016e6f4 100644 --- a/servers/rendering/shader_compiler.cpp +++ b/servers/rendering/shader_compiler.cpp @@ -303,8 +303,8 @@ void ShaderCompiler::_dump_function_deps(const SL::ShaderNode *p_node, const Str Vector<StringName> uses_functions; - for (RBSet<StringName>::Element *E = p_node->functions[fidx].uses_function.front(); E; E = E->next()) { - uses_functions.push_back(E->get()); + for (const StringName &E : p_node->functions[fidx].uses_function) { + uses_functions.push_back(E); } uses_functions.sort_custom<StringName::AlphCompare>(); //ensure order is deterministic so the same shader is always produced diff --git a/servers/rendering/shader_language.cpp b/servers/rendering/shader_language.cpp index 8a3ab92714..d2e188a9a7 100644 --- a/servers/rendering/shader_language.cpp +++ b/servers/rendering/shader_language.cpp @@ -4036,8 +4036,8 @@ void ShaderLanguage::get_keyword_list(List<String> *r_keywords) { idx++; } - for (RBSet<String>::Element *E = kws.front(); E; E = E->next()) { - r_keywords->push_back(E->get()); + for (const String &E : kws) { + r_keywords->push_back(E); } } @@ -4066,8 +4066,8 @@ void ShaderLanguage::get_builtin_funcs(List<String> *r_keywords) { idx++; } - for (RBSet<String>::Element *E = kws.front(); E; E = E->next()) { - r_keywords->push_back(E->get()); + for (const String &E : kws) { + r_keywords->push_back(E); } } @@ -4341,8 +4341,8 @@ bool ShaderLanguage::_propagate_function_call_sampler_uniform_settings(StringNam arg->tex_argument_filter = p_filter; arg->tex_argument_repeat = p_repeat; for (KeyValue<StringName, RBSet<int>> &E : arg->tex_argument_connect) { - for (RBSet<int>::Element *F = E.value.front(); F; F = F->next()) { - if (!_propagate_function_call_sampler_uniform_settings(E.key, F->get(), p_filter, p_repeat)) { + for (const int &F : E.value) { + if (!_propagate_function_call_sampler_uniform_settings(E.key, F, p_filter, p_repeat)) { return false; } } @@ -4375,8 +4375,8 @@ bool ShaderLanguage::_propagate_function_call_sampler_builtin_reference(StringNa arg->tex_builtin = p_builtin; for (KeyValue<StringName, RBSet<int>> &E : arg->tex_argument_connect) { - for (RBSet<int>::Element *F = E.value.front(); F; F = F->next()) { - if (!_propagate_function_call_sampler_builtin_reference(E.key, F->get(), p_builtin)) { + for (const int &F : E.value) { + if (!_propagate_function_call_sampler_builtin_reference(E.key, F, p_builtin)) { return false; } } @@ -7568,12 +7568,12 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const FunctionInfo &p_fun String ShaderLanguage::_get_shader_type_list(const RBSet<String> &p_shader_types) const { // Return a list of shader types as an human-readable string String valid_types; - for (const RBSet<String>::Element *E = p_shader_types.front(); E; E = E->next()) { + for (const String &E : p_shader_types) { if (!valid_types.is_empty()) { valid_types += ", "; } - valid_types += "'" + E->get() + "'"; + valid_types += "'" + E + "'"; } return valid_types; |