Search in sources :

Example 21 with ParticleController

use of com.badlogic.gdx.graphics.g3d.particles.ParticleController in project libgdx by libgdx.

the class EffectPanel method createDefaultBillboardController.

private ParticleController createDefaultBillboardController() {
    //Emission
    RegularEmitter emitter = new RegularEmitter();
    emitter.getDuration().setLow(3000);
    emitter.getEmission().setHigh(250);
    emitter.getLife().setHigh(500, 1000);
    emitter.getLife().setTimeline(new float[] { 0, 0.66f, 1 });
    emitter.getLife().setScaling(new float[] { 1, 1, 0.3f });
    emitter.setMaxParticleCount(200);
    //Spawn
    PointSpawnShapeValue pointSpawnShapeValue = new PointSpawnShapeValue();
    SpawnInfluencer spawnSource = new SpawnInfluencer(pointSpawnShapeValue);
    //Color
    ColorInfluencer.Single colorInfluencer = new ColorInfluencer.Single();
    colorInfluencer.colorValue.setColors(new float[] { 1, 0.12156863f, 0.047058824f, 0, 0, 0 });
    colorInfluencer.colorValue.setTimeline(new float[] { 0, 1 });
    colorInfluencer.alphaValue.setHigh(1);
    colorInfluencer.alphaValue.setTimeline(new float[] { 0, 0.5f, 0.8f, 1 });
    colorInfluencer.alphaValue.setScaling(new float[] { 0, 0.15f, 0.5f, 0 });
    //Velocity
    DynamicsInfluencer velocityInfluencer = new DynamicsInfluencer();
    //Directional
    DynamicsModifier.PolarAcceleration velocityValue = new DynamicsModifier.PolarAcceleration();
    velocityValue.phiValue.setHigh(-35, 35);
    velocityValue.phiValue.setActive(true);
    velocityValue.phiValue.setTimeline(new float[] { 0, 0.5f, 1 });
    velocityValue.phiValue.setScaling(new float[] { 1, 0, 0 });
    velocityValue.thetaValue.setHigh(0, 360);
    velocityValue.strengthValue.setHigh(5, 10);
    velocityInfluencer.velocities.add(velocityValue);
    return new ParticleController("Billboard Controller", emitter, new BillboardRenderer(editor.getBillboardBatch()), new RegionInfluencer.Single(editor.getTexture()), spawnSource, colorInfluencer, velocityInfluencer);
}
Also used : DynamicsInfluencer(com.badlogic.gdx.graphics.g3d.particles.influencers.DynamicsInfluencer) BillboardRenderer(com.badlogic.gdx.graphics.g3d.particles.renderers.BillboardRenderer) RegularEmitter(com.badlogic.gdx.graphics.g3d.particles.emitters.RegularEmitter) DynamicsModifier(com.badlogic.gdx.graphics.g3d.particles.influencers.DynamicsModifier) PointSpawnShapeValue(com.badlogic.gdx.graphics.g3d.particles.values.PointSpawnShapeValue) ParticleController(com.badlogic.gdx.graphics.g3d.particles.ParticleController) ColorInfluencer(com.badlogic.gdx.graphics.g3d.particles.influencers.ColorInfluencer) RegionInfluencer(com.badlogic.gdx.graphics.g3d.particles.influencers.RegionInfluencer) SpawnInfluencer(com.badlogic.gdx.graphics.g3d.particles.influencers.SpawnInfluencer)

Example 22 with ParticleController

use of com.badlogic.gdx.graphics.g3d.particles.ParticleController in project libgdx by libgdx.

the class EffectPanel method createDefaultModelInstanceController.

