com.badlogic.gdx.graphics.g3d.particles.ParticleEffect Java Examples

The following examples show how to use com.badlogic.gdx.graphics.g3d.particles.ParticleEffect. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GameScene.java    From GdxDemo3D with Apache License 2.0 6 votes vote down vote up
public void dispose() {
	ParticleSystem particleSystem = ParticleSystem.get();
	for (ParticleEffect pfx : particleEffects) {
		particleSystem.remove(pfx);
		pfx.dispose();
	}
	particleEffects.clear();
	navMesh.dispose();
	for (Array<GameObject> objs : gameObjects.values()) {
		for (GameObject obj : objs) {
			obj.dispose();
		}
	}
	gameObjects.clear();
	assets.dispose();
}
 
Example #2
Source File: ParticleUtils.java    From Skyland with MIT License 5 votes vote down vote up
public void cloudPoof(Vector3 translation) {
    ParticleEffect effect = particleManager.get(Particles.PARTICLE_CLOUD_PUFF, ParticleEffect.class).copy();
    effect.init();
    effect.start();
    effect.translate(translation.add(0, -2.5f, 0));
    effect.scale(1.5f, 1.5f, 1.5f);
    effect.rotate(new Vector3(0, 1, 0), 90);

    particleSystem.add(effect);
}
 
Example #3
Source File: ParticleUtils.java    From Skyland with MIT License 5 votes vote down vote up
public void caveDust(Matrix4 transform) {
    ParticleEffect effect = particleManager.get(Particles.PARTICLE_CAVE_DUST, ParticleEffect.class).copy();
    effect.init();
    effect.start();
    effect.setTransform(transform);
    particleSystem.add(effect);
}
 
Example #4
Source File: ParticleUtils.java    From Skyland with MIT License 5 votes vote down vote up
private void initManager() {
    particleManager = new AssetManager();
    ParticleEffectLoader.ParticleEffectLoadParameter loadParam = new ParticleEffectLoader.ParticleEffectLoadParameter(particleSystem.getBatches());
    ParticleEffectLoader loader = new ParticleEffectLoader(new InternalFileHandleResolver());
    particleManager.setLoader(ParticleEffect.class, loader);
    particleManager.load(Particles.PARTICLE_CLOUD_PUFF, ParticleEffect.class, loadParam);
    particleManager.load(Particles.PARTICLE_CAVE_DUST, ParticleEffect.class, loadParam);
    particleManager.finishLoading();
}
 
Example #5
Source File: Assets.java    From gdx-proto with Apache License 2.0 5 votes vote down vote up
public static void loadParticleEffects(ParticleSystem particleSystem) {
	ParticleEffectLoader.ParticleEffectLoadParameter loadParam = new ParticleEffectLoader.ParticleEffectLoadParameter(particleSystem.getBatches());
	ParticleEffectLoader loader = new ParticleEffectLoader(new InternalFileHandleResolver());
	manager.setLoader(ParticleEffect.class, loader);
	manager.load("particle/bullet-hit.pfx", ParticleEffect.class, loadParam);
	manager.load("particle/blue-explosion.pfx", ParticleEffect.class, loadParam);
	manager.finishLoading();
}
 
Example #6
Source File: Particles.java    From gdx-proto with Apache License 2.0 5 votes vote down vote up
public Particles() {
	inst = this;
	system = ParticleSystem.get();
	PointSpriteParticleBatch psBatch = new PointSpriteParticleBatch();
	psBatch.setCamera(View.inst.getCamera());
	system.add(psBatch);

	Assets.loadParticleEffects(system);

	ParticleEffect bulletHit = Assets.manager.get("particle/bullet-hit.pfx");
	ParticleEffect blueExplosion = Assets.manager.get("particle/blue-explosion.pfx");
	bulletHitPool = new PFXPool(bulletHit);
	blueExplosionPool = new PFXPool(blueExplosion);
}
 
Example #7
Source File: Particles.java    From gdx-proto with Apache License 2.0 4 votes vote down vote up
public ParticleEffect obtainBulletHit() {
	//System.out.println("free bullet-hit count: " + bulletHitPool.getFree());
	return bulletHitPool.obtain();
}
 
Example #8
Source File: Particles.java    From gdx-proto with Apache License 2.0 4 votes vote down vote up
public void freeBulletHit(ParticleEffect pfx) {
	system.remove(pfx);
	bulletHitPool.free(pfx);
}
 
Example #9
Source File: Particles.java    From gdx-proto with Apache License 2.0 4 votes vote down vote up
public ParticleEffect obtainBlueExplosion() {
	//System.out.println("free bullet-hit count: " + blueExplosionPool.getFree());
	return blueExplosionPool.obtain();
}
 
Example #10
Source File: Particles.java    From gdx-proto with Apache License 2.0 4 votes vote down vote up
public void freeBlueExplosion(ParticleEffect pfx) {
	system.remove(pfx);
	blueExplosionPool.free(pfx);
}
 
Example #11
Source File: Particles.java    From gdx-proto with Apache License 2.0 4 votes vote down vote up
public PFXPool(ParticleEffect sourceEffect) {
	this.sourceEffect = sourceEffect;
}
 
Example #12
Source File: Particles.java    From gdx-proto with Apache License 2.0 4 votes vote down vote up
@Override
public void free(ParticleEffect pfx) {
	pfx.reset();
	super.free(pfx);
}
 
Example #13
Source File: Particles.java    From gdx-proto with Apache License 2.0 4 votes vote down vote up
@Override
protected ParticleEffect newObject() {
	ParticleEffect pfx = sourceEffect.copy();
	pfx.init();
	return pfx;
}