Tim Cooper
7 年前
当前提交
fc3caa89
共有 303 个文件被更改,包括 1429 次插入 和 243 次删除
-
2MaterialGraphProject/Assets/NewNodes/Editor/Keep/ParallaxNode.cs
-
4MaterialGraphProject/Assets/NewNodes/Editor/Kill/AACheckerBoard3dNode.cs
-
2MaterialGraphProject/Assets/NewNodes/Editor/Kill/MultiLayerParallaxNode.cs
-
2MaterialGraphProject/Assets/NewNodes/Editor/Kill/POMNode.cs
-
10MaterialGraphProject/Assets/NewNodes/Editor/Kill/SphericalIndentationNode.cs
-
3MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/AbstractMaterialGraph.cs
-
6MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/SamplerStateShaderProperty.cs
-
12MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/AbstractMaterialNode.cs
-
2MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/PositionNode.cs
-
2MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/UVNode.cs
-
5MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/VertexColorNode.cs
-
4MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/ViewDirectionNode.cs
-
6MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Matrix/Matrix2Node.cs
-
6MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Matrix/Matrix3Node.cs
-
6MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Matrix/Matrix4Node.cs
-
2MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Time/SinTimeNode.cs
-
10MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Time/TimeNode.cs
-
6MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/AbsoluteNode.cs
-
6MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/LengthNode.cs
-
70MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/LogNode.cs
-
6MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/NegateNode.cs
-
6MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/NormalizeNode.cs
-
8MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/PosterizeNode.cs
-
55MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/ReciprocalNode.cs
-
8MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Basic/AddNode.cs
-
8MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Basic/MultiplyNode.cs
-
12MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Basic/PowerNode.cs
-
14MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Basic/SquareRootNode.cs
-
8MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Basic/SubtractNode.cs
-
14MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Interpolation/InverseLerpNode.cs
-
10MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Interpolation/LerpNode.cs
-
14MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Range/ClampNode.cs
-
10MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Range/FractionNode.cs
-
10MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Range/RemapNode.cs
-
6MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Range/SaturateNode.cs
-
6MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Round/FloorNode.cs
-
6MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Round/RoundNode.cs
-
6MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Round/SignNode.cs
-
8MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Round/StepNode.cs
-
6MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Round/TruncateNode.cs
-
8MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/DegreesToRadiansNode.cs
-
8MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/RadiansToDegreesNode.cs
-
9MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Procedural/NoiseNode.cs
-
32MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Procedural/VoronoiNoise.cs
-
21MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/UV/SpherizeNode.cs
-
4MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/UV/SpherizeNode.cs.meta
-
98MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/UV/RotateNode.cs
-
2MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Util/ShaderGenerator.cs
-
4MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/DefaultControl.cs
-
5MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/ConstantNode.cs.meta
-
24MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/UV/RadialShearNode.cs
-
8MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Texture/Texture2DNode.cs
-
11MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Texture/SamplerStateNode.cs
-
4MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/ColorNode.cs
-
59MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/ExponentialNode.cs
-
2MaterialGraphProject/Assets/NewNodes/Editor/Kill/CheckerboardNode.cs
-
2MaterialGraphProject/Assets/NewNodes/Editor/Kill/GradientRampNode.cs
-
4MaterialGraphProject/Assets/NewNodes/Editor/Kill/LineNode.cs
-
2MaterialGraphProject/Assets/NewNodes/Editor/Kill/PulseNode.cs
-
2MaterialGraphProject/Assets/NewNodes/Editor/Kill/UVPannerNode.cs
-
4MaterialGraphProject/Assets/NewNodes/Editor/Kill/UVTileNode.cs
-
10MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/Vector1Node.cs
-
6MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/Vector2Node.cs
-
6MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/Vector3Node.cs
-
6MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/Vector4Node.cs
-
38MaterialGraphProject/Assets/NewNodes/Editor/Kill/SpherizeNode.cs
-
12MaterialGraphProject/Assets/NewNodes/Editor/Kill/SpherizeNode.cs.meta
-
74MaterialGraphProject/Assets/NewNodes/Editor/Kill/UVTransform.cs
-
11MaterialGraphProject/Assets/NewNodes/Editor/Kill/UVTransform.cs.meta
-
7MaterialGraphProject/Assets/SRP/PostProcessing/LICENSE.meta
-
8MaterialGraphProject/Assets/SRP/PostProcessing/PostProcessing.meta
-
7MaterialGraphProject/Assets/SRP/PostProcessing/README.md.meta
-
7MaterialGraphProject/Assets/SRP/PostProcessing/package.json.meta
-
8MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic.meta
-
34MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/BitangentVectorNode.cs
-
34MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/NormalVectorNode.cs
-
97MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/ScreenPositionNode.cs
-
34MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Geometry/TangentVectorNode.cs
-
83MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Matrix/TransformationMatrixNode.cs
-
8MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Texture/Delete.meta
-
67MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Texture/Texture2DAssetNode.cs
-
11MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Texture/Texture2DAssetNode.cs.meta
-
31MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/ModuloNode.cs
-
30MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Advanced/ReciprocalSquareRootNode.cs
-
30MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Basic/DivideNode.cs
-
8MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Derivative.meta
-
31MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Interpolation/SmoothstepNode.cs
-
31MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Range/MaximumNode.cs
-
30MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Range/MinimumNode.cs
-
30MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Range/OneMinusNode.cs
-
32MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Range/RandomRangeNode.cs
-
30MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Round/CeilingNode.cs
-
30MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/ArccosineNode.cs
-
30MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/ArcsineNode.cs
-
31MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/Arctangent2Node.cs
-
30MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Math/Trigonometry/ArctangentNode.cs
|
|||
using System.Reflection; |
|||
using UnityEngine; |
|||
|
|||
namespace UnityEditor.ShaderGraph |
|||
{ |
|||
/* |
|||
[Title("OLD/SpherizeOLD")] |
|||
public class SpherizeNode : CodeFunctionNode |
|||
{ |
|||
public SpherizeNode() |
|||
{ |
|||
name = "Spherizeold"; |
|||
} |
|||
|
|||
protected override MethodInfo GetFunctionToConvert() |
|||
{ |
|||
return GetType().GetMethod("Unity_Spherize", BindingFlags.Static | BindingFlags.NonPublic); |
|||
} |
|||
|
|||
static string Unity_Spherize( |
|||
[Slot(0, Binding.MeshUV0)] Vector2 uv, |
|||
[Slot(1, Binding.None)] Vector2 position, |
|||
[Slot(2, Binding.None)] Vector2 radiusAndStrength, |
|||
[Slot(3, Binding.None)] out Vector2 Out) |
|||
{ |
|||
Out = Vector2.zero; |
|||
return |
|||
@"
|
|||
{ |
|||
{precision}2 fromUVToPoint = position - uv; |
|||
{precision} dist = length(fromUVToPoint); |
|||
{precision} mag = ((1.0 - (dist / radiusAndStrength.x)) * radiusAndStrength.y) * step(dist, radiusAndStrength.x); |
|||
Out = uv + (mag * fromUVToPoint); |
|||
}";
|
|||
} |
|||
} |
|||
*/ |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 249d9b9165bdf234e84a85cdb8aca2aa |
|||
timeCreated: 1495555169 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Reflection; |
|||
using UnityEngine; |
|||
using UnityEditor.ShaderGraph.Drawing.Controls; |
|||
using UnityEditor.Graphing; |
|||
|
|||
namespace UnityEditor.ShaderGraph |
|||
{ |
|||
[Title("OLD/Transform")] |
|||
public class UVTransform : CodeFunctionNode |
|||
{ |
|||
|
|||
[SerializeField] |
|||
private RotationUnit m_constant = RotationUnit.Radians; |
|||
|
|||
[EnumControl("")] |
|||
public RotationUnit constant |
|||
{ |
|||
get { return m_constant; } |
|||
set |
|||
{ |
|||
if (m_constant == value) |
|||
return; |
|||
|
|||
m_constant = value; |
|||
if (onModified != null) |
|||
{ |
|||
onModified(this, ModificationScope.Graph); |
|||
} |
|||
} |
|||
} |
|||
public UVTransform() |
|||
{ |
|||
name = "Transform"; |
|||
} |
|||
protected override MethodInfo GetFunctionToConvert() |
|||
{ |
|||
return GetType().GetMethod("Unity_ScaleOffsetRotate", BindingFlags.Static | BindingFlags.NonPublic); |
|||
} |
|||
|
|||
static string Unity_ScaleOffsetRotate( |
|||
[Slot(0, Binding.MeshUV0)] Vector2 uv, |
|||
[Slot(1, Binding.None, 1f, 1f, 1f, 1f)] Vector2 scale, |
|||
[Slot(2, Binding.None)] Vector2 offset, |
|||
[Slot(3, Binding.None)] Vector1 rotation, |
|||
[Slot(4, Binding.None)] out Vector2 result) |
|||
{ |
|||
result = Vector2.zero; |
|||
return |
|||
@"
|
|||
{ |
|||
|
|||
|
|||
uv -= offset; |
|||
|
|||
{precision} s = sin(rotation); |
|||
{precision} c = cos(rotation); |
|||
|
|||
|
|||
//center rotation matrix
|
|||
{precision}2x2 rMatrix = float2x2(c, -s, s, c); |
|||
rMatrix *= 0.5; |
|||
rMatrix += 0.5; |
|||
rMatrix = rMatrix*2 - 1; |
|||
|
|||
//multiply the UVs by the rotation matrix
|
|||
uv.xy = mul(uv.xy, rMatrix); |
|||
uv += offset; |
|||
float4 xform = float4(scale, offset + offset - offset * scale); |
|||
result = uv * xform.xy + xform.zw; |
|||
} |
|||
";
|
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 24a04c4279e1baf46a98939f82dd7206 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 43962434dbfd3ea40af2ea7add0c2aa6 |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: dadb3ccc226c9c84a97777dbcbb0223f |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 03a6615db00fb6043834d5363972c41f |
|||
TextScriptImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 9d96f64353b62874bbd5efae54087728 |
|||
TextScriptImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: b43ef3944c134a74995e6582de94d21b |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
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(); |
|||
} |
|||
} |
|||
} |
|
|||
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(); |
|||
} |
|||
} |
|||
} |
|
|||
using System.Reflection; |
|||
using UnityEngine; |
|||
using UnityEditor.Graphing; |
|||
using UnityEditor.ShaderGraph.Drawing.Controls; |
|||
|
|||
namespace UnityEditor.ShaderGraph |
|||
{ |
|||
public interface IMayRequireScreenPosition |
|||
{ |
|||
bool RequiresScreenPosition(); |
|||
} |
|||
|
|||
public enum ScreenSpaceType |
|||
{ |
|||
Default, |
|||
Center, |
|||
Tiled |
|||
}; |
|||
|
|||
[Title("Input/Geometry/Screen Position")] |
|||
public class ScreenPositionNode : AbstractMaterialNode, IGeneratesBodyCode, IMayRequireScreenPosition |
|||
{ |
|||
public ScreenPositionNode() |
|||
{ |
|||
name = "Screen Position"; |
|||
UpdateNodeAfterDeserialization(); |
|||
} |
|||
|
|||
[SerializeField] |
|||
private ScreenSpaceType m_ScreenSpaceType = ScreenSpaceType.Default; |
|||
|
|||
[EnumControl("")] |
|||
public ScreenSpaceType screenSpaceType |
|||
{ |
|||
get { return m_ScreenSpaceType; } |
|||
set |
|||
{ |
|||
if (m_ScreenSpaceType == value) |
|||
return; |
|||
|
|||
m_ScreenSpaceType = value; |
|||
if (onModified != null) |
|||
{ |
|||
onModified(this, ModificationScope.Graph); |
|||
} |
|||
} |
|||
} |
|||
|
|||
string GetCurrentType() |
|||
{ |
|||
return System.Enum.GetName(typeof(ScreenSpaceType), m_ScreenSpaceType); |
|||
} |
|||
|
|||
private const int kOutputSlot1Id = 0; |
|||
private const string kOutputSlot1Name = "Out"; |
|||
|
|||
public override bool hasPreview { get { return true; } } |
|||
public override PreviewMode previewMode |
|||
{ |
|||
get { return PreviewMode.Preview2D; } |
|||
} |
|||
|
|||
|
|||
public sealed override void UpdateNodeAfterDeserialization() |
|||
{ |
|||
AddSlot(new Vector2MaterialSlot(kOutputSlot1Id, kOutputSlot1Name, kOutputSlot1Name, SlotType.Output, Vector2.zero)); |
|||
RemoveSlotsNameNotMatching(new[] { kOutputSlot1Id }); |
|||
} |
|||
|
|||
public override string GetVariableNameForSlot(int slotId) |
|||
{ |
|||
return ShaderGeneratorNames.ScreenPosition; |
|||
} |
|||
|
|||
public void GenerateNodeCode(ShaderGenerator visitor, GenerationMode generationMode) |
|||
{ |
|||
switch (m_ScreenSpaceType) |
|||
{ |
|||
case ScreenSpaceType.Center: |
|||
visitor.AddShaderChunk(string.Format("{0} = {1};", ShaderGeneratorNames.ScreenPosition, "float4((" + ShaderGeneratorNames.ScreenPosition + ".xy / " + ShaderGeneratorNames.ScreenPosition + ".w) * 2 - 1, 0, 0)"), false); |
|||
break; |
|||
case ScreenSpaceType.Tiled: |
|||
visitor.AddShaderChunk(string.Format("{0} = {1};", ShaderGeneratorNames.ScreenPosition, "float4((" + ShaderGeneratorNames.ScreenPosition + ".xy / " + ShaderGeneratorNames.ScreenPosition + ".w) * 2 - 1, 0, 0)"), false); |
|||
visitor.AddShaderChunk(string.Format("{0} = {1};", ShaderGeneratorNames.ScreenPosition, "float4(" + ShaderGeneratorNames.ScreenPosition + ".x * _ScreenParams.x / _ScreenParams.y, " + ShaderGeneratorNames.ScreenPosition + ".y, 0, 0)"), false); |
|||
break; |
|||
default: |
|||
visitor.AddShaderChunk(string.Format("{0} = {1};", ShaderGeneratorNames.ScreenPosition, "float4(" + ShaderGeneratorNames.ScreenPosition + ".xy / " + ShaderGeneratorNames.ScreenPosition + ".w, 0, 0)"), false); |
|||
break; |
|||
} |
|||
} |
|||
|
|||
public bool RequiresScreenPosition() |
|||
{ |
|||
return true; |
|||
} |
|||
} |
|||
} |
|
|||
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(); |
|||
} |
|||
} |
|||
} |
|
|||
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; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 394a8fe944cfd6b488bf5491e4622c7b |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections.Generic; |
|||
using UnityEditor.ShaderGraph.Drawing.Controls; |
|||
using UnityEngine; |
|||
using UnityEditor.Graphing; |
|||
|
|||
namespace UnityEditor.ShaderGraph |
|||
{ |
|||
[Title("Input/Texture/Texture 2D Asset")] |
|||
public class Texture2DAssetNode : AbstractMaterialNode |
|||
{ |
|||
public const int OutputSlotId = 0; |
|||
|
|||
const string kOutputSlotName = "Out"; |
|||
|
|||
public Texture2DAssetNode() |
|||
{ |
|||
name = "Texture 2D Asset"; |
|||
UpdateNodeAfterDeserialization(); |
|||
} |
|||
|
|||
public sealed override void UpdateNodeAfterDeserialization() |
|||
{ |
|||
AddSlot(new Texture2DMaterialSlot(OutputSlotId, kOutputSlotName, kOutputSlotName, SlotType.Output)); |
|||
RemoveSlotsNameNotMatching(new[] { OutputSlotId }); |
|||
} |
|||
|
|||
[SerializeField] |
|||
private SerializableTexture m_Texture = new SerializableTexture(); |
|||
|
|||
[TextureControl("")] |
|||
public Texture texture |
|||
{ |
|||
get { return m_Texture.texture; } |
|||
set |
|||
{ |
|||
if (m_Texture.texture == value) |
|||
return; |
|||
m_Texture.texture = value; |
|||
if (onModified != null) |
|||
{ |
|||
onModified(this, ModificationScope.Node); |
|||
} |
|||
} |
|||
} |
|||
|
|||
public override void CollectShaderProperties(PropertyCollector properties, GenerationMode generationMode) |
|||
{ |
|||
properties.AddShaderProperty(new TextureShaderProperty() |
|||
{ |
|||
overrideReferenceName = GetVariableNameForSlot(OutputSlotId), |
|||
generatePropertyBlock = true, |
|||
value = m_Texture, |
|||
modifiable = false |
|||
}); |
|||
} |
|||
|
|||
public override void CollectPreviewMaterialProperties(List<PreviewProperty> properties) |
|||
{ |
|||
properties.Add(new PreviewProperty |
|||
{ |
|||
m_Name = GetVariableNameForSlot(OutputSlotId), |
|||
m_PropType = PropertyType.Texture, |
|||
m_Texture = texture |
|||
}); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 9c629b78a2ec57749ab4f76f4f42f423 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Reflection; |
|||
|
|||
namespace UnityEditor.ShaderGraph |
|||
{ |
|||
[Title("Math/Advanced/Modulo")] |
|||
public class ModuloNode : CodeFunctionNode |
|||
{ |
|||
public ModuloNode() |
|||
{ |
|||
name = "Modulo"; |
|||
} |
|||
|
|||
protected override MethodInfo GetFunctionToConvert() |
|||
{ |
|||
return GetType().GetMethod("Unity_Modulo", BindingFlags.Static | BindingFlags.NonPublic); |
|||
} |
|||
|
|||
static string Unity_Modulo( |
|||
[Slot(0, Binding.None)] DynamicDimensionVector A, |
|||
[Slot(1, Binding.None)] DynamicDimensionVector B, |
|||
[Slot(2, Binding.None)] out DynamicDimensionVector Out) |
|||
{ |
|||
return |
|||
@"
|
|||
{ |
|||
Out = fmod(A, B); |
|||
} |
|||
";
|
|||
} |
|||
} |
|||
} |
|
|||
using System.Reflection; |
|||
|
|||
namespace UnityEditor.ShaderGraph |
|||
{ |
|||
[Title("Math/Advanced/Reciprocal Square Root")] |
|||
public class ReciprocalSquareRootNode : CodeFunctionNode |
|||
{ |
|||
public ReciprocalSquareRootNode() |
|||
{ |
|||
name = "Reciprocal Square Root"; |
|||
} |
|||
|
|||
protected override MethodInfo GetFunctionToConvert() |
|||
{ |
|||
return GetType().GetMethod("Unity_Rsqrt", BindingFlags.Static | BindingFlags.NonPublic); |
|||
} |
|||
|
|||
static string Unity_Rsqrt( |
|||
[Slot(0, Binding.None)] DynamicDimensionVector In, |
|||
[Slot(1, Binding.None)] out DynamicDimensionVector Out) |
|||
{ |
|||
return |
|||
@"
|
|||
{ |
|||
Out = rsqrt(In); |
|||
} |
|||
";
|
|||
} |
|||
} |
|||
} |
|
|||
using System.Reflection; |
|||
|
|||
namespace UnityEditor.ShaderGraph |
|||
{ |
|||
[Title("Math/Basic/Divide")] |
|||
public class DivideNode : CodeFunctionNode |
|||
{ |
|||
public DivideNode() |
|||
{ |
|||
name = "Divide"; |
|||
} |
|||
|
|||
protected override MethodInfo GetFunctionToConvert() |
|||
{ |
|||
return GetType().GetMethod("Unity_Divide", BindingFlags.Static | BindingFlags.NonPublic); |
|||
} |
|||
|
|||
static string Unity_Divide( |
|||
[Slot(0, Binding.None)] DynamicDimensionVector A, |
|||
[Slot(1, Binding.None)] DynamicDimensionVector B, |
|||
[Slot(2, Binding.None)] out DynamicDimensionVector Out) |
|||
{ |
|||
return @"
|
|||
{ |
|||
Out = A / B; |
|||
} |
|||
";
|
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: c10838deaed74574a94a340e53c2b229 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Reflection; |
|||
|
|||
namespace UnityEditor.ShaderGraph |
|||
{ |
|||
[Title("Math/Interpolation/Smoothstep")] |
|||
class SmoothstepNode : CodeFunctionNode |
|||
{ |
|||
public SmoothstepNode() |
|||
{ |
|||
name = "Smoothstep"; |
|||
} |
|||
|
|||
protected override MethodInfo GetFunctionToConvert() |
|||
{ |
|||
return GetType().GetMethod("Unity_Smoothstep", BindingFlags.Static | BindingFlags.NonPublic); |
|||
} |
|||
|
|||
static string Unity_Smoothstep( |
|||
[Slot(0, Binding.None)] DynamicDimensionVector A, |
|||
[Slot(1, Binding.None)] DynamicDimensionVector B, |
|||
[Slot(2, Binding.None)] DynamicDimensionVector T, |
|||
[Slot(3, Binding.None)] out DynamicDimensionVector Out) |
|||
{ |
|||
return |
|||
@"
|
|||
{ |
|||
Out = smoothstep(A, B, T); |
|||
}";
|
|||
} |
|||
} |
|||
} |
|
|||
using System.Reflection; |
|||
|
|||
namespace UnityEditor.ShaderGraph |
|||
{ |
|||
[Title("Math/Range/Maximum")] |
|||
public class MaximumNode : CodeFunctionNode |
|||
{ |
|||
public MaximumNode() |
|||
{ |
|||
name = "Maximum"; |
|||
} |
|||
|
|||
protected override MethodInfo GetFunctionToConvert() |
|||
{ |
|||
return GetType().GetMethod("Unity_Maximum", BindingFlags.Static | BindingFlags.NonPublic); |
|||
} |
|||
|
|||
static string Unity_Maximum( |
|||
[Slot(0, Binding.None)] DynamicDimensionVector A, |
|||
[Slot(1, Binding.None)] DynamicDimensionVector B, |
|||
[Slot(2, Binding.None)] out DynamicDimensionVector Out) |
|||
{ |
|||
return |
|||
@"
|
|||
{ |
|||
Out = max(A, B); |
|||
} |
|||
";
|
|||
} |
|||
} |
|||
} |
|
|||
using System.Reflection; |
|||
|
|||
namespace UnityEditor.ShaderGraph |
|||
{ |
|||
[Title("Math/Range/Minimum")] |
|||
public class MinimumNode : CodeFunctionNode |
|||
{ |
|||
public MinimumNode() |
|||
{ |
|||
name = "Minimum"; |
|||
} |
|||
|
|||
protected override MethodInfo GetFunctionToConvert() |
|||
{ |
|||
return GetType().GetMethod("Unity_Minimum", BindingFlags.Static | BindingFlags.NonPublic); |
|||
} |
|||
|
|||
static string Unity_Minimum( |
|||
[Slot(0, Binding.None, 1, 1, 1, 1)] DynamicDimensionVector A, |
|||
[Slot(1, Binding.None, 1, 1, 1, 1)] DynamicDimensionVector B, |
|||
[Slot(2, Binding.None)] out DynamicDimensionVector Out) |
|||
{ |
|||
return |
|||
@"
|
|||
{ |
|||
Out = min(A, B); |
|||
};";
|
|||
} |
|||
} |
|||
} |
|
|||
using System.Reflection; |
|||
|
|||
namespace UnityEditor.ShaderGraph |
|||
{ |
|||
[Title("Math/Range/One Minus")] |
|||
public class OneMinusNode : CodeFunctionNode |
|||
{ |
|||
public OneMinusNode() |
|||
{ |
|||
name = "One Minus"; |
|||
} |
|||
|
|||
protected override MethodInfo GetFunctionToConvert() |
|||
{ |
|||
return GetType().GetMethod("Unity_OneMinus", BindingFlags.Static | BindingFlags.NonPublic); |
|||
} |
|||
|
|||
static string Unity_OneMinus( |
|||
[Slot(0, Binding.None)] DynamicDimensionVector In, |
|||
[Slot(1, Binding.None)] out DynamicDimensionVector Out) |
|||
{ |
|||
return |
|||
@"
|
|||
{ |
|||
Out = 1 - In; |
|||
} |
|||
";
|
|||
} |
|||
} |
|||
} |
|
|||
using System.Reflection; |
|||
|
|||
namespace UnityEditor.ShaderGraph |
|||
{ |
|||
[Title("Math/Range/Random Range")] |
|||
public class RandomRangeNode : CodeFunctionNode |
|||
{ |
|||
public RandomRangeNode() |
|||
{ |
|||
name = "Random Range"; |
|||
} |
|||
|
|||
protected override MethodInfo GetFunctionToConvert() |
|||
{ |
|||
return GetType().GetMethod("Unity_RandomRange", BindingFlags.Static | BindingFlags.NonPublic); |
|||
} |
|||
|
|||
static string Unity_RandomRange( |
|||
[Slot(0, Binding.None)] Vector1 Seed, |
|||
[Slot(1, Binding.None)] Vector1 Min, |
|||
[Slot(2, Binding.None, 1, 1, 1, 1)] Vector1 Max, |
|||
[Slot(3, Binding.None)] out Vector1 Out) |
|||
{ |
|||
return |
|||
@"
|
|||
{ |
|||
{precision} randomno = frac(sin(dot({precision}2(Seed, Seed), float2(12.9898, 78.233)))*43758.5453); |
|||
Out = floor(randomno * (Max - Min + 1)) + Min; |
|||
}";
|
|||
} |
|||
} |
|||
} |
|
|||
using System.Reflection; |
|||
|
|||
namespace UnityEditor.ShaderGraph |
|||
{ |
|||
[Title("Math/Round/Ceiling")] |
|||
public class CeilingNode : CodeFunctionNode |
|||
{ |
|||
public CeilingNode() |
|||
{ |
|||
name = "Ceiling"; |
|||
} |
|||
|
|||
protected override MethodInfo GetFunctionToConvert() |
|||
{ |
|||
return GetType().GetMethod("Unity_Ceiling", BindingFlags.Static | BindingFlags.NonPublic); |
|||
} |
|||
|
|||
static string Unity_Ceiling( |
|||
[Slot(0, Binding.None)] DynamicDimensionVector In, |
|||
[Slot(1, Binding.None)] out DynamicDimensionVector Out) |
|||
{ |
|||
return |
|||
@"
|
|||
{ |
|||
Out = ceil(In); |
|||
} |
|||
";
|
|||
} |
|||
} |
|||
} |
|
|||
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); |
|||
} |
|||
";
|
|||
} |
|||
} |
|||
} |
|
|||
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); |
|||
} |
|||
";
|
|||
} |
|||
} |
|||
} |
|
|||
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); |
|||
} |
|||
";
|
|||
} |
|||
} |
|||
} |
|
|||
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); |
|||
} |
|||
";
|
|||
} |
|||
} |
|||
} |
部分文件因为文件数量过多而无法显示
撰写
预览
正在加载...
取消
保存
Reference in new issue