Search in sources :

Example 1 with ParticleEffectInstance

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;
    }
}
Also used : ParticleEffectInstance(com.talosvfx.talos.runtime.ParticleEffectInstance)

Example 2 with ParticleEffectInstance

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);
    }
}
Also used : ParticleEffectInstance(com.talosvfx.talos.runtime.ParticleEffectInstance) Vector2(com.badlogic.gdx.math.Vector2)

Example 3 with ParticleEffectInstance

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);
}
Also used : ParticleEffectInstance(com.talosvfx.talos.runtime.ParticleEffectInstance)

Example 4 with ParticleEffectInstance

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;
}
Also used : ParticleEffectInstance(com.talosvfx.talos.runtime.ParticleEffectInstance)

Example 5 with ParticleEffectInstance

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);
        }
    }
}
Also used : ParticleEffectInstance(com.talosvfx.talos.runtime.ParticleEffectInstance)

Aggregations

ParticleEffectInstance (com.talosvfx.talos.runtime.ParticleEffectInstance)15 Vector2 (com.badlogic.gdx.math.Vector2)3 Color (com.badlogic.gdx.graphics.Color)2 Slot (com.esotericsoftware.spine.Slot)2 NumericalValue (com.talosvfx.talos.runtime.values.NumericalValue)2 FileHandle (com.badlogic.gdx.files.FileHandle)1 Texture (com.badlogic.gdx.graphics.Texture)1 FloatArray (com.badlogic.gdx.utils.FloatArray)1 JsonValue (com.badlogic.gdx.utils.JsonValue)1 ObjectMap (com.badlogic.gdx.utils.ObjectMap)1 ShortArray (com.badlogic.gdx.utils.ShortArray)1 BlendMode (com.esotericsoftware.spine.BlendMode)1 Bone (com.esotericsoftware.spine.Bone)1 Skeleton (com.esotericsoftware.spine.Skeleton)1 Attachment (com.esotericsoftware.spine.attachments.Attachment)1 ClippingAttachment (com.esotericsoftware.spine.attachments.ClippingAttachment)1 MeshAttachment (com.esotericsoftware.spine.attachments.MeshAttachment)1 RegionAttachment (com.esotericsoftware.spine.attachments.RegionAttachment)1 SkeletonAttachment (com.esotericsoftware.spine.attachments.SkeletonAttachment)1 BoundEffect (com.talosvfx.talos.editor.addons.bvb.BoundEffect)1