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