diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-08-24 14:56:01 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-08-24 14:56:01 +0200 |
commit | cf4d036d530e5e3fe1c1b23f734479b4f56e3eae (patch) | |
tree | e8d0de2b1019fe877d6de73d5428d67f09578b01 | |
parent | 1726f15d5b964d1a91004db906dd7f926c6574eb (diff) |
reorder stuff around
-rw-r--r-- | shaders/lightmap.cpp | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/shaders/lightmap.cpp b/shaders/lightmap.cpp index 6de117b0..f10e1f91 100644 --- a/shaders/lightmap.cpp +++ b/shaders/lightmap.cpp @@ -258,6 +258,28 @@ void lightmap_shader::add_light(Vector2 neighbor_offset, const light_s& light) AbstractShaderProgram::draw(light_mesh); } +void lightmap_shader::bind() +{ + framebuffer.fb.bind(); + GL::Renderer::setScissor({{}, image_size}); + framebuffer.fb.clearColor(1, Color4{0, 0, 0, 1}); + using BlendFunction = Magnum::GL::Renderer::BlendFunction; + GL::Renderer::setBlendFunction(0, BlendFunction::One, BlendFunction::Zero); + GL::Renderer::setBlendFunction(1, BlendFunction::One, BlendFunction::One); +} + +void lightmap_shader::finish() // NOLINT(*-convert-member-functions-to-static) +{ + using BlendFunction = Magnum::GL::Renderer::BlendFunction; + GL::Renderer::setBlendFunction(BlendFunction::SourceAlpha, BlendFunction::OneMinusSourceAlpha); +} + +GL::Texture2D& lightmap_shader::accum_texture() +{ + fm_debug_assert(framebuffer.accum.id()); + return framebuffer.accum; +} + void lightmap_shader::add_rect(Vector2 neighbor_offset, Vector2 min, Vector2 max) { auto off = neighbor_offset*chunk_size + chunk_offset; @@ -359,28 +381,6 @@ void lightmap_shader::add_entities(Vector2 neighbor_offset, chunk& c) } } -void lightmap_shader::bind() -{ - framebuffer.fb.bind(); - GL::Renderer::setScissor({{}, image_size}); - framebuffer.fb.clearColor(1, Color4{0, 0, 0, 1}); - using BlendFunction = Magnum::GL::Renderer::BlendFunction; - GL::Renderer::setBlendFunction(0, BlendFunction::One, BlendFunction::Zero); - GL::Renderer::setBlendFunction(1, BlendFunction::One, BlendFunction::One); -} - -void lightmap_shader::finish() // NOLINT(*-convert-member-functions-to-static) -{ - using BlendFunction = Magnum::GL::Renderer::BlendFunction; - GL::Renderer::setBlendFunction(BlendFunction::SourceAlpha, BlendFunction::OneMinusSourceAlpha); -} - -GL::Texture2D& lightmap_shader::accum_texture() -{ - fm_debug_assert(framebuffer.accum.id()); - return framebuffer.accum; -} - bool light_s::operator==(const light_s&) const noexcept = default; lightmap_shader::~lightmap_shader() = default; |