Applied review changes

This commit is contained in:
W2.Wizard
2021-01-26 00:04:04 +01:00
parent f331191e3d
commit 44d636520b

View File

@@ -371,17 +371,18 @@ void VisjectExecutor::ProcessGroupMath(Box* box, Node* node, Value& value)
if (value.Type.Type == VariantType::Enum)
value.AsUint64 = value.AsUint64 | (uint64)tryGetValue(node->GetBox(1), Value::Zero);
break;
// Remap
case 48:
{
const float inVal = tryGetValue(node->GetBox(0), node->Values[0]).AsFloat;
const Vector2 rangeA = tryGetValue(node->GetBox(1), node->Values[1]).AsVector2();
const Vector2 rangeB = tryGetValue(node->GetBox(2), node->Values[2]).AsVector2();
const bool clamp = tryGetValue(node->GetBox(3), node->Values[3]).AsBool;
auto mapFunc = rangeB.X + (inVal - rangeA.X) * (rangeB.Y - rangeB.X) / (rangeA.Y - rangeA.X);
// Clamp value?
value = node->Values[3].AsBool ? Math::Clamp(mapFunc, rangeB.X, rangeB.Y) : mapFunc;
value = clamp ? Math::Clamp(mapFunc, rangeB.X, rangeB.Y) : mapFunc;
break;
}
default: