mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-20 06:40:09 +00:00
Improve performance of loading screen by not recomputing the bounding sphere of the entire scene after each loading step
This commit is contained in:
parent
30b101b175
commit
c58fc6d276
@ -123,6 +123,12 @@ namespace MWGui
|
||||
int mWidth, mHeight;
|
||||
};
|
||||
|
||||
class DontComputeBoundCallback : public osg::Node::ComputeBoundingSphereCallback
|
||||
{
|
||||
public:
|
||||
virtual osg::BoundingSphere computeBound(const osg::Node&) const { return osg::BoundingSphere(); }
|
||||
};
|
||||
|
||||
void LoadingScreen::loadingOn()
|
||||
{
|
||||
mLoadingOnTime = mTimer.time_m();
|
||||
@ -136,6 +142,10 @@ namespace MWGui
|
||||
mViewer->getIncrementalCompileOperation()->setTargetFrameRate(mTargetFrameRate);
|
||||
}
|
||||
|
||||
// Assign dummy bounding sphere callback to avoid the bounding sphere of the entire scene being recomputed after each frame of loading
|
||||
// We are already using node masks to avoid the scene from being updated/rendered, but node masks don't work for computeBound()
|
||||
mViewer->getSceneData()->setComputeBoundingSphereCallback(new DontComputeBoundCallback);
|
||||
|
||||
bool showWallpaper = (MWBase::Environment::get().getStateManager()->getState()
|
||||
== MWBase::StateManager::State_NoGame);
|
||||
|
||||
@ -192,6 +202,9 @@ namespace MWGui
|
||||
else
|
||||
mImportantLabel = false; // label was already shown on loading screen
|
||||
|
||||
mViewer->getSceneData()->setComputeBoundingSphereCallback(NULL);
|
||||
mViewer->getSceneData()->dirtyBound();
|
||||
|
||||
//std::cout << "loading took " << mTimer.time_m() - mLoadingOnTime << std::endl;
|
||||
setVisible(false);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user