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 37 of file raypacket.h.

◆ RAYPACKET_INVMASK

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

Definition at line 39 of file raypacket.h.

◆ RAYPACKET_MASK

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

Definition at line 38 of file raypacket.h.

◆ RAYPACKET_RAYS_PER_PACKET

#define RAYPACKET_RAYS_PER_PACKET   ( RAYPACKET_DIM * RAYPACKET_DIM )

Definition at line 40 of file raypacket.h.

Function Documentation

◆ RAYPACKET_InitRays()

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

Definition at line 148 of file raypacket.cpp.

149 {
150  for( unsigned int y = 0, i = 0; y < RAYPACKET_DIM; ++y )
151  {
152  for( unsigned int x = 0; x < RAYPACKET_DIM; ++x, ++i )
153  {
154  SFVEC3F rayOrigin;
155  SFVEC3F rayDir;
156 
157  aCamera.MakeRay( SFVEC2F( aWindowsPosition.x + (float)x,
158  aWindowsPosition.y + (float)y ),
159  rayOrigin, rayDir );
160 
161  aRayPck[i].Init( rayOrigin, rayDir );
162  }
163  }
164 }
#define RAYPACKET_DIM
Definition: raypacket.h:37
void Init(const SFVEC3F &o, const SFVEC3F &d)
Definition: ray.cpp:41
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:309
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 167 of file raypacket.cpp.

170 {
171  for( unsigned int y = 0, i = 0; y < RAYPACKET_DIM; ++y )
172  {
173  for( unsigned int x = 0; x < RAYPACKET_DIM; ++x, ++i )
174  {
175  SFVEC3F rayOrigin;
176  SFVEC3F rayDir;
177 
178  aCamera.MakeRay( SFVEC2F( aWindowsPosition.x +(float)x +
179  Fast_RandFloat() * a2DWindowsPosDisplacementFactor.x,
180  aWindowsPosition.y + (float)y +
181  Fast_RandFloat() * a2DWindowsPosDisplacementFactor.y ),
182  rayOrigin, rayDir );
183 
184  aRayPck[i].Init( rayOrigin, rayDir );
185  }
186  }
187 }
#define RAYPACKET_DIM
Definition: raypacket.h:37
void Init(const SFVEC3F &o, const SFVEC3F &d)
Definition: ray.cpp:41
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:309
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().