summaryrefslogtreecommitdiffhomepage
path: root/shaders/lightmap.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-08-25 00:05:19 +0200
committerStanislaw Halik <sthalik@misaki.pl>2023-08-25 00:05:19 +0200
commitd18f3480de2b6f81ff189f7fe9f586f3bbce4403 (patch)
tree219225d8d78908552429e8ee88ed4a2197709608 /shaders/lightmap.cpp
parentab7885a7c4063d418cbd874a9fc7d906a7c7f3c3 (diff)
probably fix it
Diffstat (limited to 'shaders/lightmap.cpp')
-rw-r--r--shaders/lightmap.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/shaders/lightmap.cpp b/shaders/lightmap.cpp
index 353febe3..293e8f2e 100644
--- a/shaders/lightmap.cpp
+++ b/shaders/lightmap.cpp
@@ -82,11 +82,6 @@ auto lightmap_shader::make_framebuffer(Vector2i size) -> Framebuffer
.clearColor(0, Color4{1, 0, 1, 1})
.clearColor(1, Color4{0, 0, 0, 1});
- framebuffer.fb.mapForDraw({
- { 0u, GL::Framebuffer::ColorAttachment{0} },
- { 1u, GL::Framebuffer::ColorAttachment{1} },
- });
-
return framebuffer;
}
@@ -240,7 +235,9 @@ void lightmap_shader::add_light(Vector2 neighbor_offset, const light_s& light)
float alpha = light.color.a() / 255.f;
auto color = (Vector3{light.color.rgb()} / 255.f) * alpha;
- framebuffer.fb.clearColor(0, Color4{0, 0, 0, 1});
+ framebuffer.fb.mapForDraw({
+ { 0u, GL::Framebuffer::ColorAttachment{0} },
+ });
setUniform(LightColorUniform, color * alpha);
setUniform(SizeUniform, Vector2(1) / real_image_size);
@@ -259,6 +256,10 @@ void lightmap_shader::add_light(Vector2 neighbor_offset, const light_s& light)
mesh_view.setCount((int32_t)count*6);
AbstractShaderProgram::draw(mesh_view);
+ framebuffer.fb.mapForDraw({
+ { 1u, GL::Framebuffer::ColorAttachment{1} },
+ });
+
setUniform(ModeUniform, BlendLightmapMode);
AbstractShaderProgram::draw(light_mesh);
}