1 /*---------------------------------------------------------------------------*
2   Project:  NintendoWare
3   File:     gfx_AimTargetViewUpdater.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_AIMTARGETVIEWUPDATER_H_
19 #define NW_GFX_AIMTARGETVIEWUPDATER_H_
20 
21 #include <nw/gfx/gfx_CameraViewUpdater.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 AimTargetViewUpdater : public CameraViewUpdater
37 {
38 private:
39     NW_DISALLOW_COPY_AND_ASSIGN(AimTargetViewUpdater);
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 AimTargetViewUpdater* Create(os::IAllocator* allocator);
56 
57     //---------------------------------------------------------------------------
58     //! @brief        ビューマトリクスのアップデータを生成します。
59     //!
60     //! @param[in]    allocator       アロケータです。
61     //! @param[in]    resUpdater      アップデータのリソースです。
62     //!
63     //! @return       生成したビューマトリクスのアップデータです。
64     //---------------------------------------------------------------------------
65     static AimTargetViewUpdater* Create(
66         os::IAllocator* allocator,
67         ResAimTargetViewUpdater 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(AimTargetViewUpdater);
77         if (isDynamicBuild)
78         {
79             size += sizeof(ResAimTargetViewUpdaterData);
80         }
81     }
82 
83     //@}
84 
85     //----------------------------------------
86     //! @name ビューマトリクス
87     //@{
88 
89     //---------------------------------------------------------------------------
90     //! @brief        ビューマトリクスを更新します。
91     //!
92     //! @param[out]   viewMatrix      更新するビューマトリクスです。
93     //! @param[in]    worldMatrix     カメラのワールドマトリクスです。
94     //! @param[in]    cameraPosition  カメラ位置です。
95     //---------------------------------------------------------------------------
96     void virtual Update(
97         math::MTX34* viewMatrix,
98         const math::MTX34& worldMatrix,
99         const math::VEC3& cameraPosition);
100 
101     //@}
102 
103     //----------------------------------------
104     //! @name リソース
105     //@{
106 
107     //! ビューアップデータのリソースを取得します。
GetResource()108     virtual ResCameraViewUpdater GetResource()
109     {
110         return this->m_Resource;
111     }
112 
113     //! ビューアップデータのリソースを取得します。
GetResource()114     virtual const ResCameraViewUpdater GetResource() const
115     {
116         return this->m_Resource;
117     }
118 
119     //@}
120 
121     //! @brief ViewUpdaterの種類を取得します。
Kind()122     virtual anim::ResCameraAnimData::ViewUpdaterKind Kind() const
123     {
124         return anim::ResCameraAnimData::VIEW_UPDATER_AIM;
125     }
126 
127 private:
128     //----------------------------------------
129     //! @name コンストラクタ/デストラクタ
130     //@{
131     //---------------------------------------------------------------------------
132     //! @brief        コンストラクタです。
133     //---------------------------------------------------------------------------
134     AimTargetViewUpdater(
135         os::IAllocator* pAllocator,
136         bool isDynamic,
137         ResAimTargetViewUpdater resUpdater);
138 
139     //---------------------------------------------------------------------------
140     //! @brief        デストラクタです。
141     //---------------------------------------------------------------------------
142     virtual ~AimTargetViewUpdater();
143     //@}
144 
145     ResAimTargetViewUpdater m_Resource;
146 };
147 
148 } // namespace gfx
149 } // namespace nw
150 
151 #endif // NW_GFX_AIMTARGETVIEWUPDATER_H_
152