Further work on IncrementalCompileOperation

This commit is contained in:
Robert Osfield
2009-03-09 14:56:20 +00:00
parent 73c2615d17
commit 173357252b
2 changed files with 245 additions and 35 deletions

View File

@@ -153,20 +153,20 @@ class OSGUTIL_EXPORT IncrementalCompileOperation : public osg::GraphicsOperation
struct CompileData : public osg::Referenced
{
typedef std::list< osg::ref_ptr<osg::Texture> > Textures;
typedef std::list< osg::ref_ptr<osg::Drawable> > Drawables;
typedef std::list< osg::ref_ptr<osg::Texture> > Textures;
typedef std::list< osg::ref_ptr<osg::Program> > Programs;
bool empty() const { return _textures.empty() && _drawables.empty() && _programs.empty(); }
bool empty() const { return _drawables.empty() && _textures.empty() && _programs.empty(); }
Textures _textures;
Drawables _drawables;
Textures _textures;
Programs _programs;
};
class CompileSet;
typedef std::set<osg::GraphicsContext*> ContextSet;
typedef std::map<osg::GraphicsContext*, osg::ref_ptr<CompileData> > CompileMap;
typedef std::map<osg::GraphicsContext*, CompileData > CompileMap;
struct CompileCompletedCallback : public osg::Referenced
{
@@ -187,7 +187,18 @@ class OSGUTIL_EXPORT IncrementalCompileOperation : public osg::GraphicsOperation
_attachmentPoint(attachmentPoint),
_subgraphToCompile(subgraphToCompile) {}
void buildCompileMap(ContextSet& context);
void buildCompileMap(ContextSet& context, GLObjectsVisitor::Mode mode=GLObjectsVisitor::COMPILE_DISPLAY_LISTS|GLObjectsVisitor::COMPILE_STATE_ATTRIBUTES);
bool compileCompleted() const
{
for(CompileMap::const_iterator itr = _compileMap.begin();
itr != _compileMap.end();
++itr)
{
if (!(itr->second.empty())) return false;
}
return true;
}
osg::ref_ptr<osg::Group> _attachmentPoint;
osg::ref_ptr<osg::Node> _subgraphToCompile;
@@ -221,6 +232,9 @@ class OSGUTIL_EXPORT IncrementalCompileOperation : public osg::GraphicsOperation
protected:
virtual ~IncrementalCompileOperation();
// forward declare to keep within class namespace
class CollectStateToCompile;
OpenThreads::Mutex _toCompileMutex;