Added Node
This commit is contained in:
@@ -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),
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user