KiCad PCB EDA Suite
raypacket.h File Reference
#include "ray.h"
#include "frustum.h"
#include "../camera.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 CAMERA &aCamera, const SFVEC2F &aWindowsPosition, RAY *aRayPck)
 
void RAYPACKET_InitRays_with2DDisplacement (const CAMERA &aCamera, const SFVEC2F &aWindowsPosition, const SFVEC2F &a2DWindowsPosDisplacementFactor, RAY *aRayPck)
 

Macro Definition Documentation

◆ RAYPACKET_DIM

#define RAYPACKET_DIM   (1 << 3)

Definition at line 32 of file raypacket.h.

◆ RAYPACKET_INVMASK

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

Definition at line 34 of file raypacket.h.

◆ RAYPACKET_MASK

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

Definition at line 33 of file raypacket.h.

◆ RAYPACKET_RAYS_PER_PACKET

#define RAYPACKET_RAYS_PER_PACKET   ( RAYPACKET_DIM * RAYPACKET_DIM )

Definition at line 35 of file raypacket.h.

Function Documentation

◆ RAYPACKET_InitRays()

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

Definition at line 143 of file raypacket.cpp.

144 {
145  for( unsigned int y = 0, i = 0; y < RAYPACKET_DIM; ++y )
146  {
147  for( unsigned int x = 0; x < RAYPACKET_DIM; ++x, ++i )
148  {
149  SFVEC3F rayOrigin;
150  SFVEC3F rayDir;
151 
152  aCamera.MakeRay( SFVEC2F( aWindowsPosition.x + (float)x,
153  aWindowsPosition.y + (float)y ),
154  rayOrigin, rayDir );
155 
156  aRayPck[i].Init( rayOrigin, rayDir );
157  }
158  }
159 }
#define RAYPACKET_DIM
Definition: raypacket.h:32
void Init(const SFVEC3F &o, const SFVEC3F &d)
Definition: ray.cpp:35
glm::vec2 SFVEC2F
Definition: xv3d_types.h:42
void MakeRay(const SFVEC2I &aWindowPos, SFVEC3F &aOutOrigin, SFVEC3F &aOutDirection) const
Make a ray based on a windows screen position.
Definition: camera.cpp:323
glm::vec3 SFVEC3F
Definition: xv3d_types.h:44

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

Referenced by RAYPACKET::RAYPACKET().

◆ RAYPACKET_InitRays_with2DDisplacement()

void RAYPACKET_InitRays_with2DDisplacement ( const CAMERA aCamera,
const SFVEC2F aWindowsPosition,
const SFVEC2F a2DWindowsPosDisplacementFactor,
RAY aRayPck 
)

Definition at line 162 of file raypacket.cpp.

165 {
166  for( unsigned int y = 0, i = 0; y < RAYPACKET_DIM; ++y )
167  {
168  for( unsigned int x = 0; x < RAYPACKET_DIM; ++x, ++i )
169  {
170  SFVEC3F rayOrigin;
171  SFVEC3F rayDir;
172 
173  aCamera.MakeRay( SFVEC2F( aWindowsPosition.x +(float)x +
174  Fast_RandFloat() * a2DWindowsPosDisplacementFactor.x,
175  aWindowsPosition.y + (float)y +
176  Fast_RandFloat() * a2DWindowsPosDisplacementFactor.y ),
177  rayOrigin, rayDir );
178 
179  aRayPck[i].Init( rayOrigin, rayDir );
180  }
181  }
182 }
#define RAYPACKET_DIM
Definition: raypacket.h:32
void Init(const SFVEC3F &o, const SFVEC3F &d)
Definition: ray.cpp:35
float Fast_RandFloat()
Definition: 3d_fastmath.cpp:45
glm::vec2 SFVEC2F
Definition: xv3d_types.h:42
void MakeRay(const SFVEC2I &aWindowPos, SFVEC3F &aOutOrigin, SFVEC3F &aOutDirection) const
Make a ray based on a windows screen position.
Definition: camera.cpp:323
glm::vec3 SFVEC3F
Definition: xv3d_types.h:44

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

Referenced by RAYPACKET::RAYPACKET(), and RENDER_3D_RAYTRACE::renderBlockTracing().