Sdk/CameraComponent: Add Size property for Orthogonal rendering

Former-commit-id: 0cdebac880e7e97685c7a0a2980dba973ec651a3
This commit is contained in:
Lynix
2016-01-13 18:43:42 +01:00
parent 4562243c5f
commit f49f77b75d
3 changed files with 31 additions and 2 deletions

View File

@@ -4,12 +4,14 @@
#include <Nazara/Core/Error.hpp>
#include <Nazara/Math/Algorithm.hpp>
#include "CameraComponent.hpp"
namespace Ndk
{
inline CameraComponent::CameraComponent() :
m_projectionType(Nz::ProjectionType_Perspective),
m_targetRegion(0.f, 0.f, 1.f, 1.f),
m_size(0.f),
m_target(nullptr),
m_frustumUpdated(false),
m_projectionMatrixUpdated(false),
@@ -28,6 +30,7 @@ namespace Ndk
AbstractViewer(camera),
m_projectionType(camera.m_projectionType),
m_targetRegion(camera.m_targetRegion),
m_size(camera.m_size),
m_target(nullptr),
m_frustumUpdated(false),
m_projectionMatrixUpdated(false),
@@ -102,6 +105,11 @@ namespace Ndk
return m_projectionType;
}
inline const Nz::Vector2f & CameraComponent::GetSize() const
{
return m_size;
}
inline const Nz::RenderTarget* CameraComponent::GetTarget() const
{
return m_target;
@@ -151,6 +159,18 @@ namespace Ndk
InvalidateProjectionMatrix();
}
inline void CameraComponent::SetSize(const Nz::Vector2f& size)
{
m_size = size;
InvalidateProjectionMatrix();
}
inline void CameraComponent::SetSize(float width, float height)
{
SetSize({width, height});
}
inline void CameraComponent::SetTarget(const Nz::RenderTarget* renderTarget)
{
m_target = renderTarget;