diff options
Diffstat (limited to 'source/gameengine/Ketsji')
-rw-r--r-- | source/gameengine/Ketsji/KX_Camera.cpp | 6 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_Camera.h | 6 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_CameraIpoSGController.cpp | 17 |
3 files changed, 19 insertions, 10 deletions
diff --git a/source/gameengine/Ketsji/KX_Camera.cpp b/source/gameengine/Ketsji/KX_Camera.cpp index 0b12ddfe0d1..009ea4ac617 100644 --- a/source/gameengine/Ketsji/KX_Camera.cpp +++ b/source/gameengine/Ketsji/KX_Camera.cpp @@ -161,6 +161,12 @@ bool KX_Camera::hasValidProjectionMatrix() const return m_set_projection_matrix; } +void KX_Camera::InvalidateProjectionMatrix(bool valid) +{ + m_set_projection_matrix = valid; +} + + /* * These getters retrieve the clip data and the focal length */ diff --git a/source/gameengine/Ketsji/KX_Camera.h b/source/gameengine/Ketsji/KX_Camera.h index 103c47fc3d6..52ae64efbfb 100644 --- a/source/gameengine/Ketsji/KX_Camera.h +++ b/source/gameengine/Ketsji/KX_Camera.h @@ -158,6 +158,12 @@ public: /** returns true if this camera has been set a projection matrix. */ bool hasValidProjectionMatrix() const; + /** Sets the validity of the projection matrix. Call this if you change camera + data (eg lens, near plane, far plane) and require the projection matrix to be + recalculated. + */ + void InvalidateProjectionMatrix(bool valid = false); + /** Gets the modelview matrix that is used by the rasterizer. * @warning If the Camera is a dynamic object then this method may return garbage. Use GetCameraToWorld() instead. */ diff --git a/source/gameengine/Ketsji/KX_CameraIpoSGController.cpp b/source/gameengine/Ketsji/KX_CameraIpoSGController.cpp index 19f17ff32ed..425493dbe7e 100644 --- a/source/gameengine/Ketsji/KX_CameraIpoSGController.cpp +++ b/source/gameengine/Ketsji/KX_CameraIpoSGController.cpp @@ -47,24 +47,21 @@ bool KX_CameraIpoSGController::Update(double currentTime) (*i)->Execute(m_ipotime); } - RAS_CameraData* camdata; - SG_Spatial* ob = (SG_Spatial*)m_pObject; KX_Camera* kxcamera = (KX_Camera*) ob->GetSGClientObject(); - camdata = kxcamera->GetCameraData(); + RAS_CameraData* camdata = kxcamera->GetCameraData(); - - if (m_modify_lens) { + if (m_modify_lens) camdata->m_lens = m_lens; - } - if (m_modify_clipstart ) { + if (m_modify_clipstart ) camdata->m_clipstart = m_clipstart; - } - if (m_modify_clipend) { + if (m_modify_clipend) camdata->m_clipend = m_clipend; - } + + if (m_modify_lens || m_modify_clipstart || m_modify_clipend) + kxcamera->InvalidateProjectionMatrix(); m_modified=false; } |