bfogerty
8 年前
当前提交
a82b356e
共有 2 个文件被更改,包括 78 次插入 和 0 次删除
-
66MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Procedural/PulseNode.cs
-
12MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Procedural/PulseNode.cs.meta
|
|||
namespace UnityEngine.MaterialGraph |
|||
{ |
|||
[Title("Procedural/Pulse")] |
|||
public class PulseNode : Function3Input, IGeneratesFunction |
|||
{ |
|||
public PulseNode() |
|||
{ |
|||
name = "Pulse"; |
|||
} |
|||
|
|||
protected override string GetFunctionName() |
|||
{ |
|||
return "unity_pulsenode_" + precision; |
|||
} |
|||
|
|||
protected override string GetInputSlot1Name() |
|||
{ |
|||
return "Value"; |
|||
} |
|||
|
|||
protected override string GetInputSlot2Name() |
|||
{ |
|||
return "MinValue"; |
|||
} |
|||
|
|||
protected override string GetInputSlot3Name() |
|||
{ |
|||
return "MaxValue"; |
|||
} |
|||
|
|||
protected override MaterialSlot GetInputSlot1() |
|||
{ |
|||
return new MaterialSlot(InputSlot1Id, GetInputSlot1Name(), kInputSlot1ShaderName, UnityEngine.Graphing.SlotType.Input, SlotValueType.Vector1, Vector2.zero); |
|||
} |
|||
|
|||
protected override MaterialSlot GetInputSlot2() |
|||
{ |
|||
return new MaterialSlot(InputSlot2Id, GetInputSlot2Name(), kInputSlot2ShaderName, UnityEngine.Graphing.SlotType.Input, SlotValueType.Vector1, Vector2.zero); |
|||
} |
|||
|
|||
protected override MaterialSlot GetInputSlot3() |
|||
{ |
|||
return new MaterialSlot(InputSlot3Id, GetInputSlot3Name(), kInputSlot3ShaderName, 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("value", "minValue", "maxValue"), false); |
|||
outputString.AddShaderChunk("{", false); |
|||
outputString.Indent(); |
|||
|
|||
outputString.AddShaderChunk("return step( minValue, value ) - step( maxValue, value );", false); |
|||
|
|||
outputString.Deindent(); |
|||
outputString.AddShaderChunk("}", false); |
|||
|
|||
visitor.AddShaderChunk(outputString.GetShaderString(0), true); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: f6a740415478c444bb056f9d9d941de2 |
|||
timeCreated: 1495559217 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue