Version 1.24
[libovr-mingw-w64-jolly.git] / Include / Extras / OVR_StereoProjection.h
1 /************************************************************************************\r
2 \r
3 Filename    :   OVR_StereoProjection.h\r
4 Content     :   Stereo projection functions\r
5 Created     :   November 30, 2013\r
6 Authors     :   Tom Fosyth\r
7 \r
8 Copyright   :   Copyright 2014-2016 Oculus VR, LLC All Rights reserved.\r
9 \r
10 Licensed under the Oculus VR Rift SDK License Version 3.3 (the "License");\r
11 you may not use the Oculus VR Rift SDK except in compliance with the License,\r
12 which is provided at the time of installation or download, or which\r
13 otherwise accompanies this software in either electronic or hard copy form.\r
14 \r
15 You may obtain a copy of the License at\r
16 \r
17 http://www.oculusvr.com/licenses/LICENSE-3.3\r
18 \r
19 Unless required by applicable law or agreed to in writing, the Oculus VR SDK\r
20 distributed under the License is distributed on an "AS IS" BASIS,\r
21 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
22 See the License for the specific language governing permissions and\r
23 limitations under the License.\r
24 \r
25 *************************************************************************************/\r
26 \r
27 #ifndef OVR_StereoProjection_h\r
28 #define OVR_StereoProjection_h\r
29 \r
30 #include "Extras/OVR_Math.h"\r
31 \r
32 namespace OVR {\r
33 \r
34 //-----------------------------------------------------------------------------------\r
35 // ***** Stereo Enumerations\r
36 \r
37 // StereoEye specifies which eye we are rendering for; it is used to\r
38 // retrieve StereoEyeParams.\r
39 enum StereoEye { StereoEye_Left, StereoEye_Right, StereoEye_Center };\r
40 \r
41 //-----------------------------------------------------------------------------------\r
42 // ***** Propjection functions\r
43 \r
44 Matrix4f CreateProjection(\r
45     bool rightHanded,\r
46     bool isOpenGL,\r
47     FovPort fov,\r
48     StereoEye eye,\r
49     float zNear = 0.01f,\r
50     float zFar = 10000.0f,\r
51     bool flipZ = false,\r
52     bool farAtInfinity = false);\r
53 \r
54 Matrix4f CreateOrthoSubProjection(\r
55     bool rightHanded,\r
56     StereoEye eyeType,\r
57     float tanHalfFovX,\r
58     float tanHalfFovY,\r
59     float unitsX,\r
60     float unitsY,\r
61     float distanceFromCamera,\r
62     float interpupillaryDistance,\r
63     Matrix4f const& projection,\r
64     float zNear = 0.0f,\r
65     float zFar = 0.0f,\r
66     bool flipZ = false,\r
67     bool farAtInfinity = false);\r
68 \r
69 ScaleAndOffset2D CreateNDCScaleAndOffsetFromFov(FovPort fov);\r
70 \r
71 } // namespace OVR\r
72 \r
73 #endif // OVR_StereoProjection_h\r