1 /*---------------------------------------------------------------------------*
2   Project:  NintendoWare
3   File:     gfx_ResParticleSet.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_RESPARTICLESET_H_
17 #define NW_GFX_RESPARTICLESET_H_
18 
19 #include <nw/ut/ut_ResUtil.h>
20 #include <nw/gfx/res/gfx_ResSceneObject.h>
21 #include <nw/gfx/res/gfx_ResParticleCollection.h>
22 #include <nw/gfx/res/gfx_ResParticleShape.h>
23 #include <nw/gfx/res/gfx_ResParticleInitializer.h>
24 #include <nw/gfx/res/gfx_ResParticleUpdater.h>
25 #include <nw/gfx/res/gfx_ResParticleShapeBuilder.h>
26 #include <nw/gfx/res/gfx_ResTypeInfo.h>
27 
28 namespace nw {
29 namespace gfx {
30 namespace res {
31 
32 typedef ut::ResArrayClass<ResParticleInitializer>::type::iterator ResParticleInitializerArrayIterator;
33 typedef ut::ResArrayClass<const ResParticleInitializer>::type::const_iterator ResParticleInitializerArrayConstIterator;
34 typedef ut::ResArrayClass<ResParticleInitializer>::type ResParticleInitializerArray;
35 typedef ut::ResArrayClass<const ResParticleInitializer>::type ResParticleInitializerArrayConst;
36 
37 typedef ut::ResArrayClass<ResParticleUpdater>::type::iterator ResParticleUpdaterArrayIterator;
38 typedef ut::ResArrayClass<const ResParticleUpdater>::type::const_iterator ResParticleUpdaterArrayConstIterator;
39 typedef ut::ResArrayClass<ResParticleUpdater>::type ResParticleUpdaterArray;
40 typedef ut::ResArrayClass<const ResParticleUpdater>::type ResParticleUpdaterArrayConst;
41 
42 //! @details :private
43 struct ResParticleSetData : public ResSceneNodeData
44 {
45     nw::ut::Offset toParticleCollection;
46     nw::ut::ResS32 m_ParticleInitializersTableCount;
47     nw::ut::Offset toParticleInitializersTable;
48     nw::ut::ResS32 m_ParticleUpdatersTableCount;
49     nw::ut::Offset toParticleUpdatersTable;
50     nw::ut::Offset toParticleShapeBuilder;
51     nw::ut::ResS32 m_ParticleShapeIndex;
52     nw::ut::ResU32 m_ParticleSetPriority;
53     nw::ut::ResBool m_IsForceWorld;
54     nw::ut::ResBool m_IsBufferFlushEnabled;
55     nw::ut::ResBool m_IsInheritParentVelocity;
56 };
57 
58 
59 //--------------------------------------------------------------------------
60 //! @brief  パーティクルセットを表すバイナリリソースクラスです。
61 //--------------------------------------------------------------------------
62 class ResParticleSet : public ResSceneNode
63 {
64 public:
65     enum { TYPE_INFO = NW_GFX_RES_TYPE_INFO(ResParticleSet) };
66     enum { SIGNATURE = NW_RES_SIGNATURE32('PSET') };
67 
68     NW_RES_CTOR_INHERIT( ResParticleSet, ResSceneNode )
69 
70     NW_RES_FIELD_CLASS_DECL( ResParticleCollection, ParticleCollection )         // GetParticleCollection()
71     NW_RES_FIELD_CLASS_LIST_DECL( ResParticleInitializer, ParticleInitializers ) // GetParticleInitializers(int idx), GetParticleInitializersCount()
72     NW_RES_FIELD_CLASS_LIST_DECL( ResParticleUpdater, ParticleUpdaters )         // GetParticleUpdaters(int idx), GetParticleUpdatersCount()
73     NW_RES_FIELD_CLASS_DECL( ResParticleShapeBuilder, ParticleShapeBuilder )         // GetParticleShpaBuilder()
74     NW_RES_FIELD_PRIMITIVE_DECL( s32, ParticleShapeIndex)                            // GetParticleShapeIndex()
75     NW_RES_FIELD_PRIMITIVE_DECL( u32, ParticleSetPriority)                       // GetParticleSetPriority()
76     NW_RES_FIELD_PRIMITIVE_DECL( bool, IsForceWorld)                             // GetIsForceWorld()
77     NW_RES_FIELD_PRIMITIVE_DECL( bool, IsBufferFlushEnabled)                     // GetIsBufferFlushEnabled()
78     NW_RES_FIELD_PRIMITIVE_DECL( bool, IsInheritParentVelocity)                     // GetIsInheritParentVelocity()
79 
80     void    Setup();
81 };
82 typedef nw::ut::ResArrayPatricia<ResParticleSet>::type  ResParticleSetArray;
83 
84 } // namespace res
85 } // namespace gfx
86 } // namespace nw
87 
88 #endif // NW_GFX_RESPARTICLESET_H_
89