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 (CFRUSTUM *m_Frustum, RAY *m_ray)
 
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)
 

Function Documentation

static void RAYPACKET_GenerateFrustum ( CFRUSTUM m_Frustum,
RAY m_ray 
)
static

Definition at line 35 of file raypacket.cpp.

References CFRUSTUM::GenerateFrustum(), and RAYPACKET_DIM.

Referenced by RAYPACKET::RAYPACKET().

36 {
37  m_Frustum->GenerateFrustum(
38  m_ray[ 0 * RAYPACKET_DIM + 0 ],
39  m_ray[ 0 * RAYPACKET_DIM + (RAYPACKET_DIM - 1) ],
40  m_ray[ (RAYPACKET_DIM - 1) * RAYPACKET_DIM + 0 ],
41  m_ray[ (RAYPACKET_DIM - 1) * RAYPACKET_DIM + (RAYPACKET_DIM - 1) ] );
42 }
#define RAYPACKET_DIM
Definition: raypacket.h:37
void GenerateFrustum(const RAY &topLeft, const RAY &topRight, const RAY &bottomLeft, const RAY &bottomRight)
GenerateFrustum.
Definition: cfrustum.cpp:42
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