Removed old hack to disable multi-threaded cameras when particle systems are present,
this is no longer required as osgParticle has now been made thread safe.
This commit is contained in:
@@ -457,38 +457,6 @@ bool OsgCameraGroup::realize( ThreadingModel thread_model )
|
||||
return realize();
|
||||
}
|
||||
|
||||
|
||||
// small visitor to check for the existance of particle systems,
|
||||
// which currently arn't thread safe, so we would need to disable
|
||||
// multithreading of cull and draw.
|
||||
class SearchForSpecialNodes : public osg::NodeVisitor
|
||||
{
|
||||
public:
|
||||
SearchForSpecialNodes():
|
||||
osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN),
|
||||
_foundParticles(false),
|
||||
_foundPagedLOD(false)
|
||||
{
|
||||
}
|
||||
|
||||
virtual void apply(osg::Node& node)
|
||||
{
|
||||
if (strcmp(node.libraryName(),"osgParticle")==0 && strcmp(node.className(),"PrecipitationEffect")!=0) _foundParticles = true;
|
||||
|
||||
if (!_foundParticles ||
|
||||
!_foundPagedLOD) traverse(node);
|
||||
}
|
||||
|
||||
virtual void apply(osg::PagedLOD& node)
|
||||
{
|
||||
_foundPagedLOD = true;
|
||||
apply((osg::Node&)node);
|
||||
}
|
||||
|
||||
bool _foundParticles;
|
||||
bool _foundPagedLOD;
|
||||
};
|
||||
|
||||
bool OsgCameraGroup::realize()
|
||||
{
|
||||
if( _initialized ) return _realized;
|
||||
@@ -669,23 +637,6 @@ bool OsgCameraGroup::realize()
|
||||
|
||||
setUpSceneViewsWithData();
|
||||
|
||||
// if we are multi-threaded check to see if particle exists in the scene
|
||||
// if so we need to disable multi-threading of cameras.
|
||||
if (_threadModel == Producer::CameraGroup::ThreadPerCamera)
|
||||
{
|
||||
if (getTopMostSceneData())
|
||||
{
|
||||
SearchForSpecialNodes sfsn;
|
||||
getTopMostSceneData()->accept(sfsn);
|
||||
if (sfsn._foundParticles)
|
||||
{
|
||||
osg::notify(osg::INFO)<<"Warning: disabling multi-threading of cull and draw"<<std::endl;
|
||||
osg::notify(osg::INFO)<<" to avoid threading problems in osgParticle."<<std::endl;
|
||||
_threadModel = Producer::CameraGroup::SingleThreaded;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// if we are still multi-thread check to make sure that no render surfaces
|
||||
// are shared and don't use shared contexts, if they do we need to
|
||||
|
||||
Reference in New Issue
Block a user