1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     ulcd_StereoCamera.h
4 
5   Copyright (C)2009-2012 Nintendo Co., Ltd.  All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law.  They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Rev: 46347 $
14  *---------------------------------------------------------------------------*/
15 
16 /* Please see man pages for details
17 
18 
19 
20 */
21 
22 #ifndef NN_ULCD_CTR_ULCD_STEREO_CAMERA_H_
23 #define NN_ULCD_CTR_ULCD_STEREO_CAMERA_H_
24 
25 #include <nn/WithInitialize.h>
26 #include <nn/util/util_NonCopyable.h>
27 #include <nn/math.h>
28 
29 namespace nn {
30 namespace ulcd {
31 namespace CTR {
32 
33     /* Please see man pages for details
34 
35     */
36     class StereoCamera
37     {
38     public:
39 
40         /* Please see man pages for details
41 
42 
43 
44 
45 
46         */
47         StereoCamera();
48         /* Please see man pages for details
49 
50 
51 
52         */
53         StereoCamera(const nn::WithInitialize&);
54         /* Please see man pages for details
55 
56 
57 
58 
59 
60         */
61         ~StereoCamera();
62 
63         /* Please see man pages for details
64 
65 
66 
67         */
68         void Initialize(void);
69         /* Please see man pages for details
70 
71 
72 
73         */
74         void Finalize(void);
75         /* Please see man pages for details
76 
77 
78 
79 
80 
81 
82 
83         */
84         void SetBaseFrustum(const nn::math::Matrix44 *proj);
85         /* Please see man pages for details
86 
87 
88 
89 
90 
91 
92 
93 
94 
95 
96 
97 
98         */
99         void SetBaseFrustum(const f32 left, const f32 right, const f32 bottom, const f32 top, const f32 near, const f32 far);
100         /* Please see man pages for details
101 
102 
103 
104 
105 
106 
107 
108         */
109         void SetBaseCamera(const nn::math::Matrix34 *view);
110         /* Please see man pages for details
111 
112 
113 
114 
115 
116 
117 
118 
119 
120 
121         */
122         void SetBaseCamera(const nn::math::Vector3 *position, const nn::math::Vector3 *rightDir,
123                            const nn::math::Vector3 *upDir, const nn::math::Vector3 *targetDir);
124         /* Please see man pages for details
125 
126 
127 
128 
129 
130         */
131         void SetLimitParallax(const f32 limit);
132         /* Please see man pages for details
133 
134 
135 
136 
137 
138 
139 
140 
141 
142 
143 
144 
145 
146         */
147         void CalculateMatrices(nn::math::Matrix44* projL, nn::math::Matrix34* viewL,
148                                nn::math::Matrix44* projR, nn::math::Matrix34* viewR,
149                                const f32 depthLevel, const f32 factor,
150                                const nn::math::PivotDirection pivot = nn::math::PIVOT_UPSIDE_TO_TOP);
151 
152         /* Please see man pages for details
153 
154 
155 
156 
157 
158 
159 
160 
161 
162 
163 
164         */
165         void CalculateMatricesReal(nn::math::Matrix44* projL, nn::math::Matrix34* viewL,
166                                    nn::math::Matrix44* projR, nn::math::Matrix34* viewR,
167                                    const f32 depthLevel, const f32 factor,
168                                    const nn::math::PivotDirection pivot = nn::math::PIVOT_UPSIDE_TO_TOP);
169         /* Please see man pages for details
170 
171 
172 
173 
174 
175 
176 
177 
178 
179 
180 
181 
182 
183 
184 
185         */
186         f32 CalculateMatrices( nn::math::Matrix44* projL, nn::math::Matrix34* viewL,
187                                nn::math::Matrix44* projR, nn::math::Matrix34* viewR,
188                                const nn::math::Matrix44* projOriginal, const nn::math::Matrix34* viewOriginal,
189                                const f32 depthLevel, const f32 factor, const bool realSwitch);
190         /* Please see man pages for details
191 
192 
193 
194 
195 
196          */
197         f32 GetParallax(const f32 distance) const;
198         /* Please see man pages for details
199 
200 
201 
202          */
203         f32 GetCoefficientForParallax(void) const;
204         /* Please see man pages for details
205 
206 
207 
208          */
209         f32 GetMaxParallax(void) const;
210         /* Please see man pages for details
211 
212 
213 
214          */
GetLimitParallax(void)215         f32 GetLimitParallax(void) const { return m_LimitParallax; }
216         /* Please see man pages for details
217 
218 
219 
220          */
GetDistanceToLevel(void)221         f32 GetDistanceToLevel(void) const { return m_DepthLevel; }
222         /* Please see man pages for details
223 
224 
225 
226          */
GetDistanceToNearClip(void)227         f32 GetDistanceToNearClip(void) const { return m_DistanceToNearClip; }
228         /* Please see man pages for details
229 
230 
231 
232          */
GetDistanceToFarClip(void)233         f32 GetDistanceToFarClip(void) const { return m_DistanceToFarClip; }
234 
235     private:
236 
237         struct CameraInfo
238         {
239             f32 left;       //
240             f32 right;      //
241             f32 bottom;     //
242             f32 top;        //
243             f32 near;       //
244             f32 far;        //
245 
246             nn::math::Vector3 position;     //
247             nn::math::Vector3 rightDir;     //
248             nn::math::Vector3 upDir;        //
249             nn::math::Vector3 targetDir;    //
250         };
251 
252         CameraInfo m_BaseCamera;
253 
254         f32 m_LimitParallax;
255 
256         f32 m_LevelWidth;
257         f32 m_DepthLevel;
258         f32 m_DistanceToNearClip;
259         f32 m_DistanceToFarClip;
260         f32 m_CameraInterval;
261 
262 //        bool m_IsInitialized;
263 //        u8   rsv[3];
264     };
265 
266 }   // namespace CTR {
267 }   // namespace ulcd {
268 }   // namespace nn {
269 
270 
271 #endif  // #ifndef NN_ULCD_CTR_ULCD_STEREO_CAMERA_H_
272 
273