Tweak Rotator node

This commit is contained in:
Wojtek Figat
2021-01-24 19:01:25 +01:00
parent f6065c4463
commit f714afc180

View File

@@ -351,17 +351,17 @@ void MaterialGenerator::ProcessGroupMaterial(Box* box, Node* node, Value& value)
// Rotator
case 27:
{
auto UV = tryGetValue(node->GetBox(0), Value::Zero).AsVector2();
auto uv = tryGetValue(node->GetBox(0), getUVs).AsVector2();
auto center = tryGetValue(node->GetBox(1), Value::Zero).AsVector2();
auto rotationAngle = tryGetValue(node->GetBox(2), Value::Zero).AsFloat();
const auto x1 = writeLocal(ValueType::Vector2, String::Format(TEXT("({0} * -1) + {1}"), center.Value, UV.Value), node);
const auto RACosSin = writeLocal(ValueType::Vector2, String::Format(TEXT("float2(cos({0}), sin({0}))"), rotationAngle.Value), node);
const auto x1 = writeLocal(ValueType::Vector2, String::Format(TEXT("({0} * -1) + {1}"), center.Value, uv.Value), node);
const auto raCosSin = writeLocal(ValueType::Vector2, String::Format(TEXT("float2(cos({0}), sin({0}))"), rotationAngle.Value), node);
const auto DotB1 = writeLocal(ValueType::Vector2, String::Format(TEXT("float2({0}.x, {0}.y * -1)"), RACosSin.Value), node);
const auto DotB2 = writeLocal(ValueType::Vector2, String::Format(TEXT("float2({0}.y, {0}.x)"), RACosSin.Value), node);
const auto dotB1 = writeLocal(ValueType::Vector2, String::Format(TEXT("float2({0}.x, {0}.y * -1)"), raCosSin.Value), node);
const auto dotB2 = writeLocal(ValueType::Vector2, String::Format(TEXT("float2({0}.y, {0}.x)"), raCosSin.Value), node);
value = writeLocal(ValueType::Vector2, String::Format(TEXT("{3} + float2(dot({0},{1}), dot({0},{2}))"), x1.Value, DotB1.Value, DotB2.Value, center.Value), node);
value = writeLocal(ValueType::Vector2, String::Format(TEXT("{3} + float2(dot({0},{1}), dot({0},{2}))"), x1.Value, dotB1.Value, dotB2.Value, center.Value), node);
break;
}
default: