2014-08-07 20:43:33 +02:00
|
|
|
#ifndef COMPONENTS_TERRAIN_TERRAINGRID_H
|
|
|
|
#define COMPONENTS_TERRAIN_TERRAINGRID_H
|
2014-06-29 02:42:36 +02:00
|
|
|
|
2017-03-06 20:41:02 +01:00
|
|
|
#include <map>
|
|
|
|
|
2015-11-06 20:14:57 +01:00
|
|
|
#include <osg/Vec2f>
|
|
|
|
|
2014-08-07 20:43:33 +02:00
|
|
|
#include "world.hpp"
|
2014-06-29 02:42:36 +02:00
|
|
|
|
|
|
|
namespace Terrain
|
|
|
|
{
|
|
|
|
|
2017-03-08 01:53:13 +01:00
|
|
|
/// @brief Simple terrain implementation that loads cells in a grid, with no LOD. Only requested cells are loaded.
|
2014-06-29 02:42:36 +02:00
|
|
|
class TerrainGrid : public Terrain::World
|
|
|
|
{
|
|
|
|
public:
|
2018-06-13 01:48:31 +02:00
|
|
|
TerrainGrid(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem, Storage* storage, int nodeMask, int preCompileMask=~0, int borderMask=0);
|
2014-06-29 02:42:36 +02:00
|
|
|
~TerrainGrid();
|
|
|
|
|
2017-03-09 20:52:50 +01:00
|
|
|
virtual void cacheCell(View* view, int x, int y);
|
2016-02-09 20:57:30 +01:00
|
|
|
|
|
|
|
/// @note Not thread safe.
|
2014-06-29 02:42:36 +02:00
|
|
|
virtual void loadCell(int x, int y);
|
2016-02-09 20:57:30 +01:00
|
|
|
|
|
|
|
/// @note Not thread safe.
|
2014-06-29 02:42:36 +02:00
|
|
|
virtual void unloadCell(int x, int y);
|
|
|
|
|
2017-03-09 20:52:50 +01:00
|
|
|
View* createView();
|
|
|
|
|
2014-06-29 02:42:36 +02:00
|
|
|
private:
|
2015-11-06 20:14:57 +01:00
|
|
|
osg::ref_ptr<osg::Node> buildTerrain (osg::Group* parent, float chunkSize, const osg::Vec2f& chunkCenter);
|
|
|
|
|
|
|
|
// split each ESM::Cell into mNumSplits*mNumSplits terrain chunks
|
|
|
|
unsigned int mNumSplits;
|
|
|
|
|
2018-06-13 01:48:31 +02:00
|
|
|
MWRender::CellBorder::CellGrid mGrid;
|
2018-06-14 12:01:09 +02:00
|
|
|
};
|
2014-06-29 02:42:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|