Просмотр исходного кода

Particle Emitter :
- Changed cloning method to clone(boolean cloneMaterial), and added a clone() method that calls clone(true). The missing clone(boolean) method was preventing the particle emitter to be correctly cloned when loading it from a j3o file yielding weird results.

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7946 75d07b2b-3a1a-0410-a2c5-0572b91ccdca

rem..om 14 лет назад
Родитель
Сommit
865c380b4e
1 измененных файлов с 10 добавлено и 3 удалено
  1. 10 3
      engine/src/core/com/jme3/effect/ParticleEmitter.java

+ 10 - 3
engine/src/core/com/jme3/effect/ParticleEmitter.java

@@ -150,7 +150,12 @@ public class ParticleEmitter extends Geometry {
 
 
     @Override
     @Override
     public ParticleEmitter clone() {
     public ParticleEmitter clone() {
-        ParticleEmitter clone = (ParticleEmitter) super.clone();
+        return clone(true);
+    }
+
+    @Override
+    public ParticleEmitter clone(boolean cloneMaterial) {
+        ParticleEmitter clone = (ParticleEmitter) super.clone(cloneMaterial);
         clone.shape = shape.deepClone();
         clone.shape = shape.deepClone();
 
 
         // Reinitialize particle list
         // Reinitialize particle list
@@ -331,7 +336,7 @@ public class ParticleEmitter extends Geometry {
             particles[i] = new Particle();
             particles[i] = new Particle();
         }
         }
         //We have to reinit the mesh's buffers with the new size
         //We have to reinit the mesh's buffers with the new size
-        particleMesh.initParticleData(this, particles.length);        
+        particleMesh.initParticleData(this, particles.length);
         particleMesh.setImagesXY(this.imagesX, this.imagesY);
         particleMesh.setImagesXY(this.imagesX, this.imagesY);
         firstUnUsed = 0;
         firstUnUsed = 0;
         lastUsed = -1;
         lastUsed = -1;
@@ -1132,7 +1137,7 @@ public class ParticleEmitter extends Geometry {
 
 
         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);
-      
+
 
 
         enabled = ic.readBoolean("enabled", true);
         enabled = ic.readBoolean("enabled", true);
         particlesPerSec = ic.readFloat("particlesPerSec", 0);
         particlesPerSec = ic.readFloat("particlesPerSec", 0);
@@ -1147,6 +1152,7 @@ public class ParticleEmitter extends Geometry {
         startSize = ic.readFloat("startSize", 0);
         startSize = ic.readFloat("startSize", 0);
         endSize = ic.readFloat("endSize", 0);
         endSize = ic.readFloat("endSize", 0);
         worldSpace = ic.readBoolean("worldSpace", false);
         worldSpace = ic.readBoolean("worldSpace", false);
+        this.setIgnoreTransform(worldSpace);
         facingVelocity = ic.readBoolean("facingVelocity", false);
         facingVelocity = ic.readBoolean("facingVelocity", false);
         selectRandomImage = ic.readBoolean("selectRandomImage", false);
         selectRandomImage = ic.readBoolean("selectRandomImage", false);
         randomAngle = ic.readBoolean("randomAngle", false);
         randomAngle = ic.readBoolean("randomAngle", false);
@@ -1197,6 +1203,7 @@ public class ParticleEmitter extends Geometry {
             // loaded separately
             // loaded separately
             control = getControl(ParticleEmitterControl.class);
             control = getControl(ParticleEmitterControl.class);
             control.parentEmitter = this;
             control.parentEmitter = this;
+
         }
         }
     }
     }
 }
 }