summaryrefslogtreecommitdiffhomepage
path: root/shaders/shader.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-06-13 05:27:47 +0200
committerStanislaw Halik <sthalik@misaki.pl>2023-06-13 05:27:47 +0200
commit55ff3fddd8bee56fdec18612c7afd4863ac024e0 (patch)
treed2422898c42bdc263ca777ed19d26683b31020df /shaders/shader.cpp
parentb25f19d99a78099e10319983cb8230266a2c9870 (diff)
shaders: wip
Diffstat (limited to 'shaders/shader.cpp')
-rw-r--r--shaders/shader.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/shaders/shader.cpp b/shaders/shader.cpp
index 0c66bef2..4b184057 100644
--- a/shaders/shader.cpp
+++ b/shaders/shader.cpp
@@ -32,7 +32,10 @@ tile_shader::tile_shader()
set_scale({640, 480});
set_tint({1, 1, 1, 1});
- setUniform(OffsetUniform, Vector3{});
+ setUniform(OffsetUniform, Vector3(Vector2(_camera_offset), _depth_offset));
+ setUniform(EnableLightmapUniform, _enable_lightmap);
+ setUniform(SamplerUniform, 0);
+ setUniform(LightmapSamplerUniform, 1);
}
tile_shader::~tile_shader() = default;
@@ -57,6 +60,13 @@ tile_shader& tile_shader::set_tint(const Vector4& tint)
return *this;
}
+tile_shader& tile_shader::set_lightmap_enabled(bool value)
+{
+ if (value != _enable_lightmap)
+ setUniform(EnableLightmapUniform, _enable_lightmap = value);
+ return *this;
+}
+
void tile_shader::_draw()
{
fm_assert(std::fabs(_camera_offset[0]) < 1 << 24 && std::fabs(_camera_offset[1]) < 1 << 24);