1 #ifndef COMPONENTS_ESM_TERRAIN_STORAGE_H
2 #define COMPONENTS_ESM_TERRAIN_STORAGE_H
4 #include <OpenThreads/Mutex>
30 Storage(
const VFS::Manager* vfs,
const std::string& normalMapPattern =
"",
const std::string& normalHeightMapPattern =
"",
bool autoUseNormalMaps =
false,
const std::string& specularMapPattern =
"",
bool autoUseSpecularMaps =
false);
39 virtual void getBounds(
float& minX,
float& maxX,
float& minY,
float& maxY) = 0;
49 virtual bool getMinMaxHeights (
float size,
const osg::Vec2f& center,
float& min,
float& max);
61 virtual void fillVertexBuffers (
int lodLevel,
float size,
const osg::Vec2f& center,
62 osg::ref_ptr<osg::Vec3Array> positions,
63 osg::ref_ptr<osg::Vec3Array> normals,
64 osg::ref_ptr<osg::Vec4Array> colours);
77 virtual void getBlendmaps (
float chunkSize,
const osg::Vec2f& chunkCenter,
bool pack,
79 std::vector<Terrain::LayerInfo>& layerList);
81 virtual float getHeightAt (
const osg::Vec3f& worldPos);
94 void fixNormal (osg::Vec3f& normal,
int cellX,
int cellY,
int col,
int row);
95 void fixColour (osg::Vec4f& colour,
int cellX,
int cellY,
int col,
int row);
96 void averageNormal (osg::Vec3f& normal,
int cellX,
int cellY,
int col,
int row);
void fixNormal(osg::Vec3f &normal, int cellX, int cellY, int col, int row)
Definition: storage.cpp:79
std::string mNormalHeightMapPattern
Definition: storage.hpp:113
void averageNormal(osg::Vec3f &normal, int cellX, int cellY, int col, int row)
Definition: storage.cpp:113
Storage(const VFS::Manager *vfs, const std::string &normalMapPattern="", const std::string &normalHeightMapPattern="", bool autoUseNormalMaps=false, const std::string &specularMapPattern="", bool autoUseSpecularMaps=false)
Definition: storage.cpp:21
std::map< std::string, Terrain::LayerInfo > mLayerInfoMap
Definition: storage.hpp:109
virtual int getCellVertices()
Get the number of vertices on one side for each cell. Should be (power of two)+1. ...
Definition: storage.cpp:568
float getVertexHeight(const ESM::Land *land, int x, int y)
Definition: storage.cpp:499
std::vector< osg::ref_ptr< osg::Image > > ImageVector
Definition: storage.hpp:56
std::string mNormalMapPattern
Definition: storage.hpp:112
const ESM::Land::LandData * getLandData(int cellX, int cellY, int flags)
Definition: storage.cpp:31
bool mAutoUseSpecularMaps
Definition: storage.hpp:117
Definition: loadltex.hpp:28
bool mAutoUseNormalMaps
Definition: storage.hpp:114
Definition: loadland.hpp:20
std::pair< short, short > UniqueTextureId
Definition: storage.hpp:103
virtual void getBlendmaps(float chunkSize, const osg::Vec2f &chunkCenter, bool pack, ImageVector &blendmaps, std::vector< Terrain::LayerInfo > &layerList)
Definition: storage.cpp:332
We keep storage of terrain data abstract here since we need different implementations for game and ed...
Definition: storage.hpp:21
Feeds data from ESM terrain records (ESM::Land, ESM::LandTexture) into the terrain component...
Definition: storage.hpp:21
virtual void getBounds(float &minX, float &maxX, float &minY, float &maxY)=0
Get bounds of the whole terrain in cell units.
virtual void fillVertexBuffers(int lodLevel, float size, const osg::Vec2f ¢er, osg::ref_ptr< osg::Vec3Array > positions, osg::ref_ptr< osg::Vec3Array > normals, osg::ref_ptr< osg::Vec4Array > colours)
Definition: storage.cpp:152
virtual float getHeightAt(const osg::Vec3f &worldPos)
Definition: storage.cpp:419
std::string mSpecularMapPattern
Definition: storage.hpp:116
virtual const ESM::Land * getLand(int cellX, int cellY)=0
UniqueTextureId getVtexIndexAt(int cellX, int cellY, int x, int y)
Definition: storage.cpp:281
const VFS::Manager * mVFS
Definition: storage.hpp:92
OpenThreads::Mutex mLayerInfoMutex
Definition: storage.hpp:110
std::string getTextureName(UniqueTextureId id)
Definition: storage.cpp:312
The main class responsible for loading files from a virtual file system.
Definition: manager.hpp:20
virtual bool getMinMaxHeights(float size, const osg::Vec2f ¢er, float &min, float &max)
Definition: storage.cpp:39
Terrain::LayerInfo getLayerInfo(const std::string &texture)
Definition: storage.cpp:506
virtual const ESM::LandTexture * getLandTexture(int index, short plugin)=0
virtual float getCellWorldSize()
Get the transformation factor for mapping cell units to world units.
Definition: storage.cpp:563
Definition: loadland.hpp:81
void fixColour(osg::Vec4f &colour, int cellX, int cellY, int col, int row)
Definition: storage.cpp:124
virtual Terrain::LayerInfo getDefaultLayer()
Definition: storage.cpp:554