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 {
21  class Storage
22  {
23  public:
24  virtual ~Storage() {}
25 
26  public:
28  virtual void getBounds(float& minX, float& maxX, float& minY, float& maxY) = 0;
29 
38  virtual bool getMinMaxHeights (float size, const osg::Vec2f& center, float& min, float& max) = 0;
39 
51  virtual void fillVertexBuffers (int lodLevel, float size, const osg::Vec2f& center,
52  osg::ref_ptr<osg::Vec3Array> positions,
53  osg::ref_ptr<osg::Vec3Array> normals,
54  osg::ref_ptr<osg::Vec4Array> colours) = 0;
55 
56  typedef std::vector<osg::ref_ptr<osg::Image> > ImageVector;
68  virtual void getBlendmaps (float chunkSize, const osg::Vec2f& chunkCenter, bool pack,
69  ImageVector& blendmaps,
70  std::vector<LayerInfo>& layerList) = 0;
71 
72  virtual float getHeightAt (const osg::Vec3f& worldPos) = 0;
73 
74  virtual LayerInfo getDefaultLayer() = 0;
75 
77  virtual float getCellWorldSize() = 0;
78 
80  virtual int getCellVertices() = 0;
81  };
82 
83 }
84 
85 #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 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:56
We keep storage of terrain data abstract here since we need different implementations for game and ed...
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 float getHeightAt(const osg::Vec3f &worldPos)=0
virtual bool getMinMaxHeights(float size, const osg::Vec2f &center, float &min, float &max)=0
Definition: defs.hpp:17
virtual ~Storage()
Definition: storage.hpp:24
virtual int getCellVertices()=0
Get the number of vertices on one side for each cell. Should be (power of two)+1. ...
virtual LayerInfo getDefaultLayer()=0