Search in sources :

Example 6 with ParticleController

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

the class FlameMain method getParticleEffects.

public Array<ParticleEffect> getParticleEffects(Array<ParticleController> controllers, Array<ParticleEffect> out) {
    out.clear();
    assetManager.getAll(ParticleEffect.class, out);
    for (int i = 0; i < out.size; ) {
        ParticleEffect effect = out.get(i);
        Array<ParticleController> effectControllers = effect.getControllers();
        boolean remove = true;
        for (ParticleController controller : controllers) {
            if (effectControllers.contains(controller, true)) {
                remove = false;
                break;
            }
        }
        if (remove) {
            out.removeIndex(i);
            continue;
        }
        ++i;
    }
    return out;
}
Also used : ParticleEffect(com.badlogic.gdx.graphics.g3d.particles.ParticleEffect) ParticleController(com.badlogic.gdx.graphics.g3d.particles.ParticleController)

Example 7 with ParticleController

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

the class CountPanel method initializeComponents.

private void initializeComponents(int min, int max) {
    //Min
    minSlider = new Slider(0, 0, 999999, 1);
    minSlider.setValue(min);
    minSlider.addChangeListener(new ChangeListener() {

        public void stateChanged(ChangeEvent event) {
            ParticleController controller = editor.getEmitter();
            controller.emitter.minParticleCount = (int) minSlider.getValue();
            editor.restart();
        }
    });
    //Max
    maxSlider = new Slider(0, 0, 999999, 1);
    maxSlider.setValue(max);
    maxSlider.addChangeListener(new ChangeListener() {

        public void stateChanged(ChangeEvent event) {
            ParticleController controller = editor.getEmitter();
            controller.emitter.maxParticleCount = (int) maxSlider.getValue();
            editor.restart();
        }
    });
    int i = 0;
    contentPanel.add(new JLabel("Min"), new GridBagConstraints(0, i, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 0, 0, 0), 0, 0));
    contentPanel.add(minSlider, new GridBagConstraints(1, i++, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 0, 0, 0), 0, 0));
    contentPanel.add(new JLabel("Max"), new GridBagConstraints(0, i, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 0, 0, 0), 0, 0));
    contentPanel.add(maxSlider, new GridBagConstraints(1, i++, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 0, 0, 0), 0, 0));
}
Also used : GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) ChangeEvent(javax.swing.event.ChangeEvent) ParticleController(com.badlogic.gdx.graphics.g3d.particles.ParticleController) JLabel(javax.swing.JLabel) ChangeListener(javax.swing.event.ChangeListener)

Example 8 with ParticleController

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

the class ParticleControllerInfluencerPanel method reloadControllers.

private void reloadControllers() {
    Array<ParticleEffect> effects = new Array<ParticleEffect>();
    Array<ParticleController> controllers = new Array<ParticleController>();
    editor.assetManager.getAll(ParticleEffect.class, effects);
    for (ParticleEffect effect : effects) {
        controllers.addAll(effect.getControllers());
    }
    controllerPicker.setLoadedTemplates(controllers);
}
Also used : Array(com.badlogic.gdx.utils.Array) ParticleEffect(com.badlogic.gdx.graphics.g3d.particles.ParticleEffect) ParticleController(com.badlogic.gdx.graphics.g3d.particles.ParticleController)

Example 9 with ParticleController

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

the class ParticleControllerTest method render.

@Override
protected void render(ModelBatch batch, Array<ModelInstance> instances) {
    if (emitters.size > 0) {
        //Update
        float delta = Gdx.graphics.getDeltaTime();
        builder.delete(0, builder.length());
        builder.append(Gdx.graphics.getFramesPerSecond());
        fpsLabel.setText(builder);
        ui.act(delta);
        billboardParticleBatch.begin();
        for (ParticleController controller : emitters) {
            controller.update();
            controller.draw();
        }
        billboardParticleBatch.end();
        batch.render(billboardParticleBatch, environment);
    }
    batch.render(instances, environment);
    ui.draw();
}
Also used : ParticleController(com.badlogic.gdx.graphics.g3d.particles.ParticleController)

Example 10 with ParticleController

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

the class ParticleControllerTest method create.

@Override
public void create() {
    super.create();
    emitters = new Array<ParticleController>();
    assets.load(DEFAULT_PARTICLE, Texture.class);
    assets.load(DEFAULT_SKIN, Skin.class);
    loading = true;
    environment = new Environment();
    environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0f, 0f, 0.1f, 1f));
    environment.add(new DirectionalLight().set(1f, 1f, 1f, 0, -0.5f, -1));
    billboardParticleBatch = new BillboardParticleBatch();
    billboardParticleBatch.setCamera(cam);
    ui = new Stage();
    builder = new StringBuilder();
}
Also used : ParticleController(com.badlogic.gdx.graphics.g3d.particles.ParticleController) DirectionalLight(com.badlogic.gdx.graphics.g3d.environment.DirectionalLight) Environment(com.badlogic.gdx.graphics.g3d.Environment) BillboardParticleBatch(com.badlogic.gdx.graphics.g3d.particles.batches.BillboardParticleBatch) Stage(com.badlogic.gdx.scenes.scene2d.Stage) ColorAttribute(com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute)

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