Added a local implementation of SlideEventHandler::checkNeedToDoFrame() so that Present3D can toggle on/off the need for continuous rendering to only slides that require it,

enabling slides with no animation to sit iddle rather keeping rendering, reducing CPU/GPU overhead and saving power.
This commit is contained in:
Robert Osfield
2016-03-10 16:35:08 +00:00
parent 1f5b7855eb
commit 68430ee8e5
4 changed files with 50 additions and 5 deletions

View File

@@ -1655,3 +1655,41 @@ void SlideEventHandler::setRequestReload(bool flag)
_requestReload = flag;
}
bool SlideEventHandler::checkNeedToDoFrame()
{
if (_viewer.valid())
{
if (_viewer->getRequestRedraw()) return true;
if (_viewer->getRequestContinousUpdate()) return true;
// If the database pager is going to update the scene the render flag is
// set so that the updates show up
if(_viewer->getDatabasePager()->requiresUpdateSceneGraph() || _viewer->getDatabasePager()->getRequestsInProgress()) return true;
// if there update callbacks then we need to do frame.
if (_viewer->getCamera()->getUpdateCallback()) return true;
if (!_pause)
{
if (_slideSwitch.valid() && _activeLayer<static_cast<int>(_slideSwitch->getNumChildren()))
{
if (_slideSwitch->getChild(_activeLayer)->getNumChildrenRequiringUpdateTraversal()>0) return true;
}
else if (_viewer->getSceneData()!=0 && _viewer->getSceneData()->getNumChildrenRequiringUpdateTraversal()>0) return true;
}
// check if events are available and need processing
if (_viewer->checkEvents()) return true;
// now check if any of the event handles have prompted a redraw.
if (_viewer->getRequestRedraw()) return true;
if (_viewer->getRequestContinousUpdate()) return true;
return false;
}
else
{
return true;
}
}