Search in sources :

Example 1 with ShadedDrawable

use of com.talosvfx.talos.runtime.render.drawables.ShadedDrawable in project talos by rockbite.

the class RibbonModule method processValues.

@Override
public void processValues() {
    RibbonRenderer renderer = (RibbonRenderer) outputValue.getDrawable();
    TextureRegion mainRegion = null;
    TextureRegion ribbonRegion = null;
    if (!mainDrawableValue.isEmpty() && mainDrawableValue.getDrawable() != null) {
        mainRegion = mainDrawableValue.getDrawable().getTextureRegion();
    }
    if (!ribbonDrawableValue.isEmpty() && ribbonDrawableValue.getDrawable() != null) {
        if (ribbonDrawableValue.getDrawable() instanceof TextureRegionDrawable) {
            ribbonRegion = ribbonDrawableValue.getDrawable().getTextureRegion();
        } else if (ribbonDrawableValue.getDrawable() instanceof ShadedDrawable) {
            renderer.setShadedDrawable((ShadedDrawable) ribbonDrawableValue.getDrawable());
        }
    }
    renderer.setRegions(mainRegion, ribbonRegion);
}
Also used : TextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion) ShadedDrawable(com.talosvfx.talos.runtime.render.drawables.ShadedDrawable) RibbonRenderer(com.talosvfx.talos.runtime.render.drawables.RibbonRenderer) TextureRegionDrawable(com.talosvfx.talos.runtime.render.drawables.TextureRegionDrawable)

Example 2 with ShadedDrawable

use of com.talosvfx.talos.runtime.render.drawables.ShadedDrawable in project talos by rockbite.

the class ShadedSpriteModule method updateShader.

private void updateShader(ShaderDescriptor shaderDescriptor) {
    this.shaderDescriptor = shaderDescriptor;
    if (shaderDescriptor != null) {
        ShadedDrawable drawable = (ShadedDrawable) outputValue.getDrawable();
        drawable.setShader(shaderDescriptor.getFragCode());
        for (String uniformName : shaderDescriptor.getUniformMap().keys()) {
            ShaderDescriptor.UniformData data = shaderDescriptor.getUniformMap().get(uniformName);
            if (data.type == ShaderDescriptor.Type.TEXTURE) {
                TextureRegion textureRegion = graph.getEffectDescriptor().getAssetProvider().findAsset(data.payload, TextureRegion.class);
                textureMap.put(uniformName, textureRegion);
            }
        }
        drawable.setTextures(textureMap);
    }
}
Also used : ShadedDrawable(com.talosvfx.talos.runtime.render.drawables.ShadedDrawable) TextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion) ShaderDescriptor(com.talosvfx.talos.runtime.utils.ShaderDescriptor)

Example 3 with ShadedDrawable

use of com.talosvfx.talos.runtime.render.drawables.ShadedDrawable in project talos by rockbite.

the class ShadedSpriteModule method defineSlots.

@Override
protected void defineSlots() {
    outputValue = (DrawableValue) createOutputSlot(OUTPUT, new DrawableValue());
    outputValue.setDrawable(new ShadedDrawable());
}
Also used : ShadedDrawable(com.talosvfx.talos.runtime.render.drawables.ShadedDrawable) DrawableValue(com.talosvfx.talos.runtime.values.DrawableValue)

Aggregations

ShadedDrawable (com.talosvfx.talos.runtime.render.drawables.ShadedDrawable)3 TextureRegion (com.badlogic.gdx.graphics.g2d.TextureRegion)2 RibbonRenderer (com.talosvfx.talos.runtime.render.drawables.RibbonRenderer)1 TextureRegionDrawable (com.talosvfx.talos.runtime.render.drawables.TextureRegionDrawable)1 ShaderDescriptor (com.talosvfx.talos.runtime.utils.ShaderDescriptor)1 DrawableValue (com.talosvfx.talos.runtime.values.DrawableValue)1