summaryrefslogtreecommitdiffhomepage
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/draw.cpp12
-rw-r--r--main/main-impl.hpp1
2 files changed, 13 insertions, 0 deletions
diff --git a/main/draw.cpp b/main/draw.cpp
index 28bd1fdd..2c8ebc7b 100644
--- a/main/draw.cpp
+++ b/main/draw.cpp
@@ -1,8 +1,10 @@
+#include "Magnum/GL/Context.h"
#include "main-impl.hpp"
#include "floormat/app.hpp"
#include "src/camera-offset.hpp"
#include "src/anim-atlas.hpp"
#include "main/clickable.hpp"
+#include "world.hpp"
#include <Corrade/Containers/ArrayView.h>
#include <Magnum/GL/DefaultFramebuffer.h>
#include <Magnum/GL/Renderer.h>
@@ -35,6 +37,7 @@ void main_impl::recalc_viewport(Vector2i fb_size, Vector2i win_size) noexcept
// -- user--
app.on_viewport_event(fb_size);
+ update_collect_threshold();
}
global_coords main_impl::pixel_to_tile(Vector2d position) const noexcept
@@ -76,6 +79,15 @@ auto main_impl::get_draw_bounds() const noexcept -> draw_bounds
return {x0, x1, y0, y1};
}
+void main_impl::update_collect_threshold()
+{
+ const auto [minx, maxx, miny, maxy] = get_draw_bounds();
+ const auto value = std::max(64_uz, (std::size_t)(maxx-minx+4)*(std::size_t)(maxy-minx+4));
+ if (!(GL::Context::current().configurationFlags() & GL::Implementation::ContextConfigurationFlag::QuietLog))
+ fm_debug("collect threshold is now %zu", value);
+ _world.set_collect_threshold(value);
+}
+
void main_impl::draw_world() noexcept
{
const auto [minx, maxx, miny, maxy] = get_draw_bounds();
diff --git a/main/main-impl.hpp b/main/main-impl.hpp
index deb5d73e..997b4980 100644
--- a/main/main-impl.hpp
+++ b/main/main-impl.hpp
@@ -91,6 +91,7 @@ private:
void recalc_viewport(Vector2i fb_size, Vector2i win_size) noexcept;
void draw_world() noexcept;
+ void update_collect_threshold();
draw_bounds get_draw_bounds() const noexcept override;