34 #define BVH_RANGED_TRAVERSAL 71 #ifdef BVH_RANGED_TRAVERSAL 102 int todoOffset = 0, nodeNum = 0;
120 nodeNum = nodeNum + 1;
134 for(
unsigned int i = ia; i < ie; ++i )
151 if( todoOffset == 0 )
154 const StackNode& node = todo[--todoOffset];
169 #ifdef BVH_PARTITION_TRAVERSAL 172 unsigned int ia,
const unsigned int* aRayIndex,
188 static inline unsigned int partRays(
const RAYPACKET& aRayPacket,
const BBOX_3D& aBBox,
189 unsigned int ia,
unsigned int* aRayIndex,
198 for(
unsigned int i = 0; i < ia; ++i )
204 std::swap( aRayIndex[ie++], aRayIndex[i] );
214 int todoOffset = 0, nodeNum = 0;
227 ia = partRays( aRayPacket, curCell->
bounds, ia,
I, aHitInfoPacket );
236 nodeNum = nodeNum + 1;
250 for(
unsigned int i = 0; i < ie; ++i )
252 unsigned int idx =
I[i];
255 aHitInfoPacket[idx].m_HitInfo );
269 if( todoOffset == 0 )
272 const StackNode& node = todo[--todoOffset];
static unsigned int getFirstHit(const RAYPACKET &aRayPacket, const BBOX_3D &aBBox, unsigned int ia, HITINFO_PACKET *aHitInfoPacket)
RAY m_ray[RAYPACKET_RAYS_PER_PACKET]
CONST_VECTOR_OBJECT m_primitives
uint16_t nPrimitives
0 -> interior node
virtual bool Intersect(const RAY &aRay, HITINFO &aHitInfo) const =0
Manage a bounding box defined by two SFVEC3F min max points.
bool Intersect(const RAY &aRay, float *t) const
This BVH implementation is based on the source code implementation from the book "Physically Based Re...
float m_tHit
( 4) distance
static unsigned int getLastHit(const RAYPACKET &aRayPacket, const BBOX_3D &aBBox, unsigned int ia, HITINFO_PACKET *aHitInfoPacket)
bool Intersect(const BBOX_3D &aBBox) const
Intersect aBBox with this frustum.
#define RAYPACKET_RAYS_PER_PACKET
unsigned int m_acc_node_info
( 4) The acc stores here the node that it hits
bool Intersect(const RAY &aRay, HITINFO &aHitInfo) const override
const BBOX_3D & GetBBox() const
int secondChildOffset
interior
unsigned int m_I[RAYPACKET_RAYS_PER_PACKET]