namespace UnityEngine.MaterialGraph { [Title("UV/UV Tile")] public class UVTileNode : Function2Input, IGeneratesFunction { public UVTileNode() { name = "UVTile"; } protected override string GetFunctionName() { return "unity_uvtile_" + precision; } protected override string GetInputSlot1Name() { return "UV"; } protected override MaterialSlot GetInputSlot1() { return new MaterialSlot(InputSlot1Id, GetInputSlot1Name(), kInputSlot1ShaderName, UnityEngine.Graphing.SlotType.Input, SlotValueType.Vector2, Vector2.zero); } protected override string GetInputSlot2Name() { return "Tile Factor (X,Y)"; } protected override MaterialSlot GetInputSlot2() { return new MaterialSlot(InputSlot2Id, GetInputSlot2Name(), kInputSlot2ShaderName, UnityEngine.Graphing.SlotType.Input, SlotValueType.Vector2, Vector2.zero); } protected override MaterialSlot GetOutputSlot() { return new MaterialSlot(OutputSlotId, GetOutputSlotName(), kOutputSlotShaderName, UnityEngine.Graphing.SlotType.Output, SlotValueType.Vector2, Vector2.zero); } public void GenerateNodeFunction(ShaderGenerator visitor, GenerationMode generationMode) { var outputString = new ShaderGenerator(); outputString.AddShaderChunk(GetFunctionPrototype("uv", "tileFactor"), false); outputString.AddShaderChunk("{", false); outputString.Indent(); outputString.AddShaderChunk("return uv * tileFactor;", false); outputString.Deindent(); outputString.AddShaderChunk("}", false); visitor.AddShaderChunk(outputString.GetShaderString(0), true); } } }