diff options
author | chai <chaifix@163.com> | 2020-10-23 13:08:43 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2020-10-23 13:08:43 +0800 |
commit | b82da95b5181ac8bbae38efb13e950d5e88a4caa (patch) | |
tree | 48a6f3269276484bbc7cfc95f0651f40a2176aa1 /Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TFHCRemapNode.cs | |
parent | 917e9e0b320775634dc2e710f7deac74fd0822f0 (diff) |
*移动amplify shader editor到third party目录
Diffstat (limited to 'Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TFHCRemapNode.cs')
-rw-r--r-- | Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TFHCRemapNode.cs | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TFHCRemapNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TFHCRemapNode.cs deleted file mode 100644 index 1b77ed5f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TFHCRemapNode.cs +++ /dev/null @@ -1,64 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -// -// Custom Node Remap -// Donated by The Four Headed Cat - @fourheadedcat -using UnityEngine; -using System; -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Remap", "Math Operators", "Remap value from old min - max range to new min - max range", null, KeyCode.None, true, false, null, null, "The Four Headed Cat - @fourheadedcat" )] - public sealed class TFHCRemapNode : DynamicTypeNode - { - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_inputPorts[ 0 ].Name = Constants.EmptyPortValue; - m_inputPorts[ 1 ].Name = "Min Old"; - AddInputPort( WirePortDataType.FLOAT, false, "Max Old" ); - m_inputPorts[ 2 ].FloatInternalData = 1; - AddInputPort( WirePortDataType.FLOAT, false, "Min New" ); - AddInputPort( WirePortDataType.FLOAT, false, "Max New" ); - m_inputPorts[ 4 ].FloatInternalData = 1; - m_textLabelWidth = 100; - m_useInternalPortData = true; - m_previewShaderGUID = "72dd1cbea889fa047b929d5191e360c0"; - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - UpdateConnections(); - } - - public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) - { - base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); - UpdateConnections(); - } - - void UpdateConnections() - { - m_inputPorts[ 0 ].MatchPortToConnection(); - m_inputPorts[ 1 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); - m_inputPorts[ 2 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); - m_inputPorts[ 3 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); - m_inputPorts[ 4 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); - m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - string value = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - string oldMin = m_inputPorts[ 1 ].GenerateShaderForOutput( ref dataCollector, m_inputPorts[ 0 ].DataType, ignoreLocalvar, true ); - string oldMax = m_inputPorts[ 2 ].GenerateShaderForOutput( ref dataCollector, m_inputPorts[ 0 ].DataType, ignoreLocalvar, true ); - string newMin = m_inputPorts[ 3 ].GenerateShaderForOutput( ref dataCollector, m_inputPorts[ 0 ].DataType, ignoreLocalvar, true ); - string newMax = m_inputPorts[ 4 ].GenerateShaderForOutput( ref dataCollector, m_inputPorts[ 0 ].DataType, ignoreLocalvar, true ); - string strout = "(" + newMin + " + (" + value + " - " + oldMin + ") * (" + newMax + " - " + newMin + ") / (" + oldMax + " - " + oldMin + "))"; - - return CreateOutputLocalVariable( 0, strout, ref dataCollector ); - } - } -} |