Camera not longer use a LookAt view matrix
Former-commit-id: c07e1db9f939bcfe9ef09a1fdab88176f79b61e8
This commit is contained in:
parent
7f9455b947
commit
28175f3170
|
|
@ -35,7 +35,6 @@ class NAZARA_API NzCamera : public NzSceneNode
|
||||||
const NzMatrix4f& GetProjectionMatrix() const;
|
const NzMatrix4f& GetProjectionMatrix() const;
|
||||||
nzSceneNodeType GetSceneNodeType() const override;
|
nzSceneNodeType GetSceneNodeType() const override;
|
||||||
const NzRenderTarget* GetTarget() const;
|
const NzRenderTarget* GetTarget() const;
|
||||||
const NzVector3f& GetUpVector() const;
|
|
||||||
const NzMatrix4f& GetViewMatrix() const;
|
const NzMatrix4f& GetViewMatrix() const;
|
||||||
const NzRectf& GetViewport() const;
|
const NzRectf& GetViewport() const;
|
||||||
float GetZFar() const;
|
float GetZFar() const;
|
||||||
|
|
@ -44,7 +43,6 @@ class NAZARA_API NzCamera : public NzSceneNode
|
||||||
void SetFOV(float fov);
|
void SetFOV(float fov);
|
||||||
void SetTarget(const NzRenderTarget* renderTarget);
|
void SetTarget(const NzRenderTarget* renderTarget);
|
||||||
void SetTarget(const NzRenderTarget& renderTarget);
|
void SetTarget(const NzRenderTarget& renderTarget);
|
||||||
void SetUpVector(const NzVector3f& upVector);
|
|
||||||
void SetViewport(const NzRectf& viewport);
|
void SetViewport(const NzRectf& viewport);
|
||||||
void SetZFar(float zFar);
|
void SetZFar(float zFar);
|
||||||
void SetZNear(float zNear);
|
void SetZNear(float zNear);
|
||||||
|
|
@ -63,7 +61,6 @@ class NAZARA_API NzCamera : public NzSceneNode
|
||||||
mutable NzMatrix4f m_projectionMatrix;
|
mutable NzMatrix4f m_projectionMatrix;
|
||||||
mutable NzMatrix4f m_viewMatrix;
|
mutable NzMatrix4f m_viewMatrix;
|
||||||
NzRectf m_viewport;
|
NzRectf m_viewport;
|
||||||
NzVector3f m_upVector;
|
|
||||||
const NzRenderTarget* m_target;
|
const NzRenderTarget* m_target;
|
||||||
mutable bool m_frustumUpdated;
|
mutable bool m_frustumUpdated;
|
||||||
mutable bool m_projectionMatrixUpdated;
|
mutable bool m_projectionMatrixUpdated;
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
NzCamera::NzCamera() :
|
NzCamera::NzCamera() :
|
||||||
m_viewport(0.f, 0.f, 1.f, 1.f),
|
m_viewport(0.f, 0.f, 1.f, 1.f),
|
||||||
m_upVector(NzVector3f::Up()),
|
|
||||||
m_frustumUpdated(false),
|
m_frustumUpdated(false),
|
||||||
m_projectionMatrixUpdated(false),
|
m_projectionMatrixUpdated(false),
|
||||||
m_viewMatrixUpdated(false),
|
m_viewMatrixUpdated(false),
|
||||||
|
|
@ -131,11 +130,6 @@ const NzRenderTarget* NzCamera::GetTarget() const
|
||||||
return m_target;
|
return m_target;
|
||||||
}
|
}
|
||||||
|
|
||||||
const NzVector3f& NzCamera::GetUpVector() const
|
|
||||||
{
|
|
||||||
return m_upVector;
|
|
||||||
}
|
|
||||||
|
|
||||||
const NzMatrix4f& NzCamera::GetViewMatrix() const
|
const NzMatrix4f& NzCamera::GetViewMatrix() const
|
||||||
{
|
{
|
||||||
if (!m_viewMatrixUpdated)
|
if (!m_viewMatrixUpdated)
|
||||||
|
|
@ -177,14 +171,6 @@ void NzCamera::SetTarget(const NzRenderTarget& renderTarget)
|
||||||
SetTarget(&renderTarget);
|
SetTarget(&renderTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NzCamera::SetUpVector(const NzVector3f& upVector)
|
|
||||||
{
|
|
||||||
m_upVector = upVector;
|
|
||||||
|
|
||||||
m_frustumUpdated = false;
|
|
||||||
m_viewMatrixUpdated = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void NzCamera::SetViewport(const NzRectf& viewport)
|
void NzCamera::SetViewport(const NzRectf& viewport)
|
||||||
{
|
{
|
||||||
m_viewport = viewport;
|
m_viewport = viewport;
|
||||||
|
|
@ -231,7 +217,13 @@ void NzCamera::Unregister()
|
||||||
|
|
||||||
void NzCamera::UpdateFrustum() const
|
void NzCamera::UpdateFrustum() const
|
||||||
{
|
{
|
||||||
m_frustum.Build(m_fov, m_aspectRatio, m_zNear, m_zFar, m_derivedPosition, m_derivedPosition + m_derivedRotation*NzVector3f::Forward(), m_upVector);
|
if (!m_projectionMatrixUpdated)
|
||||||
|
UpdateProjectionMatrix();
|
||||||
|
|
||||||
|
if (!m_viewMatrixUpdated)
|
||||||
|
UpdateViewMatrix();
|
||||||
|
|
||||||
|
m_frustum.Extract(m_viewMatrix, m_projectionMatrix);
|
||||||
m_frustumUpdated = true;
|
m_frustumUpdated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -246,7 +238,7 @@ void NzCamera::UpdateViewMatrix() const
|
||||||
if (!m_derivedUpdated)
|
if (!m_derivedUpdated)
|
||||||
UpdateDerived();
|
UpdateDerived();
|
||||||
|
|
||||||
m_viewMatrix.MakeLookAt(m_derivedPosition, m_derivedPosition + m_derivedRotation*NzVector3f::Forward(), m_upVector);
|
m_viewMatrix.MakeViewMatrix(m_derivedPosition, m_derivedRotation);
|
||||||
m_viewMatrixUpdated = true;
|
m_viewMatrixUpdated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue