import RibbonEmitter from '../../../parsers/mdlx/ribbonemitter' ; import MdxModel from './model' ; import GenericObject from './genericobject' ; import Layer from './layer' ; import { EMITTER_RIBBON , SETTING_PARTICLES_HIGH } from './geometryemitterfuncs' ; /**
 * An MDX ribbon emitter.
 */ export default class RibbonEmitterObject extends GenericObject { geometryEmitterType = EMITTER_RIBBON ; layer : Layer ; heightAbove : number ; heightBelow : number ; alpha : number ; color : Float32Array ; lifeSpan : number ; textureSlot : number ; emissionRate : number ; gravity : number ; columns : number ; rows : number ; /**
     * Even if the internal texture isn't loaded, it's fine to run emitters based on this emitter object.
     *
     * The ribbons will simply be black.
     */ ok = true ; constructor ( model , emitter , index ) { super ( model , emitter , index ) ; this . layer = model . materials [ emitter . materialId ] . layers [ 0 ] ; this . heightAbove = emitter . heightAbove ; this . heightBelow = emitter . heightBelow ; this . alpha = emitter . alpha ; this . color = emitter . color ; this . lifeSpan = emitter . lifeSpan ; this . textureSlot = emitter . textureSlot ; this . emissionRate = emitter . emissionRate * SETTING_PARTICLES_HIGH ; this . gravity = emitter . gravity ; this . columns = emitter . columns ; this . rows = emitter . rows ; } getHeightBelow ( out , sequence , frame , counter ) { return this . getScalarValue ( out , 'KRHB' , sequence , frame , counter , this . heightBelow ) ; } getHeightAbove ( out , sequence , frame , counter ) { return this . getScalarValue ( out , 'KRHA' , sequence , frame , counter , this . heightAbove ) ; } getTextureSlot ( out , sequence , frame , counter ) { return this . getScalarValue ( out , 'KRTX' , sequence , frame , counter , 0 ) ; } getColor ( out , sequence , frame , counter ) { return this . getVectorValue ( out , 'KRCO' , sequence , frame , counter , this . color ) ; } getAlpha ( out , sequence , frame , counter ) { return this . getScalarValue ( out , 'KRAL' , sequence , frame , counter , this . alpha ) ; } /**
     * Ribbon emitters specifically have an alpha.
     *
     * When this alpha is 0, naturally ribbons shouldn't be emitted.
     *
     * Therefore first check the alpha animation, and only if it's >0 check the visibility animation.
     */ override getVisibility ( out , sequence , frame , counter ) { const keyframe = this . getAlpha ( out , sequence , frame , counter ) ; if ( out [ 0 ] === 0 ) { return keyframe ; } return this . getScalarValue ( out , 'KRVS' , sequence , frame , counter , 1 ) ; } }