use of com.gempukku.libgdx.graph.shader.field.ShaderFieldType in project gdx-graph by MarcinSc.
the class InverseSquareRootShaderNodeBuilder 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 = inputValue.getFieldType();
commonShaderBuilder.addMainLine("// Inverse square root node");
String name = "result_" + nodeId;
commonShaderBuilder.addMainLine(resultType.getShaderType() + " " + name + " = inversesqrt(" + inputValue.getRepresentation() + ");");
return LibGDXCollections.singletonMap("output", new DefaultFieldOutput(ShaderFieldType.Float, name));
}
use of com.gempukku.libgdx.graph.shader.field.ShaderFieldType in project gdx-graph by MarcinSc.
the class DivideShaderNodeBuilder 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 aValue = inputs.get("a");
FieldOutput bValue = inputs.get("b");
ShaderFieldType resultType = determineOutputType(aValue, bValue);
commonShaderBuilder.addMainLine("// Divide node");
String name = "result_" + nodeId;
commonShaderBuilder.addMainLine(resultType.getShaderType() + " " + name + " = " + aValue.getRepresentation() + " / " + bValue.getRepresentation() + ";");
return LibGDXCollections.singletonMap("output", new DefaultFieldOutput(resultType, name));
}
use of com.gempukku.libgdx.graph.shader.field.ShaderFieldType in project gdx-graph by MarcinSc.
the class OneMinusShaderNodeBuilder 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 = inputValue.getFieldType();
commonShaderBuilder.addMainLine("// One minus node");
String name = "result_" + nodeId;
commonShaderBuilder.addMainLine(resultType.getShaderType() + " " + name + " = 1.0 - " + inputValue.getRepresentation() + ";");
return LibGDXCollections.singletonMap("output", new DefaultFieldOutput(resultType, name));
}
use of com.gempukku.libgdx.graph.shader.field.ShaderFieldType in project gdx-graph by MarcinSc.
the class CeilingShaderNodeBuilder 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 = inputValue.getFieldType();
commonShaderBuilder.addMainLine("// Ceiling node");
String name = "result_" + nodeId;
commonShaderBuilder.addMainLine(resultType.getShaderType() + " " + name + " = ceil(" + inputValue.getRepresentation() + ");");
return LibGDXCollections.singletonMap("output", new DefaultFieldOutput(resultType, name));
}
use of com.gempukku.libgdx.graph.shader.field.ShaderFieldType in project gdx-graph by MarcinSc.
the class SignShaderNodeBuilder 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 = inputValue.getFieldType();
commonShaderBuilder.addMainLine("// Sign node");
String name = "result_" + nodeId;
commonShaderBuilder.addMainLine(resultType.getShaderType() + " " + name + " = sign(" + inputValue.getRepresentation() + ");");
return LibGDXCollections.singletonMap("output", new DefaultFieldOutput(resultType, name));
}
Aggregations