浏览代码

Input Part 1

Input/Basic (WIP)
Input/Scene (WIP)
/main
Matt Dean 7 年前
当前提交
a3c5d049
共有 30 个文件被更改,包括 143 次插入123 次删除
  1. 4
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/ColorNode.cs
  2. 12
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/Vector1Node.cs
  3. 6
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/Vector2Node.cs
  4. 6
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/Vector3Node.cs
  5. 6
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/Vector4Node.cs
  6. 43
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Scene/CameraNode.cs
  7. 41
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Scene/LightProbeNode.cs
  8. 42
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Scene/ReflectionProbeNode.cs
  9. 48
      MaterialGraphProject/Assets/NewNodes/Editor/Keep/LightProbeNode.cs
  10. 49
      MaterialGraphProject/Assets/NewNodes/Editor/Keep/ReflectionProbeNode.cs
  11. 9
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Vector.meta
  12. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Scene.meta
  13. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Scene/LightProbeNode.cs.meta
  14. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Scene/ReflectionProbeNode.cs.meta
  15. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/ColorNode.cs.meta
  16. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/ColorNode.cs
  17. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Scene/ScreenPosNode.cs.meta
  18. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Scene/CameraNode.cs.meta
  19. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Scene/ScreenPosNode.cs
  20. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/Vector4Node.cs.meta
  21. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/Vector3Node.cs.meta
  22. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/Vector2Node.cs.meta
  23. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/Vector1Node.cs.meta
  24. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/Vector1Node.cs
  25. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/Vector2Node.cs
  26. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/Vector3Node.cs
  27. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/Vector4Node.cs

4
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/ColorNode.cs


