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