diff --git a/include/osg/Camera b/include/osg/Camera index f663247cb..fc9671d84 100644 --- a/include/osg/Camera +++ b/include/osg/Camera @@ -599,9 +599,12 @@ class OSG_EXPORT Camera : public Transform, public CullSettings Callback(org, copyop) {} META_Object(osg, DrawCallback); + /** Functor method called by rendering thread to recursively launch operator() on _nestedcallback **/ - inline void run(osg::RenderInfo& renderInfo)const{ + inline void run(osg::RenderInfo& renderInfo) const + { operator () (renderInfo); + if (_nestedCallback.valid()) ((const DrawCallback*)_nestedCallback.get())->run(renderInfo); } @@ -623,8 +626,10 @@ class OSG_EXPORT Camera : public Transform, public CullSettings const DrawCallback* getInitialDrawCallback() const { return _initialDrawCallback.get(); } /** Convenience method that sets DrawCallback Initial callback of the node if it doesn't exist, or nest it into the existing one. */ - inline void addInitialDrawCallback(DrawCallback* nc) { - if (nc != NULL) { + inline void addInitialDrawCallback(DrawCallback* nc) + { + if (nc != NULL) + { if (_initialDrawCallback.valid()) _initialDrawCallback->addNestedCallback(nc); else setInitialDrawCallback(nc); } @@ -633,8 +638,10 @@ class OSG_EXPORT Camera : public Transform, public CullSettings template void addInitialDrawCallback(const ref_ptr& nc) { addInitialDrawCallback(nc.get()); } /** Convenience method that removes a given callback from a node, even if that callback is nested. There is no error return in case the given callback is not found. */ - inline void removeInitialDrawCallback(DrawCallback* nc) { - if (nc != NULL && _initialDrawCallback.valid()) { + inline void removeInitialDrawCallback(DrawCallback* nc) + { + if (nc != NULL && _initialDrawCallback.valid()) + { if (_initialDrawCallback == nc) { ref_ptr< DrawCallback> new_nested_callback = (DrawCallback*) nc->getNestedCallback(); @@ -657,8 +664,10 @@ class OSG_EXPORT Camera : public Transform, public CullSettings const DrawCallback* getPreDrawCallback() const { return _preDrawCallback.get(); } /** Convenience method that sets DrawCallback Initial callback of the node if it doesn't exist, or nest it into the existing one. */ - inline void addPreDrawCallback(DrawCallback* nc) { - if (nc != NULL) { + inline void addPreDrawCallback(DrawCallback* nc) + { + if (nc != NULL) + { if (_preDrawCallback.valid()) _preDrawCallback->addNestedCallback(nc); else setPreDrawCallback(nc); } @@ -667,8 +676,10 @@ class OSG_EXPORT Camera : public Transform, public CullSettings template void addPreDrawCallback(const ref_ptr& nc) { addPreDrawCallback(nc.get()); } /** Convenience method that removes a given callback from a node, even if that callback is nested. There is no error return in case the given callback is not found. */ - inline void removePreDrawCallback(DrawCallback* nc) { - if (nc != NULL && _preDrawCallback.valid()) { + inline void removePreDrawCallback(DrawCallback* nc) + { + if (nc != NULL && _preDrawCallback.valid()) + { if (_preDrawCallback == nc) { ref_ptr< DrawCallback> new_nested_callback = (DrawCallback*) nc->getNestedCallback(); @@ -691,8 +702,10 @@ class OSG_EXPORT Camera : public Transform, public CullSettings const DrawCallback* getPostDrawCallback() const { return _postDrawCallback.get(); } /** Convenience method that sets DrawCallback Initial callback of the node if it doesn't exist, or nest it into the existing one. */ - inline void addPostDrawCallback(DrawCallback* nc) { - if (nc != NULL) { + inline void addPostDrawCallback(DrawCallback* nc) + { + if (nc != NULL) + { if (_postDrawCallback.valid()) _postDrawCallback->addNestedCallback(nc); else setPostDrawCallback(nc); } @@ -701,8 +714,10 @@ class OSG_EXPORT Camera : public Transform, public CullSettings template void addPostDrawCallback(const ref_ptr& nc) { addPostDrawCallback(nc.get()); } /** Convenience method that removes a given callback from a node, even if that callback is nested. There is no error return in case the given callback is not found. */ - inline void removePostDrawCallback(DrawCallback* nc) { - if (nc != NULL && _postDrawCallback.valid()) { + inline void removePostDrawCallback(DrawCallback* nc) + { + if (nc != NULL && _postDrawCallback.valid()) + { if (_postDrawCallback == nc) { ref_ptr< DrawCallback> new_nested_callback = (DrawCallback*) nc->getNestedCallback(); @@ -725,8 +740,10 @@ class OSG_EXPORT Camera : public Transform, public CullSettings const DrawCallback* getFinalDrawCallback() const { return _finalDrawCallback.get(); } /** Convenience method that sets DrawCallback Initial callback of the node if it doesn't exist, or nest it into the existing one. */ - inline void addFinalDrawCallback(DrawCallback* nc) { - if (nc != NULL) { + inline void addFinalDrawCallback(DrawCallback* nc) + { + if (nc != NULL) + { if (_finalDrawCallback.valid()) _finalDrawCallback->addNestedCallback(nc); else setFinalDrawCallback(nc); } @@ -735,8 +752,10 @@ class OSG_EXPORT Camera : public Transform, public CullSettings template void addFinalDrawCallback(const ref_ptr& nc) { addFinalDrawCallback(nc.get()); } /** Convenience method that removes a given callback from a node, even if that callback is nested. There is no error return in case the given callback is not found. */ - inline void removeFinalDrawCallback(DrawCallback* nc) { - if (nc != NULL && _finalDrawCallback.valid()) { + inline void removeFinalDrawCallback(DrawCallback* nc) + { + if (nc != NULL && _finalDrawCallback.valid()) + { if (_finalDrawCallback == nc) { ref_ptr< DrawCallback> new_nested_callback = (DrawCallback*) nc->getNestedCallback();