Sdk/RenderSystem: Allow to change render technique
Former-commit-id: ec61a2ebff138300344e6068917f0863c3d11859
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
#define NDK_SYSTEMS_RENDERSYSTEM_HPP
|
||||
|
||||
#include <Nazara/Graphics/AbstractBackground.hpp>
|
||||
#include <Nazara/Graphics/ForwardRenderTechnique.hpp>
|
||||
#include <Nazara/Graphics/DeferredRenderTechnique.hpp>
|
||||
#include <NDK/EntityList.hpp>
|
||||
#include <NDK/System.hpp>
|
||||
#include <unordered_map>
|
||||
@@ -25,11 +25,15 @@ namespace Ndk
|
||||
inline RenderSystem(const RenderSystem& renderSystem);
|
||||
~RenderSystem() = default;
|
||||
|
||||
template<typename T> void ChangeRenderTechnique();
|
||||
inline void ChangeRenderTechnique(std::unique_ptr<Nz::AbstractRenderTechnique>&& renderTechnique);
|
||||
|
||||
inline const Nz::BackgroundRef& GetDefaultBackground() const;
|
||||
inline const Nz::Matrix4f& GetCoordinateSystemMatrix() const;
|
||||
inline Nz::Vector3f GetGlobalForward() const;
|
||||
inline Nz::Vector3f GetGlobalRight() const;
|
||||
inline Nz::Vector3f GetGlobalUp() const;
|
||||
inline Nz::AbstractRenderTechnique& GetRenderTechnique() const;
|
||||
|
||||
inline void SetDefaultBackground(Nz::BackgroundRef background);
|
||||
inline void SetGlobalForward(const Nz::Vector3f& direction);
|
||||
@@ -45,11 +49,11 @@ namespace Ndk
|
||||
void OnEntityValidation(Entity* entity, bool justAdded) override;
|
||||
void OnUpdate(float elapsedTime) override;
|
||||
|
||||
std::unique_ptr<Nz::AbstractRenderTechnique> m_renderTechnique;
|
||||
EntityList m_cameras;
|
||||
EntityList m_drawables;
|
||||
EntityList m_lights;
|
||||
Nz::BackgroundRef m_background;
|
||||
Nz::ForwardRenderTechnique m_renderTechnique;
|
||||
Nz::Matrix4f m_coordinateSystemMatrix;
|
||||
bool m_coordinateSystemInvalidated;
|
||||
};
|
||||
|
||||
@@ -9,6 +9,17 @@ namespace Ndk
|
||||
{
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline void RenderSystem::ChangeRenderTechnique()
|
||||
{
|
||||
ChangeRenderTechnique(std::make_unique<T>());
|
||||
}
|
||||
|
||||
inline void RenderSystem::ChangeRenderTechnique(std::unique_ptr<Nz::AbstractRenderTechnique>&& renderTechnique)
|
||||
{
|
||||
m_renderTechnique = std::move(renderTechnique);
|
||||
}
|
||||
|
||||
inline const Nz::BackgroundRef& RenderSystem::GetDefaultBackground() const
|
||||
{
|
||||
return m_background;
|
||||
@@ -34,6 +45,11 @@ namespace Ndk
|
||||
return Nz::Vector3f(m_coordinateSystemMatrix.m12, m_coordinateSystemMatrix.m22, m_coordinateSystemMatrix.m32);
|
||||
}
|
||||
|
||||
inline Nz::AbstractRenderTechnique& RenderSystem::GetRenderTechnique() const
|
||||
{
|
||||
return *m_renderTechnique.get();
|
||||
}
|
||||
|
||||
inline void RenderSystem::SetDefaultBackground(Nz::BackgroundRef background)
|
||||
{
|
||||
m_background = std::move(background);
|
||||
|
||||
Reference in New Issue
Block a user