本文整理汇总了Java中com.jme3.effect.ParticleEmitter.emitAllParticles方法的典型用法代码示例。如果您正苦于以下问题:Java ParticleEmitter.emitAllParticles方法的具体用法?Java ParticleEmitter.emitAllParticles怎么用?Java ParticleEmitter.emitAllParticles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jme3.effect.ParticleEmitter
的用法示例。
在下文中一共展示了ParticleEmitter.emitAllParticles方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: simpleInitApp
import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
@Override
public void simpleInitApp() {
ParticleEmitter emit = new ParticleEmitter("Emitter", Type.Point, 10000);
emit.setShape(new EmitterBoxShape(new Vector3f(-1.8f, -1.8f, -1.8f),
new Vector3f(1.8f, 1.8f, 1.8f)));
emit.setGravity(0, 0, 0);
emit.setLowLife(60);
emit.setHighLife(60);
emit.setInitialVelocity(new Vector3f(0, 0, 0));
emit.setImagesX(15);
emit.setStartSize(0.05f);
emit.setEndSize(0.05f);
emit.setStartColor(ColorRGBA.White);
emit.setEndColor(ColorRGBA.White);
emit.setSelectRandomImage(true);
emit.emitAllParticles();
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
mat.setBoolean("PointSprite", true);
mat.setTexture("Texture", assetManager.loadTexture("Effects/Smoke/Smoke.png"));
emit.setMaterial(mat);
rootNode.attachChild(emit);
}
示例2: onEntityUpdated
import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
@Override
protected void onEntityUpdated(Entity e) {
ParticleCaster caster = e.get(ParticleCaster.class);
PlanarStance stance = e.get(PlanarStance.class);
Point3D pos = stance.getCoord().get3D(stance.getElevation());
Point3D velocity = Point2D.ORIGIN.getTranslation(stance.getOrientation().getValue(), caster.getInitialSpeed()).get3D(0);
ParticleEmitter pe = SpatialPool.emitters.get(e.getId());
if (pe != null) {
pe.setLocalTranslation(TranslateUtil.toVector3f(pos));
pe.getParticleInfluencer().setInitialVelocity(TranslateUtil.toVector3f(velocity));
// the all at once behavior is launched here, because the emitter needs to be well placed before that call.
if (caster.isAllAtOnce()) {
pe.emitAllParticles();
}
}
}
示例3: exec
import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
@Override
public void exec(World world, int reason) {
if (reason != RemovalReasons.EXPIRED) {
return;
}
Vector3f worldTranslation = cloud.getParent().getWorldTranslation();
ParticleEmitter wave = createShockwave();
world.getWorldRoot().attachChild(wave);
wave.setLocalTranslation(worldTranslation);
wave.emitAllParticles();
wave.addControl(new CTimedExistence(4f));
AudioNode sound = new AudioNode(Globals.assets,
"Effects/Sound/IntoTheShadows.wav");
sound.setPositional(true);
sound.setReverbEnabled(false);
sound.setVolume(1f);
sound.setLocalTranslation(worldTranslation);
sound.play();
sound.addControl(new CTimedExistence(4f));
}
示例4: saGoHome
import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
private void saGoHome(Vector3f position) {
sa.setIsWon(true);
ParticleEmitter dirt = new ParticleEmitter("Debris", ParticleMesh.Type.Triangle, 200);
Material debris_mat = new Material(assetManager,
"Common/MatDefs/Misc/Particle.j3md");
debris_mat.setTexture("Texture", assetManager.loadTexture(
"Effects/Explosion/shockwave.png"));
dirt.setMaterial(debris_mat);
rootNode.attachChild(dirt);
dirt.setParticlesPerSec(0);
dirt.setImagesX(1);
dirt.setImagesY(1); // 3x3 texture animation
dirt.setStartSize(1f);
dirt.setEndSize(5f);
dirt.setLowLife(0.4f);
dirt.setHighLife(0.5f);
dirt.setLocalTranslation(position);
dirt.getParticleInfluencer().setInitialVelocity(new Vector3f(10f, 5f, 0));
dirt.getParticleInfluencer().setVelocityVariation(1f);
dirt.setGravity(0, -5f, 0);
dirt.emitAllParticles();
}
示例5: explode
import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
private void explode() {
dirt = new ParticleEmitter("Debris", ParticleMesh.Type.Triangle, 200);
Material debris_mat = new Material(assetManager,
"Common/MatDefs/Misc/Particle.j3md");
debris_mat.setTexture("Texture", assetManager.loadTexture(
"Effects/Explosion/smoketrail.png"));
dirt.setMaterial(debris_mat);
rootNode.attachChild(dirt);
dirt.setParticlesPerSec(0);
dirt.setImagesX(1);
dirt.setImagesY(3); // 3x3 texture animation
dirt.setStartSize(1f);
dirt.setEndSize(5f);
dirt.setLowLife(0.4f);
dirt.setHighLife(0.5f);
dirt.setLocalTranslation(position);
dirt.getParticleInfluencer().setInitialVelocity(new Vector3f(10f, 5f, 0));
dirt.getParticleInfluencer().setVelocityVariation(1f);
dirt.setGravity(0, -5f, 0);
dirt.emitAllParticles();
}
示例6: createSmallExplosion
import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
private void createSmallExplosion(Node root, Vector3f location) {
ParticleEmitter fire = new ParticleEmitter("shotgun-explosion",
ParticleMesh.Type.Triangle, 20);
Material material = new Material(assetManager,
"Common/MatDefs/Misc/Particle.j3md");
material.setTexture("Texture",
assetManager.loadTexture("Effects/flame.png"));
fire.setMaterial(material);
fire.setImagesX(2);
fire.setImagesY(2);
fire.setSelectRandomImage(true);
fire.setGravity(Vector3f.ZERO);
fire.setRandomAngle(true);
fire.setStartColor(new ColorRGBA(0.95f, 0.150f, 0.0f, 0.40f));
fire.setEndColor(new ColorRGBA(1.0f, 1.0f, 0.0f, 0.0f));
fire.setLowLife(0.1f);
fire.setHighLife(0.3f);
fire.setNumParticles(100);
fire.setStartSize(0.50f);
fire.setEndSize(1.0f);
fire.getParticleInfluencer()
.setInitialVelocity(Vector3f.UNIT_X.mult(1.0f));
fire.getParticleInfluencer().setVelocityVariation(6f);
fire.setShape(new EmitterSphereShape(Vector3f.ZERO, 0.2f));
fire.setParticlesPerSec(0f);
root.attachChild(fire);
fire.setLocalTranslation(location);
fire.emitAllParticles();
fire.addControl(new CTimedExistence(1f));
}
示例7: simpleInitApp
import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
@Override
public void simpleInitApp() {
final ParticleEmitter emit = new ParticleEmitter("Emitter", Type.Point, 10000);
emit.setShape(new EmitterBoxShape(new Vector3f(-1.8f, -1.8f, -1.8f),
new Vector3f(1.8f, 1.8f, 1.8f)));
emit.setGravity(0, 0, 0);
emit.setLowLife(60);
emit.setHighLife(60);
emit.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 0, 0));
emit.setImagesX(15);
emit.setStartSize(0.05f);
emit.setEndSize(0.05f);
emit.setStartColor(ColorRGBA.White);
emit.setEndColor(ColorRGBA.White);
emit.setSelectRandomImage(true);
emit.emitAllParticles();
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
mat.setBoolean("PointSprite", true);
mat.setTexture("Texture", assetManager.loadTexture("Effects/Smoke/Smoke.png"));
emit.setMaterial(mat);
rootNode.attachChild(emit);
inputManager.addListener(new ActionListener() {
public void onAction(String name, boolean isPressed, float tpf) {
if ("setNum".equals(name) && isPressed) {
emit.setNumParticles(5000);
emit.emitAllParticles();
}
}
}, "setNum");
inputManager.addMapping("setNum", new KeyTrigger(KeyInput.KEY_SPACE));
}
示例8: createSmokePuff
import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
private void createSmokePuff(Node worldRoot, Vector3f worldTranslation) {
ParticleEmitter smokePuff = new ParticleEmitter("smoke-puff",
ParticleMesh.Type.Triangle, 20);
Material materialGray = new Material(Globals.assets,
"Common/MatDefs/Misc/Particle.j3md");
materialGray.setTexture("Texture",
Globals.assets.loadTexture("Effects/flame.png"));
smokePuff.setMaterial(materialGray);
smokePuff.setImagesX(2);
smokePuff.setImagesY(2);
smokePuff.setSelectRandomImage(true);
smokePuff.setStartColor(new ColorRGBA(0.5f, 0.5f, 0.5f, 0.2f));
smokePuff.setStartColor(new ColorRGBA(0.5f, 0.5f, 0.5f, 0.1f));
smokePuff.getParticleInfluencer()
.setInitialVelocity(Vector3f.UNIT_X.mult(5.0f));
smokePuff.getParticleInfluencer().setVelocityVariation(1f);
smokePuff.setStartSize(2.0f);
smokePuff.setEndSize(6.0f);
smokePuff.setGravity(Vector3f.ZERO);
smokePuff.setLowLife(0.75f);
smokePuff.setHighLife(1f);
smokePuff.setParticlesPerSec(0);
smokePuff.setRandomAngle(true);
smokePuff.setShape(new EmitterSphereShape(Vector3f.ZERO, 4.0f));
worldRoot.attachChild(smokePuff);
smokePuff.setLocalTranslation(worldTranslation);
smokePuff.emitAllParticles();
}
示例9: createSmokePuff
import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
private void createSmokePuff(Node worldRoot, Vector3f worldTranslation) {
ParticleEmitter smokePuff = new ParticleEmitter("smoke-puff",
ParticleMesh.Type.Triangle, 20);
Material materialGray = new Material(assets,
"Common/MatDefs/Misc/Particle.j3md");
materialGray.setTexture("Texture",
assets.loadTexture("Effects/flame.png"));
smokePuff.setMaterial(materialGray);
smokePuff.setImagesX(2);
smokePuff.setImagesY(2);
smokePuff.setSelectRandomImage(true);
smokePuff.setStartColor(new ColorRGBA(0.5f, 0.5f, 0.5f, 0.2f));
smokePuff.setStartColor(new ColorRGBA(0.5f, 0.5f, 0.5f, 0.1f));
smokePuff.getParticleInfluencer()
.setInitialVelocity(Vector3f.UNIT_X.mult(5.0f));
smokePuff.getParticleInfluencer().setVelocityVariation(1f);
smokePuff.setStartSize(2f);
smokePuff.setEndSize(6f);
smokePuff.setGravity(Vector3f.ZERO);
smokePuff.setLowLife(0.75f);
smokePuff.setHighLife(1f);
smokePuff.setParticlesPerSec(0);
smokePuff.setRandomAngle(true);
smokePuff.setShape(new EmitterSphereShape(Vector3f.ZERO, 4f));
worldRoot.attachChild(smokePuff);
smokePuff.setLocalTranslation(worldTranslation);
smokePuff.emitAllParticles();
}
示例10: createSmokePuff
import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
private void createSmokePuff(Node node) {
ParticleEmitter smokePuff = new ParticleEmitter("smoke-puff",
ParticleMesh.Type.Triangle, 20);
Material material = new Material(assets,
"Common/MatDefs/Misc/Particle.j3md");
material.setTexture("Texture",
assets.loadTexture("Effects/flame_alpha.png"));
material.getAdditionalRenderState()
.setBlendMode(RenderState.BlendMode.Alpha);
smokePuff.setMaterial(material);
smokePuff.setImagesX(2);
smokePuff.setImagesY(2);
smokePuff.setSelectRandomImage(true);
smokePuff.setStartColor(new ColorRGBA(0.3f, 0.3f, 0.3f, 0.3f));
smokePuff.setEndColor(new ColorRGBA(0.3f, 0.3f, 0.3f, 0.1f));
smokePuff.getParticleInfluencer()
.setInitialVelocity(Vector3f.UNIT_X.mult(5.0f));
smokePuff.getParticleInfluencer().setVelocityVariation(1f);
smokePuff.setStartSize(8f);
smokePuff.setEndSize(30f);
smokePuff.setGravity(Vector3f.ZERO);
smokePuff.setLowLife(1.75f);
smokePuff.setHighLife(6f);
smokePuff.setParticlesPerSec(0);
smokePuff.setRandomAngle(true);
smokePuff.setShape(new EmitterSphereShape(Vector3f.ZERO, 4.0f));
node.attachChild(smokePuff);
smokePuff.emitAllParticles();
}
示例11: exec
import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
@Override
public void exec(World world, int reason) {
Vector3f worldTranslation = fire.getParent().getLocalTranslation();
Node node = new Node("rocket-explosion");
world.getWorldRoot().attachChild(node);
node.setLocalTranslation(worldTranslation);
leaveSmokeTrail(node);
createSmokePuff(node);
fire.removeFromParent();
node.attachChild(fire);
node.attachChild(sound);
fire.setLocalTranslation(Vector3f.ZERO);
node.addControl(new CTimedExistence(6f));
fire.setStartColor(new ColorRGBA(0.95f, 0.150f, 0.0f, 0.40f));
fire.setEndColor(new ColorRGBA(1.0f, 1.0f, 0.0f, 0.0f));
fire.setLowLife(0.4f);
fire.setHighLife(0.5f);
fire.setNumParticles(120);
fire.setStartSize(7.50f);
fire.setEndSize(25f);
fire.getParticleInfluencer()
.setInitialVelocity(Vector3f.UNIT_X.mult(45.0f));
fire.getParticleInfluencer().setVelocityVariation(1f);
fire.emitAllParticles();
fire.setParticlesPerSec(0.0f);
ParticleEmitter wave = createShockwave();
world.getWorldRoot().attachChild(wave);
wave.setLocalTranslation(worldTranslation);
wave.emitAllParticles();
wave.addControl(new CTimedExistence(4f));
sound.setVolume(5f);
sound.play();
}
示例12: execute
import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
@Override
public EffectHandle execute(Node root, Vector3f loc, String p) {
Node weapon = (Node) root.getChild("weapon");
float antiScale = 1f / weapon.getWorldScale().x;
ParticleEmitter e = createEmitter();
weapon.attachChild(e);
e.setLocalTranslation(0f, 0.7f * antiScale, 4f * antiScale);
e.emitAllParticles();
e.addControl(new CTimedExistence(time));
return null;
}
示例13: execute
import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
@Override
public EffectHandle execute(Node root, Vector3f loc, String p) {
randomSound.execute(root, loc, p);
CCharacterPhysics cPhysics = root
.getControl(CCharacterPhysics.class);
cPhysics.getCapsuleShape().getHeight();
SpatialDistancePair hit = checkHit(root, cPhysics);
if (hit == null || hit.distance > Rend.RANGE) {
return null;
}
Vector3f dir = hit.spatial.getLocalTranslation()
.subtract(root.getLocalTranslation()).normalizeLocal();
Ray ray = new Ray(root.getLocalTranslation().add(0f,
cPhysics.getCapsuleShape().getHeight() * 0.9f, 0f), dir);
CollisionResults collisions = new CollisionResults();
hit.spatial.collideWith(ray, collisions);
Vector3f hitLoc = collisions.getClosestCollision().getContactPoint();
ParticleEmitter e = createBloodEmitter();
((Node) hit.spatial).attachChild(e);
hit.spatial.worldToLocal(hitLoc, e.getLocalTranslation());
e.emitAllParticles();
return null;
}
示例14: execute
import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
@Override
public EffectHandle execute(Node root, Vector3f location, String p) {
SimpleSoundEffect earthQuake =
new SimpleSoundEffect("Effects/Sound/EarthQuake.wav");
earthQuake.setVolume(1.5f);
earthQuake.execute(root, location, null);
ParticleEmitter emitter = createParticleEffect();
root.attachChild(emitter);
emitter.setLocalTranslation(location);
emitter.emitAllParticles();
emitter.addControl(new CTimedExistence(14f));
return null;
}
示例15: execute
import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
@Override
public EffectHandle execute(Node root, Vector3f location, String p) {
ParticleEmitter fire = createFire();
ParticleEmitter smoke = createSmokePuff();
ParticleEmitter wave = createShockwave();
Node explosion = new Node("explosion");
root.attachChild(explosion);
explosion.setLocalTranslation(location);
explosion.move(0f, 3f, 0f);
AudioNode sound = new AudioNode(Globals.assets,
"Effects/Sound/FireballExplosion.wav");
sound.setPositional(true);
sound.setReverbEnabled(false);
sound.setVolume(5f);
explosion.attachChild(fire);
explosion.attachChild(smoke);
explosion.attachChild(wave);
explosion.attachChild(sound);
explosion.addControl(new CTimedExistence(5f));
fire.emitAllParticles();
smoke.emitAllParticles();
wave.emitAllParticles();
fire.setParticlesPerSec(0);
smoke.setParticlesPerSec(0);
sound.play();
return null;
}