Particle Emitter :

- Added possibility to change the mesh type after initialization

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7947 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
rem..om 14 years ago
parent 865c380b4e
commit f5dceb6c4d
  1. 20
      engine/src/core/com/jme3/effect/ParticleEmitter.java

@ -73,6 +73,7 @@ import java.io.IOException;
*/
public class ParticleEmitter extends Geometry {
private boolean enabled = true;
private static final EmitterShape DEFAULT_SHAPE = new EmitterPointShape(Vector3f.ZERO);
private static final ParticleInfluencer DEFAULT_INFLUENCER = new DefaultParticleInfluencer();
private ParticleEmitterControl control;
@ -97,7 +98,7 @@ public class ParticleEmitter extends Geometry {
private Vector3f faceNormal = new Vector3f(Vector3f.NAN);
private int imagesX = 1;
private int imagesY = 1;
private boolean enabled = true;
private ColorRGBA startColor = new ColorRGBA(0.4f, 0.4f, 0.4f, 0.5f);
private ColorRGBA endColor = new ColorRGBA(0.1f, 0.1f, 0.1f, 0.0f);
private float startSize = 0.2f;
@ -285,6 +286,23 @@ public class ParticleEmitter extends Geometry {
return meshType;
}
public void setMeshType(ParticleMesh.Type meshType) {
this.meshType = meshType;
switch (meshType) {
case Point:
particleMesh = new ParticlePointMesh();
this.setMesh(particleMesh);
break;
case Triangle:
particleMesh = new ParticleTriMesh();
this.setMesh(particleMesh);
break;
default:
throw new IllegalStateException("Unrecognized particle type: " + meshType);
}
this.setNumParticles(particles.length);
}
/**
* Returns true if particles should spawn in world space.
*

Loading…
Cancel
Save