Search in sources :

Example 1 with RibbonRenderer

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

the class RibbonModule method defineSlots.

@Override
protected void defineSlots() {
    mainDrawableValue = (DrawableValue) createInputSlot(MAIN_REGION, new DrawableValue());
    ribbonDrawableValue = (DrawableValue) createInputSlot(RIBBON_REGION, new DrawableValue());
    thicknessValue = createInputSlot(THICKNESS);
    transparencyValue = createInputSlot(TRANSPARENCY);
    colorValue = createInputSlot(COLOR);
    RibbonRenderer renderer = new RibbonRenderer();
    outputValue = (DrawableValue) createOutputSlot(OUTPUT, new DrawableValue());
    outputValue.setDrawable(renderer);
}
Also used : RibbonRenderer(com.talosvfx.talos.runtime.render.drawables.RibbonRenderer) DrawableValue(com.talosvfx.talos.runtime.values.DrawableValue)

Example 2 with RibbonRenderer

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

the class RibbonModule method setDetailCount.

public void setDetailCount(int count) {
    detail = count;
    RibbonRenderer renderer = (RibbonRenderer) outputValue.getDrawable();
    renderer.setConfig(detail, memoryDuration);
}
Also used : RibbonRenderer(com.talosvfx.talos.runtime.render.drawables.RibbonRenderer)

Example 3 with RibbonRenderer

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

the class RibbonModule method setMemoryDuration.

public void setMemoryDuration(float duration) {
    memoryDuration = duration;
    RibbonRenderer renderer = (RibbonRenderer) outputValue.getDrawable();
    renderer.setConfig(detail, memoryDuration);
}
Also used : RibbonRenderer(com.talosvfx.talos.runtime.render.drawables.RibbonRenderer)

Example 4 with RibbonRenderer

use of com.talosvfx.talos.runtime.render.drawables.RibbonRenderer 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 5 with RibbonRenderer

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

the class RibbonModule method fetchAllInputSlotValues.

@Override
public void fetchAllInputSlotValues() {
    super.fetchAllInputSlotValues();
    float requester = getScope().get(ScopePayload.REQUESTER_ID).getFloat();
    RibbonRenderer renderer = (RibbonRenderer) outputValue.getDrawable();
    renderer.setCurrentParticle(getScope().currParticle());
    for (int i = 0; i < detail; i++) {
        float pointAlpha = (float) i / (detail - 1);
        if (pointAlpha == 0)
            pointAlpha = 0.001f;
        getScope().set(ScopePayload.SECONDARY_SEED, pointAlpha);
        getScope().set(ScopePayload.REQUESTER_ID, requester + pointAlpha * 0.1f);
        for (Slot inputSlot : inputSlots.values()) {
            fetchInputSlotValue(inputSlot.getIndex());
        }
        float transparencyVal = 1f;
        if (!transparencyValue.isEmpty()) {
            transparencyVal = transparencyValue.getFloat();
        }
        if (colorValue.isEmpty()) {
            tmpColor.set(Color.WHITE);
            tmpColor.a = transparencyVal;
        } else {
            tmpColor.set(colorValue.get(0), colorValue.get(1), colorValue.get(2), transparencyVal);
        }
        float thicknessVal = 0.1f;
        if (!thicknessValue.isEmpty()) {
            thicknessVal = thicknessValue.getFloat();
        }
        renderer.setPointData(i, thicknessVal, tmpColor);
    }
    // renderer.adjustPointData();
    getScope().set(ScopePayload.REQUESTER_ID, requester);
}
Also used : RibbonRenderer(com.talosvfx.talos.runtime.render.drawables.RibbonRenderer) Slot(com.talosvfx.talos.runtime.Slot)

Aggregations

RibbonRenderer (com.talosvfx.talos.runtime.render.drawables.RibbonRenderer)6 TextureRegion (com.badlogic.gdx.graphics.g2d.TextureRegion)1 Slot (com.talosvfx.talos.runtime.Slot)1 ShadedDrawable (com.talosvfx.talos.runtime.render.drawables.ShadedDrawable)1 TextureRegionDrawable (com.talosvfx.talos.runtime.render.drawables.TextureRegionDrawable)1 DrawableValue (com.talosvfx.talos.runtime.values.DrawableValue)1