1 /*---------------------------------------------------------------------------*
2   Project:  NintendoWare
3   File:     gfx_ResSceneEnvironmentSetting.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: $
16  *---------------------------------------------------------------------------*/
17 #ifndef NW_GFX_RESSCENEENVIRONMENTSETTING_H_
18 #define NW_GFX_RESSCENEENVIRONMENTSETTING_H_
19 
20 #include <nw/ut/ut_ResUtil.h>
21 #include <nw/ut/ut_ResDictionary.h>
22 
23 #include <nw/gfx/res/gfx_ResSceneObject.h>
24 #include <nw/gfx/res/gfx_ResFog.h>
25 
26 namespace nw
27 {
28 namespace gfx
29 {
30 namespace res
31 {
32 
33 class ResCamera;
34 class ResLight;
35 
36 
37 //! @details :private
38 struct ResReferenceSceneObjectData
39 {
40     nw::ut::ResS32 m_Index;
41     nw::ut::BinString toPath;
42     nw::ut::Offset toTarget;
43 };
44 
45 
46 //! @details :private
47 struct ResLightSetData
48 {
49     nw::ut::ResS32 m_Index;
50     nw::ut::ResS32 m_LightsTableCount;
51     nw::ut::Offset toLightsTable;
52 };
53 
54 //! @details :private
55 struct ResSceneEnvironmentSettingData : public ResSceneObjectData
56 {
57     nw::ut::ResS32 m_CamerasTableCount;
58     nw::ut::Offset toCamerasTable;
59     nw::ut::ResS32 m_LightSetsTableCount;
60     nw::ut::Offset toLightSetsTable;
61     nw::ut::ResS32 m_FogsTableCount;
62     nw::ut::Offset toFogsTable;
63 };
64 
65 
66 //---------------------------------------------------------------------------
67 //! @brief        シーンオブジェクトへの参照情報を保持するリソースクラスです。
68 //---------------------------------------------------------------------------
69 class ResReferenceSceneObject : public nw::ut::ResCommon<ResReferenceSceneObjectData>
70 {
71 public:
72     NW_RES_CTOR( ResReferenceSceneObject )
73 
74     //---------------------------------------------------------------------------
75     //! @fn           s32 GetIndex() const
76     //! @brief        シーンオブジェクトのインデックス番号を取得します。
77     //---------------------------------------------------------------------------
78     NW_RES_FIELD_PRIMITIVE_DECL( s32, Index ) // GetIndex()
79 
80     //---------------------------------------------------------------------------
81     //! @fn           const char* GetPath() const
82     //! @brief        参照先のパス名を取得します。
83     //---------------------------------------------------------------------------
84     NW_RES_FIELD_STRING_DECL( Path ) // GetPath()
85 
86     //---------------------------------------------------------------------------
87     //! @fn           ResSceneObject GetTarget() const
88     //! @brief        参照しているオブジェクトへのポインタクラスを取得します。
89     //---------------------------------------------------------------------------
90     NW_RES_FIELD_CLASS_DECL( ResSceneObject, Target ) // GetTarget()
91 };
92 
93 //---------------------------------------------------------------------------
94 //! @brief        複数ライトの参照をまとめるバイナリリソースクラスです。
95 //---------------------------------------------------------------------------
96 class ResLightSet : public nw::ut::ResCommon<ResLightSetData>
97 {
98 public:
99     NW_RES_CTOR(ResLightSet);
100 
101     //---------------------------------------------------------------------------
102     //! @fn           s32 GetIndex() const
103     //! @brief        ライトセットのインデックス番号を取得します。
104     //---------------------------------------------------------------------------
105     NW_RES_FIELD_PRIMITIVE_DECL( s32, Index ) // GetIndex()
106 
107     //---------------------------------------------------------------------------
108     //! @fn           s32 GetLightsCount() const
109     //! @brief        所属するライトの要素数を取得します。
110     //---------------------------------------------------------------------------
111     //---------------------------------------------------------------------------
112     //! @fn           ResReferenceSceneObject GetLights(int idx)
113     //! @brief        所属するライトを取得します。
114     //---------------------------------------------------------------------------
115     NW_RES_FIELD_CLASS_LIST_DECL(ResReferenceSceneObject, Lights) // GetLights(), GetLights(int idx), GetLightsCount()
116 };
117 
118 //---------------------------------------------------------------------------
119 //! @brief        シーンの環境設定を表すバイナリリソースクラスです。
120 //---------------------------------------------------------------------------
121 class ResSceneEnvironmentSetting : public ResSceneObject
122 {
123 public:
124     enum { TYPE_INFO = NW_GFX_RES_TYPE_INFO(ResSceneEnvironmentSetting) };
125     enum { SIGNATURE = NW_RES_SIGNATURE32('CENV') };
126     enum { BINARY_REVISION = REVISION_RES_RENDER_ENV_SETTING };
127 
NW_RES_CTOR_INHERIT(ResSceneEnvironmentSetting,ResSceneObject)128     NW_RES_CTOR_INHERIT( ResSceneEnvironmentSetting, ResSceneObject )
129 
130     //---------------------------------------------------------------------------
131     //! @brief        リビジョンを取得します。
132     //!
133     //! @return       リソースのリビジョン情報です。
134     //---------------------------------------------------------------------------
135     u32 GetRevision() const { return this->GetHeader().revision; }
136 
137     //---------------------------------------------------------------------------
138     //! @fn           s32 GetCamerasCount() const
139     //! @brief        カメラの要素数を取得します。
140     //---------------------------------------------------------------------------
141     //---------------------------------------------------------------------------
142     //! @fn           ResReferenceSceneObject GetCameras(int idx)
143     //! @brief        カメラを取得します。
144     //---------------------------------------------------------------------------
145     NW_RES_FIELD_CLASS_LIST_DECL( ResReferenceSceneObject, Cameras ) // GetCameras(int idx), GetCamerasCount()
146 
147     //---------------------------------------------------------------------------
148     //! @fn           s32 GetLightSetsCount() const
149     //! @brief        ライトセットの要素数を取得します。
150     //---------------------------------------------------------------------------
151     //---------------------------------------------------------------------------
152     //! @fn           ResLightSet GetLightSets(int idx)
153     //! @brief        ライトセットを取得します。
154     //---------------------------------------------------------------------------
155     NW_RES_FIELD_CLASS_LIST_DECL( ResLightSet, LightSets ) // GetLightSets(int idx), GetLightSetsCount()
156 
157     //---------------------------------------------------------------------------
158     //! @fn           s32 GetFogsCount() const
159     //! @brief        フォグの要素数を取得します。
160     //---------------------------------------------------------------------------
161     //---------------------------------------------------------------------------
162     //! @fn           ResReferenceSceneObject GetFogs(int idx)
163     //! @brief        フォグを取得します。
164     //---------------------------------------------------------------------------
165     NW_RES_FIELD_CLASS_LIST_DECL( ResReferenceSceneObject, Fogs ) // GetFogs(int idx), GetFogsCount()
166 };
167 
168 typedef nw::ut::ResArrayPatricia<ResSceneEnvironmentSetting>::type  ResSceneEnvironmentSettingArray;
169 typedef nw::ut::ResArrayClass<ResReferenceSceneObject>::type ResReferenceSceneObjectArray;
170 typedef nw::ut::ResArrayClass<ResLightSet>::type ResLightSetArray;
171 
172 } // namespace res
173 } // namespace gfx
174 } // namespace nw
175 
176 #endif // NW_GFX_RESSCENEENVIRONMENTSETTING_H_
177 
178