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.
This commit is contained in:
Robert Osfield 2002-12-03 17:20:31 +00:00
parent 264cca1317
commit f6934e25ab
4 changed files with 6 additions and 6 deletions

View File

@ -172,7 +172,7 @@ class SG_EXPORT Drawable : public Object
void compile(State& state); void compile(State& state);
struct AppCallback : public osg::Referenced struct AppCallback : public virtual osg::Referenced
{ {
/** do customized app code.*/ /** do customized app code.*/
virtual void app(osg::NodeVisitor *visitor, osg::Drawable* drawable) = 0; 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(); } const AppCallback* getAppCallback() const { return _appCallback.get(); }
struct CullCallback : public osg::Referenced struct CullCallback : public virtual osg::Referenced
{ {
/** do customized cull code.*/ /** do customized cull code.*/
virtual bool cull(osg::NodeVisitor *visitor, osg::Drawable* drawable, osg::State *state=NULL) const = 0; 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 * 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 * 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.*/ * 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.*/ /** do customized draw code.*/
virtual void drawImplementation(State& state,const osg::Drawable* drawable) const = 0; virtual void drawImplementation(State& state,const osg::Drawable* drawable) const = 0;

View File

@ -13,7 +13,7 @@ namespace osg {
class Node; class Node;
class NodeVisitor; class NodeVisitor;
class SG_EXPORT NodeCallback : public Referenced { class SG_EXPORT NodeCallback : public virtual Referenced {
public : public :

View File

@ -53,7 +53,7 @@ class SG_EXPORT PositionAttitudeTransform : public Transform
/** Callback which can be attached to a PositionAttitudeTransform /** Callback which can be attached to a PositionAttitudeTransform
* as an app callback to allow it to follow the path defined by a * as an app callback to allow it to follow the path defined by a
* AnimationPath.*/ * AnimationPath.*/
class SG_EXPORT AnimationPathCallback : public NodeCallback class SG_EXPORT AnimationPathCallback : public virtual NodeCallback
{ {
public: public:

View File

@ -73,7 +73,7 @@ class SG_EXPORT Transform : public Group
/** Callback attached to an Transform to specify how to compute the /** Callback attached to an Transform to specify how to compute the
* modelview transformation for the transform below the Transform * modelview transformation for the transform below the Transform
* node. */ * node. */
struct ComputeTransformCallback : public osg::Referenced struct ComputeTransformCallback : public virtual osg::Referenced
{ {
/** Get the transformation matrix which moves from local coords /** Get the transformation matrix which moves from local coords
* to world coords.*/ * to world coords.*/