KiCad PCB EDA Suite
raypacket.h
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
5  * Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
30 #ifndef _RAYPACKET_H_
31 #define _RAYPACKET_H_
32 
33 #include "ray.h"
34 #include "frustum.h"
35 #include "../camera.h"
36 
37 #define RAYPACKET_DIM (1 << 3)
38 #define RAYPACKET_MASK (unsigned int) ( ( RAYPACKET_DIM - 1 ) )
39 #define RAYPACKET_INVMASK (unsigned int) ( ~( RAYPACKET_DIM - 1 ) )
40 #define RAYPACKET_RAYS_PER_PACKET ( RAYPACKET_DIM * RAYPACKET_DIM )
41 
42 
43 struct RAYPACKET
44 {
45  RAYPACKET( const CAMERA& aCamera, const SFVEC2I& aWindowsPosition );
46 
47  RAYPACKET( const CAMERA& aCamera, const SFVEC2I& aWindowsPosition,
48  const SFVEC3F& aDirectionDisplacementFactor );
49 
50  RAYPACKET( const CAMERA& aCamera, const SFVEC2I& aWindowsPosition,
51  unsigned int aPixelMultiple );
52 
53  RAYPACKET( const CAMERA& aCamera, const SFVEC2F& aWindowsPosition );
54 
55  RAYPACKET( const CAMERA& aCamera, const SFVEC2F& aWindowsPosition,
56  const SFVEC2F& a2DWindowsPosDisplacementFactor );
57 
60 };
61 
62 void RAYPACKET_InitRays( const CAMERA& aCamera, const SFVEC2F& aWindowsPosition, RAY* aRayPck );
63 
64 void RAYPACKET_InitRays_with2DDisplacement( const CAMERA& aCamera, const SFVEC2F& aWindowsPosition,
65  const SFVEC2F& a2DWindowsPosDisplacementFactor,
66  RAY* aRayPck );
67 
68 #endif // _RAYPACKET_H_
RAY m_ray[RAYPACKET_RAYS_PER_PACKET]
Definition: raypacket.h:59
void RAYPACKET_InitRays(const CAMERA &aCamera, const SFVEC2F &aWindowsPosition, RAY *aRayPck)
Definition: raypacket.cpp:148
Definition: ray.h:67
glm::ivec2 SFVEC2I
Definition: xv3d_types.h:39
Implement a frustum that is used for ray packet tests.
A class used to derive camera objects from.
Definition: camera.h:77
glm::vec2 SFVEC2F
Definition: xv3d_types.h:42
void RAYPACKET_InitRays_with2DDisplacement(const CAMERA &aCamera, const SFVEC2F &aWindowsPosition, const SFVEC2F &a2DWindowsPosDisplacementFactor, RAY *aRayPck)
Definition: raypacket.cpp:167
FRUSTUM m_Frustum
Definition: raypacket.h:58
#define RAYPACKET_RAYS_PER_PACKET
Definition: raypacket.h:40
glm::vec3 SFVEC3F
Definition: xv3d_types.h:44
RAYPACKET(const CAMERA &aCamera, const SFVEC2I &aWindowsPosition)
Definition: raypacket.cpp:45