Search in sources :

Example 31 with ColorRGBA

use of com.jme3.math.ColorRGBA 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 32 with ColorRGBA

use of com.jme3.math.ColorRGBA 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 33 with ColorRGBA

use of com.jme3.math.ColorRGBA 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 34 with ColorRGBA

use of com.jme3.math.ColorRGBA 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 35 with ColorRGBA

use of com.jme3.math.ColorRGBA in project jmonkeyengine by jMonkeyEngine.

the class TestSoftParticles method createParticles.

private void createParticles() {
    Material material = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
    material.setTexture("Texture", assetManager.loadTexture("Effects/Explosion/flame.png"));
    // 
    material.setFloat("Softness", 3f);
    //Fire
    ParticleEmitter fire = new ParticleEmitter("Fire", ParticleMesh.Type.Triangle, 30);
    fire.setMaterial(material);
    fire.setShape(new EmitterSphereShape(Vector3f.ZERO, 0.1f));
    fire.setImagesX(2);
    // 2x2 texture animation
    fire.setImagesY(2);
    // red
    fire.setEndColor(new ColorRGBA(1f, 0f, 0f, 1f));
    // yellow
    fire.setStartColor(new ColorRGBA(1f, 1f, 0f, 0.5f));
    fire.setStartSize(0.6f);
    fire.setEndSize(0.01f);
    fire.setGravity(0, -0.3f, 0);
    fire.setLowLife(0.5f);
    fire.setHighLife(3f);
    fire.setLocalTranslation(0, 0.2f, 0);
    particleNode.attachChild(fire);
    ParticleEmitter smoke = new ParticleEmitter("Smoke", ParticleMesh.Type.Triangle, 30);
    smoke.setMaterial(material);
    smoke.setShape(new EmitterSphereShape(Vector3f.ZERO, 5));
    smoke.setImagesX(1);
    // 2x2 texture animation
    smoke.setImagesY(1);
    // dark gray
    smoke.setStartColor(new ColorRGBA(0.1f, 0.1f, 0.1f, 1f));
    // gray      
    smoke.setEndColor(new ColorRGBA(0.5f, 0.5f, 0.5f, 0.3f));
    smoke.setStartSize(3f);
    smoke.setEndSize(5f);
    smoke.setGravity(0, -0.001f, 0);
    smoke.setLowLife(100f);
    smoke.setHighLife(100f);
    smoke.setLocalTranslation(0, 0.1f, 0);
    smoke.emitAllParticles();
    particleNode.attachChild(smoke);
}
Also used : ParticleEmitter(com.jme3.effect.ParticleEmitter) ColorRGBA(com.jme3.math.ColorRGBA) EmitterSphereShape(com.jme3.effect.shapes.EmitterSphereShape) Material(com.jme3.material.Material)

Aggregations

ColorRGBA (com.jme3.math.ColorRGBA)98 Vector3f (com.jme3.math.Vector3f)65 Material (com.jme3.material.Material)44 DirectionalLight (com.jme3.light.DirectionalLight)42 Geometry (com.jme3.scene.Geometry)23 ParticleEmitter (com.jme3.effect.ParticleEmitter)14 PointLight (com.jme3.light.PointLight)14 Quaternion (com.jme3.math.Quaternion)14 Spatial (com.jme3.scene.Spatial)14 AmbientLight (com.jme3.light.AmbientLight)13 Sphere (com.jme3.scene.shape.Sphere)12 Node (com.jme3.scene.Node)11 KeyTrigger (com.jme3.input.controls.KeyTrigger)10 FilterPostProcessor (com.jme3.post.FilterPostProcessor)10 Texture (com.jme3.texture.Texture)9 BulletAppState (com.jme3.bullet.BulletAppState)8 RigidBodyControl (com.jme3.bullet.control.RigidBodyControl)7 Quad (com.jme3.scene.shape.Quad)7 TextureCubeMap (com.jme3.texture.TextureCubeMap)7 EmitterSphereShape (com.jme3.effect.shapes.EmitterSphereShape)6