From e02d3dbd590810df98b08c17fd81e6ce28711af8 Mon Sep 17 00:00:00 2001 From: LaG1924 Date: Sat, 20 Nov 2021 16:35:20 +0500 Subject: Fixed some broken graphics features --- src/Gal.hpp | 2 ++ src/GalOgl.cpp | 4 ++++ src/Render.cpp | 16 ++++++++-------- src/RendererWorld.cpp | 1 + 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/Gal.hpp b/src/Gal.hpp index f448c89..4757e37 100644 --- a/src/Gal.hpp +++ b/src/Gal.hpp @@ -106,6 +106,8 @@ namespace Gal { virtual void SetScissor(bool enabled) = 0; + virtual void SetWireframe(bool enabled) = 0; + virtual std::shared_ptr CreateBuffer() = 0; diff --git a/src/GalOgl.cpp b/src/GalOgl.cpp index 052c68a..29e7fc0 100644 --- a/src/GalOgl.cpp +++ b/src/GalOgl.cpp @@ -1055,6 +1055,10 @@ struct ImplOgl : public Impl { glCheckError(); } + virtual void SetWireframe(bool enabled) override { + glPolygonMode(GL_FRONT_AND_BACK, enabled ? GL_LINE : GL_FILL); + } + virtual std::shared_ptr CreateBuffer() override { auto buff = std::make_shared(); diff --git a/src/Render.cpp b/src/Render.cpp index 6301ff5..02f56ff 100644 --- a/src/Render.cpp +++ b/src/Render.cpp @@ -142,13 +142,13 @@ void Render::PrepareToRendering() { auto dsTexConf = gal->CreateTexture2DConfig(scaledW, scaledH, Gal::Format::D24S8); - dsTexConf->SetMinFilter(Gal::Filtering::Nearest); - dsTexConf->SetMaxFilter(Gal::Filtering::Nearest); + dsTexConf->SetMinFilter(Gal::Filtering::Bilinear); + dsTexConf->SetMaxFilter(Gal::Filtering::Bilinear); fbDepthStencil = gal->BuildTexture(dsTexConf); auto texConf = gal->CreateTexture2DConfig(scaledW, scaledH, Gal::Format::R8G8B8A8); - texConf->SetMinFilter(Gal::Filtering::Nearest); - texConf->SetMaxFilter(Gal::Filtering::Nearest); + texConf->SetMinFilter(Gal::Filtering::Bilinear); + texConf->SetMaxFilter(Gal::Filtering::Bilinear); fbColor = gal->BuildTexture(texConf); auto fbConf = gal->CreateFramebufferConfig(); @@ -223,12 +223,12 @@ void Render::RenderFrame() { Gal::GetImplementation()->GetDefaultFramebuffer()->Clear(); framebuffer->Clear(); - //if (isWireframe) - //glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); + if (isWireframe) + Gal::GetImplementation()->SetWireframe(true); if (renderWorld) world->Render(static_cast(windowWidth) / static_cast(windowHeight)); - //if (isWireframe) - //glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + if (isWireframe) + Gal::GetImplementation()->SetWireframe(false); fbPipeline->Activate(); fbPipelineInstance->Activate(); diff --git a/src/RendererWorld.cpp b/src/RendererWorld.cpp index cb4551f..561578f 100644 --- a/src/RendererWorld.cpp +++ b/src/RendererWorld.cpp @@ -381,6 +381,7 @@ void RendererWorld::Render(float screenRatio) { sectionsPipeline->Activate(); sectionsPipeline->SetShaderParameter("DayTime", mixLevel); sectionsPipeline->SetShaderParameter("projView", projView); + sectionsPipeline->SetShaderParameter("GlobalTime", globalTime); Frustum frustum(projView); -- cgit v1.2.3