|
|
|
@ -6,6 +6,9 @@
|
|
|
|
|
#include <osg/Texture2D>
|
|
|
|
|
#include <osg/RenderInfo>
|
|
|
|
|
|
|
|
|
|
#include <components/sceneutil/unrefqueue.hpp>
|
|
|
|
|
#include <components/sceneutil/workqueue.hpp>
|
|
|
|
|
|
|
|
|
|
#include <algorithm>
|
|
|
|
|
|
|
|
|
|
namespace Terrain
|
|
|
|
@ -20,9 +23,20 @@ CompositeMapRenderer::CompositeMapRenderer()
|
|
|
|
|
|
|
|
|
|
mFBO = new osg::FrameBufferObject;
|
|
|
|
|
|
|
|
|
|
mUnrefQueue = new SceneUtil::UnrefQueue;
|
|
|
|
|
|
|
|
|
|
getOrCreateStateSet()->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CompositeMapRenderer::~CompositeMapRenderer()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CompositeMapRenderer::setWorkQueue(SceneUtil::WorkQueue* workQueue)
|
|
|
|
|
{
|
|
|
|
|
mWorkQueue = workQueue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CompositeMapRenderer::drawImplementation(osg::RenderInfo &renderInfo) const
|
|
|
|
|
{
|
|
|
|
|
double dt = mTimer.time_s();
|
|
|
|
@ -35,6 +49,9 @@ void CompositeMapRenderer::drawImplementation(osg::RenderInfo &renderInfo) const
|
|
|
|
|
|
|
|
|
|
mCompiled.clear();
|
|
|
|
|
|
|
|
|
|
if (mWorkQueue)
|
|
|
|
|
mUnrefQueue->flush(mWorkQueue.get());
|
|
|
|
|
|
|
|
|
|
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mMutex);
|
|
|
|
|
|
|
|
|
|
if (mImmediateCompileSet.empty() && mCompileSet.empty())
|
|
|
|
@ -122,6 +139,10 @@ void CompositeMapRenderer::compile(CompositeMap &compositeMap, osg::RenderInfo &
|
|
|
|
|
|
|
|
|
|
++compositeMap.mCompiled;
|
|
|
|
|
|
|
|
|
|
if (mWorkQueue)
|
|
|
|
|
{
|
|
|
|
|
mUnrefQueue->push(compositeMap.mDrawables[i]);
|
|
|
|
|
}
|
|
|
|
|
compositeMap.mDrawables[i] = nullptr;
|
|
|
|
|
|
|
|
|
|
if (timeLeft)
|
|
|
|
|