Merge branch 'RotationMaterialNode' of git://github.com/W2Wizard/FlaxEngine into W2Wizard-RotationMaterialNode

# Conflicts:
#	Source/Engine/Tools/MaterialGenerator/MaterialGenerator.Material.cpp
This commit is contained in:
Wojtek Figat
2021-01-24 18:57:44 +01:00
2 changed files with 31 additions and 0 deletions

View File

@@ -347,6 +347,22 @@ void MaterialGenerator::ProcessGroupMaterial(Box* box, Node* node, Value& value)
const String text = String::Format(TEXT("float3((float2({0}.xy) + float2({1}.xy) * 2.0), sqrt(saturate(1.0 - dot((float2({0}.xy) + float2({1}.xy) * 2.0).xy, (float2({0}.xy) + float2({1}.xy) * 2.0).xy))))"), baseNormal.Value, additionalNormal.Value);
value = writeLocal(ValueType::Vector3, text, node);
break;
}
// Rotator
case 27:
{
auto UV = tryGetValue(node->GetBox(0), Value::Zero).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 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);
break;
}
default:
break;