summaryrefslogtreecommitdiff
path: root/Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSwitchByPipeline.cs
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2022-03-10 14:07:40 +0800
committerchai <chaifix@163.com>2022-03-10 14:07:40 +0800
commit22891bf59032ba88262824255a706d652031384b (patch)
tree7595439ba9966c9402d37e37cee5e8cf098757d5 /Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSwitchByPipeline.cs
parent8b04ea73e540067f83870b61d89db4868fea5e8a (diff)
* move folder
Diffstat (limited to 'Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSwitchByPipeline.cs')
-rw-r--r--Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSwitchByPipeline.cs102
1 files changed, 0 insertions, 102 deletions
diff --git a/Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSwitchByPipeline.cs b/Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSwitchByPipeline.cs
deleted file mode 100644
index 5a05605e..00000000
--- a/Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSwitchByPipeline.cs
+++ /dev/null
@@ -1,102 +0,0 @@
-// Amplify Shader Editor - Visual Shader Editing Tool
-// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
-
-using UnityEngine;
-using UnityEditor;
-using System;
-
-namespace AmplifyShaderEditor
-{
- [Serializable]
- [NodeAttributes( "Switch by Pipeline", "Functions", "Executes branch according to current pipeline", NodeAvailabilityFlags = (int)NodeAvailability.ShaderFunction )]
- public sealed class FunctionSwitchByPipeline : ParentNode
- {
- protected override void CommonInit( int uniqueId )
- {
- base.CommonInit( uniqueId );
- AddInputPort( WirePortDataType.FLOAT, false, "Surface", -1, MasterNodePortCategory.Fragment, 0 );
- AddInputPort( WirePortDataType.FLOAT, false, "Default RP", -1, MasterNodePortCategory.Fragment, 3 );
- AddInputPort( WirePortDataType.FLOAT, false, "Lightweight", -1, MasterNodePortCategory.Fragment, 1 );
- AddInputPort( WirePortDataType.FLOAT, false, "HD", -1, MasterNodePortCategory.Fragment, 2 );
- AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue );
-
- }
-
- public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true )
- {
- base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode );
- GetInputPortByUniqueId( portId ).MatchPortToConnection();
- UpdateOutputPort();
- }
-
- public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type )
- {
- base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type );
- GetInputPortByUniqueId( outputPortId ).MatchPortToConnection();
- UpdateOutputPort();
- }
-
- void UpdateOutputPort()
- {
- switch( UIUtils.CurrentWindow.OutsideGraph.CurrentSRPType )
- {
- case TemplateSRPType.BuiltIn:
- {
- InputPort port = UIUtils.CurrentWindow.OutsideGraph.IsStandardSurface ? GetInputPortByUniqueId( 0 ) : GetInputPortByUniqueId( 3 );
- m_outputPorts[ 0 ].ChangeType( port.DataType, false );
- }
- break;
- case TemplateSRPType.Lightweight:
- {
- InputPort port = GetInputPortByUniqueId( 1 );
- m_outputPorts[ 0 ].ChangeType( port.DataType, false );
- }
- break;
- case TemplateSRPType.HD:
- {
- InputPort port = GetInputPortByUniqueId( 2 );
- m_outputPorts[ 0 ].ChangeType( port.DataType, false );
- }
- break;
- }
- }
-
- public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar )
- {
- base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar );
- switch( dataCollector.CurrentSRPType )
- {
- case TemplateSRPType.BuiltIn:
- {
- InputPort port = UIUtils.CurrentWindow.OutsideGraph.IsStandardSurface ? GetInputPortByUniqueId( 0 ) : GetInputPortByUniqueId( 3 );
- return port.GeneratePortInstructions( ref dataCollector );
- }
- case TemplateSRPType.Lightweight:
- {
- InputPort port = GetInputPortByUniqueId( 1 );
- return port.GeneratePortInstructions( ref dataCollector );
- }
- case TemplateSRPType.HD:
- {
- InputPort port = GetInputPortByUniqueId( 2 );
- return port.GeneratePortInstructions( ref dataCollector );
- }
- }
-
- return "0";
- }
-
- public override void RefreshExternalReferences()
- {
- base.RefreshExternalReferences();
- if( UIUtils.CurrentShaderVersion() < 16303 )
- {
- InputPort standardPort = GetInputPortByUniqueId( 0 );
- if( standardPort.IsConnected )
- {
- UIUtils.SetConnection( UniqueId, 3, standardPort.GetConnection().NodeId, standardPort.GetConnection().PortId );
- }
- }
- }
- }
-}