@ -169,6 +169,11 @@ public class ParticleEmitter extends Geometry {
this . setNumParticles ( numParticles ) ;
this . setNumParticles ( numParticles ) ;
// Must create clone of shape/influencer so that a reference to a static is
// not maintained
shape = shape . deepClone ( ) ;
particleInfluencer = particleInfluencer . clone ( ) ;
controls . add ( control ) ;
controls . add ( control ) ;
switch ( meshType ) {
switch ( meshType ) {
@ -836,7 +841,6 @@ public class ParticleEmitter extends Geometry {
TempVars vars = TempVars . get ( ) ;
TempVars vars = TempVars . get ( ) ;
BoundingBox bbox = ( BoundingBox ) this . getMesh ( ) . getBound ( ) ;
BoundingBox bbox = ( BoundingBox ) this . getMesh ( ) . getBound ( ) ;
Vector3f min = vars . vect1 ;
Vector3f min = vars . vect1 ;
@ -852,9 +856,7 @@ public class ParticleEmitter extends Geometry {
max . set ( Vector3f . NEGATIVE_INFINITY ) ;
max . set ( Vector3f . NEGATIVE_INFINITY ) ;
}
}
while ( this . emitParticle ( min , max ) ) {
while ( emitParticle ( min , max ) ) ;
;
}
bbox . setMinMax ( min , max ) ;
bbox . setMinMax ( min , max ) ;
this . setBoundRefresh ( ) ;
this . setBoundRefresh ( ) ;
@ -1080,6 +1082,12 @@ public class ParticleEmitter extends Geometry {
super . read ( im ) ;
super . read ( im ) ;
InputCapsule ic = im . getCapsule ( this ) ;
InputCapsule ic = im . getCapsule ( this ) ;
shape = ( EmitterShape ) ic . readSavable ( "shape" , DEFAULT_SHAPE ) ;
shape = ( EmitterShape ) ic . readSavable ( "shape" , DEFAULT_SHAPE ) ;
if ( shape = = DEFAULT_SHAPE ) {
// Prevent reference to static
shape = shape . deepClone ( ) ;
}
meshType = ic . readEnum ( "meshType" , ParticleMesh . Type . class , ParticleMesh . Type . Triangle ) ;
meshType = ic . readEnum ( "meshType" , ParticleMesh . Type . class , ParticleMesh . Type . Triangle ) ;
int numParticles = ic . readInt ( "numParticles" , 0 ) ;
int numParticles = ic . readInt ( "numParticles" , 0 ) ;
this . setNumParticles ( numParticles ) ;
this . setNumParticles ( numParticles ) ;
@ -1117,6 +1125,9 @@ public class ParticleEmitter extends Geometry {
particleMesh . initParticleData ( this , particles . length ) ;
particleMesh . initParticleData ( this , particles . length ) ;
particleInfluencer = ( ParticleInfluencer ) ic . readSavable ( "influencer" , DEFAULT_INFLUENCER ) ;
particleInfluencer = ( ParticleInfluencer ) ic . readSavable ( "influencer" , DEFAULT_INFLUENCER ) ;
if ( particleInfluencer = = DEFAULT_INFLUENCER ) {
particleInfluencer = particleInfluencer . clone ( ) ;
}
if ( im . getFormatVersion ( ) = = 0 ) {
if ( im . getFormatVersion ( ) = = 0 ) {
// compatibility before the control inside particle emitter
// compatibility before the control inside particle emitter