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>
30 FGHitRec( ssgEntity *e, int idx, sgdVec3 p, sgdVec3 n ) {
33 sgdSetVec3(point,p[0],p[1],p[2]);
34 sgdSetVec3(normal,n[0],n[1],n[2]);
37 ssgEntity *get_entity(void) { return ent; }
38 int get_face(void) { return index; }
39 double *get_point(void) { return point; }
40 double *get_normal(void) { return normal; }
49 vector < FGHitRec > list;
57 void init(void) { list.clear(); test_dist=DBL_MAX; }
58 void clear(void) { init(); last = NULL; }
59 void add( ssgEntity *ent, int idx, sgdVec3 point, sgdVec3 normal ) {
60 list.push_back( FGHitRec( ent,idx,point,normal) );
63 int num_hits(void) { return list.size(); }
64 ssgEntity *get_entity(int i) { return list[i].get_entity(); }
65 ssgEntity *last_hit(void) { return last; }
66 int get_face(int i) { return list[i].get_face(); }
67 double *get_point(int i) { return list[i].get_point(); }
68 double *get_normal(int i) { return list[i].get_normal(); }
70 void Intersect( ssgBranch *branch, sgdVec3 orig, sgdVec3 dir );
71 void Intersect( ssgBranch *scene, sgdMat4 m, sgdVec3 orig, sgdVec3 dir );
73 void IntersectBranch( ssgBranch *branch, sgdMat4 m, sgdVec3 orig, sgdVec3 dir);
75 int IntersectLeaf( ssgLeaf *leaf, sgdMat4 m,
76 sgdVec3 orig, sgdVec3 dir );
78 int IntersectLeaf( ssgLeaf *leaf, sgdMat4 m,
79 sgdVec3 orig, sgdVec3 dir,
84 // Associated functions, assuming a wgs84 world with 0,0,0 at the
85 // center, find the current terrain intersection elevation for the
87 bool fgCurrentElev( sgdVec3 abs_view_pos,
88 sgdVec3 scenery_center,
89 ssgTransform *terra_transform,
95 bool fgCurrentElev( sgdVec3 abs_view_pos,
96 sgdVec3 scenery_center,
102 #endif // _HITLIST_HXX