openscenegraph
HeightAboveTerrain
Go to the documentation of this file.
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
12*/
13
14#ifndef OSGSIM_HEIGHTABOVETERRAIN
15#define OSGSIM_HEIGHTABOVETERRAIN 1
16
18
19// include so we can get access to the DatabaseCacheReadCallback
20#include <osgSim/LineOfSight>
21
22namespace osgSim {
23
33{
34 public :
35
36
38
39
41 void clear();
42
44 unsigned int addPoint(const osg::Vec3d& point);
45
47 unsigned int getNumPoints() const { return _HATList.size(); }
48
50 void setPoint(unsigned int i, const osg::Vec3d& point) { _HATList[i]._point = point; }
51
53 const osg::Vec3d& getPoint(unsigned int i) const { return _HATList[i]._point; }
54
58 double getHeightAboveTerrain(unsigned int i) const { return _HATList[i]._hat; }
59
62 void setLowestHeight(double lowestHeight) { _lowestHeight = lowestHeight; }
63
65 double getLowestHeight() const { return _lowestHeight; }
66
72 void computeIntersections(osg::Node* scene, osg::Node::NodeMask traversalMask=0xffffffff);
73
75 static double computeHeightAboveTerrain(osg::Node* scene, const osg::Vec3d& point, osg::Node::NodeMask traversalMask=0xffffffff);
76
77
79 void clearDatabaseCache() { if (_dcrc.valid()) _dcrc->clearDatabaseCache(); }
80
85
88
89 protected :
90
91 struct HAT
92 {
93 HAT(const osg::Vec3d& point):
94 _point(point),
95 _hat(0.0) {}
96
98 double _hat;
99 };
100
101 typedef std::vector<HAT> HATList;
102
103
106
107
110
111
112};
113
114}
115
116#endif
Definition LineOfSight:24
Definition HeightAboveTerrain:33
osgUtil::IntersectionVisitor _intersectionVisitor
Definition HeightAboveTerrain:109
double getHeightAboveTerrain(unsigned int i) const
Definition HeightAboveTerrain:58
DatabaseCacheReadCallback * getDatabaseCacheReadCallback()
Definition HeightAboveTerrain:87
void setLowestHeight(double lowestHeight)
Definition HeightAboveTerrain:62
double _lowestHeight
Definition HeightAboveTerrain:104
void setDatabaseCacheReadCallback(DatabaseCacheReadCallback *dcrc)
void clearDatabaseCache()
Definition HeightAboveTerrain:79
const osg::Vec3d & getPoint(unsigned int i) const
Definition HeightAboveTerrain:53
std::vector< HAT > HATList
Definition HeightAboveTerrain:101
unsigned int addPoint(const osg::Vec3d &point)
void computeIntersections(osg::Node *scene, osg::Node::NodeMask traversalMask=0xffffffff)
osg::ref_ptr< DatabaseCacheReadCallback > _dcrc
Definition HeightAboveTerrain:108
HATList _HATList
Definition HeightAboveTerrain:105
static double computeHeightAboveTerrain(osg::Node *scene, const osg::Vec3d &point, osg::Node::NodeMask traversalMask=0xffffffff)
void setPoint(unsigned int i, const osg::Vec3d &point)
Definition HeightAboveTerrain:50
unsigned int getNumPoints() const
Definition HeightAboveTerrain:47
double getLowestHeight() const
Definition HeightAboveTerrain:65
Definition IntersectionVisitor:152
Definition Node:72
unsigned int NodeMask
Definition Node:363
Definition Vec3d:30
Definition ref_ptr:32
Definition BlinkSequence:27
#define OSGSIM_EXPORT
Definition osgSim/Export:38
Definition HeightAboveTerrain:92
HAT(const osg::Vec3d &point)
Definition HeightAboveTerrain:93
osg::Vec3d _point
Definition HeightAboveTerrain:97
double _hat
Definition HeightAboveTerrain:98