5 # error This library requires C++
8 #include <simgear/compiler.h>
27 FGHitRec( ssgEntity *e, int idx, sgdVec3 p, sgdVec3 n ) {
30 sgdSetVec3(point,p[0],p[1],p[2]);
31 sgdSetVec3(normal,n[0],n[1],n[2]);
34 ssgEntity *get_entity(void) { return ent; }
35 int get_face(void) { return index; }
36 double *get_point(void) { return point; }
37 double *get_normal(void) { return normal; }
46 vector < FGHitRec > list;
50 FGHitList() { last = NULL; }
51 void init(void) { list.clear(); }
52 void clear(void) { init(); last = NULL; }
53 void add( ssgEntity *ent, int idx, sgdVec3 point, sgdVec3 normal ) {
54 list.push_back( FGHitRec( ent,idx,point,normal) );
57 int num_hits(void) { return list.size(); }
58 ssgEntity *get_entity(int i) { return list[i].get_entity(); }
59 ssgEntity *last_hit(void) { return last; }
60 int get_face(int i) { return list[i].get_face(); }
61 double *get_point(int i) { return list[i].get_point(); }
62 double *get_normal(int i) { return list[i].get_normal(); }
64 void Intersect( ssgBranch *branch,
65 sgdVec3 orig, sgdVec3 dir );
67 void IntersectBranch( ssgBranch *branch, sgdMat4 m,
68 sgdVec3 orig, sgdVec3 dir);
70 void IntersectCachedLeaf( sgdMat4 m,
71 sgdVec3 orig, sgdVec3 dir);
73 int IntersectLeaf( ssgLeaf *leaf, sgdMat4 m,
74 sgdVec3 orig, sgdVec3 dir );
78 inline void FGHitList::Intersect( ssgBranch *scene,
79 sgdVec3 orig, sgdVec3 dir )
86 sgdMakeIdentMat4 ( m ) ;
87 IntersectCachedLeaf(m, orig, dir);
91 sgdMakeIdentMat4 ( m ) ;
92 IntersectBranch( scene, m, orig, dir);
97 // Associated function, assuming a wgs84 world with 0,0,0 at the
98 // center, find the current terrain intersection elevation for the
100 bool fgCurrentElev( sgdVec3 abs_view_pos, sgdVec3 scenery_center,
102 double *terrain_elev, double *radius, double *normal );
105 #endif // _HITLIST_HXX