1 #ifndef COMPONENTS_ESM_TERRAIN_STORAGE_H
2 #define COMPONENTS_ESM_TERRAIN_STORAGE_H
4 #include <OpenThreads/Mutex>
47 Storage(
const VFS::Manager* vfs,
const std::string& normalMapPattern =
"",
const std::string& normalHeightMapPattern =
"",
bool autoUseNormalMaps =
false,
const std::string& specularMapPattern =
"",
bool autoUseSpecularMaps =
false);
50 virtual osg::ref_ptr<const LandObject>
getLand (
int cellX,
int cellY)= 0;
53 virtual void getBounds(
float& minX,
float& maxX,
float& minY,
float& maxY) = 0;
63 virtual bool getMinMaxHeights (
float size,
const osg::Vec2f& center,
float& min,
float& max);
75 virtual void fillVertexBuffers (
int lodLevel,
float size,
const osg::Vec2f& center,
76 osg::ref_ptr<osg::Vec3Array> positions,
77 osg::ref_ptr<osg::Vec3Array> normals,
78 osg::ref_ptr<osg::Vec4Array> colours);
91 virtual void getBlendmaps (
float chunkSize,
const osg::Vec2f& chunkCenter,
bool pack,
93 std::vector<Terrain::LayerInfo>& layerList);
95 virtual float getHeightAt (
const osg::Vec3f& worldPos);
108 void fixNormal (osg::Vec3f& normal,
int cellX,
int cellY,
int col,
int row,
LandCache& cache);
109 void fixColour (osg::Vec4f& colour,
int cellX,
int cellY,
int col,
int row,
LandCache& cache);
virtual osg::ref_ptr< const LandObject > getLand(int cellX, int cellY)=0
void fixNormal(osg::Vec3f &normal, int cellX, int cellY, int col, int row, LandCache &cache)
Definition: storage.cpp:115
UniqueTextureId getVtexIndexAt(int cellX, int cellY, int x, int y, LandCache &)
Definition: storage.cpp:329
std::string mNormalHeightMapPattern
Definition: storage.hpp:129
void copy(const btTransform &src, Nif::Transformation &dst)
Definition: testbulletnifloader.cpp:269
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:65
std::map< std::string, Terrain::LayerInfo > mLayerInfoMap
Definition: storage.hpp:125
virtual int getCellVertices()
Get the number of vertices on one side for each cell. Should be (power of two)+1. ...
Definition: storage.cpp:634
const ESM::Land * mLand
Definition: storage.hpp:36
std::vector< osg::ref_ptr< osg::Image > > ImageVector
Definition: storage.hpp:57
std::string mNormalMapPattern
Definition: storage.hpp:128
bool mAutoUseSpecularMaps
Definition: storage.hpp:133
virtual int getBlendmapScale(float chunkSize)
Definition: storage.cpp:639
Definition: loadltex.hpp:28
bool mAutoUseNormalMaps
Definition: storage.hpp:130
T & getData(Data &data)
Definition: types.hpp:25
Definition: loadland.hpp:20
int mLoadFlags
Definition: storage.hpp:37
std::pair< short, short > UniqueTextureId
Definition: storage.hpp:119
virtual void getBlendmaps(float chunkSize, const osg::Vec2f &chunkCenter, bool pack, ImageVector &blendmaps, std::vector< Terrain::LayerInfo > &layerList)
Definition: storage.cpp:392
virtual ~LandObject()
Definition: storage.cpp:46
Wrapper around Land Data with reference counting. The wrapper needs to be held as long as the data is...
Definition: storage.hpp:22
Definition: storage.hpp:22
void averageNormal(osg::Vec3f &normal, int cellX, int cellY, int col, int row, LandCache &cache)
Definition: storage.cpp:151
Feeds data from ESM terrain records (ESM::Land, ESM::LandTexture) into the terrain component...
Definition: storage.hpp:44
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:191
virtual float getHeightAt(const osg::Vec3f &worldPos)
Definition: storage.cpp:478
float getVertexHeight(const ESM::Land::LandData *data, int x, int y)
Definition: storage.cpp:562
std::string mSpecularMapPattern
Definition: storage.hpp:132
const VFS::Manager * mVFS
Definition: storage.hpp:106
void fixColour(osg::Vec4f &colour, int cellX, int cellY, int col, int row, LandCache &cache)
Definition: storage.cpp:162
OpenThreads::Mutex mLayerInfoMutex
Definition: storage.hpp:126
LandObject()
Definition: storage.cpp:27
std::string getTextureName(UniqueTextureId id)
Definition: storage.cpp:367
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:75
Terrain::LayerInfo getLayerInfo(const std::string &texture)
Definition: storage.cpp:581
ESM::Land::LandData mData
Definition: storage.hpp:39
META_Object(ESMTerrain, LandObject) const ESM int getPlugin() const
Definition: storage.cpp:57
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:629
Definition: loadland.hpp:85
Definition: storage.cpp:20