1 /*---------------------------------------------------------------------------*
2   Project:  NintendoWare
3   File:     gfx_ResParticleEmitter.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 
18 #ifndef NW_GFX_RESPARTICLEEMITTER_H_
19 #define NW_GFX_RESPARTICLEEMITTER_H_
20 
21 #include <nw/ut/ut_ResUtil.h>
22 #include <nw/ut/ut_ResDictionary.h>
23 #include <nw/gfx/res/gfx_ResSceneObject.h>
24 #include <nw/gfx/res/gfx_ResParticleSet.h>
25 #include <nw/gfx/res/gfx_ResParticleForm.h>
26 #include <nw/gfx/res/gfx_ResTypeInfo.h>
27 
28 namespace nw {
29 namespace gfx {
30 namespace res {
31 
32 //! @details :private
33 struct ResParticleEmitterData : public ResTransformNodeData
34 {
35     nw::ut::ResU32 m_Id;
36     nw::ut::BinString toParticleSetPath;
37     nw::ut::Offset toParticleForm;
38     nw::ut::ResBool m_IsResourceCopyEnabled;
39     u8              padding_0[3];
40     nw::ut::ResF32 m_EmissionRatio;
41     nw::ut::ResF32 m_EmissionRatioRandom;
42     nw::ut::ResS32 m_EmissionInterval;
43     nw::ut::ResF32 m_EmissionIntervalRandom;
44     nw::ut::ResBool m_EmissionSpanInfinity;
45     u8              padding_1[3];
46     nw::ut::ResS32 m_EmissionSpan;
47     nw::ut::ResS32 m_EmissionStart;
48 };
49 
50 //! @details :private
51 // リソースコピー用
52 struct ResParticleEmitterParameterData
53 {
54     nw::ut::ResBool m_IsResourceCopyEnabled;
55     u8              padding_0[3];
56     nw::ut::ResF32 m_EmissionRatio;
57     nw::ut::ResF32 m_EmissionRatioRandom;
58     nw::ut::ResS32 m_EmissionInterval;
59     nw::ut::ResF32 m_EmissionIntervalRandom;
60     nw::ut::ResBool m_EmissionSpanInfinity;
61     u8              padding_1[3];
62     nw::ut::ResS32 m_EmissionSpan;
63     nw::ut::ResS32 m_EmissionStart;
64 };
65 
66 
67 //--------------------------------------------------------------------------
68 //! @brief  パーティクルエミッタを表すバイナリリソースクラスです。
69 //---------------------------------------------------------------------------
70 class ResParticleEmitter : public ResTransformNode
71 {
72 public:
73     enum { TYPE_INFO = NW_GFX_RES_TYPE_INFO(ResParticleEmitter) };
74     enum { SIGNATURE = NW_RES_SIGNATURE32('PEMT') };
75 
76     NW_RES_CTOR_INHERIT( ResParticleEmitter, ResTransformNode )
77 
78     NW_RES_FIELD_PRIMITIVE_DECL( u32, Id )                     // GetId(), SetId()
79     NW_RES_FIELD_STRING_DECL( ParticleSetPath )                // GetParticleSetPath()
80     NW_RES_FIELD_CLASS_DECL( ResParticleForm, ParticleForm)    // GetParticleForm()
81     NW_RES_FIELD_PRIMITIVE_DECL( bool, IsResourceCopyEnabled)
82     NW_RES_FIELD_PRIMITIVE_DECL( f32, EmissionRatio )          // GetEmissionRatio(), SetEmissionRatio()
83     NW_RES_FIELD_PRIMITIVE_DECL( f32, EmissionRatioRandom )    // GetEmissionRatioRandom(), SetEmissionRatioRandom()
84     NW_RES_FIELD_PRIMITIVE_DECL( s32, EmissionInterval )       // GetEmissionInterval(), SetEmissionInterval()
85     NW_RES_FIELD_PRIMITIVE_DECL( f32, EmissionIntervalRandom ) // GetEmissionIntervalRandom(), SetEmissionIntervalRandom()
86     NW_RES_FIELD_PRIMITIVE_DECL( bool, EmissionSpanInfinity)   // GetEmissionSpanInfinity(), SetEmissionSpanInfinity()
87     NW_RES_FIELD_PRIMITIVE_DECL( s32, EmissionSpan)            // GetEmissionSpan(), SetEmissionSpan()
88     NW_RES_FIELD_PRIMITIVE_DECL( s32, EmissionStart)           // GetEmissionStart(), SetEmissionStart()
89 };
90 
91 
92 //--------------------------------------------------------------------------
93 //! @brief  パーティクルエミッタのパラメータを表すバイナリリソースクラスです。
94 //---------------------------------------------------------------------------
95 class ResParticleEmitterParameter : public nw::ut::ResCommon<ResParticleEmitterParameterData>
96 {
97 public:
98 //    enum { TYPE_INFO = NW_GFX_RES_TYPE_INFO(ResParticleEmitterParameter) };
99 //    enum { SIGNATURE = NW_RES_SIGNATURE32('PEMT') };
100 
101     NW_RES_CTOR( ResParticleEmitterParameter )
102 
103     NW_RES_FIELD_PRIMITIVE_DECL( bool, IsResourceCopyEnabled)
104 
105     //---------------------------------------------------------------------------
106     //! @fn           f32 GetEmissionRatio()
107     //! @brief        放出量を取得します。
108     //---------------------------------------------------------------------------
109     //---------------------------------------------------------------------------
110     //! @fn           void SetEmissionRatio(f32 emissionRatio)
111     //! @brief        放出量を設定します。
112     //---------------------------------------------------------------------------
113     NW_RES_FIELD_PRIMITIVE_DECL( f32, EmissionRatio )          // GetEmissionRatio(), SetEmissionRatio()
114 
115     //---------------------------------------------------------------------------
116     //! @fn           f32 GetEmissionRatioRandom()
117     //! @brief        放出量のランダムを取得します。
118     //---------------------------------------------------------------------------
119     //---------------------------------------------------------------------------
120     //! @fn           void SetEmissionRatioRandom(f32 emissionRatioRandom)
121     //! @brief        放出量のランダムを設定します。
122     //---------------------------------------------------------------------------
123     NW_RES_FIELD_PRIMITIVE_DECL( f32, EmissionRatioRandom )    // GetEmissionRatioRandom(), SetEmissionRatioRandom()
124 
125     //---------------------------------------------------------------------------
126     //! @fn           s32 GetEmissionInterval()
127     //! @brief        放出間隔を取得します。
128     //---------------------------------------------------------------------------
129     //---------------------------------------------------------------------------
130     //! @fn           void SetEmissionInterval(s32 emissionInterval)
131     //! @brief        放出間隔を設定します。
132     //---------------------------------------------------------------------------
133     NW_RES_FIELD_PRIMITIVE_DECL( s32, EmissionInterval )       // GetEmissionInterval(), SetEmissionInterval()
134 
135     //---------------------------------------------------------------------------
136     //! @fn           f32 GetEmissionIntervalRandom()
137     //! @brief        放出間隔のランダムを取得します。
138     //---------------------------------------------------------------------------
139     //---------------------------------------------------------------------------
140     //! @fn           void SetEmissionIntervalRandom(f32 emissionIntervalRandom)
141     //! @brief        放出間隔のランダムを設定します。
142     //---------------------------------------------------------------------------
143     NW_RES_FIELD_PRIMITIVE_DECL( f32, EmissionIntervalRandom ) // GetEmissionIntervalRandom(), SetEmissionIntervalRandom()
144 
145     //---------------------------------------------------------------------------
146     //! @fn           bool GetEmissionSpanInfinity()
147     //! @brief        放出時間が無限かどうかのフラグを取得します。
148     //---------------------------------------------------------------------------
149     //---------------------------------------------------------------------------
150     //! @fn           void SetEmissionSpanInfinity(bool emissionSpanInfinity)
151     //! @brief        放出時間が無限かどうかのフラグを設定します。
152     //---------------------------------------------------------------------------
153     NW_RES_FIELD_PRIMITIVE_DECL( bool, EmissionSpanInfinity)   // GetEmissionSpanInfinity(), SetEmissionSpanInfinity()
154 
155     //---------------------------------------------------------------------------
156     //! @fn           s32 GetEmissionSpan()
157     //! @brief        放出時間を取得します。
158     //! @details      放出時間が無限の場合は無効です。
159     //---------------------------------------------------------------------------
160     //---------------------------------------------------------------------------
161     //! @fn           s32 SetEmissionSpan(s32 emissionSapn)
162     //! @brief        放出時間を設定します。
163     //! @details      放出時間が無限の場合は無効です。
164     //---------------------------------------------------------------------------
165     NW_RES_FIELD_PRIMITIVE_DECL( s32, EmissionSpan)            // GetEmissionSpan(), SetEmissionSpan()
166 
167     //---------------------------------------------------------------------------
168     //! @fn           s32 GetEmissionStart()
169     //! @brief        放出開始時間を取得します。
170     //---------------------------------------------------------------------------
171     //---------------------------------------------------------------------------
172     //! @fn           s32 SetEmissionStart(s32 emissionStart)
173     //! @brief        放出開始時間を設定します。
174     //---------------------------------------------------------------------------
175     NW_RES_FIELD_PRIMITIVE_DECL( s32, EmissionStart)           // GetEmissionStart(), SetEmissionStart()
176 };
177 
178 typedef nw::ut::ResArrayPatricia<ResParticleEmitter>::type  ResEmitterArray;
179 
180 } // namespace res
181 } // namespace gfx
182 } // namespace nw
183 
184 #endif // NW_GFX_RESPARTICLEEMITTER_H_
185