1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-09 12:42:11 +00:00
OpenMW/components/terrain/terraingrid.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

60 lines
1.5 KiB
C++
Raw Normal View History

#ifndef COMPONENTS_TERRAIN_TERRAINGRID_H
#define COMPONENTS_TERRAIN_TERRAINGRID_H
#include <map>
#include <osg/Vec2f>
#include "world.hpp"
namespace osg
{
class Group;
class Stats;
}
namespace Resource
{
class ResourceSystem;
}
namespace Terrain
{
class Storage;
/// @brief Simple terrain implementation that loads cells in a grid, with no LOD. Only requested cells are loaded.
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);
TerrainGrid(osg::Group* parent, Storage* storage, ESM::RefId worldspace, unsigned int nodeMask = ~0u);
~TerrainGrid();
void cacheCell(View* view, int x, int y) override;
2016-02-09 19:57:30 +00:00
/// @note Not thread safe.
void loadCell(int x, int y) override;
2016-02-09 19:57:30 +00:00
/// @note Not thread safe.
void unloadCell(int x, int y) override;
View* createView() override;
2019-06-13 13:37:00 +00:00
protected:
bool isGridEmpty() const { return mGrid.empty(); }
private:
osg::ref_ptr<osg::Node> buildTerrain(osg::Group* parent, float chunkSize, const osg::Vec2f& chunkCenter);
2019-06-13 13:37:00 +00:00
void updateWaterCulling();
// split each ESM::Cell into mNumSplits*mNumSplits terrain chunks
unsigned int mNumSplits;
CellBorder::CellGrid mGrid;
2018-06-14 10:01:09 +00:00
};
}
#endif