1 /*---------------------------------------------------------------------------*
2   Project:  NintendoWare
3   File:     gfx_ResParticleUpdater.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_RESPARTICLEUPDATER_H_
17 #define NW_GFX_RESPARTICLEUPDATER_H_
18 
19 #include <nw/ut/ut_ResUtil.h>
20 #include <nw/ut/ut_ResDictionary.h>
21 #include <nw/gfx/gfx_ParticleTime.h>
22 #include <nw/gfx/res/gfx_ResSceneObject.h>
23 #include <nw/gfx/res/gfx_ResParticleAnimation.h>
24 #include <nw/gfx/res/gfx_ResParticleAnimationOption.h>
25 #include <nw/gfx/res/gfx_ResParticleForm.h>
26 #include <nw/gfx/res/gfx_ResTypeInfo.h>
27 
28 //#define NW_GFX_PARTICLE_4KEY
29 
30 namespace nw {
31 namespace gfx {
32 
33 class ParticleContext;
34 class ParticleSet;
35 
36 namespace res {
37 
38 //---------------------------------------------------------------------------
39 //! @brief パーティクルストリームの使用種別の定義です。
40 //---------------------------------------------------------------------------
41 enum ParticleUsage
42 {
43     PARTICLEUSAGE_TRANSLATE = 0,     //!< トランスレートです。
44     PARTICLEUSAGE_SCALE,             //!< スケールです。
45     PARTICLEUSAGE_ROTATE,            //!< ローテートです。
46     PARTICLEUSAGE_COLOR,             //!< RGBカラーです。
47     PARTICLEUSAGE_ALPHA,             //!< アルファです。
48     PARTICLEUSAGE_TEXTURETRANSLATE0, //!< テクスチャ座標のトランスレートです。
49     PARTICLEUSAGE_TEXTURESCALE0,     //!< テクスチャ座標のスケールです。
50     PARTICLEUSAGE_TEXTUREROTATE0,    //!< テクスチャ座標のローテートです。
51     PARTICLEUSAGE_SCALE_EXT,         //!< スケール(拡張)です。
52 
53     PARTICLEUSAGE_ID,                //!< パーティクルIDです。
54     PARTICLEUSAGE_BIRTH,             //!< 生成した時刻です。
55     PARTICLEUSAGE_LIFE,              //!< 寿命です。
56     PARTICLEUSAGE_VELOCITY,          //!< 速度です。
57 
58     PARTICLEUSAGE_ACTIVEINDEX,       //!< 使用中の要素への間接参照インデックスです。
59     PARTICLEUSAGE_FREEINDEX,         //!< 使用可能な要素への間接参照インデックスです。
60 #ifdef NW_GFX_PARTICLE_COMPAT_1_1
61     PARTICLEUSAGE_NEG_TIMELIMIT,     //!< 消滅する時刻の負数(高速化のため)です。
62 #endif
63 
64     PARTICLEUSAGE_COUNT,             //!< 種別の個数です。
65 
66     PARTICLEUSAGE_IS_INT = INT_MAX
67 };
68 
69 //! @details :private
70 struct ResParticleUpdaterData
71 {
72     nw::ut::ResTypeInfo typeInfo;
73     nw::ut::ResBool m_IsResourceCopyEnabled;
74     nw::ut::ResBool m_UpdaterEnabled;
75     u8              padding_0[2];
76     nw::ut::ResS32 m_TargetStream;
77     nw::ut::Offset toParticleAnimation;
78 };
79 
80 
81 //--------------------------------------------------------------------------
82 //! @brief  パーティクルアップデータを表すバイナリリソースクラスです。
83 //--------------------------------------------------------------------------
84 class ResParticleUpdater : public nw::ut::ResCommon< ResParticleUpdaterData >
85 {
86 public:
87     enum { TYPE_INFO = NW_GFX_RES_TYPE_INFO(ResParticleUpdater) };
88     enum { SIGNATURE = NW_RES_SIGNATURE32('PUPD') };
89 
90     NW_RES_CTOR( ResParticleUpdater )
91 
NW_RES_FIELD_PRIMITIVE_DECL(bool,IsResourceCopyEnabled)92     NW_RES_FIELD_PRIMITIVE_DECL( bool, IsResourceCopyEnabled )
93     NW_RES_FIELD_PRIMITIVE_DECL( bool, UpdaterEnabled)
94     NW_RES_FIELD_PRIMITIVE_DECL( ParticleUsage, TargetStream )
95     NW_RES_FIELD_CLASS_DECL( ResParticleAnimation, ParticleAnimation )
96 
97     //---------------------------------------------------------------------------
98     //! @brief        インスタンスの型情報を取得します。
99     //!
100     //! @return       型情報です。
101     //---------------------------------------------------------------------------
102     nw::ut::ResTypeInfo     GetTypeInfo() const { return ref().typeInfo; }
103 
NW_DEPRECATED_FUNCTION(s32 GetTargetStreamsCount ()const)104     NW_DEPRECATED_FUNCTION(s32 GetTargetStreamsCount() const)
105     {
106         if (this->GetTargetStream() < 0)
107         {
108             return 0;
109         }
110 
111         return 1;
112     }
113 
NW_DEPRECATED_FUNCTION(ParticleUsage * GetTargetStreams ())114     NW_DEPRECATED_FUNCTION(ParticleUsage* GetTargetStreams())
115     {
116         return (ParticleUsage*)&ref().m_TargetStream;
117     }
118 
NW_DEPRECATED_FUNCTION(const ParticleUsage * GetTargetStreams ()const)119     NW_DEPRECATED_FUNCTION(const ParticleUsage* GetTargetStreams() const)
120     {
121         return (const ParticleUsage*)&ref().m_TargetStream;
122     }
123 };
124 
125 //! @details :private
126 struct ResParticleAccelarationUpdaterData : public ResParticleUpdaterData
127 {
128     nw::ut::ResF32 m_Factor;
129 };
130 
131 
132 //--------------------------------------------------------------------------
133 //! @brief  f32を乗算で更新するパーティクルアップデータを表すバイナリリソースクラスです。
134 //--------------------------------------------------------------------------
135 class ResParticleAccelarationUpdater : public ResParticleUpdater
136 {
137 public:
138     enum { TYPE_INFO = NW_GFX_RES_TYPE_INFO(ResParticleAccelarationUpdater) };
139     enum { SIGNATURE = NW_RES_SIGNATURE32('ACCE') };
140 
141     NW_RES_CTOR_INHERIT( ResParticleAccelarationUpdater, ResParticleUpdater )
142 
143     NW_RES_FIELD_PRIMITIVE_DECL( f32, Factor ) // GetFactor(), SetFactor()
144 };
145 
146 //! @details :private
147 struct ResParticleFloatUpdaterData : public ResParticleUpdaterData
148 {
149     nw::ut::ResF32 m_DefaultValue;
150 };
151 
152 
153 //--------------------------------------------------------------------------
154 //! @brief  f32を更新するパーティクルアップデータを表すバイナリリソースクラスです(基底クラス)。
155 //--------------------------------------------------------------------------
156 class ResParticleFloatUpdater : public ResParticleUpdater
157 {
158 public:
159     enum { TYPE_INFO = NW_GFX_RES_TYPE_INFO(ResParticleFloatUpdater) };
160     enum { SIGNATURE = NW_RES_SIGNATURE32('FLOA') };
161 
162     NW_RES_CTOR_INHERIT( ResParticleFloatUpdater, ResParticleUpdater )
163 
164     NW_RES_FIELD_PRIMITIVE_DECL( f32, DefaultValue )
165 };
166 
167 //! @details :private
168 struct ResParticleFloatImmediateUpdaterData : public ResParticleFloatUpdaterData
169 {
170 };
171 
172 
173 //--------------------------------------------------------------------------
174 //! @brief  f32を即値で更新するパーティクルアップデータを表すバイナリリソースクラスです。
175 //--------------------------------------------------------------------------
176 class ResParticleFloatImmediateUpdater : public ResParticleFloatUpdater
177 {
178 public:
179     enum { TYPE_INFO = NW_GFX_RES_TYPE_INFO(ResParticleFloatImmediateUpdater) };
180     enum { SIGNATURE = NW_RES_SIGNATURE32('FIMM') };
181 
182     NW_RES_CTOR_INHERIT( ResParticleFloatImmediateUpdater, ResParticleFloatUpdater )
183 };
184 
185 
186 #ifdef NW_GFX_PARTICLE_4KEY
187 //! @details :private
188 struct ResParticleFloatImmediate4KeyUpdaterData : public ResParticleUpdaterData
189 {
190     nw::ut::ResU32 m_InTime;
191     nw::ut::ResU32 m_OutTime;
192     nw::ut::ResF32 m_Value0;
193     nw::ut::ResF32 m_Value1;
194     nw::ut::ResF32 m_Value2;
195     nw::ut::ResF32 m_Value3;
196 };
197 
198 //--------------------------------------------------------------------------
199 //! @brief  f32を4キーの即値で更新するパーティクルアップデータを表すバイナリリソースクラスです。
200 //--------------------------------------------------------------------------
201 class ResParticleFloatImmediate4KeyUpdater : public ResParticleUpdater
202 {
203 public:
204     enum { TYPE_INFO = NW_GFX_RES_TYPE_INFO(ResParticleFloatImmediate4KeyUpdater) };
205     enum { SIGNATURE = NW_RES_SIGNATURE32('FIM4') };
206 
207     NW_RES_CTOR_INHERIT( ResParticleFloatImmediate4KeyUpdater, ResParticleUpdater )
208 
209     NW_RES_FIELD_PRIMITIVE_DECL( u32, InTime )
210     NW_RES_FIELD_PRIMITIVE_DECL( u32, OutTime )
211     NW_RES_FIELD_PRIMITIVE_DECL( f32, Value0 )
212     NW_RES_FIELD_PRIMITIVE_DECL( f32, Value1 )
213     NW_RES_FIELD_PRIMITIVE_DECL( f32, Value2 )
214     NW_RES_FIELD_PRIMITIVE_DECL( f32, Value3 )
215 };
216 #endif
217 
218 
219 //! @details :private
220 struct ResParticleGeneralUpdaterData : public ResParticleUpdaterData
221 {
222 };
223 
224 //--------------------------------------------------------------------------
225 //! @brief  位置・速度を更新するパーティクルジェネラアップデータを表すバイナリリソースクラスです。
226 //--------------------------------------------------------------------------
227 class ResParticleGeneralUpdater : public ResParticleUpdater
228 {
229 public:
230     enum { TYPE_INFO = NW_GFX_RES_TYPE_INFO(ResParticleGeneralUpdater) };
231     enum { SIGNATURE = NW_RES_SIGNATURE32('GENE') };
232 
233     NW_RES_CTOR_INHERIT( ResParticleGeneralUpdater, ResParticleUpdater )
234 };
235 
236 //! @details :private
237 struct ResParticleGravityUpdaterData : public ResParticleUpdaterData
238 {
239     nw::ut::ResF32 m_Power;
240     nw::ut::ResVec3 m_Direction;
241 };
242 
243 
244 //--------------------------------------------------------------------------
245 //! @brief  重力のパーティクルアップデータを表すバイナリリソースクラスです。
246 //--------------------------------------------------------------------------
247 class ResParticleGravityUpdater : public ResParticleUpdater
248 {
249 public:
250     enum { TYPE_INFO = NW_GFX_RES_TYPE_INFO(ResParticleGravityUpdater) };
251     enum { SIGNATURE = NW_RES_SIGNATURE32('GRAV') };
252 
253     NW_RES_CTOR_INHERIT( ResParticleGravityUpdater, ResParticleUpdater )
254 
255     NW_RES_FIELD_PRIMITIVE_DECL( f32, Power )             // GetPower(), SetPower()
256     NW_RES_FIELD_VECTOR3_DECL( nw::math::VEC3, Direction ) // GetDirection()
257 };
258 
259 //! @details :private
260 struct ResParticleSpinUpdaterData : public ResParticleUpdaterData
261 {
262     nw::ut::ResF32 m_Power;
263     nw::ut::ResVec3 m_Axis;
264 };
265 
266 
267 //--------------------------------------------------------------------------
268 //! @brief  スピンのパーティクルアップデータを表すバイナリリソースクラスです。
269 //--------------------------------------------------------------------------
270 class ResParticleSpinUpdater : public ResParticleUpdater
271 {
272 public:
273     enum { TYPE_INFO = NW_GFX_RES_TYPE_INFO(ResParticleSpinUpdater) };
274     enum { SIGNATURE = NW_RES_SIGNATURE32('SPIN') };
275 
276     NW_RES_CTOR_INHERIT( ResParticleSpinUpdater, ResParticleUpdater )
277 
278     NW_RES_FIELD_PRIMITIVE_DECL( f32, Power )             // GetPower(), SetPower()
279     NW_RES_FIELD_VECTOR3_DECL( nw::math::VEC3, Axis ) // GetAxis()
280 };
281 
282 //! @details :private
283 struct ResParticleRandomUpdaterData : public ResParticleUpdaterData
284 {
285     nw::ut::ResVec3 m_Power;
286     nw::ut::ResS32 m_Interval;
287 };
288 
289 
290 //--------------------------------------------------------------------------
291 //! @brief  Vector3をランダム付きで更新するパーティクルアップデータを表すバイナリリソースクラスです。
292 //--------------------------------------------------------------------------
293 class ResParticleRandomUpdater : public ResParticleUpdater
294 {
295 public:
296     enum { TYPE_INFO = NW_GFX_RES_TYPE_INFO(ResParticleRandomUpdater) };
297     enum { SIGNATURE = NW_RES_SIGNATURE32('RNDU') };
298 
299     NW_RES_CTOR_INHERIT( ResParticleRandomUpdater, ResParticleUpdater )
300 
301     NW_RES_FIELD_VECTOR3_DECL( nw::math::VEC3, Power ) // GetPower()
302     NW_RES_FIELD_PRIMITIVE_DECL( s32, Interval )             // GetInterval(), SetInterval()
303 };
304 
305 //! @details :private
306 struct ResParticleVector2ImmediateUpdaterData : public ResParticleUpdaterData
307 {
308     nw::ut::ResVec2 m_DefaultValue;
309 };
310 
311 
312 //--------------------------------------------------------------------------
313 //! @brief  Vector2を即値で更新するパーティクルアップデータを表すバイナリリソースクラスです。
314 //--------------------------------------------------------------------------
315 class ResParticleVector2ImmediateUpdater : public ResParticleUpdater
316 {
317 public:
318     enum { TYPE_INFO = NW_GFX_RES_TYPE_INFO(ResParticleVector2ImmediateUpdater) };
319     enum { SIGNATURE = NW_RES_SIGNATURE32('V2IM') };
320 
321     NW_RES_CTOR_INHERIT( ResParticleVector2ImmediateUpdater, ResParticleUpdater )
322 
323     NW_RES_FIELD_VECTOR2_DECL( nw::math::VEC2, DefaultValue )
324 };
325 
326 //! @details :private
327 struct ResParticleVector3UpdaterData : public ResParticleUpdaterData
328 {
329     nw::ut::ResVec3 m_DefaultValue;
330 };
331 
332 
333 //--------------------------------------------------------------------------
334 //! @brief  Vector3を更新するパーティクルアップデータを表すバイナリリソースクラスです(基底クラス)。
335 //--------------------------------------------------------------------------
336 class ResParticleVector3Updater : public ResParticleUpdater
337 {
338 public:
339     enum { TYPE_INFO = NW_GFX_RES_TYPE_INFO(ResParticleVector3Updater) };
340     enum { SIGNATURE = NW_RES_SIGNATURE32('VEC3') };
341 
342     NW_RES_CTOR_INHERIT( ResParticleVector3Updater, ResParticleUpdater )
343 
344     NW_RES_FIELD_VECTOR3_DECL( nw::math::VEC3, DefaultValue )
345 };
346 
347 //! @details :private
348 struct ResParticleVector3AdditiveUpdaterData : public ResParticleVector3UpdaterData
349 {
350 };
351 
352 
353 //--------------------------------------------------------------------------
354 //! @brief  Vector3を加算で更新するパーティクルアップデータを表すバイナリリソースクラスです。
355 //--------------------------------------------------------------------------
356 class ResParticleVector3AdditiveUpdater : public ResParticleVector3Updater
357 {
358 public:
359     enum { TYPE_INFO = NW_GFX_RES_TYPE_INFO(ResParticleVector3AdditiveUpdater) };
360     enum { SIGNATURE = NW_RES_SIGNATURE32('V3AD') };
361 
362     NW_RES_CTOR_INHERIT( ResParticleVector3AdditiveUpdater, ResParticleVector3Updater )
363 };
364 
365 //! @details :private
366 struct ResParticleVector3ImmediateUpdaterData : public ResParticleVector3UpdaterData
367 {
368 };
369 
370 
371 //--------------------------------------------------------------------------
372 //! @brief  Vector3を即値で更新するパーティクルアップデータを表すバイナリリソースクラスです。
373 //--------------------------------------------------------------------------
374 class ResParticleVector3ImmediateUpdater : public ResParticleVector3Updater
375 {
376 public:
377     enum { TYPE_INFO = NW_GFX_RES_TYPE_INFO(ResParticleVector3ImmediateUpdater) };
378     enum { SIGNATURE = NW_RES_SIGNATURE32('V3IM') };
379 
380     NW_RES_CTOR_INHERIT( ResParticleVector3ImmediateUpdater, ResParticleVector3Updater )
381 };
382 
383 //! @details :private
384 struct ResParticleVector3RandomAdditiveUpdaterData : public ResParticleVector3UpdaterData
385 {
386 };
387 
388 
389 //--------------------------------------------------------------------------
390 //! @brief  Vector3ランダム加算付きパーティクルアップデータを表すバイナリリソースクラスです。
391 //--------------------------------------------------------------------------
392 class ResParticleVector3RandomAdditiveUpdater : public ResParticleVector3Updater
393 {
394 public:
395     enum { TYPE_INFO = NW_GFX_RES_TYPE_INFO(ResParticleVector3RandomAdditiveUpdater) };
396     enum { SIGNATURE = NW_RES_SIGNATURE32('V3RA') };
397 
398     NW_RES_CTOR_INHERIT( ResParticleVector3RandomAdditiveUpdater, ResParticleVector3Updater )
399 };
400 
401 //! @details :private
402 struct ResParticleRotateUpVectorUpdaterData : public ResParticleUpdaterData
403 {
404     nw::ut::ResU32 m_Source;
405 };
406 
407 
408 //--------------------------------------------------------------------------
409 //! @brief  アップベクトル方向へ回転するパーティクルアップデータを表すバイナリリソースクラスです。
410 //--------------------------------------------------------------------------
411 class ResParticleRotateUpVectorUpdater : public ResParticleUpdater
412 {
413 public:
414     enum { TYPE_INFO = NW_GFX_RES_TYPE_INFO(ResParticleRotateUpVectorUpdater) };
415     enum { SIGNATURE = NW_RES_SIGNATURE32('RUVU') };
416 
417     enum ParticleRotateUpVectorSource
418     {
419         SOURCE_VELOCITY = 0,
420         SOURCE_DISTANCE
421     };
422 
423     NW_RES_CTOR_INHERIT( ResParticleRotateUpVectorUpdater, ResParticleUpdater )
424 
425     NW_RES_FIELD_PRIMITIVE_DECL( ParticleRotateUpVectorSource, Source )
426 };
427 
428 //! テクスチャの分割数の定義です。
429 enum ParticleTexturePatternUpdaterDivisionType
430 {
431     Division1 = 1,
432     Division2 = 2,
433     Division4 = 4,
434     Division8 = 8,
435     Division16 = 16
436 };
437 
438 //! @details :private
439 struct ResParticleTexturePatternUpdaterData : public ResParticleUpdaterData
440 {
441     nw::ut::ResU32 m_DivisionX;
442     nw::ut::ResU32 m_DivisionY;
443     nw::ut::ResS32 m_TextureIndex;
444 };
445 
446 
447 //--------------------------------------------------------------------------
448 //! @brief  テクスチャパターンパーティクルアップデータを表すバイナリリソースクラスです。
449 //--------------------------------------------------------------------------
450 class ResParticleTexturePatternUpdater : public ResParticleUpdater
451 {
452 public:
453     enum { TYPE_INFO = NW_GFX_RES_TYPE_INFO(ResParticleTexturePatternUpdater) };
454     enum { SIGNATURE = NW_RES_SIGNATURE32('TPAT') };
455 
456     NW_RES_CTOR_INHERIT( ResParticleTexturePatternUpdater, ResParticleUpdater )
457 
458     NW_RES_FIELD_PRIMITIVE_DECL( ParticleTexturePatternUpdaterDivisionType, DivisionX )
459     NW_RES_FIELD_PRIMITIVE_DECL( ParticleTexturePatternUpdaterDivisionType, DivisionY )
460     NW_RES_FIELD_PRIMITIVE_DECL( u32, TextureIndex )
461 };
462 
463 //! @details :private
464 struct ResParticleChildUpdaterOptionData
465 {
466     nw::ut::ResTypeInfo typeInfo;
467 };
468 
469 
470 //--------------------------------------------------------------------------
471 //! @brief  パーティクルチャイルドアップデータのオプションを表すバイナリリソースクラスです(基底クラス)。
472 //--------------------------------------------------------------------------
473 class ResParticleChildUpdaterOption : public nw::ut::ResCommon< ResParticleChildUpdaterOptionData >
474 {
475 public:
476     enum { TYPE_INFO = NW_GFX_RES_TYPE_INFO(ResParticleChildUpdaterOption) };
477     enum { SIGNATURE = NW_RES_SIGNATURE32('COPT') };
478 
NW_RES_CTOR(ResParticleChildUpdaterOption)479     NW_RES_CTOR( ResParticleChildUpdaterOption )
480 
481     //---------------------------------------------------------------------------
482     //! @brief        インスタンスの型情報を取得します。
483     //!
484     //! @return       型情報です。
485     //---------------------------------------------------------------------------
486     nw::ut::ResTypeInfo     GetTypeInfo() const { return ref().typeInfo; }
487 
488 #ifdef NW_GFX_PARTICLE_COMPAT_1_1
489     bool CheckTiming(ParticleTime birth, ParticleTime life, ParticleTime limit, ParticleTime prevTime, ParticleTime currentTime);
490 #else
491     bool CheckTiming(ParticleTime birth, ParticleTime life, ParticleTime prevTime, ParticleTime currentTime);
492 #endif
493 };
494 
495 //! @details :private
496 struct ResParticleChildUpdaterFirstUpdateOptionData : public ResParticleChildUpdaterOptionData
497 {
498 };
499 
500 
501 //--------------------------------------------------------------------------
502 //! @brief  パーティクルチャイルドで、親の生成時を表すバイナリリソースクラスです。
503 //--------------------------------------------------------------------------
504 class ResParticleChildUpdaterFirstUpdateOption : public ResParticleChildUpdaterOption
505 {
506 public:
507     enum { TYPE_INFO = NW_GFX_RES_TYPE_INFO(ResParticleChildUpdaterFirstUpdateOption) };
508     enum { SIGNATURE = NW_RES_SIGNATURE32('COBU') };
509 
510     NW_RES_CTOR_INHERIT( ResParticleChildUpdaterFirstUpdateOption, ResParticleChildUpdaterOption )
511 };
512 
513 //! @details :private
514 struct ResParticleChildUpdaterFinalUpdateOptionData : public ResParticleChildUpdaterOptionData
515 {
516 };
517 
518 
519 //--------------------------------------------------------------------------
520 //! @brief  パーティクルチャイルドで、親の消滅時を表すバイナリリソースクラスです。
521 //--------------------------------------------------------------------------
522 class ResParticleChildUpdaterFinalUpdateOption : public ResParticleChildUpdaterOption
523 {
524 public:
525     enum { TYPE_INFO = NW_GFX_RES_TYPE_INFO(ResParticleChildUpdaterFinalUpdateOption) };
526     enum { SIGNATURE = NW_RES_SIGNATURE32('COFU') };
527 
528     NW_RES_CTOR_INHERIT( ResParticleChildUpdaterFinalUpdateOption, ResParticleChildUpdaterOption )
529 };
530 
531 //! @details :private
532 struct ResParticleChildUpdaterIntervalOptionData : public ResParticleChildUpdaterOptionData
533 {
534     nw::ut::ResF32 m_Start;
535     nw::ut::ResF32 m_End;
536     nw::ut::ResS32 m_Interval;
537 };
538 
539 
540 //--------------------------------------------------------------------------
541 //! @brief  パーティクルチャイルドで、寿命の割合で間隔を表すバイナリリソースクラスです。
542 //--------------------------------------------------------------------------
543 class ResParticleChildUpdaterIntervalOption : public ResParticleChildUpdaterOption
544 {
545 public:
546     enum { TYPE_INFO = NW_GFX_RES_TYPE_INFO(ResParticleChildUpdaterIntervalOption) };
547     enum { SIGNATURE = NW_RES_SIGNATURE32('COIN') };
548 
549     NW_RES_CTOR_INHERIT( ResParticleChildUpdaterIntervalOption, ResParticleChildUpdaterOption )
550 
551     NW_RES_FIELD_PRIMITIVE_DECL( f32, Start )
552     NW_RES_FIELD_PRIMITIVE_DECL( f32, End )
553     NW_RES_FIELD_PRIMITIVE_DECL( s32, Interval )
554 };
555 
556 //! @details :private
557 struct ResParticleChildUpdaterFrameOptionData : public ResParticleChildUpdaterOptionData
558 {
559     nw::ut::ResS32 m_Start;
560     nw::ut::ResS32 m_End;
561     nw::ut::ResS32 m_Interval;
562 };
563 
564 
565 //--------------------------------------------------------------------------
566 //! @brief  パーティクルチャイルド、フレームで間隔を表すバイナリリソースクラスです。
567 //--------------------------------------------------------------------------
568 class ResParticleChildUpdaterFrameOption : public ResParticleChildUpdaterOption
569 {
570 public:
571     enum { TYPE_INFO = NW_GFX_RES_TYPE_INFO(ResParticleChildUpdaterFrameOption) };
572     enum { SIGNATURE = NW_RES_SIGNATURE32('COFN') };
573 
574     NW_RES_CTOR_INHERIT( ResParticleChildUpdaterFrameOption, ResParticleChildUpdaterOption )
575 
576     NW_RES_FIELD_PRIMITIVE_DECL( s32, Start )
577     NW_RES_FIELD_PRIMITIVE_DECL( s32, End )
578     NW_RES_FIELD_PRIMITIVE_DECL( s32, Interval )
579 };
580 
581 //! @details :private
582 struct ResParticleChildUpdaterData : public ResParticleUpdaterData
583 {
584     nw::ut::BinString toParticleSetPath;
585     nw::ut::Offset toParticleForm;
586     nw::ut::Offset toTiming;
587     nw::ut::ResS32 m_EmissionRatio;
588 };
589 
590 
591 //--------------------------------------------------------------------------
592 //! @brief  パーティクルチャイルドアップデータを表すバイナリリソースクラスです。
593 //--------------------------------------------------------------------------
594 class ResParticleChildUpdater : public ResParticleUpdater
595 {
596 public:
597     enum { TYPE_INFO = NW_GFX_RES_TYPE_INFO(ResParticleChildUpdater) };
598     enum { SIGNATURE = NW_RES_SIGNATURE32('CHLD') };
599 
600     NW_RES_CTOR_INHERIT( ResParticleChildUpdater, ResParticleUpdater )
601 
602     NW_RES_FIELD_STRING_DECL( ParticleSetPath )                // GetParticleSetPath()
603     NW_RES_FIELD_CLASS_DECL( ResParticleForm, ParticleForm)    // GetParticleForm()
604     NW_RES_FIELD_CLASS_DECL( ResParticleChildUpdaterOption, Timing)    // GetTiming()
605     NW_RES_FIELD_PRIMITIVE_DECL( s32, EmissionRatio )            // GetEmissionRatio()
606 };
607 
608 //! @details :private
609 struct ResParticleUserUpdaterData : public ResParticleUpdaterData
610 {
611     nw::ut::ResU32 m_UserParameter;
612 };
613 
614 
615 //--------------------------------------------------------------------------
616 //! @brief  ユーザー定義のパーティクルアップデータを表すバイナリリソースクラスです。
617 //--------------------------------------------------------------------------
618 class ResParticleUserUpdater : public ResParticleUpdater
619 {
620 public:
621     enum { TYPE_INFO = NW_GFX_RES_TYPE_INFO(ResParticleUserUpdater) };
622     enum { SIGNATURE = NW_RES_SIGNATURE32('USER') };
623 
624     typedef void (*UserFunctionType)(
625         ParticleContext*,
626         ParticleSet*,
627         const ResParticleUserUpdater*,
628         f32,
629         f32
630     );
631 
632     NW_RES_CTOR_INHERIT( ResParticleUserUpdater, ResParticleUpdater )
633 
634     NW_RES_FIELD_PRIMITIVE_DECL( u32, UserParameter )            // GetUserParameter()
635 };
636 
637 } // namespace res
638 } // namespace gfx
639 } // namespace nw
640 
641 #endif // NW_GFX_RESPARTICLEUPDATER_H_
642