diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-06-10 10:57:53 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-06-10 10:57:53 +0200 |
commit | 411b53fd96b3e43960fcd1bf4bfeefe4c5e2f164 (patch) | |
tree | b56da1aee8a89e0582b81bf85098c06f837fc6ed /main | |
parent | bb70c67f77fbd3a8d1af5d73bad27acf1b986fc6 (diff) |
wip
Diffstat (limited to 'main')
-rw-r--r-- | main/draw.cpp | 16 | ||||
-rw-r--r-- | main/main-impl.cpp | 1 | ||||
-rw-r--r-- | main/main-impl.hpp | 5 | ||||
-rw-r--r-- | main/setup.cpp | 2 |
4 files changed, 16 insertions, 8 deletions
diff --git a/main/draw.cpp b/main/draw.cpp index 322f4f66..40e438c6 100644 --- a/main/draw.cpp +++ b/main/draw.cpp @@ -222,20 +222,22 @@ void main_impl::do_update() app.update(dt); } +void main_impl::bind() noexcept +{ + framebuffer.fb.bind(); +} + void main_impl::drawEvent() { _shader.set_tint({1, 1, 1, 1}); - { - const auto clear_color = 0x222222ff_rgbaf; + const auto clear_color = 0x222222ff_rgbaf; #ifdef FM_USE_DEPTH32 - framebuffer.fb.clearColor(0, clear_color); + framebuffer.fb.clearColor(0, clear_color); #else - GL::defaultFramebuffer.clearColor(clear_color); + GL::defaultFramebuffer.clearColor(clear_color); #endif - draw_world(); - GL::Renderer::disable(GL::Renderer::Feature::DepthTest); - } + draw_world(); app.draw(); GL::Renderer::flush(); diff --git a/main/main-impl.cpp b/main/main-impl.cpp index c774e589..de9fb45b 100644 --- a/main/main-impl.cpp +++ b/main/main-impl.cpp @@ -21,6 +21,7 @@ fm_settings& main_impl::settings() noexcept { return s; } const fm_settings& main_impl::settings() const noexcept { return s; } tile_shader& main_impl::shader() noexcept { return _shader; } const tile_shader& main_impl::shader() const noexcept { return _shader; } +struct lightmap_shader& main_impl::lightmap_shader() noexcept { return _lightmap_shader; } bool main_impl::is_text_input_active() const noexcept { return const_cast<main_impl&>(*this).isTextInputActive(); } void main_impl::start_text_input() noexcept { startTextInput(); } void main_impl::stop_text_input() noexcept { stopTextInput(); } diff --git a/main/main-impl.hpp b/main/main-impl.hpp index f5dc5010..97640d15 100644 --- a/main/main-impl.hpp +++ b/main/main-impl.hpp @@ -49,6 +49,8 @@ struct main_impl final : Platform::Sdl2Application, floormat_main tile_shader& shader() noexcept override; const tile_shader& shader() const noexcept override; + struct lightmap_shader& lightmap_shader() noexcept override; + struct world& world() noexcept override; struct world& reset_world() noexcept override; struct world& reset_world(struct world&& w) noexcept override; @@ -78,6 +80,7 @@ struct main_impl final : Platform::Sdl2Application, floormat_main [[maybe_unused]] void anyEvent(SDL_Event& event) override; void drawEvent() override; + void bind() noexcept override; void do_update(); void update_window_state(); struct meshes meshes() noexcept override; @@ -96,7 +99,7 @@ private: [[maybe_unused]] char _dummy = (register_debug_callback(), '\0'); floormat_app& app; // NOLINT(cppcoreguidelines-avoid-const-or-ref-data-members) tile_shader _shader; - lightmap_shader _lightmap_shader; + struct lightmap_shader _lightmap_shader; std::vector<clickable> _clickable_scenery; struct world _world{}; Magnum::Timeline timeline; diff --git a/main/setup.cpp b/main/setup.cpp index 569e43bb..93f3b943 100644 --- a/main/setup.cpp +++ b/main/setup.cpp @@ -56,7 +56,9 @@ auto main_impl::make_gl_conf(const fm_settings&) -> GLConfiguration flags |= GLConfiguration::Flag::ForwardCompatible; return GLConfiguration{} .setFlags(flags) +#ifdef FM_USE_DEPTH32 .setDepthBufferSize(0) +#endif .setColorBufferSize({8, 8, 8, 0}) .setStencilBufferSize(0); } |