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