Umasoft
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
SRTerrain.h
1 //
2 // SRTerrain class : a subclass of vtDynTerrainGeom which encapsulates
3 // Stefan Roettger's CLOD algorithm.
4 //
5 // Utilizes: Roettger's MINI library implementation
6 // http://stereofx.org/#Terrain
7 //
8 // Copyright (c) 2002-2011 Virtual Terrain Project
9 // Free for all uses, see license.txt for details.
10 //
11 
12 #ifndef SRTERRAINH
13 #define SRTERRAINH
14 
15 #include "DynTerrain.h"
16 
19 
26 {
27 public:
28  SRTerrain();
29 
30  // initialization
31  DTErr Init(const vtElevationGrid *pGrid, float fZScale);
32 
33  // overrides
34  void DoRender();
35  void DoCulling(const vtCamera *pCam);
36  float GetElevation(int iX, int iZ, bool bTrue = false) const;
37  void SetElevation(int iX, int iZ, float fValue, bool bTrue = false);
38  void GetWorldLocation(int iX, int iZ, FPoint3 &p, bool bTrue = false) const;
39  void SetVerticalExag(float fExag);
40  float GetVerticalExag() const { return m_fHeightScale; }
41  void SetPolygonTarget(int iCount);
42 
43  // Dynamic elevation
44  DTErr ReInit(const vtElevationGrid *pGrid);
45 
46  void LoadSingleMaterial();
47 
48  int m_iBlockSize;
49 
50  float m_fResolution;
51  float m_fHResolution;
52  float m_fLResolution;
53 
54 protected:
55  // rendering
56  void RenderSurface();
57  void RenderPass();
58 
59  // cleanup
60  virtual ~SRTerrain();
61 
62 private:
63  class ministub *m_pMini;
64 
65  IPoint2 m_window_size;
66  FPoint3 m_eyepos_ogl;
67  float m_fFOVY;
68  float m_fAspect;
69  float m_fNear, m_fFar;
70  FPoint3 eye_up, eye_forward;
71 
72  float m_fHeightScale;
73  float m_fMaximumScale;
74  float m_fDrawScale;
75  bool m_bFloat;
76 };
77  // Group dynterr
79 
80 #endif // SRTerrain