From f6934e25ab56159425b7970ed9348f8f18e1f9a8 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 3 Dec 2002 17:20:31 +0000 Subject: [PATCH] Made the callback class uses virtual inheritance of osg::Referenced to ensure that a single class can be used for two different types of callbacks whithout incurring issues of multiple ref counts and ref()/unref() methods existing. --- include/osg/Drawable | 6 +++--- include/osg/NodeCallback | 2 +- include/osg/PositionAttitudeTransform | 2 +- include/osg/Transform | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/osg/Drawable b/include/osg/Drawable index adec13f33..e17ecd98f 100644 --- a/include/osg/Drawable +++ b/include/osg/Drawable @@ -172,7 +172,7 @@ class SG_EXPORT Drawable : public Object void compile(State& state); - struct AppCallback : public osg::Referenced + struct AppCallback : public virtual osg::Referenced { /** do customized app code.*/ virtual void app(osg::NodeVisitor *visitor, osg::Drawable* drawable) = 0; @@ -188,7 +188,7 @@ class SG_EXPORT Drawable : public Object const AppCallback* getAppCallback() const { return _appCallback.get(); } - struct CullCallback : public osg::Referenced + struct CullCallback : public virtual osg::Referenced { /** do customized cull code.*/ virtual bool cull(osg::NodeVisitor *visitor, osg::Drawable* drawable, osg::State *state=NULL) const = 0; @@ -209,7 +209,7 @@ class SG_EXPORT Drawable : public Object * the user intends to decorate the exist draw code then simple call the drawable->drawImplementation() from * with the callbacks drawImplementation() method. This allows the users to do both pre and post callbacks * without fuss and can even diable the inner draw in required.*/ - struct DrawCallback : public osg::Referenced + struct DrawCallback : public virtual osg::Referenced { /** do customized draw code.*/ virtual void drawImplementation(State& state,const osg::Drawable* drawable) const = 0; diff --git a/include/osg/NodeCallback b/include/osg/NodeCallback index 1821eaca4..e278ec507 100644 --- a/include/osg/NodeCallback +++ b/include/osg/NodeCallback @@ -13,7 +13,7 @@ namespace osg { class Node; class NodeVisitor; -class SG_EXPORT NodeCallback : public Referenced { +class SG_EXPORT NodeCallback : public virtual Referenced { public : diff --git a/include/osg/PositionAttitudeTransform b/include/osg/PositionAttitudeTransform index c37e0f479..59a6c7572 100644 --- a/include/osg/PositionAttitudeTransform +++ b/include/osg/PositionAttitudeTransform @@ -53,7 +53,7 @@ class SG_EXPORT PositionAttitudeTransform : public Transform /** Callback which can be attached to a PositionAttitudeTransform * as an app callback to allow it to follow the path defined by a * AnimationPath.*/ - class SG_EXPORT AnimationPathCallback : public NodeCallback + class SG_EXPORT AnimationPathCallback : public virtual NodeCallback { public: diff --git a/include/osg/Transform b/include/osg/Transform index 6841535d5..b37020fed 100644 --- a/include/osg/Transform +++ b/include/osg/Transform @@ -73,7 +73,7 @@ class SG_EXPORT Transform : public Group /** Callback attached to an Transform to specify how to compute the * modelview transformation for the transform below the Transform * node. */ - struct ComputeTransformCallback : public osg::Referenced + struct ComputeTransformCallback : public virtual osg::Referenced { /** Get the transformation matrix which moves from local coords * to world coords.*/