Feeds data from ESM terrain records (ESM::Land, ESM::LandTexture) into the terrain component, converting it on the fly as needed.  
 More...
#include <storage.hpp>
 | 
|   | Storage (const VFS::Manager *vfs, const std::string &normalMapPattern="", const std::string &normalHeightMapPattern="", bool autoUseNormalMaps=false, const std::string &specularMapPattern="", bool autoUseSpecularMaps=false) | 
|   | 
virtual osg::ref_ptr< const  
LandObject >  | getLand (int cellX, int cellY)=0 | 
|   | 
| virtual const ESM::LandTexture *  | getLandTexture (int index, short plugin)=0 | 
|   | 
| virtual void  | getBounds (float &minX, float &maxX, float &minY, float &maxY)=0 | 
|   | Get bounds of the whole terrain in cell units.  More...
  | 
|   | 
| virtual bool  | getMinMaxHeights (float size, const osg::Vec2f ¢er, float &min, float &max) | 
|   | 
| 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) | 
|   | 
| virtual void  | getBlendmaps (float chunkSize, const osg::Vec2f &chunkCenter, bool pack, ImageVector &blendmaps, std::vector< Terrain::LayerInfo > &layerList) | 
|   | 
| virtual float  | getHeightAt (const osg::Vec3f &worldPos) | 
|   | 
| virtual float  | getCellWorldSize () | 
|   | Get the transformation factor for mapping cell units to world units.  More...
  | 
|   | 
| virtual int  | getCellVertices () | 
|   | Get the number of vertices on one side for each cell. Should be (power of two)+1.  More...
  | 
|   | 
| virtual int  | getBlendmapScale (float chunkSize) | 
|   | 
| virtual  | ~Storage () | 
|   | 
 | 
| void  | fixNormal (osg::Vec3f &normal, int cellX, int cellY, int col, int row, LandCache &cache) | 
|   | 
| void  | fixColour (osg::Vec4f &colour, int cellX, int cellY, int col, int row, LandCache &cache) | 
|   | 
| void  | averageNormal (osg::Vec3f &normal, int cellX, int cellY, int col, int row, LandCache &cache) | 
|   | 
| float  | getVertexHeight (const ESM::Land::LandData *data, int x, int y) | 
|   | 
| const LandObject *  | getLand (int cellX, int cellY, LandCache &cache) | 
|   | 
| UniqueTextureId  | getVtexIndexAt (int cellX, int cellY, int x, int y, LandCache &) | 
|   | 
| std::string  | getTextureName (UniqueTextureId id) | 
|   | 
| Terrain::LayerInfo  | getLayerInfo (const std::string &texture) | 
|   | 
 | 
