From 98e70f21a1ad53852e9f890f0ea60b21f56bfd5a Mon Sep 17 00:00:00 2001 From: Lynix Date: Wed, 3 Apr 2013 01:47:43 +0200 Subject: [PATCH] Made Background::Draw receive const scene pointer Former-commit-id: 2b84f8ea924714d81046f3dd29990939586e7622 --- include/Nazara/Graphics/Background.hpp | 4 +++- include/Nazara/Graphics/ColorBackground.hpp | 2 +- include/Nazara/Graphics/TextureBackground.hpp | 2 +- src/Nazara/Graphics/ColorBackground.cpp | 4 +++- src/Nazara/Graphics/Scene.cpp | 2 +- src/Nazara/Graphics/TextureBackground.cpp | 4 +++- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/include/Nazara/Graphics/Background.hpp b/include/Nazara/Graphics/Background.hpp index f8ba7d58a..4f32e4b36 100644 --- a/include/Nazara/Graphics/Background.hpp +++ b/include/Nazara/Graphics/Background.hpp @@ -10,13 +10,15 @@ #include #include +class NzScene; + class NAZARA_API NzBackground { public: NzBackground() = default; ~NzBackground(); - virtual void Draw() const = 0; + virtual void Draw(const NzScene* scene) const = 0; virtual nzBackgroundType GetBackgroundType() const = 0; }; diff --git a/include/Nazara/Graphics/ColorBackground.hpp b/include/Nazara/Graphics/ColorBackground.hpp index c51a158eb..049157a08 100644 --- a/include/Nazara/Graphics/ColorBackground.hpp +++ b/include/Nazara/Graphics/ColorBackground.hpp @@ -16,7 +16,7 @@ class NAZARA_API NzColorBackground : public NzBackground public: NzColorBackground(const NzColor& color = NzColor::Black); - void Draw() const; + void Draw(const NzScene* scene) const; nzBackgroundType GetBackgroundType() const; NzColor GetColor() const; diff --git a/include/Nazara/Graphics/TextureBackground.hpp b/include/Nazara/Graphics/TextureBackground.hpp index 008abca36..58a458665 100644 --- a/include/Nazara/Graphics/TextureBackground.hpp +++ b/include/Nazara/Graphics/TextureBackground.hpp @@ -16,7 +16,7 @@ class NAZARA_API NzTextureBackground : public NzBackground public: NzTextureBackground(NzTexture* texture); - void Draw() const; + void Draw(const NzScene* scene) const; nzBackgroundType GetBackgroundType() const; NzTexture* GetTexture() const; diff --git a/src/Nazara/Graphics/ColorBackground.cpp b/src/Nazara/Graphics/ColorBackground.cpp index eda8eb2ce..bdcc5b760 100644 --- a/src/Nazara/Graphics/ColorBackground.cpp +++ b/src/Nazara/Graphics/ColorBackground.cpp @@ -11,8 +11,10 @@ m_color(color) { } -void NzColorBackground::Draw() const +void NzColorBackground::Draw(const NzScene* scene) const { + NazaraUnused(scene); + NzRenderer::SetClearColor(m_color); NzRenderer::Clear(nzRendererClear_Color); } diff --git a/src/Nazara/Graphics/Scene.cpp b/src/Nazara/Graphics/Scene.cpp index 9a0948e5e..4b3f8d551 100644 --- a/src/Nazara/Graphics/Scene.cpp +++ b/src/Nazara/Graphics/Scene.cpp @@ -108,7 +108,7 @@ void NzScene::Draw() NzRenderer::Clear(nzRendererClear_Depth); if (m_impl->background) - m_impl->background->Draw(); + m_impl->background->Draw(this); LightComparator lightComparator; diff --git a/src/Nazara/Graphics/TextureBackground.cpp b/src/Nazara/Graphics/TextureBackground.cpp index ef8ad7141..a5fd2dc5d 100644 --- a/src/Nazara/Graphics/TextureBackground.cpp +++ b/src/Nazara/Graphics/TextureBackground.cpp @@ -12,8 +12,10 @@ m_texture(texture) { } -void NzTextureBackground::Draw() const +void NzTextureBackground::Draw(const NzScene* scene) const { + NazaraUnused(scene); + const NzRenderTarget* target = NzRenderer::GetTarget(); NzRectui viewport = NzRenderer::GetViewport();