From aae112ae02b415483ac03c59629dc9290bd833cf Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 12 Sep 2023 05:52:55 +0200 Subject: a --- shaders/lightmap.cpp | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'shaders') diff --git a/shaders/lightmap.cpp b/shaders/lightmap.cpp index 47a7a5e0..52471b6b 100644 --- a/shaders/lightmap.cpp +++ b/shaders/lightmap.cpp @@ -1,11 +1,12 @@ #include "shaders/lightmap.hpp" #include "compat/assert.hpp" +#include "compat/math.hpp" #include "src/tile-defs.hpp" -#include "loader/loader.hpp" #include "src/chunk.hpp" #include "src/tile-bbox.hpp" #include "src/tile-atlas.hpp" #include "src/object.hpp" +#include "loader/loader.hpp" #include #include #include @@ -25,23 +26,12 @@ namespace floormat { namespace { -template -constexpr T poor_mans_ceil(T x) -{ - static_assert(std::is_floating_point_v); - const auto x0 = (int64_t)x; - if (x > x0) - return T(x0 + (int64_t)1); - else - return T(x0); -} - constexpr auto neighbor_count = 4; constexpr float fuzz_pixels = 16; constexpr float shadow_wall_depth = 8; constexpr float real_image_size = 1024; -constexpr auto half_neighbors = (int)poor_mans_ceil(neighbor_count/2.f); +constexpr auto half_neighbors = (int)math::ceil(neighbor_count/2.f); constexpr auto image_size = TILE_SIZE2 * TILE_MAX_DIM * neighbor_count; constexpr auto chunk_size = TILE_SIZE2 * TILE_MAX_DIM; -- cgit v1.2.3