Search in sources :

Example 1 with Value

use of com.talosvfx.talos.runtime.values.Value in project talos by rockbite.

the class AbstractModule method fetchInputSlotValue.

/**
 * Fetch value from the input of this module
 * @param slotId
 */
public void fetchInputSlotValue(int slotId) {
    // find what it is connected to
    Slot inputSlot = inputSlots.get(slotId);
    if (inputSlot == null) {
        return;
    }
    if (inputSlot.getTargetSlot() == null) {
        if (inputSlot.getValue() == null)
            return;
        inputSlot.getValue().setEmpty(true);
    } else {
        // ask it's module give it's output value
        Value result = inputSlot.getTargetModule().fetchOutputSlotValue(inputSlot.getTargetSlot().getIndex());
        if (result != null) {
            inputSlot.getValue().set(result);
            inputSlot.getValue().setEmpty(false);
        }
    }
}
Also used : JsonValue(com.badlogic.gdx.utils.JsonValue) NumericalValue(com.talosvfx.talos.runtime.values.NumericalValue) Value(com.talosvfx.talos.runtime.values.Value) Slot(com.talosvfx.talos.runtime.Slot)

Example 2 with Value

use of com.talosvfx.talos.runtime.values.Value in project talos by rockbite.

the class RandomInputModule method processValues.

@Override
public void processValues() {
    Value output = outputSlots.get(0).getValue();
    if (output != null) {
        random.setSeed((long) ((getScope().getFloat(ScopePayload.EMITTER_ALPHA_AT_P_INIT) * 10000 * (index + 1) * 1000)));
        int index = MathUtils.round(random.nextFloat() * (inputSlots.size - 1));
        Value input = inputSlots.get(index).getValue();
        if (input != null && !input.isEmpty()) {
            output.set(input);
        }
    }
}
Also used : Value(com.talosvfx.talos.runtime.values.Value)

Aggregations

Value (com.talosvfx.talos.runtime.values.Value)2 JsonValue (com.badlogic.gdx.utils.JsonValue)1 Slot (com.talosvfx.talos.runtime.Slot)1 NumericalValue (com.talosvfx.talos.runtime.values.NumericalValue)1