Ndk/RenderSystem: Add backgrounds support
Former-commit-id: 3209be099cb65095f97f99f6ae1d7c44332ea924
This commit is contained in:
parent
c4783ac38f
commit
0895a9273d
|
|
@ -7,6 +7,7 @@
|
||||||
#ifndef NDK_SYSTEMS_RENDERSYSTEM_HPP
|
#ifndef NDK_SYSTEMS_RENDERSYSTEM_HPP
|
||||||
#define NDK_SYSTEMS_RENDERSYSTEM_HPP
|
#define NDK_SYSTEMS_RENDERSYSTEM_HPP
|
||||||
|
|
||||||
|
#include <Nazara/Graphics/AbstractBackground.hpp>
|
||||||
#include <Nazara/Graphics/ForwardRenderTechnique.hpp>
|
#include <Nazara/Graphics/ForwardRenderTechnique.hpp>
|
||||||
#include <NDK/EntityList.hpp>
|
#include <NDK/EntityList.hpp>
|
||||||
#include <NDK/System.hpp>
|
#include <NDK/System.hpp>
|
||||||
|
|
@ -24,6 +25,10 @@ namespace Ndk
|
||||||
inline RenderSystem(const RenderSystem& renderSystem);
|
inline RenderSystem(const RenderSystem& renderSystem);
|
||||||
~RenderSystem() = default;
|
~RenderSystem() = default;
|
||||||
|
|
||||||
|
inline const NzBackgroundRef& GetDefaultBackground() const;
|
||||||
|
|
||||||
|
inline void SetDefaultBackground(NzBackgroundRef background);
|
||||||
|
|
||||||
static SystemIndex systemIndex;
|
static SystemIndex systemIndex;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
@ -34,6 +39,7 @@ namespace Ndk
|
||||||
EntityList m_cameras;
|
EntityList m_cameras;
|
||||||
EntityList m_drawables;
|
EntityList m_drawables;
|
||||||
EntityList m_lights;
|
EntityList m_lights;
|
||||||
|
NzBackgroundRef m_background;
|
||||||
NzForwardRenderTechnique m_renderTechnique;
|
NzForwardRenderTechnique m_renderTechnique;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,4 +8,14 @@ namespace Ndk
|
||||||
System(renderSystem)
|
System(renderSystem)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline const NzBackgroundRef& RenderSystem::GetDefaultBackground() const
|
||||||
|
{
|
||||||
|
return m_background;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void RenderSystem::SetDefaultBackground(NzBackgroundRef background)
|
||||||
|
{
|
||||||
|
m_background = std::move(background);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ namespace Ndk
|
||||||
{
|
{
|
||||||
RenderSystem::RenderSystem()
|
RenderSystem::RenderSystem()
|
||||||
{
|
{
|
||||||
|
SetDefaultBackground(NzColorBackground::New());
|
||||||
SetUpdateRate(0.f);
|
SetUpdateRate(0.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -73,11 +74,9 @@ namespace Ndk
|
||||||
lightComponent.AddToRenderQueue(renderQueue, drawableNode.GetTransformMatrix());
|
lightComponent.AddToRenderQueue(renderQueue, drawableNode.GetTransformMatrix());
|
||||||
}
|
}
|
||||||
|
|
||||||
NzColorBackground background;
|
|
||||||
|
|
||||||
NzSceneData sceneData;
|
NzSceneData sceneData;
|
||||||
sceneData.ambientColor = NzColor(25, 25, 25);
|
sceneData.ambientColor = NzColor(25, 25, 25);
|
||||||
sceneData.background = &background;
|
sceneData.background = m_background;
|
||||||
sceneData.viewer = &camComponent;
|
sceneData.viewer = &camComponent;
|
||||||
|
|
||||||
m_renderTechnique.Draw(sceneData);
|
m_renderTechnique.Draw(sceneData);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue