diff --git a/include/Nazara/Graphics/Scene.hpp b/include/Nazara/Graphics/Scene.hpp index 625c0e920..d286c4c19 100644 --- a/include/Nazara/Graphics/Scene.hpp +++ b/include/Nazara/Graphics/Scene.hpp @@ -37,6 +37,8 @@ class NAZARA_API NzScene void Cull(); void Draw(); + void EnableBackground(bool enable); + NzColor GetAmbientColor() const; NzAbstractBackground* GetBackground() const; NzAbstractRenderTechnique* GetRenderTechnique() const; @@ -45,6 +47,8 @@ class NAZARA_API NzScene float GetUpdateTime() const; unsigned int GetUpdatePerSecond() const; + bool IsBackgroundEnabled() const; + void RegisterForUpdate(NzUpdatable* object); void SetAmbientColor(const NzColor& color); diff --git a/src/Nazara/Graphics/DeferredForwardPass.cpp b/src/Nazara/Graphics/DeferredForwardPass.cpp index 2adb9c421..368377e08 100644 --- a/src/Nazara/Graphics/DeferredForwardPass.cpp +++ b/src/Nazara/Graphics/DeferredForwardPass.cpp @@ -29,7 +29,7 @@ bool NzDeferredForwardPass::Process(const NzScene* scene, unsigned int workTextu NzRenderer::SetTarget(m_workRTT); NzRenderer::SetViewport(NzRecti(0, 0, m_dimensions.x, m_dimensions.y)); - NzAbstractBackground* background = scene->GetBackground(); + NzAbstractBackground* background = (scene->IsBackgroundEnabled()) ? scene->GetBackground() : nullptr; if (background) background->Draw(scene); diff --git a/src/Nazara/Graphics/ForwardRenderTechnique.cpp b/src/Nazara/Graphics/ForwardRenderTechnique.cpp index 8435db95e..5789f7489 100644 --- a/src/Nazara/Graphics/ForwardRenderTechnique.cpp +++ b/src/Nazara/Graphics/ForwardRenderTechnique.cpp @@ -70,7 +70,7 @@ void NzForwardRenderTechnique::Clear(const NzScene* scene) const NzRenderer::Enable(nzRendererParameter_DepthWrite, true); NzRenderer::Clear(nzRendererBuffer_Depth); - NzAbstractBackground* background = scene->GetBackground(); + NzAbstractBackground* background = (scene->IsBackgroundEnabled()) ? scene->GetBackground() : nullptr; if (background) background->Draw(scene); }