diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-11-09 18:27:32 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-11-09 18:27:32 +0100 |
commit | 5907a8902e6f01774cebbb515349a66c86a47fb3 (patch) | |
tree | 7d3f90a38e038e0f4acbaf62b328fb23446ab7c7 /shaders | |
parent | 1febb02d958fa4cf8c15e3ca18f9d644f9fc80fb (diff) |
allow drawing walls in random order
Diffstat (limited to 'shaders')
-rw-r--r-- | shaders/tile.cpp | 4 | ||||
-rw-r--r-- | shaders/tile.hpp | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/shaders/tile.cpp b/shaders/tile.cpp index c8261acd..22a91497 100644 --- a/shaders/tile.cpp +++ b/shaders/tile.cpp @@ -66,11 +66,11 @@ void tile_shader::_draw() } } -float tile_shader::depth_value(const local_coords& xy) noexcept +float tile_shader::depth_value(const local_coords& xy, float offset) noexcept { constexpr float max = (TILE_MAX_DIM+1)*(TILE_MAX_DIM+1) * .5f; constexpr float min = -1 + 1.f/256; - float value = min + xy.to_index()/max; + float value = min + (xy.to_index() + offset)/max; fm_assert(value > -1 && value < 1); return value; } diff --git a/shaders/tile.hpp b/shaders/tile.hpp index 8a45e1e7..4acc556b 100644 --- a/shaders/tile.hpp +++ b/shaders/tile.hpp @@ -27,7 +27,7 @@ struct tile_shader : GL::AbstractShaderProgram tile_shader& set_camera_offset(Vector2d camera_offset); Vector4 tint() const { return _tint; } tile_shader& set_tint(const Vector4& tint); - static float depth_value(const local_coords& xy) noexcept; + static float depth_value(const local_coords& xy, float offset = 0) noexcept; template<typename T = float> static constexpr Math::Vector2<T> project(const Math::Vector3<T>& pt); template<typename T = float> static constexpr Math::Vector2<T> unproject(const Math::Vector2<T>& px); |