Made Refernced::setThreadSafeReferenceCounting(bool) a virtual then overrode

this in various scene graph classes to ensure that the scene graph gets
updated as well as the objects that the initialial call is made from.
This commit is contained in:
Robert Osfield
2007-01-04 16:49:58 +00:00
parent cce656a19b
commit 73fffe1800
19 changed files with 140 additions and 16 deletions

View File

@@ -278,6 +278,9 @@ class OSG_EXPORT Drawable : public Object
*/
virtual void compileGLObjects(RenderInfo& renderInfo) const;
/** Set whether to use a mutex to ensure ref() and unref() are thread safe.*/
virtual void setThreadSafeRefUnref(bool threadSafe);
/** Resize any per context GLObject buffers to specified size. */
virtual void resizeGLObjectBuffers(unsigned int maxSize);

View File

@@ -138,6 +138,9 @@ class OSG_EXPORT Geode : public Node
virtual BoundingSphere computeBound() const;
/** Set whether to use a mutex to ensure ref() and unref() are thread safe.*/
virtual void setThreadSafeRefUnref(bool threadSafe);
/** Resize any per context GLObject buffers to specified size. */
virtual void resizeGLObjectBuffers(unsigned int maxSize);

View File

@@ -142,6 +142,9 @@ class OSG_EXPORT Group : public Node
return _children.size(); // node not found.
}
/** Set whether to use a mutex to ensure ref() and unref() are thread safe.*/
virtual void setThreadSafeRefUnref(bool threadSafe);
/** Resize any per context GLObject buffers to specified size. */
virtual void resizeGLObjectBuffers(unsigned int maxSize);

View File

@@ -299,6 +299,9 @@ class OSG_EXPORT Node : public Object
/** Get the const compute bound callback.*/
const ComputeBoundingSphereCallback* getComputeBoundingSphereCallback() const { return _computeBoundCallback.get(); }
/** Set whether to use a mutex to ensure ref() and unref() are thread safe.*/
virtual void setThreadSafeRefUnref(bool threadSafe);
/** Resize any per context GLObject buffers to specified size. */
virtual void resizeGLObjectBuffers(unsigned int /*maxSize*/);

View File

@@ -61,6 +61,10 @@ class OSG_EXPORT Program : public osg::StateAttribute
* performing any rebuild operations that might be pending. */
virtual void apply(osg::State& state) const;
/** Set whether to use a mutex to ensure ref() and unref() are thread safe.*/
virtual void setThreadSafeRefUnref(bool threadSafe);
/** Compile program and associated shaders.*/
virtual void compileGLObjects(osg::State& state) const;
/** Resize any per context GLObject buffers to specified size. */

View File

@@ -53,7 +53,7 @@ class OSG_EXPORT Referenced
inline Referenced& operator = (const Referenced&) { return *this; }
/** Set whether to use a mutex to ensure ref() and unref() are thread safe.*/
void setThreadSafeRefUnref(bool threadSafe);
virtual void setThreadSafeRefUnref(bool threadSafe);
/** Get whether a mutex is used to ensure ref() and unref() are thread safe.*/
bool getThreadSafeRefUnref() const { return _refMutex!=0; }

View File

@@ -414,6 +414,9 @@ class OSG_EXPORT StateSet : public Object
* Return true if all associated modes are valid.*/
bool checkValidityOfAssociatedModes(State& state) const;
/** Set whether to use a mutex to ensure ref() and unref() are thread safe.*/
virtual void setThreadSafeRefUnref(bool threadSafe);
/** call compile on all StateAttributes contained within this StateSet.*/
void compileGLObjects(State& state) const;
@@ -423,6 +426,8 @@ class OSG_EXPORT StateSet : public Object
/** call release on all StateAttributes contained within this StateSet.*/
virtual void releaseGLObjects(State* state=0) const;
protected :