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