A game about forced loneliness, made by TACStudios
1namespace UnityEditor.ShaderGraph
2{
3 /*abstract class FunctionMultiInput : BaseMaterialNode, IGeneratesBodyCode
4 {
5 private const string kOutputSlotName = "Output";
6 private const string kBaseInputSlotName = "Input";
7
8 public override bool hasPreview { get { return true; } }
9
10 public override void OnCreate()
11 {
12 base.OnCreate();
13 AddSlot(new Slot(SlotType.OutputSlot, kOutputSlotName));
14
15 AddSlot(new Slot(SlotType.InputSlot, GetInputSlotName(0)));
16 AddSlot(new Slot(SlotType.InputSlot, GetInputSlotName(1)));
17 }
18
19 protected bool IsInputSlotConnected(int index)
20 {
21 var inputSlot = GetValidInputSlots().FirstOrDefault(x => x.name == GetInputSlotName(index));
22 if (inputSlot == null)
23 {
24 Debug.LogError("Invalid slot configuration on node: " + name);
25 return false;
26 }
27
28 return inputSlot.edges.Count > 0;
29 }
30
31 private static string GetInputSlotName(int index) { return kBaseInputSlotName + (index); }
32
33 public override void InputEdgeChanged(Edge e)
34 {
35 base.InputEdgeChanged(e);
36
37 int inputSlotCount = GetValidInputSlots().Count();
38
39 if (IsInputSlotConnected(inputSlotCount - 1))
40 AddSlot(new Slot(SlotType.InputSlot, GetInputSlotName(inputSlotCount)));
41 else if (inputSlotCount > 2)
42 {
43 var lastSlot = inputSlots.FirstOrDefault(x => x.name == GetInputSlotName(inputSlotCount - 1));
44 if (lastSlot != null)
45 RemoveSlot(lastSlot);
46 }
47 }
48
49 protected abstract string GetFunctionName();
50
51 public void GenerateNodeCode(ShaderGenerator visitor, GenerationMode generationMode)
52 {
53 var outputSlot = outputSlots.FirstOrDefault(x => x.name == kOutputSlotName);
54
55 if (outputSlot == null)
56 {
57 Debug.LogError("Invalid slot configuration on node: " + name);
58 return;
59 }
60
61 var inputSlots = GetValidInputSlots();
62 int inputSlotCount = inputSlots.Count();
63
64 // build up a list of the valid input connections
65 var inputValues = new List<string>(inputSlotCount);
66 MaterialWindow.DebugMaterialGraph("Generating On Node: " + GetOutputVariableNameForNode() + " - Preview is: " + generationMode);
67 inputValues.AddRange(inputSlots.Select(inputSlot => GetSlotValue(inputSlot, generationMode)));
68 visitor.AddShaderChunk(precision + "4 " + GetVariableNameForSlot(outputSlot, generationMode) + " = " + GetFunctionCallBody(inputValues) + ";", true);
69 }
70
71 protected virtual string GetFunctionCallBody(List<string> inputValues)
72 {
73 string functionCall = inputValues[0];
74 for (int q = 1; q < inputValues.Count; ++q)
75 functionCall = GetFunctionName() + " (" + functionCall + ", " + inputValues[q] + ")";
76 return functionCall;
77 }
78 }*/
79}