Peter Bay Bastian
7 年前
当前提交
d00ca780
共有 67 个文件被更改,包括 1255 次插入 和 206 次删除
-
2MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/DynamicVectorMaterialSlot.cs
-
8MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/MaterialSlot.cs
-
20MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/PreviewProperty.cs
-
36MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/SerializableCubemap.cs
-
35MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/SerializableTexture.cs
-
2MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/Vector1MaterialSlot.cs
-
2MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/Vector2MaterialSlot.cs
-
2MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/Vector3MaterialSlot.cs
-
2MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/Vector4MaterialSlot.cs
-
22MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Implementation/NodeUtils.cs
-
68MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/LightweightPipeline/LightWeightPBRSubShader.cs
-
36MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/LightweightPipeline/LightWeightUnlitSubShader.cs
-
20MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/MasterNodes/PBRMasterNode.cs
-
24MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/MasterNodes/UnlitMasterNode.cs
-
6MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/AbstractMaterialNode.cs
-
7MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/CodeFunctionNode.cs
-
2MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/Vector1Node.cs
-
2MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/Vector2Node.cs
-
8MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/Vector3Node.cs
-
9MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/Vector4Node.cs
-
13MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/PropertyNode.cs
-
36MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/MasterNode.cs
-
1MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/PropertyType.cs
-
9MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/SlotValue.cs
-
8MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Util/GraphUtil.cs
-
2MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Util/ShaderGenerator.cs
-
1MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/GraphInspectorView.cs
-
8MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/ShaderPropertyView.cs
-
20MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/MaterialGraphEditWindow.cs
-
16MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/PreviewManager.cs
-
46MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/PreviewSceneResources.cs
-
14MaterialGraphProject/Assets/UnityShaderEditor/Editor/Importers/ShaderGraphImporter.cs
-
11MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Styles/MaterialGraph.uss
-
8MaterialGraphProject/Assets/UnityShaderEditor/Editor/Templates/lightweightPBRForwardPass.template
-
26MaterialGraphProject/Assets/UnityShaderEditor/Editor/Templates/lightweightUnlitPass.template
-
91MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/BooleanMaterialSlot.cs
-
11MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/BooleanMaterialSlot.cs.meta
-
58MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/BooleanShaderProperty.cs
-
3MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/BooleanShaderProperty.cs.meta
-
84MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/BooleanNode.cs
-
12MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/Basic/BooleanNode.cs.meta
-
8MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Utility/Logic.meta
-
30MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/Slots/BooleanSlotControlView.cs
-
3MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/Slots/BooleanSlotControlView.cs.meta
-
51MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Shaders/BlitNoAlpha.shader
-
11MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Shaders/BlitNoAlpha.shader.meta
-
8MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Utility/Logic/ComparisonNode.cs.meta
-
8MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Utility/Logic/BranchNode.cs.meta
-
38MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Utility/Logic/AllNode.cs
-
8MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Utility/Logic/AllNode.cs.meta
-
38MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Utility/Logic/AnyNode.cs
-
8MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Utility/Logic/AnyNode.cs.meta
-
38MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Utility/Logic/IsInfiniteNode.cs
-
8MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Utility/Logic/IsInfiniteNode.cs.meta
-
38MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Utility/Logic/IsNanNode.cs
-
8MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Utility/Logic/IsNanNode.cs.meta
-
39MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Utility/Logic/AndNode.cs
-
8MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Utility/Logic/AndNode.cs.meta
-
35MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Utility/Logic/BranchNode.cs
-
39MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Utility/Logic/NandNode.cs
-
8MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Utility/Logic/NandNode.cs.meta
-
39MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Utility/Logic/OrNode.cs
-
8MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Utility/Logic/OrNode.cs.meta
-
38MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Utility/Logic/NotNode.cs
-
8MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Utility/Logic/NotNode.cs.meta
-
145MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Utility/Logic/ComparisonNode.cs
|
|||
using System; |
|||
using UnityEditor.Graphing; |
|||
using UnityEditor.ShaderGraph.Drawing.Slots; |
|||
using UnityEngine; |
|||
using UnityEngine.Experimental.UIElements; |
|||
|
|||
namespace UnityEditor.ShaderGraph |
|||
{ |
|||
[Serializable] |
|||
public class BooleanMaterialSlot : MaterialSlot, IMaterialSlotHasValue<bool> |
|||
{ |
|||
[SerializeField] |
|||
private bool m_Value; |
|||
|
|||
[SerializeField] |
|||
private bool m_DefaultValue; |
|||
|
|||
public BooleanMaterialSlot() |
|||
{} |
|||
|
|||
public BooleanMaterialSlot( |
|||
int slotId, |
|||
string displayName, |
|||
string shaderOutputName, |
|||
SlotType slotType, |
|||
bool value, |
|||
ShaderStage shaderStage = ShaderStage.Dynamic, |
|||
bool hidden = false) |
|||
: base(slotId, displayName, shaderOutputName, slotType, shaderStage, hidden) |
|||
{ |
|||
m_DefaultValue = value; |
|||
m_Value = value; |
|||
} |
|||
|
|||
public override VisualElement InstantiateControl() |
|||
{ |
|||
return new BooleanSlotControlView(this); |
|||
} |
|||
|
|||
public bool defaultValue { get { return m_DefaultValue; } } |
|||
|
|||
public bool value |
|||
{ |
|||
get { return m_Value; } |
|||
set { m_Value = value; } |
|||
} |
|||
|
|||
protected override string ConcreteSlotValueAsVariable(AbstractMaterialNode.OutputPrecision precision) |
|||
{ |
|||
return (value ? 1 : 0).ToString(); |
|||
} |
|||
|
|||
public override void AddDefaultProperty(PropertyCollector properties, GenerationMode generationMode) |
|||
{ |
|||
if (!generationMode.IsPreview()) |
|||
return; |
|||
|
|||
var matOwner = owner as AbstractMaterialNode; |
|||
if (matOwner == null) |
|||
throw new Exception(string.Format("Slot {0} either has no owner, or the owner is not a {1}", this, typeof(AbstractMaterialNode))); |
|||
|
|||
var property = new BooleanShaderProperty() |
|||
{ |
|||
overrideReferenceName = matOwner.GetVariableNameForSlot(id), |
|||
generatePropertyBlock = false, |
|||
value = value |
|||
}; |
|||
properties.AddShaderProperty(property); |
|||
} |
|||
|
|||
public override SlotValueType valueType { get { return SlotValueType.Boolean; } } |
|||
public override ConcreteSlotValueType concreteValueType { get { return ConcreteSlotValueType.Boolean; } } |
|||
|
|||
public override PreviewProperty GetPreviewProperty(string name) |
|||
{ |
|||
var pp = new PreviewProperty(PropertyType.Boolean) |
|||
{ |
|||
name = name, |
|||
booleanValue = value |
|||
}; |
|||
return pp; |
|||
} |
|||
|
|||
public override void CopyValuesFrom(MaterialSlot foundSlot) |
|||
{ |
|||
var slot = foundSlot as BooleanMaterialSlot; |
|||
if (slot != null) |
|||
value = slot.value; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: efad93f5b8245a54fb4fee128fc0f3f6 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using System.Text; |
|||
using UnityEditor.Graphing; |
|||
using UnityEditor.ShaderGraph.Drawing.Controls; |
|||
using UnityEngine; |
|||
|
|||
namespace UnityEditor.ShaderGraph |
|||
{ |
|||
[Serializable] |
|||
public class BooleanShaderProperty : AbstractShaderProperty<bool> |
|||
{ |
|||
public BooleanShaderProperty() |
|||
{ |
|||
displayName = "Boolean"; |
|||
} |
|||
|
|||
public override PropertyType propertyType |
|||
{ |
|||
get { return PropertyType.Boolean; } |
|||
} |
|||
|
|||
public override Vector4 defaultValue |
|||
{ |
|||
get { return new Vector4(); } |
|||
} |
|||
|
|||
public override string GetPropertyBlockString() |
|||
{ |
|||
var result = new StringBuilder(); |
|||
result.Append("[Toggle] "); |
|||
result.Append(referenceName); |
|||
result.Append("(\""); |
|||
result.Append(displayName); |
|||
result.Append("\", Float) = "); |
|||
result.Append(value == true ? 1 : 0); |
|||
return result.ToString(); |
|||
} |
|||
|
|||
public override string GetPropertyDeclarationString(string delimiter = ";") |
|||
{ |
|||
return string.Format("float {0}{1}", referenceName, delimiter); |
|||
} |
|||
|
|||
public override PreviewProperty GetPreviewMaterialProperty() |
|||
{ |
|||
return new PreviewProperty(PropertyType.Boolean) |
|||
{ |
|||
name = referenceName, |
|||
booleanValue = value |
|||
}; |
|||
} |
|||
|
|||
public override INode ToConcreteNode() |
|||
{ |
|||
return new BooleanNode { value = new Toggle(value) }; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 8891f9466e6b01c498c3f4b2c6abc0eb |
|||
timeCreated: 1505346922 |
|
|||
using System.Collections.Generic; |
|||
using UnityEditor.ShaderGraph.Drawing.Controls; |
|||
using UnityEngine; |
|||
using UnityEditor.Graphing; |
|||
|
|||
namespace UnityEditor.ShaderGraph |
|||
{ |
|||
[Title("Input", "Basic", "Boolean")] |
|||
public class BooleanNode : AbstractMaterialNode, IGeneratesBodyCode, IPropertyFromNode |
|||
{ |
|||
[SerializeField] |
|||
private bool m_Value; |
|||
|
|||
public const int OutputSlotId = 0; |
|||
private const string kOutputSlotName = "Out"; |
|||
|
|||
public BooleanNode() |
|||
{ |
|||
name = "Boolean"; |
|||
UpdateNodeAfterDeserialization(); |
|||
} |
|||
|
|||
public sealed override void UpdateNodeAfterDeserialization() |
|||
{ |
|||
AddSlot(new BooleanMaterialSlot(OutputSlotId, kOutputSlotName, kOutputSlotName, SlotType.Output, false)); |
|||
RemoveSlotsNameNotMatching(new[] { OutputSlotId }); |
|||
} |
|||
|
|||
[ToggleControl("")] |
|||
public Toggle value |
|||
{ |
|||
get { return new Toggle(m_Value); } |
|||
set |
|||
{ |
|||
if (m_Value == value.isOn) |
|||
return; |
|||
m_Value = value.isOn; |
|||
Dirty(ModificationScope.Node); |
|||
} |
|||
} |
|||
|
|||
public override void CollectShaderProperties(PropertyCollector properties, GenerationMode generationMode) |
|||
{ |
|||
if (!generationMode.IsPreview()) |
|||
return; |
|||
|
|||
properties.AddShaderProperty(new BooleanShaderProperty() |
|||
{ |
|||
overrideReferenceName = GetVariableNameForNode(), |
|||
generatePropertyBlock = false, |
|||
value = m_Value |
|||
}); |
|||
} |
|||
|
|||
public void GenerateNodeCode(ShaderGenerator visitor, GenerationMode generationMode) |
|||
{ |
|||
if (generationMode.IsPreview()) |
|||
return; |
|||
|
|||
visitor.AddShaderChunk(precision + " " + GetVariableNameForNode() + " = " + (m_Value ? 1 : 0) + ";", true); |
|||
} |
|||
|
|||
public override string GetVariableNameForSlot(int slotId) |
|||
{ |
|||
return GetVariableNameForNode(); |
|||
} |
|||
|
|||
public override void CollectPreviewMaterialProperties(List<PreviewProperty> properties) |
|||
{ |
|||
properties.Add(new PreviewProperty(PropertyType.Boolean) |
|||
{ |
|||
name = GetVariableNameForNode(), |
|||
booleanValue = m_Value |
|||
}); |
|||
} |
|||
|
|||
public IShaderProperty AsShaderProperty() |
|||
{ |
|||
return new BooleanShaderProperty { value = m_Value }; |
|||
} |
|||
|
|||
public int outputSlotId { get { return OutputSlotId; } } |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: a6bd4d4655c0b9046a14e6ab0caebdc3 |
|||
timeCreated: 1445864587 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 1c5103f75b5ec7445bb4c7b5a36f6aec |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using UnityEditor.Experimental.UIElements; |
|||
using UnityEditor.Graphing; |
|||
using UnityEngine; |
|||
using UnityEngine.Experimental.UIElements; |
|||
|
|||
namespace UnityEditor.ShaderGraph.Drawing.Slots |
|||
{ |
|||
public class BooleanSlotControlView : VisualElement |
|||
{ |
|||
BooleanMaterialSlot m_Slot; |
|||
|
|||
public BooleanSlotControlView(BooleanMaterialSlot slot) |
|||
{ |
|||
m_Slot = slot; |
|||
Action changedToggle = () => { OnChangeToggle(); }; |
|||
var toggleField = new UnityEngine.Experimental.UIElements.Toggle(changedToggle); |
|||
Add(toggleField); |
|||
} |
|||
|
|||
void OnChangeToggle() |
|||
{ |
|||
m_Slot.owner.owner.owner.RegisterCompleteObjectUndo("Toggle Change"); |
|||
var value = m_Slot.value; |
|||
value = !value; |
|||
m_Slot.value = value; |
|||
m_Slot.owner.Dirty(ModificationScope.Node); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 7fc29d436587748dcaaefd8669c3d946 |
|||
timeCreated: 1510659384 |
|
|||
Shader "Hidden/BlitNoAlpha" |
|||
{ |
|||
Properties |
|||
{ |
|||
_MainTex ("Texture", any) = "" {} |
|||
} |
|||
SubShader { |
|||
Pass { |
|||
ZTest Always Cull Off ZWrite Off |
|||
|
|||
CGPROGRAM |
|||
#pragma vertex vert |
|||
#pragma fragment frag |
|||
#include "UnityCG.cginc" |
|||
|
|||
UNITY_DECLARE_SCREENSPACE_TEXTURE(_MainTex); |
|||
uniform float4 _MainTex_ST; |
|||
|
|||
struct appdata_t { |
|||
float4 vertex : POSITION; |
|||
float2 texcoord : TEXCOORD0; |
|||
UNITY_VERTEX_INPUT_INSTANCE_ID |
|||
}; |
|||
|
|||
struct v2f { |
|||
float4 vertex : SV_POSITION; |
|||
float2 texcoord : TEXCOORD0; |
|||
UNITY_VERTEX_OUTPUT_STEREO |
|||
}; |
|||
|
|||
v2f vert (appdata_t v) |
|||
{ |
|||
v2f o; |
|||
UNITY_SETUP_INSTANCE_ID(v); |
|||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); |
|||
o.vertex = UnityObjectToClipPos(v.vertex); |
|||
o.texcoord = TRANSFORM_TEX(v.texcoord.xy, _MainTex); |
|||
return o; |
|||
} |
|||
|
|||
fixed4 frag (v2f i) : SV_Target |
|||
{ |
|||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); |
|||
return half4(UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, i.texcoord).xyz, 1.0); |
|||
} |
|||
ENDCG |
|||
|
|||
} |
|||
} |
|||
Fallback Off |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 50b406436c6214c49aaaa6011b71dde8 |
|||
timeCreated: 1502007198 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
externalObjects: {} |
|||
defaultTextures: [] |
|||
nonModifiableTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: c66cc68d0d0862b4c8ddfc00093d0ae0 |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|
|||
fileFormatVersion: 2 |
|||
guid: 15ad3dc0ff22d7748af5e82ef5503d32 |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|
|||
using System.Reflection; |
|||
using UnityEngine; |
|||
using UnityEditor.Graphing; |
|||
using UnityEditor.ShaderGraph.Drawing.Controls; |
|||
|
|||
namespace UnityEditor.ShaderGraph |
|||
{ |
|||
[Title("Utility", "Logic", "All")] |
|||
public class AllNode : CodeFunctionNode |
|||
{ |
|||
public AllNode() |
|||
{ |
|||
name = "All"; |
|||
} |
|||
|
|||
public override bool hasPreview |
|||
{ |
|||
get { return false; } |
|||
} |
|||
|
|||
protected override MethodInfo GetFunctionToConvert() |
|||
{ |
|||
return GetType().GetMethod("Unity_All", BindingFlags.Static | BindingFlags.NonPublic); |
|||
} |
|||
|
|||
static string Unity_All( |
|||
[Slot(0, Binding.None)] DynamicDimensionVector In, |
|||
[Slot(1, Binding.None)] out Boolean Out) |
|||
{ |
|||
return |
|||
@"
|
|||
{ |
|||
Out = all(In); |
|||
} |
|||
";
|
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: aa03a542537ab4fb4a01a004efa97f58 |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|
|||
using System.Reflection; |
|||
using UnityEngine; |
|||
using UnityEditor.Graphing; |
|||
using UnityEditor.ShaderGraph.Drawing.Controls; |
|||
|
|||
namespace UnityEditor.ShaderGraph |
|||
{ |
|||
[Title("Utility", "Logic", "Any")] |
|||
public class AnyNode : CodeFunctionNode |
|||
{ |
|||
public AnyNode() |
|||
{ |
|||
name = "Any"; |
|||
} |
|||
|
|||
public override bool hasPreview |
|||
{ |
|||
get { return false; } |
|||
} |
|||
|
|||
protected override MethodInfo GetFunctionToConvert() |
|||
{ |
|||
return GetType().GetMethod("Unity_Any", BindingFlags.Static | BindingFlags.NonPublic); |
|||
} |
|||
|
|||
static string Unity_Any( |
|||
[Slot(0, Binding.None)] DynamicDimensionVector In, |
|||
[Slot(1, Binding.None)] out Boolean Out) |
|||
{ |
|||
return |
|||
@"
|
|||
{ |
|||
Out = any(In); |
|||
} |
|||
";
|
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: f3d072ddeeee848848f2e59dbb5cf1d9 |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|
|||
using System.Reflection; |
|||
using UnityEngine; |
|||
using UnityEditor.Graphing; |
|||
using UnityEditor.ShaderGraph.Drawing.Controls; |
|||
|
|||
namespace UnityEditor.ShaderGraph |
|||
{ |
|||
[Title("Utility", "Logic", "Is Infinite")] |
|||
public class IsInfiniteNode : CodeFunctionNode |
|||
{ |
|||
public IsInfiniteNode() |
|||
{ |
|||
name = "Is Infinite"; |
|||
} |
|||
|
|||
public override bool hasPreview |
|||
{ |
|||
get { return false; } |
|||
} |
|||
|
|||
protected override MethodInfo GetFunctionToConvert() |
|||
{ |
|||
return GetType().GetMethod("Unity_IsInfinite", BindingFlags.Static | BindingFlags.NonPublic); |
|||
} |
|||
|
|||
static string Unity_IsInfinite( |
|||
[Slot(0, Binding.None)] DynamicDimensionVector In, |
|||
[Slot(1, Binding.None)] out Boolean Out) |
|||
{ |
|||
return |
|||
@"
|
|||
{ |
|||
Out = isinf(In); |
|||
} |
|||
";
|
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 6eaf1bad910084b85ac9ead4319c7820 |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|
|||
using System.Reflection; |
|||
using UnityEngine; |
|||
using UnityEditor.Graphing; |
|||
using UnityEditor.ShaderGraph.Drawing.Controls; |
|||
|
|||
namespace UnityEditor.ShaderGraph |
|||
{ |
|||
[Title("Utility", "Logic", "Is NaN")] |
|||
public class IsNanNode : CodeFunctionNode |
|||
{ |
|||
public IsNanNode() |
|||
{ |
|||
name = "Is NaN"; |
|||
} |
|||
|
|||
public override bool hasPreview |
|||
{ |
|||
get { return false; } |
|||
} |
|||
|
|||
protected override MethodInfo GetFunctionToConvert() |
|||
{ |
|||
return GetType().GetMethod("Unity_IsNaN", BindingFlags.Static | BindingFlags.NonPublic); |
|||
} |
|||
|
|||
static string Unity_IsNaN( |
|||
[Slot(0, Binding.None)] DynamicDimensionVector In, |
|||
[Slot(1, Binding.None)] out Boolean Out) |
|||
{ |
|||
return |
|||
@"
|
|||
{ |
|||
Out = isnan(In); |
|||
} |
|||
";
|
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 0e15b8359c9db4d0ea27f4deab94137e |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|
|||
using System.Reflection; |
|||
using UnityEngine; |
|||
using UnityEditor.Graphing; |
|||
using UnityEditor.ShaderGraph.Drawing.Controls; |
|||
|
|||
namespace UnityEditor.ShaderGraph |
|||
{ |
|||
[Title("Utility", "Logic", "And")] |
|||
public class AndNode : CodeFunctionNode |
|||
{ |
|||
public AndNode() |
|||
{ |
|||
name = "And"; |
|||
} |
|||
|
|||
public override bool hasPreview |
|||
{ |
|||
get { return false; } |
|||
} |
|||
|
|||
protected override MethodInfo GetFunctionToConvert() |
|||
{ |
|||
return GetType().GetMethod("Unity_And", BindingFlags.Static | BindingFlags.NonPublic); |
|||
} |
|||
|
|||
static string Unity_And( |
|||
[Slot(0, Binding.None)] Boolean A, |
|||
[Slot(1, Binding.None)] Boolean B, |
|||
[Slot(2, Binding.None)] out Boolean Out) |
|||
{ |
|||
return |
|||
@"
|
|||
{ |
|||
Out = A && B; |
|||
} |
|||
";
|
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 34929a6d0bb40407fb00206ab0a10fa1 |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|
|||
using System.Reflection; |
|||
using UnityEngine; |
|||
using UnityEditor.Graphing; |
|||
using UnityEditor.ShaderGraph.Drawing.Controls; |
|||
|
|||
namespace UnityEditor.ShaderGraph |
|||
{ |
|||
[Title("Utility", "Logic", "Branch")] |
|||
public class BranchNode : CodeFunctionNode |
|||
{ |
|||
public BranchNode() |
|||
{ |
|||
name = "Branch"; |
|||
} |
|||
|
|||
protected override MethodInfo GetFunctionToConvert() |
|||
{ |
|||
return GetType().GetMethod("Unity_Branch", BindingFlags.Static | BindingFlags.NonPublic); |
|||
} |
|||
|
|||
static string Unity_Branch( |
|||
[Slot(0, Binding.None)] Boolean Predicate, |
|||
[Slot(1, Binding.None, 1, 1, 1, 1)] DynamicDimensionVector True, |
|||
[Slot(2, Binding.None, 0, 0, 0, 0)] DynamicDimensionVector False, |
|||
[Slot(3, Binding.None)] out DynamicDimensionVector Out) |
|||
{ |
|||
return |
|||
@"
|
|||
{ |
|||
Out = (Predicate * True) + abs((Predicate - 1) * False); |
|||
} |
|||
";
|
|||
} |
|||
} |
|||
} |
|
|||
using System.Reflection; |
|||
using UnityEngine; |
|||
using UnityEditor.Graphing; |
|||
using UnityEditor.ShaderGraph.Drawing.Controls; |
|||
|
|||
namespace UnityEditor.ShaderGraph |
|||
{ |
|||
[Title("Utility", "Logic", "Nand")] |
|||
public class NandNode : CodeFunctionNode |
|||
{ |
|||
public NandNode() |
|||
{ |
|||
name = "Nand"; |
|||
} |
|||
|
|||
public override bool hasPreview |
|||
{ |
|||
get { return false; } |
|||
} |
|||
|
|||
protected override MethodInfo GetFunctionToConvert() |
|||
{ |
|||
return GetType().GetMethod("Unity_Nand", BindingFlags.Static | BindingFlags.NonPublic); |
|||
} |
|||
|
|||
static string Unity_Nand( |
|||
[Slot(0, Binding.None)] Boolean A, |
|||
[Slot(1, Binding.None)] Boolean B, |
|||
[Slot(2, Binding.None)] out Boolean Out) |
|||
{ |
|||
return |
|||
@"
|
|||
{ |
|||
Out = !A && !B; |
|||
} |
|||
";
|
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 4defde87a9d5e44d8b8900d3f8ef6440 |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|
|||
using System.Reflection; |
|||
using UnityEngine; |
|||
using UnityEditor.Graphing; |
|||
using UnityEditor.ShaderGraph.Drawing.Controls; |
|||
|
|||
namespace UnityEditor.ShaderGraph |
|||
{ |
|||
[Title("Utility", "Logic", "Or")] |
|||
public class OrNode : CodeFunctionNode |
|||
{ |
|||
public OrNode() |
|||
{ |
|||
name = "Or"; |
|||
} |
|||
|
|||
public override bool hasPreview |
|||
{ |
|||
get { return false; } |
|||
} |
|||
|
|||
protected override MethodInfo GetFunctionToConvert() |
|||
{ |
|||
return GetType().GetMethod("Unity_Or", BindingFlags.Static | BindingFlags.NonPublic); |
|||
} |
|||
|
|||
static string Unity_Or( |
|||
[Slot(0, Binding.None)] Boolean A, |
|||
[Slot(1, Binding.None)] Boolean B, |
|||
[Slot(2, Binding.None)] out Boolean Out) |
|||
{ |
|||
return |
|||
@"
|
|||
{ |
|||
Out = A || B; |
|||
} |
|||
";
|
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 0f6f860c0f1e24214b5d2974cc624227 |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|
|||
using System.Reflection; |
|||
using UnityEngine; |
|||
using UnityEditor.Graphing; |
|||
using UnityEditor.ShaderGraph.Drawing.Controls; |
|||
|
|||
namespace UnityEditor.ShaderGraph |
|||
{ |
|||
[Title("Utility", "Logic", "Not")] |
|||
public class NotNode : CodeFunctionNode |
|||
{ |
|||
public NotNode() |
|||
{ |
|||
name = "Not"; |
|||
} |
|||
|
|||
public override bool hasPreview |
|||
{ |
|||
get { return false; } |
|||
} |
|||
|
|||
protected override MethodInfo GetFunctionToConvert() |
|||
{ |
|||
return GetType().GetMethod("Unity_Not", BindingFlags.Static | BindingFlags.NonPublic); |
|||
} |
|||
|
|||
static string Unity_Not( |
|||
[Slot(0, Binding.None)] Boolean In, |
|||
[Slot(1, Binding.None)] out Boolean Out) |
|||
{ |
|||
return |
|||
@"
|
|||
{ |
|||
Out = !In; |
|||
} |
|||
";
|
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: acb4138f9cef644dfa59102e871d1820 |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|
|||
using System.Reflection; |
|||
using UnityEngine; |
|||
using UnityEditor.Graphing; |
|||
using UnityEditor.ShaderGraph.Drawing.Controls; |
|||
|
|||
namespace UnityEditor.ShaderGraph |
|||
{ |
|||
public enum ComparisonType |
|||
{ |
|||
Equal, |
|||
NotEqual, |
|||
Less, |
|||
LessOrEqual, |
|||
Greater, |
|||
GreaterOrEqual |
|||
}; |
|||
|
|||
[Title("Utility", "Logic", "Comparison")] |
|||
public class ComparisonNode : CodeFunctionNode |
|||
{ |
|||
public ComparisonNode() |
|||
{ |
|||
name = "Comparison"; |
|||
} |
|||
|
|||
[SerializeField] |
|||
private ComparisonType m_ComparisonType = ComparisonType.Equal; |
|||
|
|||
[EnumControl("")] |
|||
public ComparisonType comparisonType |
|||
{ |
|||
get { return m_ComparisonType; } |
|||
set |
|||
{ |
|||
if (m_ComparisonType == value) |
|||
return; |
|||
|
|||
m_ComparisonType = value; |
|||
Dirty(ModificationScope.Graph); |
|||
} |
|||
} |
|||
|
|||
public override bool hasPreview |
|||
{ |
|||
get { return false; } |
|||
} |
|||
|
|||
protected override MethodInfo GetFunctionToConvert() |
|||
{ |
|||
switch(comparisonType) |
|||
{ |
|||
case ComparisonType.NotEqual: |
|||
return GetType().GetMethod("Unity_Comparison_NotEqual", BindingFlags.Static | BindingFlags.NonPublic); |
|||
case ComparisonType.Less: |
|||
return GetType().GetMethod("Unity_Comparison_Less", BindingFlags.Static | BindingFlags.NonPublic); |
|||
case ComparisonType.LessOrEqual: |
|||
return GetType().GetMethod("Unity_Comparison_LessOrEqual", BindingFlags.Static | BindingFlags.NonPublic); |
|||
case ComparisonType.Greater: |
|||
return GetType().GetMethod("Unity_Comparison_Greater", BindingFlags.Static | BindingFlags.NonPublic); |
|||
case ComparisonType.GreaterOrEqual: |
|||
return GetType().GetMethod("Unity_Comparison_GreaterOrEqual", BindingFlags.Static | BindingFlags.NonPublic); |
|||
default: |
|||
return GetType().GetMethod("Unity_Comparison_Equal", BindingFlags.Static | BindingFlags.NonPublic); |
|||
} |
|||
} |
|||
|
|||
static string Unity_Comparison_Equal( |
|||
[Slot(0, Binding.None)] Vector1 A, |
|||
[Slot(1, Binding.None)] Vector1 B, |
|||
[Slot(2, Binding.None)] out Boolean Out) |
|||
{ |
|||
return |
|||
@"
|
|||
{ |
|||
Out = A == B ? 1 : 0; |
|||
} |
|||
";
|
|||
} |
|||
|
|||
static string Unity_Comparison_NotEqual( |
|||
[Slot(0, Binding.None)] Vector1 A, |
|||
[Slot(1, Binding.None)] Vector1 B, |
|||
[Slot(2, Binding.None)] out Boolean Out) |
|||
{ |
|||
return |
|||
@"
|
|||
{ |
|||
Out = A != B ? 1 : 0; |
|||
} |
|||
";
|
|||
} |
|||
|
|||
static string Unity_Comparison_Less( |
|||
[Slot(0, Binding.None)] Vector1 A, |
|||
[Slot(1, Binding.None)] Vector1 B, |
|||
[Slot(2, Binding.None)] out Boolean Out) |
|||
{ |
|||
return |
|||
@"
|
|||
{ |
|||
Out = A < B ? 1 : 0; |
|||
} |
|||
";
|
|||
} |
|||
|
|||
static string Unity_Comparison_LessOrEqual( |
|||
[Slot(0, Binding.None)] Vector1 A, |
|||
[Slot(1, Binding.None)] Vector1 B, |
|||
[Slot(2, Binding.None)] out Boolean Out) |
|||
{ |
|||
return |
|||
@"
|
|||
{ |
|||
Out = A <= B ? 1 : 0; |
|||
} |
|||
";
|
|||
} |
|||
|
|||
static string Unity_Comparison_Greater( |
|||
[Slot(0, Binding.None)] Vector1 A, |
|||
[Slot(1, Binding.None)] Vector1 B, |
|||
[Slot(2, Binding.None)] out Boolean Out) |
|||
{ |
|||
return |
|||
@"
|
|||
{ |
|||
Out = A > B ? 1 : 0; |
|||
} |
|||
";
|
|||
} |
|||
|
|||
static string Unity_Comparison_GreaterOrEqual( |
|||
[Slot(0, Binding.None)] Vector1 A, |
|||
[Slot(1, Binding.None)] Vector1 B, |
|||
[Slot(2, Binding.None)] out Boolean Out) |
|||
{ |
|||
return |
|||
@"
|
|||
{ |
|||
Out = A >= B ? 1 : 0; |
|||
} |
|||
";
|
|||
} |
|||
} |
|||
} |
撰写
预览
正在加载...
取消
保存
Reference in new issue