|
|
|
|
|
|
namespace UnityEngine.MaterialGraph |
|
|
|
{ |
|
|
|
[Title("UV/Cartesian To Polar")] |
|
|
|
public class CartesianToPolarNode : Function3Input, IGeneratesFunction |
|
|
|
public class CartesianToPolarNode : Function1Input, IGeneratesFunction |
|
|
|
{ |
|
|
|
public CartesianToPolarNode() |
|
|
|
{ |
|
|
|
|
|
|
return "unity_cartesiantopolar_" + precision; |
|
|
|
} |
|
|
|
|
|
|
|
protected override string GetInputSlot1Name() |
|
|
|
protected override string GetInputSlotName() |
|
|
|
protected override string GetInputSlot2Name() |
|
|
|
{ |
|
|
|
return "HorizontalTileScale"; |
|
|
|
} |
|
|
|
|
|
|
|
protected override string GetInputSlot3Name() |
|
|
|
{ |
|
|
|
return "VerticalTileScale"; |
|
|
|
} |
|
|
|
|
|
|
|
protected override MaterialSlot GetInputSlot1() |
|
|
|
{ |
|
|
|
return new MaterialSlot(InputSlot1Id, GetInputSlot1Name(), kInputSlot1ShaderName, UnityEngine.Graphing.SlotType.Input, SlotValueType.Vector2, Vector2.zero); |
|
|
|
} |
|
|
|
|
|
|
|
protected override MaterialSlot GetInputSlot2() |
|
|
|
protected override MaterialSlot GetInputSlot() |
|
|
|
return new MaterialSlot(InputSlot2Id, GetInputSlot2Name(), kInputSlot2ShaderName, UnityEngine.Graphing.SlotType.Input, SlotValueType.Vector1, Vector4.zero); |
|
|
|
} |
|
|
|
|
|
|
|
protected override MaterialSlot GetInputSlot3() |
|
|
|
{ |
|
|
|
return new MaterialSlot(InputSlot3Id, GetInputSlot3Name(), kInputSlot3ShaderName, UnityEngine.Graphing.SlotType.Input, SlotValueType.Vector1, Vector4.zero); |
|
|
|
} |
|
|
|
protected override MaterialSlot GetOutputSlot() |
|
|
|
{ |
|
|
|
return new MaterialSlot(OutputSlotId, GetOutputSlotName(), kOutputSlotShaderName, UnityEngine.Graphing.SlotType.Output, SlotValueType.Vector2, Vector2.zero); |
|
|
|
return new MaterialSlot(InputSlotId, GetInputSlotName(), kInputSlotShaderName, UnityEngine.Graphing.SlotType.Input, SlotValueType.Vector2, Vector2.zero); |
|
|
|
outputString.AddShaderChunk(GetFunctionPrototype("uv", "horizontalTileScale", "verticalTileScale"), false); |
|
|
|
outputString.AddShaderChunk(GetFunctionPrototype("uv"), false); |
|
|
|
outputString.AddShaderChunk("{", false); |
|
|
|
outputString.Indent(); |
|
|
|
outputString.AddShaderChunk("float radius = length(uv);", false); |
|
|
|