Renamed callbacks to avoid overlap with Node callbacks

This commit is contained in:
Robert Osfield 2014-05-21 09:06:17 +00:00
parent 30b54e3af2
commit 9859f3110b
2 changed files with 25 additions and 25 deletions

View File

@ -292,13 +292,13 @@ class OSG_EXPORT Drawable : public Node
virtual void setUpdateCallback(UpdateCallback* ac); virtual void setUpdateCallback(UpdateCallback* ac);
/** Get the non const UpdateCallback.*/ /** Get the non const UpdateCallback.*/
UpdateCallback* getUpdateCallback() { return _updateCallback.get(); } UpdateCallback* getUpdateCallback() { return _drawableUpdateCallback.get(); }
/** Get the const UpdateCallback.*/ /** Get the const UpdateCallback.*/
const UpdateCallback* getUpdateCallback() const { return _updateCallback.get(); } const UpdateCallback* getUpdateCallback() const { return _drawableUpdateCallback.get(); }
/** Return whether this Drawable has update callbacks associated with it, and therefore must be traversed.*/ /** Return whether this Drawable has update callbacks associated with it, and therefore must be traversed.*/
bool requiresUpdateTraversal() const { return _updateCallback.valid() || (_stateset.valid() && _stateset->requiresUpdateTraversal()); } bool requiresUpdateTraversal() const { return _drawableUpdateCallback.valid() || (_stateset.valid() && _stateset->requiresUpdateTraversal()); }
struct EventCallback : public virtual osg::Object struct EventCallback : public virtual osg::Object
@ -317,13 +317,13 @@ class OSG_EXPORT Drawable : public Node
virtual void setEventCallback(EventCallback* ac); virtual void setEventCallback(EventCallback* ac);
/** Get the non const EventCallback.*/ /** Get the non const EventCallback.*/
EventCallback* getEventCallback() { return _eventCallback.get(); } EventCallback* getEventCallback() { return _drawableEventCallback.get(); }
/** Get the const EventCallback.*/ /** Get the const EventCallback.*/
const EventCallback* getEventCallback() const { return _eventCallback.get(); } const EventCallback* getEventCallback() const { return _drawableEventCallback.get(); }
/** Return whether this Drawable has event callbacks associated with it, and therefore must be traversed.*/ /** Return whether this Drawable has event callbacks associated with it, and therefore must be traversed.*/
bool requiresEventTraversal() const { return _eventCallback.valid() || (_stateset.valid() && _stateset->requiresEventTraversal()); } bool requiresEventTraversal() const { return _drawableEventCallback.valid() || (_stateset.valid() && _stateset->requiresEventTraversal()); }
struct CullCallback : public virtual osg::Object struct CullCallback : public virtual osg::Object
@ -342,13 +342,13 @@ class OSG_EXPORT Drawable : public Node
}; };
/** Set the CullCallback which allows users to customize the culling of Drawable during the cull traversal.*/ /** Set the CullCallback which allows users to customize the culling of Drawable during the cull traversal.*/
virtual void setCullCallback(CullCallback* cc) { _cullCallback=cc; } virtual void setCullCallback(CullCallback* cc) { _drawableCullCallback=cc; }
/** Get the non const CullCallback.*/ /** Get the non const CullCallback.*/
CullCallback* getCullCallback() { return _cullCallback.get(); } CullCallback* getCullCallback() { return _drawableCullCallback.get(); }
/** Get the const CullCallback.*/ /** Get the const CullCallback.*/
const CullCallback* getCullCallback() const { return _cullCallback.get(); } const CullCallback* getCullCallback() const { return _drawableCullCallback.get(); }
@ -798,10 +798,10 @@ class OSG_EXPORT Drawable : public Node
typedef osg::buffered_value<GLuint> GLObjectList; typedef osg::buffered_value<GLuint> GLObjectList;
mutable GLObjectList _globjList; mutable GLObjectList _globjList;
ref_ptr<UpdateCallback> _updateCallback; ref_ptr<UpdateCallback> _drawableUpdateCallback;
ref_ptr<EventCallback> _eventCallback; ref_ptr<EventCallback> _drawableEventCallback;
ref_ptr<CullCallback> _cullCallback; ref_ptr<CullCallback> _drawableCullCallback;
ref_ptr<DrawCallback> _drawCallback; ref_ptr<DrawCallback> _drawCallback;
}; };

View File

@ -249,9 +249,9 @@ Drawable::Drawable(const Drawable& drawable,const CopyOp& copyop):
_useDisplayList(drawable._useDisplayList), _useDisplayList(drawable._useDisplayList),
_supportsVertexBufferObjects(drawable._supportsVertexBufferObjects), _supportsVertexBufferObjects(drawable._supportsVertexBufferObjects),
_useVertexBufferObjects(drawable._useVertexBufferObjects), _useVertexBufferObjects(drawable._useVertexBufferObjects),
_updateCallback(drawable._updateCallback), _drawableUpdateCallback(drawable._drawableUpdateCallback),
_eventCallback(drawable._eventCallback), _drawableEventCallback(drawable._drawableEventCallback),
_cullCallback(drawable._cullCallback), _drawableCullCallback(drawable._drawableCullCallback),
_drawCallback(drawable._drawCallback) _drawCallback(drawable._drawCallback)
{ {
setStateSet(copyop(drawable._stateset.get())); setStateSet(copyop(drawable._stateset.get()));
@ -328,9 +328,9 @@ void Drawable::setThreadSafeRefUnref(bool threadSafe)
Object::setThreadSafeRefUnref(threadSafe); Object::setThreadSafeRefUnref(threadSafe);
if (_stateset.valid()) _stateset->setThreadSafeRefUnref(threadSafe); if (_stateset.valid()) _stateset->setThreadSafeRefUnref(threadSafe);
if (_updateCallback.valid()) _updateCallback->setThreadSafeRefUnref(threadSafe); if (_drawableUpdateCallback.valid()) _drawableUpdateCallback->setThreadSafeRefUnref(threadSafe);
if (_eventCallback.valid()) _eventCallback->setThreadSafeRefUnref(threadSafe); if (_drawableEventCallback.valid()) _drawableEventCallback->setThreadSafeRefUnref(threadSafe);
if (_cullCallback.valid()) _cullCallback->setThreadSafeRefUnref(threadSafe); if (_drawableCullCallback.valid()) _drawableCullCallback->setThreadSafeRefUnref(threadSafe);
if (_drawCallback.valid()) _drawCallback->setThreadSafeRefUnref(threadSafe); if (_drawCallback.valid()) _drawCallback->setThreadSafeRefUnref(threadSafe);
} }
@ -470,13 +470,13 @@ void Drawable::dirtyDisplayList()
void Drawable::setUpdateCallback(UpdateCallback* ac) void Drawable::setUpdateCallback(UpdateCallback* ac)
{ {
if (_updateCallback==ac) return; if (_drawableUpdateCallback==ac) return;
int delta = 0; int delta = 0;
if (_updateCallback.valid()) --delta; if (_drawableUpdateCallback.valid()) --delta;
if (ac) ++delta; if (ac) ++delta;
_updateCallback = ac; _drawableUpdateCallback = ac;
if (delta!=0 && !(_stateset.valid() && _stateset->requiresUpdateTraversal())) if (delta!=0 && !(_stateset.valid() && _stateset->requiresUpdateTraversal()))
{ {
@ -491,13 +491,13 @@ void Drawable::setUpdateCallback(UpdateCallback* ac)
void Drawable::setEventCallback(EventCallback* ac) void Drawable::setEventCallback(EventCallback* ac)
{ {
if (_eventCallback==ac) return; if (_drawableEventCallback==ac) return;
int delta = 0; int delta = 0;
if (_eventCallback.valid()) --delta; if (_drawableEventCallback.valid()) --delta;
if (ac) ++delta; if (ac) ++delta;
_eventCallback = ac; _drawableEventCallback = ac;
if (delta!=0 && !(_stateset.valid() && _stateset->requiresEventTraversal())) if (delta!=0 && !(_stateset.valid() && _stateset->requiresEventTraversal()))
{ {