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;
}
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));
}
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);
}
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();
}
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();
}
Aggregations