diff options
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); |
