use of com.talosvfx.talos.runtime.render.SpriteBatchParticleRenderer in project talos by rockbite.
the class LegacyCompareTest method create.
@Override
public void create() {
super.create();
TextureAtlas skinAtlas = new TextureAtlas(Gdx.files.internal("skin/uiskin.atlas"));
skin = new Skin(Gdx.files.internal("skin/uiskin.json"));
skin.addRegions(skinAtlas);
uiStage = new Stage();
stage = new Stage();
((OrthographicCamera) stage.getViewport().getCamera()).zoom = 1f / 64;
talosRenderer = new SpriteBatchParticleRenderer(stage.getBatch());
String mainPath = "C:\\Users\\Tom\\Desktop\\vfx\\";
// mainPath = getLocalPath() + "\\";
String assetPath = mainPath + "Particles-Assets";
String legacyPath = mainPath + "RefactoredProduction";
String talosExport = mainPath + "Converted\\runtime";
atlas = new TextureAtlas(Gdx.files.absolute(mainPath + "Atlas\\particleAssets.atlas"));
legacyList = new Array<>();
talosList = new Array<>();
traverseFolder(Gdx.files.absolute(legacyPath), legacyList, "p", 0);
traverseFolder(Gdx.files.absolute(talosExport), talosList, "p", 0);
addNextEffect();
Gdx.input.setInputProcessor(stage);
}
use of com.talosvfx.talos.runtime.render.SpriteBatchParticleRenderer in project talos by rockbite.
the class ParticleControlTest method create.
@Override
public void create() {
orthographicCamera = new OrthographicCamera();
float width = 2000f;
float aspect = (float) Gdx.graphics.getWidth() / (float) Gdx.graphics.getHeight();
orthographicCamera.setToOrtho(false, width, width / aspect);
shapeRenderer = new ShapeRenderer();
batch = new SpriteBatch();
particleRenderer = new SpriteBatchParticleRenderer(batch);
cameraController = new CameraController(orthographicCamera);
ParticleEffectDescriptor descriptor = new ParticleEffectDescriptor();
TextureAtlas atlas = new TextureAtlas();
atlas.addRegion("fire", new TextureRegion(new TextureRegion(new Texture(Gdx.files.internal("fire.png")))));
descriptor.setAssetProvider(new TestAssetProvider(atlas));
descriptor.load(Gdx.files.internal("test.p"));
particleEffectInstance = descriptor.createEffectInstance();
particleEffectInstance.loopable = true;
stage = new Stage();
VisUI.load();
VisTextButton start = new VisTextButton("Start/Resume");
VisTextButton pause = new VisTextButton("Pause");
VisTextButton restart = new VisTextButton("Restart");
VisTextButton allowCompletion = new VisTextButton("Allow Completion");
start.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
particleEffectInstance.resume();
}
});
pause.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
particleEffectInstance.pause();
}
});
restart.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
particleEffectInstance.restart();
}
});
allowCompletion.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
particleEffectInstance.allowCompletion();
}
});
Table table = new Table();
table.setFillParent(true);
table.defaults().pad(10).top().left();
table.top().left();
table.add(start);
table.row();
table.add(pause);
table.row();
table.add(restart);
table.row();
table.add(allowCompletion);
stage.addActor(table);
Gdx.input.setInputProcessor(new InputMultiplexer(stage, cameraController));
}
use of com.talosvfx.talos.runtime.render.SpriteBatchParticleRenderer in project talos by rockbite.
the class TalosDemo method create.
@Override
public void create() {
/**
* We need a viewport for proper camerawork
*/
viewport = new FitViewport(10f, 10f);
viewport.update(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), false);
/**
* We may need polygon sprite batch to render more complex VFX such us beams
*/
batch = new PolygonSpriteBatch();
/**
* Prepare the texture atlas.
* Normally just load Texture Atlas, but for the sake of demo this will be creating fake atlas from just one texture.
*/
TextureRegion textureRegion = new TextureRegion(new Texture(Gdx.files.internal("fire.png")));
TextureAtlas textureAtlas = new TextureAtlas();
textureAtlas.addRegion("fire", textureRegion);
/**
* Creating particle effect instance from particle effect descriptor
*/
ParticleEffectDescriptor effectDescriptor = new ParticleEffectDescriptor(Gdx.files.internal("fire.p"), textureAtlas);
effect = effectDescriptor.createEffectInstance();
defaultRenderer = new SpriteBatchParticleRenderer();
}
Aggregations