Umasoft
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
ExternalHeightField3d.h
1 //
2 // ExternalHeightField3d.h
3 //
4 // Copyright (c) 2010-2011 Virtual Terrain Project
5 // Free for all uses, see license.txt for details.
6 //
7 
8 #pragma once
9 
10 #include "vtdata/HeightField.h"
11 #include <osg/Node>
12 #ifdef USE_OSGEARTH
13 #include <osgEarthUtil/ElevationManager>
14 #endif
15 
16 class vtGeode;
17 class vtProjection;
18 namespace osgTerrain
19 {
20  class Layer;
21 };
22 namespace osgSim
23 {
24  class HeightAboveTerrain;
25 };
26 
27 class vtExternalHeightField3d : public vtHeightField3d, public osg::Referenced
28 {
29 public:
32 
33  bool Initialize(const char *external_data);
34  osg::Node *CreateGeometry();
35 
36  vtProjection &GetProjection();
37  const vtProjection &GetProjection() const;
38 
39  bool FindAltitudeOnEarth(const DPoint2 &p, float &fAltitude, bool bTrue = false) const;
40  bool FindAltitudeAtPoint(const FPoint3 &p3, float &fAltitude, bool bTrue = false, int iCultureFlags = 0, FPoint3 *vNormal = NULL) const;
41  bool CastRayToSurface(const FPoint3 &point, const FPoint3 &dir, FPoint3 &result) const;
42 
43 private:
44  osg::ref_ptr<osg::Node> m_pNode;
45  osg::PagedLOD *m_pLOD;
46  osgTerrain::Layer *m_pLayer;
47  vtProjection m_Projection;
48  osg::Matrix m_TransfromOSGModel2VTPWorld;
49  osg::Matrix m_TransformVTPWorld2OSGModel;
50  osgSim::HeightAboveTerrain *m_pHat;
51  bool m_bOsgEarth;
52 
53 #ifdef USE_OSGEARTH
54  osg::ref_ptr<osgEarth::Util::ElevationManager> m_pElevationManager;
55  float m_ResolutionAtLevel0;
56  float m_CompromiseResolution;
57 #endif
58 };