use of com.talosvfx.talos.runtime.ParticleEffectInstance in project talos by rockbite.
the class MainRenderer method obtainParticle.
private ParticleEffectInstance obtainParticle(GameObject gameObject, ParticleEffectDescriptor descriptor) {
ParticleComponent component = gameObject.getComponent(ParticleComponent.class);
if (particleCache.containsKey(component)) {
return particleCache.get(component);
} else {
ParticleEffectInstance instance = descriptor.createEffectInstance();
particleCache.put(component, instance);
return instance;
}
}
use of com.talosvfx.talos.runtime.ParticleEffectInstance in project talos by rockbite.
the class MainRenderer method renderParticle.
private void renderParticle(Batch batch, GameObject gameObject) {
ParticleComponent particleComponent = gameObject.getComponent(ParticleComponent.class);
vec.set(0, 0);
transformComponent.localToWorld(gameObject, vec);
Vector2 renderPosition = vec;
if (particleComponent.descriptor == null) {
particleComponent.reloadDescriptor();
}
if (particleComponent.descriptor != null) {
ParticleEffectInstance instance = obtainParticle(gameObject, particleComponent.descriptor);
instance.setPosition(renderPosition.x, renderPosition.y);
// todo: we so hacky hacky
instance.update(Gdx.graphics.getDeltaTime());
talosRenderer.setBatch(batch);
talosRenderer.render(instance);
}
}
use of com.talosvfx.talos.runtime.ParticleEffectInstance in project talos by rockbite.
the class BoundEffect method startInstance.
public void startInstance() {
if (forever)
return;
if (isStandalone && !particleEffects.isEmpty())
return;
ParticleEffectInstance instance = particleEffectDescriptor.createEffectInstance();
instance.setScope(scopePayload);
particleEffects.add(instance);
}
use of com.talosvfx.talos.runtime.ParticleEffectInstance in project talos by rockbite.
the class BoundEffect method spawnEffect.
private ParticleEffectInstance spawnEffect() {
ParticleEffectInstance instance = particleEffectDescriptor.createEffectInstance();
instance.setScope(scopePayload);
particleEffects.add(instance);
return instance;
}
use of com.talosvfx.talos.runtime.ParticleEffectInstance in project talos by rockbite.
the class BvBWorkspace method drawVFXBefore.
private void drawVFXBefore(Batch batch, float parentAlpha) {
Skeleton skeleton = skeletonContainer.getSkeleton();
if (skeleton == null)
return;
talosRenderer.setBatch(batch);
for (BoundEffect effect : skeletonContainer.getBoundEffects()) {
if (effect.isNested() || !effect.isBehind())
continue;
for (ParticleEffectInstance particleEffectInstance : effect.getParticleEffects()) {
talosRenderer.render(particleEffectInstance);
}
}
}
Aggregations