KiCad PCB EDA Suite
RAYPACKET Struct Reference

#include <raypacket.h>

Public Member Functions

 RAYPACKET (const CAMERA &aCamera, const SFVEC2I &aWindowsPosition)
 
 RAYPACKET (const CAMERA &aCamera, const SFVEC2I &aWindowsPosition, const SFVEC3F &aDirectionDisplacementFactor)
 
 RAYPACKET (const CAMERA &aCamera, const SFVEC2I &aWindowsPosition, unsigned int aPixelMultiple)
 
 RAYPACKET (const CAMERA &aCamera, const SFVEC2F &aWindowsPosition)
 
 RAYPACKET (const CAMERA &aCamera, const SFVEC2F &aWindowsPosition, const SFVEC2F &a2DWindowsPosDisplacementFactor)
 

Public Attributes

FRUSTUM m_Frustum
 
RAY m_ray [RAYPACKET_RAYS_PER_PACKET]
 

Detailed Description

Definition at line 38 of file raypacket.h.

Constructor & Destructor Documentation

◆ RAYPACKET() [1/5]

RAYPACKET::RAYPACKET ( const CAMERA aCamera,
const SFVEC2I aWindowsPosition 
)

Definition at line 40 of file raypacket.cpp.

41{
42 unsigned int i = 0;
43
44 for( unsigned int y = 0; y < RAYPACKET_DIM; ++y )
45 {
46 for( unsigned int x = 0; x < RAYPACKET_DIM; ++x )
47 {
48 SFVEC3F rayOrigin;
49 SFVEC3F rayDir;
50
51 aCamera.MakeRay( SFVEC2I( aWindowsPosition.x + x, aWindowsPosition.y + y ),
52 rayOrigin, rayDir );
53
54 m_ray[i].Init( rayOrigin, rayDir );
55
56 i++;
57 }
58 }
59
60 wxASSERT( i == RAYPACKET_RAYS_PER_PACKET );
61
63}
void MakeRay(const SFVEC2I &aWindowPos, SFVEC3F &aOutOrigin, SFVEC3F &aOutDirection) const
Make a ray based on a windows screen position.
Definition: camera.cpp:349
static void RAYPACKET_GenerateFrustum(FRUSTUM *m_Frustum, RAY *m_ray)
Definition: raypacket.cpp:30
#define RAYPACKET_RAYS_PER_PACKET
Definition: raypacket.h:35
#define RAYPACKET_DIM
Definition: raypacket.h:32
RAY m_ray[RAYPACKET_RAYS_PER_PACKET]
Definition: raypacket.h:54
FRUSTUM m_Frustum
Definition: raypacket.h:53
void Init(const SFVEC3F &o, const SFVEC3F &d)
Definition: ray.cpp:35
glm::ivec2 SFVEC2I
Definition: xv3d_types.h:39
glm::vec3 SFVEC3F
Definition: xv3d_types.h:44

References RAY::Init(), m_Frustum, m_ray, CAMERA::MakeRay(), RAYPACKET_DIM, RAYPACKET_GenerateFrustum(), and RAYPACKET_RAYS_PER_PACKET.

◆ RAYPACKET() [2/5]

RAYPACKET::RAYPACKET ( const CAMERA aCamera,
const SFVEC2I aWindowsPosition,
const SFVEC3F aDirectionDisplacementFactor 
)

Definition at line 84 of file raypacket.cpp.

86{
87 unsigned int i = 0;
88
89 for( unsigned int y = 0; y < RAYPACKET_DIM; ++y )
90 {
91 for( unsigned int x = 0; x < RAYPACKET_DIM; ++x )
92 {
93 SFVEC3F rayOrigin;
94 SFVEC3F rayDir;
95
96 aCamera.MakeRay( SFVEC2I( aWindowsPosition.x + x, aWindowsPosition.y + y ),
97 rayOrigin, rayDir );
98
99 const SFVEC3F randVector = SFVEC3F( Fast_RandFloat() * aDirectionDisplacementFactor.x,
100 Fast_RandFloat() * aDirectionDisplacementFactor.y,
101 Fast_RandFloat() * aDirectionDisplacementFactor.z );
102
103 m_ray[i].Init( rayOrigin, glm::normalize( rayDir + randVector ) );
104
105 i++;
106 }
107 }
108
109 wxASSERT( i == RAYPACKET_RAYS_PER_PACKET );
110
112}
float Fast_RandFloat()
Definition: 3d_fastmath.cpp:45

References Fast_RandFloat(), RAY::Init(), m_Frustum, m_ray, CAMERA::MakeRay(), RAYPACKET_DIM, RAYPACKET_GenerateFrustum(), and RAYPACKET_RAYS_PER_PACKET.

◆ RAYPACKET() [3/5]

RAYPACKET::RAYPACKET ( const CAMERA aCamera,
const SFVEC2I aWindowsPosition,
unsigned int  aPixelMultiple 
)

Definition at line 115 of file raypacket.cpp.

117{
118 unsigned int i = 0;
119
120 for( unsigned int y = 0; y < RAYPACKET_DIM; y++ )
121 {
122 for( unsigned int x = 0; x < RAYPACKET_DIM; x++ )
123 {
124 SFVEC3F rayOrigin;
125 SFVEC3F rayDir;
126
127 aCamera.MakeRay( SFVEC2I( aWindowsPosition.x + x * aPixelMultiple,
128 aWindowsPosition.y + y * aPixelMultiple),
129 rayOrigin, rayDir );
130
131 m_ray[i].Init( rayOrigin, rayDir );
132
133 i++;
134 }
135 }
136
137 wxASSERT( i == RAYPACKET_RAYS_PER_PACKET );
138
140}

References RAY::Init(), m_Frustum, m_ray, CAMERA::MakeRay(), RAYPACKET_DIM, RAYPACKET_GenerateFrustum(), and RAYPACKET_RAYS_PER_PACKET.

◆ RAYPACKET() [4/5]

RAYPACKET::RAYPACKET ( const CAMERA aCamera,
const SFVEC2F aWindowsPosition 
)

Definition at line 66 of file raypacket.cpp.

67{
68 RAYPACKET_InitRays( aCamera, aWindowsPosition, m_ray );
69
71}
void RAYPACKET_InitRays(const CAMERA &aCamera, const SFVEC2F &aWindowsPosition, RAY *aRayPck)
Definition: raypacket.cpp:143

References m_Frustum, m_ray, RAYPACKET_GenerateFrustum(), and RAYPACKET_InitRays().

◆ RAYPACKET() [5/5]

RAYPACKET::RAYPACKET ( const CAMERA aCamera,
const SFVEC2F aWindowsPosition,
const SFVEC2F a2DWindowsPosDisplacementFactor 
)

Definition at line 74 of file raypacket.cpp.

76{
77 RAYPACKET_InitRays_with2DDisplacement( aCamera, aWindowsPosition,
78 a2DWindowsPosDisplacementFactor, m_ray );
79
81}
void RAYPACKET_InitRays_with2DDisplacement(const CAMERA &aCamera, const SFVEC2F &aWindowsPosition, const SFVEC2F &a2DWindowsPosDisplacementFactor, RAY *aRayPck)
Definition: raypacket.cpp:162

References m_Frustum, m_ray, RAYPACKET_GenerateFrustum(), and RAYPACKET_InitRays_with2DDisplacement().

Member Data Documentation

◆ m_Frustum

FRUSTUM RAYPACKET::m_Frustum

Definition at line 53 of file raypacket.h.

Referenced by getFirstHit(), BVH_PBRT::Intersect(), and RAYPACKET().

◆ m_ray


The documentation for this struct was generated from the following files: