diff options
author | Aaron Record <aaronjrecord@gmail.com> | 2022-05-18 17:43:40 -0600 |
---|---|---|
committer | Aaron Record <aaronjrecord@gmail.com> | 2022-05-19 12:09:16 +0200 |
commit | 900c676b0282bed83d00834e3c280ac89c2bc94d (patch) | |
tree | b6bf869a55440a666f4bcc17d5e9cd93ff26dbdc /servers/rendering/renderer_viewport.cpp | |
parent | 71c40ff4da85a4770958533cdc65f2c9f7ddeaff (diff) |
Use range iterators for RBSet in most cases
Diffstat (limited to 'servers/rendering/renderer_viewport.cpp')
-rw-r--r-- | servers/rendering/renderer_viewport.cpp | 46 |
1 files changed, 23 insertions, 23 deletions
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; } } } |