A game about forced loneliness, made by TACStudios
1using System.Reflection;
2using UnityEngine;
3
4namespace UnityEditor.ShaderGraph
5{
6 [Title("Utility", "Preview")]
7 class PreviewNode : CodeFunctionNode
8 {
9 public override bool hasPreview { get { return true; } }
10
11 [SerializeField]
12 float m_Width;
13
14 [SerializeField]
15 float m_Height;
16
17 public void SetDimensions(float width, float height)
18 {
19 float newSize = Mathf.Clamp(Mathf.Min(width, height), 150f, 1000f);
20
21 m_Width = newSize;
22 m_Height = newSize;
23 }
24
25 public float width
26 {
27 get { return m_Width; }
28 }
29
30 public float height
31 {
32 get { return m_Height; }
33 }
34
35 public PreviewNode()
36 {
37 name = "Preview";
38
39 m_Width = 208f;
40 m_Height = 208f;
41 }
42
43 protected override MethodInfo GetFunctionToConvert()
44 {
45 return GetType().GetMethod("Unity_Preview", BindingFlags.Static | BindingFlags.NonPublic);
46 }
47
48 static string Unity_Preview(
49 [Slot(0, Binding.None)] DynamicDimensionVector In,
50 [Slot(1, Binding.None)] out DynamicDimensionVector Out)
51 {
52 return
53@"
54{
55 Out = In;
56}
57";
58 }
59 }
60}