浏览代码
Merge branch 'hackweek2017' of https://github.com/stramit/MaterialGraph into hackweek2017
/main
Merge branch 'hackweek2017' of https://github.com/stramit/MaterialGraph into hackweek2017
/main
Eduardo Chaves
8 年前
当前提交
dd8b5552
共有 38 个文件被更改,包括 0 次插入 和 832 次删除
-
13MaterialGraphProject/Assets/Brandon/ATan2Node.cs
-
12MaterialGraphProject/Assets/Brandon/ATan2Node.cs.meta
-
13MaterialGraphProject/Assets/Brandon/ArcCosNode.cs
-
12MaterialGraphProject/Assets/Brandon/ArcCosNode.cs.meta
-
13MaterialGraphProject/Assets/Brandon/ArcSinNode.cs
-
12MaterialGraphProject/Assets/Brandon/ArcSinNode.cs.meta
-
13MaterialGraphProject/Assets/Brandon/ArcTanNode.cs
-
12MaterialGraphProject/Assets/Brandon/ArcTanNode.cs.meta
-
65MaterialGraphProject/Assets/Brandon/CartesianToPolarNode.cs
-
12MaterialGraphProject/Assets/Brandon/CartesianToPolarNode.cs.meta
-
63MaterialGraphProject/Assets/Brandon/CheckerboardNode.cs
-
12MaterialGraphProject/Assets/Brandon/CheckerboardNode.cs.meta
-
13MaterialGraphProject/Assets/Brandon/CosNode.cs
-
12MaterialGraphProject/Assets/Brandon/CosNode.cs.meta
-
13MaterialGraphProject/Assets/Brandon/CrossNode.cs
-
12MaterialGraphProject/Assets/Brandon/CrossNode.cs.meta
-
13MaterialGraphProject/Assets/Brandon/DegreesToRadiansNode.cs
-
12MaterialGraphProject/Assets/Brandon/DegreesToRadiansNode.cs.meta
-
58MaterialGraphProject/Assets/Brandon/GradientRampNode.cs
-
12MaterialGraphProject/Assets/Brandon/GradientRampNode.cs.meta
-
58MaterialGraphProject/Assets/Brandon/HexNode.cs
-
12MaterialGraphProject/Assets/Brandon/HexNode.cs.meta
-
57MaterialGraphProject/Assets/Brandon/ParticleNode.cs
-
12MaterialGraphProject/Assets/Brandon/ParticleNode.cs.meta
-
13MaterialGraphProject/Assets/Brandon/RadiansToDegreesNode.cs
-
12MaterialGraphProject/Assets/Brandon/RadiansToDegreesNode.cs.meta
-
29MaterialGraphProject/Assets/Brandon/ReciprocalNode.cs
-
12MaterialGraphProject/Assets/Brandon/ReciprocalNode.cs.meta
-
13MaterialGraphProject/Assets/Brandon/SinCosNode.cs
-
12MaterialGraphProject/Assets/Brandon/SinCosNode.cs.meta
-
13MaterialGraphProject/Assets/Brandon/TanNode.cs
-
12MaterialGraphProject/Assets/Brandon/TanNode.cs.meta
-
56MaterialGraphProject/Assets/Brandon/UVTileNode.cs
-
12MaterialGraphProject/Assets/Brandon/UVTileNode.cs.meta
-
71MaterialGraphProject/Assets/Brandon/LineNode.cs
-
12MaterialGraphProject/Assets/Brandon/LineNode.cs.meta
-
29MaterialGraphProject/Assets/Eduardo/NegateNode.cs
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Math/Trigonometry/ArcTan2 Node")] |
|||
public class ATan2Node : Function2Input |
|||
{ |
|||
public ATan2Node() |
|||
{ |
|||
name = "ATan2Node"; |
|||
} |
|||
|
|||
protected override string GetFunctionName() { return "atan2"; } |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: fdd3de2442c50d74da35552bdbe0be74 |
|||
timeCreated: 1495459701 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Math/Trigonometry/ArcCos Node")] |
|||
public class ACosNode : Function1Input |
|||
{ |
|||
public ACosNode() |
|||
{ |
|||
name = "ACosNode"; |
|||
} |
|||
|
|||
protected override string GetFunctionName() { return "acos"; } |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 455566eec6487b04e92c32110f05073a |
|||
timeCreated: 1495459453 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Math/Trigonometry/ArcSin Node")] |
|||
public class ASinNode : Function1Input |
|||
{ |
|||
public ASinNode() |
|||
{ |
|||
name = "ASinNode"; |
|||
} |
|||
|
|||
protected override string GetFunctionName() { return "asin"; } |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: e0bd4c0099ef82240b5e91e77990628e |
|||
timeCreated: 1495459543 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Math/Trigonometry/ArcTan Node")] |
|||
public class ATanNode : Function1Input |
|||
{ |
|||
public ATanNode() |
|||
{ |
|||
name = "ATanNode"; |
|||
} |
|||
|
|||
protected override string GetFunctionName() { return "atan"; } |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 9db0fbefda58761488455432f3133271 |
|||
timeCreated: 1495459625 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("UV/Cartesian To Polar Node")] |
|||
public class CartesianToPolarNode : Function3Input, IGeneratesFunction |
|||
{ |
|||
public CartesianToPolarNode() |
|||
{ |
|||
name = "CartesianToPolarNode"; |
|||
} |
|||
|
|||
protected override string GetFunctionName() |
|||
{ |
|||
return "unity_cartesiantopolar_" + precision; |
|||
} |
|||
|
|||
protected override string GetInputSlot1Name() |
|||
{ |
|||
return "UV"; |
|||
} |
|||
|
|||
protected override string GetInputSlot2Name() |
|||
{ |
|||
return "HorizontalTileScale"; |
|||
} |
|||
|
|||
protected override string GetInputSlot3Name() |
|||
{ |
|||
return "VerticalTileScale"; |
|||
} |
|||
|
|||
protected override MaterialSlot GetInputSlot1() |
|||
{ |
|||
return new MaterialSlot(InputSlot1Id, GetInputSlot1Name(), kInputSlot1ShaderName, UnityEngine.Graphing.SlotType.Input, SlotValueType.Vector2, Vector2.zero); |
|||
} |
|||
|
|||
protected override MaterialSlot GetInputSlot2() |
|||
{ |
|||
return new MaterialSlot(InputSlot2Id, GetInputSlot2Name(), kInputSlot2ShaderName, UnityEngine.Graphing.SlotType.Input, SlotValueType.Vector1, Vector4.zero); |
|||
} |
|||
|
|||
protected override MaterialSlot GetInputSlot3() |
|||
{ |
|||
return new MaterialSlot(InputSlot3Id, GetInputSlot3Name(), kInputSlot3ShaderName, UnityEngine.Graphing.SlotType.Input, SlotValueType.Vector1, Vector4.zero); |
|||
} |
|||
protected override MaterialSlot GetOutputSlot() |
|||
{ |
|||
return new MaterialSlot(OutputSlotId, GetOutputSlotName(), kOutputSlotShaderName, UnityEngine.Graphing.SlotType.Output, SlotValueType.Vector2, Vector2.zero); |
|||
} |
|||
|
|||
public void GenerateNodeFunction(ShaderGenerator visitor, GenerationMode generationMode) |
|||
{ |
|||
var outputString = new ShaderGenerator(); |
|||
outputString.AddShaderChunk(GetFunctionPrototype("uv", "horizontalTileScale", "verticalTileScale"), false); |
|||
outputString.AddShaderChunk("{", false); |
|||
outputString.Indent(); |
|||
outputString.AddShaderChunk("float radius = length(uv);", false); |
|||
outputString.AddShaderChunk("float angle = atan2(uv.x, uv.y);", false); |
|||
outputString.AddShaderChunk("return float2(radius, angle);", false); |
|||
outputString.Deindent(); |
|||
outputString.AddShaderChunk("}", false); |
|||
|
|||
visitor.AddShaderChunk(outputString.GetShaderString(0), true); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 254f958f2febf5e42811f813c866bb2e |
|||
timeCreated: 1495464810 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Procedural/Checkerboard Node")] |
|||
public class CheckerboardNode : Function3Input, IGeneratesFunction |
|||
{ |
|||
public CheckerboardNode() |
|||
{ |
|||
name = "CheckerboardNode"; |
|||
} |
|||
|
|||
protected override string GetFunctionName() |
|||
{ |
|||
return "unity_checkerboard_" + precision; |
|||
} |
|||
|
|||
protected override string GetInputSlot1Name() |
|||
{ |
|||
return "UV"; |
|||
} |
|||
|
|||
protected override string GetInputSlot2Name() |
|||
{ |
|||
return "HorizontalTileScale"; |
|||
} |
|||
|
|||
protected override string GetInputSlot3Name() |
|||
{ |
|||
return "VerticalTileScale"; |
|||
} |
|||
|
|||
protected override MaterialSlot GetInputSlot1() |
|||
{ |
|||
return new MaterialSlot(InputSlot1Id, GetInputSlot1Name(), kInputSlot1ShaderName, UnityEngine.Graphing.SlotType.Input, SlotValueType.Vector2, Vector2.zero); |
|||
} |
|||
|
|||
protected override MaterialSlot GetInputSlot2() |
|||
{ |
|||
return new MaterialSlot(InputSlot2Id, GetInputSlot2Name(), kInputSlot2ShaderName, UnityEngine.Graphing.SlotType.Input, SlotValueType.Vector1, Vector4.zero); |
|||
} |
|||
|
|||
protected override MaterialSlot GetInputSlot3() |
|||
{ |
|||
return new MaterialSlot(InputSlot3Id, GetInputSlot3Name(), kInputSlot3ShaderName, UnityEngine.Graphing.SlotType.Input, SlotValueType.Vector1, Vector4.zero); |
|||
} |
|||
protected override MaterialSlot GetOutputSlot() |
|||
{ |
|||
return new MaterialSlot(OutputSlotId, GetOutputSlotName(), kOutputSlotShaderName, UnityEngine.Graphing.SlotType.Output, SlotValueType.Vector1, Vector2.zero); |
|||
} |
|||
|
|||
public void GenerateNodeFunction(ShaderGenerator visitor, GenerationMode generationMode) |
|||
{ |
|||
var outputString = new ShaderGenerator(); |
|||
outputString.AddShaderChunk(GetFunctionPrototype("uv", "horizontalTileScale", "verticalTileScale"), false); |
|||
outputString.AddShaderChunk("{", false); |
|||
outputString.Indent(); |
|||
outputString.AddShaderChunk("return floor(fmod(floor(uv.x * horizontalTileScale) + floor(uv.y * verticalTileScale), 2.0)) * float4(1.0, 1.0, 1.0, 1.0);", false); |
|||
outputString.Deindent(); |
|||
outputString.AddShaderChunk("}", false); |
|||
|
|||
visitor.AddShaderChunk(outputString.GetShaderString(0), true); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 33d3c277f991d6749b4a8ace52c6d7b9 |
|||
timeCreated: 1495448360 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Math/Trigonometry/Cos Node")] |
|||
public class CosNode : Function1Input |
|||
{ |
|||
public CosNode() |
|||
{ |
|||
name = "CosNode"; |
|||
} |
|||
|
|||
protected override string GetFunctionName() { return "cos"; } |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 27c8eab8410ea16418392d646ec92572 |
|||
timeCreated: 1495446924 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Math/Vector/Cross Node")] |
|||
public class CrossNode : Function2Input |
|||
{ |
|||
public CrossNode() |
|||
{ |
|||
name = "CrossNode"; |
|||
} |
|||
|
|||
protected override string GetFunctionName() { return "cross"; } |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 6a69c68bb4c22d840b464885246650a3 |
|||
timeCreated: 1495446521 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Math/Trigonometry/Degrees To Radians Node")] |
|||
public class DegreesToRadiansNode : Function1Input |
|||
{ |
|||
public DegreesToRadiansNode() |
|||
{ |
|||
name = "DegreesToRadians"; |
|||
} |
|||
|
|||
protected override string GetFunctionName() { return "radians"; } |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 30f44257fb54ebf48908aef7ecc9b285 |
|||
timeCreated: 1495459878 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Procedural/Gradient Ramp Node")] |
|||
public class GradientRampNode : Function2Input, IGeneratesFunction |
|||
{ |
|||
public GradientRampNode() |
|||
{ |
|||
name = "GradientRampNode"; |
|||
} |
|||
|
|||
protected override string GetFunctionName() |
|||
{ |
|||
return "unitygGradientramp_" + precision; |
|||
} |
|||
|
|||
protected override string GetInputSlot1Name() |
|||
{ |
|||
return "UV"; |
|||
} |
|||
|
|||
protected override string GetInputSlot2Name() |
|||
{ |
|||
return "Stripe Count"; |
|||
} |
|||
|
|||
protected override MaterialSlot GetInputSlot1() |
|||
{ |
|||
return new MaterialSlot(InputSlot1Id, GetInputSlot1Name(), kInputSlot1ShaderName, UnityEngine.Graphing.SlotType.Input, SlotValueType.Vector2, Vector4.zero); |
|||
} |
|||
|
|||
protected override MaterialSlot GetInputSlot2() |
|||
{ |
|||
return new MaterialSlot(InputSlot2Id, GetInputSlot2Name(), kInputSlot2ShaderName, UnityEngine.Graphing.SlotType.Input, SlotValueType.Vector1, Vector4.zero); |
|||
} |
|||
|
|||
protected override MaterialSlot GetOutputSlot() |
|||
{ |
|||
return new MaterialSlot(OutputSlotId, GetOutputSlotName(), kOutputSlotShaderName, UnityEngine.Graphing.SlotType.Output, SlotValueType.Vector1, Vector2.zero); |
|||
} |
|||
|
|||
public void GenerateNodeFunction(ShaderGenerator visitor, GenerationMode generationMode) |
|||
{ |
|||
var outputString = new ShaderGenerator(); |
|||
outputString.AddShaderChunk(GetFunctionPrototype("uv", "stripeCount"), false); |
|||
outputString.AddShaderChunk("{", false); |
|||
outputString.Indent(); |
|||
|
|||
outputString.AddShaderChunk("float widthOfEachStripe = 1.0 / stripeCount;", false); |
|||
outputString.AddShaderChunk("float t = fmod(floor(uv.x / widthOfEachStripe), stripeCount);", false); |
|||
outputString.AddShaderChunk("return lerp(0.0, 1.0, t / (stripeCount - 1.0));", false); |
|||
|
|||
outputString.Deindent(); |
|||
outputString.AddShaderChunk("}", false); |
|||
|
|||
visitor.AddShaderChunk(outputString.GetShaderString(0), true); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: b7f3879f9309ee2439c68a734792dc73 |
|||
timeCreated: 1495449448 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Procedural/Hex Node")] |
|||
public class HexNode : Function2Input, IGeneratesFunction |
|||
{ |
|||
public HexNode() |
|||
{ |
|||
name = "HexNode"; |
|||
} |
|||
|
|||
protected override string GetFunctionName() |
|||
{ |
|||
return "unity_hex_" + precision; |
|||
} |
|||
|
|||
protected override string GetInputSlot1Name() |
|||
{ |
|||
return "UV"; |
|||
} |
|||
|
|||
protected override MaterialSlot GetInputSlot1() |
|||
{ |
|||
return new MaterialSlot(InputSlot1Id, GetInputSlot1Name(), kInputSlot1ShaderName, UnityEngine.Graphing.SlotType.Input, SlotValueType.Vector2, Vector2.zero); |
|||
} |
|||
|
|||
protected override string GetInputSlot2Name() |
|||
{ |
|||
return "Thickness"; |
|||
} |
|||
|
|||
protected override MaterialSlot GetInputSlot2() |
|||
{ |
|||
return new MaterialSlot(InputSlot2Id, GetInputSlot2Name(), kInputSlot2ShaderName, UnityEngine.Graphing.SlotType.Input, SlotValueType.Vector1, Vector2.zero); |
|||
} |
|||
|
|||
protected override MaterialSlot GetOutputSlot() |
|||
{ |
|||
return new MaterialSlot(OutputSlotId, GetOutputSlotName(), kOutputSlotShaderName, UnityEngine.Graphing.SlotType.Output, SlotValueType.Vector1, Vector2.zero); |
|||
} |
|||
|
|||
public void GenerateNodeFunction(ShaderGenerator visitor, GenerationMode generationMode) |
|||
{ |
|||
var outputString = new ShaderGenerator(); |
|||
outputString.AddShaderChunk(GetFunctionPrototype("uv", "thickness"), false); |
|||
outputString.AddShaderChunk("{", false); |
|||
outputString.Indent(); |
|||
|
|||
outputString.AddShaderChunk("uv.y += fmod(floor(uv.x), 2.0) * 0.5;", false); |
|||
outputString.AddShaderChunk("uv = abs(frac(uv) - 0.5);", false); |
|||
outputString.AddShaderChunk("return step(thickness, abs(max(uv.x * 1.5 + uv.y, uv.y * 2.0) - 1.0));", false); |
|||
|
|||
outputString.Deindent(); |
|||
outputString.AddShaderChunk("}", false); |
|||
|
|||
visitor.AddShaderChunk(outputString.GetShaderString(0), true); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 98787001c1c5ac14588e5d2eb427aea8 |
|||
timeCreated: 1495456895 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Procedural/Particle Node")] |
|||
public class ParticleNode : Function2Input, IGeneratesFunction |
|||
{ |
|||
public ParticleNode() |
|||
{ |
|||
name = "ParticleNode"; |
|||
} |
|||
|
|||
protected override string GetFunctionName() |
|||
{ |
|||
return "unity_particle_" + precision; |
|||
} |
|||
|
|||
protected override string GetInputSlot1Name() |
|||
{ |
|||
return "UV"; |
|||
} |
|||
|
|||
protected override string GetInputSlot2Name() |
|||
{ |
|||
return "ScaleFactor"; |
|||
} |
|||
|
|||
protected override MaterialSlot GetInputSlot1() |
|||
{ |
|||
return new MaterialSlot(InputSlot1Id, GetInputSlot1Name(), kInputSlot1ShaderName, UnityEngine.Graphing.SlotType.Input, SlotValueType.Vector2, Vector2.zero); |
|||
} |
|||
|
|||
protected override MaterialSlot GetInputSlot2() |
|||
{ |
|||
return new MaterialSlot(InputSlot2Id, GetInputSlot2Name(), kInputSlot2ShaderName, UnityEngine.Graphing.SlotType.Input, SlotValueType.Vector1, Vector2.zero); |
|||
} |
|||
|
|||
protected override MaterialSlot GetOutputSlot() |
|||
{ |
|||
return new MaterialSlot(OutputSlotId, GetOutputSlotName(), kOutputSlotShaderName, UnityEngine.Graphing.SlotType.Output, SlotValueType.Vector1, Vector2.zero); |
|||
} |
|||
|
|||
public void GenerateNodeFunction(ShaderGenerator visitor, GenerationMode generationMode) |
|||
{ |
|||
var outputString = new ShaderGenerator(); |
|||
outputString.AddShaderChunk(GetFunctionPrototype("uv", "scaleFactor"), false); |
|||
outputString.AddShaderChunk("{", false); |
|||
outputString.Indent(); |
|||
|
|||
outputString.AddShaderChunk("uv = uv * 2.0 - 1.0;", false); |
|||
outputString.AddShaderChunk("return abs(1.0/length(uv * scaleFactor));", false); |
|||
|
|||
outputString.Deindent(); |
|||
outputString.AddShaderChunk("}", false); |
|||
|
|||
visitor.AddShaderChunk(outputString.GetShaderString(0), true); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 445f6145066270045930268f04f7f296 |
|||
timeCreated: 1495470132 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Math/Trigonometry/Radians To Degrees Node")] |
|||
public class RadiansToDegreesNode : Function1Input |
|||
{ |
|||
public RadiansToDegreesNode() |
|||
{ |
|||
name = "RadiansToDegrees"; |
|||
} |
|||
|
|||
protected override string GetFunctionName() { return "degrees"; } |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 3673593934a8a544294ca6398a7cc6cb |
|||
timeCreated: 1495460178 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Math/Advanced/Reciprocal Node")] |
|||
public class ReciprocalNode : Function1Input, IGeneratesFunction |
|||
{ |
|||
public ReciprocalNode() |
|||
{ |
|||
name = "ReciprocalNode"; |
|||
} |
|||
|
|||
protected override string GetFunctionName() |
|||
{ |
|||
return "unity_reciprocal_" + precision; |
|||
} |
|||
|
|||
public void GenerateNodeFunction(ShaderGenerator visitor, GenerationMode generationMode) |
|||
{ |
|||
var outputString = new ShaderGenerator(); |
|||
outputString.AddShaderChunk(GetFunctionPrototype("arg1"), false); |
|||
outputString.AddShaderChunk("{", false); |
|||
outputString.Indent(); |
|||
outputString.AddShaderChunk("return 1.0/arg1;", false); |
|||
outputString.Deindent(); |
|||
outputString.AddShaderChunk("}", false); |
|||
|
|||
visitor.AddShaderChunk(outputString.GetShaderString(0), true); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 2b52706eb67bd8445b13f43ae287c679 |
|||
timeCreated: 1495445608 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Math/SinCos Node")] |
|||
public class SinCosNode : Function1Input |
|||
{ |
|||
public SinCosNode() |
|||
{ |
|||
name = "SinCosNode"; |
|||
} |
|||
|
|||
protected override string GetFunctionName() { return "cos"; } |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 61e8adbfbb5cd244fa9bb6dcc900b2bc |
|||
timeCreated: 1495447065 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Math/Trigonometry/Tan Node")] |
|||
public class TanNode : Function1Input |
|||
{ |
|||
public TanNode() |
|||
{ |
|||
name = "TanNode"; |
|||
} |
|||
|
|||
protected override string GetFunctionName() { return "tan"; } |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 217bab274e1af304daceecaf52863882 |
|||
timeCreated: 1495446976 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("UV/Tile Node")] |
|||
public class UVTileNode : Function2Input, IGeneratesFunction |
|||
{ |
|||
public UVTileNode() |
|||
{ |
|||
name = "UVTileNode"; |
|||
} |
|||
|
|||
protected override string GetFunctionName() |
|||
{ |
|||
return "unity_uvtile_" + precision; |
|||
} |
|||
|
|||
protected override string GetInputSlot1Name() |
|||
{ |
|||
return "UV"; |
|||
} |
|||
|
|||
protected override MaterialSlot GetInputSlot1() |
|||
{ |
|||
return new MaterialSlot(InputSlot1Id, GetInputSlot1Name(), kInputSlot1ShaderName, UnityEngine.Graphing.SlotType.Input, SlotValueType.Vector2, Vector2.zero); |
|||
} |
|||
|
|||
protected override string GetInputSlot2Name() |
|||
{ |
|||
return "Tile Factor (X,Y)"; |
|||
} |
|||
|
|||
protected override MaterialSlot GetInputSlot2() |
|||
{ |
|||
return new MaterialSlot(InputSlot2Id, GetInputSlot2Name(), kInputSlot2ShaderName, UnityEngine.Graphing.SlotType.Input, SlotValueType.Vector2, Vector2.zero); |
|||
} |
|||
|
|||
protected override MaterialSlot GetOutputSlot() |
|||
{ |
|||
return new MaterialSlot(OutputSlotId, GetOutputSlotName(), kOutputSlotShaderName, UnityEngine.Graphing.SlotType.Output, SlotValueType.Vector2, Vector2.zero); |
|||
} |
|||
|
|||
public void GenerateNodeFunction(ShaderGenerator visitor, GenerationMode generationMode) |
|||
{ |
|||
var outputString = new ShaderGenerator(); |
|||
outputString.AddShaderChunk(GetFunctionPrototype("uv", "tileFactor"), false); |
|||
outputString.AddShaderChunk("{", false); |
|||
outputString.Indent(); |
|||
|
|||
outputString.AddShaderChunk("return uv * tileFactor;", false); |
|||
|
|||
outputString.Deindent(); |
|||
outputString.AddShaderChunk("}", false); |
|||
|
|||
visitor.AddShaderChunk(outputString.GetShaderString(0), true); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 9de1e3a9c41ab2e4d9547aa844abb327 |
|||
timeCreated: 1495462112 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Procedural/Line Node")] |
|||
public class LineNode : Function3Input, IGeneratesFunction |
|||
{ |
|||
public LineNode() |
|||
{ |
|||
name = "LineNode"; |
|||
} |
|||
|
|||
protected override string GetFunctionName() |
|||
{ |
|||
return "unity_linenode_" + precision; |
|||
} |
|||
|
|||
protected override string GetInputSlot1Name() |
|||
{ |
|||
return "UV"; |
|||
} |
|||
|
|||
protected override string GetInputSlot2Name() |
|||
{ |
|||
return "StartPoint"; |
|||
} |
|||
|
|||
protected override string GetInputSlot3Name() |
|||
{ |
|||
return "EndPoint"; |
|||
} |
|||
|
|||
protected override MaterialSlot GetInputSlot1() |
|||
{ |
|||
return new MaterialSlot(InputSlot1Id, GetInputSlot1Name(), kInputSlot1ShaderName, UnityEngine.Graphing.SlotType.Input, SlotValueType.Vector2, Vector2.zero); |
|||
} |
|||
|
|||
protected override MaterialSlot GetInputSlot2() |
|||
{ |
|||
return new MaterialSlot(InputSlot2Id, GetInputSlot2Name(), kInputSlot2ShaderName, UnityEngine.Graphing.SlotType.Input, SlotValueType.Vector2, Vector2.zero); |
|||
} |
|||
|
|||
protected override MaterialSlot GetInputSlot3() |
|||
{ |
|||
return new MaterialSlot(InputSlot3Id, GetInputSlot3Name(), kInputSlot3ShaderName, UnityEngine.Graphing.SlotType.Input, SlotValueType.Vector2, Vector2.zero); |
|||
} |
|||
|
|||
protected override MaterialSlot GetOutputSlot() |
|||
{ |
|||
return new MaterialSlot(OutputSlotId, GetOutputSlotName(), kOutputSlotShaderName, UnityEngine.Graphing.SlotType.Output, SlotValueType.Vector1, Vector2.zero); |
|||
} |
|||
|
|||
public void GenerateNodeFunction(ShaderGenerator visitor, GenerationMode generationMode) |
|||
{ |
|||
var outputString = new ShaderGenerator(); |
|||
outputString.AddShaderChunk(GetFunctionPrototype("uv", "a", "b"), false); |
|||
outputString.AddShaderChunk("{", false); |
|||
outputString.Indent(); |
|||
|
|||
outputString.AddShaderChunk("float2 aTob = b - a;", false); |
|||
outputString.AddShaderChunk("float2 aTop = uv - a;", false); |
|||
outputString.AddShaderChunk("float t = dot(aTop, aTob) / dot(aTob, aTob);", false); |
|||
outputString.AddShaderChunk("t = clamp(t, 0.0, 1.0);", false); |
|||
outputString.AddShaderChunk("float d = 1.0 / length(uv - (a + aTob * t));", false); |
|||
outputString.AddShaderChunk("return clamp(d, 0.0, 1.0);", false); |
|||
|
|||
outputString.Deindent(); |
|||
outputString.AddShaderChunk("}", false); |
|||
|
|||
visitor.AddShaderChunk(outputString.GetShaderString(0), true); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 10fe1b4258a2ed646925d0ec6bdc35f2 |
|||
timeCreated: 1495489255 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Math/Advanced/Negate")] |
|||
public class NegateNode : Function1Input, IGeneratesFunction |
|||
{ |
|||
public NegateNode() |
|||
{ |
|||
name = "Negate"; |
|||
} |
|||
|
|||
protected override string GetFunctionName() |
|||
{ |
|||
return "unity_negate_" + precision; |
|||
} |
|||
|
|||
public void GenerateNodeFunction(ShaderGenerator visitor, GenerationMode generationMode) |
|||
{ |
|||
var outputString = new ShaderGenerator(); |
|||
outputString.AddShaderChunk(GetFunctionPrototype("arg1"), false); |
|||
outputString.AddShaderChunk("{", false); |
|||
outputString.Indent(); |
|||
outputString.AddShaderChunk("return -1 * arg1;", false); |
|||
outputString.Deindent(); |
|||
outputString.AddShaderChunk("}", false); |
|||
|
|||
visitor.AddShaderChunk(outputString.GetShaderString(0), true); |
|||
} |
|||
} |
|||
} |
撰写
预览
正在加载...
取消
保存
Reference in new issue