Added Node

This commit is contained in:
W2.Wizard
2021-01-26 19:26:38 +01:00
parent 054aa18e31
commit 96e5e20e66
2 changed files with 30 additions and 0 deletions

View File

@@ -701,6 +701,26 @@ namespace FlaxEditor.Surface.Archetypes
NodeElementArchetype.Factory.Output(0, string.Empty, typeof(float), 5), NodeElementArchetype.Factory.Output(0, string.Empty, typeof(float), 5),
} }
}, },
new NodeArchetype
{
TypeID = 29,
Title = "UV Tiling & Offset",
Description = "Takes UVs and applies tiling and offset",
Flags = NodeFlags.MaterialGraph,
Size = new Vector2(150, 60),
DefaultValues = new object[]
{
new Vector2(1, 1),
new Vector2(0, 0)
},
Elements = new[]
{
NodeElementArchetype.Factory.Input(0, "UV", true, typeof(Vector2), 0),
NodeElementArchetype.Factory.Input(1, "Tiling", true, typeof(Vector2), 1, 0),
NodeElementArchetype.Factory.Input(2, "Offset", true, typeof(Vector2), 2, 1),
NodeElementArchetype.Factory.Output(0, string.Empty, typeof(Vector2), 3),
}
}
}; };
} }
} }

View File

@@ -381,6 +381,16 @@ void MaterialGenerator::ProcessGroupMaterial(Box* box, Node* node, Value& value)
value = writeLocal(ValueType::Float, String::Format(TEXT("{0} ? (1 - {1}) : {1}"), invert.Value, x2.Value), node); value = writeLocal(ValueType::Float, String::Format(TEXT("{0} ? (1 - {1}) : {1}"), invert.Value, x2.Value), node);
break; break;
}
// Tiling & Offset
case 29:
{
auto uv = tryGetValue(node->GetBox(0), getUVs).AsVector2();
auto tiling = tryGetValue(node->GetBox(1), node->Values[0]).AsVector2();
auto offset = tryGetValue(node->GetBox(2), node->Values[1]).AsVector2();
value = writeLocal(ValueType::Vector2, String::Format(TEXT("{0} * {1} + {2}"), uv.Value, tiling.Value, offset.Value), node);
break;
} }
default: default:
break; break;