Ndk/RenderSystem: Add backgrounds support

Former-commit-id: 3209be099cb65095f97f99f6ae1d7c44332ea924
This commit is contained in:
Lynix 2015-06-24 00:26:46 +02:00
parent c4783ac38f
commit 0895a9273d
3 changed files with 18 additions and 3 deletions

View File

@ -7,6 +7,7 @@
#ifndef NDK_SYSTEMS_RENDERSYSTEM_HPP
#define NDK_SYSTEMS_RENDERSYSTEM_HPP
#include <Nazara/Graphics/AbstractBackground.hpp>
#include <Nazara/Graphics/ForwardRenderTechnique.hpp>
#include <NDK/EntityList.hpp>
#include <NDK/System.hpp>
@ -24,6 +25,10 @@ namespace Ndk
inline RenderSystem(const RenderSystem& renderSystem);
~RenderSystem() = default;
inline const NzBackgroundRef& GetDefaultBackground() const;
inline void SetDefaultBackground(NzBackgroundRef background);
static SystemIndex systemIndex;
private:
@ -34,6 +39,7 @@ namespace Ndk
EntityList m_cameras;
EntityList m_drawables;
EntityList m_lights;
NzBackgroundRef m_background;
NzForwardRenderTechnique m_renderTechnique;
};
}

View File

@ -8,4 +8,14 @@ namespace Ndk
System(renderSystem)
{
}
inline const NzBackgroundRef& RenderSystem::GetDefaultBackground() const
{
return m_background;
}
inline void RenderSystem::SetDefaultBackground(NzBackgroundRef background)
{
m_background = std::move(background);
}
}

View File

@ -13,6 +13,7 @@ namespace Ndk
{
RenderSystem::RenderSystem()
{
SetDefaultBackground(NzColorBackground::New());
SetUpdateRate(0.f);
}
@ -73,11 +74,9 @@ namespace Ndk
lightComponent.AddToRenderQueue(renderQueue, drawableNode.GetTransformMatrix());
}
NzColorBackground background;
NzSceneData sceneData;
sceneData.ambientColor = NzColor(25, 25, 25);
sceneData.background = &background;
sceneData.background = m_background;
sceneData.viewer = &camComponent;
m_renderTechnique.Draw(sceneData);