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>
32 FGHitRec( ssgEntity *e, int idx, sgdVec3 p, sgdVec3 n ) {
35 sgdSetVec3(point,p[0],p[1],p[2]);
36 sgdSetVec3(normal,n[0],n[1],n[2]);
39 ssgEntity *get_entity(void) { return ent; }
40 int get_face(void) { return index; }
41 double *get_point(void) { return point; }
42 double *get_normal(void) { return normal; }
51 vector < FGHitRec > list;
59 void init(void) { list.clear(); test_dist=DBL_MAX; }
60 void clear(void) { init(); last = NULL; }
61 void add( ssgEntity *ent, int idx, sgdVec3 point, sgdVec3 normal ) {
62 list.push_back( FGHitRec( ent,idx,point,normal) );
65 int num_hits(void) { return list.size(); }
66 ssgEntity *get_entity(int i) { return list[i].get_entity(); }
67 ssgEntity *last_hit(void) { return last; }
68 int get_face(int i) { return list[i].get_face(); }
69 double *get_point(int i) { return list[i].get_point(); }
70 double *get_normal(int i) { return list[i].get_normal(); }
72 void Intersect( ssgBranch *branch, sgdVec3 orig, sgdVec3 dir );
73 void Intersect( ssgBranch *scene, sgdMat4 m, sgdVec3 orig, sgdVec3 dir );
75 void IntersectBranch( ssgBranch *branch, sgdMat4 m, sgdVec3 orig, sgdVec3 dir);
77 int IntersectLeaf( ssgLeaf *leaf, sgdMat4 m,
78 sgdVec3 orig, sgdVec3 dir );
80 int IntersectLeaf( ssgLeaf *leaf, sgdMat4 m,
81 sgdVec3 orig, sgdVec3 dir,
86 // Associated functions, assuming a wgs84 world with 0,0,0 at the
87 // center, find the current terrain intersection elevation for the
89 bool fgCurrentElev( sgdVec3 abs_view_pos,
91 sgdVec3 scenery_center,
99 bool fgCurrentElev( sgdVec3 abs_view_pos,
101 sgdVec3 scenery_center,
103 double *terrain_elev,
107 #endif // _HITLIST_HXX