#ifndef OPENMW_COMPONENTS_ESMPAGING_CHUNKMANAGER_H #define OPENMW_COMPONENTS_ESMPAGING_CHUNKMANAGER_H #include #include #include #include namespace Resource { class SceneManager; } namespace MWWorld { class ESMStore; } namespace MWRender { typedef std::tuple ChunkId; // Center, Size class ObjectPaging : public Resource::GenericResourceManager, public Terrain::QuadTreeWorld::ChunkManager { public: ObjectPaging(Resource::SceneManager* sceneManager); ~ObjectPaging() = default; osg::ref_ptr getChunk(float size, const osg::Vec2f& center, unsigned char lod, unsigned int lodFlags, bool far, const osg::Vec3f& viewPoint, bool compile) override; osg::ref_ptr createChunk(float size, const osg::Vec2f& center, const osg::Vec3f& viewPoint, bool compile); virtual unsigned int getNodeMask() override; /// @return true if something changed bool enableObject(int type, const ESM::RefNum & refnum, const osg::Vec3f& pos, bool enabled); void clear(); void reportStats(unsigned int frameNumber, osg::Stats* stats) const override; private: Resource::SceneManager* mSceneManager; bool mDebugBatches; float mMergeFactor; float mMinSize; float mMinSizeMergeFactor; float mMinSizeCostMultiplier; OpenThreads::Mutex mDisabledMutex; std::set mDisabled; OpenThreads::Mutex mSizeCacheMutex; typedef std::map SizeCache; SizeCache mSizeCache; }; } #endif