OpenSceneGraph 3.6.5
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
The osgSim library is a NodeKit that extends the core scene graph to support nodes and drawables that...
Definition BlinkSequence:27
Base class for all internal nodes in the scene graph.
Definition Node:72
unsigned int NodeMask
This is a set of bits (flags) that represent the Node.
Definition Node:363
Smart pointer for handling referenced counted objects.
Definition ref_ptr:32
General purpose double triple for use as vertices, vectors and normals.
Definition Vec3d:30
osgUtil::IntersectionVisitor _intersectionVisitor
Definition HeightAboveTerrain:109
double getHeightAboveTerrain(unsigned int i) const
Get the intersection height for a single height above terrain test.
Definition HeightAboveTerrain:58
DatabaseCacheReadCallback * getDatabaseCacheReadCallback()
Get the ReadCallback that does the reading of external PagedLOD models, and caching of loaded subgrap...
Definition HeightAboveTerrain:87
void setLowestHeight(double lowestHeight)
Set the lowest height that the should be tested for.
Definition HeightAboveTerrain:62
double _lowestHeight
Definition HeightAboveTerrain:104
void setDatabaseCacheReadCallback(DatabaseCacheReadCallback *dcrc)
Set the ReadCallback that does the reading of external PagedLOD models, and caching of loaded subgrap...
void clear()
Clear the internal HAT List so it contains no height above terrain tests.
void clearDatabaseCache()
Clear the database cache.
Definition HeightAboveTerrain:79
const osg::Vec3d & getPoint(unsigned int i) const
Get the source point of single height above terrain test.
Definition HeightAboveTerrain:53
std::vector< HAT > HATList
Definition HeightAboveTerrain:101
unsigned int addPoint(const osg::Vec3d &point)
Add a height above terrain test point in the CoordinateFrame.
void computeIntersections(osg::Node *scene, osg::Node::NodeMask traversalMask=0xffffffff)
Compute the HAT intersections with the specified scene graph.
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)
Compute the vertical distance between the specified scene graph and a single HAT point.
void setPoint(unsigned int i, const osg::Vec3d &point)
Set the source point of single height above terrain test.
Definition HeightAboveTerrain:50
unsigned int getNumPoints() const
Get the number of height above terrain tests.
Definition HeightAboveTerrain:47
double getLowestHeight() const
Get the lowest height that the should be tested for.
Definition HeightAboveTerrain:65
HAT(const osg::Vec3d &point)
Definition HeightAboveTerrain:93
osg::Vec3d _point
Definition HeightAboveTerrain:97
double _hat
Definition HeightAboveTerrain:98
Definition LineOfSight:24
IntersectionVisitor is used to testing for intersections with the scene, traversing the scene using g...
Definition IntersectionVisitor:152
#define OSGSIM_EXPORT
Definition Export:38

osg logo
Generated at Sun Jul 27 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.