2019-06-13 13:37:00 +00:00
|
|
|
#ifndef OPENMW_COMPONENTS_ESMPAGING_CHUNKMANAGER_H
|
|
|
|
#define OPENMW_COMPONENTS_ESMPAGING_CHUNKMANAGER_H
|
|
|
|
|
|
|
|
#include <components/terrain/quadtreeworld.hpp>
|
|
|
|
#include <components/resource/resourcemanager.hpp>
|
|
|
|
#include <components/esm/loadcell.hpp>
|
|
|
|
|
2019-08-03 13:37:00 +00:00
|
|
|
#include <OpenThreads/Mutex>
|
|
|
|
|
2019-06-13 13:37:00 +00:00
|
|
|
namespace Resource
|
|
|
|
{
|
|
|
|
class SceneManager;
|
|
|
|
}
|
|
|
|
namespace MWWorld
|
|
|
|
{
|
|
|
|
class ESMStore;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace MWRender
|
|
|
|
{
|
|
|
|
|
|
|
|
typedef std::tuple<osg::Vec2f, float> ChunkId; // Center, Size
|
|
|
|
|
|
|
|
class ObjectPaging : public Resource::GenericResourceManager<ChunkId>, public Terrain::QuadTreeWorld::ChunkManager
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ObjectPaging(Resource::SceneManager* sceneManager);
|
|
|
|
~ObjectPaging() = default;
|
|
|
|
|
2020-04-30 13:37:00 +00:00
|
|
|
osg::ref_ptr<osg::Node> getChunk(float size, const osg::Vec2f& center, unsigned char lod, unsigned int lodFlags, bool far, const osg::Vec3f& viewPoint, bool compile) override;
|
2019-06-13 13:37:00 +00:00
|
|
|
|
2020-04-30 13:37:00 +00:00
|
|
|
osg::ref_ptr<osg::Node> createChunk(float size, const osg::Vec2f& center, const osg::Vec3f& viewPoint, bool compile);
|
2019-06-13 13:37:00 +00:00
|
|
|
|
|
|
|
virtual unsigned int getNodeMask() override;
|
|
|
|
|
2019-08-03 13:37:00 +00:00
|
|
|
void enableObject(const ESM::RefNum & refnum, bool enabled);
|
|
|
|
void clear();
|
|
|
|
|
2019-06-13 13:37:00 +00:00
|
|
|
private:
|
|
|
|
Resource::SceneManager* mSceneManager;
|
2020-04-30 13:37:00 +00:00
|
|
|
float mMergeFactor;
|
2019-06-13 13:37:00 +00:00
|
|
|
float mMinSize;
|
2019-08-03 13:37:00 +00:00
|
|
|
|
|
|
|
OpenThreads::Mutex mDisabledMutex;
|
|
|
|
std::set<ESM::RefNum> mDisabled;
|
2019-06-13 13:37:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|