public void render ( float x , float y ) { if ( ( sprite == null ) && ( defaultImageName != null ) ) { loadSystemParticleImage ( ) ; } if ( ! visible ) { return ; } GL . glTranslatef ( x , y , 0 ) ; if ( blendingMode == BLEND_ADDITIVE ) { GL . glBlendFunc ( SGL . GL_SRC_ALPHA , SGL . GL_ONE ) ; } if ( usePoints ( ) ) { GL . glEnable ( SGL . GL_POINT_SMOOTH ) ; TextureImpl . bindNone ( ) ; } // iterate over all emitters for ( int emitterIdx = 0 ; emitterIdx < emitters . size ( ) ; emitterIdx ++ ) { // get emitter ParticleEmitter emitter = ( ParticleEmitter ) emitters . get ( emitterIdx ) ; if ( ! emitter . isEnabled ( ) ) { continue ; } // check for additive override and enable when set if ( emitter . useAdditive ( ) ) { GL . glBlendFunc ( SGL . GL_SRC_ALPHA , SGL . GL_ONE ) ; } // now get the particle pool for this emitter and render all particles that are in use ParticlePool pool = ( ParticlePool ) particlesByEmitter . get ( emitter ) ; Image image = emitter . getImage ( ) ; if ( image == null ) { image = this . sprite ; } if ( ! emitter . isOriented ( ) && ! emitter . usePoints ( this ) ) { image . startUse ( ) ; } for ( int i = 0 ; i < pool . particles . length ; i ++ ) { if ( pool . particles [ i ] . inUse ( ) ) pool . particles [ i ] . render ( ) ; } if ( ! emitter . isOriented ( ) && ! emitter . usePoints ( this ) ) { image . endUse ( ) ; } // reset additive blend mode if ( emitter . useAdditive ( ) ) { GL . glBlendFunc ( SGL . GL_SRC_ALPHA , SGL . GL_ONE_MINUS_SRC_ALPHA ) ; } } if ( usePoints ( ) ) { GL . glDisable ( SGL . GL_POINT_SMOOTH ) ; } if ( blendingMode == BLEND_ADDITIVE ) { GL . glBlendFunc ( SGL . GL_SRC_ALPHA , SGL . GL_ONE_MINUS_SRC_ALPHA ) ; } Color . white . bind ( ) ; GL . glTranslatef ( - x , - y , 0 ) ; }
Render the particles in the system