1 /*---------------------------------------------------------------------------*
2   Project:  NintendoWare
3   File:     gfx_PerspectiveProjectionUpdater.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_PERSPECTIVEPROJECTIONUPDATER_H_
19 #define NW_GFX_PERSPECTIVEPROJECTIONUPDATER_H_
20 
21 #include <nw/gfx/gfx_CameraProjectionUpdater.h>
22 #include <nw/ut/ut_Preprocessor.h>
23 
24 namespace nw
25 {
26 namespace os
27 {
28 class IAllocator;
29 } // namespace os
30 namespace gfx
31 {
32 
33 //---------------------------------------------------------------------------
34 //! @brief        画角を用いてプロジェクションマトリクスを更新するためのクラスです。
35 //---------------------------------------------------------------------------
36 class PerspectiveProjectionUpdater : public CameraProjectionUpdater
37 {
38 private:
39     NW_DISALLOW_COPY_AND_ASSIGN(PerspectiveProjectionUpdater);
40 
41 public:
42     NW_UT_RUNTIME_TYPEINFO;
43 
44     //----------------------------------------
45     //! @name 作成/破棄
46     //@{
47 
48     //---------------------------------------------------------------------------
49     //! @brief        プロジェクションマトリクスアップデータを生成します。
50     //!
51     //! @param[in]    allocator   アロケータです。
52     //!
53     //! @return       生成したプロジェクションのアップデータを返します。
54     //---------------------------------------------------------------------------
55     static PerspectiveProjectionUpdater* Create(os::IAllocator* allocator);
56 
57     //---------------------------------------------------------------------------
58     //! @brief        リソースからプロジェクションマトリクスアップデータを生成します。
59     //!
60     //! @param[in]    allocator   アロケータです。
61     //! @param[in]    resUpdater  アップデータのリソースです。
62     //!
63     //! @return       生成したプロジェクションのアップデータを返します。
64     //---------------------------------------------------------------------------
65     static PerspectiveProjectionUpdater* Create(
66         os::IAllocator* allocator,
67         ResPerspectiveProjectionUpdater resUpdater);
68 
69     //! @details :private
GetMemorySizeInternal(os::MemorySizeCalculator * pSize,bool isDynamicBuild)70     static void GetMemorySizeInternal(
71         os::MemorySizeCalculator* pSize,
72         bool isDynamicBuild)
73     {
74         os::MemorySizeCalculator& size = *pSize;
75 
76         size += sizeof(PerspectiveProjectionUpdater);
77         if (isDynamicBuild)
78         {
79             size += sizeof(ResPerspectiveProjectionUpdaterData);
80         }
81     }
82 
83     //@}
84 
85     //----------------------------------------
86     //! @name プロジェクションマトリクス
87     //@{
88 
89     //---------------------------------------------------------------------------
90     //! @brief        プロジェクションマトリクスを更新します。
91     //!
92     //! @param[in]    projectionMatrix  更新するプロジェクションマトリクスです。
93     //! @param[in]    textureProjectionMatrix 更新するプロジェクションテクスチャ用射影行列です。
94     //---------------------------------------------------------------------------
95     void virtual Update(math::MTX44* projectionMatrix, math::Matrix34* textureProjectionMatrix);
96 
97     //@}
98 
99     //----------------------------------------
100     //! @name リソース
101     //@{
102 
103     //! プロジェクションアップデータのリソースを取得します。
GetResource()104     virtual ResCameraProjectionUpdater GetResource()
105     {
106         return this->m_Resource;
107     }
108 
109     //! プロジェクションアップデータのリソースを取得します。
GetResource()110     virtual const ResCameraProjectionUpdater GetResource() const
111     {
112         return this->m_Resource;
113     }
114 
115     //@}
116 
117 
118     //! @brief ViewUpdaterの種類を取得します。
Kind()119     virtual anim::ResCameraAnimData::ProjectionUpdaterKind Kind() const
120     {
121         return anim::ResCameraAnimData::PROJECTION_UPDATER_PERSPECTIVE;
122     }
123 
124 private:
125     //----------------------------------------
126     //! @name コンストラクタ/デストラクタ
127     //@{
128 
129     //---------------------------------------------------------------------------
130     //! @brief        コンストラクタです。
131     //---------------------------------------------------------------------------
132     PerspectiveProjectionUpdater(
133         os::IAllocator* pAllocator,
134         bool isDynamic,
135         ResPerspectiveProjectionUpdater resUpdater);
136 
137     //---------------------------------------------------------------------------
138     //! @brief        デストラクタです。
139     //---------------------------------------------------------------------------
140     virtual ~PerspectiveProjectionUpdater();
141     //@}
142 
143     ResPerspectiveProjectionUpdater m_Resource;
144 };
145 
146 } // namespace gfx
147 } // namespace nw
148 
149 #endif // NW_GFX_PERSPECTIVEPROJECTIONUPDATER_H_
150