Ndk: Add support for 2D rendering

Former-commit-id: bdf9257816c8f48b8c0679647978480785720053
This commit is contained in:
Lynix
2015-09-18 12:34:05 +02:00
parent dd7afa970f
commit 859544eaa7
10 changed files with 140 additions and 11 deletions

View File

@@ -8,6 +8,7 @@
namespace Ndk
{
inline CameraComponent::CameraComponent() :
m_projectionType(nzProjectionType_Perspective),
m_targetRegion(0.f, 0.f, 1.f, 1.f),
m_target(nullptr),
m_frustumUpdated(false),
@@ -25,6 +26,7 @@ namespace Ndk
inline CameraComponent::CameraComponent(const CameraComponent& camera) :
Component(camera),
NzAbstractViewer(camera),
m_projectionType(camera.m_projectionType),
m_targetRegion(camera.m_targetRegion),
m_target(nullptr),
m_frustumUpdated(false),
@@ -95,6 +97,11 @@ namespace Ndk
return m_projectionMatrix;
}
inline nzProjectionType CameraComponent::GetProjectionType() const
{
return m_projectionType;
}
inline const NzRenderTarget* CameraComponent::GetTarget() const
{
return m_target;
@@ -132,8 +139,15 @@ namespace Ndk
inline void CameraComponent::SetFOV(float fov)
{
NazaraAssert(!NzNumberEquals(fov, 0.f), "FOV must be different from zero");
m_fov = fov;
InvalidateProjectionMatrix();
}
inline void CameraComponent::SetProjectionType(nzProjectionType projectionType)
{
m_projectionType = projectionType;
InvalidateProjectionMatrix();
}
@@ -149,6 +163,7 @@ namespace Ndk
inline void CameraComponent::SetTargetRegion(const NzRectf& region)
{
m_targetRegion = region;
InvalidateViewport();
}
@@ -166,14 +181,15 @@ namespace Ndk
inline void CameraComponent::SetZFar(float zFar)
{
m_zFar = zFar;
InvalidateProjectionMatrix();
}
inline void CameraComponent::SetZNear(float zNear)
{
NazaraAssert(!NzNumberEquals(zNear, 0.f), "zNear cannot be zero");
m_zNear = zNear;
InvalidateProjectionMatrix();
}