Files
NazaraEngine/SDK/include/NDK/Systems/RenderSystem.inl
Lynix 256c67099c SDK/RenderSystem: Fix an oopsie
Former-commit-id: f5a5b9410128a9156336268a4f00fb6afba9e4a6 [formerly 30af713ddc19d64e705160025b188706a24fb88f] [formerly d3870ff10df9cbd862d47e47c940dcda8346c295 [formerly dd082645670ee873087f6730a8c7e5858d6f5ded]]
Former-commit-id: 87358be88eaa6c53337c0c12abe8df11aeb2d6aa [formerly 156a76761c21de5a32578c4a7e6250081cab447a]
Former-commit-id: eb382e3c9c1af7f8871d1d7ce777b15f0d87138b
2016-08-10 19:10:40 +02:00

91 lines
2.5 KiB
C++

// Copyright (C) 2015 Jérôme Leclercq
// This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp
namespace Ndk
{
inline RenderSystem::RenderSystem(const RenderSystem& renderSystem) :
System(renderSystem)
{
}
template<typename T>
inline T& RenderSystem::ChangeRenderTechnique()
{
return static_cast<T&>(ChangeRenderTechnique(std::make_unique<T>()));
}
inline Nz::AbstractRenderTechnique& RenderSystem::ChangeRenderTechnique(std::unique_ptr<Nz::AbstractRenderTechnique>&& renderTechnique)
{
m_renderTechnique = std::move(renderTechnique);
return *m_renderTechnique.get();
}
inline const Nz::BackgroundRef& RenderSystem::GetDefaultBackground() const
{
return m_background;
}
inline const Nz::Matrix4f& RenderSystem::GetCoordinateSystemMatrix() const
{
return m_coordinateSystemMatrix;
}
inline Nz::Vector3f RenderSystem::GetGlobalForward() const
{
return Nz::Vector3f(-m_coordinateSystemMatrix.m13, -m_coordinateSystemMatrix.m23, -m_coordinateSystemMatrix.m33);
}
inline Nz::Vector3f RenderSystem::GetGlobalRight() const
{
return Nz::Vector3f(m_coordinateSystemMatrix.m11, m_coordinateSystemMatrix.m21, m_coordinateSystemMatrix.m31);
}
inline Nz::Vector3f RenderSystem::GetGlobalUp() const
{
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);
}
inline void RenderSystem::SetGlobalForward(const Nz::Vector3f& direction)
{
m_coordinateSystemMatrix.m13 = -direction.x;
m_coordinateSystemMatrix.m23 = -direction.y;
m_coordinateSystemMatrix.m33 = -direction.z;
InvalidateCoordinateSystem();
}
inline void RenderSystem::SetGlobalRight(const Nz::Vector3f& direction)
{
m_coordinateSystemMatrix.m11 = direction.x;
m_coordinateSystemMatrix.m21 = direction.y;
m_coordinateSystemMatrix.m31 = direction.z;
InvalidateCoordinateSystem();
}
inline void RenderSystem::SetGlobalUp(const Nz::Vector3f& direction)
{
m_coordinateSystemMatrix.m12 = direction.x;
m_coordinateSystemMatrix.m22 = direction.y;
m_coordinateSystemMatrix.m32 = direction.z;
InvalidateCoordinateSystem();
}
inline void RenderSystem::InvalidateCoordinateSystem()
{
m_coordinateSystemInvalidated = true;
}
}