Fixes and improvements

This commit is contained in:
Wojciech Figat
2021-11-18 11:21:30 +01:00
parent 2a2b70f83f
commit cdcb2f8f7a
15 changed files with 46 additions and 48 deletions

View File

@@ -56,10 +56,8 @@ void MaterialGenerator::ProcessGroupMaterial(Box* box, Node* node, Value& value)
}
// Screen Size
case 7:
{
value = Value(VariantType::Vector2, box->ID == 0 ? TEXT("ScreenSize.xy") : TEXT("ScreenSize.zw"));
break;
}
// Custom code
case 8:
{
@@ -331,7 +329,7 @@ void MaterialGenerator::ProcessGroupMaterial(Box* box, Node* node, Value& value)
// Evaluate the function output
_graphStack.Push(graph);
value = functionOutputBox && functionOutputBox->HasConnection() ? eatBox(node, functionOutputBox->FirstConnection()) : Value::Zero;
value = tryGetValue(functionOutputBox, Value::Zero);
_graphStack.Pop();
break;
}
@@ -400,7 +398,6 @@ void MaterialGenerator::ProcessGroupMaterial(Box* box, Node* node, Value& value)
case 30:
{
const auto inValue = tryGetValue(node->GetBox(0), 0, Value::Zero);
value = writeLocal(inValue.Type, String::Format(TEXT("ddx({0})"), inValue.Value), node);
break;
}
@@ -408,7 +405,6 @@ void MaterialGenerator::ProcessGroupMaterial(Box* box, Node* node, Value& value)
case 31:
{
const auto inValue = tryGetValue(node->GetBox(0), 0, Value::Zero);
value = writeLocal(inValue.Type, String::Format(TEXT("ddy({0})"), inValue.Value), node);
break;
}
@@ -416,7 +412,6 @@ void MaterialGenerator::ProcessGroupMaterial(Box* box, Node* node, Value& value)
case 32:
{
const auto inValue = tryGetValue(node->GetBox(0), 0, Value::Zero);
value = writeLocal(ValueType::Float, String::Format(TEXT("sign({0})"), inValue.Value), node);
break;
}
@@ -424,7 +419,6 @@ void MaterialGenerator::ProcessGroupMaterial(Box* box, Node* node, Value& value)
case 33:
{
const auto inValue = tryGetValue(node->GetBox(0), 0, Value::Zero);
value = writeLocal(ValueType::Bool, String::Format(TEXT("any({0})"), inValue.Value), node);
break;
}
@@ -432,7 +426,6 @@ void MaterialGenerator::ProcessGroupMaterial(Box* box, Node* node, Value& value)
case 34:
{
const auto inValue = tryGetValue(node->GetBox(0), 0, Value::Zero);
value = writeLocal(ValueType::Bool, String::Format(TEXT("all({0})"), inValue.Value), node);
break;
}