1 /*---------------------------------------------------------------------------* 2 Project: NintendoWare 3 File: gfx_CameraProjectionUpdater.h 4 5 Copyright (C)2009-2010 Nintendo Co., Ltd./HAL Laboratory, Inc. 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 $Revision: 20134 $ 14 *---------------------------------------------------------------------------*/ 15 16 #ifndef NW_GFX_CAMERAPROJECTIONUPDATER_H_ 17 #define NW_GFX_CAMERAPROJECTIONUPDATER_H_ 18 19 #include <nw/gfx/gfx_GfxObject.h> 20 #include <nw/gfx/res/gfx_ResCamera.h> 21 22 namespace nw 23 { 24 25 namespace math 26 { 27 struct VEC2; 28 struct Transform3; 29 struct MTX34; 30 } 31 32 namespace ut 33 { 34 struct Rect; 35 } 36 37 namespace gfx 38 { 39 40 //--------------------------------------------------------------------------- 41 //! @brief プロジェクションマトリクスを更新するインタフェースです。 42 //! 43 //! ICameraProjectionUpdater は廃止され CameraProjectionUpdater に変更されました。 44 //--------------------------------------------------------------------------- 45 class CameraProjectionUpdater : public GfxObject 46 { 47 private: 48 NW_DISALLOW_COPY_AND_ASSIGN(CameraProjectionUpdater); 49 50 public: 51 NW_UT_RUNTIME_TYPEINFO; 52 53 //---------------------------------------- 54 //! @name プロジェクションマトリクス 55 //@{ 56 57 //--------------------------------------------------------------------------- 58 //! @brief プロジェクションマトリクスを更新します。 59 //! 60 //! @param[in] projectionMatrix 更新するプロジェクションマトリクスです。 61 //! @param[in] textureProjectionMatrix 更新するプロジェクションテクスチャ用射影行列です。 62 //--------------------------------------------------------------------------- 63 virtual void Update(math::MTX44* projectionMatrix, math::Matrix34* textureProjectionMatrix) = 0; 64 65 //@} 66 67 //---------------------------------------- 68 //! @name ピボット 69 //@{ 70 71 //! @brief 画面の上方向を設定します。 72 //! 73 //! @param[in] pivot 画面の上方向です。 SetPivotDirection(math::PivotDirection pivot)74 void SetPivotDirection( math::PivotDirection pivot) { this->m_Pivot = pivot; } 75 76 //! @brief 画面の上方向を取得します。 77 //! 78 //! @return 画面の上方向です。 GetPivotDirection()79 math::PivotDirection GetPivotDirection() const { return this->m_Pivot; } 80 81 //@} 82 83 //! 動的に生成されたアップデータかどうかのフラグを取得します。 IsDynamic()84 bool IsDynamic() 85 { 86 return this->m_IsDynamic; 87 } 88 89 //---------------------------------------- 90 //! @name リソース 91 //@{ 92 93 //! プロジェクションアップデータのリソースを取得します。 94 virtual ResCameraProjectionUpdater GetResource() = 0; 95 96 //! プロジェクションアップデータのリソースを取得します。 97 virtual const ResCameraProjectionUpdater GetResource() const = 0; 98 99 //@} 100 101 //---------------------------------------- 102 //! @name テクスチャ 103 //@{ 104 105 //! @brief テクスチャのスケールを取得します。 TextureScale()106 math::VEC2& TextureScale() { return m_TextureScale; } 107 108 //! @brief テクスチャのスケールを取得します。 TextureScale()109 const math::VEC2& TextureScale() const { return m_TextureScale; } 110 111 //! @brief テクスチャの平行移動を取得します。 TextureTranslate()112 math::VEC2& TextureTranslate() { return m_TextureTranslate; } 113 114 //! @brief テクスチャの平行移動を取得します。 TextureTranslate()115 const math::VEC2& TextureTranslate() const { return m_TextureTranslate; } 116 117 //@} 118 119 protected: 120 121 //! @brief コンストラクタです。 CameraProjectionUpdater(os::IAllocator * allocator,bool isDynamic)122 CameraProjectionUpdater(os::IAllocator* allocator, bool isDynamic) 123 : GfxObject(allocator), 124 m_Pivot(math::PIVOT_NONE), 125 m_IsDynamic(isDynamic), 126 m_TextureScale(0.5f, 0.5f), 127 m_TextureTranslate(0.5f, 0.5f) 128 {} 129 130 //! @brief デストラクタです。 ~CameraProjectionUpdater()131 virtual ~CameraProjectionUpdater(){} 132 133 private: 134 math::PivotDirection m_Pivot; 135 bool m_IsDynamic; 136 math::VEC2 m_TextureScale; 137 math::VEC2 m_TextureTranslate; 138 139 protected: 140 //! ニアクリップのデフォルト値です。 141 static const float PROJECTION_NEAR_CLIP; 142 //! ファークリップのデフォルト値です。 143 static const float PROJECTION_FAR_CLIP; 144 //! FOVのY方向のデフォルト値です。 145 static const float PROJECTION_FOVY_RADIAN; 146 //! アスペクト比のデフォルト値です。 147 static const float PROJECTION_ASPECT_RATIO; 148 //! ニアクリップ面での中心座標のデフォルト値です。 149 static const math::VEC2 PROJECTION_CENTER; 150 //! ニアクリップ面での高さのデフォルト値です。 151 static const float PROJECTION_HEIGHT; 152 //! ニアクリップ面での表示矩形のデフォルト値です。 153 static const ResProjectionRect PROJECTION_RECT; 154 }; 155 156 } // namespace gfx 157 } // namespace nw 158 159 #endif // NW_GFX_CAMERAPROJECTIONUPDATER_H_ 160