Introduced use of MarkerObject to IncrmentalCompileOperation/DatabasePager as a way of marking objects that have already been processed and compiled,

thus avoid potential threading conflicts when paged subgraphs are reused.


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14470 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield
2014-11-06 10:40:54 +00:00
parent 7f592b7ad5
commit a84df15c0a
6 changed files with 114 additions and 60 deletions

View File

@@ -269,6 +269,19 @@ T* cloneType(const T* t)
}
}
/** DummyObject that can be used as placeholder but otherwise has no other functionality.*/
class DummyObject : public osg::Object
{
public:
DummyObject() {}
DummyObject(const DummyObject& dummy, const osg::CopyOp& copyop) {}
META_Object(osg, DummyObject)
protected:
virtual ~DummyObject() {}
};
}
#endif

View File

@@ -286,6 +286,9 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
virtual bool containsPagedLOD(const osg::observer_ptr<osg::PagedLOD>& plod) const = 0;
};
void setMarkerObject(osg::Object* mo) { _markerObject = mo; }
osg::Object* getMarkerObject() { return _markerObject.get(); }
const osg::Object* getMarkerObject() const { return _markerObject.get(); }
protected:
@@ -469,6 +472,8 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
double _maximumTimeToMergeTile;
double _totalTimeToMergeTiles;
unsigned int _numTilesMerges;
osg::ref_ptr<osg::Object> _markerObject;
};
}

View File

@@ -24,7 +24,7 @@ class OSGUTIL_EXPORT StateToCompile : public osg::NodeVisitor
{
public:
StateToCompile(GLObjectsVisitor::Mode mode);
StateToCompile(GLObjectsVisitor::Mode mode, osg::Object* markerObject=0);
typedef std::set<osg::Drawable*> DrawableSet;
typedef std::set<osg::StateSet*> StateSetSet;
@@ -40,6 +40,7 @@ class OSGUTIL_EXPORT StateToCompile : public osg::NodeVisitor
ProgramSet _programs;
bool _assignPBOToImages;
osg::ref_ptr<osg::PixelBufferObject> _pbo;
osg::ref_ptr<osg::Object> _markerObject;
bool empty() const { return _textures.empty() && _programs.empty() && _drawables.empty(); }
@@ -290,6 +291,10 @@ class OSGUTIL_EXPORT IncrementalCompileOperation : public osg::GraphicsOperation
OpenThreads::Mutex* getCompiledMutex() { return &_compiledMutex; }
CompileSets& getCompiled() { return _compiled; }
void setMarkerObject(osg::Object* mo) { _markerObject = mo; }
osg::Object* getMarkerObject() { return _markerObject.get(); }
const osg::Object* getMarkerObject() const { return _markerObject.get(); }
protected:
virtual ~IncrementalCompileOperation();
@@ -315,6 +320,8 @@ class OSGUTIL_EXPORT IncrementalCompileOperation : public osg::GraphicsOperation
ContextSet _contexts;
osg::ref_ptr<osg::Object> _markerObject;
};
}