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-2016 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 "cfrustum.h"
35 #include "../ccamera.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 {
47 
48  RAYPACKET( const CCAMERA &aCamera,
49  const SFVEC2I &aWindowsPosition );
50 
51  RAYPACKET( const CCAMERA &aCamera,
52  const SFVEC2I &aWindowsPosition,
53  const SFVEC3F &aDirectionDisplacementFactor );
54 
55  RAYPACKET( const CCAMERA &aCamera,
56  const SFVEC2I &aWindowsPosition,
57  unsigned int aPixelMultiple );
58 
59  RAYPACKET( const CCAMERA &aCamera,
60  const SFVEC2F &aWindowsPosition );
61 
62  RAYPACKET( const CCAMERA &aCamera,
63  const SFVEC2F &aWindowsPosition,
64  const SFVEC2F &a2DWindowsPosDisplacementFactor );
65 };
66 
67 void RAYPACKET_InitRays( const CCAMERA &aCamera,
68  const SFVEC2F &aWindowsPosition,
69  RAY *aRayPck );
70 
72  const SFVEC2F &aWindowsPosition,
73  const SFVEC2F &a2DWindowsPosDisplacementFactor,
74  RAY *aRayPck );
75 
76 #endif // _RAYPACKET_H_
RAY m_ray[RAYPACKET_RAYS_PER_PACKET]
Definition: raypacket.h:46
Class CCAMERA is a virtual class used to derive CCAMERA objects from.
Definition: ccamera.h:80
Definition: ray.h:43
glm::ivec2 SFVEC2I
Definition: xv3d_types.h:42
CFRUSTUM m_Frustum
Definition: raypacket.h:45
RAYPACKET(const CCAMERA &aCamera, const SFVEC2I &aWindowsPosition)
Definition: raypacket.cpp:45
glm::vec2 SFVEC2F
Definition: xv3d_types.h:45
implements a frustum that is used to test ray pack tests
#define RAYPACKET_RAYS_PER_PACKET
Definition: raypacket.h:40
glm::vec3 SFVEC3F
Definition: xv3d_types.h:47
void RAYPACKET_InitRays(const CCAMERA &aCamera, const SFVEC2F &aWindowsPosition, RAY *aRayPck)
Definition: raypacket.cpp:154
void RAYPACKET_InitRays_with2DDisplacement(const CCAMERA &aCamera, const SFVEC2F &aWindowsPosition, const SFVEC2F &a2DWindowsPosDisplacementFactor, RAY *aRayPck)
Definition: raypacket.cpp:174