summaryrefslogtreecommitdiffhomepage
path: root/shaders
diff options
context:
space:
mode:
Diffstat (limited to 'shaders')
-rw-r--r--shaders/tile-shader.cpp7
-rw-r--r--shaders/tile-shader.hpp4
-rw-r--r--shaders/tile-shader.vert2
3 files changed, 5 insertions, 8 deletions
diff --git a/shaders/tile-shader.cpp b/shaders/tile-shader.cpp
index 2218d463..12bc0a6d 100644
--- a/shaders/tile-shader.cpp
+++ b/shaders/tile-shader.cpp
@@ -39,11 +39,7 @@ tile_shader& tile_shader::set_scale(const Vector2& scale)
tile_shader& tile_shader::set_camera_offset(Vector2d camera_offset)
{
- static constexpr auto MAX = std::numeric_limits<std::int32_t>::max();
- ASSERT(std::fabs(camera_offset[0]) <= MAX);
- ASSERT(std::fabs(camera_offset[1]) <= MAX);
_camera_offset = camera_offset;
-
return *this;
}
@@ -56,9 +52,10 @@ tile_shader& tile_shader::set_tint(const Vector4& tint)
void tile_shader::_draw()
{
- if (const auto offset = Vector2i{(std::int32_t)_camera_offset[0], (std::int32_t)_camera_offset[1]};
+ if (const auto offset = Vector2{(float)_camera_offset[0], (float)_camera_offset[1]};
offset != _real_camera_offset)
{
+ ASSERT(offset[0] < 1 << 24 && offset[1] < 1 << 24);
_real_camera_offset = offset;
setUniform(OffsetUniform, offset);
}
diff --git a/shaders/tile-shader.hpp b/shaders/tile-shader.hpp
index c8d609f3..d538c4cc 100644
--- a/shaders/tile-shader.hpp
+++ b/shaders/tile-shader.hpp
@@ -33,7 +33,7 @@ private:
Vector2d _camera_offset;
Vector4 _tint;
Vector2 _scale;
- Vector2i _real_camera_offset;
+ Vector2 _real_camera_offset;
enum { ScaleUniform = 0, OffsetUniform = 1, TintUniform = 2, };
};
@@ -48,7 +48,7 @@ auto tile_shader::draw(T&& mesh, Xs&&... xs) ->
constexpr Vector2d tile_shader::project(const Vector3d pt)
{
- const auto x = -pt[0], y = pt[1], z = pt[2];
+ const auto x = pt[0], y = pt[1], z = pt[2];
return { (x-y), (x+y+z*2)*.59 };
}
diff --git a/shaders/tile-shader.vert b/shaders/tile-shader.vert
index d28f25fb..8b3f2dba 100644
--- a/shaders/tile-shader.vert
+++ b/shaders/tile-shader.vert
@@ -1,7 +1,7 @@
precision highp float;
layout (location = 0) uniform vec2 scale;
-layout (location = 1) uniform ivec2 offset;
+layout (location = 1) uniform vec2 offset;
layout (location = 0) in vec4 position;
layout (location = 1) in vec2 texcoords;