/** * Creates and EffectTrack * * @param emitter the emitter of the track * @param length the length of the track (usually the length of the * animation you want to add the track to) */ public EffectTrack(ParticleEmitter emitter, float length) { this.emitter = emitter; //saving particles per second value this.particlesPerSeconds = emitter.getParticlesPerSec(); //setting the emmitter to not emmit. this.emitter.setParticlesPerSec(0); this.length = length; //Marking the emitter with a reference to this track for further use in deserialization. setUserData(this); }
/** * Sets the Emitter to use in this track * * @param emitter */ public void setEmitter(ParticleEmitter emitter) { if (this.emitter != null) { TrackInfo data = (TrackInfo) emitter.getUserData("TrackInfo"); data.getTracks().remove(this); } this.emitter = emitter; //saving particles per second value this.particlesPerSeconds = emitter.getParticlesPerSec(); //setting the emmitter to not emmit. this.emitter.setParticlesPerSec(0); setUserData(this); }
/** * This method clone the Track and search for the cloned counterpart of the * original emitter in the given cloned spatial. The spatial is assumed to * be the Spatial holding the AnimControl controlling the animation using * this Track. * * @param spatial the Spatial holding the AnimControl * @return the cloned Track with proper reference */ @Override public Track cloneForSpatial(Spatial spatial) { EffectTrack effectTrack = new EffectTrack(); effectTrack.particlesPerSeconds = this.particlesPerSeconds; effectTrack.length = this.length; effectTrack.startOffset = this.startOffset; //searching for the newly cloned ParticleEmitter effectTrack.emitter = findEmitter(spatial); if (effectTrack.emitter == null) { logger.log(Level.WARNING, "{0} was not found in {1} or is not bound to this track", new Object[]{emitter.getName(), spatial.getName()}); effectTrack.emitter = emitter; } removeUserData(this); //setting user data on the new emmitter and marking it with a reference to the cloned Track. setUserData(effectTrack); effectTrack.emitter.setParticlesPerSec(0); return effectTrack; }
/** * Creates and EffectTrack * * @param emitter the emitter of the track * @param length the length of the track (usually the length of the * animation you want to add the track to) */ public EffectTrack(ParticleEmitter emitter, float length) { this.emitter = emitter; //saving particles per second value this.particlesPerSeconds = emitter.getParticlesPerSec(); //setting the emmitter to not emmit. this.emitter.setParticlesPerSec(0); this.length = length; //Marking the emitter with a reference to this track for further use in deserialization. setUserData(this); }
/** * Creates and EffectTrack * * @param emitter the emmitter of the track * @param length the length of the track (usually the length of the * animation you want to add the track to) */ public EffectTrack(ParticleEmitter emitter, float length) { this.emitter = emitter; //saving particles per second value this.particlesPerSeconds = emitter.getParticlesPerSec(); //setting the emmitter to not emmit. this.emitter.setParticlesPerSec(0); this.length = length; //Marking the emitter with a reference to this track for further use in deserialization. setUserData(this); }
/** * Sets the Emitter to use in this track * * @param emitter */ public void setEmitter(ParticleEmitter emitter) { if (this.emitter != null) { TrackInfo data = (TrackInfo) emitter.getUserData("TrackInfo"); data.getTracks().remove(this); } this.emitter = emitter; //saving particles per second value this.particlesPerSeconds = emitter.getParticlesPerSec(); //setting the emmitter to not emmit. this.emitter.setParticlesPerSec(0); setUserData(this); }
/** * Sets the Emitter to use in this track * * @param emitter */ public void setEmitter(ParticleEmitter emitter) { if (this.emitter != null) { TrackInfo data = (TrackInfo) emitter.getUserData("TrackInfo"); data.getTracks().remove(this); } this.emitter = emitter; //saving particles per second value this.particlesPerSeconds = emitter.getParticlesPerSec(); //setting the emmitter to not emmit. this.emitter.setParticlesPerSec(0); setUserData(this); }
/** * This method clone the Track and search for the cloned counterpart of the * original emmitter in the given cloned spatial. The spatial is assumed to * be the Spatial holding the AnimControl controling the animation using * this Track. * * @param spatial the Spatial holding the AnimControl * @return the cloned Track with proper reference */ public Track cloneForSpatial(Spatial spatial) { EffectTrack effectTrack = new EffectTrack(); effectTrack.particlesPerSeconds = this.particlesPerSeconds; effectTrack.length = this.length; effectTrack.startOffset = this.startOffset; //searching for the newly cloned ParticleEmitter effectTrack.emitter = findEmitter(spatial); if (effectTrack.emitter == null) { logger.log(Level.WARNING, "{0} was not found in {1} or is not bound to this track", new Object[]{emitter.getName(), spatial.getName()}); effectTrack.emitter = emitter; } removeUserData(this); //setting user data on the new emmitter and marking it with a reference to the cloned Track. setUserData(effectTrack); effectTrack.emitter.setParticlesPerSec(0); return effectTrack; }
/** * This method clone the Track and search for the cloned counterpart of the * original emitter in the given cloned spatial. The spatial is assumed to * be the Spatial holding the AnimControl controlling the animation using * this Track. * * @param spatial the Spatial holding the AnimControl * @return the cloned Track with proper reference */ @Override public Track cloneForSpatial(Spatial spatial) { EffectTrack effectTrack = new EffectTrack(); effectTrack.particlesPerSeconds = this.particlesPerSeconds; effectTrack.length = this.length; effectTrack.startOffset = this.startOffset; //searching for the newly cloned ParticleEmitter effectTrack.emitter = findEmitter(spatial); if (effectTrack.emitter == null) { logger.log(Level.WARNING, "{0} was not found in {1} or is not bound to this track", new Object[]{emitter.getName(), spatial.getName()}); effectTrack.emitter = emitter; } removeUserData(this); //setting user data on the new emmitter and marking it with a reference to the cloned Track. setUserData(effectTrack); effectTrack.emitter.setParticlesPerSec(0); return effectTrack; }