Search in sources :

Example 6 with DynamicsInfluencer

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

the class DynamicsInfluencerPanel method velocityChecked.

protected void velocityChecked(int index, boolean isChecked) {
    ParticleController controller = editor.getEmitter();
    DynamicsInfluencer influencer = (DynamicsInfluencer) controller.findInfluencer(DynamicsInfluencer.class);
    influencer.velocities.clear();
    velocities.get(index).isActive = isChecked;
    for (VelocityWrapper wrapper : velocities) {
        if (wrapper.isActive)
            influencer.velocities.add(wrapper.velocityValue);
    }
    //Restart the effect and reinit the controller
    editor.restart();
}
Also used : DynamicsInfluencer(com.badlogic.gdx.graphics.g3d.particles.influencers.DynamicsInfluencer) ParticleController(com.badlogic.gdx.graphics.g3d.particles.ParticleController)

Example 7 with DynamicsInfluencer

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

the class DynamicsInfluencerPanel method createVelocity.

protected void createVelocity(Object selectedItem) {
    //Add the velocity to the table and to the influencer
    ParticleController controller = editor.getEmitter();
    DynamicsInfluencer influencer = (DynamicsInfluencer) controller.findInfluencer(DynamicsInfluencer.class);
    VelocityWrapper wrapper = new VelocityWrapper(createVelocityValue(selectedItem), true);
    velocities.add(wrapper);
    influencer.velocities.add(wrapper.velocityValue);
    int index = velocities.size - 1;
    velocityTableModel.addRow(new Object[] { "Velocity " + index, true });
    //Reinit
    editor.restart();
    //Select new velocity
    velocityTable.getSelectionModel().setSelectionInterval(index, index);
    revalidate();
    repaint();
}
Also used : DynamicsInfluencer(com.badlogic.gdx.graphics.g3d.particles.influencers.DynamicsInfluencer) ParticleController(com.badlogic.gdx.graphics.g3d.particles.ParticleController)

Example 8 with DynamicsInfluencer

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

the class ParticleControllerTest method createBillboardController.

private ParticleController createBillboardController(float[] colors, Texture particleTexture) {
    //Emission
    RegularEmitter emitter = new RegularEmitter();
    emitter.getDuration().setLow(3000);
    emitter.getEmission().setHigh(2900);
    emitter.getLife().setHigh(1000);
    emitter.setMaxParticleCount(3000);
    //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);
    //Scale
    ScaleInfluencer scaleInfluencer = new ScaleInfluencer();
    scaleInfluencer.value.setTimeline(new float[] { 0, 1 });
    scaleInfluencer.value.setScaling(new float[] { 1, 0 });
    scaleInfluencer.value.setLow(0);
    scaleInfluencer.value.setHigh(1);
    //Color
    ColorInfluencer.Single colorInfluencer = new ColorInfluencer.Single();
    colorInfluencer.colorValue.setColors(new float[] { colors[0], colors[1], colors[2], 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 });
    //Dynamics
    DynamicsInfluencer dynamicsInfluencer = new DynamicsInfluencer();
    BrownianAcceleration modifier = new BrownianAcceleration();
    modifier.strengthValue.setTimeline(new float[] { 0, 1 });
    modifier.strengthValue.setScaling(new float[] { 0, 1 });
    modifier.strengthValue.setHigh(80);
    modifier.strengthValue.setLow(1, 5);
    dynamicsInfluencer.velocities.add(modifier);
    return new ParticleController("Billboard Controller", emitter, new BillboardRenderer(billboardParticleBatch), new RegionInfluencer.Single(particleTexture), spawnSource, scaleInfluencer, colorInfluencer, dynamicsInfluencer);
}
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) Single(com.badlogic.gdx.graphics.g3d.particles.influencers.ColorInfluencer.Single) BrownianAcceleration(com.badlogic.gdx.graphics.g3d.particles.influencers.DynamicsModifier.BrownianAcceleration) PointSpawnShapeValue(com.badlogic.gdx.graphics.g3d.particles.values.PointSpawnShapeValue) ScaleInfluencer(com.badlogic.gdx.graphics.g3d.particles.influencers.ScaleInfluencer) Single(com.badlogic.gdx.graphics.g3d.particles.influencers.ColorInfluencer.Single) 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)

Aggregations

ParticleController (com.badlogic.gdx.graphics.g3d.particles.ParticleController)8 DynamicsInfluencer (com.badlogic.gdx.graphics.g3d.particles.influencers.DynamicsInfluencer)8 RegularEmitter (com.badlogic.gdx.graphics.g3d.particles.emitters.RegularEmitter)5 SpawnInfluencer (com.badlogic.gdx.graphics.g3d.particles.influencers.SpawnInfluencer)5 ColorInfluencer (com.badlogic.gdx.graphics.g3d.particles.influencers.ColorInfluencer)4 DynamicsModifier (com.badlogic.gdx.graphics.g3d.particles.influencers.DynamicsModifier)4 RegionInfluencer (com.badlogic.gdx.graphics.g3d.particles.influencers.RegionInfluencer)3 ScaleInfluencer (com.badlogic.gdx.graphics.g3d.particles.influencers.ScaleInfluencer)3 PointSpawnShapeValue (com.badlogic.gdx.graphics.g3d.particles.values.PointSpawnShapeValue)3 BillboardRenderer (com.badlogic.gdx.graphics.g3d.particles.renderers.BillboardRenderer)2 EllipseSpawnShapeValue (com.badlogic.gdx.graphics.g3d.particles.values.EllipseSpawnShapeValue)2 Texture (com.badlogic.gdx.graphics.Texture)1 Model (com.badlogic.gdx.graphics.g3d.Model)1 Single (com.badlogic.gdx.graphics.g3d.particles.influencers.ColorInfluencer.Single)1 BrownianAcceleration (com.badlogic.gdx.graphics.g3d.particles.influencers.DynamicsModifier.BrownianAcceleration)1 ModelInfluencer (com.badlogic.gdx.graphics.g3d.particles.influencers.ModelInfluencer)1 ParticleControllerFinalizerInfluencer (com.badlogic.gdx.graphics.g3d.particles.influencers.ParticleControllerFinalizerInfluencer)1 ParticleControllerInfluencer (com.badlogic.gdx.graphics.g3d.particles.influencers.ParticleControllerInfluencer)1 ModelInstanceRenderer (com.badlogic.gdx.graphics.g3d.particles.renderers.ModelInstanceRenderer)1 ParticleControllerControllerRenderer (com.badlogic.gdx.graphics.g3d.particles.renderers.ParticleControllerControllerRenderer)1