1 /*---------------------------------------------------------------------------* 2 Project: NintendoWare 3 File: gfx_ResParticleModel.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: 19618 $ 14 *---------------------------------------------------------------------------*/ 15 16 #ifndef NW_GFX_RESPARTICLEMODEL_H_ 17 #define NW_GFX_RESPARTICLEMODEL_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_ResModel.h> 23 #include <nw/gfx/res/gfx_ResParticleSet.h> 24 #include <nw/gfx/res/gfx_ResRevision.h> 25 #include <nw/gfx/res/gfx_ResTypeInfo.h> 26 27 namespace nw { 28 namespace gfx { 29 namespace res { 30 31 //! @details :private 32 struct ResParticleModelData : public ResModelData 33 { 34 nw::ut::ResS32 m_ParticleSetsTableCount; 35 nw::ut::Offset toParticleSetsTable; 36 }; 37 38 39 //-------------------------------------------------------------------------- 40 //! @brief パーティクルモデルを表すバイナリリソースクラスです。 41 //-------------------------------------------------------------------------- 42 class ResParticleModel : public ResModel 43 { 44 public: 45 enum { TYPE_INFO = NW_GFX_RES_TYPE_INFO(ResParticleModel) }; 46 enum { SIGNATURE = NW_RES_SIGNATURE32('PMDL') }; 47 enum { BINARY_REVISION = REVISION_RES_EMITTER }; 48 49 NW_RES_CTOR_INHERIT( ResParticleModel, ResModel ) 50 51 NW_RES_FIELD_CLASS_LIST_DECL( ResParticleSet, ParticleSets ) // GetParticleSets(int idx), GetParticleSetsCount() 52 53 void Setup(); 54 55 //--------------------------------------------------------------------------- 56 //! @brief ResParticleModel 内の全ての ResParticleSet を巡回して TFunction を適用します。 57 //! 58 //! @tparam TFunction ResParticleSet を引数に取る関数(オブジェクト)の型です。 59 //! @param[in] function 適応する関数(オブジェクト)です。 60 //--------------------------------------------------------------------------- 61 template<typename TFunction> ForeachParticleSet(TFunction function)62 void ForeachParticleSet(TFunction function) 63 { 64 if (this->IsValid()) 65 { 66 for (s32 i = 0; i < this->GetParticleSetsCount(); ++i) 67 { 68 ResParticleSet resParticleSet = this->GetParticleSets(i); 69 function(resParticleSet); 70 } 71 } 72 } 73 }; 74 75 } // namespace res 76 } // namespace gfx 77 } // namespace nw 78 79 #endif // NW_GFX_RESPARTICLEMODEL_H_ 80