1
0
Fork 0

Remove cached intersection code so that we can support intersecting with

dynamic objects.
This commit is contained in:
curt 2001-07-31 19:54:29 +00:00
parent 57b4283383
commit 17c781a870
2 changed files with 42 additions and 36 deletions

View file

@ -230,9 +230,9 @@ void FGHitList::IntersectBranch( ssgBranch *branch, sgdMat4 m,
center[1] = fcenter[1];
center[2] = fcenter[2];
sgdXformPnt3( center, m ) ;
double radius_sqd = bsphere->getRadius() * bsphere->getRadius();
// watch out for overflow
if ( sgdClosestPointToLineDistSquared( center, orig, dir ) <
radius_sqd )
double(bsphere->getRadius() * bsphere->getRadius()) )
{
// possible intersections
if ( kid->isAKindOf ( ssgTypeBranch() ) ) {
@ -307,7 +307,7 @@ void FGHitList::IntersectCachedLeaf( sgdMat4 m,
sgdXformPnt3( center, m );
if ( sgdClosestPointToLineDistSquared( center, orig, dir ) <
radius*radius )
double(radius*radius) )
{
IntersectLeaf( (ssgLeaf *)last_hit(), m, orig, dir );
}

View file

@ -80,17 +80,23 @@ inline void FGHitList::Intersect( ssgBranch *scene,
{
sgdMat4 m;
#ifdef USE_CACHED_HIT
// This optimization gives a slight speedup
// but it precludes using the hitlist for dynamic
// objects NHV
init();
if( last_hit() ) {
sgdMakeIdentMat4 ( m ) ;
IntersectCachedLeaf(m, orig, dir);
}
if( ! num_hits() ) {
#endif
clear();
sgdMakeIdentMat4 ( m ) ;
IntersectBranch( scene, m, orig, dir);
#ifdef USE_CACHED_HIT
}
#endif
}