Commit c2b593fb authored by hybrid's avatar hybrid

New method for camera scene nodes. updateMatrices updates the camera matrices...

New method for camera scene nodes. updateMatrices updates the camera matrices without uploading them to the driver directly. Patch submitted by hendu

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@4475 dfc29bdd-3216-0410-991c-e03cc46cb475
parent a01095ad
......@@ -165,6 +165,9 @@ namespace scene
@see getTargetAndRotationBinding() */
virtual void bindTargetAndRotation(bool bound) =0;
//! Updates the matrices without uploading them to the driver
virtual void updateMatrices() = 0;
//! Queries if the camera scene node's rotation and its target position are bound together.
/** @see bindTargetAndRotation() */
virtual bool getTargetAndRotationBinding(void) const =0;
......
......@@ -243,6 +243,19 @@ void CCameraSceneNode::OnRegisterSceneNode()
//! render
void CCameraSceneNode::render()
{
updateMatrices();
video::IVideoDriver* driver = SceneManager->getVideoDriver();
if ( driver)
{
driver->setTransform(video::ETS_PROJECTION, ViewArea.getTransform ( video::ETS_PROJECTION) );
driver->setTransform(video::ETS_VIEW, ViewArea.getTransform ( video::ETS_VIEW) );
}
}
//! update
void CCameraSceneNode::updateMatrices()
{
core::vector3df pos = getAbsolutePosition();
core::vector3df tgtv = Target - pos;
......@@ -263,16 +276,8 @@ void CCameraSceneNode::render()
ViewArea.getTransform(video::ETS_VIEW).buildCameraLookAtMatrixLH(pos, Target, up);
ViewArea.getTransform(video::ETS_VIEW) *= Affector;
recalculateViewArea();
video::IVideoDriver* driver = SceneManager->getVideoDriver();
if ( driver)
{
driver->setTransform(video::ETS_PROJECTION, ViewArea.getTransform ( video::ETS_PROJECTION) );
driver->setTransform(video::ETS_VIEW, ViewArea.getTransform ( video::ETS_VIEW) );
}
}
//! returns the axis aligned bounding box of this node
const core::aabbox3d<f32>& CCameraSceneNode::getBoundingBox() const
{
......
......@@ -113,6 +113,9 @@ namespace scene
//! Render
virtual void render();
//! Update
virtual void updateMatrices();
//! Returns the axis aligned bounding box of this node
virtual const core::aabbox3d<f32>& getBoundingBox() const;
......
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