private ParticleController createDefaultModelInstanceController() {
    //Emission
    RegularEmitter emitter = new RegularEmitter();
    emitter.getDuration().setLow(3000);
    emitter.getEmission().setHigh(80);
    emitter.getLife().setHigh(500, 1000);
    emitter.getLife().setTimeline(new float[] { 0, 0.66f, 1 });
    emitter.getLife().setScaling(new float[] { 1, 1, 0.3f });
    emitter.setMaxParticleCount(100);
    //Color
    ColorInfluencer.Random colorInfluencer = new ColorInfluencer.Random();
    //Spawn
    EllipseSpawnShapeValue spawnShapeValue = new EllipseSpawnShapeValue();
    spawnShapeValue.setDimensions(1, 1, 1);
    SpawnInfluencer spawnSource = new SpawnInfluencer(spawnShapeValue);
    //Velocity
    DynamicsInfluencer velocityInfluencer = new DynamicsInfluencer();
    //Directional
    DynamicsModifier.CentripetalAcceleration velocityValue = new DynamicsModifier.CentripetalAcceleration();
    velocityValue.strengthValue.setHigh(5, 11);
    velocityValue.strengthValue.setActive(true);
    //velocityValue.setActive(true);
    velocityInfluencer.velocities.add(velocityValue);
    return new ParticleController("ModelInstance Controller", emitter, new ModelInstanceRenderer(editor.getModelInstanceParticleBatch()), new ModelInfluencer.Single((Model) editor.assetManager.get(FlameMain.DEFAULT_MODEL_PARTICLE)), spawnSource, colorInfluencer, velocityInfluencer);
}
Also used : DynamicsInfluencer(com.badlogic.gdx.graphics.g3d.particles.influencers.DynamicsInfluencer) ModelInfluencer(com.badlogic.gdx.graphics.g3d.particles.influencers.ModelInfluencer) RegularEmitter(com.badlogic.gdx.graphics.g3d.particles.emitters.RegularEmitter) ModelInstanceRenderer(com.badlogic.gdx.graphics.g3d.particles.renderers.ModelInstanceRenderer) DynamicsModifier(com.badlogic.gdx.graphics.g3d.particles.influencers.DynamicsModifier) EllipseSpawnShapeValue(com.badlogic.gdx.graphics.g3d.particles.values.EllipseSpawnShapeValue) ParticleController(com.badlogic.gdx.graphics.g3d.particles.ParticleController) ColorInfluencer(com.badlogic.gdx.graphics.g3d.particles.influencers.ColorInfluencer) ListSelectionModel(javax.swing.ListSelectionModel) DefaultComboBoxModel(javax.swing.DefaultComboBoxModel) DefaultTableModel(javax.swing.table.DefaultTableModel) Model(com.badlogic.gdx.graphics.g3d.Model) SpawnInfluencer(com.badlogic.gdx.graphics.g3d.particles.influencers.SpawnInfluencer)

Example 23 with ParticleController

use of com.badlogic.gdx.graphics.g3d.particles.ParticleController in project libgdx by libgdx.

the class EffectPanel method createDefaultTemplateController.

public ParticleController createDefaultTemplateController() {
    //Emission
    RegularEmitter emitter = new RegularEmitter();
    emitter.getDuration().setLow(3000);
    emitter.getEmission().setHigh(90);
    emitter.getLife().setHigh(1000);
    emitter.getLife().setTimeline(new float[] { 0, 0.66f, 1 });
    emitter.getLife().setScaling(new float[] { 1, 1, 0.3f });
    emitter.setMaxParticleCount(100);
    //Spawn
    PointSpawnShapeValue pointSpawnShapeValue = new PointSpawnShapeValue();
    pointSpawnShapeValue.xOffsetValue.setLow(0, 1f);
    pointSpawnShapeValue.xOffsetValue.setActive(true);
    pointSpawnShapeValue.yOffsetValue.setLow(0, 1f);
    pointSpawnShapeValue.yOffsetValue.setActive(true);
    pointSpawnShapeValue.zOffsetValue.setLow(0, 1f);
    pointSpawnShapeValue.zOffsetValue.setActive(true);
    SpawnInfluencer spawnSource = new SpawnInfluencer(pointSpawnShapeValue);
    ScaleInfluencer scaleInfluencer = new ScaleInfluencer();
    scaleInfluencer.value.setHigh(1f);
    //Color
    ColorInfluencer.Single colorInfluencer = new ColorInfluencer.Single();
    colorInfluencer.colorValue.setColors(new float[] { 1, 0.12156863f, 0.047058824f, 0, 0, 0 });
    colorInfluencer.colorValue.setTimeline(new float[] { 0, 1 });
    colorInfluencer.alphaValue.setHigh(1);
    colorInfluencer.alphaValue.setTimeline(new float[] { 0, 0.5f, 0.8f, 1 });
    colorInfluencer.alphaValue.setScaling(new float[] { 0, 0.15f, 0.5f, 0 });
    return new ParticleController("Billboard Controller", emitter, new BillboardRenderer(editor.getBillboardBatch()), new RegionInfluencer.Single(editor.getTexture()), spawnSource, scaleInfluencer, colorInfluencer);
}
Also used : BillboardRenderer(com.badlogic.gdx.graphics.g3d.particles.renderers.BillboardRenderer) ScaleInfluencer(com.badlogic.gdx.graphics.g3d.particles.influencers.ScaleInfluencer) RegularEmitter(com.badlogic.gdx.graphics.g3d.particles.emitters.RegularEmitter) ParticleController(com.badlogic.gdx.graphics.g3d.particles.ParticleController) ColorInfluencer(com.badlogic.gdx.graphics.g3d.particles.influencers.ColorInfluencer) RegionInfluencer(com.badlogic.gdx.graphics.g3d.particles.influencers.RegionInfluencer) SpawnInfluencer(com.badlogic.gdx.graphics.g3d.particles.influencers.SpawnInfluencer) PointSpawnShapeValue(com.badlogic.gdx.graphics.g3d.particles.values.PointSpawnShapeValue)

