2 // Height Over Terrain and Assosciated Routines for FlightGear based Scenery
3 // Written by Norman Vine, started 2000.
9 # error This library requires C++
12 #include <simgear/compiler.h>
31 FGHitRec( ssgEntity *e, int idx, sgdVec3 p, sgdVec3 n ) {
34 sgdSetVec3(point,p[0],p[1],p[2]);
35 sgdSetVec3(normal,n[0],n[1],n[2]);
38 ssgEntity *get_entity(void) { return ent; }
39 int get_face(void) { return index; }
40 double *get_point(void) { return point; }
41 double *get_normal(void) { return normal; }
50 vector < FGHitRec > list;
58 void init(void) { list.clear(); test_dist=DBL_MAX; }
59 void clear(void) { init(); last = NULL; }
60 void add( ssgEntity *ent, int idx, sgdVec3 point, sgdVec3 normal ) {
61 list.push_back( FGHitRec( ent,idx,point,normal) );
64 int num_hits(void) { return list.size(); }
65 ssgEntity *get_entity(int i) { return list[i].get_entity(); }
66 ssgEntity *last_hit(void) { return last; }
67 int get_face(int i) { return list[i].get_face(); }
68 double *get_point(int i) { return list[i].get_point(); }
69 double *get_normal(int i) { return list[i].get_normal(); }
71 void Intersect( ssgBranch *branch, sgdVec3 orig, sgdVec3 dir );
72 void Intersect( ssgBranch *scene, sgdMat4 m, sgdVec3 orig, sgdVec3 dir );
74 void IntersectBranch( ssgBranch *branch, sgdMat4 m, sgdVec3 orig, sgdVec3 dir);
76 int IntersectLeaf( ssgLeaf *leaf, sgdMat4 m,
77 sgdVec3 orig, sgdVec3 dir );
79 int IntersectLeaf( ssgLeaf *leaf, sgdMat4 m,
80 sgdVec3 orig, sgdVec3 dir,
85 // Associated functions, assuming a wgs84 world with 0,0,0 at the
86 // center, find the current terrain intersection elevation for the
88 bool fgCurrentElev( sgdVec3 abs_view_pos,
90 sgdVec3 scenery_center,
98 bool fgCurrentElev( sgdVec3 abs_view_pos,
100 sgdVec3 scenery_center,
102 double *terrain_elev,
106 #endif // _HITLIST_HXX