From de4a4042f7aff23d27034cadcb561e8ec82769c4 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 22 Aug 2007 10:34:11 +0000 Subject: [PATCH] Set main scene graph elements to use thread safe ref/unref by default --- include/osg/StateAttribute | 2 +- src/osg/Drawable.cpp | 1 + src/osg/Image.cpp | 1 + src/osg/Node.cpp | 1 + src/osg/StateAttribute.cpp | 7 +++++++ src/osg/View.cpp | 1 + 6 files changed, 12 insertions(+), 1 deletion(-) diff --git a/include/osg/StateAttribute b/include/osg/StateAttribute index 133ca13e9..d8bca6219 100644 --- a/include/osg/StateAttribute +++ b/include/osg/StateAttribute @@ -186,7 +186,7 @@ class OSG_EXPORT StateAttribute : public Object /** Simple pairing between an attribute type and the member within that attribute type group.*/ typedef std::pair TypeMemberPair; - StateAttribute() {} + StateAttribute(); StateAttribute(const StateAttribute& sa,const CopyOp& copyop=CopyOp::SHALLOW_COPY): Object(sa,copyop) {} diff --git a/src/osg/Drawable.cpp b/src/osg/Drawable.cpp index b7c0610ba..761491d5f 100644 --- a/src/osg/Drawable.cpp +++ b/src/osg/Drawable.cpp @@ -245,6 +245,7 @@ void Drawable::flushDeletedVertexBufferObjects(unsigned int contextID,double /*c Drawable::Drawable() + :Object(true) { _boundingBoxComputed = false; diff --git a/src/osg/Image.cpp b/src/osg/Image.cpp index f129a4f80..4bdcd63bf 100644 --- a/src/osg/Image.cpp +++ b/src/osg/Image.cpp @@ -28,6 +28,7 @@ using namespace osg; using namespace std; Image::Image() + :Object(true) { setDataVariance(STATIC); diff --git a/src/osg/Node.cpp b/src/osg/Node.cpp index 672a481c6..67e041202 100644 --- a/src/osg/Node.cpp +++ b/src/osg/Node.cpp @@ -53,6 +53,7 @@ namespace osg } Node::Node() + :Object(true) { _boundingSphereComputed = false; _nodeMask = 0xffffffff; diff --git a/src/osg/StateAttribute.cpp b/src/osg/StateAttribute.cpp index 774eb0f65..61b18dbab 100644 --- a/src/osg/StateAttribute.cpp +++ b/src/osg/StateAttribute.cpp @@ -18,6 +18,13 @@ using namespace osg; + +StateAttribute::StateAttribute() + :Object(true) +{ +} + + void StateAttribute::addParent(osg::StateSet* object) { _parents.push_back(object); diff --git a/src/osg/View.cpp b/src/osg/View.cpp index df58b1202..7303d34e8 100644 --- a/src/osg/View.cpp +++ b/src/osg/View.cpp @@ -91,6 +91,7 @@ void View::setLightingMode(LightingMode lightingMode) if (_lightingMode != NO_LIGHT && !_light) { _light = new osg::Light; + _light->setThreadSafeRefUnref(true); _light->setLightNum(0); _light->setAmbient(Vec4(0.00f,0.0f,0.00f,1.0f)); _light->setDiffuse(Vec4(0.8f,0.8f,0.8f,1.0f));