KiCad PCB EDA Suite
raypacket.h File Reference
#include "ray.h"
#include "cfrustum.h"
#include "../ccamera.h"

Go to the source code of this file.

Classes

struct  RAYPACKET
 

Macros

#define RAYPACKET_DIM   (1 << 3)
 
#define RAYPACKET_MASK   (unsigned int)( (RAYPACKET_DIM - 1))
 
#define RAYPACKET_INVMASK   (unsigned int)(~(RAYPACKET_DIM - 1))
 
#define RAYPACKET_RAYS_PER_PACKET   (RAYPACKET_DIM * RAYPACKET_DIM)
 

Functions

void RAYPACKET_InitRays (const CCAMERA &aCamera, const SFVEC2F &aWindowsPosition, RAY *aRayPck)
 
void RAYPACKET_InitRays_with2DDisplacement (const CCAMERA &aCamera, const SFVEC2F &aWindowsPosition, const SFVEC2F &a2DWindowsPosDisplacementFactor, RAY *aRayPck)
 

Macro Definition Documentation

#define RAYPACKET_INVMASK   (unsigned int)(~(RAYPACKET_DIM - 1))

Definition at line 39 of file raypacket.h.

Referenced by C3D_RENDER_RAYTRACING::initialize_block_positions().

#define RAYPACKET_MASK   (unsigned int)( (RAYPACKET_DIM - 1))

Definition at line 38 of file raypacket.h.

Function Documentation

void RAYPACKET_InitRays ( const CCAMERA aCamera,
const SFVEC2F aWindowsPosition,
RAY aRayPck 
)

Definition at line 154 of file raypacket.cpp.

References RAY::Init(), CCAMERA::MakeRay(), and RAYPACKET_DIM.

Referenced by RAYPACKET::RAYPACKET().

157 {
158  for( unsigned int y = 0, i = 0; y < RAYPACKET_DIM; ++y )
159  {
160  for( unsigned int x = 0; x < RAYPACKET_DIM; ++x, ++i )
161  {
162  SFVEC3F rayOrigin;
163  SFVEC3F rayDir;
164 
165  aCamera.MakeRay( SFVEC2F( aWindowsPosition.x + (float)x,
166  aWindowsPosition.y + (float)y ),
167  rayOrigin, rayDir );
168 
169  aRayPck[i].Init( rayOrigin, rayDir );
170  }
171  }
172 }
#define RAYPACKET_DIM
Definition: raypacket.h:37
void Init(const SFVEC3F &o, const SFVEC3F &d)
Definition: ray.cpp:38
glm::vec2 SFVEC2F
Definition: xv3d_types.h:45
void MakeRay(const SFVEC2I &aWindowPos, SFVEC3F &aOutOrigin, SFVEC3F &aOutDirection) const
MakeRay - Make a ray based on a windows screen position.
Definition: ccamera.cpp:293
glm::vec3 SFVEC3F
Definition: xv3d_types.h:47
void RAYPACKET_InitRays_with2DDisplacement ( const CCAMERA aCamera,
const SFVEC2F aWindowsPosition,
const SFVEC2F a2DWindowsPosDisplacementFactor,
RAY aRayPck 
)

Definition at line 174 of file raypacket.cpp.

References Fast_RandFloat(), RAY::Init(), CCAMERA::MakeRay(), and RAYPACKET_DIM.

Referenced by RAYPACKET::RAYPACKET(), and C3D_RENDER_RAYTRACING::rt_render_trace_block().

178 {
179  for( unsigned int y = 0, i = 0; y < RAYPACKET_DIM; ++y )
180  {
181  for( unsigned int x = 0; x < RAYPACKET_DIM; ++x, ++i )
182  {
183  SFVEC3F rayOrigin;
184  SFVEC3F rayDir;
185 
186  aCamera.MakeRay( SFVEC2F( aWindowsPosition.x +(float)x +
187  Fast_RandFloat() * a2DWindowsPosDisplacementFactor.x,
188  aWindowsPosition.y + (float)y +
189  Fast_RandFloat() * a2DWindowsPosDisplacementFactor.y ),
190  rayOrigin, rayDir );
191 
192  aRayPck[i].Init( rayOrigin, rayDir );
193  }
194  }
195 }
#define RAYPACKET_DIM
Definition: raypacket.h:37
void Init(const SFVEC3F &o, const SFVEC3F &d)
Definition: ray.cpp:38
float Fast_RandFloat()
Definition: 3d_fastmath.cpp:45
glm::vec2 SFVEC2F
Definition: xv3d_types.h:45
void MakeRay(const SFVEC2I &aWindowPos, SFVEC3F &aOutOrigin, SFVEC3F &aOutDirection) const
MakeRay - Make a ray based on a windows screen position.
Definition: ccamera.cpp:293
glm::vec3 SFVEC3F
Definition: xv3d_types.h:47