/*---------------------------------------------------------------------------* Project: NintendoWare File: SmParticle.cpp Copyright (C)2009-2011 Nintendo/HAL Laboratory, Inc. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo and/or its licensed developers and are protected by national and international copyright laws. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. The content herein is highly confidential and should be handled accordingly. $Revision: $ *---------------------------------------------------------------------------*/ #include "../include/SmParticle.h" namespace { //---------------------------------------- // コンストラクタ SmParticle::SmParticle( nw::gfx::SceneNode* parentNode ) { m_pParentNode = parentNode; m_ParticleModelInstArray.clear(); m_ParticleEmitterInstArray.clear(); for ( int i=0; iForeachParticleSet(nw::gfx::ParticleSetsClear()); m_ParticleModelInstArray[i]->ParticleAnimFrameController().SetFrame(0); } for ( int i=0; iReset(); } } //---------------------------------------- // アニメーションフレームを設定する void SmParticle::SetAnimationFrame( f32 setFrame ) { f32 endFrame = 0.0f; for ( int i=0; iParticleAnimFrameController().GetEndFrame()) { endFrame = m_ParticleModelInstArray[i]->ParticleAnimFrameController().GetEndFrame(); } } if (setFrame > endFrame) { setFrame = endFrame; } // フレームの更新がなければアニメーションは更新しません if (m_AnimationFrame != setFrame) return; // フレーム数をセット for (int i=0; iParticleAnimFrameController().SetFrame( setFrame ); } m_AnimationFrame = setFrame; } //---------------------------------------- // パーティクルを0~1で表示レベルを調整する void SmParticle::SetVisibleZone( f32 term ) { /* 現状、パーティクルモデル・エミッタが同数の場合のみ動作する。 */ if( m_ParticleModelInstArray.size() != m_ParticleEmitterInstArray.size() ) { return; } s32 visibleNum = m_ParticleModelInstArray.size() * term; for ( int i = 0; i < m_ParticleModelInstArray.size(); i++ ) { if ( i < visibleNum ) { attach( i ); m_ParticleInstAttachedArray[i] = true; } else { detach( i ); m_ParticleInstAttachedArray[i] = false; } } } #if 0 //---------------------------------------- // アニメーションフレームを進める bool SmParticle::AddAnimationFrame( f32 addFrame, bool loop = true ) { NW_UNUSED_VARIABLE(addFrame); NW_UNUSED_VARIABLE(loop); return false; } #endif } // namespace