Added also tryGetValue to ShaderGraph
Since @mafiesto4 requested in the review to use tryGetValye in the VisjectGraph to get the bool param I also did it to the shader one
This commit is contained in:
@@ -408,9 +408,10 @@ void ShaderGenerator::ProcessGroupMath(Box* box, Node* node, Value& value)
|
||||
const auto inVal = tryGetValue(node->GetBox(0), node->Values[0].AsFloat);
|
||||
const auto rangeA = tryGetValue(node->GetBox(1), node->Values[1].AsVector2());
|
||||
const auto rangeB = tryGetValue(node->GetBox(2), node->Values[2].AsVector2());
|
||||
const auto clamp = tryGetValue(node->GetBox(3), node->Values[3]).AsBool();
|
||||
|
||||
const auto mapFunc = String::Format(TEXT("{2}.x + ({0} - {1}.x) * ({2}.y - {2}.x) / ({1}.y - {1}.x)"), inVal.Value, rangeA.Value, rangeB.Value);
|
||||
value = writeLocal(ValueType::Float, node->Values[3].AsBool ? String::Format(TEXT("clamp({0}, {1}.x, {1}.y)"), mapFunc, rangeB.Value) : mapFunc, node);
|
||||
value = writeLocal(ValueType::Float, String::Format(TEXT("{2} ? clamp({0}, {1}.x, {1}.y) : {0}"), mapFunc, rangeB.Value, clamp.Value), node);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user