1 /*---------------------------------------------------------------------------*
2   Project:  NintendoWare
3   File:     gfx_OrthoProjectionUpdater.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_ORTHOPROJECTIONUPDATER_H_
19 #define NW_GFX_ORTHOPROJECTIONUPDATER_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 OrthoProjectionUpdater : public CameraProjectionUpdater
37 {
38 private:
39     NW_DISALLOW_COPY_AND_ASSIGN(OrthoProjectionUpdater);
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 OrthoProjectionUpdater* Create(os::IAllocator* allocator);
56 
57     //---------------------------------------------------------------------------
58     //! @brief        正射影によるプロジェクションアップデータを生成します。
59     //!
60     //! @param[in]    allocator   アロケータです。
61     //! @param[in]    resUpdater  アップデータのリソースです。
62     //!
63     //! @return       生成したプロジェクションのアップデータを返します。
64     //---------------------------------------------------------------------------
65     static OrthoProjectionUpdater* Create(
66         os::IAllocator* allocator,
67         ResOrthoProjectionUpdater 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(OrthoProjectionUpdater);
77         if (isDynamicBuild)
78         {
79             size += sizeof(ResOrthoProjectionUpdaterData);
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     //! @brief プロジェクションアップデータの種類を取得します。
Kind()118     virtual anim::ResCameraAnimData::ProjectionUpdaterKind Kind() const
119     {
120         return anim::ResCameraAnimData::PROJECTION_UPDATER_ORTHO;
121     }
122 
123 
124 private:
125     //----------------------------------------
126     //! @name コンストラクタ/デストラクタ
127     //@{
128     //---------------------------------------------------------------------------
129     //! @brief        コンストラクタです。
130     //---------------------------------------------------------------------------
131     OrthoProjectionUpdater(
132         os::IAllocator* pAllocator,
133         bool isDynamic,
134         ResOrthoProjectionUpdater resUpdater);
135 
136     //---------------------------------------------------------------------------
137     //! @brief        デストラクタです。
138     //---------------------------------------------------------------------------
139     virtual ~OrthoProjectionUpdater();
140     //@}
141 
142     ResOrthoProjectionUpdater m_Resource;
143 };
144 
145 } // namespace gfx
146 } // namespace nw
147 
148 #endif // NW_GFX_ORTHOPROJECTIONUPDATER_H_
149