Added asCamera() methods into osg::Camera and osg::Node

This commit is contained in:
Robert Osfield
2011-09-14 10:02:11 +00:00
parent 0f30c08701
commit 8345c85c3c
2 changed files with 12 additions and 0 deletions

View File

@@ -45,6 +45,9 @@ class OSG_EXPORT Camera : public Transform, public CullSettings
META_Node(osg, Camera);
virtual Camera* asCamera() { return this; }
virtual const Camera* asCamera() const { return this; }
/** Set the View that this Camera is part of. */
void setView(View* view) { _view = view; }

View File

@@ -105,6 +105,15 @@ class OSG_EXPORT Node : public Object
* Equivalent to dynamic_cast<const Transform*>(this).*/
virtual const Transform* asTransform() const { return 0; }
/** Convert 'this' into a Camera pointer if Node is a Camera, otherwise return 0.
* Equivalent to dynamic_cast<Camera*>(this).*/
virtual Camera* asCamera() { return 0; }
/** convert 'const this' into a const Camera pointer if Node is a Camera, otherwise return 0.
* Equivalent to dynamic_cast<const Camera*>(this).*/
virtual const Camera* asCamera() const { return 0; }
/** Convert 'this' into a Switch pointer if Node is a Switch, otherwise return 0.
* Equivalent to dynamic_cast<Switch*>(this).*/
virtual Switch* asSwitch() { return 0; }