Search in sources :

Example 1 with FloatFieldType

use of com.gempukku.libgdx.graph.field.FloatFieldType in project gdx-graph by MarcinSc.

the class Arctan2ShaderNodeBuilder method buildCommonNode.

@Override
protected ObjectMap<String, ? extends FieldOutput> buildCommonNode(boolean designTime, String nodeId, JsonValue data, ObjectMap<String, FieldOutput> inputs, ObjectSet<String> producedOutputs, CommonShaderBuilder commonShaderBuilder, GraphShaderContext graphShaderContext, GraphShader graphShader) {
    FieldOutput inputValue = inputs.get("input");
    ShaderFieldType resultType = new FloatFieldType();
    commonShaderBuilder.addMainLine("// Arctangent2 node");
    String name = "result_" + nodeId;
    commonShaderBuilder.addMainLine(resultType.getShaderType() + " " + name + " = atan(" + inputValue.getRepresentation() + ".y, " + inputValue.getRepresentation() + ".x);");
    return LibGDXCollections.singletonMap("output", new DefaultFieldOutput(resultType, name));
}
Also used : FloatFieldType(com.gempukku.libgdx.graph.field.FloatFieldType) DefaultFieldOutput(com.gempukku.libgdx.graph.shader.node.DefaultFieldOutput) ShaderFieldType(com.gempukku.libgdx.graph.shader.field.ShaderFieldType) DefaultFieldOutput(com.gempukku.libgdx.graph.shader.node.DefaultFieldOutput)

Aggregations

FloatFieldType (com.gempukku.libgdx.graph.field.FloatFieldType)1 ShaderFieldType (com.gempukku.libgdx.graph.shader.field.ShaderFieldType)1 DefaultFieldOutput (com.gempukku.libgdx.graph.shader.node.DefaultFieldOutput)1