OpenMW
|
We keep storage of terrain data abstract here since we need different implementations for game and editor. More...
#include <storage.hpp>
Public Member Functions | |
virtual | ~Storage () |
virtual Ogre::AxisAlignedBox | getBounds ()=0 |
Get bounds of the whole terrain in cell units. | |
bool | getMinMaxHeights (float size, const Ogre::Vector2 ¢er, float &min, float &max) |
void | fillVertexBuffers (int lodLevel, float size, const Ogre::Vector2 ¢er, Ogre::HardwareVertexBufferSharedPtr vertexBuffer, Ogre::HardwareVertexBufferSharedPtr normalBuffer, Ogre::HardwareVertexBufferSharedPtr colourBuffer) |
void | getBlendmaps (float chunkSize, const Ogre::Vector2 &chunkCenter, bool pack, std::vector< Ogre::TexturePtr > &blendmaps, std::vector< LayerInfo > &layerList) |
float | getHeightAt (const Ogre::Vector3 &worldPos) |
Private Types | |
typedef std::pair< short, short > | UniqueTextureId |
Private Member Functions | |
virtual ESM::Land * | getLand (int cellX, int cellY)=0 |
virtual const ESM::LandTexture * | getLandTexture (int index, short plugin)=0 |
void | fixNormal (Ogre::Vector3 &normal, int cellX, int cellY, int col, int row) |
void | fixColour (Ogre::ColourValue &colour, int cellX, int cellY, int col, int row) |
void | averageNormal (Ogre::Vector3 &normal, int cellX, int cellY, int col, int row) |
float | getVertexHeight (const ESM::Land *land, int x, int y) |
UniqueTextureId | getVtexIndexAt (int cellX, int cellY, int x, int y) |
std::string | getTextureName (UniqueTextureId id) |
LayerInfo | getLayerInfo (const std::string &texture) |
Private Attributes | |
std::map< std::string, LayerInfo > | mLayerInfoMap |
We keep storage of terrain data abstract here since we need different implementations for game and editor.
typedef std::pair<short, short> Terrain::Storage::UniqueTextureId [private] |
virtual Terrain::Storage::~Storage | ( | ) | [inline, virtual] |
void Terrain::Storage::averageNormal | ( | Ogre::Vector3 & | normal, |
int | cellX, | ||
int | cellY, | ||
int | col, | ||
int | row | ||
) | [private] |
void Terrain::Storage::fillVertexBuffers | ( | int | lodLevel, |
float | size, | ||
const Ogre::Vector2 & | center, | ||
Ogre::HardwareVertexBufferSharedPtr | vertexBuffer, | ||
Ogre::HardwareVertexBufferSharedPtr | normalBuffer, | ||
Ogre::HardwareVertexBufferSharedPtr | colourBuffer | ||
) |
Fill vertex buffers for a terrain chunk.
lodLevel | LOD level, 0 = most detailed |
size | size of the terrain chunk in cell units |
center | center of the chunk in cell units |
vertexBuffer | buffer to write vertices |
normalBuffer | buffer to write vertex normals |
colourBuffer | buffer to write vertex colours |
void Terrain::Storage::fixColour | ( | Ogre::ColourValue & | colour, |
int | cellX, | ||
int | cellY, | ||
int | col, | ||
int | row | ||
) | [private] |
void Terrain::Storage::fixNormal | ( | Ogre::Vector3 & | normal, |
int | cellX, | ||
int | cellY, | ||
int | col, | ||
int | row | ||
) | [private] |
void Terrain::Storage::getBlendmaps | ( | float | chunkSize, |
const Ogre::Vector2 & | chunkCenter, | ||
bool | pack, | ||
std::vector< Ogre::TexturePtr > & | blendmaps, | ||
std::vector< LayerInfo > & | layerList | ||
) |
Create textures holding layer blend values for a terrain chunk.
chunkSize | size of the terrain chunk in cell units |
chunkCenter | center of the chunk in cell units |
pack | Whether to pack blend values for up to 4 layers into one texture (one in each channel) - otherwise, each texture contains blend values for one layer only. Shader-based rendering can utilize packing, FFP can't. |
blendmaps | created blendmaps will be written here |
layerList | names of the layer textures used will be written here |
virtual Ogre::AxisAlignedBox Terrain::Storage::getBounds | ( | ) | [pure virtual] |
Get bounds of the whole terrain in cell units.
Implemented in MWRender::TerrainStorage.
float Terrain::Storage::getHeightAt | ( | const Ogre::Vector3 & | worldPos | ) |
virtual ESM::Land* Terrain::Storage::getLand | ( | int | cellX, |
int | cellY | ||
) | [private, pure virtual] |
Implemented in MWRender::TerrainStorage.
virtual const ESM::LandTexture* Terrain::Storage::getLandTexture | ( | int | index, |
short | plugin | ||
) | [private, pure virtual] |
Implemented in MWRender::TerrainStorage.
LayerInfo Terrain::Storage::getLayerInfo | ( | const std::string & | texture | ) | [private] |
bool Terrain::Storage::getMinMaxHeights | ( | float | size, |
const Ogre::Vector2 & | center, | ||
float & | min, | ||
float & | max | ||
) |
Get the minimum and maximum heights of a terrain chunk.
size | size of the chunk in cell units |
center | center of the chunk in cell units |
min | min height will be stored here |
max | max height will be stored here |
std::string Terrain::Storage::getTextureName | ( | UniqueTextureId | id | ) | [private] |
float Terrain::Storage::getVertexHeight | ( | const ESM::Land * | land, |
int | x, | ||
int | y | ||
) | [private] |
Storage::UniqueTextureId Terrain::Storage::getVtexIndexAt | ( | int | cellX, |
int | cellY, | ||
int | x, | ||
int | y | ||
) | [private] |
std::map<std::string, LayerInfo> Terrain::Storage::mLayerInfoMap [private] |