1 /*---------------------------------------------------------------------------* 2 Project: Horizon 3 File: ulcd_StereoCamera.h 4 5 Copyright (C)2010 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: 34262 $ 14 *---------------------------------------------------------------------------*/ 15 16 /* Please see man pages for details 17 18 19 20 */ 21 22 #ifndef NN_ULCD_CTR_STEREO_CAMERA_H_ 23 #define NN_ULCD_CTR_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 199 f32 GetCoefficientForParallax(void) const; 200 /* Please see man pages for details 201 202 203 204 */ 205 f32 GetMaxParallax(void) const; 206 /* Please see man pages for details 207 208 209 210 */ GetLimitParallax(void)211 f32 GetLimitParallax(void) const { return m_LimitParallax; } 212 /* Please see man pages for details 213 214 215 216 */ GetDistanceToLevel(void)217 f32 GetDistanceToLevel(void) const { return m_DepthLevel; } 218 /* Please see man pages for details 219 220 221 222 */ GetDistanceToNearClip(void)223 f32 GetDistanceToNearClip(void) const { return m_DistanceToNearClip; } 224 /* Please see man pages for details 225 226 227 228 */ GetDistanceToFarClip(void)229 f32 GetDistanceToFarClip(void) const { return m_DistanceToFarClip; } 230 231 private: 232 233 struct CameraInfo 234 { 235 f32 left; // 236 f32 right; // 237 f32 bottom; // 238 f32 top; // 239 f32 near; // 240 f32 far; // 241 242 nn::math::Vector3 position; // 243 nn::math::Vector3 rightDir; // 244 nn::math::Vector3 upDir; // 245 nn::math::Vector3 targetDir; // 246 }; 247 248 CameraInfo m_BaseCamera; 249 250 f32 m_LimitParallax; 251 252 f32 m_LevelWidth; 253 f32 m_DepthLevel; 254 f32 m_DistanceToNearClip; 255 f32 m_DistanceToFarClip; 256 f32 m_CameraInterval; 257 258 // bool m_IsInitialized; 259 // u8 rsv[3]; 260 }; 261 262 } // namespace CTR { 263 } // namespace ulcd { 264 } // namespace nn { 265 266 267 #endif // #ifndef NN_ULCD_CTR_STEREO_CAMERA_H_ 268 269