namespace UnityEngine.MaterialGraph
{
[Title("Input/Color")]
[Title("Input/Basic/Color")]
public class ColorNode : AbstractMaterialNode, IGeneratesBodyCode
{
[SerializeField]

private const string kOutputSlotName = "Color";
private const string kOutputSlotName = "Out";
public ColorNode()
{

12
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/Vector1Node.cs


namespace UnityEngine.MaterialGraph
{
[Title("Input/Vector/Vector 1")]
[Title("Input/Basic/Vector 1")]
public const int OutputSlotId = 0;
private const string kOutputSlotName = "Out";
// [SerializeField]
// [SerializeField]
public const int OutputSlotId = 0;
private const string kOutputSlotName = "Value";
name = "Vector1";
name = "Vector 1";
UpdateNodeAfterDeserialization();
}

6
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/Vector2Node.cs


namespace UnityEngine.MaterialGraph
{
[Title("Input/Vector/Vector 2")]
[Title("Input/Basic/Vector 2")]
public class Vector2Node : AbstractMaterialNode, IGeneratesBodyCode
{
[SerializeField]

private const string kOutputSlotName = "Value";
private const string kOutputSlotName = "Out";
name = "Vector2";
name = "Vector 2";
UpdateNodeAfterDeserialization();
}

6
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/Vector3Node.cs


namespace UnityEngine.MaterialGraph
{
[Title("Input/Vector/Vector 3")]
[Title("Input/Basic/Vector 3")]
public class Vector3Node : AbstractMaterialNode, IGeneratesBodyCode
{
[SerializeField]

private const string kOutputSlotName = "Value";
private const string kOutputSlotName = "Out";
name = "Vector3";
name = "Vector 3";
UpdateNodeAfterDeserialization();
}

6
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/Vector4Node.cs


namespace UnityEngine.MaterialGraph
{
[Title("Input/Vector/Vector 4")]
[Title("Input/Basic/Vector 4")]
public class Vector4Node : AbstractMaterialNode, IGeneratesBodyCode
{
[SerializeField]

private const string kOutputSlotName = "Value";
private const string kOutputSlotName = "Out";
name = "Vector4";
name = "Vector 4";
UpdateNodeAfterDeserialization();
}

43
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Scene/CameraNode.cs


using UnityEngine.Graphing;
namespace UnityEngine.MaterialGraph
{
[Title("Input/Scene/Camera")]
public class CameraNode : AbstractMaterialNode
{
private const string kOutputSlotName = "Pos";
private const string kOutputSlot2Name = "Dir";
public const int OutputSlotId = 0;
public const int OutputSlot2Id = 1;
public CameraNode()
{
name = "Camera";
UpdateNodeAfterDeserialization();
}
public sealed override void UpdateNodeAfterDeserialization()
{
AddSlot(new Vector3MaterialSlot(OutputSlotId, kOutputSlotName, kOutputSlotName, SlotType.Output, Vector3.zero));
AddSlot(new Vector3MaterialSlot(OutputSlot2Id, kOutputSlot2Name, kOutputSlot2Name, SlotType.Output, Vector3.zero));
RemoveSlotsNameNotMatching(validSlots);
}
protected int[] validSlots
{
get { return new[] { OutputSlotId, OutputSlot2Id }; }
}
public override string GetVariableNameForSlot(int slotId)
{
switch (slotId)
{
case OutputSlot2Id:
return "mul(unity_ObjectToWorld, UNITY_MATRIX_IT_MV [2].xyz)";
default:
return "_WorldSpaceCameraPos";
}
}
}
}

41
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Scene/LightProbeNode.cs


using System.Reflection;
namespace UnityEngine.MaterialGraph
{
[Title("Input/Scene/Light Probe")]
public class LightProbeNode : CodeFunctionNode
{
//public override bool hasPreview { get { return false; } }
public LightProbeNode()
{
name = "Light Probe";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_LightProbe", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_LightProbe(
[Slot(0, Binding.WorldSpaceNormal)] Vector3 Normal,
[Slot(1, Binding.None)] out Vector3 Out)
{
Out = Vector3.one;
return
@"
{
Out = ShadeSH9(float4(Normal , 1));
}
";
}
public override PreviewMode previewMode
{
get
{
return PreviewMode.Preview3D;
}
}
}
}

42
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Scene/ReflectionProbeNode.cs


using System.Reflection;
namespace UnityEngine.MaterialGraph
{
[Title("Input/Scene/Reflection Probe")]
public class ReflectionProbeNode : CodeFunctionNode
{
public ReflectionProbeNode()
{
name = "Reflection Probe";
}
public override PreviewMode previewMode
{
get
{
return PreviewMode.Preview3D;
}
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_ReflectionProbe", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_ReflectionProbe(
[Slot(0, Binding.ObjectSpaceViewDirection)] Vector3 ViewDir,
[Slot(1, Binding.ObjectSpaceNormal)] Vector3 Normal,
[Slot(2, Binding.None)] Vector1 LOD,
[Slot(3, Binding.None)] out Vector3 Out)
{
Out = Vector3.one;
return
@"
{
{precision}3 reflectVec = reflect(-ViewDir, Normal);
Out = DecodeHDR(UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, reflectVec, LOD), unity_SpecCube0_HDR);
}
";
}
}
}

48
MaterialGraphProject/Assets/NewNodes/Editor/Keep/LightProbeNode.cs


using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
#if UNITY_EDITOR
using UnityEditor;
#endif
using UnityEngine.Graphing;
namespace UnityEngine.MaterialGraph
{
[Title("Input/Scene Data/Light Probe")]
public class LightProbeNode : CodeFunctionNode
{
public override bool hasPreview { get { return false; } }
public LightProbeNode()
{
name = "LightProbe";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_LightProbe", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_LightProbe(
[Slot(0, Binding.WorldSpaceNormal)] Vector3 worldSpaceNormal,
[Slot(1, Binding.None)] out Vector4 color)
{
color = Vector4.one;
return
@"
{
color = ShadeSH9(float4(worlsSpaceNormal , 1));
}
";
}
public override PreviewMode previewMode
{
get
{
return PreviewMode.Preview3D;
}
}
}
}

49
MaterialGraphProject/Assets/NewNodes/Editor/Keep/ReflectionProbeNode.cs


using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
#if UNITY_EDITOR
using UnityEditor;
#endif
using UnityEngine.Graphing;
namespace UnityEngine.MaterialGraph
{
[Title("Input/Scene Data/Reflection Probe")]
public class ReflectionProbeNode : CodeFunctionNode
{
public ReflectionProbeNode()
{
name = "ReflectionProbe";
}
public override PreviewMode previewMode
{
get
{
return PreviewMode.Preview3D;
}
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_ReflectionProbe", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_ReflectionProbe(
[Slot(0, Binding.ObjectSpaceNormal)] Vector3 viewDirection,
[Slot(1, Binding.ObjectSpaceViewDirection)] Vector3 worldSpaceNormal,
[Slot(2, Binding.None)] Vector1 lod,
[Slot(3, Binding.None)] out Vector4 color)
{
color = Vector4.one;
return
@"
{
{precision}3 reflect = reflect(-viewDirection, worldSpaceNormal);
color = DecodeHDR(UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, reflect, lod), unity_SpecCube0_HDR);
}
";
}
}
}

9
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Vector.meta


fileFormatVersion: 2
guid: 1ccfba538a5b85b43a9d78f3057e00f2
folderAsset: yes
timeCreated: 1495526799
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/SceneData.meta → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Scene.meta

/MaterialGraphProject/Assets/NewNodes/Editor/Keep/LightProbeNode.cs.meta → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Scene/LightProbeNode.cs.meta

/MaterialGraphProject/Assets/NewNodes/Editor/Keep/ReflectionProbeNode.cs.meta → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Scene/ReflectionProbeNode.cs.meta

/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/ColorNode.cs.meta → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/ColorNode.cs.meta

/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/ColorNode.cs → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/ColorNode.cs

/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/SceneData/ScreenPosNode.cs.meta → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Scene/ScreenPosNode.cs.meta

/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/SceneData/CameraDirNode.cs.meta → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Scene/CameraNode.cs.meta

/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/SceneData/ScreenPosNode.cs → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Scene/ScreenPosNode.cs

/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Vector/Vector4Node.cs.meta → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/Vector4Node.cs.meta

/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Vector/Vector3Node.cs.meta → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/Vector3Node.cs.meta

/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Vector/Vector2Node.cs.meta → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/Vector2Node.cs.meta

/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Vector/Vector1Node.cs.meta → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/Vector1Node.cs.meta

/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Vector/Vector1Node.cs → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/Vector1Node.cs

/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Vector/Vector2Node.cs → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/Vector2Node.cs

/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Vector/Vector3Node.cs → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/Vector3Node.cs

/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Vector/Vector4Node.cs → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/Vector4Node.cs

正在加载...
取消
保存