typedef std::vector 
< osg::ref_ptr< osg::Image > >  | ImageVector | 
|   | 
Feeds data from ESM terrain records (ESM::Land, ESM::LandTexture) into the terrain component, converting it on the fly as needed. 
 
      
        
          | ESMTerrain::Storage::Storage  | 
          ( | 
          const VFS::Manager *  | 
          vfs,  | 
        
        
           | 
           | 
          const std::string &  | 
          normalMapPattern = "",  | 
        
        
           | 
           | 
          const std::string &  | 
          normalHeightMapPattern = "",  | 
        
        
           | 
           | 
          bool  | 
          autoUseNormalMaps = false,  | 
        
        
           | 
           | 
          const std::string &  | 
          specularMapPattern = "",  | 
        
        
           | 
           | 
          bool  | 
          autoUseSpecularMaps = false  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
 
  
  
      
        
          | void ESMTerrain::Storage::averageNormal  | 
          ( | 
          osg::Vec3f &  | 
          normal,  | 
         
        
           | 
           | 
          int  | 
          cellX,  | 
         
        
           | 
           | 
          int  | 
          cellY,  | 
         
        
           | 
           | 
          int  | 
          col,  | 
         
        
           | 
           | 
          int  | 
          row,  | 
         
        
           | 
           | 
          LandCache &  | 
          cache  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
private   | 
  
 
 
  
  
      
        
          | void ESMTerrain::Storage::fillVertexBuffers  | 
          ( | 
          int  | 
          lodLevel,  | 
         
        
           | 
           | 
          float  | 
          size,  | 
         
        
           | 
           | 
          const osg::Vec2f &  | 
          center,  | 
         
        
           | 
           | 
          osg::ref_ptr< osg::Vec3Array >  | 
          positions,  | 
         
        
           | 
           | 
          osg::ref_ptr< osg::Vec3Array >  | 
          normals,  | 
         
        
           | 
           | 
          osg::ref_ptr< osg::Vec4Array >  | 
          colours  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
virtual   | 
  
 
Fill vertex buffers for a terrain chunk. 
- Note
 - May be called from background threads. Make sure to only call thread-safe functions from here! 
 
- 
Vertices should be written in row-major order (a row is defined as parallel to the x-axis). The specified positions should be in local space, i.e. relative to the center of the terrain chunk. 
 
- Parameters
 - 
  
    | lodLevel | LOD level, 0 = most detailed  | 
    | size | size of the terrain chunk in cell units  | 
    | center | center of the chunk in cell units  | 
    | positions | buffer to write vertices  | 
    | normals | buffer to write vertex normals  | 
    | colours | buffer to write vertex colours  | 
  
   
Implements Terrain::Storage.
 
 
  
  
      
        
          | void ESMTerrain::Storage::fixColour  | 
          ( | 
          osg::Vec4f &  | 
          colour,  | 
         
        
           | 
           | 
          int  | 
          cellX,  | 
         
        
           | 
           | 
          int  | 
          cellY,  | 
         
        
           | 
           | 
          int  | 
          col,  | 
         
        
           | 
           | 
          int  | 
          row,  | 
         
        
           | 
           | 
          LandCache &  | 
          cache  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
private   | 
  
 
 
  
  
      
        
          | void ESMTerrain::Storage::fixNormal  | 
          ( | 
          osg::Vec3f &  | 
          normal,  | 
         
        
           | 
           | 
          int  | 
          cellX,  | 
         
        
           | 
           | 
          int  | 
          cellY,  | 
         
        
           | 
           | 
          int  | 
          col,  | 
         
        
           | 
           | 
          int  | 
          row,  | 
         
        
           | 
           | 
          LandCache &  | 
          cache  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
private   | 
  
 
 
  
  
      
        
          | void ESMTerrain::Storage::getBlendmaps  | 
          ( | 
          float  | 
          chunkSize,  | 
         
        
           | 
           | 
          const osg::Vec2f &  | 
          chunkCenter,  | 
         
        
           | 
           | 
          bool  | 
          pack,  | 
         
        
           | 
           | 
          ImageVector &  | 
          blendmaps,  | 
         
        
           | 
           | 
          std::vector< Terrain::LayerInfo > &  | 
          layerList  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
virtual   | 
  
 
Create textures holding layer blend values for a terrain chunk. 
- Note
 - The terrain chunk shouldn't be larger than one cell since otherwise we might have to do a ridiculous amount of different layers. For larger chunks, composite maps should be used. 
 
- 
May be called from background threads. 
 
- Parameters
 - 
  
    | 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  | 
  
   
Implements Terrain::Storage.
 
 
  
  
      
        
          | int ESMTerrain::Storage::getBlendmapScale  | 
          ( | 
          float  | 
          chunkSize | ) | 
           | 
         
       
   | 
  
virtual   | 
  
 
 
  
  
      
        
          | virtual void ESMTerrain::Storage::getBounds  | 
          ( | 
          float &  | 
          minX,  | 
         
        
           | 
           | 
          float &  | 
          maxX,  | 
         
        
           | 
           | 
          float &  | 
          minY,  | 
         
        
           | 
           | 
          float &  | 
          maxY  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
pure virtual   | 
  
 
 
  
  
      
        
          | int ESMTerrain::Storage::getCellVertices  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
virtual   | 
  
 
Get the number of vertices on one side for each cell. Should be (power of two)+1. 
Implements Terrain::Storage.
 
 
  
  
      
        
          | float ESMTerrain::Storage::getCellWorldSize  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
virtual   | 
  
 
Get the transformation factor for mapping cell units to world units. 
Implements Terrain::Storage.
 
 
  
  
      
        
          | float ESMTerrain::Storage::getHeightAt  | 
          ( | 
          const osg::Vec3f &  | 
          worldPos | ) | 
           | 
         
       
   | 
  
virtual   | 
  
 
 
  
  
      
        
          | virtual osg::ref_ptr<const LandObject> ESMTerrain::Storage::getLand  | 
          ( | 
          int  | 
          cellX,  | 
         
        
           | 
           | 
          int  | 
          cellY  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
pure virtual   | 
  
 
 
  
  
      
        
          | virtual const ESM::LandTexture* ESMTerrain::Storage::getLandTexture  | 
          ( | 
          int  | 
          index,  | 
         
        
           | 
           | 
          short  | 
          plugin  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
pure virtual   | 
  
 
 
  
  
      
        
          | bool ESMTerrain::Storage::getMinMaxHeights  | 
          ( | 
          float  | 
          size,  | 
         
        
           | 
           | 
          const osg::Vec2f &  | 
          center,  | 
         
        
           | 
           | 
          float &  | 
          min,  | 
         
        
           | 
           | 
          float &  | 
          max  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
virtual   | 
  
 
Get the minimum and maximum heights of a terrain region. 
- Note
 - Will only be called for chunks with size = minBatchSize, i.e. leafs of the quad tree. Larger chunks can simply merge AABB of children. 
 
- Parameters
 - 
  
    | 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  | 
  
   
- Returns
 - true if there was data available for this terrain chunk 
 
Implements Terrain::Storage.
 
 
  
  
      
        
          | bool ESMTerrain::Storage::mAutoUseNormalMaps | 
         
       
   | 
  
private   | 
  
 
 
  
  
      
        
          | bool ESMTerrain::Storage::mAutoUseSpecularMaps | 
         
       
   | 
  
private   | 
  
 
 
  
  
      
        
          | OpenThreads::Mutex ESMTerrain::Storage::mLayerInfoMutex | 
         
       
   | 
  
private   | 
  
 
 
  
  
      
        
          | std::string ESMTerrain::Storage::mNormalHeightMapPattern | 
         
       
   | 
  
private   | 
  
 
 
  
  
      
        
          | std::string ESMTerrain::Storage::mNormalMapPattern | 
         
       
   | 
  
private   | 
  
 
 
  
  
      
        
          | std::string ESMTerrain::Storage::mSpecularMapPattern | 
         
       
   | 
  
private   | 
  
 
 
The documentation for this class was generated from the following files:
- /home/travis/build/elsid/openmw/components/esmterrain/storage.hpp
 
- /home/travis/build/elsid/openmw/components/esmterrain/storage.cpp