summaryrefslogtreecommitdiff
path: root/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time
diff options
context:
space:
mode:
Diffstat (limited to 'Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time')
-rw-r--r--Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/CosTime.cs55
-rw-r--r--Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/CosTime.cs.meta12
-rw-r--r--Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/DeltaTime.cs33
-rw-r--r--Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/DeltaTime.cs.meta12
-rw-r--r--Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SimpleTimeNode.cs48
-rw-r--r--Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SimpleTimeNode.cs.meta12
-rw-r--r--Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SinTimeNode.cs58
-rw-r--r--Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SinTimeNode.cs.meta12
-rw-r--r--Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/TimeNode.cs55
-rw-r--r--Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/TimeNode.cs.meta12
10 files changed, 309 insertions, 0 deletions
diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/CosTime.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/CosTime.cs
new file mode 100644
index 00000000..096676f2
--- /dev/null
+++ b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/CosTime.cs
@@ -0,0 +1,55 @@
+// Amplify Shader Editor - Visual Shader Editing Tool
+// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
+
+using System;
+namespace AmplifyShaderEditor
+{
+ [Serializable]
+ [NodeAttributes( "Cos Time", "Time", "Cosine of time" )]
+ public sealed class CosTime : ConstVecShaderVariable
+ {
+#if UNITY_2018_3_OR_NEWER
+ private readonly string[] SRPTime =
+ {
+ "cos( _TimeParameters.x * 0.125 )",
+ "cos( _TimeParameters.x * 0.25 )",
+ "cos( _TimeParameters.x * 0.5 )",
+ "_TimeParameters.z",
+ };
+#endif
+ protected override void CommonInit( int uniqueId )
+ {
+ base.CommonInit( uniqueId );
+ ChangeOutputName( 1, "t/8" );
+ ChangeOutputName( 2, "t/4" );
+ ChangeOutputName( 3, "t/2" );
+ ChangeOutputName( 4, "t" );
+ m_value = "_CosTime";
+ m_previewShaderGUID = "3093999b42c3c0940a71799511d7781c";
+ m_continuousPreviewRefresh = true;
+ }
+
+ public override void RefreshExternalReferences()
+ {
+ base.RefreshExternalReferences();
+ if( !m_outputPorts[ 0 ].IsConnected )
+ {
+ m_outputPorts[ 0 ].Visible = false;
+ m_sizeIsDirty = true;
+ }
+ }
+
+ public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar )
+ {
+#if UNITY_2018_3_OR_NEWER
+ if( outputId > 0 && dataCollector.IsTemplate )
+ {
+ if( ( dataCollector.TemplateDataCollectorInstance.IsHDRP && ASEPackageManagerHelper.CurrentHDVersion > ASESRPVersions.ASE_SRP_5_16_1 ) ||
+ ( dataCollector.TemplateDataCollectorInstance.IsLWRP && ASEPackageManagerHelper.CurrentLWVersion > ASESRPVersions.ASE_SRP_5_16_1 ) )
+ return SRPTime[ outputId - 1 ];
+ }
+#endif
+ return base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar );
+ }
+ }
+}
diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/CosTime.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/CosTime.cs.meta
new file mode 100644
index 00000000..80373c18
--- /dev/null
+++ b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/CosTime.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 447e504f2ca5aaf4bbf0fdbce33596bc
+timeCreated: 1481126955
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/DeltaTime.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/DeltaTime.cs
new file mode 100644
index 00000000..a1f3380f
--- /dev/null
+++ b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/DeltaTime.cs
@@ -0,0 +1,33 @@
+// Amplify Shader Editor - Visual Shader Editing Tool
+// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
+
+using System;
+namespace AmplifyShaderEditor
+{
+ [Serializable]
+ [NodeAttributes( "Delta Time", "Time", "Delta time" )]
+ public sealed class DeltaTime : ConstVecShaderVariable
+ {
+ protected override void CommonInit( int uniqueId )
+ {
+ base.CommonInit( uniqueId );
+ ChangeOutputName( 1, "dt" );
+ ChangeOutputName( 2, "1/dt" );
+ ChangeOutputName( 3, "smoothDt" );
+ ChangeOutputName( 4, "1/smoothDt" );
+ m_value = "unity_DeltaTime";
+ m_previewShaderGUID = "9d69a693042c443498f96d6da60535eb";
+ m_continuousPreviewRefresh = true;
+ }
+
+ public override void RefreshExternalReferences()
+ {
+ base.RefreshExternalReferences();
+ if( !m_outputPorts[ 0 ].IsConnected )
+ {
+ m_outputPorts[ 0 ].Visible = false;
+ m_sizeIsDirty = true;
+ }
+ }
+ }
+}
diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/DeltaTime.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/DeltaTime.cs.meta
new file mode 100644
index 00000000..400f94fe
--- /dev/null
+++ b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/DeltaTime.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 3ddde7ed1ab4f8044a9a6aa3891f5ca4
+timeCreated: 1481126955
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SimpleTimeNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SimpleTimeNode.cs
new file mode 100644
index 00000000..8445f90b
--- /dev/null
+++ b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SimpleTimeNode.cs
@@ -0,0 +1,48 @@
+// Amplify Shader Editor - Visual Shader Editing Tool
+// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
+
+using System;
+namespace AmplifyShaderEditor
+{
+ [Serializable]
+ [NodeAttributes( "Time", "Time", "Time in seconds with a scale multiplier" )]
+ public sealed class SimpleTimeNode : ShaderVariablesNode
+ {
+ private const string TimeStandard = "_Time.y";
+#if UNITY_2018_3_OR_NEWER
+ private const string TimeSRP = "_TimeParameters.x";
+#endif
+ protected override void CommonInit( int uniqueId )
+ {
+ base.CommonInit( uniqueId );
+ ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT );
+ AddInputPort( WirePortDataType.FLOAT, false, "Scale" );
+ m_inputPorts[ 0 ].FloatInternalData = 1;
+ m_useInternalPortData = true;
+ m_previewShaderGUID = "45b7107d5d11f124fad92bcb1fa53661";
+ m_continuousPreviewRefresh = true;
+ }
+
+ public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar )
+ {
+ base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar );
+ string multiplier = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector );
+ string timeGlobalVar = TimeStandard;
+#if UNITY_2018_3_OR_NEWER
+ if( dataCollector.IsTemplate )
+ {
+ if( ( dataCollector.TemplateDataCollectorInstance.IsHDRP && ASEPackageManagerHelper.CurrentHDVersion > ASESRPVersions.ASE_SRP_5_16_1 ) ||
+ ( dataCollector.TemplateDataCollectorInstance.IsLWRP && ASEPackageManagerHelper.CurrentLWVersion > ASESRPVersions.ASE_SRP_5_16_1 ) )
+ timeGlobalVar = TimeSRP;
+ }
+#endif
+ if( multiplier == "1.0" )
+ return timeGlobalVar;
+
+ string scaledVarName = "mulTime" + OutputId;
+ string scaledVarValue = timeGlobalVar + " * " + multiplier;
+ dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT, scaledVarName, scaledVarValue );
+ return scaledVarName;
+ }
+ }
+}
diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SimpleTimeNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SimpleTimeNode.cs.meta
new file mode 100644
index 00000000..313b9315
--- /dev/null
+++ b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SimpleTimeNode.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: f36e4491ee33fe74fa51cfb5ad450c6e
+timeCreated: 1481126959
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SinTimeNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SinTimeNode.cs
new file mode 100644
index 00000000..aac2b1eb
--- /dev/null
+++ b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SinTimeNode.cs
@@ -0,0 +1,58 @@
+// Amplify Shader Editor - Visual Shader Editing Tool
+// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
+
+using System;
+using UnityEditor;
+using UnityEngine;
+namespace AmplifyShaderEditor
+{
+ [Serializable]
+ [NodeAttributes( "Sin Time", "Time", "Unity sin time" )]
+ public sealed class SinTimeNode : ConstVecShaderVariable
+ {
+ //double m_time;
+#if UNITY_2018_3_OR_NEWER
+ private readonly string[] SRPTime =
+ {
+ "sin( _TimeParameters.x * 0.125 )",
+ "sin( _TimeParameters.x * 0.25 )",
+ "sin( _TimeParameters.x * 0.5 )",
+ "_TimeParameters.y",
+ };
+#endif
+ protected override void CommonInit( int uniqueId )
+ {
+ base.CommonInit( uniqueId );
+ ChangeOutputName( 1, "t/8" );
+ ChangeOutputName( 2, "t/4" );
+ ChangeOutputName( 3, "t/2" );
+ ChangeOutputName( 4, "t" );
+ m_value = "_SinTime";
+ m_previewShaderGUID = "e4ba809e0badeb94994170b2cbbbba10";
+ m_continuousPreviewRefresh = true;
+ }
+
+ public override void RefreshExternalReferences()
+ {
+ base.RefreshExternalReferences();
+ if( !m_outputPorts[ 0 ].IsConnected )
+ {
+ m_outputPorts[ 0 ].Visible = false;
+ m_sizeIsDirty = true;
+ }
+ }
+
+ public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar )
+ {
+#if UNITY_2018_3_OR_NEWER
+ if( outputId > 0 && dataCollector.IsTemplate )
+ {
+ if( ( dataCollector.TemplateDataCollectorInstance.IsHDRP && ASEPackageManagerHelper.CurrentHDVersion > ASESRPVersions.ASE_SRP_5_16_1 ) ||
+ ( dataCollector.TemplateDataCollectorInstance.IsLWRP && ASEPackageManagerHelper.CurrentLWVersion > ASESRPVersions.ASE_SRP_5_16_1 ) )
+ return SRPTime[ outputId - 1 ];
+ }
+#endif
+ return base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar );
+ }
+ }
+}
diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SinTimeNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SinTimeNode.cs.meta
new file mode 100644
index 00000000..876a7748
--- /dev/null
+++ b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SinTimeNode.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 796acd44fcf330e4e921855630007b9b
+timeCreated: 1481126957
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/TimeNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/TimeNode.cs
new file mode 100644
index 00000000..258d5177
--- /dev/null
+++ b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/TimeNode.cs
@@ -0,0 +1,55 @@
+// Amplify Shader Editor - Visual Shader Editing Tool
+// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
+
+using System;
+namespace AmplifyShaderEditor
+{
+ [Serializable]
+ [NodeAttributes( "Time Parameters", "Time", "Time since level load" )]
+ public sealed class TimeNode : ConstVecShaderVariable
+ {
+#if UNITY_2018_3_OR_NEWER
+ private readonly string[] SRPTime =
+ {
+ "( _TimeParameters.x * 0.05 )",
+ "( _TimeParameters.x )",
+ "( _TimeParameters.x * 2 )",
+ "( _TimeParameters.x * 3 )",
+ };
+#endif
+ protected override void CommonInit( int uniqueId )
+ {
+ base.CommonInit( uniqueId );
+ ChangeOutputName( 1, "t/20" );
+ ChangeOutputName( 2, "t" );
+ ChangeOutputName( 3, "t*2" );
+ ChangeOutputName( 4, "t*3" );
+ m_value = "_Time";
+ m_previewShaderGUID = "73abc10c8d1399444827a7eeb9c24c2a";
+ m_continuousPreviewRefresh = true;
+ }
+
+ public override void RefreshExternalReferences()
+ {
+ base.RefreshExternalReferences();
+ if( !m_outputPorts[ 0 ].IsConnected )
+ {
+ m_outputPorts[ 0 ].Visible = false;
+ m_sizeIsDirty = true;
+ }
+ }
+
+ public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar )
+ {
+#if UNITY_2018_3_OR_NEWER
+ if( outputId > 0 && dataCollector.IsTemplate )
+ {
+ if( ( dataCollector.TemplateDataCollectorInstance.IsHDRP && ASEPackageManagerHelper.CurrentHDVersion > ASESRPVersions.ASE_SRP_5_16_1 ) ||
+ ( dataCollector.TemplateDataCollectorInstance.IsLWRP && ASEPackageManagerHelper.CurrentLWVersion > ASESRPVersions.ASE_SRP_5_16_1 ))
+ return SRPTime[ outputId - 1 ];
+ }
+#endif
+ return base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar );
+ }
+ }
+}
diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/TimeNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/TimeNode.cs.meta
new file mode 100644
index 00000000..521dcf41
--- /dev/null
+++ b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/TimeNode.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: d8c6b7bfb7784e14d8708ab6fb981268
+timeCreated: 1481126959
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant: