summaryrefslogtreecommitdiff
path: root/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2020-10-22 23:30:02 +0800
committerchai <chaifix@163.com>2020-10-22 23:30:02 +0800
commit917e9e0b320775634dc2e710f7deac74fd0822f0 (patch)
tree637f3cccc80e7738c8a077fa3ff59218b8b18ee8 /Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen
parent8268e4e308bd110dfea4ad849a7ff74e66951349 (diff)
* amplify shader editor
Diffstat (limited to 'Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen')
-rw-r--r--Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraProjectionNode.cs100
-rw-r--r--Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraProjectionNode.cs.meta12
-rw-r--r--Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraWorldClipPlanes.cs115
-rw-r--r--Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraWorldClipPlanes.cs.meta12
-rw-r--r--Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/OrthoParams.cs38
-rw-r--r--Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/OrthoParams.cs.meta12
-rw-r--r--Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ProjectionParams.cs32
-rw-r--r--Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ProjectionParams.cs.meta12
-rw-r--r--Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ScreenParams.cs32
-rw-r--r--Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ScreenParams.cs.meta12
-rw-r--r--Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/WorldSpaceCameraPos.cs28
-rw-r--r--Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/WorldSpaceCameraPos.cs.meta12
-rw-r--r--Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ZBufferParams.cs31
-rw-r--r--Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ZBufferParams.cs.meta12
14 files changed, 460 insertions, 0 deletions
diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraProjectionNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraProjectionNode.cs
new file mode 100644
index 00000000..0591ba12
--- /dev/null
+++ b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraProjectionNode.cs
@@ -0,0 +1,100 @@
+// Amplify Shader Editor - Visual Shader Editing Tool
+// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
+
+using UnityEngine;
+using UnityEditor;
+using System;
+
+namespace AmplifyShaderEditor
+{
+ public enum BuiltInShaderCameraTypes
+ {
+ unity_CameraProjection = 0,
+ unity_CameraInvProjection
+ }
+
+ [Serializable]
+ [NodeAttributes( "Projection Matrices", "Camera And Screen", "Camera's Projection/Inverse Projection matrix" )]
+ public sealed class CameraProjectionNode : ShaderVariablesNode
+ {
+ private const string _projMatrixLabelStr = "Projection Matrix";
+ private readonly string[] _projMatrixValuesStr = { "Camera Projection",
+ "Inverse Camera Projection"};
+
+
+ [SerializeField]
+ private BuiltInShaderCameraTypes m_selectedType = BuiltInShaderCameraTypes.unity_CameraProjection;
+
+ private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper();
+
+ protected override void CommonInit( int uniqueId )
+ {
+ base.CommonInit( uniqueId );
+ ChangeOutputProperties( 0, _projMatrixValuesStr[ (int)m_selectedType ], WirePortDataType.FLOAT4x4 );
+ m_textLabelWidth = 115;
+ m_autoWrapProperties = true;
+ m_hasLeftDropdown = true;
+ }
+
+ public override void AfterCommonInit()
+ {
+ base.AfterCommonInit();
+ if( PaddingTitleLeft == 0 )
+ {
+ PaddingTitleLeft = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin;
+ if( PaddingTitleRight == 0 )
+ PaddingTitleRight = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin;
+ }
+ }
+
+ public override void Destroy()
+ {
+ base.Destroy();
+ m_upperLeftWidget = null;
+ }
+
+ public override void Draw( DrawInfo drawInfo )
+ {
+ base.Draw( drawInfo );
+ EditorGUI.BeginChangeCheck();
+ m_selectedType = (BuiltInShaderCameraTypes)m_upperLeftWidget.DrawWidget( this, (int)m_selectedType, _projMatrixValuesStr );
+ if( EditorGUI.EndChangeCheck() )
+ {
+ ChangeOutputName( 0, _projMatrixValuesStr[ (int)m_selectedType ] );
+ SetSaveIsDirty();
+ }
+ }
+
+ public override void DrawProperties()
+ {
+ base.DrawProperties();
+ EditorGUI.BeginChangeCheck();
+ m_selectedType = (BuiltInShaderCameraTypes)EditorGUILayoutPopup( _projMatrixLabelStr, (int)m_selectedType, _projMatrixValuesStr );
+ if( EditorGUI.EndChangeCheck() )
+ {
+ ChangeOutputName( 0, _projMatrixValuesStr[ (int)m_selectedType ] );
+ SetSaveIsDirty();
+ }
+ }
+
+ public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar )
+ {
+ base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar );
+ GeneratorUtils.RegisterUnity2019MatrixDefines( ref dataCollector );
+ return m_selectedType.ToString();
+ }
+
+ public override void ReadFromString( ref string[] nodeParams )
+ {
+ base.ReadFromString( ref nodeParams );
+ m_selectedType = (BuiltInShaderCameraTypes)Enum.Parse( typeof( BuiltInShaderCameraTypes ), GetCurrentParam( ref nodeParams ) );
+ ChangeOutputName( 0, _projMatrixValuesStr[ (int)m_selectedType ] );
+ }
+
+ public override void WriteToString( ref string nodeInfo, ref string connectionsInfo )
+ {
+ base.WriteToString( ref nodeInfo, ref connectionsInfo );
+ IOUtils.AddFieldValueToString( ref nodeInfo, m_selectedType );
+ }
+ }
+}
diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraProjectionNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraProjectionNode.cs.meta
new file mode 100644
index 00000000..11a1c16b
--- /dev/null
+++ b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraProjectionNode.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: f776bdd36b750304c8e0de8ee1f31fc0
+timeCreated: 1481126960
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraWorldClipPlanes.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraWorldClipPlanes.cs
new file mode 100644
index 00000000..fd23099e
--- /dev/null
+++ b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraWorldClipPlanes.cs
@@ -0,0 +1,115 @@
+// Amplify Shader Editor - Visual Shader Editing Tool
+// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
+
+using System;
+using UnityEngine;
+using UnityEditor;
+
+namespace AmplifyShaderEditor
+{
+ public enum BuiltInShaderClipPlanesTypes
+ {
+ Left = 0,
+ Right,
+ Bottom,
+ Top,
+ Near,
+ Far
+ }
+
+ [Serializable]
+ [NodeAttributes( "Clip Planes", "Camera And Screen", "Camera World Clip Planes" )]
+ public sealed class CameraWorldClipPlanes : ShaderVariablesNode
+ {
+ [SerializeField]
+ private BuiltInShaderClipPlanesTypes m_selectedType = BuiltInShaderClipPlanesTypes.Left;
+
+ private const string LabelStr = "Plane";
+ private const string ValueStr = "unity_CameraWorldClipPlanes";
+
+ private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper();
+ private int m_planeId;
+ protected override void CommonInit( int uniqueId )
+ {
+ base.CommonInit( uniqueId );
+ ChangeOutputProperties( 0, "ABCD", WirePortDataType.FLOAT4 );
+ m_textLabelWidth = 55;
+ m_autoWrapProperties = true;
+ m_hasLeftDropdown = true;
+ SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, m_selectedType ) );
+ m_previewShaderGUID = "6afe5a4ad7bbd0e4ab352c758f543a09";
+ }
+
+ public override void OnEnable()
+ {
+ base.OnEnable();
+ m_planeId = Shader.PropertyToID( "_PlaneId" );
+ }
+
+ public override void AfterCommonInit()
+ {
+ base.AfterCommonInit();
+ if( PaddingTitleLeft == 0 )
+ {
+ PaddingTitleLeft = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin;
+ if( PaddingTitleRight == 0 )
+ PaddingTitleRight = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin;
+ }
+ }
+
+ public override void Destroy()
+ {
+ base.Destroy();
+ m_upperLeftWidget = null;
+ }
+
+ public override void Draw( DrawInfo drawInfo )
+ {
+ base.Draw( drawInfo );
+ m_upperLeftWidget.DrawWidget<BuiltInShaderClipPlanesTypes>(ref m_selectedType, this, OnWidgetUpdate );
+ }
+
+ private readonly Action<ParentNode> OnWidgetUpdate = ( x ) => {
+ x.SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, ( x as CameraWorldClipPlanes ).Type ) );
+ };
+
+ public BuiltInShaderClipPlanesTypes Type { get { return m_selectedType; } }
+
+ public override void DrawProperties()
+ {
+ base.DrawProperties();
+ EditorGUI.BeginChangeCheck();
+ m_selectedType = ( BuiltInShaderClipPlanesTypes ) EditorGUILayoutEnumPopup( LabelStr, m_selectedType );
+ if ( EditorGUI.EndChangeCheck() )
+ {
+ SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, m_selectedType ) );
+ SetSaveIsDirty();
+ }
+ }
+
+ public override void SetPreviewInputs()
+ {
+ base.SetPreviewInputs();
+ PreviewMaterial.SetInt( m_planeId, (int)m_selectedType );
+ }
+
+ public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar )
+ {
+ base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar );
+ return ValueStr + "[" + ( int ) m_selectedType + "]";
+ }
+
+ public override void ReadFromString( ref string[] nodeParams )
+ {
+ base.ReadFromString( ref nodeParams );
+ m_selectedType = ( BuiltInShaderClipPlanesTypes ) Enum.Parse( typeof( BuiltInShaderClipPlanesTypes ), GetCurrentParam( ref nodeParams ) );
+ SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, m_selectedType ) );
+ }
+
+ public override void WriteToString( ref string nodeInfo, ref string connectionsInfo )
+ {
+ base.WriteToString( ref nodeInfo, ref connectionsInfo );
+ IOUtils.AddFieldValueToString( ref nodeInfo, m_selectedType );
+ }
+ }
+}
diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraWorldClipPlanes.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraWorldClipPlanes.cs.meta
new file mode 100644
index 00000000..3b17b846
--- /dev/null
+++ b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraWorldClipPlanes.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: e5a9a010f1c8dda449c8ca7ee9e25869
+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/CameraAndScreen/OrthoParams.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/OrthoParams.cs
new file mode 100644
index 00000000..c2e93c26
--- /dev/null
+++ b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/OrthoParams.cs
@@ -0,0 +1,38 @@
+// Amplify Shader Editor - Visual Shader Editing Tool
+// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
+
+using System;
+namespace AmplifyShaderEditor
+{
+ [Serializable]
+ [NodeAttributes( "Ortho Params", "Camera And Screen", "Orthographic Parameters" )]
+ public sealed class OrthoParams : ConstVecShaderVariable
+ {
+ protected override void CommonInit( int uniqueId )
+ {
+ base.CommonInit( uniqueId );
+ ChangeOutputName( 1, "Ortho Cam Width" );
+ ChangeOutputName( 2, "Ortho Cam Height" );
+ ChangeOutputName( 3, "Unused" );
+ ChangeOutputName( 4, "Projection Mode" );
+ m_value = "unity_OrthoParams";
+ m_previewShaderGUID = "88a910ece3dce224793e669bb1bc158d";
+ }
+
+ public override void RefreshExternalReferences()
+ {
+ base.RefreshExternalReferences();
+ if( !m_outputPorts[ 0 ].IsConnected )
+ {
+ m_outputPorts[ 0 ].Visible = false;
+ m_sizeIsDirty = true;
+ }
+
+ if( !m_outputPorts[ 3 ].IsConnected )
+ {
+ m_outputPorts[ 3 ].Visible = false;
+ m_sizeIsDirty = true;
+ }
+ }
+ }
+}
diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/OrthoParams.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/OrthoParams.cs.meta
new file mode 100644
index 00000000..d406a63e
--- /dev/null
+++ b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/OrthoParams.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: f9431cdf8e81c1d4f902b3fa7d04f7ac
+timeCreated: 1481126960
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ProjectionParams.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ProjectionParams.cs
new file mode 100644
index 00000000..9e4357b7
--- /dev/null
+++ b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ProjectionParams.cs
@@ -0,0 +1,32 @@
+// Amplify Shader Editor - Visual Shader Editing Tool
+// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
+
+using System;
+namespace AmplifyShaderEditor
+{
+ [Serializable]
+ [NodeAttributes( "Projection Params", "Camera And Screen", "Projection Near/Far parameters" )]
+ public sealed class ProjectionParams : ConstVecShaderVariable
+ {
+ protected override void CommonInit( int uniqueId )
+ {
+ base.CommonInit( uniqueId );
+ ChangeOutputName( 1, "Flipped" );
+ ChangeOutputName( 2, "Near Plane" );
+ ChangeOutputName( 3, "Far Plane" );
+ ChangeOutputName( 4, "1/Far Plane" );
+ m_value = "_ProjectionParams";
+ m_previewShaderGUID = "97ae846cb0a6b044388fad3bc03bb4c2";
+ }
+
+ 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/CameraAndScreen/ProjectionParams.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ProjectionParams.cs.meta
new file mode 100644
index 00000000..8e87d5a2
--- /dev/null
+++ b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ProjectionParams.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: ba1ca8bace2c2dd4dafac6f73f4dfb1b
+timeCreated: 1481126958
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ScreenParams.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ScreenParams.cs
new file mode 100644
index 00000000..5446ac2f
--- /dev/null
+++ b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ScreenParams.cs
@@ -0,0 +1,32 @@
+// Amplify Shader Editor - Visual Shader Editing Tool
+// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
+
+using System;
+namespace AmplifyShaderEditor
+{
+ [Serializable]
+ [NodeAttributes( "Screen Params", "Camera And Screen", "Camera's Render Target size parameters" )]
+ public sealed class ScreenParams : ConstVecShaderVariable
+ {
+ protected override void CommonInit( int uniqueId )
+ {
+ base.CommonInit( uniqueId );
+ ChangeOutputName( 1, "RT Width" );
+ ChangeOutputName( 2, "RT Height" );
+ ChangeOutputName( 3, "1+1/Width" );
+ ChangeOutputName( 4, "1+1/Height" );
+ m_value = "_ScreenParams";
+ m_previewShaderGUID = "78173633b803de4419206191fed3d61e";
+ }
+
+ //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/CameraAndScreen/ScreenParams.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ScreenParams.cs.meta
new file mode 100644
index 00000000..f43db824
--- /dev/null
+++ b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ScreenParams.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 2e593f23857d59643b5b5f6dd6264e1b
+timeCreated: 1481126954
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/WorldSpaceCameraPos.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/WorldSpaceCameraPos.cs
new file mode 100644
index 00000000..2342f158
--- /dev/null
+++ b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/WorldSpaceCameraPos.cs
@@ -0,0 +1,28 @@
+// Amplify Shader Editor - Visual Shader Editing Tool
+// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
+
+using System;
+namespace AmplifyShaderEditor
+{
+ [Serializable]
+ [NodeAttributes( "World Space Camera Pos", "Camera And Screen", "World Space Camera position" )]
+ public sealed class WorldSpaceCameraPos : ConstantShaderVariable
+ {
+ protected override void CommonInit( int uniqueId )
+ {
+ base.CommonInit( uniqueId );
+ ChangeOutputProperties( 0, "XYZ", WirePortDataType.FLOAT3 );
+ AddOutputPort( WirePortDataType.FLOAT, "X" );
+ AddOutputPort( WirePortDataType.FLOAT, "Y" );
+ AddOutputPort( WirePortDataType.FLOAT, "Z" );
+
+ m_value = "_WorldSpaceCameraPos";
+ m_previewShaderGUID = "6b0c78411043dd24dac1152c84bb63ba";
+ }
+
+ public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar )
+ {
+ return GetOutputVectorItem( 0, outputId, base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ) );
+ }
+ }
+}
diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/WorldSpaceCameraPos.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/WorldSpaceCameraPos.cs.meta
new file mode 100644
index 00000000..8a47447f
--- /dev/null
+++ b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/WorldSpaceCameraPos.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 972d92a6008896f4292a61726e18f667
+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/CameraAndScreen/ZBufferParams.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ZBufferParams.cs
new file mode 100644
index 00000000..4fcb5e19
--- /dev/null
+++ b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ZBufferParams.cs
@@ -0,0 +1,31 @@
+// Amplify Shader Editor - Visual Shader Editing Tool
+// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
+
+using System;
+namespace AmplifyShaderEditor
+{
+ [Serializable]
+ [NodeAttributes( "Z-Buffer Params", "Camera And Screen", "Linearized Z buffer values" )]
+ public sealed class ZBufferParams : ConstVecShaderVariable
+ {
+ protected override void CommonInit( int uniqueId )
+ {
+ base.CommonInit( uniqueId );
+ ChangeOutputName( 1, "1-far/near" );
+ ChangeOutputName( 2, "far/near" );
+ ChangeOutputName( 3, "[0]/far" );
+ ChangeOutputName( 4, "[1]/far" );
+ m_value = "_ZBufferParams";
+ m_previewShaderGUID = "56c42c106bcb497439187f5bb6b6f94d";
+ }
+ 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/CameraAndScreen/ZBufferParams.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ZBufferParams.cs.meta
new file mode 100644
index 00000000..e8b668c8
--- /dev/null
+++ b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ZBufferParams.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 2765a41106f478f4982e859b978bdec4
+timeCreated: 1481126954
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant: