"L. Spiro Engine"
|
00001 00016 #ifndef __LSE_CAMERA_H__ 00017 #define __LSE_CAMERA_H__ 00018 00019 #include "../LSEEngine.h" 00020 #include "../Entity/LSEActor.h" 00021 #include "Frustum/LSMFrustum.h" 00022 00023 namespace lse { 00024 00025 // == Enumerations. 00029 enum LSE_CAM_TYPE { 00030 LSE_CT_PERSP, 00031 LSE_CT_ORTHO, 00032 }; 00033 00040 class CCamera : public CActor { 00041 public : 00042 // == Various constructors. 00043 LSE_CALLCTOR CCamera(); 00044 virtual LSE_CALLCTOR ~CCamera(); 00045 00046 00047 // == Functions. 00056 LSVOID LSE_CALL SetPerspParms( LSREAL _fFov, LSREAL _fAspect, 00057 LSREAL _fNearPlane, LSREAL _fFarPlane ); 00058 00069 LSVOID LSE_CALL SetOrthoParms( LSREAL _fLeft, LSREAL _fTop, 00070 LSREAL _fRight, LSREAL _fBottom, LSREAL _fNearPlane = -LSM_ONE, LSREAL _fFarPlane = LSM_ONE ); 00071 00077 virtual LSUINT32 LSE_CALL EntityType() const; 00078 00082 LSVOID LSE_CALL Update(); 00083 00089 LSE_INLINE const CMatrix4x4 & LSE_CALL ViewMatrix() const; 00090 00096 LSE_INLINE const CMatrix4x4 & LSE_CALL InvViewMatrix() const; 00097 00103 LSE_INLINE const CMatrix4x4 & LSE_CALL ProjMatrix() const; 00104 00110 LSE_INLINE const CMatrix4x4 & LSE_CALL ViewProjMatrix() const; 00111 00117 LSE_INLINE const CFrustum & LSE_CALL Frustum() const; 00118 00124 LSE_INLINE LSREAL LSE_CALL Fov() const; 00125 00131 LSE_INLINE LSREAL LSE_CALL NearPlane() const; 00132 00138 LSE_INLINE LSREAL LSE_CALL FarPlane() const; 00139 00145 LSE_INLINE LSREAL LSE_CALL Aspect() const; 00146 00147 00148 protected : 00149 // == Members. 00153 CMatrix4x4 m_mViewMatrix; 00154 00158 CMatrix4x4 m_mProjMatrix; 00159 00163 CMatrix4x4 m_mViewProjMatrix; 00164 00168 CFrustum m_fFrustum; 00169 00173 LSE_CAM_TYPE m_ctCamType; 00174 00178 LSREAL m_fNear; 00179 00183 LSREAL m_fFar; 00184 00188 LSREAL m_fFov; 00189 00193 LSREAL m_fAspect; 00194 00198 LSREAL m_fMinX; 00199 00203 LSREAL m_fMinY; 00204 00208 LSREAL m_fMaxX; 00209 00213 LSREAL m_fMaxY; 00214 00218 LSUINT32 m_ui32InitialScrW; 00219 00223 LSUINT32 m_ui32InitialScrH; 00224 00228 LSUINT32 m_ui32CurScrW; 00229 00233 LSUINT32 m_ui32CurScrH; 00234 00235 00236 // == Functions. 00240 LSVOID LSE_CALL AdjustToCurScreenSize(); 00241 00242 00243 private : 00244 typedef CActor Parent; 00245 }; 00246 00247 00248 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00249 // DEFINITIONS 00250 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00251 // == Types. 00255 typedef CSharedPtr<CCamera> CSharedCameraPtr; 00256 00257 // == Functions. 00263 LSE_INLINE const CMatrix4x4 & LSE_CALL CCamera::ViewMatrix() const { 00264 return m_mViewMatrix; 00265 } 00266 00272 LSE_INLINE const CMatrix4x4 & LSE_CALL CCamera::InvViewMatrix() const { 00273 return m_mWorldTrans; 00274 } 00275 00281 LSE_INLINE const CMatrix4x4 & LSE_CALL CCamera::ProjMatrix() const { 00282 return m_mProjMatrix; 00283 } 00284 00290 LSE_INLINE const CMatrix4x4 & LSE_CALL CCamera::ViewProjMatrix() const { 00291 return m_mViewProjMatrix; 00292 } 00293 00299 LSE_INLINE const CFrustum & LSE_CALL CCamera::Frustum() const { 00300 return m_fFrustum; 00301 } 00302 00308 LSE_INLINE LSREAL LSE_CALL CCamera::Fov() const { 00309 return m_fFov; 00310 } 00311 00317 LSE_INLINE LSREAL LSE_CALL CCamera::NearPlane() const { 00318 return m_fNear; 00319 } 00320 00326 LSE_INLINE LSREAL LSE_CALL CCamera::FarPlane() const { 00327 return m_fFar; 00328 } 00329 00335 LSE_INLINE LSREAL LSE_CALL CCamera::Aspect() const { 00336 return m_fAspect; 00337 } 00338 00339 } // namespace lse 00340 00341 #endif // __LSE_CAMERA_H__