Search in sources :

Example 1 with Influencer

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

the class ParticleController method copy.

/** @return a copy of this controller */
public ParticleController copy() {
    Emitter emitter = (Emitter) this.emitter.copy();
    Influencer[] influencers = new Influencer[this.influencers.size];
    int i = 0;
    for (Influencer influencer : this.influencers) {
        influencers[i++] = (Influencer) influencer.copy();
    }
    return new ParticleController(new String(this.name), emitter, (ParticleControllerRenderer<?, ?>) renderer.copy(), influencers);
}
Also used : Emitter(com.badlogic.gdx.graphics.g3d.particles.emitters.Emitter) Influencer(com.badlogic.gdx.graphics.g3d.particles.influencers.Influencer)

Example 2 with Influencer

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

the class ParticleController method save.

@Override
public void save(AssetManager manager, ResourceData data) {
    emitter.save(manager, data);
    for (Influencer influencer : influencers) influencer.save(manager, data);
    renderer.save(manager, data);
}
Also used : Influencer(com.badlogic.gdx.graphics.g3d.particles.influencers.Influencer)

Example 3 with Influencer

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

the class FlameMain method addInfluencer.

protected void addInfluencer(Class<Influencer> type, ParticleController controller) {
    if (controller.findInfluencer(type) != null)
        return;
    try {
        controller.end();
        Influencer newInfluencer = type.newInstance();
        boolean replaced = false;
        if (ColorInfluencer.class.isAssignableFrom(type)) {
            replaced = controller.replaceInfluencer(ColorInfluencer.class, (ColorInfluencer) newInfluencer);
        } else if (RegionInfluencer.class.isAssignableFrom(type)) {
            replaced = controller.replaceInfluencer(RegionInfluencer.class, (RegionInfluencer) newInfluencer);
        } else if (ModelInfluencer.class.isAssignableFrom(type)) {
            ModelInfluencer newModelInfluencer = (ModelInfluencer) newInfluencer;
            ModelInfluencer currentInfluencer = (ModelInfluencer) controller.findInfluencer(ModelInfluencer.class);
            if (currentInfluencer != null) {
                newModelInfluencer.models.add(currentInfluencer.models.first());
            }
            replaced = controller.replaceInfluencer(ModelInfluencer.class, (ModelInfluencer) newInfluencer);
        } else if (ParticleControllerInfluencer.class.isAssignableFrom(type)) {
            ParticleControllerInfluencer newModelInfluencer = (ParticleControllerInfluencer) newInfluencer;
            ParticleControllerInfluencer currentInfluencer = (ParticleControllerInfluencer) controller.findInfluencer(ParticleControllerInfluencer.class);
            if (currentInfluencer != null) {
                newModelInfluencer.templates.add(currentInfluencer.templates.first());
            }
            replaced = controller.replaceInfluencer(ParticleControllerInfluencer.class, (ParticleControllerInfluencer) newInfluencer);
        }
        if (!replaced) {
            if (getControllerType() != ControllerType.ParticleController)
                controller.influencers.add(newInfluencer);
            else {
                Influencer finalizer = controller.influencers.pop();
                controller.influencers.add(newInfluencer);
                controller.influencers.add(finalizer);
            }
        }
        controller.init();
        effect.start();
        reloadRows();
    } catch (Exception e1) {
        e1.printStackTrace();
    }
}
Also used : ModelInfluencer(com.badlogic.gdx.graphics.g3d.particles.influencers.ModelInfluencer) SpawnInfluencer(com.badlogic.gdx.graphics.g3d.particles.influencers.SpawnInfluencer) ScaleInfluencer(com.badlogic.gdx.graphics.g3d.particles.influencers.ScaleInfluencer) ParticleControllerInfluencer(com.badlogic.gdx.graphics.g3d.particles.influencers.ParticleControllerInfluencer) DynamicsInfluencer(com.badlogic.gdx.graphics.g3d.particles.influencers.DynamicsInfluencer) RegionInfluencer(com.badlogic.gdx.graphics.g3d.particles.influencers.RegionInfluencer) ParticleControllerFinalizerInfluencer(com.badlogic.gdx.graphics.g3d.particles.influencers.ParticleControllerFinalizerInfluencer) Influencer(com.badlogic.gdx.graphics.g3d.particles.influencers.Influencer) ModelInfluencer(com.badlogic.gdx.graphics.g3d.particles.influencers.ModelInfluencer) ColorInfluencer(com.badlogic.gdx.graphics.g3d.particles.influencers.ColorInfluencer) ColorInfluencer(com.badlogic.gdx.graphics.g3d.particles.influencers.ColorInfluencer) ParticleControllerInfluencer(com.badlogic.gdx.graphics.g3d.particles.influencers.ParticleControllerInfluencer) RegionInfluencer(com.badlogic.gdx.graphics.g3d.particles.influencers.RegionInfluencer)

Example 4 with Influencer

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

the class ParticleController method bind.

/** Bind the sub systems to the controller Called once during the init phase. */
protected void bind() {
    emitter.set(this);
    for (Influencer influencer : influencers) influencer.set(this);
    renderer.set(this);
}
Also used : Influencer(com.badlogic.gdx.graphics.g3d.particles.influencers.Influencer)

Example 5 with Influencer

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

the class ParticleController method allocateChannels.

protected void allocateChannels(int maxParticleCount) {
    particles = new ParallelArray(maxParticleCount);
    // Alloc additional channels
    emitter.allocateChannels();
    for (Influencer influencer : influencers) influencer.allocateChannels();
    renderer.allocateChannels();
}
Also used : Influencer(com.badlogic.gdx.graphics.g3d.particles.influencers.Influencer)

Aggregations

Influencer (com.badlogic.gdx.graphics.g3d.particles.influencers.Influencer)7 Emitter (com.badlogic.gdx.graphics.g3d.particles.emitters.Emitter)1 ColorInfluencer (com.badlogic.gdx.graphics.g3d.particles.influencers.ColorInfluencer)1 DynamicsInfluencer (com.badlogic.gdx.graphics.g3d.particles.influencers.DynamicsInfluencer)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 RegionInfluencer (com.badlogic.gdx.graphics.g3d.particles.influencers.RegionInfluencer)1 ScaleInfluencer (com.badlogic.gdx.graphics.g3d.particles.influencers.ScaleInfluencer)1 SpawnInfluencer (com.badlogic.gdx.graphics.g3d.particles.influencers.SpawnInfluencer)1