KiCad PCB EDA Suite
raypacket.cpp File Reference
#include "raypacket.h"
#include "../3d_fastmath.h"
#include <wx/debug.h>

Go to the source code of this file.

Functions

static void RAYPACKET_GenerateFrustum (FRUSTUM *m_Frustum, RAY *m_ray)
 
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)
 

Function Documentation

◆ RAYPACKET_GenerateFrustum()

static void RAYPACKET_GenerateFrustum ( FRUSTUM m_Frustum,
RAY m_ray 
)
static

Definition at line 30 of file raypacket.cpp.

31 {
32  m_Frustum->GenerateFrustum(
33  m_ray[ 0 * RAYPACKET_DIM + 0 ],
34  m_ray[ 0 * RAYPACKET_DIM + (RAYPACKET_DIM - 1) ],
35  m_ray[ (RAYPACKET_DIM - 1) * RAYPACKET_DIM + 0 ],
36  m_ray[ (RAYPACKET_DIM - 1) * RAYPACKET_DIM + (RAYPACKET_DIM - 1) ] );
37 }
#define RAYPACKET_DIM
Definition: raypacket.h:32
void GenerateFrustum(const RAY &topLeft, const RAY &topRight, const RAY &bottomLeft, const RAY &bottomRight)
Definition: frustum.cpp:37

References FRUSTUM::GenerateFrustum(), and RAYPACKET_DIM.

Referenced by RAYPACKET::RAYPACKET().

◆ 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().