summaryrefslogtreecommitdiffhomepage
path: root/shaders
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-08-24 13:27:35 +0200
committerStanislaw Halik <sthalik@misaki.pl>2023-08-24 13:27:41 +0200
commit7b5e5e332cad7d009487494b7ab9616c6c7d263b (patch)
tree3b7ddcceed6e883aef925805533ea7463a952729 /shaders
parent25645965792e2398bb25a5e0b2e75e40d83f6366 (diff)
shaders: just render the entire light buffer
Diffstat (limited to 'shaders')
-rw-r--r--shaders/lightmap.cpp18
-rw-r--r--shaders/lightmap.hpp1
2 files changed, 1 insertions, 18 deletions
diff --git a/shaders/lightmap.cpp b/shaders/lightmap.cpp
index 7fb3f198..839bd782 100644
--- a/shaders/lightmap.cpp
+++ b/shaders/lightmap.cpp
@@ -175,19 +175,13 @@ lightmap_shader::lightmap_shader()
framebuffer = make_framebuffer(image_size);
- light_vertexes = {};
- light_vertex_buf = GL::Buffer{light_vertexes, GL::BufferUsage::DynamicDraw};
- light_mesh = make_light_mesh(light_vertex_buf, GL::Buffer{quad_indexes(0)});
-
-#if 0
auto blend_vertexes = std::array<Vector3, 4>{{
{ 1, -1, 0 }, /* 3--1 1 */
{ 1, 1, 0 }, /* | / /| */
{ -1, -1, 0 }, /* |/ / | */
{ -1, 1, 0 }, /* 2 2--0 */
}};
- light_mesh = make_light_mesh<GL::Buffer&&>(GL::Buffer{blend_vertexes}, GL::Buffer{quad_indexes(0)});
-#endif
+ light_mesh = make_light_mesh(GL::Buffer{blend_vertexes}, GL::Buffer{quad_indexes(0)});
framebuffer.scratch.bind(TextureSampler);
setUniform(SamplerUniform, TextureSampler);
@@ -247,21 +241,11 @@ void lightmap_shader::add_light(Vector2 neighbor_offset, const light_s& light)
setUniform(FalloffUniform, (uint32_t)light.falloff);
setUniform(ModeUniform, DrawLightmapMode);
- const auto size = I * clip_scale;
- light_vertexes = {{
- { size.x() + center_clip.x(), -size.y() + center_clip.y(), 0 },
- { size.x() + center_clip.x(), size.y() + center_clip.y(), 0 },
- { -size.x() + center_clip.x(), -size.y() + center_clip.y(), 0 },
- { -size.x() + center_clip.x(), size.y() + center_clip.y(), 0 },
- }};
- light_vertex_buf.setSubData(0, light_vertexes);
-
AbstractShaderProgram::draw(light_mesh);
setUniform(ModeUniform, DrawShadowsMode);
setUniform(LightColorUniform, Color3{0, 0, 0});
setUniform(RangeUniform, I);
-
fm_assert(occlusion_mesh.id());
auto mesh_view = GL::MeshView{occlusion_mesh};
mesh_view.setCount((int32_t)count*6);
diff --git a/shaders/lightmap.hpp b/shaders/lightmap.hpp
index 22a94af0..5fee2381 100644
--- a/shaders/lightmap.hpp
+++ b/shaders/lightmap.hpp
@@ -96,7 +96,6 @@ private:
GL::Mesh occlusion_mesh{NoCreate};
static constexpr auto starting_capacity = 1; // todo
- std::array<Vector3, 4> light_vertexes;
GL::Buffer light_vertex_buf{NoCreate};
GL::Mesh light_mesh{NoCreate};
};