Added Scene::EnableBackground

Former-commit-id: 57a3c3e41799703bb72b4980433d7faadc3b1b86
This commit is contained in:
Lynix 2014-05-28 00:35:28 +02:00
parent 8aaed03310
commit 012c120bf1
3 changed files with 6 additions and 2 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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);
}