From 053a3caf7bdd2a9726f88689fe11c8a4be90d65d Mon Sep 17 00:00:00 2001 From: elsid Date: Sat, 9 Sep 2023 19:29:26 +0200 Subject: [PATCH] Pass cache expiry delay to GenericResourceManager constructor --- apps/bulletobjecttool/main.cpp | 7 ++++--- apps/navmeshtool/main.cpp | 8 +++++--- apps/opencs/model/world/data.cpp | 6 ++++-- apps/opencs/view/render/cell.cpp | 3 ++- apps/openmw/engine.cpp | 2 +- apps/openmw/mwphysics/physicssystem.cpp | 5 +++-- apps/openmw/mwrender/groundcover.cpp | 3 ++- apps/openmw/mwrender/landmanager.cpp | 3 ++- apps/openmw/mwrender/objectpaging.cpp | 4 ++-- apps/openmw_test_suite/fx/technique.cpp | 2 +- apps/openmw_test_suite/nifosg/testnifloader.cpp | 2 +- components/resource/bulletshapemanager.cpp | 4 ++-- components/resource/bulletshapemanager.hpp | 3 ++- components/resource/imagemanager.cpp | 4 ++-- components/resource/imagemanager.hpp | 2 +- components/resource/keyframemanager.cpp | 4 ++-- components/resource/keyframemanager.hpp | 2 +- components/resource/resourcemanager.hpp | 10 +--------- components/resource/resourcesystem.cpp | 8 ++++---- components/resource/resourcesystem.hpp | 2 +- components/resource/scenemanager.cpp | 6 +++--- components/resource/scenemanager.hpp | 4 ++-- components/terrain/chunkmanager.cpp | 4 ++-- components/terrain/chunkmanager.hpp | 4 ++-- components/terrain/terraingrid.cpp | 5 +++-- components/terrain/terraingrid.hpp | 6 +++--- components/terrain/texturemanager.cpp | 4 ++-- components/terrain/texturemanager.hpp | 2 +- components/terrain/world.cpp | 9 +++++---- components/terrain/world.hpp | 5 +++-- 30 files changed, 69 insertions(+), 64 deletions(-) diff --git a/apps/bulletobjecttool/main.cpp b/apps/bulletobjecttool/main.cpp index d52d278f9e..c522d69d70 100644 --- a/apps/bulletobjecttool/main.cpp +++ b/apps/bulletobjecttool/main.cpp @@ -172,10 +172,11 @@ namespace const EsmLoader::EsmData esmData = EsmLoader::loadEsmData(query, contentFiles, fileCollections, readers, &encoder); - Resource::ImageManager imageManager(&vfs); + constexpr double expiryDelay = 0; + Resource::ImageManager imageManager(&vfs, expiryDelay); Resource::NifFileManager nifFileManager(&vfs); - Resource::SceneManager sceneManager(&vfs, &imageManager, &nifFileManager); - Resource::BulletShapeManager bulletShapeManager(&vfs, &sceneManager, &nifFileManager); + Resource::SceneManager sceneManager(&vfs, &imageManager, &nifFileManager, expiryDelay); + Resource::BulletShapeManager bulletShapeManager(&vfs, &sceneManager, &nifFileManager, expiryDelay); Resource::forEachBulletObject( readers, vfs, bulletShapeManager, esmData, [](const ESM::Cell& cell, const Resource::BulletObject& object) { diff --git a/apps/navmeshtool/main.cpp b/apps/navmeshtool/main.cpp index 86ff8c3ddb..f82bd09f9e 100644 --- a/apps/navmeshtool/main.cpp +++ b/apps/navmeshtool/main.cpp @@ -218,10 +218,12 @@ namespace NavMeshTool const EsmLoader::EsmData esmData = EsmLoader::loadEsmData(query, contentFiles, fileCollections, readers, &encoder); - Resource::ImageManager imageManager(&vfs); + constexpr double expiryDelay = 0; + + Resource::ImageManager imageManager(&vfs, expiryDelay); Resource::NifFileManager nifFileManager(&vfs); - Resource::SceneManager sceneManager(&vfs, &imageManager, &nifFileManager); - Resource::BulletShapeManager bulletShapeManager(&vfs, &sceneManager, &nifFileManager); + Resource::SceneManager sceneManager(&vfs, &imageManager, &nifFileManager, expiryDelay); + Resource::BulletShapeManager bulletShapeManager(&vfs, &sceneManager, &nifFileManager, expiryDelay); DetourNavigator::RecastGlobalAllocator::init(); DetourNavigator::Settings navigatorSettings = DetourNavigator::makeSettingsFromSettingsManager(); navigatorSettings.mRecast.mSwimHeightScale diff --git a/apps/opencs/model/world/data.cpp b/apps/opencs/model/world/data.cpp index 07e9879795..e8fd138ab4 100644 --- a/apps/opencs/model/world/data.cpp +++ b/apps/opencs/model/world/data.cpp @@ -142,12 +142,14 @@ CSMWorld::Data::Data(ToUTF8::FromType encoding, const Files::PathContainer& data , mReaderIndex(1) , mDataPaths(dataPaths) , mArchives(archives) + , mVFS(std::make_unique()) { - mVFS = std::make_unique(); VFS::registerArchives(mVFS.get(), Files::Collections(mDataPaths), mArchives, true); mResourcesManager.setVFS(mVFS.get()); - mResourceSystem = std::make_unique(mVFS.get()); + + constexpr double expiryDelay = 0; + mResourceSystem = std::make_unique(mVFS.get(), expiryDelay); Shader::ShaderManager::DefineMap defines = mResourceSystem->getSceneManager()->getShaderManager().getGlobalDefines(); diff --git a/apps/opencs/view/render/cell.cpp b/apps/opencs/view/render/cell.cpp index 6238b40e72..c74782f2d1 100644 --- a/apps/opencs/view/render/cell.cpp +++ b/apps/opencs/view/render/cell.cpp @@ -146,8 +146,9 @@ void CSVRender::Cell::updateLand() } else { + constexpr double expiryDelay = 0; mTerrain = std::make_unique(mCellNode, mCellNode, mData.getResourceSystem().get(), - mTerrainStorage, Mask_Terrain, ESM::Cell::sDefaultWorldspaceId); + mTerrainStorage, Mask_Terrain, ESM::Cell::sDefaultWorldspaceId, expiryDelay); } mTerrain->loadCell(esmLand.mX, esmLand.mY); diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 3e7f151fad..b04d36f08f 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -645,7 +645,7 @@ void OMW::Engine::prepareEngine() VFS::registerArchives(mVFS.get(), mFileCollections, mArchives, true); - mResourceSystem = std::make_unique(mVFS.get()); + mResourceSystem = std::make_unique(mVFS.get(), Settings::cells().mCacheExpiryDelay); mResourceSystem->getSceneManager()->getShaderManager().setMaxTextureUnits(mGlMaxTextureImageUnits); mResourceSystem->getSceneManager()->setUnRefImageDataAfterApply( false); // keep to Off for now to allow better state sharing diff --git a/apps/openmw/mwphysics/physicssystem.cpp b/apps/openmw/mwphysics/physicssystem.cpp index 5f13fef571..2d756fedc8 100644 --- a/apps/openmw/mwphysics/physicssystem.cpp +++ b/apps/openmw/mwphysics/physicssystem.cpp @@ -94,8 +94,9 @@ namespace namespace MWPhysics { PhysicsSystem::PhysicsSystem(Resource::ResourceSystem* resourceSystem, osg::ref_ptr parentNode) - : mShapeManager(std::make_unique( - resourceSystem->getVFS(), resourceSystem->getSceneManager(), resourceSystem->getNifFileManager())) + : mShapeManager( + std::make_unique(resourceSystem->getVFS(), resourceSystem->getSceneManager(), + resourceSystem->getNifFileManager(), Settings::cells().mCacheExpiryDelay)) , mResourceSystem(resourceSystem) , mDebugDrawEnabled(false) , mTimeAccum(0.0f) diff --git a/apps/openmw/mwrender/groundcover.cpp b/apps/openmw/mwrender/groundcover.cpp index e00e3446a6..92be726f09 100644 --- a/apps/openmw/mwrender/groundcover.cpp +++ b/apps/openmw/mwrender/groundcover.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -327,7 +328,7 @@ namespace MWRender Groundcover::Groundcover( Resource::SceneManager* sceneManager, float density, float viewDistance, const MWWorld::GroundcoverStore& store) - : GenericResourceManager(nullptr) + : GenericResourceManager(nullptr, Settings::cells().mCacheExpiryDelay) , mSceneManager(sceneManager) , mDensity(density) , mStateset(new osg::StateSet) diff --git a/apps/openmw/mwrender/landmanager.cpp b/apps/openmw/mwrender/landmanager.cpp index 6ab9f12139..835fb9b204 100644 --- a/apps/openmw/mwrender/landmanager.cpp +++ b/apps/openmw/mwrender/landmanager.cpp @@ -3,6 +3,7 @@ #include #include +#include #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" @@ -12,7 +13,7 @@ namespace MWRender { LandManager::LandManager(int loadFlags) - : GenericResourceManager(nullptr) + : GenericResourceManager(nullptr, Settings::cells().mCacheExpiryDelay) , mLoadFlags(loadFlags) { } diff --git a/apps/openmw/mwrender/objectpaging.cpp b/apps/openmw/mwrender/objectpaging.cpp index c3c473de6b..3579badee2 100644 --- a/apps/openmw/mwrender/objectpaging.cpp +++ b/apps/openmw/mwrender/objectpaging.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include "apps/openmw/mwbase/environment.hpp" #include "apps/openmw/mwbase/world.hpp" @@ -454,7 +454,7 @@ namespace MWRender }; ObjectPaging::ObjectPaging(Resource::SceneManager* sceneManager, ESM::RefId worldspace) - : GenericResourceManager(nullptr) + : GenericResourceManager(nullptr, Settings::cells().mCacheExpiryDelay) , Terrain::QuadTreeWorld::ChunkManager(worldspace) , mSceneManager(sceneManager) , mRefTrackerLocked(false) diff --git a/apps/openmw_test_suite/fx/technique.cpp b/apps/openmw_test_suite/fx/technique.cpp index e59cca43cf..352dd9ca09 100644 --- a/apps/openmw_test_suite/fx/technique.cpp +++ b/apps/openmw_test_suite/fx/technique.cpp @@ -99,7 +99,7 @@ namespace { "shaders/missing_sampler_source.omwfx", &missing_sampler_source }, { "shaders/repeated_shared_block.omwfx", &repeated_shared_block }, })) - , mImageManager(mVFS.get()) + , mImageManager(mVFS.get(), 0) { } diff --git a/apps/openmw_test_suite/nifosg/testnifloader.cpp b/apps/openmw_test_suite/nifosg/testnifloader.cpp index 5c9caf4799..b8ef6ecacd 100644 --- a/apps/openmw_test_suite/nifosg/testnifloader.cpp +++ b/apps/openmw_test_suite/nifosg/testnifloader.cpp @@ -28,7 +28,7 @@ namespace struct BaseNifOsgLoaderTest { VFS::Manager mVfs; - Resource::ImageManager mImageManager{ &mVfs }; + Resource::ImageManager mImageManager{ &mVfs, 0 }; const osgDB::ReaderWriter* mReaderWriter = osgDB::Registry::instance()->getReaderWriterForExtension("osgt"); osg::ref_ptr mOptions = new osgDB::Options; diff --git a/components/resource/bulletshapemanager.cpp b/components/resource/bulletshapemanager.cpp index 0e2089cb06..f817d6b89a 100644 --- a/components/resource/bulletshapemanager.cpp +++ b/components/resource/bulletshapemanager.cpp @@ -98,8 +98,8 @@ namespace Resource }; BulletShapeManager::BulletShapeManager( - const VFS::Manager* vfs, SceneManager* sceneMgr, NifFileManager* nifFileManager) - : ResourceManager(vfs) + const VFS::Manager* vfs, SceneManager* sceneMgr, NifFileManager* nifFileManager, double expiryDelay) + : ResourceManager(vfs, expiryDelay) , mInstanceCache(new MultiObjectCache) , mSceneManager(sceneMgr) , mNifFileManager(nifFileManager) diff --git a/components/resource/bulletshapemanager.hpp b/components/resource/bulletshapemanager.hpp index 1b4ce849fe..a81296fdfd 100644 --- a/components/resource/bulletshapemanager.hpp +++ b/components/resource/bulletshapemanager.hpp @@ -25,7 +25,8 @@ namespace Resource class BulletShapeManager : public ResourceManager { public: - BulletShapeManager(const VFS::Manager* vfs, SceneManager* sceneMgr, NifFileManager* nifFileManager); + BulletShapeManager( + const VFS::Manager* vfs, SceneManager* sceneMgr, NifFileManager* nifFileManager, double expiryDelay); ~BulletShapeManager(); /// @note May return a null pointer if the object has no shape. diff --git a/components/resource/imagemanager.cpp b/components/resource/imagemanager.cpp index 178e681d4e..26fd60d7ea 100644 --- a/components/resource/imagemanager.cpp +++ b/components/resource/imagemanager.cpp @@ -46,8 +46,8 @@ namespace namespace Resource { - ImageManager::ImageManager(const VFS::Manager* vfs) - : ResourceManager(vfs) + ImageManager::ImageManager(const VFS::Manager* vfs, double expiryDelay) + : ResourceManager(vfs, expiryDelay) , mWarningImage(createWarningImage()) , mOptions(new osgDB::Options("dds_flip dds_dxt1_detect_rgba ignoreTga2Fields")) , mOptionsNoFlip(new osgDB::Options("dds_dxt1_detect_rgba ignoreTga2Fields")) diff --git a/components/resource/imagemanager.hpp b/components/resource/imagemanager.hpp index ddb2fcc00c..2fad70d576 100644 --- a/components/resource/imagemanager.hpp +++ b/components/resource/imagemanager.hpp @@ -23,7 +23,7 @@ namespace Resource class ImageManager : public ResourceManager { public: - ImageManager(const VFS::Manager* vfs); + explicit ImageManager(const VFS::Manager* vfs, double expiryDelay); ~ImageManager(); /// Create or retrieve an Image diff --git a/components/resource/keyframemanager.cpp b/components/resource/keyframemanager.cpp index 8820469e87..574d761d09 100644 --- a/components/resource/keyframemanager.cpp +++ b/components/resource/keyframemanager.cpp @@ -207,8 +207,8 @@ namespace Resource namespace Resource { - KeyframeManager::KeyframeManager(const VFS::Manager* vfs, SceneManager* sceneManager) - : ResourceManager(vfs) + KeyframeManager::KeyframeManager(const VFS::Manager* vfs, SceneManager* sceneManager, double expiryDelay) + : ResourceManager(vfs, expiryDelay) , mSceneManager(sceneManager) { } diff --git a/components/resource/keyframemanager.hpp b/components/resource/keyframemanager.hpp index d075e65d4c..0c92553949 100644 --- a/components/resource/keyframemanager.hpp +++ b/components/resource/keyframemanager.hpp @@ -48,7 +48,7 @@ namespace Resource class KeyframeManager : public ResourceManager { public: - KeyframeManager(const VFS::Manager* vfs, SceneManager* sceneManager); + explicit KeyframeManager(const VFS::Manager* vfs, SceneManager* sceneManager, double expiryDelay); ~KeyframeManager() = default; /// Retrieve a read-only keyframe resource by name (case-insensitive). diff --git a/components/resource/resourcemanager.hpp b/components/resource/resourcemanager.hpp index 09b99faf28..55e4e142b5 100644 --- a/components/resource/resourcemanager.hpp +++ b/components/resource/resourcemanager.hpp @@ -3,8 +3,6 @@ #include -#include - #include "objectcache.hpp" namespace VFS @@ -41,8 +39,7 @@ namespace Resource public: typedef GenericObjectCache CacheType; - explicit GenericResourceManager( - const VFS::Manager* vfs, double expiryDelay = Settings::cells().mCacheExpiryDelay) + explicit GenericResourceManager(const VFS::Manager* vfs, double expiryDelay) : mVFS(vfs) , mCache(new CacheType) , mExpiryDelay(expiryDelay) @@ -80,11 +77,6 @@ namespace Resource class ResourceManager : public GenericResourceManager { public: - explicit ResourceManager(const VFS::Manager* vfs) - : GenericResourceManager(vfs) - { - } - explicit ResourceManager(const VFS::Manager* vfs, double expiryDelay) : GenericResourceManager(vfs, expiryDelay) { diff --git a/components/resource/resourcesystem.cpp b/components/resource/resourcesystem.cpp index 1f3f6bf198..0bee08e9ac 100644 --- a/components/resource/resourcesystem.cpp +++ b/components/resource/resourcesystem.cpp @@ -10,13 +10,13 @@ namespace Resource { - ResourceSystem::ResourceSystem(const VFS::Manager* vfs) + ResourceSystem::ResourceSystem(const VFS::Manager* vfs, double expiryDelay) : mVFS(vfs) { mNifFileManager = std::make_unique(vfs); - mImageManager = std::make_unique(vfs); - mSceneManager = std::make_unique(vfs, mImageManager.get(), mNifFileManager.get()); - mKeyframeManager = std::make_unique(vfs, mSceneManager.get()); + mImageManager = std::make_unique(vfs, expiryDelay); + mSceneManager = std::make_unique(vfs, mImageManager.get(), mNifFileManager.get(), expiryDelay); + mKeyframeManager = std::make_unique(vfs, mSceneManager.get(), expiryDelay); addResourceManager(mNifFileManager.get()); addResourceManager(mKeyframeManager.get()); diff --git a/components/resource/resourcesystem.hpp b/components/resource/resourcesystem.hpp index 72440d17ee..d06ac79640 100644 --- a/components/resource/resourcesystem.hpp +++ b/components/resource/resourcesystem.hpp @@ -30,7 +30,7 @@ namespace Resource class ResourceSystem { public: - ResourceSystem(const VFS::Manager* vfs); + explicit ResourceSystem(const VFS::Manager* vfs, double expiryDelay); ~ResourceSystem(); SceneManager* getSceneManager(); diff --git a/components/resource/scenemanager.cpp b/components/resource/scenemanager.cpp index 78b2d5165a..dde39c5d65 100644 --- a/components/resource/scenemanager.cpp +++ b/components/resource/scenemanager.cpp @@ -352,9 +352,9 @@ namespace Resource std::vector> mRigGeometryHolders; }; - SceneManager::SceneManager( - const VFS::Manager* vfs, Resource::ImageManager* imageManager, Resource::NifFileManager* nifFileManager) - : ResourceManager(vfs) + SceneManager::SceneManager(const VFS::Manager* vfs, Resource::ImageManager* imageManager, + Resource::NifFileManager* nifFileManager, double expiryDelay) + : ResourceManager(vfs, expiryDelay) , mShaderManager(new Shader::ShaderManager) , mForceShaders(false) , mClampLighting(true) diff --git a/components/resource/scenemanager.hpp b/components/resource/scenemanager.hpp index 54643b561d..e8a9640ce9 100644 --- a/components/resource/scenemanager.hpp +++ b/components/resource/scenemanager.hpp @@ -89,8 +89,8 @@ namespace Resource class SceneManager : public ResourceManager { public: - SceneManager( - const VFS::Manager* vfs, Resource::ImageManager* imageManager, Resource::NifFileManager* nifFileManager); + explicit SceneManager(const VFS::Manager* vfs, Resource::ImageManager* imageManager, + Resource::NifFileManager* nifFileManager, double expiryDelay); ~SceneManager(); Shader::ShaderManager& getShaderManager(); diff --git a/components/terrain/chunkmanager.cpp b/components/terrain/chunkmanager.cpp index 6273041f72..8df5dc3a77 100644 --- a/components/terrain/chunkmanager.cpp +++ b/components/terrain/chunkmanager.cpp @@ -20,8 +20,8 @@ namespace Terrain { ChunkManager::ChunkManager(Storage* storage, Resource::SceneManager* sceneMgr, TextureManager* textureManager, - CompositeMapRenderer* renderer, ESM::RefId worldspace) - : GenericResourceManager(nullptr) + CompositeMapRenderer* renderer, ESM::RefId worldspace, double expiryDelay) + : GenericResourceManager(nullptr, expiryDelay) , QuadTreeWorld::ChunkManager(worldspace) , mStorage(storage) , mSceneManager(sceneMgr) diff --git a/components/terrain/chunkmanager.hpp b/components/terrain/chunkmanager.hpp index a55dd15cc1..20d6ba9327 100644 --- a/components/terrain/chunkmanager.hpp +++ b/components/terrain/chunkmanager.hpp @@ -75,8 +75,8 @@ namespace Terrain class ChunkManager : public Resource::GenericResourceManager, public QuadTreeWorld::ChunkManager { public: - ChunkManager(Storage* storage, Resource::SceneManager* sceneMgr, TextureManager* textureManager, - CompositeMapRenderer* renderer, ESM::RefId worldspace); + explicit ChunkManager(Storage* storage, Resource::SceneManager* sceneMgr, TextureManager* textureManager, + CompositeMapRenderer* renderer, ESM::RefId worldspace, double expiryDelay); osg::ref_ptr getChunk(float size, const osg::Vec2f& center, unsigned char lod, unsigned int lodFlags, bool activeGrid, const osg::Vec3f& viewPoint, bool compile) override; diff --git a/components/terrain/terraingrid.cpp b/components/terrain/terraingrid.cpp index cdbfdea723..2849c4d401 100644 --- a/components/terrain/terraingrid.cpp +++ b/components/terrain/terraingrid.cpp @@ -23,9 +23,10 @@ namespace Terrain }; TerrainGrid::TerrainGrid(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem, - Storage* storage, unsigned int nodeMask, ESM::RefId worldspace, unsigned int preCompileMask, + Storage* storage, unsigned int nodeMask, ESM::RefId worldspace, double expiryDelay, unsigned int preCompileMask, unsigned int borderMask) - : Terrain::World(parent, compileRoot, resourceSystem, storage, nodeMask, preCompileMask, borderMask, worldspace) + : Terrain::World( + parent, compileRoot, resourceSystem, storage, nodeMask, preCompileMask, borderMask, worldspace, expiryDelay) , mNumSplits(4) { } diff --git a/components/terrain/terraingrid.hpp b/components/terrain/terraingrid.hpp index 5204af7093..8483338f23 100644 --- a/components/terrain/terraingrid.hpp +++ b/components/terrain/terraingrid.hpp @@ -26,9 +26,9 @@ namespace Terrain class TerrainGrid : public Terrain::World { public: - TerrainGrid(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem, - Storage* storage, unsigned int nodeMask, ESM::RefId worldspace, unsigned int preCompileMask = ~0u, - unsigned int borderMask = 0); + explicit TerrainGrid(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem, + Storage* storage, unsigned int nodeMask, ESM::RefId worldspace, double expiryDelay, + unsigned int preCompileMask = ~0u, unsigned int borderMask = 0); TerrainGrid(osg::Group* parent, Storage* storage, ESM::RefId worldspace, unsigned int nodeMask = ~0u); ~TerrainGrid(); diff --git a/components/terrain/texturemanager.cpp b/components/terrain/texturemanager.cpp index ff4a84707e..360d87bf48 100644 --- a/components/terrain/texturemanager.cpp +++ b/components/terrain/texturemanager.cpp @@ -10,8 +10,8 @@ namespace Terrain { - TextureManager::TextureManager(Resource::SceneManager* sceneMgr) - : ResourceManager(sceneMgr->getVFS()) + TextureManager::TextureManager(Resource::SceneManager* sceneMgr, double expiryDelay) + : ResourceManager(sceneMgr->getVFS(), expiryDelay) , mSceneManager(sceneMgr) { } diff --git a/components/terrain/texturemanager.hpp b/components/terrain/texturemanager.hpp index ae3e41f138..96fb43abfa 100644 --- a/components/terrain/texturemanager.hpp +++ b/components/terrain/texturemanager.hpp @@ -21,7 +21,7 @@ namespace Terrain class TextureManager : public Resource::ResourceManager { public: - TextureManager(Resource::SceneManager* sceneMgr); + explicit TextureManager(Resource::SceneManager* sceneMgr, double expiryDelay); void updateTextureFiltering(); diff --git a/components/terrain/world.cpp b/components/terrain/world.cpp index 98ce982285..93a9c563af 100644 --- a/components/terrain/world.cpp +++ b/components/terrain/world.cpp @@ -5,6 +5,7 @@ #include #include +#include #include "chunkmanager.hpp" #include "compositemaprenderer.hpp" @@ -17,7 +18,7 @@ namespace Terrain World::World(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem, Storage* storage, unsigned int nodeMask, unsigned int preCompileMask, unsigned int borderMask, - ESM::RefId worldspace) + ESM::RefId worldspace, double expiryDelay) : mStorage(storage) , mParent(parent) , mResourceSystem(resourceSystem) @@ -45,9 +46,9 @@ namespace Terrain mParent->addChild(mTerrainRoot); - mTextureManager = std::make_unique(mResourceSystem->getSceneManager()); - mChunkManager = std::make_unique( - mStorage, mResourceSystem->getSceneManager(), mTextureManager.get(), mCompositeMapRenderer, mWorldspace); + mTextureManager = std::make_unique(mResourceSystem->getSceneManager(), expiryDelay); + mChunkManager = std::make_unique(mStorage, mResourceSystem->getSceneManager(), + mTextureManager.get(), mCompositeMapRenderer, mWorldspace, expiryDelay); mChunkManager->setNodeMask(nodeMask); mCellBorder = std::make_unique(this, mTerrainRoot.get(), borderMask, mResourceSystem->getSceneManager()); diff --git a/components/terrain/world.hpp b/components/terrain/world.hpp index 16b39c1385..63b920146b 100644 --- a/components/terrain/world.hpp +++ b/components/terrain/world.hpp @@ -49,8 +49,9 @@ namespace Terrain /// @param storage Storage instance to get terrain data from (heights, normals, colors, textures..) /// @param nodeMask mask for the terrain root /// @param preCompileMask mask for pre compiling textures - World(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem, Storage* storage, - unsigned int nodeMask, unsigned int preCompileMask, unsigned int borderMask, ESM::RefId worldspace); + explicit World(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem, + Storage* storage, unsigned int nodeMask, unsigned int preCompileMask, unsigned int borderMask, + ESM::RefId worldspace, double expiryDelay); World(osg::Group* parent, Storage* storage, unsigned int nodeMask, ESM::RefId worldspace); virtual ~World();