KiCad PCB EDA Suite
cbvh_packet_traversal.cpp File Reference

This file implementes packet traversal over the BVH PBRT implementation. More...

#include "cbvh_pbrt.h"
#include <wx/debug.h>

Go to the source code of this file.

Classes

struct  StackNode
 

Macros

#define BVH_RANGED_TRAVERSAL
 
#define MAX_TODOS   64
 

Functions

static unsigned int getFirstHit (const RAYPACKET &aRayPacket, const CBBOX &aBBox, unsigned int ia, HITINFO_PACKET *aHitInfoPacket)
 
static unsigned int getLastHit (const RAYPACKET &aRayPacket, const CBBOX &aBBox, unsigned int ia, HITINFO_PACKET *aHitInfoPacket)
 

Detailed Description

This file implementes packet traversal over the BVH PBRT implementation.

Definition in file cbvh_packet_traversal.cpp.

Macro Definition Documentation

#define BVH_RANGED_TRAVERSAL

Definition at line 34 of file cbvh_packet_traversal.cpp.

#define MAX_TODOS   64

Definition at line 38 of file cbvh_packet_traversal.cpp.

Referenced by CBVH_PBRT::Intersect().

Function Documentation

static unsigned int getFirstHit ( const RAYPACKET aRayPacket,
const CBBOX aBBox,
unsigned int  ia,
HITINFO_PACKET aHitInfoPacket 
)
inlinestatic

Definition at line 48 of file cbvh_packet_traversal.cpp.

References CFRUSTUM::Intersect(), CBBOX::Intersect(), RAYPACKET::m_Frustum, RAYPACKET::m_ray, and RAYPACKET_RAYS_PER_PACKET.

Referenced by CBVH_PBRT::Intersect().

52 {
53  float hitT;
54 
55  if( aBBox.Intersect( aRayPacket.m_ray[ia], &hitT ) )
56  if( hitT < aHitInfoPacket[ia].m_HitInfo.m_tHit )
57  return ia;
58 
59  if( !aRayPacket.m_Frustum.Intersect( aBBox ) )
61 
62  for( unsigned int i = ia + 1; i < RAYPACKET_RAYS_PER_PACKET; ++i )
63  {
64  if( aBBox.Intersect( aRayPacket.m_ray[i], &hitT ) )
65  if( hitT < aHitInfoPacket[i].m_HitInfo.m_tHit )
66  return i;
67  }
68 
70 }
RAY m_ray[RAYPACKET_RAYS_PER_PACKET]
Definition: raypacket.h:46
CFRUSTUM m_Frustum
Definition: raypacket.h:45
bool Intersect(const CBBOX &aBBox) const
Intersect - Intersects a bbox with this frustum.
Definition: cfrustum.cpp:65
bool Intersect(const RAY &aRay, float *t) const
Function Intersect.
Definition: cbbox_ray.cpp:46
#define RAYPACKET_RAYS_PER_PACKET
Definition: raypacket.h:40
static unsigned int getLastHit ( const RAYPACKET aRayPacket,
const CBBOX aBBox,
unsigned int  ia,
HITINFO_PACKET aHitInfoPacket 
)
inlinestatic

Definition at line 75 of file cbvh_packet_traversal.cpp.

References CBBOX::Intersect(), RAYPACKET::m_ray, and RAYPACKET_RAYS_PER_PACKET.

Referenced by CBVH_PBRT::Intersect().

79 {
80  for( unsigned int ie = (RAYPACKET_RAYS_PER_PACKET - 1); ie > ia; --ie )
81  {
82  float hitT;
83 
84  if( aBBox.Intersect( aRayPacket.m_ray[ie], &hitT ) )
85  if( hitT < aHitInfoPacket[ie].m_HitInfo.m_tHit )
86  return ie + 1;
87  }
88 
89  return ia + 1;
90 }
RAY m_ray[RAYPACKET_RAYS_PER_PACKET]
Definition: raypacket.h:46
bool Intersect(const RAY &aRay, float *t) const
Function Intersect.
Definition: cbbox_ray.cpp:46
#define RAYPACKET_RAYS_PER_PACKET
Definition: raypacket.h:40