mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-26 01:26:40 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			44 lines
		
	
	
	
		
			1.2 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
	
		
			1.2 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| #ifndef COMPONENTS_TERRAIN_TERRAINGRID_H
 | |
| #define COMPONENTS_TERRAIN_TERRAINGRID_H
 | |
| 
 | |
| #include <map>
 | |
| 
 | |
| #include <osg/Vec2f>
 | |
| 
 | |
| #include "world.hpp"
 | |
| 
 | |
| namespace Terrain
 | |
| {
 | |
| 
 | |
|     /// @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, int nodeMask, int preCompileMask=~0, int borderMask=0);
 | |
|         ~TerrainGrid();
 | |
| 
 | |
|         void cacheCell(View* view, int x, int y) override;
 | |
| 
 | |
|         /// @note Not thread safe.
 | |
|         void loadCell(int x, int y) override;
 | |
| 
 | |
|         /// @note Not thread safe.
 | |
|         void unloadCell(int x, int y) override;
 | |
| 
 | |
|         View* createView() override;
 | |
| 
 | |
|     protected:
 | |
|         bool isGridEmpty() const { return mGrid.empty(); }
 | |
| 
 | |
|     private:
 | |
|         osg::ref_ptr<osg::Node> buildTerrain (osg::Group* parent, float chunkSize, const osg::Vec2f& chunkCenter);
 | |
|         void updateWaterCulling();
 | |
| 
 | |
|         // split each ESM::Cell into mNumSplits*mNumSplits terrain chunks
 | |
|         unsigned int mNumSplits;
 | |
| 
 | |
|         CellBorder::CellGrid mGrid;
 | |
|     };
 | |
| }
 | |
| 
 | |
| #endif
 |