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