Added target parameter to Camera
Former-commit-id: a0f27d4a37aba8cfc9a2feba23866e95e7e90ea1
This commit is contained in:
parent
cd48d70844
commit
cdda9706c3
|
|
@ -34,6 +34,7 @@ class NAZARA_API NzCamera : public NzSceneNode
|
||||||
const NzFrustumf& GetFrustum() const;
|
const NzFrustumf& GetFrustum() const;
|
||||||
const NzMatrix4f& GetProjectionMatrix() const;
|
const NzMatrix4f& GetProjectionMatrix() const;
|
||||||
nzSceneNodeType GetSceneNodeType() const override;
|
nzSceneNodeType GetSceneNodeType() const override;
|
||||||
|
const NzRenderTarget* GetTarget() const;
|
||||||
const NzVector3f& GetUpVector() const;
|
const NzVector3f& GetUpVector() const;
|
||||||
const NzMatrix4f& GetViewMatrix() const;
|
const NzMatrix4f& GetViewMatrix() const;
|
||||||
const NzRectf& GetViewport() const;
|
const NzRectf& GetViewport() const;
|
||||||
|
|
@ -41,6 +42,7 @@ class NAZARA_API NzCamera : public NzSceneNode
|
||||||
float GetZNear() const;
|
float GetZNear() const;
|
||||||
|
|
||||||
void SetFOV(float fov);
|
void SetFOV(float fov);
|
||||||
|
void SetTarget(const NzRenderTarget* renderTarget);
|
||||||
void SetUpVector(const NzVector3f& upVector);
|
void SetUpVector(const NzVector3f& upVector);
|
||||||
void SetViewport(const NzRectf& viewport);
|
void SetViewport(const NzRectf& viewport);
|
||||||
void SetZFar(float zFar);
|
void SetZFar(float zFar);
|
||||||
|
|
@ -61,6 +63,7 @@ class NAZARA_API NzCamera : public NzSceneNode
|
||||||
mutable NzMatrix4f m_viewMatrix;
|
mutable NzMatrix4f m_viewMatrix;
|
||||||
NzRectf m_viewport;
|
NzRectf m_viewport;
|
||||||
NzVector3f m_upVector;
|
NzVector3f m_upVector;
|
||||||
|
const NzRenderTarget* m_target;
|
||||||
mutable bool m_frustumUpdated;
|
mutable bool m_frustumUpdated;
|
||||||
mutable bool m_projectionMatrixUpdated;
|
mutable bool m_projectionMatrixUpdated;
|
||||||
mutable bool m_viewMatrixUpdated;
|
mutable bool m_viewMatrixUpdated;
|
||||||
|
|
|
||||||
|
|
@ -25,18 +25,18 @@ NzCamera::~NzCamera() = default;
|
||||||
|
|
||||||
void NzCamera::Activate() const
|
void NzCamera::Activate() const
|
||||||
{
|
{
|
||||||
NzRenderTarget* renderTarget = NzRenderer::GetTarget();
|
|
||||||
|
|
||||||
#ifdef NAZARA_3D_SAFE
|
#ifdef NAZARA_3D_SAFE
|
||||||
if (!renderTarget)
|
if (!m_target)
|
||||||
{
|
{
|
||||||
NazaraError("No render target !");
|
NazaraError("No render target !");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
unsigned int width = renderTarget->GetWidth();
|
NzRenderer::SetTarget(m_target);
|
||||||
unsigned int height = std::max(renderTarget->GetHeight(), 1U);
|
|
||||||
|
unsigned int width = m_target->GetWidth();
|
||||||
|
unsigned int height = std::max(m_target->GetHeight(), 1U);
|
||||||
|
|
||||||
float vWidth = width * m_viewport.width;
|
float vWidth = width * m_viewport.width;
|
||||||
float vHeight = height * m_viewport.height;
|
float vHeight = height * m_viewport.height;
|
||||||
|
|
@ -126,6 +126,11 @@ nzSceneNodeType NzCamera::GetSceneNodeType() const
|
||||||
return nzSceneNodeType_Camera;
|
return nzSceneNodeType_Camera;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const NzRenderTarget* NzCamera::GetTarget() const
|
||||||
|
{
|
||||||
|
return m_target;
|
||||||
|
}
|
||||||
|
|
||||||
const NzVector3f& NzCamera::GetUpVector() const
|
const NzVector3f& NzCamera::GetUpVector() const
|
||||||
{
|
{
|
||||||
return m_upVector;
|
return m_upVector;
|
||||||
|
|
@ -162,6 +167,11 @@ void NzCamera::SetFOV(float fov)
|
||||||
m_projectionMatrixUpdated= false;
|
m_projectionMatrixUpdated= false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NzCamera::SetTarget(const NzRenderTarget* renderTarget)
|
||||||
|
{
|
||||||
|
m_target = renderTarget;
|
||||||
|
}
|
||||||
|
|
||||||
void NzCamera::SetUpVector(const NzVector3f& upVector)
|
void NzCamera::SetUpVector(const NzVector3f& upVector)
|
||||||
{
|
{
|
||||||
m_upVector = upVector;
|
m_upVector = upVector;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue