1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 18:29:55 +00:00

Remove unnecessary code

This commit is contained in:
alekulyn 2023-12-27 22:30:04 -06:00
parent 310b8206dd
commit f71862fb76
2 changed files with 4 additions and 15 deletions

View file

@ -43,12 +43,10 @@ namespace Terrain
mImmediateCompileSet.erase(node); mImmediateCompileSet.erase(node);
mMutex.unlock(); mMutex.unlock();
compile(*node, renderInfo, nullptr); compile(*node, renderInfo);
mMutex.lock(); mMutex.lock();
} }
double timeLeft = availableTime;
const auto deadline = std::chrono::steady_clock::now() + std::chrono::duration<double>(availableTime); const auto deadline = std::chrono::steady_clock::now() + std::chrono::duration<double>(availableTime);
while (!mCompileSet.empty() && std::chrono::steady_clock::now() < deadline) while (!mCompileSet.empty() && std::chrono::steady_clock::now() < deadline)
{ {
@ -56,7 +54,7 @@ namespace Terrain
mCompileSet.erase(node); mCompileSet.erase(node);
mMutex.unlock(); mMutex.unlock();
compile(*node, renderInfo, &timeLeft); compile(*node, renderInfo);
mMutex.lock(); mMutex.lock();
if (node->mCompiled < node->mDrawables.size()) if (node->mCompiled < node->mDrawables.size())
@ -69,7 +67,7 @@ namespace Terrain
mTimer.setStartTick(); mTimer.setStartTick();
} }
void CompositeMapRenderer::compile(CompositeMap& compositeMap, osg::RenderInfo& renderInfo, double* timeLeft) const void CompositeMapRenderer::compile(CompositeMap& compositeMap, osg::RenderInfo& renderInfo) const
{ {
// if there are no more external references we can assume the texture is no longer required // if there are no more external references we can assume the texture is no longer required
if (compositeMap.mTexture->referenceCount() <= 1) if (compositeMap.mTexture->referenceCount() <= 1)
@ -125,15 +123,6 @@ namespace Terrain
++compositeMap.mCompiled; ++compositeMap.mCompiled;
compositeMap.mDrawables[i] = nullptr; compositeMap.mDrawables[i] = nullptr;
if (timeLeft)
{
*timeLeft -= timer.time_s();
timer.setStartTick();
if (*timeLeft <= 0)
break;
}
} }
if (compositeMap.mCompiled == compositeMap.mDrawables.size()) if (compositeMap.mCompiled == compositeMap.mDrawables.size())
compositeMap.mDrawables = std::vector<osg::ref_ptr<osg::Drawable>>(); compositeMap.mDrawables = std::vector<osg::ref_ptr<osg::Drawable>>();

View file

@ -38,7 +38,7 @@ namespace Terrain
void drawImplementation(osg::RenderInfo& renderInfo) const override; void drawImplementation(osg::RenderInfo& renderInfo) const override;
void compile(CompositeMap& compositeMap, osg::RenderInfo& renderInfo, double* timeLeft) const; void compile(CompositeMap& compositeMap, osg::RenderInfo& renderInfo) const;
/// Set the available time in seconds for compiling (non-immediate) composite maps each frame /// Set the available time in seconds for compiling (non-immediate) composite maps each frame
void setMinimumTimeAvailableForCompile(double time); void setMinimumTimeAvailableForCompile(double time);