import ParticleEmitter2Object from './particleemitter2object' ; import MdxModelInstance from './modelinstance' ; import MdxNode from './node' ; import MdxEmitter from './emitter' ; import Particle2 from './particle2' ; const emissionRateHeap = new Float32Array ( 1 ) ; /**
 * An MDX particle emitter type 2.
 */ export default class ParticleEmitter2 extends MdxEmitter { node : MdxNode ; lastEmissionKey = - 1 ; constructor ( instance , emitterObject ) { super ( instance , emitterObject ) ; this . node = instance . nodes [ emitterObject . index ] ; } updateEmission ( dt ) { const instance = < MdxModelInstance > this . instance ; if ( instance . allowParticleSpawn ) { const emitterObject = < ParticleEmitter2Object > this . emitterObject ; const keyframe = emitterObject . getEmissionRate ( emissionRateHeap , instance . sequence , instance . frame , instance . counter ) ; if ( emitterObject . squirt ) { if ( keyframe !== this . lastEmissionKey ) { this . currentEmission += emissionRateHeap [ 0 ] ; } this . lastEmissionKey = keyframe ; } else { this . currentEmission += emissionRateHeap [ 0 ] * dt ; } } } emit ( ) { const emitterObject = < ParticleEmitter2Object > this . emitterObject ; if ( emitterObject . head ) { this . emitObject ( 0 ) ; } if ( emitterObject . tail ) { this . emitObject ( 1 ) ; } } createObject ( ) { return new Particle2 ( this ) ; } }