From f9082502f8a91132fe45ab9d3f632f865aa2a29d Mon Sep 17 00:00:00 2001 From: scrawl Date: Tue, 9 Feb 2016 01:02:40 +0100 Subject: [PATCH] Move construction of WorkQueue to RenderingManager --- apps/openmw/mwrender/renderingmanager.cpp | 7 +++++++ apps/openmw/mwrender/renderingmanager.hpp | 9 +++++++++ apps/openmw/mwworld/cellpreloader.cpp | 1 - apps/openmw/mwworld/scene.cpp | 1 + 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index 07b477c43..6ba30f32c 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include @@ -131,6 +132,7 @@ namespace MWRender : mViewer(viewer) , mRootNode(rootNode) , mResourceSystem(resourceSystem) + , mWorkQueue(new SceneUtil::WorkQueue) , mFogDepth(0.f) , mUnderwaterColor(fallback->getFallbackColour("Water_UnderwaterColor")) , mUnderwaterWeight(fallback->getFallbackFloat("Water_UnderwaterColorWeight")) @@ -231,6 +233,11 @@ namespace MWRender return mResourceSystem; } + SceneUtil::WorkQueue *RenderingManager::getWorkQueue() + { + return mWorkQueue.get(); + } + void RenderingManager::clearCache() { if (mTerrain.get()) diff --git a/apps/openmw/mwrender/renderingmanager.hpp b/apps/openmw/mwrender/renderingmanager.hpp index bc5db562c..8bc3a0a74 100644 --- a/apps/openmw/mwrender/renderingmanager.hpp +++ b/apps/openmw/mwrender/renderingmanager.hpp @@ -42,6 +42,11 @@ namespace Fallback class Map; } +namespace SceneUtil +{ + class WorkQueue; +} + namespace MWRender { @@ -65,6 +70,8 @@ namespace MWRender Resource::ResourceSystem* getResourceSystem(); + SceneUtil::WorkQueue* getWorkQueue(); + void clearCache(); double getReferenceTime() const; @@ -190,6 +197,8 @@ namespace MWRender osg::ref_ptr mLightRoot; Resource::ResourceSystem* mResourceSystem; + osg::ref_ptr mWorkQueue; + osg::ref_ptr mSunLight; std::auto_ptr mPathgrid; diff --git a/apps/openmw/mwworld/cellpreloader.cpp b/apps/openmw/mwworld/cellpreloader.cpp index 06216221b..2591e8c89 100644 --- a/apps/openmw/mwworld/cellpreloader.cpp +++ b/apps/openmw/mwworld/cellpreloader.cpp @@ -156,7 +156,6 @@ namespace MWWorld , mBulletShapeManager(bulletShapeManager) , mExpiryDelay(0.0) { - mWorkQueue = new SceneUtil::WorkQueue; } void CellPreloader::preload(CellStore *cell, double timestamp) diff --git a/apps/openmw/mwworld/scene.cpp b/apps/openmw/mwworld/scene.cpp index 321c1c622..2856c77e8 100644 --- a/apps/openmw/mwworld/scene.cpp +++ b/apps/openmw/mwworld/scene.cpp @@ -459,6 +459,7 @@ namespace MWWorld , mPreloadEnabled(Settings::Manager::getBool("preload enabled", "Cells")) { mPreloader.reset(new CellPreloader(rendering.getResourceSystem(), physics->getShapeManager())); + mPreloader->setWorkQueue(mRendering.getWorkQueue()); float cacheExpiryDelay = Settings::Manager::getFloat("cache expiry delay", "Cells"); rendering.getResourceSystem()->setExpiryDelay(cacheExpiryDelay);