A game about forced loneliness, made by TACStudios
1using System.Reflection;
2using UnityEngine;
3
4namespace UnityEditor.ShaderGraph
5{
6 [Title("Math", "Range", "Remap")]
7 class RemapNode : CodeFunctionNode
8 {
9 public RemapNode()
10 {
11 name = "Remap";
12 }
13
14 protected override MethodInfo GetFunctionToConvert()
15 {
16 return GetType().GetMethod("Unity_Remap", BindingFlags.Static | BindingFlags.NonPublic);
17 }
18
19 static string Unity_Remap(
20 [Slot(0, Binding.None, -1, -1, -1, -1)] DynamicDimensionVector In,
21 [Slot(1, Binding.None, -1, 1, 0, 0)] Vector2 InMinMax,
22 [Slot(2, Binding.None, 0, 1, 0, 0)] Vector2 OutMinMax,
23 [Slot(3, Binding.None)] out DynamicDimensionVector Out)
24 {
25 return
26@"
27{
28 Out = OutMinMax.x + (In - InMinMax.x) * (OutMinMax.y - OutMinMax.x) / (InMinMax.y - InMinMax.x);
29}
30";
31 }
32 }
33}