Example 24 with ParticleController

use of com.badlogic.gdx.graphics.g3d.particles.ParticleController in project libgdx by libgdx.

the class EffectPanel method importEffect.

protected void importEffect() {
    File file = editor.showFileLoadDialog();
    if (file != null) {
        ParticleEffect effect;
        if ((effect = editor.openEffect(file, false)) != null) {
            for (ParticleController controller : effect.getControllers()) addEmitter(controller, false);
            editIndex = 0;
            emitterTable.getSelectionModel().setSelectionInterval(editIndex, editIndex);
        }
    }
}
Also used : ParticleEffect(com.badlogic.gdx.graphics.g3d.particles.ParticleEffect) ParticleController(com.badlogic.gdx.graphics.g3d.particles.ParticleController) File(java.io.File)

Example 25 with ParticleController

use of com.badlogic.gdx.graphics.g3d.particles.ParticleController in project libgdx by libgdx.

the class ParticleControllerInfluencerPanel method handle.

@Override
public void handle(int aEventType, Object aEventData) {
    if (aEventType == FlameMain.EVT_ASSET_RELOADED) {
        Object[] data = (Object[]) aEventData;
        if (data[0] instanceof ParticleEffect) {
            ParticleEffect oldEffect = (ParticleEffect) data[0];
            int currentCount = value.templates.size;
            value.templates.removeAll(oldEffect.getControllers(), true);
            if (value.templates.size != currentCount) {
                int diff = currentCount - value.templates.size;
                if (diff > 0) {
                    ParticleEffect newEffect = (ParticleEffect) data[1];
                    Array<ParticleController> newControllers = newEffect.getControllers();
                    if (newControllers.size > 0) {
                        for (int i = 0, c = Math.min(diff, newControllers.size); i < c; ++i) value.templates.add(newControllers.get(i));
                    }
                } else {
                    value.templates.addAll(((ParticleEffect) editor.assetManager.get(FlameMain.DEFAULT_BILLBOARD_PARTICLE)).getControllers());
                }
                controllerPicker.reloadTemplates();
                controllerPicker.setValue(value.templates);
                editor.restart();
            }
        }
    }
}
Also used : ParticleEffect(com.badlogic.gdx.graphics.g3d.particles.ParticleEffect) ParticleController(com.badlogic.gdx.graphics.g3d.particles.ParticleController)

Aggregations

ParticleController (com.badlogic.gdx.graphics.g3d.particles.ParticleController)26 DynamicsInfluencer (com.badlogic.gdx.graphics.g3d.particles.influencers.DynamicsInfluencer)8 ParticleEffect (com.badlogic.gdx.graphics.g3d.particles.ParticleEffect)7 RegularEmitter (com.badlogic.gdx.graphics.g3d.particles.emitters.RegularEmitter)6 SpawnInfluencer (com.badlogic.gdx.graphics.g3d.particles.influencers.SpawnInfluencer)6 ColorInfluencer (com.badlogic.gdx.graphics.g3d.particles.influencers.ColorInfluencer)5 DynamicsModifier (com.badlogic.gdx.graphics.g3d.particles.influencers.DynamicsModifier)4 RegionInfluencer (com.badlogic.gdx.graphics.g3d.particles.influencers.RegionInfluencer)4 ScaleInfluencer (com.badlogic.gdx.graphics.g3d.particles.influencers.ScaleInfluencer)4 BillboardRenderer (com.badlogic.gdx.graphics.g3d.particles.renderers.BillboardRenderer)4 PointSpawnShapeValue (com.badlogic.gdx.graphics.g3d.particles.values.PointSpawnShapeValue)4 GridBagConstraints (java.awt.GridBagConstraints)3 Insets (java.awt.Insets)3 SaveData (com.badlogic.gdx.graphics.g3d.particles.ResourceData.SaveData)2 ModelInstanceRenderer (com.badlogic.gdx.graphics.g3d.particles.renderers.ModelInstanceRenderer)2 ParticleControllerControllerRenderer (com.badlogic.gdx.graphics.g3d.particles.renderers.ParticleControllerControllerRenderer)2 PointSpriteRenderer (com.badlogic.gdx.graphics.g3d.particles.renderers.PointSpriteRenderer)2 EllipseSpawnShapeValue (com.badlogic.gdx.graphics.g3d.particles.values.EllipseSpawnShapeValue)2 Array (com.badlogic.gdx.utils.Array)2 IntArray (com.badlogic.gdx.utils.IntArray)2