OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
storage.hpp
Go to the documentation of this file.
1 #ifndef COMPONENTS_TERRAIN_STORAGE_H
2 #define COMPONENTS_TERRAIN_STORAGE_H
3 
4 #include <vector>
5 
6 #include <osg/Vec2f>
7 #include <osg/Vec3f>
8 #include <osg/ref_ptr>
9 #include <osg/Array>
10 
11 #include "defs.hpp"
12 
13 namespace osg
14 {
15  class Image;
16 }
17 
18 namespace Terrain
19 {
22  class Storage
23  {
24  public:
25  virtual ~Storage() {}
26 
27  public:
29  virtual void getBounds(float& minX, float& maxX, float& minY, float& maxY) = 0;
30 
39  virtual bool getMinMaxHeights (float size, const osg::Vec2f& center, float& min, float& max) = 0;
40 
52  virtual void fillVertexBuffers (int lodLevel, float size, const osg::Vec2f& center,
53  osg::ref_ptr<osg::Vec3Array> positions,
54  osg::ref_ptr<osg::Vec3Array> normals,
55  osg::ref_ptr<osg::Vec4Array> colours) = 0;
56 
57  typedef std::vector<osg::ref_ptr<osg::Image> > ImageVector;
69  virtual void getBlendmaps (float chunkSize, const osg::Vec2f& chunkCenter, bool pack,
70  ImageVector& blendmaps,
71  std::vector<LayerInfo>& layerList) = 0;
72 
73  virtual float getHeightAt (const osg::Vec3f& worldPos) = 0;
74 
76  virtual float getCellWorldSize() = 0;
77 
79  virtual int getCellVertices() = 0;
80 
81  virtual int getBlendmapScale(float chunkSize) = 0;
82  };
83 
84 }
85 
86 #endif
virtual void 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)=0
virtual void getBlendmaps(float chunkSize, const osg::Vec2f &chunkCenter, bool pack, ImageVector &blendmaps, std::vector< LayerInfo > &layerList)=0
virtual int getBlendmapScale(float chunkSize)=0
virtual float getCellWorldSize()=0
Get the transformation factor for mapping cell units to world units.
std::vector< osg::ref_ptr< osg::Image > > ImageVector
Definition: storage.hpp:57
Definition: storage.hpp:22
virtual void getBounds(float &minX, float &maxX, float &minY, float &maxY)=0
Get bounds of the whole terrain in cell units.
virtual float getHeightAt(const osg::Vec3f &worldPos)=0
virtual bool getMinMaxHeights(float size, const osg::Vec2f &center, float &min, float &max)=0
virtual ~Storage()
Definition: storage.hpp:25
virtual int getCellVertices()=0
Get the number of vertices on one side for each cell. Should be (power of two)+1. ...