mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-24 06:23:52 +00:00
6ef848b7c5
Instead use getImage and let the caller create the Texture. Sharing of textures is then handled in post by the SharedStateManager. This is closer to what the OSG serializer does. Streamlines the TextureManager and will make it easier to multithread.
50 lines
1.3 KiB
C++
50 lines
1.3 KiB
C++
#ifndef COMPONENTS_TERRAIN_TERRAINGRID_H
|
|
#define COMPONENTS_TERRAIN_TERRAINGRID_H
|
|
|
|
#include <osg/Vec2f>
|
|
|
|
#include "world.hpp"
|
|
#include "material.hpp"
|
|
|
|
namespace osg
|
|
{
|
|
class KdTreeBuilder;
|
|
}
|
|
|
|
namespace Terrain
|
|
{
|
|
|
|
class GridElement;
|
|
|
|
/// @brief Simple terrain implementation that loads cells in a grid, with no LOD
|
|
class TerrainGrid : public Terrain::World
|
|
{
|
|
public:
|
|
TerrainGrid(osg::Group* parent, Resource::ResourceSystem* resourceSystem, osgUtil::IncrementalCompileOperation* ico,
|
|
Storage* storage, int nodeMask);
|
|
~TerrainGrid();
|
|
|
|
virtual void loadCell(int x, int y);
|
|
virtual void unloadCell(int x, int y);
|
|
|
|
/// Clear cached textures that are no longer referenced
|
|
void clearCache();
|
|
|
|
private:
|
|
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;
|
|
|
|
typedef std::map<std::string, osg::ref_ptr<osg::Texture2D> > TextureCache;
|
|
TextureCache mTextureCache;
|
|
|
|
typedef std::map<std::pair<int, int>, GridElement*> Grid;
|
|
Grid mGrid;
|
|
|
|
osg::ref_ptr<osg::KdTreeBuilder> mKdTreeBuilder;
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|