Commit a3d72206 authored by hybrid's avatar hybrid

Camera interface changed such that projection matrix and isOrthogonal flag are...

Camera interface changed such that projection matrix and isOrthogonal flag are changed together, if necessary. Patch provided by rogerborg.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1448 dfc29bdd-3216-0410-991c-e03cc46cb475
parent d3ccf633
...@@ -39,8 +39,10 @@ namespace scene ...@@ -39,8 +39,10 @@ namespace scene
to build a projection matrix. e.g: core::matrix4::buildProjectionMatrixPerspectiveFovLH. to build a projection matrix. e.g: core::matrix4::buildProjectionMatrixPerspectiveFovLH.
Note that the matrix will only stay as set by this method until one of Note that the matrix will only stay as set by this method until one of
the following Methods are called: setNearValue, setFarValue, setAspectRatio, setFOV. the following Methods are called: setNearValue, setFarValue, setAspectRatio, setFOV.
\param projection: The new projection matrix of the camera. */ \param projection The new projection matrix of the camera.
virtual void setProjectionMatrix(const core::matrix4& projection) = 0; \param isOrthogonal Set this to true if the matrix is an
orthogonal one (e.g. from matrix4::buildProjectionMatrixOrtho... */
virtual void setProjectionMatrix(const core::matrix4& projection, bool isOrthogonal = false) = 0;
//! Gets the current projection matrix of the camera. //! Gets the current projection matrix of the camera.
/** \return Returns the current projection matrix of the camera. */ /** \return Returns the current projection matrix of the camera. */
...@@ -126,18 +128,7 @@ namespace scene ...@@ -126,18 +128,7 @@ namespace scene
return IsOrthogonal; return IsOrthogonal;
} }
//! Sets if this camera should return that it is orthogonal. protected:
/** This setting does not change anything of the view or
projection matrix. However, the kind of camera
influences how collision detection and picking is done
and thus can be useful to query.
*/
void setIsOrthogonal( bool orthogonal )
{
IsOrthogonal = orthogonal;
}
private:
bool IsOrthogonal; bool IsOrthogonal;
}; };
......
...@@ -70,8 +70,9 @@ bool CCameraSceneNode::isInputReceiverEnabled() const ...@@ -70,8 +70,9 @@ bool CCameraSceneNode::isInputReceiverEnabled() const
//! Sets the projection matrix of the camera. The core::matrix4 class has some methods //! Sets the projection matrix of the camera. The core::matrix4 class has some methods
//! to build a projection matrix. e.g: core::matrix4::buildProjectionMatrixPerspectiveFovLH //! to build a projection matrix. e.g: core::matrix4::buildProjectionMatrixPerspectiveFovLH
//! \param projection: The new projection matrix of the camera. //! \param projection: The new projection matrix of the camera.
void CCameraSceneNode::setProjectionMatrix(const core::matrix4& projection) void CCameraSceneNode::setProjectionMatrix(const core::matrix4& projection, bool isOrthogonal)
{ {
IsOrthogonal = isOrthogonal;
ViewArea.Matrices [ video::ETS_PROJECTION ] = projection; ViewArea.Matrices [ video::ETS_PROJECTION ] = projection;
ViewArea.setTransformState ( video::ETS_PROJECTION ); ViewArea.setTransformState ( video::ETS_PROJECTION );
} }
......
...@@ -25,10 +25,15 @@ namespace scene ...@@ -25,10 +25,15 @@ namespace scene
//! destructor //! destructor
virtual ~CCameraSceneNode(); virtual ~CCameraSceneNode();
//! Sets the projection matrix of the camera. The core::matrix4 class has some methods //! Sets the projection matrix of the camera.
//! to build a projection matrix. e.g: core::matrix4::buildProjectionMatrixPerspectiveFovLH /** The core::matrix4 class has some methods
//! \param projection: The new projection matrix of the camera. to build a projection matrix. e.g: core::matrix4::buildProjectionMatrixPerspectiveFovLH.
virtual void setProjectionMatrix(const core::matrix4& projection); Note that the matrix will only stay as set by this method until one of
the following Methods are called: setNearValue, setFarValue, setAspectRatio, setFOV.
\param projection The new projection matrix of the camera.
\param isOrthogonal Set this to true if the matrix is an orthogonal one (e.g.
from matrix4::buildProjectionMatrixOrthoLH(). */
virtual void setProjectionMatrix(const core::matrix4& projection, bool isOrthogonal = false);
//! Gets the current projection matrix of the camera //! Gets the current projection matrix of the camera
//! \return Returns the current projection matrix of the camera. //! \return Returns the current projection matrix of the camera.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment