From 11bee6ee356e7e2f9bb8746b29af7977921ae345 Mon Sep 17 00:00:00 2001 From: scrawl Date: Fri, 10 Mar 2017 21:46:51 +0100 Subject: [PATCH] Avoid compiling composite maps that are no longer referenced --- components/terrain/compositemaprenderer.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/components/terrain/compositemaprenderer.cpp b/components/terrain/compositemaprenderer.cpp index 49d72979f0..5300aac857 100644 --- a/components/terrain/compositemaprenderer.cpp +++ b/components/terrain/compositemaprenderer.cpp @@ -57,6 +57,13 @@ void CompositeMapRenderer::drawImplementation(osg::RenderInfo &renderInfo) const void CompositeMapRenderer::compile(CompositeMap &compositeMap, osg::RenderInfo &renderInfo, double* timeLeft) const { + // if there are no more external references we can assume the texture is no longer required + if (compositeMap.mTexture->referenceCount() <= 1) + { + compositeMap.mCompiled = compositeMap.mDrawables.size(); + return; + } + osg::Timer timer; osg::State& state = *renderInfo.getState(); osg::GLExtensions* ext = state.get();