mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 15:29:55 +00:00
Pass cache expiry delay to GenericResourceManager constructor
This commit is contained in:
parent
bcc3365766
commit
053a3caf7b
30 changed files with 69 additions and 64 deletions
|
@ -172,10 +172,11 @@ namespace
|
||||||
const EsmLoader::EsmData esmData
|
const EsmLoader::EsmData esmData
|
||||||
= EsmLoader::loadEsmData(query, contentFiles, fileCollections, readers, &encoder);
|
= 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::NifFileManager nifFileManager(&vfs);
|
||||||
Resource::SceneManager sceneManager(&vfs, &imageManager, &nifFileManager);
|
Resource::SceneManager sceneManager(&vfs, &imageManager, &nifFileManager, expiryDelay);
|
||||||
Resource::BulletShapeManager bulletShapeManager(&vfs, &sceneManager, &nifFileManager);
|
Resource::BulletShapeManager bulletShapeManager(&vfs, &sceneManager, &nifFileManager, expiryDelay);
|
||||||
|
|
||||||
Resource::forEachBulletObject(
|
Resource::forEachBulletObject(
|
||||||
readers, vfs, bulletShapeManager, esmData, [](const ESM::Cell& cell, const Resource::BulletObject& object) {
|
readers, vfs, bulletShapeManager, esmData, [](const ESM::Cell& cell, const Resource::BulletObject& object) {
|
||||||
|
|
|
@ -218,10 +218,12 @@ namespace NavMeshTool
|
||||||
const EsmLoader::EsmData esmData
|
const EsmLoader::EsmData esmData
|
||||||
= EsmLoader::loadEsmData(query, contentFiles, fileCollections, readers, &encoder);
|
= 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::NifFileManager nifFileManager(&vfs);
|
||||||
Resource::SceneManager sceneManager(&vfs, &imageManager, &nifFileManager);
|
Resource::SceneManager sceneManager(&vfs, &imageManager, &nifFileManager, expiryDelay);
|
||||||
Resource::BulletShapeManager bulletShapeManager(&vfs, &sceneManager, &nifFileManager);
|
Resource::BulletShapeManager bulletShapeManager(&vfs, &sceneManager, &nifFileManager, expiryDelay);
|
||||||
DetourNavigator::RecastGlobalAllocator::init();
|
DetourNavigator::RecastGlobalAllocator::init();
|
||||||
DetourNavigator::Settings navigatorSettings = DetourNavigator::makeSettingsFromSettingsManager();
|
DetourNavigator::Settings navigatorSettings = DetourNavigator::makeSettingsFromSettingsManager();
|
||||||
navigatorSettings.mRecast.mSwimHeightScale
|
navigatorSettings.mRecast.mSwimHeightScale
|
||||||
|
|
|
@ -142,12 +142,14 @@ CSMWorld::Data::Data(ToUTF8::FromType encoding, const Files::PathContainer& data
|
||||||
, mReaderIndex(1)
|
, mReaderIndex(1)
|
||||||
, mDataPaths(dataPaths)
|
, mDataPaths(dataPaths)
|
||||||
, mArchives(archives)
|
, mArchives(archives)
|
||||||
|
, mVFS(std::make_unique<VFS::Manager>())
|
||||||
{
|
{
|
||||||
mVFS = std::make_unique<VFS::Manager>();
|
|
||||||
VFS::registerArchives(mVFS.get(), Files::Collections(mDataPaths), mArchives, true);
|
VFS::registerArchives(mVFS.get(), Files::Collections(mDataPaths), mArchives, true);
|
||||||
|
|
||||||
mResourcesManager.setVFS(mVFS.get());
|
mResourcesManager.setVFS(mVFS.get());
|
||||||
mResourceSystem = std::make_unique<Resource::ResourceSystem>(mVFS.get());
|
|
||||||
|
constexpr double expiryDelay = 0;
|
||||||
|
mResourceSystem = std::make_unique<Resource::ResourceSystem>(mVFS.get(), expiryDelay);
|
||||||
|
|
||||||
Shader::ShaderManager::DefineMap defines
|
Shader::ShaderManager::DefineMap defines
|
||||||
= mResourceSystem->getSceneManager()->getShaderManager().getGlobalDefines();
|
= mResourceSystem->getSceneManager()->getShaderManager().getGlobalDefines();
|
||||||
|
|
|
@ -146,8 +146,9 @@ void CSVRender::Cell::updateLand()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
constexpr double expiryDelay = 0;
|
||||||
mTerrain = std::make_unique<Terrain::TerrainGrid>(mCellNode, mCellNode, mData.getResourceSystem().get(),
|
mTerrain = std::make_unique<Terrain::TerrainGrid>(mCellNode, mCellNode, mData.getResourceSystem().get(),
|
||||||
mTerrainStorage, Mask_Terrain, ESM::Cell::sDefaultWorldspaceId);
|
mTerrainStorage, Mask_Terrain, ESM::Cell::sDefaultWorldspaceId, expiryDelay);
|
||||||
}
|
}
|
||||||
|
|
||||||
mTerrain->loadCell(esmLand.mX, esmLand.mY);
|
mTerrain->loadCell(esmLand.mX, esmLand.mY);
|
||||||
|
|
|
@ -645,7 +645,7 @@ void OMW::Engine::prepareEngine()
|
||||||
|
|
||||||
VFS::registerArchives(mVFS.get(), mFileCollections, mArchives, true);
|
VFS::registerArchives(mVFS.get(), mFileCollections, mArchives, true);
|
||||||
|
|
||||||
mResourceSystem = std::make_unique<Resource::ResourceSystem>(mVFS.get());
|
mResourceSystem = std::make_unique<Resource::ResourceSystem>(mVFS.get(), Settings::cells().mCacheExpiryDelay);
|
||||||
mResourceSystem->getSceneManager()->getShaderManager().setMaxTextureUnits(mGlMaxTextureImageUnits);
|
mResourceSystem->getSceneManager()->getShaderManager().setMaxTextureUnits(mGlMaxTextureImageUnits);
|
||||||
mResourceSystem->getSceneManager()->setUnRefImageDataAfterApply(
|
mResourceSystem->getSceneManager()->setUnRefImageDataAfterApply(
|
||||||
false); // keep to Off for now to allow better state sharing
|
false); // keep to Off for now to allow better state sharing
|
||||||
|
|
|
@ -94,8 +94,9 @@ namespace
|
||||||
namespace MWPhysics
|
namespace MWPhysics
|
||||||
{
|
{
|
||||||
PhysicsSystem::PhysicsSystem(Resource::ResourceSystem* resourceSystem, osg::ref_ptr<osg::Group> parentNode)
|
PhysicsSystem::PhysicsSystem(Resource::ResourceSystem* resourceSystem, osg::ref_ptr<osg::Group> parentNode)
|
||||||
: mShapeManager(std::make_unique<Resource::BulletShapeManager>(
|
: mShapeManager(
|
||||||
resourceSystem->getVFS(), resourceSystem->getSceneManager(), resourceSystem->getNifFileManager()))
|
std::make_unique<Resource::BulletShapeManager>(resourceSystem->getVFS(), resourceSystem->getSceneManager(),
|
||||||
|
resourceSystem->getNifFileManager(), Settings::cells().mCacheExpiryDelay))
|
||||||
, mResourceSystem(resourceSystem)
|
, mResourceSystem(resourceSystem)
|
||||||
, mDebugDrawEnabled(false)
|
, mDebugDrawEnabled(false)
|
||||||
, mTimeAccum(0.0f)
|
, mTimeAccum(0.0f)
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include <components/misc/convert.hpp>
|
#include <components/misc/convert.hpp>
|
||||||
#include <components/sceneutil/lightmanager.hpp>
|
#include <components/sceneutil/lightmanager.hpp>
|
||||||
#include <components/sceneutil/nodecallback.hpp>
|
#include <components/sceneutil/nodecallback.hpp>
|
||||||
|
#include <components/settings/values.hpp>
|
||||||
#include <components/shader/shadermanager.hpp>
|
#include <components/shader/shadermanager.hpp>
|
||||||
#include <components/terrain/quadtreenode.hpp>
|
#include <components/terrain/quadtreenode.hpp>
|
||||||
|
|
||||||
|
@ -327,7 +328,7 @@ namespace MWRender
|
||||||
|
|
||||||
Groundcover::Groundcover(
|
Groundcover::Groundcover(
|
||||||
Resource::SceneManager* sceneManager, float density, float viewDistance, const MWWorld::GroundcoverStore& store)
|
Resource::SceneManager* sceneManager, float density, float viewDistance, const MWWorld::GroundcoverStore& store)
|
||||||
: GenericResourceManager<GroundcoverChunkId>(nullptr)
|
: GenericResourceManager<GroundcoverChunkId>(nullptr, Settings::cells().mCacheExpiryDelay)
|
||||||
, mSceneManager(sceneManager)
|
, mSceneManager(sceneManager)
|
||||||
, mDensity(density)
|
, mDensity(density)
|
||||||
, mStateset(new osg::StateSet)
|
, mStateset(new osg::StateSet)
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include <osg/Stats>
|
#include <osg/Stats>
|
||||||
|
|
||||||
#include <components/resource/objectcache.hpp>
|
#include <components/resource/objectcache.hpp>
|
||||||
|
#include <components/settings/values.hpp>
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/world.hpp"
|
||||||
|
@ -12,7 +13,7 @@ namespace MWRender
|
||||||
{
|
{
|
||||||
|
|
||||||
LandManager::LandManager(int loadFlags)
|
LandManager::LandManager(int loadFlags)
|
||||||
: GenericResourceManager<ESM::ExteriorCellLocation>(nullptr)
|
: GenericResourceManager<ESM::ExteriorCellLocation>(nullptr, Settings::cells().mCacheExpiryDelay)
|
||||||
, mLoadFlags(loadFlags)
|
, mLoadFlags(loadFlags)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
#include <components/sceneutil/morphgeometry.hpp>
|
#include <components/sceneutil/morphgeometry.hpp>
|
||||||
#include <components/sceneutil/riggeometry.hpp>
|
#include <components/sceneutil/riggeometry.hpp>
|
||||||
#include <components/sceneutil/riggeometryosgaextension.hpp>
|
#include <components/sceneutil/riggeometryosgaextension.hpp>
|
||||||
#include <components/settings/settings.hpp>
|
#include <components/settings/values.hpp>
|
||||||
|
|
||||||
#include "apps/openmw/mwbase/environment.hpp"
|
#include "apps/openmw/mwbase/environment.hpp"
|
||||||
#include "apps/openmw/mwbase/world.hpp"
|
#include "apps/openmw/mwbase/world.hpp"
|
||||||
|
@ -454,7 +454,7 @@ namespace MWRender
|
||||||
};
|
};
|
||||||
|
|
||||||
ObjectPaging::ObjectPaging(Resource::SceneManager* sceneManager, ESM::RefId worldspace)
|
ObjectPaging::ObjectPaging(Resource::SceneManager* sceneManager, ESM::RefId worldspace)
|
||||||
: GenericResourceManager<ChunkId>(nullptr)
|
: GenericResourceManager<ChunkId>(nullptr, Settings::cells().mCacheExpiryDelay)
|
||||||
, Terrain::QuadTreeWorld::ChunkManager(worldspace)
|
, Terrain::QuadTreeWorld::ChunkManager(worldspace)
|
||||||
, mSceneManager(sceneManager)
|
, mSceneManager(sceneManager)
|
||||||
, mRefTrackerLocked(false)
|
, mRefTrackerLocked(false)
|
||||||
|
|
|
@ -99,7 +99,7 @@ namespace
|
||||||
{ "shaders/missing_sampler_source.omwfx", &missing_sampler_source },
|
{ "shaders/missing_sampler_source.omwfx", &missing_sampler_source },
|
||||||
{ "shaders/repeated_shared_block.omwfx", &repeated_shared_block },
|
{ "shaders/repeated_shared_block.omwfx", &repeated_shared_block },
|
||||||
}))
|
}))
|
||||||
, mImageManager(mVFS.get())
|
, mImageManager(mVFS.get(), 0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ namespace
|
||||||
struct BaseNifOsgLoaderTest
|
struct BaseNifOsgLoaderTest
|
||||||
{
|
{
|
||||||
VFS::Manager mVfs;
|
VFS::Manager mVfs;
|
||||||
Resource::ImageManager mImageManager{ &mVfs };
|
Resource::ImageManager mImageManager{ &mVfs, 0 };
|
||||||
const osgDB::ReaderWriter* mReaderWriter = osgDB::Registry::instance()->getReaderWriterForExtension("osgt");
|
const osgDB::ReaderWriter* mReaderWriter = osgDB::Registry::instance()->getReaderWriterForExtension("osgt");
|
||||||
osg::ref_ptr<osgDB::Options> mOptions = new osgDB::Options;
|
osg::ref_ptr<osgDB::Options> mOptions = new osgDB::Options;
|
||||||
|
|
||||||
|
|
|
@ -98,8 +98,8 @@ namespace Resource
|
||||||
};
|
};
|
||||||
|
|
||||||
BulletShapeManager::BulletShapeManager(
|
BulletShapeManager::BulletShapeManager(
|
||||||
const VFS::Manager* vfs, SceneManager* sceneMgr, NifFileManager* nifFileManager)
|
const VFS::Manager* vfs, SceneManager* sceneMgr, NifFileManager* nifFileManager, double expiryDelay)
|
||||||
: ResourceManager(vfs)
|
: ResourceManager(vfs, expiryDelay)
|
||||||
, mInstanceCache(new MultiObjectCache)
|
, mInstanceCache(new MultiObjectCache)
|
||||||
, mSceneManager(sceneMgr)
|
, mSceneManager(sceneMgr)
|
||||||
, mNifFileManager(nifFileManager)
|
, mNifFileManager(nifFileManager)
|
||||||
|
|
|
@ -25,7 +25,8 @@ namespace Resource
|
||||||
class BulletShapeManager : public ResourceManager
|
class BulletShapeManager : public ResourceManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BulletShapeManager(const VFS::Manager* vfs, SceneManager* sceneMgr, NifFileManager* nifFileManager);
|
BulletShapeManager(
|
||||||
|
const VFS::Manager* vfs, SceneManager* sceneMgr, NifFileManager* nifFileManager, double expiryDelay);
|
||||||
~BulletShapeManager();
|
~BulletShapeManager();
|
||||||
|
|
||||||
/// @note May return a null pointer if the object has no shape.
|
/// @note May return a null pointer if the object has no shape.
|
||||||
|
|
|
@ -46,8 +46,8 @@ namespace
|
||||||
namespace Resource
|
namespace Resource
|
||||||
{
|
{
|
||||||
|
|
||||||
ImageManager::ImageManager(const VFS::Manager* vfs)
|
ImageManager::ImageManager(const VFS::Manager* vfs, double expiryDelay)
|
||||||
: ResourceManager(vfs)
|
: ResourceManager(vfs, expiryDelay)
|
||||||
, mWarningImage(createWarningImage())
|
, mWarningImage(createWarningImage())
|
||||||
, mOptions(new osgDB::Options("dds_flip dds_dxt1_detect_rgba ignoreTga2Fields"))
|
, mOptions(new osgDB::Options("dds_flip dds_dxt1_detect_rgba ignoreTga2Fields"))
|
||||||
, mOptionsNoFlip(new osgDB::Options("dds_dxt1_detect_rgba ignoreTga2Fields"))
|
, mOptionsNoFlip(new osgDB::Options("dds_dxt1_detect_rgba ignoreTga2Fields"))
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace Resource
|
||||||
class ImageManager : public ResourceManager
|
class ImageManager : public ResourceManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ImageManager(const VFS::Manager* vfs);
|
explicit ImageManager(const VFS::Manager* vfs, double expiryDelay);
|
||||||
~ImageManager();
|
~ImageManager();
|
||||||
|
|
||||||
/// Create or retrieve an Image
|
/// Create or retrieve an Image
|
||||||
|
|
|
@ -207,8 +207,8 @@ namespace Resource
|
||||||
namespace Resource
|
namespace Resource
|
||||||
{
|
{
|
||||||
|
|
||||||
KeyframeManager::KeyframeManager(const VFS::Manager* vfs, SceneManager* sceneManager)
|
KeyframeManager::KeyframeManager(const VFS::Manager* vfs, SceneManager* sceneManager, double expiryDelay)
|
||||||
: ResourceManager(vfs)
|
: ResourceManager(vfs, expiryDelay)
|
||||||
, mSceneManager(sceneManager)
|
, mSceneManager(sceneManager)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ namespace Resource
|
||||||
class KeyframeManager : public ResourceManager
|
class KeyframeManager : public ResourceManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
KeyframeManager(const VFS::Manager* vfs, SceneManager* sceneManager);
|
explicit KeyframeManager(const VFS::Manager* vfs, SceneManager* sceneManager, double expiryDelay);
|
||||||
~KeyframeManager() = default;
|
~KeyframeManager() = default;
|
||||||
|
|
||||||
/// Retrieve a read-only keyframe resource by name (case-insensitive).
|
/// Retrieve a read-only keyframe resource by name (case-insensitive).
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
|
|
||||||
#include <osg/ref_ptr>
|
#include <osg/ref_ptr>
|
||||||
|
|
||||||
#include <components/settings/values.hpp>
|
|
||||||
|
|
||||||
#include "objectcache.hpp"
|
#include "objectcache.hpp"
|
||||||
|
|
||||||
namespace VFS
|
namespace VFS
|
||||||
|
@ -41,8 +39,7 @@ namespace Resource
|
||||||
public:
|
public:
|
||||||
typedef GenericObjectCache<KeyType> CacheType;
|
typedef GenericObjectCache<KeyType> CacheType;
|
||||||
|
|
||||||
explicit GenericResourceManager(
|
explicit GenericResourceManager(const VFS::Manager* vfs, double expiryDelay)
|
||||||
const VFS::Manager* vfs, double expiryDelay = Settings::cells().mCacheExpiryDelay)
|
|
||||||
: mVFS(vfs)
|
: mVFS(vfs)
|
||||||
, mCache(new CacheType)
|
, mCache(new CacheType)
|
||||||
, mExpiryDelay(expiryDelay)
|
, mExpiryDelay(expiryDelay)
|
||||||
|
@ -80,11 +77,6 @@ namespace Resource
|
||||||
class ResourceManager : public GenericResourceManager<std::string>
|
class ResourceManager : public GenericResourceManager<std::string>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit ResourceManager(const VFS::Manager* vfs)
|
|
||||||
: GenericResourceManager<std::string>(vfs)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
explicit ResourceManager(const VFS::Manager* vfs, double expiryDelay)
|
explicit ResourceManager(const VFS::Manager* vfs, double expiryDelay)
|
||||||
: GenericResourceManager<std::string>(vfs, expiryDelay)
|
: GenericResourceManager<std::string>(vfs, expiryDelay)
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,13 +10,13 @@
|
||||||
namespace Resource
|
namespace Resource
|
||||||
{
|
{
|
||||||
|
|
||||||
ResourceSystem::ResourceSystem(const VFS::Manager* vfs)
|
ResourceSystem::ResourceSystem(const VFS::Manager* vfs, double expiryDelay)
|
||||||
: mVFS(vfs)
|
: mVFS(vfs)
|
||||||
{
|
{
|
||||||
mNifFileManager = std::make_unique<NifFileManager>(vfs);
|
mNifFileManager = std::make_unique<NifFileManager>(vfs);
|
||||||
mImageManager = std::make_unique<ImageManager>(vfs);
|
mImageManager = std::make_unique<ImageManager>(vfs, expiryDelay);
|
||||||
mSceneManager = std::make_unique<SceneManager>(vfs, mImageManager.get(), mNifFileManager.get());
|
mSceneManager = std::make_unique<SceneManager>(vfs, mImageManager.get(), mNifFileManager.get(), expiryDelay);
|
||||||
mKeyframeManager = std::make_unique<KeyframeManager>(vfs, mSceneManager.get());
|
mKeyframeManager = std::make_unique<KeyframeManager>(vfs, mSceneManager.get(), expiryDelay);
|
||||||
|
|
||||||
addResourceManager(mNifFileManager.get());
|
addResourceManager(mNifFileManager.get());
|
||||||
addResourceManager(mKeyframeManager.get());
|
addResourceManager(mKeyframeManager.get());
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace Resource
|
||||||
class ResourceSystem
|
class ResourceSystem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ResourceSystem(const VFS::Manager* vfs);
|
explicit ResourceSystem(const VFS::Manager* vfs, double expiryDelay);
|
||||||
~ResourceSystem();
|
~ResourceSystem();
|
||||||
|
|
||||||
SceneManager* getSceneManager();
|
SceneManager* getSceneManager();
|
||||||
|
|
|
@ -352,9 +352,9 @@ namespace Resource
|
||||||
std::vector<osg::ref_ptr<SceneUtil::RigGeometryHolder>> mRigGeometryHolders;
|
std::vector<osg::ref_ptr<SceneUtil::RigGeometryHolder>> mRigGeometryHolders;
|
||||||
};
|
};
|
||||||
|
|
||||||
SceneManager::SceneManager(
|
SceneManager::SceneManager(const VFS::Manager* vfs, Resource::ImageManager* imageManager,
|
||||||
const VFS::Manager* vfs, Resource::ImageManager* imageManager, Resource::NifFileManager* nifFileManager)
|
Resource::NifFileManager* nifFileManager, double expiryDelay)
|
||||||
: ResourceManager(vfs)
|
: ResourceManager(vfs, expiryDelay)
|
||||||
, mShaderManager(new Shader::ShaderManager)
|
, mShaderManager(new Shader::ShaderManager)
|
||||||
, mForceShaders(false)
|
, mForceShaders(false)
|
||||||
, mClampLighting(true)
|
, mClampLighting(true)
|
||||||
|
|
|
@ -89,8 +89,8 @@ namespace Resource
|
||||||
class SceneManager : public ResourceManager
|
class SceneManager : public ResourceManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SceneManager(
|
explicit SceneManager(const VFS::Manager* vfs, Resource::ImageManager* imageManager,
|
||||||
const VFS::Manager* vfs, Resource::ImageManager* imageManager, Resource::NifFileManager* nifFileManager);
|
Resource::NifFileManager* nifFileManager, double expiryDelay);
|
||||||
~SceneManager();
|
~SceneManager();
|
||||||
|
|
||||||
Shader::ShaderManager& getShaderManager();
|
Shader::ShaderManager& getShaderManager();
|
||||||
|
|
|
@ -20,8 +20,8 @@ namespace Terrain
|
||||||
{
|
{
|
||||||
|
|
||||||
ChunkManager::ChunkManager(Storage* storage, Resource::SceneManager* sceneMgr, TextureManager* textureManager,
|
ChunkManager::ChunkManager(Storage* storage, Resource::SceneManager* sceneMgr, TextureManager* textureManager,
|
||||||
CompositeMapRenderer* renderer, ESM::RefId worldspace)
|
CompositeMapRenderer* renderer, ESM::RefId worldspace, double expiryDelay)
|
||||||
: GenericResourceManager<ChunkKey>(nullptr)
|
: GenericResourceManager<ChunkKey>(nullptr, expiryDelay)
|
||||||
, QuadTreeWorld::ChunkManager(worldspace)
|
, QuadTreeWorld::ChunkManager(worldspace)
|
||||||
, mStorage(storage)
|
, mStorage(storage)
|
||||||
, mSceneManager(sceneMgr)
|
, mSceneManager(sceneMgr)
|
||||||
|
|
|
@ -75,8 +75,8 @@ namespace Terrain
|
||||||
class ChunkManager : public Resource::GenericResourceManager<ChunkKey>, public QuadTreeWorld::ChunkManager
|
class ChunkManager : public Resource::GenericResourceManager<ChunkKey>, public QuadTreeWorld::ChunkManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ChunkManager(Storage* storage, Resource::SceneManager* sceneMgr, TextureManager* textureManager,
|
explicit ChunkManager(Storage* storage, Resource::SceneManager* sceneMgr, TextureManager* textureManager,
|
||||||
CompositeMapRenderer* renderer, ESM::RefId worldspace);
|
CompositeMapRenderer* renderer, ESM::RefId worldspace, double expiryDelay);
|
||||||
|
|
||||||
osg::ref_ptr<osg::Node> getChunk(float size, const osg::Vec2f& center, unsigned char lod, unsigned int lodFlags,
|
osg::ref_ptr<osg::Node> getChunk(float size, const osg::Vec2f& center, unsigned char lod, unsigned int lodFlags,
|
||||||
bool activeGrid, const osg::Vec3f& viewPoint, bool compile) override;
|
bool activeGrid, const osg::Vec3f& viewPoint, bool compile) override;
|
||||||
|
|
|
@ -23,9 +23,10 @@ namespace Terrain
|
||||||
};
|
};
|
||||||
|
|
||||||
TerrainGrid::TerrainGrid(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem,
|
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)
|
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)
|
, mNumSplits(4)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,9 +26,9 @@ namespace Terrain
|
||||||
class TerrainGrid : public Terrain::World
|
class TerrainGrid : public Terrain::World
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TerrainGrid(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem,
|
explicit TerrainGrid(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem,
|
||||||
Storage* storage, unsigned int nodeMask, ESM::RefId worldspace, unsigned int preCompileMask = ~0u,
|
Storage* storage, unsigned int nodeMask, ESM::RefId worldspace, double expiryDelay,
|
||||||
unsigned int borderMask = 0);
|
unsigned int preCompileMask = ~0u, unsigned int borderMask = 0);
|
||||||
TerrainGrid(osg::Group* parent, Storage* storage, ESM::RefId worldspace, unsigned int nodeMask = ~0u);
|
TerrainGrid(osg::Group* parent, Storage* storage, ESM::RefId worldspace, unsigned int nodeMask = ~0u);
|
||||||
~TerrainGrid();
|
~TerrainGrid();
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
namespace Terrain
|
namespace Terrain
|
||||||
{
|
{
|
||||||
|
|
||||||
TextureManager::TextureManager(Resource::SceneManager* sceneMgr)
|
TextureManager::TextureManager(Resource::SceneManager* sceneMgr, double expiryDelay)
|
||||||
: ResourceManager(sceneMgr->getVFS())
|
: ResourceManager(sceneMgr->getVFS(), expiryDelay)
|
||||||
, mSceneManager(sceneMgr)
|
, mSceneManager(sceneMgr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace Terrain
|
||||||
class TextureManager : public Resource::ResourceManager
|
class TextureManager : public Resource::ResourceManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TextureManager(Resource::SceneManager* sceneMgr);
|
explicit TextureManager(Resource::SceneManager* sceneMgr, double expiryDelay);
|
||||||
|
|
||||||
void updateTextureFiltering();
|
void updateTextureFiltering();
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
#include <components/resource/resourcesystem.hpp>
|
#include <components/resource/resourcesystem.hpp>
|
||||||
#include <components/resource/scenemanager.hpp>
|
#include <components/resource/scenemanager.hpp>
|
||||||
|
#include <components/settings/values.hpp>
|
||||||
|
|
||||||
#include "chunkmanager.hpp"
|
#include "chunkmanager.hpp"
|
||||||
#include "compositemaprenderer.hpp"
|
#include "compositemaprenderer.hpp"
|
||||||
|
@ -17,7 +18,7 @@ namespace Terrain
|
||||||
|
|
||||||
World::World(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem,
|
World::World(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem,
|
||||||
Storage* storage, unsigned int nodeMask, unsigned int preCompileMask, unsigned int borderMask,
|
Storage* storage, unsigned int nodeMask, unsigned int preCompileMask, unsigned int borderMask,
|
||||||
ESM::RefId worldspace)
|
ESM::RefId worldspace, double expiryDelay)
|
||||||
: mStorage(storage)
|
: mStorage(storage)
|
||||||
, mParent(parent)
|
, mParent(parent)
|
||||||
, mResourceSystem(resourceSystem)
|
, mResourceSystem(resourceSystem)
|
||||||
|
@ -45,9 +46,9 @@ namespace Terrain
|
||||||
|
|
||||||
mParent->addChild(mTerrainRoot);
|
mParent->addChild(mTerrainRoot);
|
||||||
|
|
||||||
mTextureManager = std::make_unique<TextureManager>(mResourceSystem->getSceneManager());
|
mTextureManager = std::make_unique<TextureManager>(mResourceSystem->getSceneManager(), expiryDelay);
|
||||||
mChunkManager = std::make_unique<ChunkManager>(
|
mChunkManager = std::make_unique<ChunkManager>(mStorage, mResourceSystem->getSceneManager(),
|
||||||
mStorage, mResourceSystem->getSceneManager(), mTextureManager.get(), mCompositeMapRenderer, mWorldspace);
|
mTextureManager.get(), mCompositeMapRenderer, mWorldspace, expiryDelay);
|
||||||
mChunkManager->setNodeMask(nodeMask);
|
mChunkManager->setNodeMask(nodeMask);
|
||||||
mCellBorder
|
mCellBorder
|
||||||
= std::make_unique<CellBorder>(this, mTerrainRoot.get(), borderMask, mResourceSystem->getSceneManager());
|
= std::make_unique<CellBorder>(this, mTerrainRoot.get(), borderMask, mResourceSystem->getSceneManager());
|
||||||
|
|
|
@ -49,8 +49,9 @@ namespace Terrain
|
||||||
/// @param storage Storage instance to get terrain data from (heights, normals, colors, textures..)
|
/// @param storage Storage instance to get terrain data from (heights, normals, colors, textures..)
|
||||||
/// @param nodeMask mask for the terrain root
|
/// @param nodeMask mask for the terrain root
|
||||||
/// @param preCompileMask mask for pre compiling textures
|
/// @param preCompileMask mask for pre compiling textures
|
||||||
World(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem, Storage* storage,
|
explicit World(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem,
|
||||||
unsigned int nodeMask, unsigned int preCompileMask, unsigned int borderMask, ESM::RefId worldspace);
|
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);
|
World(osg::Group* parent, Storage* storage, unsigned int nodeMask, ESM::RefId worldspace);
|
||||||
virtual ~World();
|
virtual ~World();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue