OpenIRT/include/RayPacket.h
// Checks how many rays in the packet hit and which is the first one.
// This is *not* efficient and should only be called after the traversal
// (which keeps those stats separately) to find out which rays to shade.
Checks how many rays in the packet hit and which is the first one.
This is *not* efficient and should only be called after the traversal
(which keeps those stats separately) to find out which rays to shade.
Checks how many rays in the packet hit and which is the first one . This is * not * efficient and should only be called after the traversal ( which keeps those stats separately ) to find out which rays to shade .
void calculateHitStats() {				
		int back = nRays-1;
		numRaysHit = 0;
		for (int r = 0; r < nRays; r++) {
			if (rayHasHit[r] == 0)
				sortedRayIDs[back--] = r;
			else
				sortedRayIDs[numRaysHit++] = r;
		}
		firstHitRay = sortedRayIDs[0];
		lastHitRay = sortedRayIDs[numRaysHit - 1];
	}
void calculateHitStats ( ) { int back = nRays - 1 ; numRaysHit = 0 ; for ( int r = 0 ; r < nRays ; r ++ ) { if ( rayHasHit [ r ] == 0 ) sortedRayIDs [ back -- ] = r ; else sortedRayIDs [ numRaysHit ++ ] = r ; } firstHitRay = sortedRayIDs [ 0 ] ; lastHitRay = sortedRayIDs [ numRaysHit - 1 ] ; }
Checks how many rays in the packet hit and which is the first one.
Checks how many rays in the packet hit and which is the first one .