summaryrefslogtreecommitdiff
path: root/Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2020-10-23 13:08:43 +0800
committerchai <chaifix@163.com>2020-10-23 13:08:43 +0800
commitb82da95b5181ac8bbae38efb13e950d5e88a4caa (patch)
tree48a6f3269276484bbc7cfc95f0651f40a2176aa1 /Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation
parent917e9e0b320775634dc2e710f7deac74fd0822f0 (diff)
*移动amplify shader editor到third party目录
Diffstat (limited to 'Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation')
-rw-r--r--Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/DistanceBasedTessNode.cs30
-rw-r--r--Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/DistanceBasedTessNode.cs.meta12
-rw-r--r--Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthCullTessNode.cs27
-rw-r--r--Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthCullTessNode.cs.meta12
-rw-r--r--Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthTessNode.cs23
-rw-r--r--Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthTessNode.cs.meta12
-rw-r--r--Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/TessellationParentNode.cs29
-rw-r--r--Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/TessellationParentNode.cs.meta12
8 files changed, 157 insertions, 0 deletions
diff --git a/Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/DistanceBasedTessNode.cs b/Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/DistanceBasedTessNode.cs
new file mode 100644
index 00000000..c49df07f
--- /dev/null
+++ b/Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/DistanceBasedTessNode.cs
@@ -0,0 +1,30 @@
+
+// Amplify Shader Editor - Visual Shader Editing Tool
+// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
+
+
+namespace AmplifyShaderEditor
+{
+ [System.Serializable]
+ [NodeAttributes( "Distance-based Tessellation", "Miscellaneous", "Calculates tessellation based on distance from camera" )]
+ public sealed class DistanceBasedTessNode : TessellationParentNode
+ {
+ private const string FunctionBody = "UnityDistanceBasedTess( v0.vertex, v1.vertex, v2.vertex, {0},{1},{2})";
+ protected override void CommonInit( int uniqueId )
+ {
+ base.CommonInit( uniqueId );
+ AddInputPort( WirePortDataType.FLOAT, false,"Factor");
+ AddInputPort( WirePortDataType.FLOAT, false, "Min Dist" );
+ AddInputPort( WirePortDataType.FLOAT, false, "Max Dist" );
+ AddOutputPort( WirePortDataType.FLOAT4, Constants.EmptyPortValue );
+ }
+
+ protected override string BuildTessellationFunction( ref MasterNodeDataCollector dataCollector )
+ {
+ return string.Format( FunctionBody,
+ m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ),
+ m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ),
+ m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ) );
+ }
+ }
+}
diff --git a/Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/DistanceBasedTessNode.cs.meta b/Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/DistanceBasedTessNode.cs.meta
new file mode 100644
index 00000000..18016c1b
--- /dev/null
+++ b/Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/DistanceBasedTessNode.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 5a83fb450d164d34bb756f46b3f4290e
+timeCreated: 1482150091
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthCullTessNode.cs b/Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthCullTessNode.cs
new file mode 100644
index 00000000..48c5db07
--- /dev/null
+++ b/Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthCullTessNode.cs
@@ -0,0 +1,27 @@
+// Amplify Shader Editor - Visual Shader Editing Tool
+// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
+
+
+namespace AmplifyShaderEditor
+{
+ [System.Serializable]
+ [NodeAttributes( "Edge Length Tessellation With Cull", "Miscellaneous", "Tessellation level computed based on triangle edge length on the screen with patch frustum culling" )]
+ public sealed class EdgeLengthCullTessNode : TessellationParentNode
+ {
+ private const string FunctionBody = "UnityEdgeLengthBasedTessCull( v0.vertex, v1.vertex, v2.vertex, {0},{1})";
+ protected override void CommonInit( int uniqueId )
+ {
+ base.CommonInit( uniqueId );
+ AddInputPort( WirePortDataType.FLOAT, false, "Edge Length" );
+ AddInputPort( WirePortDataType.FLOAT, false, "Max Disp." );
+ AddOutputPort( WirePortDataType.FLOAT4, Constants.EmptyPortValue );
+ }
+
+ protected override string BuildTessellationFunction( ref MasterNodeDataCollector dataCollector )
+ {
+ return string.Format( FunctionBody,
+ m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ),
+ m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ) );
+ }
+ }
+}
diff --git a/Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthCullTessNode.cs.meta b/Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthCullTessNode.cs.meta
new file mode 100644
index 00000000..20d4dd27
--- /dev/null
+++ b/Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthCullTessNode.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 4b09c64ce2fd06a4cb4036d8cc0f8b2a
+timeCreated: 1482150962
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthTessNode.cs b/Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthTessNode.cs
new file mode 100644
index 00000000..f4905bf1
--- /dev/null
+++ b/Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthTessNode.cs
@@ -0,0 +1,23 @@
+// Amplify Shader Editor - Visual Shader Editing Tool
+// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
+
+namespace AmplifyShaderEditor
+{
+ [System.Serializable]
+ [NodeAttributes( "Edge Length Tessellation", "Miscellaneous", "Tessellation level computed based on triangle edge length on the screen" )]
+ public sealed class EdgeLengthTessNode : TessellationParentNode
+ {
+ private const string FunctionBody = "UnityEdgeLengthBasedTess (v0.vertex, v1.vertex, v2.vertex, {0})";
+ protected override void CommonInit( int uniqueId )
+ {
+ base.CommonInit( uniqueId );
+ AddInputPort( WirePortDataType.FLOAT, false, "Edge Length" );
+ AddOutputPort( WirePortDataType.FLOAT4, Constants.EmptyPortValue );
+ }
+
+ protected override string BuildTessellationFunction( ref MasterNodeDataCollector dataCollector )
+ {
+ return string.Format( FunctionBody, m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ) );
+ }
+ }
+}
diff --git a/Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthTessNode.cs.meta b/Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthTessNode.cs.meta
new file mode 100644
index 00000000..2c936ef7
--- /dev/null
+++ b/Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthTessNode.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: abe3e8fa4d49c9742a95ac801fd14d7d
+timeCreated: 1482150962
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/TessellationParentNode.cs b/Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/TessellationParentNode.cs
new file mode 100644
index 00000000..be14febc
--- /dev/null
+++ b/Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/TessellationParentNode.cs
@@ -0,0 +1,29 @@
+namespace AmplifyShaderEditor
+{
+ public class TessellationParentNode : ParentNode
+ {
+
+ protected override void CommonInit( int uniqueId )
+ {
+ base.CommonInit( uniqueId );
+ m_useInternalPortData = true;
+ }
+
+
+ public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar )
+ {
+ if ( dataCollector.PortCategory != MasterNodePortCategory.Tessellation )
+ {
+ UIUtils.ShowMessage( UniqueId, m_nodeAttribs.Name + " can only be used on Master Node Tessellation port" );
+ return "(-1)";
+ }
+
+ return BuildTessellationFunction( ref dataCollector );
+ }
+
+ protected virtual string BuildTessellationFunction( ref MasterNodeDataCollector dataCollector )
+ {
+ return string.Empty;
+ }
+ }
+}
diff --git a/Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/TessellationParentNode.cs.meta b/Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/TessellationParentNode.cs.meta
new file mode 100644
index 00000000..0799224c
--- /dev/null
+++ b/Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/TessellationParentNode.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 79c24faef1fec884d937e74bdc9209da
+timeCreated: 1482162387
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant: