Search in sources :

Example 81 with AssetManager

use of com.jme3.asset.AssetManager in project jmonkeyengine by jMonkeyEngine.

the class TestExplosionEffect method createSmokeTrail.

private void createSmokeTrail() {
    smoketrail = new ParticleEmitter("SmokeTrail", Type.Triangle, 22 * COUNT_FACTOR);
    smoketrail.setStartColor(new ColorRGBA(1f, 0.8f, 0.36f, (float) (1.0f / COUNT_FACTOR_F)));
    smoketrail.setEndColor(new ColorRGBA(1f, 0.8f, 0.36f, 0f));
    smoketrail.setStartSize(.2f);
    smoketrail.setEndSize(1f);
    //        smoketrail.setShape(new EmitterSphereShape(Vector3f.ZERO, 1f));
    smoketrail.setFacingVelocity(true);
    smoketrail.setParticlesPerSec(0);
    smoketrail.setGravity(0, 1, 0);
    smoketrail.setLowLife(.4f);
    smoketrail.setHighLife(.5f);
    smoketrail.setInitialVelocity(new Vector3f(0, 12, 0));
    smoketrail.setVelocityVariation(1);
    smoketrail.setImagesX(1);
    smoketrail.setImagesY(3);
    Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
    mat.setTexture("Texture", assetManager.loadTexture("Effects/Explosion/smoketrail.png"));
    smoketrail.setMaterial(mat);
    explosionEffect.attachChild(smoketrail);
}
Also used : ParticleEmitter(com.jme3.effect.ParticleEmitter) ColorRGBA(com.jme3.math.ColorRGBA) Vector3f(com.jme3.math.Vector3f) Material(com.jme3.material.Material)

Example 82 with AssetManager

use of com.jme3.asset.AssetManager in project jmonkeyengine by jMonkeyEngine.

the class TestExplosionEffect method createDebris.

private void createDebris() {
    debris = new ParticleEmitter("Debris", Type.Triangle, 15 * COUNT_FACTOR);
    debris.setSelectRandomImage(true);
    debris.setRandomAngle(true);
    debris.setRotateSpeed(FastMath.TWO_PI * 4);
    debris.setStartColor(new ColorRGBA(1f, 0.59f, 0.28f, (float) (1.0f / COUNT_FACTOR_F)));
    debris.setEndColor(new ColorRGBA(.5f, 0.5f, 0.5f, 0f));
    debris.setStartSize(.2f);
    debris.setEndSize(.2f);
    //        debris.setShape(new EmitterSphereShape(Vector3f.ZERO, .05f));
    debris.setParticlesPerSec(0);
    debris.setGravity(0, 12f, 0);
    debris.setLowLife(1.4f);
    debris.setHighLife(1.5f);
    debris.setInitialVelocity(new Vector3f(0, 15, 0));
    debris.setVelocityVariation(.60f);
    debris.setImagesX(3);
    debris.setImagesY(3);
    Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
    mat.setTexture("Texture", assetManager.loadTexture("Effects/Explosion/Debris.png"));
    debris.setMaterial(mat);
    explosionEffect.attachChild(debris);
}
Also used : ParticleEmitter(com.jme3.effect.ParticleEmitter) ColorRGBA(com.jme3.math.ColorRGBA) Vector3f(com.jme3.math.Vector3f) Material(com.jme3.material.Material)

Example 83 with AssetManager

use of com.jme3.asset.AssetManager in project jmonkeyengine by jMonkeyEngine.

the class TestExplosionEffect method createRoundSpark.

private void createRoundSpark() {
    roundspark = new ParticleEmitter("RoundSpark", EMITTER_TYPE, 20 * COUNT_FACTOR);
    roundspark.setStartColor(new ColorRGBA(1f, 0.29f, 0.34f, (float) (1.0 / COUNT_FACTOR_F)));
    roundspark.setEndColor(new ColorRGBA(0, 0, 0, (float) (0.5f / COUNT_FACTOR_F)));
    roundspark.setStartSize(1.2f);
    roundspark.setEndSize(1.8f);
    roundspark.setShape(new EmitterSphereShape(Vector3f.ZERO, 2f));
    roundspark.setParticlesPerSec(0);
    roundspark.setGravity(0, -.5f, 0);
    roundspark.setLowLife(1.8f);
    roundspark.setHighLife(2f);
    roundspark.setInitialVelocity(new Vector3f(0, 3, 0));
    roundspark.setVelocityVariation(.5f);
    roundspark.setImagesX(1);
    roundspark.setImagesY(1);
    Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
    mat.setTexture("Texture", assetManager.loadTexture("Effects/Explosion/roundspark.png"));
    mat.setBoolean("PointSprite", POINT_SPRITE);
    roundspark.setMaterial(mat);
    explosionEffect.attachChild(roundspark);
}
Also used : ParticleEmitter(com.jme3.effect.ParticleEmitter) ColorRGBA(com.jme3.math.ColorRGBA) Vector3f(com.jme3.math.Vector3f) EmitterSphereShape(com.jme3.effect.shapes.EmitterSphereShape) Material(com.jme3.material.Material)

Example 84 with AssetManager

use of com.jme3.asset.AssetManager in project jmonkeyengine by jMonkeyEngine.

the class TestExplosionEffect method createSpark.

private void createSpark() {
    spark = new ParticleEmitter("Spark", Type.Triangle, 30 * COUNT_FACTOR);
    spark.setStartColor(new ColorRGBA(1f, 0.8f, 0.36f, (float) (1.0f / COUNT_FACTOR_F)));
    spark.setEndColor(new ColorRGBA(1f, 0.8f, 0.36f, 0f));
    spark.setStartSize(.5f);
    spark.setEndSize(.5f);
    spark.setFacingVelocity(true);
    spark.setParticlesPerSec(0);
    spark.setGravity(0, 5, 0);
    spark.setLowLife(1.1f);
    spark.setHighLife(1.5f);
    spark.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 20, 0));
    spark.getParticleInfluencer().setVelocityVariation(1);
    spark.setImagesX(1);
    spark.setImagesY(1);
    Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
    mat.setTexture("Texture", assetManager.loadTexture("Effects/Explosion/spark.png"));
    spark.setMaterial(mat);
    explosionEffect.attachChild(spark);
}
Also used : ParticleEmitter(com.jme3.effect.ParticleEmitter) ColorRGBA(com.jme3.math.ColorRGBA) Vector3f(com.jme3.math.Vector3f) Material(com.jme3.material.Material)

Example 85 with AssetManager

use of com.jme3.asset.AssetManager in project jmonkeyengine by jMonkeyEngine.

the class TestMovingParticle method simpleInitApp.

@Override
public void simpleInitApp() {
    emit = new ParticleEmitter("Emitter", Type.Triangle, 300);
    emit.setGravity(0, 0, 0);
    emit.setVelocityVariation(1);
    emit.setLowLife(1);
    emit.setHighLife(1);
    emit.setInitialVelocity(new Vector3f(0, .5f, 0));
    emit.setImagesX(15);
    Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
    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(1000);
            }
        }
    }, "setNum");
    inputManager.addMapping("setNum", new KeyTrigger(KeyInput.KEY_SPACE));
}
Also used : ParticleEmitter(com.jme3.effect.ParticleEmitter) ActionListener(com.jme3.input.controls.ActionListener) Vector3f(com.jme3.math.Vector3f) KeyTrigger(com.jme3.input.controls.KeyTrigger) Material(com.jme3.material.Material)

Aggregations

Material (com.jme3.material.Material)213 Geometry (com.jme3.scene.Geometry)138 Vector3f (com.jme3.math.Vector3f)137 Box (com.jme3.scene.shape.Box)73 Texture (com.jme3.texture.Texture)73 DirectionalLight (com.jme3.light.DirectionalLight)66 Node (com.jme3.scene.Node)52 Sphere (com.jme3.scene.shape.Sphere)47 Quaternion (com.jme3.math.Quaternion)46 Spatial (com.jme3.scene.Spatial)43 FilterPostProcessor (com.jme3.post.FilterPostProcessor)38 ColorRGBA (com.jme3.math.ColorRGBA)37 KeyTrigger (com.jme3.input.controls.KeyTrigger)31 RigidBodyControl (com.jme3.bullet.control.RigidBodyControl)27 BulletAppState (com.jme3.bullet.BulletAppState)26 Quad (com.jme3.scene.shape.Quad)23 TextureKey (com.jme3.asset.TextureKey)22 ActionListener (com.jme3.input.controls.ActionListener)21 AmbientLight (com.jme3.light.AmbientLight)20 Texture2D (com.jme3.texture.Texture2D)20