From 55a8f4abbc92ed0dc1e92dd66c61ae87c2f212ed Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 19 Jan 2016 11:39:28 +0000 Subject: [PATCH] Renamed DrawableUpdate/Event/Cull callbacks to use new include/osg/Callback versions --- examples/osganimationviewer/AnimtkViewerGUI.cpp | 2 +- examples/osgcallback/osgcallback.cpp | 6 +++--- examples/osggpucull/osggpucull.cpp | 2 +- examples/osgmultiplemovies/osgmultiplemovies.cpp | 4 ++-- examples/osgprerender/osgprerender.cpp | 2 +- include/osg/ClusterCullingCallback | 2 +- include/osgAnimation/MorphGeometry | 2 +- include/osgAnimation/RigGeometry | 2 +- include/osgGA/EventHandler | 4 ++-- include/osgViewer/ViewerEventHandlers | 4 ++-- src/osg/ClusterCullingCallback.cpp | 2 +- src/osgAnimation/StatsHandler.cpp | 4 ++-- src/osgManipulator/Dragger.cpp | 2 +- src/osgPlugins/logo/ReaderWriterLOGO.cpp | 2 +- src/osgText/FadeText.cpp | 2 +- src/osgUtil/CullVisitor.cpp | 4 ++-- src/osgViewer/Keystone.cpp | 4 ++-- src/osgWrappers/deprecated-dotosg/osg/Drawable.cpp | 11 +++++++++-- 18 files changed, 34 insertions(+), 27 deletions(-) diff --git a/examples/osganimationviewer/AnimtkViewerGUI.cpp b/examples/osganimationviewer/AnimtkViewerGUI.cpp index 4c7e1f1d7..4c222dc68 100644 --- a/examples/osganimationviewer/AnimtkViewerGUI.cpp +++ b/examples/osganimationviewer/AnimtkViewerGUI.cpp @@ -26,7 +26,7 @@ const std::string IMAGE_PATH = "osgWidget/"; template -struct Sampler: public osg::Drawable::UpdateCallback +struct Sampler: public osg::DrawableUpdateCallback { T _motion; Sampler() { diff --git a/examples/osgcallback/osgcallback.cpp b/examples/osgcallback/osgcallback.cpp index 499d65c10..485825ce1 100644 --- a/examples/osgcallback/osgcallback.cpp +++ b/examples/osgcallback/osgcallback.cpp @@ -65,7 +65,7 @@ class DrawableDrawCallback : public osg::Drawable::DrawCallback } }; -struct DrawableUpdateCallback : public osg::Drawable::UpdateCallback +struct DrawableUpdateCallback : public osg::DrawableUpdateCallback { virtual void update(osg::NodeVisitor*, osg::Drawable* drawable) { @@ -73,7 +73,7 @@ struct DrawableUpdateCallback : public osg::Drawable::UpdateCallback } }; -struct DrawableCullCallback : public osg::Drawable::CullCallback +struct DrawableCullCallback : public osg::DrawableCullCallback { /** do customized cull code.*/ virtual bool cull(osg::NodeVisitor*, osg::Drawable* drawable, osg::State* /*state*/) const @@ -158,7 +158,7 @@ class CameraEventCallback : public osg::NodeCallback }; -struct TestDrawableUpdateCallback : public osg::Drawable::UpdateCallback +struct TestDrawableUpdateCallback : public osg::DrawableUpdateCallback { TestDrawableUpdateCallback(const std::string &message): _message(message) {} diff --git a/examples/osggpucull/osggpucull.cpp b/examples/osggpucull/osggpucull.cpp index 9a329d864..10ef25ed2 100644 --- a/examples/osggpucull/osggpucull.cpp +++ b/examples/osggpucull/osggpucull.cpp @@ -1143,7 +1143,7 @@ osg::Geometry* buildGPUCullGeometry( const std::vector& instanc // instance wandering ( object goes to random destination point and when it reaches // destination, it picks another random point and so on ). // Object parts are animated ( wheels and propellers ) -struct AnimateObjectsCallback : public osg::Drawable::UpdateCallback +struct AnimateObjectsCallback : public osg::DrawableUpdateCallback { AnimateObjectsCallback( osg::BufferTemplate< std::vector >* instances, osg::Image* instancesImage, const osg::BoundingBox& bbox, unsigned int quantityPerType ) : _instances(instances), _instancesImage(instancesImage), _bbox(bbox), _quantityPerType(quantityPerType), _lastTime(0.0) diff --git a/examples/osgmultiplemovies/osgmultiplemovies.cpp b/examples/osgmultiplemovies/osgmultiplemovies.cpp index adc77f8d5..4e2a42feb 100644 --- a/examples/osgmultiplemovies/osgmultiplemovies.cpp +++ b/examples/osgmultiplemovies/osgmultiplemovies.cpp @@ -41,10 +41,10 @@ #include -class ImageStreamStateCallback : public osg::Drawable::UpdateCallback { +class ImageStreamStateCallback : public osg::DrawableUpdateCallback { public: ImageStreamStateCallback(osgText::Text* text, osg::ImageStream* is) - : osg::Drawable::UpdateCallback() + : osg::DrawableUpdateCallback() , _text(text) , _imageStream(is) , _fps(0) diff --git a/examples/osgprerender/osgprerender.cpp b/examples/osgprerender/osgprerender.cpp index 1e1ba7bf4..39e00f1c5 100644 --- a/examples/osgprerender/osgprerender.cpp +++ b/examples/osgprerender/osgprerender.cpp @@ -47,7 +47,7 @@ // call back which creates a deformation field to oscillate the model. class MyGeometryCallback : - public osg::Drawable::UpdateCallback, + public osg::DrawableUpdateCallback, public osg::Drawable::AttributeFunctor { public: diff --git a/include/osg/ClusterCullingCallback b/include/osg/ClusterCullingCallback index f0759ac73..0a3c96e39 100644 --- a/include/osg/ClusterCullingCallback +++ b/include/osg/ClusterCullingCallback @@ -22,7 +22,7 @@ namespace osg { /** Implements cluster culling to cull back facing drawables. Derived from * Drawable::CullCallback. */ -class OSG_EXPORT ClusterCullingCallback : public Drawable::CullCallback, public NodeCallback +class OSG_EXPORT ClusterCullingCallback : public DrawableCullCallback, public NodeCallback { public: diff --git a/include/osgAnimation/MorphGeometry b/include/osgAnimation/MorphGeometry index 634167fb0..15ad85087 100644 --- a/include/osgAnimation/MorphGeometry +++ b/include/osgAnimation/MorphGeometry @@ -137,7 +137,7 @@ namespace osgAnimation bool link(osgAnimation::Channel* channel); }; - struct UpdateMorphGeometry : public osg::Drawable::UpdateCallback + struct UpdateMorphGeometry : public osg::DrawableUpdateCallback { UpdateMorphGeometry() {} diff --git a/include/osgAnimation/RigGeometry b/include/osgAnimation/RigGeometry index 42dd7a858..f35404cbc 100644 --- a/include/osgAnimation/RigGeometry +++ b/include/osgAnimation/RigGeometry @@ -123,7 +123,7 @@ namespace osgAnimation }; - struct UpdateRigGeometry : public osg::Drawable::UpdateCallback + struct UpdateRigGeometry : public osg::DrawableUpdateCallback { UpdateRigGeometry() {} diff --git a/include/osgGA/EventHandler b/include/osgGA/EventHandler index 56b938a20..fcd1776a2 100644 --- a/include/osgGA/EventHandler +++ b/include/osgGA/EventHandler @@ -30,7 +30,7 @@ namespace osgGA{ EventHandler is base class for adding handling of events, either as node event callback, drawable event callback or an event handler attached directly to the view(er) */ -class OSGGA_EXPORT EventHandler : public osg::NodeCallback, public osg::Drawable::EventCallback +class OSGGA_EXPORT EventHandler : public osg::NodeCallback, public osg::DrawableEventCallback { public: @@ -39,7 +39,7 @@ public: osg::Object(eh, copyop), osg::Callback(eh, copyop), osg::NodeCallback(eh, copyop), - osg::Drawable::EventCallback(eh, copyop) {} + osg::DrawableEventCallback(eh, copyop) {} META_Object(osgGA, EventHandler); diff --git a/include/osgViewer/ViewerEventHandlers b/include/osgViewer/ViewerEventHandlers index c895b3bcf..1017efc51 100644 --- a/include/osgViewer/ViewerEventHandlers +++ b/include/osgViewer/ViewerEventHandlers @@ -499,7 +499,7 @@ class OSGVIEWER_EXPORT ScreenCaptureHandler : public osgGA::GUIEventHandler /** InteractiveImage is an event handler that computes the mouse coordinates in an images coordinate frame * and then passes keyboard and mouse events to it. This event handler is useful for vnc or browser * surfaces in the 3D scene.*/ -class OSGVIEWER_EXPORT InteractiveImageHandler : public osgGA::GUIEventHandler, public osg::Drawable::CullCallback +class OSGVIEWER_EXPORT InteractiveImageHandler : public osgGA::GUIEventHandler, public osg::DrawableCullCallback { public: @@ -524,7 +524,7 @@ protected: InteractiveImageHandler() {} InteractiveImageHandler(const InteractiveImageHandler&,const osg::CopyOp& = osg::CopyOp::SHALLOW_COPY): - osg::Object(), osg::Callback(), osgGA::GUIEventHandler(), osg::Drawable::CullCallback(), _fullscreen(false) {} + osg::Object(), osg::Callback(), osgGA::GUIEventHandler(), osg::DrawableCullCallback(), _fullscreen(false) {} bool mousePosition(osgViewer::View* view, osg::NodeVisitor* nv, const osgGA::GUIEventAdapter& ea, int& x, int &y) const; diff --git a/src/osg/ClusterCullingCallback.cpp b/src/osg/ClusterCullingCallback.cpp index b0fbe76c6..8c0e78002 100644 --- a/src/osg/ClusterCullingCallback.cpp +++ b/src/osg/ClusterCullingCallback.cpp @@ -29,7 +29,7 @@ ClusterCullingCallback::ClusterCullingCallback(): } ClusterCullingCallback::ClusterCullingCallback(const ClusterCullingCallback& ccc,const CopyOp& copyop): - Drawable::CullCallback(ccc,copyop), + DrawableCullCallback(ccc,copyop), _controlPoint(ccc._controlPoint), _normal(ccc._normal), _radius(ccc._radius), diff --git a/src/osgAnimation/StatsHandler.cpp b/src/osgAnimation/StatsHandler.cpp index 4508e9d55..1fdb9b2bc 100644 --- a/src/osgAnimation/StatsHandler.cpp +++ b/src/osgAnimation/StatsHandler.cpp @@ -106,7 +106,7 @@ struct StatsGraph : public osg::MatrixTransform osg::ref_ptr _statsGraphGeode; - struct NeverCull : public osg::Drawable::CullCallback + struct NeverCull : public osg::DrawableCullCallback { NeverCull() {} bool cull(osg::NodeVisitor* /*nv*/, osg::Drawable* /*drawable*/, osg::RenderInfo* /*renderInfo*/) const { return false;} @@ -137,7 +137,7 @@ struct StatsGraph : public osg::MatrixTransform }; - struct GraphUpdateCallback : public osg::Drawable::UpdateCallback + struct GraphUpdateCallback : public osg::DrawableUpdateCallback { const unsigned int _width; diff --git a/src/osgManipulator/Dragger.cpp b/src/osgManipulator/Dragger.cpp index 55e8a19fe..9a9a9b97c 100644 --- a/src/osgManipulator/Dragger.cpp +++ b/src/osgManipulator/Dragger.cpp @@ -566,7 +566,7 @@ void CompositeDragger::setIntersectionMask(osg::Node::NodeMask intersectionMask) } } -class ForceCullCallback : public osg::Drawable::CullCallback +class ForceCullCallback : public osg::DrawableCullCallback { public: virtual bool cull(osg::NodeVisitor*, osg::Drawable*, osg::State*) const diff --git a/src/osgPlugins/logo/ReaderWriterLOGO.cpp b/src/osgPlugins/logo/ReaderWriterLOGO.cpp index 0f4a7c215..68e1a7f83 100644 --- a/src/osgPlugins/logo/ReaderWriterLOGO.cpp +++ b/src/osgPlugins/logo/ReaderWriterLOGO.cpp @@ -33,7 +33,7 @@ class Logos: public osg::Drawable last_position }; - struct logosCullCallback : public osg::Drawable::CullCallback + struct logosCullCallback : public osg::DrawableCullCallback { virtual bool cull(osg::NodeVisitor *visitor, osg::Drawable* drawable, osg::State*) const { diff --git a/src/osgText/FadeText.cpp b/src/osgText/FadeText.cpp index 206ff8a01..4b4842085 100644 --- a/src/osgText/FadeText.cpp +++ b/src/osgText/FadeText.cpp @@ -270,7 +270,7 @@ GlobalFadeText* getGlobalFadeText() return s_globalFadeText.get(); } -struct FadeText::FadeTextUpdateCallback : public osg::Drawable::UpdateCallback +struct FadeText::FadeTextUpdateCallback : public osg::DrawableUpdateCallback { FadeTextData _ftd; diff --git a/src/osgUtil/CullVisitor.cpp b/src/osgUtil/CullVisitor.cpp index 019f42a24..4370b8386 100644 --- a/src/osgUtil/CullVisitor.cpp +++ b/src/osgUtil/CullVisitor.cpp @@ -985,7 +985,7 @@ void CullVisitor::apply(osg::Drawable& drawable) if( drawable.getCullCallback() ) { - osg::Drawable::CullCallback* dcb = dynamic_cast(drawable.getCullCallback()); + osg::DrawableCullCallback* dcb = drawable.getCullCallback()->asDrawableCullCallback(); if (dcb) { if( dcb->cull( this, &drawable, &_renderInfo ) == true ) return; @@ -1076,7 +1076,7 @@ void CullVisitor::apply(Billboard& node) if( drawable->getCullCallback() ) { - osg::Drawable::CullCallback* dcb = dynamic_cast(drawable->getCullCallback()); + osg::DrawableCullCallback* dcb = drawable->getCullCallback()->asDrawableCullCallback(); if (dcb && dcb->cull( this, drawable, &_renderInfo ) == true ) continue; } diff --git a/src/osgViewer/Keystone.cpp b/src/osgViewer/Keystone.cpp index acdda8c6d..66bca206c 100644 --- a/src/osgViewer/Keystone.cpp +++ b/src/osgViewer/Keystone.cpp @@ -91,7 +91,7 @@ void Keystone::compute3DPositions(osg::DisplaySettings* ds, osg::Vec3& tl, osg:: // // Keystone helper functions // -struct KeystoneCullCallback : public osg::Drawable::CullCallback +struct KeystoneCullCallback : public osg::DrawableCullCallback { KeystoneCullCallback(Keystone* keystone=0):_keystone(keystone) {} KeystoneCullCallback(const KeystoneCullCallback&, const osg::CopyOp&) {} @@ -108,7 +108,7 @@ struct KeystoneCullCallback : public osg::Drawable::CullCallback }; -struct KeystoneUpdateCallback : public osg::Drawable::UpdateCallback +struct KeystoneUpdateCallback : public osg::DrawableUpdateCallback { KeystoneUpdateCallback(Keystone* keystone=0):_keystone(keystone) {} KeystoneUpdateCallback(const KeystoneUpdateCallback&, const osg::CopyOp&) {} diff --git a/src/osgWrappers/deprecated-dotosg/osg/Drawable.cpp b/src/osgWrappers/deprecated-dotosg/osg/Drawable.cpp index 2d209d9be..785a43854 100644 --- a/src/osgWrappers/deprecated-dotosg/osg/Drawable.cpp +++ b/src/osgWrappers/deprecated-dotosg/osg/Drawable.cpp @@ -41,14 +41,21 @@ bool Drawable_readLocalData(Object& obj, Input& fr) iteratorAdvanced = true; } - Drawable::UpdateCallback* uc = fr.readObjectOfType(); + DrawableUpdateCallback* uc = fr.readObjectOfType(); if (uc) { drawable.setUpdateCallback(uc); iteratorAdvanced = true; } - Drawable::CullCallback* cc = fr.readObjectOfType(); + DrawableEventCallback* ec = fr.readObjectOfType(); + if (ec) + { + drawable.setEventCallback(ec); + iteratorAdvanced = true; + } + + DrawableCullCallback* cc = fr.readObjectOfType(); if (cc) { drawable.setCullCallback(cc);