浏览代码

Fixes for PR

- Rename Tangent/Normal/Bitangent nodes
- Make GetHLSLSafeNAme static
- Rename MatrixCommonNode > TransformationMatrixNode
- Rename enums for Log and Exponential base
- String interpolation > Switch statement
- Full names for all Trigonometry nodes
- Rename Reflect/Project/Reject > Reflection/Projection/Rejection
- Rename Fresnel/FresnelEffect
- Rename unit enum in RotateNode (remove duplicate in UVTransform)
- Add min/max clamp to Gradient2D evaluation
/main
Matt Dean 7 年前
当前提交
e44629cb
共有 65 个文件被更改,包括 735 次插入672 次删除
  1. 5
      MaterialGraphProject/Assets/NewNodes/Editor/Kill/UVTransform.cs
  2. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/AbstractMaterialGraph.cs
  3. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/AbstractMaterialNode.cs
  4. 7
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Gradient/Gradient2DNode.cs
  5. 32
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/ExponentialNode.cs
  6. 36
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/LogNode.cs
  7. 49
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/ReciprocalNode.cs
  8. 11
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Derivative/DDXNode.cs
  9. 11
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Derivative/DDXYNode.cs
  10. 11
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Derivative/DDYNode.cs
  11. 17
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/UV/RotateNode.cs
  12. 34
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/BitangentVectorNode.cs
  13. 34
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/NormalVectorNode.cs
  14. 34
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/TangentVectorNode.cs
  15. 83
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Matrix/TransformationMatrixNode.cs
  16. 30
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/ArccosineNode.cs
  17. 30
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/ArcsineNode.cs
  18. 31
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/Arctangent2Node.cs
  19. 30
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/ArctangentNode.cs
  20. 30
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/CosineNode.cs
  21. 30
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/HyperbolicCosineNode.cs
  22. 30
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/HyperbolicSineNode.cs
  23. 30
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/HyperbolicTangentNode.cs
  24. 30
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/SineNode.cs
  25. 30
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/TangentNode.cs
  26. 33
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Vector/FresnelEffectNode.cs
  27. 30
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Vector/ProjectionNode.cs
  28. 32
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Vector/ReflectionNode.cs
  29. 31
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Vector/RejectionNode.cs
  30. 34
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/BitangentNode.cs
  31. 34
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/NormalNode.cs
  32. 34
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/TangentNode.cs
  33. 83
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Matrix/MatrixCommonNode.cs
  34. 30
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/ArcCosNode.cs
  35. 30
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/ArcSinNode.cs
  36. 31
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/ArcTan2Node.cs
  37. 30
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/ArcTanNode.cs
  38. 30
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/CosNode.cs
  39. 30
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/HyperbolicCosNode.cs
  40. 30
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/HyperbolicSinNode.cs
  41. 30
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/HyperbolicTanNode.cs
  42. 30
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/SinNode.cs
  43. 30
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/TanNode.cs
  44. 33
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Vector/FresnelNode.cs
  45. 30
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Vector/ProjectNode.cs
  46. 32
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Vector/ReflectNode.cs
  47. 31
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Vector/RejectNode.cs
  48. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/BitangentVectorNode.cs.meta
  49. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/NormalVectorNode.cs.meta
  50. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/TangentVectorNode.cs.meta
  51. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Matrix/TransformationMatrixNode.cs.meta
  52. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/ArccosineNode.cs.meta
  53. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/ArcsineNode.cs.meta
  54. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/Arctangent2Node.cs.meta
  55. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/ArctangentNode.cs.meta
  56. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/CosineNode.cs.meta
  57. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/HyperbolicCosineNode.cs.meta
  58. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/HyperbolicSineNode.cs.meta
  59. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/HyperbolicTangentNode.cs.meta
  60. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/SineNode.cs.meta
  61. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/TangentNode.cs.meta
  62. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Vector/FresnelEffectNode.cs.meta
  63. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Vector/ProjectionNode.cs.meta
  64. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Vector/ReflectionNode.cs.meta
  65. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Vector/RejectionNode.cs.meta

5
MaterialGraphProject/Assets/NewNodes/Editor/Kill/UVTransform.cs


namespace UnityEditor.ShaderGraph
{
public enum RotationUnit
{
Radians,
Degrees
};
[Title("OLD/Transform")]
public class UVTransform : CodeFunctionNode
{

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/AbstractMaterialGraph.cs


{
fullName = "UnityEngine.MaterialGraph.NormalNode"
};
result[normalNode] = SerializationHelper.GetTypeSerializableAsString(typeof(NormalNode));
result[normalNode] = SerializationHelper.GetTypeSerializableAsString(typeof(NormalVectorNode));
var worldPosNode = new SerializationHelper.TypeSerializationInfo
{

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/AbstractMaterialNode.cs


return GetHLSLSafeName(name) + "_" + GuidEncoder.Encode(guid);
}
public virtual string GetHLSLSafeName(string input)
public static string GetHLSLSafeName(string input)
{
char[] arr = input.ToCharArray();
arr = Array.FindAll<char>(arr, (c => (char.IsLetterOrDigit(c))));

7
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Gradient/Gradient2DNode.cs


return GetType().GetMethod("Unity_Gradient2D", BindingFlags.Static | BindingFlags.NonPublic);
}
//visitor.AddShaderChunk("Gradient ShaderGraph_DefaultGradient;", true);
//visitor.AddShaderChunk("DefaultGradient(ShaderGraph_DefaultGradient);", true);
static string Unity_Gradient2D(
[Slot(0, Binding.None)] Gradient Gradient,
[Slot(1, Binding.None)] Vector1 Time,

break;
}
float colorPos = (Time - Gradient.colors[colorKey1].w) / (Gradient.colors[colorKey2].w - Gradient.colors[colorKey1].w);
float colorPos = min(1, max(0, (Time - Gradient.colors[colorKey1].w) / (Gradient.colors[colorKey2].w - Gradient.colors[colorKey1].w)));
float alphaPos = (Time - Gradient.alphas[alphaKey1].y) / (Gradient.alphas[alphaKey2].y - Gradient.alphas[alphaKey1].y);
float alphaPos = min(1, max(0, (Time - Gradient.alphas[alphaKey1].y) / (Gradient.alphas[alphaKey2].y - Gradient.alphas[alphaKey1].y)));
float alpha = lerp(Gradient.alphas[alphaKey1].r, Gradient.alphas[alphaKey2].r, alphaPos);
Out = float4(color, alpha);
}

32
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/ExponentialNode.cs


namespace UnityEditor.ShaderGraph
{
public enum ExponentialType
public enum ExponentialBase
Exponential,
Exponential2
BaseE,
Base2
};
[Title("Math/Advanced/Exponential")]

}
[SerializeField]
private ExponentialType m_ExponentialType = ExponentialType.Exponential;
private ExponentialBase m_ExponentialBase = ExponentialBase.BaseE;
[EnumControl("")]
public ExponentialType exponentialType
[EnumControl("Base")]
public ExponentialBase exponentialBase
get { return m_ExponentialType; }
get { return m_ExponentialBase; }
if (m_ExponentialType == value)
if (m_ExponentialBase == value)
m_ExponentialType = value;
m_ExponentialBase = value;
if (onModified != null)
{
onModified(this, ModificationScope.Graph);

string GetCurrentType()
{
return System.Enum.GetName(typeof(ExponentialType), m_ExponentialType);
}
return GetType().GetMethod(string.Format("Unity_{0}", GetCurrentType()),
BindingFlags.Static | BindingFlags.NonPublic);
switch (m_ExponentialBase)
{
case ExponentialBase.Base2:
return GetType().GetMethod("Unity_Exponential2", BindingFlags.Static | BindingFlags.NonPublic);
default:
return GetType().GetMethod("Unity_Exponential", BindingFlags.Static | BindingFlags.NonPublic);
}
}
static string Unity_Exponential(

36
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/LogNode.cs


namespace UnityEditor.ShaderGraph
{
public enum LogType
public enum LogBase
Log,
Log2,
Log10
BaseE,
Base2,
Base10
};
[Title("Math/Advanced/Log")]

}
[SerializeField]
private LogType m_LogType = LogType.Log;
private LogBase m_LogBase = LogBase.BaseE;
[EnumControl("")]
public LogType logType
[EnumControl("Base")]
public LogBase logBase
get { return m_LogType; }
get { return m_LogBase; }
if (m_LogType == value)
if (m_LogBase == value)
m_LogType = value;
m_LogBase = value;
if (onModified != null)
{
onModified(this, ModificationScope.Graph);

string GetCurrentType()
{
return System.Enum.GetName(typeof(LogType), m_LogType);
}
return GetType().GetMethod(string.Format("Unity_{0}", GetCurrentType()),
BindingFlags.Static | BindingFlags.NonPublic);
switch (m_LogBase)
{
case LogBase.Base2:
return GetType().GetMethod("Unity_Log2", BindingFlags.Static | BindingFlags.NonPublic);
case LogBase.Base10:
return GetType().GetMethod("Unity_Log10", BindingFlags.Static | BindingFlags.NonPublic);
default:
return GetType().GetMethod("Unity_Log", BindingFlags.Static | BindingFlags.NonPublic);
}
}
static string Unity_Log(

49
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/ReciprocalNode.cs


using System.Reflection;
using UnityEngine;
using UnityEditor.Graphing;
using UnityEditor.ShaderGraph.Drawing.Controls;
public enum ReciprocalMethod
{
Default,
Fast
};
[Title("Math/Advanced/Reciprocal")]
public class ReciprocalNode : CodeFunctionNode
{

}
[SerializeField]
private ReciprocalMethod m_ReciprocalMethod = ReciprocalMethod.Default;
[EnumControl("Method")]
public ReciprocalMethod reciprocalMethod
{
get { return m_ReciprocalMethod; }
set
{
if (m_ReciprocalMethod == value)
return;
m_ReciprocalMethod = value;
if (onModified != null)
{
onModified(this, ModificationScope.Graph);
}
}
}
return GetType().GetMethod("Unity_Reciprocal", BindingFlags.Static | BindingFlags.NonPublic);
switch (m_ReciprocalMethod)
{
case ReciprocalMethod.Fast:
return GetType().GetMethod("Unity_Reciprocal_Fast", BindingFlags.Static | BindingFlags.NonPublic);
default:
return GetType().GetMethod("Unity_Reciprocal", BindingFlags.Static | BindingFlags.NonPublic);
}
}
static string Unity_Reciprocal(

@"
{
Out = 1.0/In;
}
";
}
static string Unity_Reciprocal_Fast(
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] out DynamicDimensionVector Out)
{
return
@"
{
Out = rcp(In);
}
";
}

11
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Derivative/DDXNode.cs


protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod(string.Format("Unity_DDX_{0}", GetCurrentPrecision()),
BindingFlags.Static | BindingFlags.NonPublic);
switch (m_PartialDerivativePrecision)
{
case PartialDerivativePrecision.Fine:
return GetType().GetMethod("Unity_DDX_Fine", BindingFlags.Static | BindingFlags.NonPublic);
case PartialDerivativePrecision.Coarse:
return GetType().GetMethod("Unity_DDX_Coarse", BindingFlags.Static | BindingFlags.NonPublic);
default:
return GetType().GetMethod("Unity_DDX_Default", BindingFlags.Static | BindingFlags.NonPublic);
}
}
static string Unity_DDX_Default(

11
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Derivative/DDXYNode.cs


protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod(string.Format("Unity_DDXY_{0}", GetCurrentPrecision()),
BindingFlags.Static | BindingFlags.NonPublic);
switch (m_PartialDerivativePrecision)
{
case PartialDerivativePrecision.Fine:
return GetType().GetMethod("Unity_DDXY_Fine", BindingFlags.Static | BindingFlags.NonPublic);
case PartialDerivativePrecision.Coarse:
return GetType().GetMethod("Unity_DDXY_Coarse", BindingFlags.Static | BindingFlags.NonPublic);
default:
return GetType().GetMethod("Unity_DDXY_Default", BindingFlags.Static | BindingFlags.NonPublic);
}
}
static string Unity_DDXY_Default(

11
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Derivative/DDYNode.cs


protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod(string.Format("Unity_DDY_{0}", GetCurrentPrecision()),
BindingFlags.Static | BindingFlags.NonPublic);
switch (m_PartialDerivativePrecision)
{
case PartialDerivativePrecision.Fine:
return GetType().GetMethod("Unity_DDY_Fine", BindingFlags.Static | BindingFlags.NonPublic);
case PartialDerivativePrecision.Coarse:
return GetType().GetMethod("Unity_DDY_Coarse", BindingFlags.Static | BindingFlags.NonPublic);
default:
return GetType().GetMethod("Unity_DDY_Default", BindingFlags.Static | BindingFlags.NonPublic);
}
}
static string Unity_DDY_Default(

17
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/UV/RotateNode.cs


namespace UnityEditor.ShaderGraph
{
public enum Unit
public enum RotationUnit
private Unit m_constant = Unit.Radians;
private RotationUnit m_Unit = RotationUnit.Radians;
[EnumControl("")]
public Unit constant
[EnumControl("Unit")]
public RotationUnit unit
get { return m_constant; }
get { return m_Unit; }
if (m_constant == value)
if (m_Unit == value)
m_constant = value;
m_Unit = value;
if (onModified != null)
{
onModified(this, ModificationScope.Graph);

protected override MethodInfo GetFunctionToConvert()
{
if(m_constant == Unit.Radians)
if(m_Unit == RotationUnit.Radians)
return GetType().GetMethod("Unity_Rotate_Radians", BindingFlags.Static | BindingFlags.NonPublic);
else
return GetType().GetMethod("Unity_Rotate_Degrees", BindingFlags.Static | BindingFlags.NonPublic);

34
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/BitangentVectorNode.cs


using UnityEngine;
using UnityEditor.Graphing;
namespace UnityEditor.ShaderGraph
{
[Title("Input/Geometry/Bitangent Vector")]
public class BitangentVectorNode : GeometryNode, IMayRequireBitangent
{
public const int kOutputSlotId = 0;
public const string kOutputSlotName = "Out";
public BitangentVectorNode()
{
name = "Bitangent Vector";
UpdateNodeAfterDeserialization();
}
public sealed override void UpdateNodeAfterDeserialization()
{
AddSlot(new Vector3MaterialSlot(kOutputSlotId, kOutputSlotName, kOutputSlotName, SlotType.Output, new Vector4(0, 0, 1)));
RemoveSlotsNameNotMatching(new[] { kOutputSlotId });
}
public override string GetVariableNameForSlot(int slotId)
{
return space.ToVariableName(InterpolatorType.BiTangent);
}
public NeededCoordinateSpace RequiresBitangent()
{
return space.ToNeededCoordinateSpace();
}
}
}

34
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/NormalVectorNode.cs


using UnityEngine;
using UnityEditor.Graphing;
namespace UnityEditor.ShaderGraph
{
[Title("Input/Geometry/Normal Vector")]
public class NormalVectorNode : GeometryNode, IMayRequireNormal
{
public const int kOutputSlotId = 0;
public const string kOutputSlotName = "Out";
public NormalVectorNode()
{
name = "Normal Vector";
UpdateNodeAfterDeserialization();
}
public sealed override void UpdateNodeAfterDeserialization()
{
AddSlot(new Vector3MaterialSlot(kOutputSlotId, kOutputSlotName, kOutputSlotName, SlotType.Output, new Vector4(0, 0, 1)));
RemoveSlotsNameNotMatching(new[] { kOutputSlotId });
}
public override string GetVariableNameForSlot(int slotId)
{
return space.ToVariableName(InterpolatorType.Normal);
}
public NeededCoordinateSpace RequiresNormal()
{
return space.ToNeededCoordinateSpace();
}
}
}

34
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/TangentVectorNode.cs


using UnityEngine;
using UnityEditor.Graphing;
namespace UnityEditor.ShaderGraph
{
[Title("Input/Geometry/Tangent Vector")]
public class TangentVectorNode : GeometryNode, IMayRequireTangent
{
public const int kOutputSlotId = 0;
public const string kOutputSlotName = "Out";
public TangentVectorNode()
{
name = "Tangent Vector";
UpdateNodeAfterDeserialization();
}
public sealed override void UpdateNodeAfterDeserialization()
{
AddSlot(new Vector3MaterialSlot(kOutputSlotId, kOutputSlotName, kOutputSlotName, SlotType.Output, new Vector4(0, 0, 1, 1)));
RemoveSlotsNameNotMatching(new[] { kOutputSlotId });
}
public override string GetVariableNameForSlot(int slotId)
{
return space.ToVariableName(InterpolatorType.Tangent);
}
public NeededCoordinateSpace RequiresTangent()
{
return space.ToNeededCoordinateSpace();
}
}
}

83
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Matrix/TransformationMatrixNode.cs


using System.ComponentModel;
using UnityEditor.Graphing;
using System.Collections.Generic;
using UnityEditor.ShaderGraph.Drawing.Controls;
using UnityEngine;
namespace UnityEditor.ShaderGraph
{
public enum TransformationMatrixType
{
ModelView,
View,
Projection,
ViewProjection,
TransposeModelView,
InverseTransposeModelView,
ObjectToWorld,
WorldToObject
};
[Title("Input/Matrix/Transformation Matrix")]
public class TransformationMatrixNode : AbstractMaterialNode
{
static Dictionary<TransformationMatrixType, string> m_matrixList = new Dictionary<TransformationMatrixType, string>
{
{TransformationMatrixType.ModelView, "UNITY_MATRIX_MV"},
{TransformationMatrixType.View, "UNITY_MATRIX_V"},
{TransformationMatrixType.Projection, "UNITY_MATRIX_P"},
{TransformationMatrixType.ViewProjection, "UNITY_MATRIX_VP"},
{TransformationMatrixType.TransposeModelView, "UNITY_MATRIX_T_MV"},
{TransformationMatrixType.InverseTransposeModelView, "UNITY_MATRIX_IT_MV"},
{TransformationMatrixType.ObjectToWorld, "unity_ObjectToWorld"},
{TransformationMatrixType.WorldToObject, "unity_WorldToObject"},
};
[SerializeField]
private TransformationMatrixType m_matrix = TransformationMatrixType.ModelView;
private const int kOutputSlotId = 0;
private const string kOutputSlotName = "Out";
public override bool hasPreview { get { return false; } }
[EnumControl("")]
public TransformationMatrixType matrix
{
get { return m_matrix; }
set
{
if (m_matrix == value)
return;
m_matrix = value;
if (onModified != null)
{
onModified(this, ModificationScope.Graph);
}
}
}
public TransformationMatrixNode()
{
name = "Transformation Matrix";
UpdateNodeAfterDeserialization();
}
public sealed override void UpdateNodeAfterDeserialization()
{
AddSlot(new Matrix4MaterialSlot(kOutputSlotId, kOutputSlotName, kOutputSlotName, SlotType.Output));
RemoveSlotsNameNotMatching(new[] { kOutputSlotId });
}
public override string GetVariableNameForSlot(int slotId)
{
return m_matrixList[matrix];
}
public bool RequiresVertexColor()
{
return true;
}
}
}

30
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/ArccosineNode.cs


using System.Reflection;
namespace UnityEditor.ShaderGraph
{
[Title("Math/Trigonometry/Arccosine")]
public class ArccosineNode : CodeFunctionNode
{
public ArccosineNode()
{
name = "Arccosine";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Arccosine", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_Arccosine(
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] out DynamicDimensionVector Out)
{
return
@"
{
Out = acos(In);
}
";
}
}
}

30
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/ArcsineNode.cs


using System.Reflection;
namespace UnityEditor.ShaderGraph
{
[Title("Math/Trigonometry/Arcsine")]
public class ArcsineNode : CodeFunctionNode
{
public ArcsineNode()
{
name = "Arcsine";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Arcsine", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_Arcsine(
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] out DynamicDimensionVector Out)
{
return
@"
{
Out = asin(In);
}
";
}
}
}

31
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/Arctangent2Node.cs


using System.Reflection;
namespace UnityEditor.ShaderGraph
{
[Title("Math/Trigonometry/Arctangent2")]
public class Arctangent2Node : CodeFunctionNode
{
public Arctangent2Node()
{
name = "Arctangent2";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Arctangent2", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_Arctangent2(
[Slot(0, Binding.None)] DynamicDimensionVector A,
[Slot(1, Binding.None)] DynamicDimensionVector B,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
{
return
@"
{
Out = atan2(A, B);
}
";
}
}
}

30
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/ArctangentNode.cs


using System.Reflection;
namespace UnityEditor.ShaderGraph
{
[Title("Math/Trigonometry/Arctangent")]
public class ArctangentNode : CodeFunctionNode
{
public ArctangentNode()
{
name = "Arctangent";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Arctangent", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_Arctangent(
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] out DynamicDimensionVector Out)
{
return
@"
{
Out = atan(In);
}
";
}
}
}

30
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/CosineNode.cs


using System.Reflection;
namespace UnityEditor.ShaderGraph
{
[Title("Math/Trigonometry/Cosine")]
public class CosineNode : CodeFunctionNode
{
public CosineNode()
{
name = "Cosine";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Cosine", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_Cosine(
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] out DynamicDimensionVector Out)
{
return
@"
{
Out = cos(In);
}
";
}
}
}

30
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/HyperbolicCosineNode.cs


using System.Reflection;
namespace UnityEditor.ShaderGraph
{
[Title("Math/Trigonometry/Hyperbolic Cosine")]
class HyperbolicCosineNode : CodeFunctionNode
{
public HyperbolicCosineNode()
{
name = "Hyperbolic Cosine";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_HyperbolicCosine", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_HyperbolicCosine(
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] out DynamicDimensionVector Out)
{
return
@"
{
Out = sinh(In);
}
";
}
}
}

30
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/HyperbolicSineNode.cs


using System.Reflection;
namespace UnityEditor.ShaderGraph
{
[Title("Math/Trigonometry/Hyperbolic Sine")]
class HyperbolicSineNode : CodeFunctionNode
{
public HyperbolicSineNode()
{
name = "Hyperbolic Sine";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_HyperbolicSine", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_HyperbolicSine(
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] out DynamicDimensionVector Out)
{
return
@"
{
Out = sinh(In);
}
";
}
}
}

30
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/HyperbolicTangentNode.cs


using System.Reflection;
namespace UnityEditor.ShaderGraph
{
[Title("Math/Trigonometry/Hyperbolic Tangent")]
class HyperbolicTangentNode : CodeFunctionNode
{
public HyperbolicTangentNode()
{
name = "Hyperbolic Tangent";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_HyperbolicTangent", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_HyperbolicTangent(
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] out DynamicDimensionVector Out)
{
return
@"
{
Out = tanh(In);
}
";
}
}
}

30
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/SineNode.cs


using System.Reflection;
namespace UnityEditor.ShaderGraph
{
[Title("Math/Trigonometry/Sine")]
class SineNode : CodeFunctionNode
{
public SineNode()
{
name = "Sine";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Sine", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_Sine(
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] out DynamicDimensionVector Out)
{
return
@"
{
Out = sin(In);
}
";
}
}
}

30
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/TangentNode.cs


using System.Reflection;
namespace UnityEditor.ShaderGraph
{
[Title("Math/Trigonometry/Tangent")]
public class TangentNode : CodeFunctionNode
{
public TangentNode()
{
name = "Tangent";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Tangent", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_Tangent(
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] out DynamicDimensionVector Out)
{
return
@"
{
Out = tan(In);
}
";
}
}
}

33
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Vector/FresnelEffectNode.cs


using System.Reflection;
using UnityEngine;
namespace UnityEditor.ShaderGraph
{
[Title("Math/Vector/Fresnel Effect")]
class FresnelNode : CodeFunctionNode
{
public FresnelNode()
{
name = "Fresnel Effect";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_FresnelEffect", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_FresnelEffect(
[Slot(0, Binding.None)] Vector3 Normal,
[Slot(1, Binding.None)] Vector3 ViewDir,
[Slot(2, Binding.None, 1, 1, 1, 1)] Vector1 Power,
[Slot(3, Binding.None)] out Vector1 Out)
{
return
@"
{
Out = pow((1.0 - dot (normalize (Normal), normalize (ViewDir))), Power);
}
";
}
}
}

30
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Vector/ProjectionNode.cs


using System.Reflection;
namespace UnityEditor.ShaderGraph
{
[Title("Math/Vector/Projection")]
public class ProjectionNode : CodeFunctionNode
{
public ProjectionNode()
{
name = "Projection";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Projection", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_Projection(
[Slot(0, Binding.None)] DynamicDimensionVector A,
[Slot(1, Binding.None)] DynamicDimensionVector B,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
{
return
@"
{
Out = B * dot(A, B) / dot(B, B);
}";
}
}
}

32
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Vector/ReflectionNode.cs


using System.Reflection;
using UnityEngine;
namespace UnityEditor.ShaderGraph
{
[Title("Math/Vector/Reflection")]
class ReflectionNode : CodeFunctionNode
{
public ReflectionNode()
{
name = "Reflection";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Reflection", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_Reflection(
[Slot(0, Binding.None)] Vector3 In,
[Slot(1, Binding.None)] Vector3 Normal,
[Slot(2, Binding.None)] out Vector3 Out)
{
Out = Vector3.one;
return @"
{
Out = reflect(In, Normal);
}";
}
}
}

31
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Vector/RejectionNode.cs


using System.Reflection;
namespace UnityEditor.ShaderGraph
{
[Title("Math/Vector/Rejection")]
public class RejectionNode : CodeFunctionNode
{
public RejectionNode()
{
name = "Rejection";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Rejection", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_Rejection(
[Slot(0, Binding.None)] DynamicDimensionVector A,
[Slot(1, Binding.None)] DynamicDimensionVector B,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
{
return
@"
{
Out = A - (B * dot(A, B) / dot(B, B));
}
";
}
}
}

34
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/BitangentNode.cs


using UnityEngine;
using UnityEditor.Graphing;
namespace UnityEditor.ShaderGraph
{
[Title("Input/Geometry/Bitangent")]
public class BitangentNode : GeometryNode, IMayRequireBitangent
{
public const int kOutputSlotId = 0;
public const string kOutputSlotName = "Out";
public BitangentNode()
{
name = "Bitangent";
UpdateNodeAfterDeserialization();
}
public sealed override void UpdateNodeAfterDeserialization()
{
AddSlot(new Vector3MaterialSlot(kOutputSlotId, kOutputSlotName, kOutputSlotName, SlotType.Output, new Vector4(0, 0, 1)));
RemoveSlotsNameNotMatching(new[] { kOutputSlotId });
}
public override string GetVariableNameForSlot(int slotId)
{
return space.ToVariableName(InterpolatorType.BiTangent);
}
public NeededCoordinateSpace RequiresBitangent()
{
return space.ToNeededCoordinateSpace();
}
}
}

34
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/NormalNode.cs


using UnityEngine;
using UnityEditor.Graphing;
namespace UnityEditor.ShaderGraph
{
[Title("Input/Geometry/Normal")]
public class NormalNode : GeometryNode, IMayRequireNormal
{
public const int kOutputSlotId = 0;
public const string kOutputSlotName = "Out";
public NormalNode()
{
name = "Normal";
UpdateNodeAfterDeserialization();
}
public sealed override void UpdateNodeAfterDeserialization()
{
AddSlot(new Vector3MaterialSlot(kOutputSlotId, kOutputSlotName, kOutputSlotName, SlotType.Output, new Vector4(0, 0, 1)));
RemoveSlotsNameNotMatching(new[] { kOutputSlotId });
}
public override string GetVariableNameForSlot(int slotId)
{
return space.ToVariableName(InterpolatorType.Normal);
}
public NeededCoordinateSpace RequiresNormal()
{
return space.ToNeededCoordinateSpace();
}
}
}

34
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/TangentNode.cs


using UnityEngine;
using UnityEditor.Graphing;
namespace UnityEditor.ShaderGraph
{
[Title("Input/Geometry/Tangent")]
public class TangentNode : GeometryNode, IMayRequireTangent
{
public const int kOutputSlotId = 0;
public const string kOutputSlotName = "Out";
public TangentNode()
{
name = "Tangent";
UpdateNodeAfterDeserialization();
}
public sealed override void UpdateNodeAfterDeserialization()
{
AddSlot(new Vector3MaterialSlot(kOutputSlotId, kOutputSlotName, kOutputSlotName, SlotType.Output, new Vector4(0, 0, 1, 1)));
RemoveSlotsNameNotMatching(new[] { kOutputSlotId });
}
public override string GetVariableNameForSlot(int slotId)
{
return space.ToVariableName(InterpolatorType.Tangent);
}
public NeededCoordinateSpace RequiresTangent()
{
return space.ToNeededCoordinateSpace();
}
}
}

83
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Matrix/MatrixCommonNode.cs


using System.ComponentModel;
using UnityEditor.Graphing;
using System.Collections.Generic;
using UnityEditor.ShaderGraph.Drawing.Controls;
using UnityEngine;
namespace UnityEditor.ShaderGraph
{
public enum CommonMatrixType
{
ModelView,
View,
Projection,
ViewProjection,
TransposeModelView,
InverseTransposeModelView,
ObjectToWorld,
WorldToObject
};
[Title("Input/Matrix/Common Matrix")]
public class MatrixCommonNode : AbstractMaterialNode
{
static Dictionary<CommonMatrixType, string> m_matrixList = new Dictionary<CommonMatrixType, string>
{
{CommonMatrixType.ModelView, "UNITY_MATRIX_MV"},
{CommonMatrixType.View, "UNITY_MATRIX_V"},
{CommonMatrixType.Projection, "UNITY_MATRIX_P"},
{CommonMatrixType.ViewProjection, "UNITY_MATRIX_VP"},
{CommonMatrixType.TransposeModelView, "UNITY_MATRIX_T_MV"},
{CommonMatrixType.InverseTransposeModelView, "UNITY_MATRIX_IT_MV"},
{CommonMatrixType.ObjectToWorld, "unity_ObjectToWorld"},
{CommonMatrixType.WorldToObject, "unity_WorldToObject"},
};
[SerializeField]
private CommonMatrixType m_matrix = CommonMatrixType.ModelView;
private const int kOutputSlotId = 0;
private const string kOutputSlotName = "Out";
public override bool hasPreview { get { return false; } }
[EnumControl("")]
public CommonMatrixType matrix
{
get { return m_matrix; }
set
{
if (m_matrix == value)
return;
m_matrix = value;
if (onModified != null)
{
onModified(this, ModificationScope.Graph);
}
}
}
public MatrixCommonNode()
{
name = "CommonMatrix";
UpdateNodeAfterDeserialization();
}
public sealed override void UpdateNodeAfterDeserialization()
{
AddSlot(new Matrix4MaterialSlot(kOutputSlotId, kOutputSlotName, kOutputSlotName, SlotType.Output));
RemoveSlotsNameNotMatching(new[] { kOutputSlotId });
}
public override string GetVariableNameForSlot(int slotId)
{
return m_matrixList[matrix];
}
public bool RequiresVertexColor()
{
return true;
}
}
}

30
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/ArcCosNode.cs


using System.Reflection;
namespace UnityEditor.ShaderGraph
{
[Title("Math/Trigonometry/ArcCos")]
public class ArcCosNode : CodeFunctionNode
{
public ArcCosNode()
{
name = "ArcCos";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_ArcCos", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_ArcCos(
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] out DynamicDimensionVector Out)
{
return
@"
{
Out = acos(In);
}
";
}
}
}

30
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/ArcSinNode.cs


using System.Reflection;
namespace UnityEditor.ShaderGraph
{
[Title("Math/Trigonometry/ArcSin")]
public class ArcSinNode : CodeFunctionNode
{
public ArcSinNode()
{
name = "ArcSin";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_ArcSin", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_ArcSin(
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] out DynamicDimensionVector Out)
{
return
@"
{
Out = asin(In);
}
";
}
}
}

31
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/ArcTan2Node.cs


using System.Reflection;
namespace UnityEditor.ShaderGraph
{
[Title("Math/Trigonometry/ArcTan2")]
public class ArcTan2Node : CodeFunctionNode
{
public ArcTan2Node()
{
name = "ArcTan2";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_ArcTan2", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_ArcTan2(
[Slot(0, Binding.None)] DynamicDimensionVector A,
[Slot(1, Binding.None)] DynamicDimensionVector B,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
{
return
@"
{
Out = atan2(A, B);
}
";
}
}
}

30
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/ArcTanNode.cs


using System.Reflection;
namespace UnityEditor.ShaderGraph
{
[Title("Math/Trigonometry/ArcTan")]
public class ArcTanNode : CodeFunctionNode
{
public ArcTanNode()
{
name = "ArcTan";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_ArcTan", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_ArcTan(
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] out DynamicDimensionVector Out)
{
return
@"
{
Out = atan(In);
}
";
}
}
}

30
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/CosNode.cs


using System.Reflection;
namespace UnityEditor.ShaderGraph
{
[Title("Math/Trigonometry/Cos")]
public class CosNode : CodeFunctionNode
{
public CosNode()
{
name = "Cos";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Cos", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_Cos(
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] out DynamicDimensionVector Out)
{
return
@"
{
Out = cos(In);
}
";
}
}
}

30
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/HyperbolicCosNode.cs


using System.Reflection;
namespace UnityEditor.ShaderGraph
{
[Title("Math/Trigonometry/Hyperbolic Cos")]
class HyperbolicCosNode : CodeFunctionNode
{
public HyperbolicCosNode()
{
name = "Hyperbolic Cos";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_HyperbolicCos", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_HyperbolicCos(
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] out DynamicDimensionVector Out)
{
return
@"
{
Out = sinh(In);
}
";
}
}
}

30
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/HyperbolicSinNode.cs


using System.Reflection;
namespace UnityEditor.ShaderGraph
{
[Title("Math/Trigonometry/Hyperbolic Sin")]
class HyperbolicSinNode : CodeFunctionNode
{
public HyperbolicSinNode()
{
name = "Hyperbolic Sin";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_HyperbolicSin", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_HyperbolicSin(
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] out DynamicDimensionVector Out)
{
return
@"
{
Out = sinh(In);
}
";
}
}
}

30
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/HyperbolicTanNode.cs


using System.Reflection;
namespace UnityEditor.ShaderGraph
{
[Title("Math/Trigonometry/Hyperbolic Tan")]
class HyperbolicTanNode : CodeFunctionNode
{
public HyperbolicTanNode()
{
name = "Hyperbolic Tan";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_HyperbolicTan", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_HyperbolicTan(
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] out DynamicDimensionVector Out)
{
return
@"
{
Out = tanh(In);
}
";
}
}
}

30
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/SinNode.cs


using System.Reflection;
namespace UnityEditor.ShaderGraph
{
[Title("Math/Trigonometry/Sin")]
class SinNode : CodeFunctionNode
{
public SinNode()
{
name = "Sin";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Sin", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_Sin(
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] out DynamicDimensionVector Out)
{
return
@"
{
Out = sin(In);
}
";
}
}
}

30
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/TanNode.cs


using System.Reflection;
namespace UnityEditor.ShaderGraph
{
[Title("Math/Trigonometry/Tan")]
public class TanNode : CodeFunctionNode
{
public TanNode()
{
name = "Tan";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Tan", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_Tan(
[Slot(0, Binding.None)] DynamicDimensionVector In,
[Slot(1, Binding.None)] out DynamicDimensionVector Out)
{
return
@"
{
Out = tan(In);
}
";
}
}
}

33
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Vector/FresnelNode.cs


using System.Reflection;
using UnityEngine;
namespace UnityEditor.ShaderGraph
{
[Title("Math/Vector/Fresnel")]
class FresnelNode : CodeFunctionNode
{
public FresnelNode()
{
name = "Fresnel";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Fresnel", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_Fresnel(
[Slot(0, Binding.None)] Vector3 Normal,
[Slot(1, Binding.None)] Vector3 ViewDir,
[Slot(2, Binding.None, 1, 1, 1, 1)] Vector1 Power,
[Slot(3, Binding.None)] out Vector1 Out)
{
return
@"
{
Out = pow((1.0 - dot (normalize (Normal), normalize (ViewDir))), Power);
}
";
}
}
}

30
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Vector/ProjectNode.cs


using System.Reflection;
namespace UnityEditor.ShaderGraph
{
[Title("Math/Vector/Project")]
public class ProjectNode : CodeFunctionNode
{
public ProjectNode()
{
name = "Project";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Project", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_Project(
[Slot(0, Binding.None)] DynamicDimensionVector A,
[Slot(1, Binding.None)] DynamicDimensionVector B,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
{
return
@"
{
Out = B * dot(A, B) / dot(B, B);
}";
}
}
}

32
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Vector/ReflectNode.cs


using System.Reflection;
using UnityEngine;
namespace UnityEditor.ShaderGraph
{
[Title("Math/Vector/Reflect")]
class ReflectNode : CodeFunctionNode
{
public ReflectNode()
{
name = "Reflect";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Reflect", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_Reflect(
[Slot(0, Binding.None)] Vector3 In,
[Slot(1, Binding.None)] Vector3 Normal,
[Slot(2, Binding.None)] out Vector3 Out)
{
Out = Vector3.one;
return @"
{
Out = reflect(In, Normal);
}";
}
}
}

31
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Vector/RejectNode.cs


using System.Reflection;
namespace UnityEditor.ShaderGraph
{
[Title("Math/Vector/Reject")]
public class RejectNode : CodeFunctionNode
{
public RejectNode()
{
name = "Reject";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Reject", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_Reject(
[Slot(0, Binding.None)] DynamicDimensionVector A,
[Slot(1, Binding.None)] DynamicDimensionVector B,
[Slot(2, Binding.None)] out DynamicDimensionVector Out)
{
return
@"
{
Out = A - (B * dot(A, B) / dot(B, B));
}
";
}
}
}

/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/BitangentNode.cs.meta → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/BitangentVectorNode.cs.meta

/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/NormalNode.cs.meta → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/NormalVectorNode.cs.meta

/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/TangentNode.cs.meta → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/TangentVectorNode.cs.meta

/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Matrix/MatrixCommonNode.cs.meta → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Matrix/TransformationMatrixNode.cs.meta

/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/ArcCosNode.cs.meta → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/ArccosineNode.cs.meta

/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/ArcSinNode.cs.meta → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/ArcsineNode.cs.meta

/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/ArcTan2Node.cs.meta → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/Arctangent2Node.cs.meta

/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/ArcTanNode.cs.meta → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/ArctangentNode.cs.meta

/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/CosNode.cs.meta → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/CosineNode.cs.meta

/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/HyperbolicCosNode.cs.meta → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/HyperbolicCosineNode.cs.meta

/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/HyperbolicSinNode.cs.meta → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/HyperbolicSineNode.cs.meta

/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/HyperbolicTanNode.cs.meta → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/HyperbolicTangentNode.cs.meta

/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/SinNode.cs.meta → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/SineNode.cs.meta

/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/TanNode.cs.meta → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/TangentNode.cs.meta

/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Vector/FresnelNode.cs.meta → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Vector/FresnelEffectNode.cs.meta

/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Vector/ProjectNode.cs.meta → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Vector/ProjectionNode.cs.meta

/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Vector/ReflectNode.cs.meta → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Vector/ReflectionNode.cs.meta

/MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Vector/RejectNode.cs.meta → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Vector/RejectionNode.cs.meta

正在加载...
取消
保存