/
RenderSystem.inl
73 lines (59 loc) · 1.97 KB
/
RenderSystem.inl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// 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)
{
}
inline const NzBackgroundRef& RenderSystem::GetDefaultBackground() const
{
return m_background;
}
inline const NzMatrix4f& RenderSystem::GetCoordinateSystemMatrix() const
{
return m_coordinateSystemMatrix;
}
inline NzVector3f RenderSystem::GetGlobalForward() const
{
return NzVector3f(-m_coordinateSystemMatrix.m13, -m_coordinateSystemMatrix.m23, -m_coordinateSystemMatrix.m33);
}
inline NzVector3f RenderSystem::GetGlobalRight() const
{
return NzVector3f(m_coordinateSystemMatrix.m11, m_coordinateSystemMatrix.m21, m_coordinateSystemMatrix.m31);
}
inline NzVector3f RenderSystem::GetGlobalUp() const
{
return NzVector3f(m_coordinateSystemMatrix.m12, m_coordinateSystemMatrix.m22, m_coordinateSystemMatrix.m32);
}
inline void RenderSystem::SetDefaultBackground(NzBackgroundRef background)
{
m_background = std::move(background);
}
inline void RenderSystem::SetGlobalForward(const NzVector3f& direction)
{
m_coordinateSystemMatrix.m13 = -direction.x;
m_coordinateSystemMatrix.m23 = -direction.y;
m_coordinateSystemMatrix.m33 = -direction.z;
InvalidateCoordinateSystem();
}
inline void RenderSystem::SetGlobalRight(const NzVector3f& direction)
{
m_coordinateSystemMatrix.m11 = direction.x;
m_coordinateSystemMatrix.m21 = direction.y;
m_coordinateSystemMatrix.m31 = direction.z;
InvalidateCoordinateSystem();
}
inline void RenderSystem::SetGlobalUp(const NzVector3f& direction)
{
m_coordinateSystemMatrix.m12 = direction.x;
m_coordinateSystemMatrix.m22 = direction.y;
m_coordinateSystemMatrix.m32 = direction.z;
InvalidateCoordinateSystem();
}
inline void RenderSystem::InvalidateCoordinateSystem()
{
m_coordinateSystemInvalidated = true;
}
}