You've already forked FateViewer
Add project files.
This commit is contained in:
@@ -0,0 +1,123 @@
|
||||
// Amplify Shader Editor - Visual Shader Editing Tool
|
||||
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
|
||||
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
namespace AmplifyShaderEditor
|
||||
{
|
||||
[Serializable]
|
||||
[NodeAttributes( "Billboard", "Miscellaneous", "Calculates new Vertex positions and normals to achieve a billboard effect." )]
|
||||
public sealed class BillboardNode : ParentNode
|
||||
{
|
||||
private const string ErrorMessage = "Billboard node should only be connected to vertex ports.";
|
||||
private const string WarningMessage = "This node is a bit different from all others as it injects the necessary code into the vertex body and writes directly on the vertex position and normal.\nIt outputs a value of 0 so it can be connected directly to a vertex port.\n[Only if that port is a relative vertex offset].";
|
||||
|
||||
[SerializeField]
|
||||
private BillboardType m_billboardType = BillboardType.Cylindrical;
|
||||
|
||||
[SerializeField]
|
||||
private bool m_rotationIndependent = false;
|
||||
|
||||
private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper();
|
||||
|
||||
protected override void CommonInit( int uniqueId )
|
||||
{
|
||||
base.CommonInit( uniqueId );
|
||||
AddOutputPort( WirePortDataType.FLOAT3, "Out" );
|
||||
m_textLabelWidth = 115;
|
||||
m_hasLeftDropdown = true;
|
||||
SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, m_billboardType ) );
|
||||
}
|
||||
|
||||
public override void Destroy()
|
||||
{
|
||||
base.Destroy();
|
||||
m_upperLeftWidget = null;
|
||||
}
|
||||
|
||||
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 Draw( DrawInfo drawInfo )
|
||||
{
|
||||
base.Draw( drawInfo );
|
||||
m_upperLeftWidget.DrawWidget<BillboardType>( ref m_billboardType, this, OnWidgetUpdate );
|
||||
}
|
||||
|
||||
private readonly Action<ParentNode> OnWidgetUpdate = ( x ) =>
|
||||
{
|
||||
x.SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, ( x as BillboardNode ).Type ) );
|
||||
};
|
||||
|
||||
public override void DrawProperties()
|
||||
{
|
||||
base.DrawProperties();
|
||||
NodeUtils.DrawPropertyGroup( ref m_propertiesFoldout, Constants.ParameterLabelStr, () =>
|
||||
{
|
||||
EditorGUI.BeginChangeCheck();
|
||||
m_billboardType = (BillboardType)EditorGUILayoutEnumPopup( BillboardOpHelper.BillboardTypeStr, m_billboardType );
|
||||
if( EditorGUI.EndChangeCheck() )
|
||||
{
|
||||
SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, m_billboardType ) );
|
||||
}
|
||||
m_rotationIndependent = EditorGUILayoutToggle( BillboardOpHelper.BillboardRotIndStr, m_rotationIndependent );
|
||||
} );
|
||||
EditorGUILayout.HelpBox( WarningMessage, MessageType.Warning );
|
||||
}
|
||||
|
||||
public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar )
|
||||
{
|
||||
if( dataCollector.IsFragmentCategory )
|
||||
{
|
||||
UIUtils.ShowMessage( UniqueId, ErrorMessage,MessageSeverity.Error );
|
||||
return m_outputPorts[0].ErrorValue;
|
||||
}
|
||||
if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) )
|
||||
return m_outputPorts[ 0 ].ErrorValue;
|
||||
|
||||
m_outputPorts[ 0 ].SetLocalValue( "0", dataCollector.PortCategory );
|
||||
string vertexPosValue = dataCollector.IsTemplate ? dataCollector.TemplateDataCollectorInstance.GetVertexPosition( WirePortDataType.OBJECT, CurrentPrecisionType ) : "v.vertex";
|
||||
string vertexNormalValue = dataCollector.IsTemplate ? dataCollector.TemplateDataCollectorInstance.GetVertexNormal( CurrentPrecisionType ) : "v.normal";
|
||||
bool vertexIsFloat3 = false;
|
||||
if( dataCollector.IsTemplate )
|
||||
{
|
||||
InterpDataHelper info = dataCollector.TemplateDataCollectorInstance.GetInfo( TemplateInfoOnSematics.POSITION );
|
||||
if( info != null )
|
||||
{
|
||||
vertexIsFloat3 = info.VarType == WirePortDataType.FLOAT3;
|
||||
}
|
||||
}
|
||||
|
||||
BillboardOpHelper.FillDataCollector( ref dataCollector, m_billboardType, m_rotationIndependent, vertexPosValue, vertexNormalValue, vertexIsFloat3 );
|
||||
|
||||
return "0";
|
||||
}
|
||||
|
||||
public override void ReadFromString( ref string[] nodeParams )
|
||||
{
|
||||
base.ReadFromString( ref nodeParams );
|
||||
m_billboardType = (BillboardType)Enum.Parse( typeof( BillboardType ), GetCurrentParam( ref nodeParams ) );
|
||||
m_rotationIndependent = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) );
|
||||
}
|
||||
|
||||
public override void WriteToString( ref string nodeInfo, ref string connectionsInfo )
|
||||
{
|
||||
base.WriteToString( ref nodeInfo, ref connectionsInfo );
|
||||
IOUtils.AddFieldValueToString( ref nodeInfo, m_billboardType );
|
||||
IOUtils.AddFieldValueToString( ref nodeInfo, m_rotationIndependent );
|
||||
SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, m_billboardType ) );
|
||||
}
|
||||
|
||||
public BillboardType Type { get { return m_billboardType; } }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 08fd3dd8f623aca42b7eb9962a89753d
|
||||
timeCreated: 1501161489
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,37 @@
|
||||
// Amplify Shader Editor - Visual Shader Editing Tool
|
||||
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
|
||||
|
||||
namespace AmplifyShaderEditor
|
||||
{
|
||||
[System.Serializable]
|
||||
[NodeAttributes( "Vertex Bitangent", "Vertex Data", "Calculated bitangent vector in object space, can be used in both local vertex offset and fragment outputs. Already has tangent sign and object transform into account" )]
|
||||
public sealed class BitangentVertexDataNode : ParentNode
|
||||
{
|
||||
protected override void CommonInit( int uniqueId )
|
||||
{
|
||||
base.CommonInit( uniqueId );
|
||||
AddOutputVectorPorts( WirePortDataType.FLOAT3, "XYZ" );
|
||||
m_drawPreviewAsSphere = true;
|
||||
m_previewShaderGUID = "76873532ab67d2947beaf07151383cbe";
|
||||
}
|
||||
|
||||
public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector )
|
||||
{
|
||||
base.PropagateNodeData( nodeData, ref dataCollector );
|
||||
dataCollector.DirtyNormal = true;
|
||||
}
|
||||
|
||||
public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar )
|
||||
{
|
||||
if ( dataCollector.PortCategory == MasterNodePortCategory.Fragment || dataCollector.PortCategory == MasterNodePortCategory.Debug )
|
||||
{
|
||||
dataCollector.ForceNormal = true;
|
||||
dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_NORMAL, CurrentPrecisionType );
|
||||
dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false );
|
||||
}
|
||||
|
||||
string vertexBitangent = GeneratorUtils.GenerateVertexBitangent( ref dataCollector, UniqueId, CurrentPrecisionType );
|
||||
return GetOutputVectorItem( 0, outputId, vertexBitangent );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 839ecbdfc8ed4fd4d8a08ec07f7159fa
|
||||
timeCreated: 1481126958
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,18 @@
|
||||
// Amplify Shader Editor - Visual Shader Editing Tool
|
||||
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
|
||||
|
||||
using UnityEngine;
|
||||
namespace AmplifyShaderEditor
|
||||
{
|
||||
[System.Serializable]
|
||||
[NodeAttributes( "[VS] Vertex Color", "Vertex Data", "Vertex color. Only works on Vertex Shaders ports ( p.e. Local Vertex Offset Port ).", null,KeyCode.None,true,true,"Vertex Color",typeof(VertexColorNode))]
|
||||
public sealed class ColorVertexDataNode : VertexDataNode
|
||||
{
|
||||
protected override void CommonInit( int uniqueId )
|
||||
{
|
||||
base.CommonInit( uniqueId );
|
||||
m_currentVertexData = "color";
|
||||
ConvertFromVectorToColorPorts();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ca76669baa9fa204b8ce5200eb07c1db
|
||||
timeCreated: 1481126959
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,44 @@
|
||||
// Amplify Shader Editor - Visual Shader Editing Tool
|
||||
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
|
||||
|
||||
namespace AmplifyShaderEditor
|
||||
{
|
||||
[System.Serializable]
|
||||
[NodeAttributes( "Vertex Normal", "Vertex Data", "Vertex normal vector in object space, can be used in both local vertex offset and fragment outputs" )]
|
||||
public sealed class NormalVertexDataNode : VertexDataNode
|
||||
{
|
||||
protected override void CommonInit( int uniqueId )
|
||||
{
|
||||
base.CommonInit( uniqueId );
|
||||
m_currentVertexData = "normal";
|
||||
ChangeOutputProperties( 0, "XYZ", WirePortDataType.FLOAT3 );
|
||||
m_outputPorts[ 4 ].Visible = false;
|
||||
m_drawPreviewAsSphere = true;
|
||||
m_previewShaderGUID = "6b24b06c33f9fe84c8a2393f13ab5406";
|
||||
}
|
||||
|
||||
public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar )
|
||||
{
|
||||
string vertexNormal = string.Empty;
|
||||
|
||||
if( dataCollector.MasterNodeCategory == AvailableShaderTypes.Template )
|
||||
{
|
||||
vertexNormal = dataCollector.TemplateDataCollectorInstance.GetVertexNormal( CurrentPrecisionType );
|
||||
return GetOutputVectorItem( 0, outputId, vertexNormal );
|
||||
}
|
||||
|
||||
if( dataCollector.PortCategory == MasterNodePortCategory.Fragment || dataCollector.PortCategory == MasterNodePortCategory.Debug )
|
||||
{
|
||||
dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_NORMAL, CurrentPrecisionType );
|
||||
if( dataCollector.DirtyNormal )
|
||||
{
|
||||
dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false );
|
||||
dataCollector.ForceNormal = true;
|
||||
}
|
||||
}
|
||||
|
||||
vertexNormal = GeneratorUtils.GenerateVertexNormal( ref dataCollector, UniqueId, CurrentPrecisionType );
|
||||
return GetOutputVectorItem( 0, outputId, vertexNormal );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4c7b60515f9cf6043bf8d03531d268f9
|
||||
timeCreated: 1481126955
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,75 @@
|
||||
// Amplify Shader Editor - Visual Shader Editing Tool
|
||||
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
|
||||
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
namespace AmplifyShaderEditor
|
||||
{
|
||||
[Serializable]
|
||||
[NodeAttributes( "Object Scale", "Vertex Data", "Object Scale extracted directly from its transform matrix" )]
|
||||
public class ObjectScaleNode : ParentNode
|
||||
{
|
||||
private const string RotationIndependentScaleStr = "Rotation Independent Scale";
|
||||
|
||||
[SerializeField]
|
||||
private bool m_rotationIndependentScale = false;
|
||||
|
||||
protected override void CommonInit( int uniqueId )
|
||||
{
|
||||
base.CommonInit( uniqueId );
|
||||
AddOutputVectorPorts( WirePortDataType.FLOAT3, "XYZ" );
|
||||
m_drawPreviewAsSphere = true;
|
||||
m_previewShaderGUID = "5540033c6c52f51468938c1a42bd2730";
|
||||
m_textLabelWidth = 180;
|
||||
UpdateMaterialPass();
|
||||
m_autoWrapProperties = true;
|
||||
}
|
||||
|
||||
public override void DrawProperties()
|
||||
{
|
||||
base.DrawProperties();
|
||||
EditorGUI.BeginChangeCheck();
|
||||
m_rotationIndependentScale = EditorGUILayoutToggle( RotationIndependentScaleStr, m_rotationIndependentScale );
|
||||
if( EditorGUI.EndChangeCheck() )
|
||||
{
|
||||
UpdateMaterialPass();
|
||||
}
|
||||
}
|
||||
|
||||
public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar )
|
||||
{
|
||||
string objectScale = m_rotationIndependentScale ? GeneratorUtils.GenerateRotationIndependentObjectScale( ref dataCollector, UniqueId ):
|
||||
GeneratorUtils.GenerateObjectScale( ref dataCollector, UniqueId );
|
||||
|
||||
return GetOutputVectorItem( 0, outputId, objectScale );
|
||||
}
|
||||
|
||||
public override void ReadFromString( ref string[] nodeParams )
|
||||
{
|
||||
base.ReadFromString( ref nodeParams );
|
||||
if( UIUtils.CurrentShaderVersion() < 17402 )
|
||||
{
|
||||
m_rotationIndependentScale = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_rotationIndependentScale = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) );
|
||||
}
|
||||
UpdateMaterialPass();
|
||||
}
|
||||
|
||||
public override void WriteToString( ref string nodeInfo, ref string connectionsInfo )
|
||||
{
|
||||
base.WriteToString( ref nodeInfo, ref connectionsInfo );
|
||||
IOUtils.AddFieldValueToString( ref nodeInfo, m_rotationIndependentScale );
|
||||
}
|
||||
|
||||
void UpdateMaterialPass()
|
||||
{
|
||||
m_previewMaterialPassId = m_rotationIndependentScale ? 1 : 0;
|
||||
PreviewIsDirty = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ef1fe46d0cc472e45ad13ac737db2c1e
|
||||
timeCreated: 1493993914
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,392 @@
|
||||
// Amplify Shader Editor - Visual Shader Editing Tool
|
||||
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
|
||||
|
||||
using System;
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
namespace AmplifyShaderEditor
|
||||
{
|
||||
[Serializable]
|
||||
[NodeAttributes( "Outline", "Miscellaneous", "Uses vertices to simulate an outline around the object" )]
|
||||
public sealed class OutlineNode : ParentNode
|
||||
{
|
||||
enum OutlineAlphaModes
|
||||
{
|
||||
None = 0,
|
||||
Masked,
|
||||
Transparent,
|
||||
AlphaPremultiplied
|
||||
};
|
||||
|
||||
private const string CullModePortNameStr = "Cull Mode";
|
||||
private const string AlphaModePortNameStr = "Alpha";
|
||||
private const string MaskedModePortNamStr = "Opacity Mask";
|
||||
private const string OutlineAlphaModeStr = "Alpha Mode";
|
||||
private const string OpacityMaskClipValueStr = "Mask Clip Value";
|
||||
private const string ErrorMessage = "Outline node should only be connected to vertex ports.";
|
||||
|
||||
[SerializeField]
|
||||
private bool m_noFog = true;
|
||||
|
||||
[SerializeField]
|
||||
private string[] AvailableOutlineModes = { "Vertex Offset", "Vertex Scale", "Custom" };
|
||||
|
||||
[SerializeField]
|
||||
private int[] AvailableOutlineValues = { 0, 1, 2 };
|
||||
|
||||
[SerializeField]
|
||||
private int m_currentSelectedMode = 0;
|
||||
|
||||
[SerializeField]
|
||||
private OutlineAlphaModes m_currentAlphaMode = OutlineAlphaModes.None;
|
||||
|
||||
private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper();
|
||||
|
||||
[NonSerialized]
|
||||
private StandardSurfaceOutputNode m_masterNode = null;
|
||||
|
||||
[SerializeField]
|
||||
private int m_zTestMode = 0;
|
||||
|
||||
[SerializeField]
|
||||
private int m_zWriteMode = 0;
|
||||
|
||||
[SerializeField]
|
||||
private CullMode m_cullMode = CullMode.Front;
|
||||
|
||||
protected override void CommonInit( int uniqueId )
|
||||
{
|
||||
base.CommonInit( uniqueId );
|
||||
|
||||
AddOutputPort( WirePortDataType.FLOAT3, "Out" );
|
||||
|
||||
AddInputPort( WirePortDataType.FLOAT3, false, "Color", -1, MasterNodePortCategory.Fragment, 0 );
|
||||
AddInputPort( WirePortDataType.FLOAT, false, "Alpha", -1, MasterNodePortCategory.Fragment, 2 );
|
||||
AddInputPort( WirePortDataType.FLOAT, false, "Width", -1, MasterNodePortCategory.Fragment, 1 );
|
||||
GetInputPortByUniqueId( 2 ).Visible = false;
|
||||
m_textLabelWidth = 115;
|
||||
m_hasLeftDropdown = true;
|
||||
SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, AvailableOutlineModes[ m_currentSelectedMode ] ) );
|
||||
}
|
||||
|
||||
public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector )
|
||||
{
|
||||
base.PropagateNodeData( nodeData, ref dataCollector );
|
||||
if( GetInputPortByUniqueId( 0 ).IsConnected )
|
||||
dataCollector.UsingCustomOutlineColor = true;
|
||||
|
||||
if( GetInputPortByUniqueId( 1 ).IsConnected )
|
||||
dataCollector.UsingCustomOutlineWidth = true;
|
||||
|
||||
if( GetInputPortByUniqueId( 2 ).IsConnected )
|
||||
dataCollector.UsingCustomOutlineAlpha = true;
|
||||
|
||||
if( !dataCollector.IsTemplate )
|
||||
{
|
||||
UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.ZWriteMode = m_zWriteMode;
|
||||
UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.OffsetMode = m_currentSelectedMode;
|
||||
}
|
||||
}
|
||||
|
||||
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_currentSelectedMode = m_upperLeftWidget.DrawWidget( this, m_currentSelectedMode, AvailableOutlineModes );
|
||||
if( EditorGUI.EndChangeCheck() )
|
||||
{
|
||||
SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, AvailableOutlineModes[ m_currentSelectedMode ] ) );
|
||||
UpdatePorts();
|
||||
}
|
||||
}
|
||||
|
||||
void CheckAlphaPortVisibility()
|
||||
{
|
||||
InputPort alphaPort = GetInputPortByUniqueId( 2 );
|
||||
if( m_currentAlphaMode != OutlineAlphaModes.None )
|
||||
{
|
||||
if( !alphaPort.Visible )
|
||||
alphaPort.Visible = true;
|
||||
|
||||
if( m_currentAlphaMode == OutlineAlphaModes.Masked )
|
||||
{
|
||||
GetInputPortByUniqueId( 2 ).Name = MaskedModePortNamStr;
|
||||
}
|
||||
else
|
||||
{
|
||||
GetInputPortByUniqueId( 2 ).Name = AlphaModePortNameStr;
|
||||
}
|
||||
m_sizeIsDirty = true;
|
||||
}
|
||||
|
||||
if( m_currentAlphaMode == OutlineAlphaModes.None && alphaPort.Visible )
|
||||
{
|
||||
alphaPort.Visible = false;
|
||||
m_sizeIsDirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void DrawProperties()
|
||||
{
|
||||
base.DrawProperties();
|
||||
NodeUtils.DrawPropertyGroup( ref m_propertiesFoldout, Constants.ParameterLabelStr, () =>
|
||||
{
|
||||
EditorGUI.BeginChangeCheck();
|
||||
m_currentSelectedMode = EditorGUILayoutIntPopup( "Type", m_currentSelectedMode, AvailableOutlineModes, AvailableOutlineValues );
|
||||
if( EditorGUI.EndChangeCheck() )
|
||||
{
|
||||
SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, AvailableOutlineModes[ m_currentSelectedMode ] ) );
|
||||
UpdatePorts();
|
||||
}
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
m_currentAlphaMode = (OutlineAlphaModes)EditorGUILayoutEnumPopup( OutlineAlphaModeStr, m_currentAlphaMode );
|
||||
if( EditorGUI.EndChangeCheck() )
|
||||
{
|
||||
CheckAlphaPortVisibility();
|
||||
}
|
||||
|
||||
if( m_currentAlphaMode == OutlineAlphaModes.Masked )
|
||||
{
|
||||
if( m_masterNode == null )
|
||||
{
|
||||
m_masterNode = UIUtils.CurrentWindow.OutsideGraph.CurrentMasterNode as StandardSurfaceOutputNode;
|
||||
}
|
||||
|
||||
if( m_masterNode != null )
|
||||
{
|
||||
m_masterNode.ShowOpacityMaskValueUI();
|
||||
}
|
||||
}
|
||||
|
||||
m_cullMode = (CullMode)EditorGUILayoutEnumPopup( CullModePortNameStr, m_cullMode );
|
||||
m_zWriteMode = EditorGUILayoutPopup( ZBufferOpHelper.ZWriteModeStr, m_zWriteMode, ZBufferOpHelper.ZWriteModeValues );
|
||||
m_zTestMode = EditorGUILayoutPopup( ZBufferOpHelper.ZTestModeStr, m_zTestMode, ZBufferOpHelper.ZTestModeLabels );
|
||||
m_noFog = EditorGUILayoutToggle( "No Fog", m_noFog );
|
||||
|
||||
} );
|
||||
}
|
||||
|
||||
void UpdatePorts()
|
||||
{
|
||||
if( m_currentSelectedMode == 2 ) //custom mode
|
||||
{
|
||||
GetInputPortByUniqueId( 1 ).ChangeProperties( "Offset", WirePortDataType.FLOAT3, false );
|
||||
}
|
||||
else
|
||||
{
|
||||
GetInputPortByUniqueId( 1 ).ChangeProperties( "Width", WirePortDataType.FLOAT, false );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar )
|
||||
{
|
||||
if( dataCollector.IsTemplate )
|
||||
return m_outputPorts[0].ErrorValue;
|
||||
|
||||
if( dataCollector.IsFragmentCategory )
|
||||
{
|
||||
UIUtils.ShowMessage( UniqueId, ErrorMessage );
|
||||
return m_outputPorts[ 0 ].ErrorValue;
|
||||
}
|
||||
|
||||
if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) )
|
||||
return m_outputPorts[ 0 ].ErrorValue;
|
||||
|
||||
m_outputPorts[ 0 ].SetLocalValue( "0", dataCollector.PortCategory );
|
||||
|
||||
StandardSurfaceOutputNode masterNode = UIUtils.CurrentWindow.OutsideGraph.CurrentMasterNode as StandardSurfaceOutputNode;
|
||||
|
||||
MasterNodeDataCollector outlineDataCollector = new MasterNodeDataCollector();
|
||||
outlineDataCollector.IsOutlineDataCollector = true;
|
||||
outlineDataCollector.DirtyNormal = true;
|
||||
InputPort colorPort = GetInputPortByUniqueId( 0 );
|
||||
InputPort alphaPort = GetInputPortByUniqueId( 2 );
|
||||
InputPort vertexPort = GetInputPortByUniqueId( 1 );
|
||||
|
||||
//if( vertexPort.IsConnected )
|
||||
//{
|
||||
// outlineDataCollector.PortCategory = MasterNodePortCategory.Vertex;
|
||||
// string outlineWidth = vertexPort.GenerateShaderForOutput( ref outlineDataCollector, vertexPort.DataType, true, true );
|
||||
// outlineDataCollector.AddToVertexLocalVariables( UniqueId, PrecisionType.Float, vertexPort.DataType, "outlineVar", outlineWidth );
|
||||
|
||||
// outlineDataCollector.AddVertexInstruction( outlineDataCollector.SpecialLocalVariables, UniqueId, false );
|
||||
// outlineDataCollector.ClearSpecialLocalVariables();
|
||||
|
||||
// outlineDataCollector.AddVertexInstruction( outlineDataCollector.VertexLocalVariables, UniqueId, false );
|
||||
// outlineDataCollector.ClearVertexLocalVariables();
|
||||
|
||||
// // need to check whether this breaks other outputs or not
|
||||
// UIUtils.CurrentWindow.OutsideGraph.ResetNodesLocalVariables();
|
||||
//}
|
||||
|
||||
outlineDataCollector.PortCategory = MasterNodePortCategory.Fragment;
|
||||
string outlineColor = colorPort.GeneratePortInstructions( ref outlineDataCollector );// "\to.Emission = " + colorPort.GeneratePortInstructions( ref outlineDataCollector ) + ";";
|
||||
string alphaValue = alphaPort.Visible ? alphaPort.GeneratePortInstructions( ref outlineDataCollector ) : string.Empty;
|
||||
|
||||
|
||||
|
||||
bool addTabs = outlineDataCollector.DirtySpecialLocalVariables || alphaPort.Available;
|
||||
outlineDataCollector.AddInstructions( "\t" + outlineDataCollector.SpecialLocalVariables.TrimStart( '\t' ) );
|
||||
outlineDataCollector.ClearSpecialLocalVariables();
|
||||
outlineDataCollector.AddInstructions( ( addTabs ? "\t\t\t" : "" ) + "o.Emission = " + outlineColor + ";" );
|
||||
if( alphaPort.Visible )
|
||||
{
|
||||
if( m_currentAlphaMode == OutlineAlphaModes.Masked )
|
||||
{
|
||||
float maskClipValue = 0.5f;
|
||||
|
||||
if( masterNode != null )
|
||||
maskClipValue = masterNode.OpacityMaskClipValue;
|
||||
|
||||
if( masterNode.InlineOpacityMaskClipValue.IsValid )
|
||||
{
|
||||
RangedFloatNode fnode = UIUtils.GetNode( masterNode.InlineOpacityMaskClipValue.NodeId ) as RangedFloatNode;
|
||||
if( fnode != null )
|
||||
{
|
||||
outlineDataCollector.AddToProperties( fnode.UniqueId, fnode.GetPropertyValue(), fnode.OrderIndex );
|
||||
outlineDataCollector.AddToUniforms( fnode.UniqueId, fnode.GetUniformValue() );
|
||||
}
|
||||
else
|
||||
{
|
||||
IntNode inode = UIUtils.GetNode( masterNode.InlineOpacityMaskClipValue.NodeId ) as IntNode;
|
||||
outlineDataCollector.AddToProperties( inode.UniqueId, inode.GetPropertyValue(), inode.OrderIndex );
|
||||
outlineDataCollector.AddToUniforms( inode.UniqueId, inode.GetUniformValue() );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
outlineDataCollector.AddToProperties( -1, string.Format( IOUtils.MaskClipValueProperty, OpacityMaskClipValueStr, maskClipValue ), -1 );
|
||||
outlineDataCollector.AddToUniforms( -1, string.Format( IOUtils.MaskClipValueUniform, maskClipValue ) );
|
||||
}
|
||||
|
||||
outlineDataCollector.AddInstructions( ( addTabs ? "\n\t\t\t" : "" ) + "clip( " + alphaValue + " - " + masterNode.InlineOpacityMaskClipValue.GetValueOrProperty( IOUtils.MaskClipValueName, false ) + " );" );
|
||||
}
|
||||
else
|
||||
{
|
||||
outlineDataCollector.AddInstructions( ( addTabs ? "\n\t\t\t" : "" ) + "o.Alpha = " + alphaValue + ";" );
|
||||
}
|
||||
}
|
||||
|
||||
if( outlineDataCollector.UsingWorldNormal )
|
||||
outlineDataCollector.AddInstructions( ( addTabs ? "\n\t\t\t" : "" ) + "o.Normal = float3(0,0,-1);" );
|
||||
|
||||
//Moved vertex port code generation from ln.227 to this after fragment ones
|
||||
//to correctly include vertex instructions generated by them
|
||||
UIUtils.CurrentWindow.OutsideGraph.ResetNodesLocalVariables();
|
||||
outlineDataCollector.PortCategory = MasterNodePortCategory.Vertex;
|
||||
string outlineWidth = vertexPort.GenerateShaderForOutput( ref outlineDataCollector, vertexPort.DataType, true, true );
|
||||
|
||||
|
||||
outlineDataCollector.AddToVertexLocalVariables( UniqueId, PrecisionType.Float, vertexPort.DataType, "outlineVar", outlineWidth );
|
||||
|
||||
outlineDataCollector.AddVertexInstruction( outlineDataCollector.SpecialLocalVariables, UniqueId, false );
|
||||
outlineDataCollector.ClearSpecialLocalVariables();
|
||||
|
||||
outlineDataCollector.AddVertexInstruction( outlineDataCollector.VertexLocalVariables, UniqueId, false );
|
||||
outlineDataCollector.ClearVertexLocalVariables();
|
||||
|
||||
outlineDataCollector.AddASEMacros();
|
||||
|
||||
// need to check whether this breaks other outputs or not
|
||||
UIUtils.CurrentWindow.OutsideGraph.ResetNodesLocalVariables();
|
||||
|
||||
if( masterNode != null )
|
||||
{
|
||||
masterNode.CheckSamplingMacrosFlag();
|
||||
//masterNode.AdditionalIncludes.AddToDataCollector( ref outlineDataCollector );
|
||||
//masterNode.AdditionalPragmas.AddToDataCollector( ref outlineDataCollector );
|
||||
//masterNode.AdditionalDefines.AddToDataCollector( ref outlineDataCollector );
|
||||
if( !masterNode.CustomShadowCaster )
|
||||
masterNode.AdditionalDirectives.AddAllToDataCollector( ref outlineDataCollector );
|
||||
}
|
||||
|
||||
UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.InputList = outlineDataCollector.InputList;
|
||||
UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.Inputs = outlineDataCollector.Inputs;
|
||||
UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.DirtyInput = outlineDataCollector.DirtyInputs;
|
||||
UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.Includes = outlineDataCollector.Includes;
|
||||
UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.Pragmas = outlineDataCollector.Pragmas;
|
||||
UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.Defines = outlineDataCollector.Defines;
|
||||
UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.StandardAdditionalDirectives = outlineDataCollector.StandardAdditionalDirectives;
|
||||
UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.Uniforms = outlineDataCollector.Uniforms;
|
||||
UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.InstancedProperties = outlineDataCollector.InstancedProperties;
|
||||
UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.GrabPasses = outlineDataCollector.GrabPass;
|
||||
UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.UniformList = outlineDataCollector.UniformsList;
|
||||
UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.InstancedPropertiesList = outlineDataCollector.InstancedPropertiesList;
|
||||
UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.VertexData = outlineDataCollector.VertexData;
|
||||
UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.Instructions = outlineDataCollector.Instructions;
|
||||
UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.Functions = outlineDataCollector.Functions;
|
||||
UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.LocalFunctions = outlineDataCollector.LocalFunctions;
|
||||
UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.OutlineCullMode = m_cullMode;
|
||||
UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.ZTestMode = m_zTestMode;
|
||||
UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.ZWriteMode = m_zWriteMode;
|
||||
UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.OffsetMode = m_currentSelectedMode;
|
||||
UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.CustomNoFog = m_noFog;
|
||||
dataCollector.CustomOutlineSelectedAlpha = (int)m_currentAlphaMode;
|
||||
|
||||
for( int i = 0; i < outlineDataCollector.PropertiesList.Count; i++ )
|
||||
{
|
||||
dataCollector.AddToProperties( UniqueId, outlineDataCollector.PropertiesList[ i ].PropertyName, outlineDataCollector.PropertiesList[ i ].OrderIndex );
|
||||
}
|
||||
|
||||
dataCollector.UsingInternalData = dataCollector.UsingInternalData || outlineDataCollector.UsingInternalData;
|
||||
UIUtils.CurrentWindow.OutsideGraph.ResetNodesLocalVariablesIfNot( MasterNodePortCategory.Vertex );
|
||||
return "0";
|
||||
}
|
||||
|
||||
public override void ReadFromString( ref string[] nodeParams )
|
||||
{
|
||||
base.ReadFromString( ref nodeParams );
|
||||
m_currentSelectedMode = Convert.ToInt32( GetCurrentParam( ref nodeParams ) );
|
||||
m_noFog = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) );
|
||||
if( UIUtils.CurrentShaderVersion() > 14202 )
|
||||
m_currentAlphaMode = (OutlineAlphaModes)Enum.Parse( typeof( OutlineAlphaModes ), GetCurrentParam( ref nodeParams ) );
|
||||
|
||||
if( UIUtils.CurrentShaderVersion() > 14302 )
|
||||
{
|
||||
m_zWriteMode = Convert.ToInt32( GetCurrentParam( ref nodeParams ) );
|
||||
m_zTestMode = Convert.ToInt32( GetCurrentParam( ref nodeParams ) );
|
||||
}
|
||||
|
||||
if( UIUtils.CurrentShaderVersion() > 15304 )
|
||||
{
|
||||
m_cullMode = (CullMode)Enum.Parse( typeof( CullMode ), GetCurrentParam( ref nodeParams ) );
|
||||
}
|
||||
|
||||
SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, AvailableOutlineModes[ m_currentSelectedMode ] ) );
|
||||
UpdatePorts();
|
||||
CheckAlphaPortVisibility();
|
||||
}
|
||||
|
||||
public override void WriteToString( ref string nodeInfo, ref string connectionsInfo )
|
||||
{
|
||||
base.WriteToString( ref nodeInfo, ref connectionsInfo );
|
||||
IOUtils.AddFieldValueToString( ref nodeInfo, m_currentSelectedMode );
|
||||
IOUtils.AddFieldValueToString( ref nodeInfo, m_noFog );
|
||||
IOUtils.AddFieldValueToString( ref nodeInfo, m_currentAlphaMode );
|
||||
IOUtils.AddFieldValueToString( ref nodeInfo, m_zWriteMode );
|
||||
IOUtils.AddFieldValueToString( ref nodeInfo, m_zTestMode );
|
||||
IOUtils.AddFieldValueToString( ref nodeInfo, m_cullMode );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 24f267627c002964badad2901309c96a
|
||||
timeCreated: 1501161489
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,138 @@
|
||||
// Amplify Shader Editor - Visual Shader Editing Tool
|
||||
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
|
||||
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace AmplifyShaderEditor
|
||||
{
|
||||
[Serializable]
|
||||
[NodeAttributes( "Vertex Position", "Vertex Data", "Vertex position vector in object space, can be used in both local vertex offset and fragment outputs" )]
|
||||
public sealed class PosVertexDataNode : VertexDataNode
|
||||
{
|
||||
private const string PropertyLabel = "Size";
|
||||
private readonly string[] SizeLabels = { "XYZ", "XYZW" };
|
||||
|
||||
[SerializeField]
|
||||
private int m_sizeOption = 0;
|
||||
|
||||
private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper();
|
||||
|
||||
protected override void CommonInit( int uniqueId )
|
||||
{
|
||||
base.CommonInit( uniqueId );
|
||||
m_currentVertexData = "vertex";
|
||||
ChangeOutputProperties( 0, "XYZ", WirePortDataType.FLOAT3 );
|
||||
m_drawPreviewAsSphere = true;
|
||||
m_outputPorts[ 4 ].Visible = false;
|
||||
m_hasLeftDropdown = true;
|
||||
m_autoWrapProperties = true;
|
||||
m_previewShaderGUID = "a5c14f759dd021b4b8d4b6eeb85ac227";
|
||||
}
|
||||
|
||||
public override void Destroy()
|
||||
{
|
||||
base.Destroy();
|
||||
m_upperLeftWidget = null;
|
||||
}
|
||||
|
||||
public override void Draw( DrawInfo drawInfo )
|
||||
{
|
||||
base.Draw( drawInfo );
|
||||
EditorGUI.BeginChangeCheck();
|
||||
m_sizeOption = m_upperLeftWidget.DrawWidget( this, m_sizeOption, SizeLabels );
|
||||
if( EditorGUI.EndChangeCheck() )
|
||||
{
|
||||
UpdatePorts();
|
||||
}
|
||||
}
|
||||
|
||||
public override void DrawProperties()
|
||||
{
|
||||
EditorGUI.BeginChangeCheck();
|
||||
m_sizeOption = EditorGUILayoutPopup( PropertyLabel, m_sizeOption, SizeLabels );
|
||||
if ( EditorGUI.EndChangeCheck() )
|
||||
{
|
||||
UpdatePorts();
|
||||
}
|
||||
}
|
||||
|
||||
void UpdatePorts()
|
||||
{
|
||||
if ( m_sizeOption == 0 )
|
||||
{
|
||||
ChangeOutputProperties( 0, SizeLabels[ 0 ], WirePortDataType.FLOAT3, false );
|
||||
m_outputPorts[ 4 ].Visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
ChangeOutputProperties( 0, SizeLabels[ 1 ], WirePortDataType.FLOAT4, false );
|
||||
m_outputPorts[ 4 ].Visible = true;
|
||||
}
|
||||
}
|
||||
public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar )
|
||||
{
|
||||
|
||||
if ( dataCollector.MasterNodeCategory == AvailableShaderTypes.Template )
|
||||
{
|
||||
string vertexPos = dataCollector.TemplateDataCollectorInstance.GetVertexPosition( ( m_sizeOption == 0 ) ? WirePortDataType.FLOAT3 : WirePortDataType.FLOAT4, CurrentPrecisionType );
|
||||
return GetOutputVectorItem( 0, outputId, vertexPos );
|
||||
}
|
||||
|
||||
|
||||
if ( dataCollector.PortCategory == MasterNodePortCategory.Fragment || dataCollector.PortCategory == MasterNodePortCategory.Debug )
|
||||
base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalVar );
|
||||
|
||||
WirePortDataType sizeType = m_sizeOption == 0 ? WirePortDataType.FLOAT3 : WirePortDataType.FLOAT4;
|
||||
|
||||
string vertexPosition = GeneratorUtils.GenerateVertexPosition( ref dataCollector, UniqueId, sizeType );
|
||||
return GetOutputVectorItem( 0, outputId, vertexPosition );
|
||||
|
||||
//if ( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation )
|
||||
//{
|
||||
// string vertexVar = base.GenerateShaderForOutput( 0, ref dataCollector, ignoreLocalVar );
|
||||
// if ( outputId != 0 )
|
||||
// {
|
||||
// return GetOutputVectorItem( 0, outputId, vertexVar );
|
||||
// }
|
||||
// else if ( m_sizeOption == 0 )
|
||||
// {
|
||||
// vertexVar += ".xyz";
|
||||
// }
|
||||
|
||||
// return vertexVar;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
|
||||
// string vertexVar = GeneratorUtils.GenerateVertexPositionOnFrag( ref dataCollector, UniqueId, m_currentPrecisionType );
|
||||
// if ( outputId != 0 )
|
||||
// {
|
||||
// return GetOutputVectorItem( 0, outputId, vertexVar );
|
||||
// }
|
||||
// else if ( m_sizeOption == 0 )
|
||||
// {
|
||||
// vertexVar += ".xyz";
|
||||
// }
|
||||
// return GetOutputVectorItem( 0, outputId, vertexVar );
|
||||
//}
|
||||
}
|
||||
|
||||
public override void ReadFromString( ref string[] nodeParams )
|
||||
{
|
||||
base.ReadFromString( ref nodeParams );
|
||||
if ( UIUtils.CurrentShaderVersion() > 7101 )
|
||||
{
|
||||
m_sizeOption = Convert.ToInt32( GetCurrentParam( ref nodeParams ) );
|
||||
UpdatePorts();
|
||||
}
|
||||
}
|
||||
|
||||
public override void WriteToString( ref string nodeInfo, ref string connectionsInfo )
|
||||
{
|
||||
base.WriteToString( ref nodeInfo, ref connectionsInfo );
|
||||
IOUtils.AddFieldValueToString( ref nodeInfo, m_sizeOption );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fc77801277f0faf4ca0be33f565b5604
|
||||
timeCreated: 1481126960
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,23 @@
|
||||
// Amplify Shader Editor - Visual Shader Editing Tool
|
||||
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
|
||||
|
||||
namespace AmplifyShaderEditor
|
||||
{
|
||||
[System.Serializable]
|
||||
[NodeAttributes( "Vertex Tangent Sign", "Vertex Data", "Vertex tangent sign in object space, return the W value of tangent vector that contains only the sign of the tangent" )]
|
||||
public sealed class TangentSignVertexDataNode : ParentNode
|
||||
{
|
||||
protected override void CommonInit( int uniqueId )
|
||||
{
|
||||
base.CommonInit( uniqueId );
|
||||
AddOutputVectorPorts( WirePortDataType.FLOAT, "Sign" );
|
||||
m_drawPreviewAsSphere = true;
|
||||
m_previewShaderGUID = "f5466d126f4bb1f49917eac88b1cb6af";
|
||||
}
|
||||
|
||||
public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar )
|
||||
{
|
||||
return GeneratorUtils.GenerateVertexTangentSign( ref dataCollector, UniqueId, CurrentPrecisionType ); ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1f79f23d5c10c9e4fb6a59c1ef70f6fc
|
||||
timeCreated: 1481126958
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,120 @@
|
||||
// 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( "Vertex Tangent", "Vertex Data", "Vertex tangent vector in object space, can be used in both local vertex offset and fragment outputs" )]
|
||||
public sealed class TangentVertexDataNode : VertexDataNode
|
||||
{
|
||||
private const string PropertyLabel = "Size";
|
||||
private readonly string[] SizeLabels = { "XYZ", "XYZW" };
|
||||
|
||||
[SerializeField]
|
||||
private int m_sizeOption = 0;
|
||||
|
||||
private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper();
|
||||
|
||||
protected override void CommonInit( int uniqueId )
|
||||
{
|
||||
base.CommonInit( uniqueId );
|
||||
m_currentVertexData = "tangent";
|
||||
ChangeOutputProperties( 0, "XYZ", WirePortDataType.FLOAT3 );
|
||||
m_outputPorts[ 4 ].Visible = false;
|
||||
m_drawPreviewAsSphere = true;
|
||||
m_hasLeftDropdown = true;
|
||||
m_previewShaderGUID = "0a44bb521d06d6143a4acbc3602037f8";
|
||||
}
|
||||
|
||||
public override void Destroy()
|
||||
{
|
||||
base.Destroy();
|
||||
m_upperLeftWidget = null;
|
||||
}
|
||||
|
||||
public override void Draw( DrawInfo drawInfo )
|
||||
{
|
||||
base.Draw( drawInfo );
|
||||
EditorGUI.BeginChangeCheck();
|
||||
m_sizeOption = m_upperLeftWidget.DrawWidget( this, m_sizeOption, SizeLabels );
|
||||
if( EditorGUI.EndChangeCheck() )
|
||||
{
|
||||
UpdatePorts();
|
||||
}
|
||||
}
|
||||
|
||||
public override void DrawProperties()
|
||||
{
|
||||
EditorGUI.BeginChangeCheck();
|
||||
m_sizeOption = EditorGUILayoutPopup( PropertyLabel, m_sizeOption, SizeLabels );
|
||||
if( EditorGUI.EndChangeCheck() )
|
||||
{
|
||||
UpdatePorts();
|
||||
}
|
||||
}
|
||||
|
||||
void UpdatePorts()
|
||||
{
|
||||
if( m_sizeOption == 0 )
|
||||
{
|
||||
ChangeOutputProperties( 0, SizeLabels[ 0 ], WirePortDataType.FLOAT3, false );
|
||||
m_outputPorts[ 4 ].Visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
ChangeOutputProperties( 0, SizeLabels[ 1 ], WirePortDataType.FLOAT4, false );
|
||||
m_outputPorts[ 4 ].Visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector )
|
||||
{
|
||||
base.PropagateNodeData( nodeData, ref dataCollector );
|
||||
dataCollector.DirtyNormal = true;
|
||||
}
|
||||
|
||||
public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar )
|
||||
{
|
||||
string vertexTangent = string.Empty;
|
||||
if ( dataCollector.MasterNodeCategory == AvailableShaderTypes.Template )
|
||||
{
|
||||
vertexTangent = dataCollector.TemplateDataCollectorInstance.GetVertexTangent( WirePortDataType.FLOAT4, CurrentPrecisionType );
|
||||
if( m_sizeOption == 0 )
|
||||
vertexTangent += ".xyz";
|
||||
|
||||
return GetOutputVectorItem( 0, outputId, vertexTangent );
|
||||
}
|
||||
|
||||
if ( dataCollector.PortCategory == MasterNodePortCategory.Fragment || dataCollector.PortCategory == MasterNodePortCategory.Debug )
|
||||
{
|
||||
dataCollector.ForceNormal = true;
|
||||
dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_NORMAL, CurrentPrecisionType );
|
||||
dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false );
|
||||
}
|
||||
|
||||
WirePortDataType sizeType = m_sizeOption == 0 ? WirePortDataType.FLOAT3 : WirePortDataType.FLOAT4;
|
||||
|
||||
vertexTangent = GeneratorUtils.GenerateVertexTangent( ref dataCollector, UniqueId, CurrentPrecisionType, sizeType );
|
||||
return GetOutputVectorItem( 0, outputId, vertexTangent );
|
||||
}
|
||||
|
||||
public override void ReadFromString( ref string[] nodeParams )
|
||||
{
|
||||
base.ReadFromString( ref nodeParams );
|
||||
if( UIUtils.CurrentShaderVersion() > 16100 )
|
||||
{
|
||||
m_sizeOption = Convert.ToInt32( GetCurrentParam( ref nodeParams ) );
|
||||
UpdatePorts();
|
||||
}
|
||||
}
|
||||
|
||||
public override void WriteToString( ref string nodeInfo, ref string connectionsInfo )
|
||||
{
|
||||
base.WriteToString( ref nodeInfo, ref connectionsInfo );
|
||||
IOUtils.AddFieldValueToString( ref nodeInfo, m_sizeOption );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b544118f39abfe84581b8249973d52c5
|
||||
timeCreated: 1481126958
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 518d8e72c2385b9488817fee5368f56c
|
||||
folderAsset: yes
|
||||
timeCreated: 1482150091
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5a83fb450d164d34bb756f46b3f4290e
|
||||
timeCreated: 1482150091
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4b09c64ce2fd06a4cb4036d8cc0f8b2a
|
||||
timeCreated: 1482150962
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: abe3e8fa4d49c9742a95ac801fd14d7d
|
||||
timeCreated: 1482150962
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 79c24faef1fec884d937e74bdc9209da
|
||||
timeCreated: 1482162387
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,16 @@
|
||||
// Amplify Shader Editor - Visual Shader Editing Tool
|
||||
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
|
||||
|
||||
namespace AmplifyShaderEditor
|
||||
{
|
||||
[System.Serializable]
|
||||
[NodeAttributes( "[VS] Vertex TexCoord1", "Vertex Data", "Second set of vertex texture coordinates. Only works on Vertex Shaders ports ( p.e. Local Vertex Offset Port )." ,null,UnityEngine.KeyCode.None,true,true, "[VS] Vertex TexCoord" )]
|
||||
public sealed class TexCoord1VertexDataNode : VertexDataNode
|
||||
{
|
||||
protected override void CommonInit( int uniqueId )
|
||||
{
|
||||
base.CommonInit( uniqueId );
|
||||
m_currentVertexData = "texcoord1";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ebd7eb3a7f6149e4e9dacbcda2d8089f
|
||||
timeCreated: 1481126960
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,241 @@
|
||||
// Amplify Shader Editor - Visual Shader Editing Tool
|
||||
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
|
||||
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace AmplifyShaderEditor
|
||||
{
|
||||
[Serializable]
|
||||
[NodeAttributes( "Vertex TexCoord", "Vertex Data", "Vertex texture coordinates, can be used in both local vertex offset and fragment outputs", tags: "uv" )]
|
||||
public sealed class TexCoordVertexDataNode : VertexDataNode
|
||||
{
|
||||
[SerializeField]
|
||||
private int m_texcoordSize = 2;
|
||||
|
||||
[SerializeField]
|
||||
private int m_index = 0;
|
||||
|
||||
protected override void CommonInit( int uniqueId )
|
||||
{
|
||||
base.CommonInit( uniqueId );
|
||||
m_currentVertexData = "texcoord";
|
||||
ChangeOutputProperties( 0, "UV", WirePortDataType.FLOAT2, false );
|
||||
m_outputPorts[ 1 ].Name = "U";
|
||||
m_outputPorts[ 2 ].Name = "V";
|
||||
m_outputPorts[ 3 ].Visible = false;
|
||||
m_outputPorts[ 4 ].Visible = false;
|
||||
m_outputPorts[ 3 ].Name = "W";
|
||||
m_outputPorts[ 4 ].Name = "T";
|
||||
m_autoWrapProperties = true;
|
||||
m_hasLeftDropdown = true;
|
||||
m_previewShaderGUID = "6c1bee77276896041bbb73b1b9e7f8ac";
|
||||
}
|
||||
|
||||
public override void DrawProperties()
|
||||
{
|
||||
base.DrawProperties();
|
||||
EditorGUI.BeginChangeCheck();
|
||||
m_texcoordSize = EditorGUILayoutIntPopup( Constants.AvailableUVSizesLabel, m_texcoordSize, Constants.AvailableUVSizesStr, Constants.AvailableUVSizes );
|
||||
if( EditorGUI.EndChangeCheck() )
|
||||
{
|
||||
UpdateOutput();
|
||||
}
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
m_index = EditorGUILayoutIntPopup( Constants.AvailableUVChannelLabel, m_index, Constants.AvailableUVSetsStr, Constants.AvailableUVChannels );
|
||||
if( EditorGUI.EndChangeCheck() )
|
||||
{
|
||||
m_currentVertexData = ( m_index == 0 ) ? "texcoord" : "texcoord" + Constants.AvailableUVChannelsStr[ m_index ];
|
||||
}
|
||||
}
|
||||
|
||||
public override void Draw( DrawInfo drawInfo )
|
||||
{
|
||||
base.Draw( drawInfo );
|
||||
|
||||
if( m_dropdownEditing )
|
||||
{
|
||||
EditorGUI.BeginChangeCheck();
|
||||
m_texcoordSize = EditorGUIIntPopup( m_dropdownRect, m_texcoordSize, Constants.AvailableUVSizesStr, Constants.AvailableUVSizes, UIUtils.PropertyPopUp );
|
||||
if( EditorGUI.EndChangeCheck() )
|
||||
{
|
||||
UpdateOutput();
|
||||
DropdownEditing = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateOutput()
|
||||
{
|
||||
if( m_texcoordSize == 3 )
|
||||
{
|
||||
m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT3, false );
|
||||
m_outputPorts[ 0 ].Name = "UVW";
|
||||
m_outputPorts[ 3 ].Visible = true;
|
||||
m_outputPorts[ 4 ].Visible = false;
|
||||
}
|
||||
else if( m_texcoordSize == 4 )
|
||||
{
|
||||
m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false );
|
||||
m_outputPorts[ 0 ].Name = "UVWT";
|
||||
m_outputPorts[ 3 ].Visible = true;
|
||||
m_outputPorts[ 4 ].Visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_texcoordSize = 2;
|
||||
m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT2, false );
|
||||
m_outputPorts[ 0 ].Name = "UV";
|
||||
m_outputPorts[ 3 ].Visible = false;
|
||||
m_outputPorts[ 4 ].Visible = false;
|
||||
}
|
||||
m_sizeIsDirty = true;
|
||||
}
|
||||
|
||||
public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar )
|
||||
{
|
||||
if( dataCollector.IsTemplate )
|
||||
{
|
||||
if( !dataCollector.TemplateDataCollectorInstance.HasUV( m_index ) )
|
||||
{
|
||||
dataCollector.TemplateDataCollectorInstance.RegisterUV( m_index, m_outputPorts[ 0 ].DataType );
|
||||
}
|
||||
|
||||
string result = string.Empty;
|
||||
if( dataCollector.TemplateDataCollectorInstance.GetCustomInterpolatedData( TemplateHelperFunctions.IntToUVChannelInfo[ m_index ], m_outputPorts[ 0 ].DataType, PrecisionType.Float, ref result, false, dataCollector.PortCategory ) )
|
||||
{
|
||||
return GetOutputVectorItem( 0, outputId, result );
|
||||
}
|
||||
else
|
||||
if( dataCollector.TemplateDataCollectorInstance.HasUV( m_index ) )
|
||||
{
|
||||
InterpDataHelper info = dataCollector.TemplateDataCollectorInstance.GetUVInfo( m_index );
|
||||
if( outputId == 0 )
|
||||
{
|
||||
return dataCollector.TemplateDataCollectorInstance.GetUVName( m_index, m_outputPorts[ 0 ].DataType );
|
||||
}
|
||||
else if( outputId <= TemplateHelperFunctions.DataTypeChannelUsage[ info.VarType ] )
|
||||
{
|
||||
return GetOutputVectorItem( 0, outputId, info.VarName );
|
||||
}
|
||||
Debug.LogWarning( "Attempting to access inexisting UV channel" );
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning( "Attempting to access non-registered UV" );
|
||||
}
|
||||
return "0";
|
||||
}
|
||||
|
||||
if( dataCollector.PortCategory == MasterNodePortCategory.Fragment || dataCollector.PortCategory == MasterNodePortCategory.Debug )
|
||||
{
|
||||
if( m_texcoordSize > 2 )
|
||||
dataCollector.UsingHigherSizeTexcoords = true;
|
||||
}
|
||||
|
||||
WirePortDataType size = (WirePortDataType)( 1 << ( m_texcoordSize + 1 ) );
|
||||
string texcoords = GeneratorUtils.GenerateAutoUVs( ref dataCollector, UniqueId, m_index, null, size );
|
||||
return GetOutputVectorItem( 0, outputId, texcoords );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates UV properties and uniforms and returns the varible name to use in the fragment shader
|
||||
/// </summary>
|
||||
/// <param name="dataCollector"></param>
|
||||
/// <param name="uniqueId"></param>
|
||||
/// <param name="index"></param>
|
||||
/// <returns>frag variable name</returns>
|
||||
static public string GenerateFragUVs( ref MasterNodeDataCollector dataCollector, int uniqueId, int index, string propertyName = null, WirePortDataType size = WirePortDataType.FLOAT2 )
|
||||
{
|
||||
string dummyPropUV = "_texcoord" + ( index > 0 ? ( index + 1 ).ToString() : "" );
|
||||
string dummyUV = "uv" + ( index > 0 ? ( index + 1 ).ToString() : "" ) + dummyPropUV;
|
||||
|
||||
dataCollector.AddToProperties( uniqueId, "[HideInInspector] " + dummyPropUV + "( \"\", 2D ) = \"white\" {}", 100 );
|
||||
dataCollector.AddToInput( uniqueId, dummyUV, size );
|
||||
|
||||
string result = Constants.InputVarStr + "." + dummyUV;
|
||||
if( !string.IsNullOrEmpty( propertyName ) )
|
||||
{
|
||||
dataCollector.AddToUniforms( uniqueId, "uniform float4 " + propertyName + "_ST;" );
|
||||
dataCollector.AddToLocalVariables( uniqueId, PrecisionType.Float, size, "uv" + propertyName, result + " * " + propertyName + "_ST.xy + " + propertyName + "_ST.zw" );
|
||||
result = "uv" + propertyName;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static public string GenerateVertexUVs( ref MasterNodeDataCollector dataCollector, int uniqueId, int index, string propertyName = null, WirePortDataType size = WirePortDataType.FLOAT2 )
|
||||
{
|
||||
|
||||
string result = Constants.VertexShaderInputStr + ".texcoord";
|
||||
if( index > 0 )
|
||||
{
|
||||
result += index.ToString();
|
||||
}
|
||||
|
||||
switch( size )
|
||||
{
|
||||
default:
|
||||
case WirePortDataType.FLOAT2:
|
||||
{
|
||||
result += ".xy";
|
||||
}
|
||||
break;
|
||||
case WirePortDataType.FLOAT3:
|
||||
{
|
||||
result += ".xyz";
|
||||
}
|
||||
break;
|
||||
case WirePortDataType.FLOAT4: break;
|
||||
}
|
||||
|
||||
if( !string.IsNullOrEmpty( propertyName ) )
|
||||
{
|
||||
dataCollector.AddToUniforms( uniqueId, "uniform float4 " + propertyName + "_ST;" );
|
||||
dataCollector.AddToVertexLocalVariables( uniqueId, UIUtils.WirePortToCgType( size ) + " uv" + propertyName + " = " + Constants.VertexShaderInputStr + ".texcoord" + ( index > 0 ? index.ToString() : string.Empty ) + " * " + propertyName + "_ST.xy + " + propertyName + "_ST.zw;" );
|
||||
result = "uv" + propertyName;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public override void ReadFromString( ref string[] nodeParams )
|
||||
{
|
||||
base.ReadFromString( ref nodeParams );
|
||||
if( UIUtils.CurrentShaderVersion() > 2502 )
|
||||
{
|
||||
m_index = Convert.ToInt32( GetCurrentParam( ref nodeParams ) );
|
||||
}
|
||||
|
||||
if( UIUtils.CurrentShaderVersion() > 5111 )
|
||||
{
|
||||
m_texcoordSize = Convert.ToInt32( GetCurrentParam( ref nodeParams ) );
|
||||
UpdateOutput();
|
||||
}
|
||||
}
|
||||
|
||||
public override void WriteToString( ref string nodeInfo, ref string connectionsInfo )
|
||||
{
|
||||
base.WriteToString( ref nodeInfo, ref connectionsInfo );
|
||||
IOUtils.AddFieldValueToString( ref nodeInfo, m_index );
|
||||
IOUtils.AddFieldValueToString( ref nodeInfo, m_texcoordSize );
|
||||
}
|
||||
|
||||
public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector )
|
||||
{
|
||||
base.PropagateNodeData( nodeData, ref dataCollector );
|
||||
if( dataCollector.IsTemplate )
|
||||
{
|
||||
dataCollector.TemplateDataCollectorInstance.SetUVUsage( m_index, m_texcoordSize );
|
||||
}
|
||||
else if( m_index > 3 )
|
||||
{
|
||||
dataCollector.AddCustomAppData( string.Format( TemplateHelperFunctions.TexUVFullSemantic, m_index ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b865968ce22b9d949993e5e60126eb11
|
||||
timeCreated: 1481126958
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,48 @@
|
||||
// Amplify Shader Editor - Visual Shader Editing Tool
|
||||
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
|
||||
//
|
||||
// Custom Node Vertex Binormal World
|
||||
// Donated by Community Member Kebrus
|
||||
|
||||
using UnityEngine;
|
||||
using System;
|
||||
|
||||
namespace AmplifyShaderEditor
|
||||
{
|
||||
[Serializable]
|
||||
[NodeAttributes( "World Bitangent", "Surface Data", "Per pixel world bitangent vector", null, KeyCode.None, true, false, null, null, "kebrus" )]
|
||||
public sealed class VertexBinormalNode : ParentNode
|
||||
{
|
||||
protected override void CommonInit( int uniqueId )
|
||||
{
|
||||
base.CommonInit( uniqueId );
|
||||
AddOutputVectorPorts( WirePortDataType.FLOAT3, "XYZ" );
|
||||
m_drawPreviewAsSphere = true;
|
||||
m_previewShaderGUID = "76873532ab67d2947beaf07151383cbe";
|
||||
}
|
||||
|
||||
public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector )
|
||||
{
|
||||
base.PropagateNodeData( nodeData, ref dataCollector );
|
||||
dataCollector.DirtyNormal = true;
|
||||
}
|
||||
|
||||
public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar )
|
||||
{
|
||||
if ( dataCollector.IsTemplate )
|
||||
return GetOutputVectorItem( 0, outputId, dataCollector.TemplateDataCollectorInstance.GetWorldBinormal( CurrentPrecisionType ) );
|
||||
|
||||
if( dataCollector.PortCategory == MasterNodePortCategory.Fragment || dataCollector.PortCategory == MasterNodePortCategory.Debug )
|
||||
{
|
||||
dataCollector.ForceNormal = true;
|
||||
|
||||
dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_NORMAL, CurrentPrecisionType );
|
||||
dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false );
|
||||
}
|
||||
|
||||
string worldBitangent = GeneratorUtils.GenerateWorldBitangent( ref dataCollector, UniqueId );
|
||||
|
||||
return GetOutputVectorItem( 0, outputId, worldBitangent );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8ae297dac4e208f4e86c8f7a022fc5bd
|
||||
timeCreated: 1481126957
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,47 @@
|
||||
// Amplify Shader Editor - Visual Shader Editing Tool
|
||||
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
|
||||
|
||||
namespace AmplifyShaderEditor
|
||||
{
|
||||
[System.Serializable]
|
||||
[NodeAttributes( "Vertex Color", "Vertex Data", "Vertex color interpolated on fragment" )]
|
||||
public sealed class VertexColorNode : VertexDataNode
|
||||
{
|
||||
protected override void CommonInit( int uniqueId )
|
||||
{
|
||||
base.CommonInit( uniqueId );
|
||||
m_currentVertexData = "color";
|
||||
m_outputPorts[ 0 ].Name = "RGBA";
|
||||
ConvertFromVectorToColorPorts();
|
||||
m_drawPreviewAsSphere = true;
|
||||
m_previewShaderGUID = "ca1d22db6470c5f4d9f93a9873b4f5bc";
|
||||
}
|
||||
|
||||
public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar )
|
||||
{
|
||||
if( dataCollector.MasterNodeCategory == AvailableShaderTypes.Template )
|
||||
{
|
||||
string color = dataCollector.TemplateDataCollectorInstance.GetVertexColor( CurrentPrecisionType );
|
||||
return GetOutputColorItem( 0, outputId, color );
|
||||
}
|
||||
|
||||
if( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation )
|
||||
{
|
||||
return base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalVar );
|
||||
}
|
||||
else
|
||||
{
|
||||
dataCollector.AddToInput( UniqueId, SurfaceInputs.COLOR );
|
||||
string result = Constants.InputVarStr + "." + Constants.ColorVariable;
|
||||
switch( outputId )
|
||||
{
|
||||
case 1: result += ".r"; break;
|
||||
case 2: result += ".g"; break;
|
||||
case 3: result += ".b"; break;
|
||||
case 4: result += ".a"; break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6271f602b9ab61e4c9a96a91e473c1e0
|
||||
timeCreated: 1481126956
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,50 @@
|
||||
// Amplify Shader Editor - Visual Shader Editing Tool
|
||||
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
|
||||
|
||||
using UnityEngine;
|
||||
using System;
|
||||
|
||||
namespace AmplifyShaderEditor
|
||||
{
|
||||
//public enum VertexData
|
||||
//{
|
||||
// vertex = 0,
|
||||
// tangent,
|
||||
// normal,
|
||||
// texcoord,
|
||||
// texcoord1,
|
||||
// color
|
||||
//}
|
||||
|
||||
[Serializable]
|
||||
public class VertexDataNode : ParentNode
|
||||
{
|
||||
[SerializeField]
|
||||
protected string m_currentVertexData;
|
||||
|
||||
protected override void CommonInit( int uniqueId )
|
||||
{
|
||||
base.CommonInit( uniqueId );
|
||||
m_currentVertexData = "vertex";
|
||||
|
||||
// Type type = typeof( StandardSurfaceOutputNode );
|
||||
//m_restictions.AddPortRestriction( type, 0 );
|
||||
//m_restictions.AddPortRestriction( type, 2 );
|
||||
//m_restictions.AddPortRestriction( type, 3 );
|
||||
//m_restictions.AddPortRestriction( type, 4 );
|
||||
//m_restictions.AddPortRestriction( type, 5 );
|
||||
//m_restictions.AddPortRestriction( type, 6 );
|
||||
//m_restictions.AddPortRestriction( type, 7 );
|
||||
//m_restictions.AddPortRestriction( type, 8 );
|
||||
//m_restictions.AddPortRestriction( type, 9 );
|
||||
//m_restictions.AddPortRestriction( type, 10 );
|
||||
AddOutputVectorPorts( WirePortDataType.FLOAT4, "Out" );
|
||||
}
|
||||
|
||||
public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar )
|
||||
{
|
||||
base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalVar );
|
||||
return GetOutputVectorItem( 0, outputId, Constants.VertexShaderInputStr + "." + m_currentVertexData );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e5f8fa23e49e4be478b283a704459767
|
||||
timeCreated: 1481126960
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,50 @@
|
||||
// Amplify Shader Editor - Visual Shader Editing Tool
|
||||
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
|
||||
//
|
||||
// Custom Node Vertex Tangent World
|
||||
// Donated by Community Member Kebrus
|
||||
|
||||
using UnityEngine;
|
||||
using System;
|
||||
|
||||
namespace AmplifyShaderEditor
|
||||
{
|
||||
[Serializable]
|
||||
[NodeAttributes( "World Tangent", "Surface Data", "Per pixel world tangent vector", null, KeyCode.None, true, false, null, null, "kebrus" )]
|
||||
public sealed class VertexTangentNode : ParentNode
|
||||
{
|
||||
protected override void CommonInit( int uniqueId )
|
||||
{
|
||||
base.CommonInit( uniqueId );
|
||||
AddOutputVectorPorts( WirePortDataType.FLOAT3, "XYZ" );
|
||||
m_drawPreviewAsSphere = true;
|
||||
m_previewShaderGUID = "61f0b80493c9b404d8c7bf56d59c3f81";
|
||||
}
|
||||
|
||||
public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector )
|
||||
{
|
||||
base.PropagateNodeData( nodeData , ref dataCollector );
|
||||
dataCollector.DirtyNormal = true;
|
||||
}
|
||||
|
||||
public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar )
|
||||
{
|
||||
if ( dataCollector.IsTemplate )
|
||||
{
|
||||
return GetOutputVectorItem( 0, outputId, dataCollector.TemplateDataCollectorInstance.GetWorldTangent( CurrentPrecisionType ) );
|
||||
}
|
||||
|
||||
if( dataCollector.PortCategory == MasterNodePortCategory.Fragment || dataCollector.PortCategory == MasterNodePortCategory.Debug )
|
||||
{
|
||||
dataCollector.ForceNormal = true;
|
||||
|
||||
dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_NORMAL, CurrentPrecisionType );
|
||||
dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false );
|
||||
}
|
||||
|
||||
string worldTangent = GeneratorUtils.GenerateWorldTangent( ref dataCollector, UniqueId );
|
||||
|
||||
return GetOutputVectorItem( 0, outputId, worldTangent );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3aca1dfe55df44d4cbaf99d5a40f7470
|
||||
timeCreated: 1481126955
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,187 @@
|
||||
// Amplify Shader Editor - Visual Shader Editing Tool
|
||||
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
|
||||
//
|
||||
// Custom Node Vertex To Fragment
|
||||
// Donated by Jason Booth - http://u3d.as/DND
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System;
|
||||
|
||||
namespace AmplifyShaderEditor
|
||||
{
|
||||
[System.Serializable]
|
||||
[NodeAttributes( "Vertex To Fragment", "Miscellaneous", "Pass vertex data to the pixel shader", null, KeyCode.None, true, false, null, null, "Jason Booth - http://u3d.as/DND" )]
|
||||
public sealed class VertexToFragmentNode : SingleInputOp
|
||||
{
|
||||
private const string DisabledInterpolatorMsg = "No Interpolation option cannot be used over Standard Surface type as we must be able to directly control interpolators registry, which does't happen over this shader type. Please disable it.";
|
||||
private const string NoInterpolationUsageMsg = "No interpolation is performed when passing value from vertex to fragment during rasterization. Please note this option will not work across all API's and can even throw compilation errors on some of them ( p.e. Metal and GLES 2.0 )";
|
||||
|
||||
private const string SampleInfoMessage = "Interpolate at sample location rather than at the pixel center. This causes the pixel shader to execute per-sample rather than per-pixel. Only available in shader model 4.1 or higher";
|
||||
|
||||
[SerializeField]
|
||||
private bool m_noInterpolation;
|
||||
|
||||
[SerializeField]
|
||||
private bool m_sample;
|
||||
|
||||
protected override void CommonInit( int uniqueId )
|
||||
{
|
||||
base.CommonInit( uniqueId );
|
||||
m_inputPorts[ 0 ].AddPortForbiddenTypes( WirePortDataType.FLOAT3x3,
|
||||
WirePortDataType.FLOAT4x4,
|
||||
WirePortDataType.SAMPLER1D,
|
||||
WirePortDataType.SAMPLER2D,
|
||||
WirePortDataType.SAMPLER3D,
|
||||
WirePortDataType.SAMPLERCUBE,
|
||||
WirePortDataType.SAMPLER2DARRAY,
|
||||
WirePortDataType.SAMPLERSTATE );
|
||||
m_inputPorts[ 0 ].Name = "(VS) In";
|
||||
m_outputPorts[ 0 ].Name = "Out";
|
||||
m_useInternalPortData = false;
|
||||
m_autoWrapProperties = true;
|
||||
m_errorMessageTypeIsError = NodeMessageType.Warning;
|
||||
m_previewShaderGUID = "74e4d859fbdb2c0468de3612145f4929";
|
||||
}
|
||||
|
||||
public override void DrawProperties()
|
||||
{
|
||||
base.DrawProperties();
|
||||
bool isSurface = ContainerGraph.IsStandardSurface;
|
||||
EditorGUI.BeginDisabledGroup( isSurface && !m_noInterpolation );
|
||||
m_noInterpolation = EditorGUILayoutToggle( "No Interpolation" , m_noInterpolation );
|
||||
EditorGUI.EndDisabledGroup();
|
||||
if( m_noInterpolation )
|
||||
{
|
||||
if( isSurface )
|
||||
{
|
||||
EditorGUILayout.HelpBox( DisabledInterpolatorMsg, MessageType.Warning );
|
||||
} else
|
||||
{
|
||||
EditorGUILayout.HelpBox( NoInterpolationUsageMsg, MessageType.Info );
|
||||
}
|
||||
}
|
||||
|
||||
EditorGUI.BeginDisabledGroup( isSurface && !m_sample );
|
||||
m_sample = EditorGUILayoutToggle( "Sample" , m_sample );
|
||||
EditorGUI.EndDisabledGroup();
|
||||
if( m_sample )
|
||||
EditorGUILayout.HelpBox( SampleInfoMessage , MessageType.Info );
|
||||
}
|
||||
|
||||
public override void Draw( DrawInfo drawInfo )
|
||||
{
|
||||
base.Draw( drawInfo );
|
||||
m_showErrorMessage = ContainerGraph.IsStandardSurface && m_noInterpolation ||
|
||||
ContainerGraph.IsStandardSurface && m_sample;
|
||||
}
|
||||
|
||||
|
||||
public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar )
|
||||
{
|
||||
if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) )
|
||||
return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory );
|
||||
|
||||
bool noInterpolationFlag = dataCollector.IsTemplate ? m_noInterpolation : false;
|
||||
bool sampleFlag = dataCollector.IsTemplate ? m_sample : false;
|
||||
string varName = GenerateInputInVertex( ref dataCollector, 0, "vertexToFrag" + OutputId,true, noInterpolationFlag, sampleFlag );
|
||||
m_outputPorts[ 0 ].SetLocalValue( varName, dataCollector.PortCategory );
|
||||
|
||||
return varName;
|
||||
|
||||
////TEMPLATES
|
||||
//if( dataCollector.IsTemplate )
|
||||
//{
|
||||
// if( !dataCollector.IsFragmentCategory )
|
||||
// return m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector );
|
||||
|
||||
// string varName = "vertexToFrag" + OutputId;
|
||||
// if( dataCollector.TemplateDataCollectorInstance.HasCustomInterpolatedData( varName ) )
|
||||
// return varName;
|
||||
|
||||
// MasterNodePortCategory category = dataCollector.PortCategory;
|
||||
// dataCollector.PortCategory = MasterNodePortCategory.Vertex;
|
||||
// bool dirtyVertexVarsBefore = dataCollector.DirtyVertexVariables;
|
||||
// ContainerGraph.ResetNodesLocalVariablesIfNot( this, MasterNodePortCategory.Vertex );
|
||||
|
||||
// string data = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector );
|
||||
|
||||
// dataCollector.PortCategory = category;
|
||||
// if( !dirtyVertexVarsBefore && dataCollector.DirtyVertexVariables )
|
||||
// {
|
||||
// dataCollector.AddVertexInstruction( dataCollector.VertexLocalVariables, UniqueId, false );
|
||||
// dataCollector.ClearVertexLocalVariables();
|
||||
// ContainerGraph.ResetNodesLocalVariablesIfNot( this, MasterNodePortCategory.Vertex );
|
||||
// }
|
||||
|
||||
// ContainerGraph.ResetNodesLocalVariablesIfNot( this, MasterNodePortCategory.Fragment );
|
||||
|
||||
// dataCollector.TemplateDataCollectorInstance.RegisterCustomInterpolatedData( varName, m_inputPorts[ 0 ].DataType, m_currentPrecisionType, data );
|
||||
// //return varName;
|
||||
|
||||
// m_outputPorts[ 0 ].SetLocalValue( varName );
|
||||
// return m_outputPorts[ 0 ].LocalValue;
|
||||
//}
|
||||
|
||||
////SURFACE
|
||||
//{
|
||||
// if( !dataCollector.IsFragmentCategory )
|
||||
// {
|
||||
// return m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector );
|
||||
// }
|
||||
|
||||
// if( dataCollector.TesselationActive )
|
||||
// {
|
||||
// UIUtils.ShowMessage( "Unable to use Vertex to Frag when Tessellation is active" );
|
||||
// return m_outputPorts[ 0 ].ErrorValue;
|
||||
// }
|
||||
|
||||
|
||||
// string interpName = "data" + OutputId;
|
||||
// dataCollector.AddToInput( UniqueId, interpName, m_inputPorts[ 0 ].DataType, m_currentPrecisionType );
|
||||
|
||||
// MasterNodePortCategory portCategory = dataCollector.PortCategory;
|
||||
// dataCollector.PortCategory = MasterNodePortCategory.Vertex;
|
||||
|
||||
// bool dirtyVertexVarsBefore = dataCollector.DirtyVertexVariables;
|
||||
|
||||
// ContainerGraph.ResetNodesLocalVariablesIfNot( this, MasterNodePortCategory.Vertex );
|
||||
|
||||
// string vertexVarValue = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector );
|
||||
// dataCollector.AddLocalVariable( UniqueId, Constants.VertexShaderOutputStr + "." + interpName, vertexVarValue + ";" );
|
||||
|
||||
// dataCollector.PortCategory = portCategory;
|
||||
|
||||
// if( !dirtyVertexVarsBefore && dataCollector.DirtyVertexVariables )
|
||||
// {
|
||||
// dataCollector.AddVertexInstruction( dataCollector.VertexLocalVariables, UniqueId, false );
|
||||
// dataCollector.ClearVertexLocalVariables();
|
||||
// ContainerGraph.ResetNodesLocalVariablesIfNot( this, MasterNodePortCategory.Vertex );
|
||||
// }
|
||||
|
||||
// ContainerGraph.ResetNodesLocalVariablesIfNot( this, MasterNodePortCategory.Fragment );
|
||||
|
||||
// //return Constants.InputVarStr + "." + interpName;
|
||||
|
||||
// m_outputPorts[ 0 ].SetLocalValue( Constants.InputVarStr + "." + interpName );
|
||||
// return m_outputPorts[ 0 ].LocalValue;
|
||||
//}
|
||||
}
|
||||
public override void ReadFromString( ref string[] nodeParams )
|
||||
{
|
||||
base.ReadFromString( ref nodeParams );
|
||||
if( UIUtils.CurrentShaderVersion() > 18707 )
|
||||
m_noInterpolation = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) );
|
||||
|
||||
if( UIUtils.CurrentShaderVersion() > 18808 )
|
||||
m_sample = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) );
|
||||
}
|
||||
|
||||
public override void WriteToString( ref string nodeInfo, ref string connectionsInfo )
|
||||
{
|
||||
base.WriteToString( ref nodeInfo, ref connectionsInfo );
|
||||
IOUtils.AddFieldValueToString( ref nodeInfo, m_noInterpolation );
|
||||
IOUtils.AddFieldValueToString( ref nodeInfo , m_sample );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9ecea5c13558ad4499dd4bc558670b8e
|
||||
timeCreated: 1481126958
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user