Init
This commit is contained in:
@ -0,0 +1,17 @@
|
||||
// Amplify Shader Editor - Visual Shader Editing Tool
|
||||
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
|
||||
|
||||
namespace AmplifyShaderEditor
|
||||
{
|
||||
[System.Serializable]
|
||||
[NodeAttributes( "Color", "Surface Data", "Interpolated per-vertex color", null, UnityEngine.KeyCode.None, true, true, "Vertex Color", typeof( VertexColorNode ) )]
|
||||
public sealed class ColorInputsNode : SurfaceShaderINParentNode
|
||||
{
|
||||
protected override void CommonInit( int uniqueId )
|
||||
{
|
||||
base.CommonInit( uniqueId );
|
||||
m_currentInput = SurfaceInputs.COLOR;
|
||||
InitialSetup();
|
||||
}
|
||||
}
|
||||
}
|
12
Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ColorInputsNode.cs.meta
generated
Normal file
12
Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ColorInputsNode.cs.meta
generated
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ee44f086d7aa7804ea035860c5735cfb
|
||||
timeCreated: 1481126960
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,118 @@
|
||||
// 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( "Grab Screen Position", "Camera And Screen", "Screen position correctly transformed to be used with Grab Screen Color" )]
|
||||
public sealed class GrabScreenPosition : ParentNode
|
||||
{
|
||||
private readonly string[] m_outputTypeStr = { "Normalized", "Screen" };
|
||||
|
||||
[SerializeField]
|
||||
private int m_outputTypeInt = 0;
|
||||
|
||||
private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper();
|
||||
|
||||
protected override void CommonInit( int uniqueId )
|
||||
{
|
||||
base.CommonInit( uniqueId );
|
||||
AddOutputVectorPorts( WirePortDataType.FLOAT4, "XYZW" );
|
||||
m_autoWrapProperties = true;
|
||||
m_hasLeftDropdown = true;
|
||||
m_textLabelWidth = 65;
|
||||
ConfigureHeader();
|
||||
}
|
||||
|
||||
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_outputTypeInt = m_upperLeftWidget.DrawWidget( this, m_outputTypeInt, m_outputTypeStr );
|
||||
if( EditorGUI.EndChangeCheck() )
|
||||
{
|
||||
ConfigureHeader();
|
||||
}
|
||||
}
|
||||
|
||||
public override void DrawProperties()
|
||||
{
|
||||
base.DrawProperties();
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
m_outputTypeInt = EditorGUILayoutPopup( "Type", m_outputTypeInt, m_outputTypeStr );
|
||||
if( EditorGUI.EndChangeCheck() )
|
||||
{
|
||||
ConfigureHeader();
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigureHeader()
|
||||
{
|
||||
SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, m_outputTypeStr[ m_outputTypeInt ] ) );
|
||||
}
|
||||
|
||||
public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar )
|
||||
{
|
||||
if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) )
|
||||
return GetOutputColorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) );
|
||||
|
||||
string localVarName = string.Empty;
|
||||
|
||||
if( m_outputTypeInt == 0 )
|
||||
localVarName = GeneratorUtils.GenerateGrabScreenPositionNormalized( ref dataCollector, UniqueId, CurrentPrecisionType, !dataCollector.UsingCustomScreenPos );
|
||||
else
|
||||
localVarName = GeneratorUtils.GenerateGrabScreenPosition( ref dataCollector, UniqueId, CurrentPrecisionType, !dataCollector.UsingCustomScreenPos );
|
||||
|
||||
m_outputPorts[ 0 ].SetLocalValue( localVarName, dataCollector.PortCategory );
|
||||
return GetOutputColorItem( 0, outputId, localVarName );
|
||||
}
|
||||
|
||||
public override void ReadFromString( ref string[] nodeParams )
|
||||
{
|
||||
base.ReadFromString( ref nodeParams );
|
||||
if( UIUtils.CurrentShaderVersion() > 3108 )
|
||||
{
|
||||
if( UIUtils.CurrentShaderVersion() < 6102 )
|
||||
{
|
||||
bool project = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) );
|
||||
m_outputTypeInt = project ? 0 : 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_outputTypeInt = Convert.ToInt32( GetCurrentParam( ref nodeParams ) );
|
||||
}
|
||||
}
|
||||
|
||||
ConfigureHeader();
|
||||
}
|
||||
|
||||
public override void WriteToString( ref string nodeInfo, ref string connectionsInfo )
|
||||
{
|
||||
base.WriteToString( ref nodeInfo, ref connectionsInfo );
|
||||
IOUtils.AddFieldValueToString( ref nodeInfo, m_outputTypeInt );
|
||||
}
|
||||
}
|
||||
}
|
12
Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/GrabScreenPosition.cs.meta
generated
Normal file
12
Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/GrabScreenPosition.cs.meta
generated
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 47af62ad6a29d1b409d526d352b5e677
|
||||
timeCreated: 1485198163
|
||||
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 System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AmplifyShaderEditor
|
||||
{
|
||||
[Serializable]
|
||||
[NodeAttributes( "[Deprecated] Local Position", "Surface Data", "Interpolated Vertex Position in Local Space", null, KeyCode.None, true, true, "Vertex Position", typeof( PosVertexDataNode ) )]
|
||||
public sealed class LocalVertexPosNode : ParentNode
|
||||
{
|
||||
private const string VertexVarName = "localVertexPos";
|
||||
private readonly string VertexOnFrag = Constants.InputVarStr + "." + VertexVarName;
|
||||
private readonly string VertexOnVert = Constants.VertexShaderInputStr + ".vertex";
|
||||
|
||||
|
||||
[SerializeField]
|
||||
private bool m_addInstruction = false;
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
base.Reset();
|
||||
m_addInstruction = true;
|
||||
}
|
||||
protected override void CommonInit( int uniqueId )
|
||||
{
|
||||
base.CommonInit( uniqueId );
|
||||
AddOutputVectorPorts( WirePortDataType.FLOAT3, "XYZ" );
|
||||
}
|
||||
public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar )
|
||||
{
|
||||
if ( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation )
|
||||
{
|
||||
return GetOutputVectorItem( 0, outputId, VertexOnVert );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( m_addInstruction )
|
||||
{
|
||||
dataCollector.AddToInput( UniqueId, VertexVarName, WirePortDataType.FLOAT3 );
|
||||
dataCollector.AddVertexInstruction( Constants.VertexShaderOutputStr + "." + VertexVarName + " = " + Constants.VertexShaderInputStr + ".vertex.xyz ", UniqueId );
|
||||
m_addInstruction = false;
|
||||
}
|
||||
|
||||
return GetOutputVectorItem( 0, outputId, VertexOnFrag );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
12
Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/LocalVertexPosNode.cs.meta
generated
Normal file
12
Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/LocalVertexPosNode.cs.meta
generated
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2528fbf85b5823a4499871c2a6eecc0a
|
||||
timeCreated: 1481126954
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,117 @@
|
||||
// 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( "Position", "Surface Data", "Surface position. Absolute World-space, by default.\n\n" +
|
||||
"Object: Object-space position, local to object.\n\n" +
|
||||
"World: Absolute world position, global to scene origin.\n\n" +
|
||||
"Relative World: Camera-relative world position.\n\n" +
|
||||
"View: View-space position.\n\n" )]
|
||||
public sealed class PositionNode : SurfaceShaderINParentNode
|
||||
{
|
||||
public enum Space
|
||||
{
|
||||
Object,
|
||||
World,
|
||||
RelativeWorld,
|
||||
View
|
||||
}
|
||||
|
||||
private readonly string[] m_outputSpaceStr = { "Object", "World", "Relative World", "View" };
|
||||
|
||||
[SerializeField]
|
||||
private int m_outputSpaceIndex = ( int )Space.World;
|
||||
|
||||
private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper();
|
||||
|
||||
protected override void CommonInit( int uniqueId )
|
||||
{
|
||||
base.CommonInit( uniqueId );
|
||||
m_currentInput = SurfaceInputs.WORLD_POS;
|
||||
m_drawPreviewAsSphere = true;
|
||||
m_previewShaderGUID = "62a28fcb1f1dd5640a572771eb121a3b";
|
||||
m_hasLeftDropdown = true;
|
||||
m_textLabelWidth = 65;
|
||||
m_autoWrapProperties = true;
|
||||
InitialSetup();
|
||||
|
||||
m_previewMaterialPassId = ( int )m_outputSpaceIndex;
|
||||
ConfigureHeader();
|
||||
}
|
||||
|
||||
public override void Draw( DrawInfo drawInfo )
|
||||
{
|
||||
base.Draw( drawInfo );
|
||||
EditorGUI.BeginChangeCheck();
|
||||
m_outputSpaceIndex = m_upperLeftWidget.DrawWidget( this, m_outputSpaceIndex, m_outputSpaceStr );
|
||||
if ( EditorGUI.EndChangeCheck() )
|
||||
{
|
||||
ConfigureHeader();
|
||||
}
|
||||
}
|
||||
|
||||
public override void DrawProperties()
|
||||
{
|
||||
EditorGUI.BeginChangeCheck();
|
||||
m_outputSpaceIndex = EditorGUILayoutPopup( "Mode", m_outputSpaceIndex, m_outputSpaceStr );
|
||||
if ( EditorGUI.EndChangeCheck() )
|
||||
{
|
||||
ConfigureHeader();
|
||||
}
|
||||
|
||||
if ( m_outputSpaceIndex == ( int )Space.World )
|
||||
{
|
||||
EditorGUILayout.HelpBox( "World refers to absolute World-Space coordinates, in full coordinates around the origin.", MessageType.Info );
|
||||
}
|
||||
else if ( m_outputSpaceIndex == ( int )Space.RelativeWorld )
|
||||
{
|
||||
EditorGUILayout.HelpBox( "Relative World refers to Camera-relative World-space, where values are kept relative to the Camera position, making them less prone to the numerical precision degradation of large floating point values.", MessageType.Info );
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigureHeader()
|
||||
{
|
||||
SetAdditonalTitleText( string.Format( Constants.SubTitleModeFormatStr, m_outputSpaceStr[ m_outputSpaceIndex ] ) );
|
||||
m_previewMaterialPassId = m_outputSpaceIndex;
|
||||
}
|
||||
|
||||
public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar )
|
||||
{
|
||||
if ( dataCollector.PortCategory == MasterNodePortCategory.Tessellation )
|
||||
{
|
||||
UIUtils.ShowNoVertexModeNodeMessage( this );
|
||||
return string.Format( "{0}( 0, 0, 0 )", UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, WirePortDataType.FLOAT3 ) );
|
||||
}
|
||||
|
||||
if ( dataCollector.IsTemplate )
|
||||
{
|
||||
string varName = dataCollector.TemplateDataCollectorInstance.GetPosition( ( Space )m_outputSpaceIndex );
|
||||
return GetOutputVectorItem( 0, outputId, varName );
|
||||
}
|
||||
else
|
||||
{
|
||||
string worldPosition = GeneratorUtils.GeneratePosition( ref dataCollector, UniqueId, ( Space )m_outputSpaceIndex );
|
||||
return GetOutputVectorItem( 0, outputId, worldPosition );
|
||||
}
|
||||
}
|
||||
|
||||
public override void ReadFromString( ref string[] nodeParams )
|
||||
{
|
||||
base.ReadFromString( ref nodeParams );
|
||||
m_outputSpaceIndex = Convert.ToInt32( GetCurrentParam( ref nodeParams ) );
|
||||
ConfigureHeader();
|
||||
}
|
||||
|
||||
public override void WriteToString( ref string nodeInfo, ref string connectionsInfo )
|
||||
{
|
||||
base.WriteToString( ref nodeInfo, ref connectionsInfo );
|
||||
IOUtils.AddFieldValueToString( ref nodeInfo, m_outputSpaceIndex );
|
||||
}
|
||||
}
|
||||
}
|
12
Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/PositionNode.cs.meta
generated
Normal file
12
Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/PositionNode.cs.meta
generated
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 283369e6e1d68954190b3e4b02a644c3
|
||||
timeCreated: 1481126957
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,714 @@
|
||||
// Amplify Shader Editor - Visual Shader Editing Tool
|
||||
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System;
|
||||
|
||||
namespace AmplifyShaderEditor
|
||||
{
|
||||
|
||||
[Serializable]
|
||||
[NodeAttributes( "Grab Screen Color" , "Camera And Screen" , "Grabed pixel color value from screen" )]
|
||||
public sealed class ScreenColorNode : PropertyNode
|
||||
{
|
||||
private readonly string[] ASEDeclareMacro =
|
||||
{
|
||||
"#if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED)",
|
||||
"#define ASE_DECLARE_SCREENSPACE_TEXTURE(tex) UNITY_DECLARE_SCREENSPACE_TEXTURE(tex);",
|
||||
"#else",
|
||||
"#define ASE_DECLARE_SCREENSPACE_TEXTURE(tex) UNITY_DECLARE_SCREENSPACE_TEXTURE(tex)",
|
||||
"#endif"
|
||||
};
|
||||
|
||||
private readonly Color ReferenceHeaderColor = new Color( 0.6f , 3.0f , 1.25f , 1.0f );
|
||||
|
||||
private const string SamplerType = "tex2D";
|
||||
private const string GrabTextureDefault = "_GrabTexture";
|
||||
private const string ScreenColorStr = "screenColor";
|
||||
|
||||
[SerializeField]
|
||||
private TexReferenceType m_referenceType = TexReferenceType.Object;
|
||||
|
||||
[SerializeField]
|
||||
private int m_referenceArrayId = -1;
|
||||
|
||||
[SerializeField]
|
||||
private int m_referenceNodeId = -1;
|
||||
|
||||
[SerializeField]
|
||||
private GUIStyle m_referenceIconStyle = null;
|
||||
|
||||
private ScreenColorNode m_referenceNode = null;
|
||||
|
||||
[SerializeField]
|
||||
private bool m_normalize = false;
|
||||
|
||||
[SerializeField]
|
||||
private bool m_useCustomGrab = false;
|
||||
|
||||
[SerializeField]
|
||||
private float m_referenceWidth = -1;
|
||||
|
||||
[SerializeField]
|
||||
private bool m_exposure = false;
|
||||
|
||||
[SerializeField]
|
||||
private bool m_isURP2D = false;
|
||||
|
||||
//SRP specific code
|
||||
private const string OpaqueTextureDefine = "REQUIRE_OPAQUE_TEXTURE 1";
|
||||
private const string FetchVarName = "fetchOpaqueVal";
|
||||
|
||||
//private string LWFetchOpaqueTexture = "SAMPLE_TEXTURE2D( _CameraOpaqueTexture, sampler_CameraOpaqueTexture, {0})";
|
||||
|
||||
private string LWFetchOpaqueTexture = "float4( SHADERGRAPH_SAMPLE_SCENE_COLOR( {0}.xy ), 1.0 )";
|
||||
|
||||
#if UNITY_2021_1_OR_NEWER
|
||||
private const string URP2DHelpBox = "For the Grab Screen Color to properly work a proper setup is required:" +
|
||||
"\n- On the 2D Asset Renderer the \"Foremost Sorting Layer\" must be set to the last layer which is going to be caught by the Grab Screen Color" +
|
||||
"\n- The \"Sorting Layer\" of the sprite itself which will be using the shader with the Grab Screen Color must be set to one which is above the one specified on the previous step";
|
||||
|
||||
private readonly string[] URP2DDeclaration = { "TEXTURE2D_X( _CameraSortingLayerTexture );",
|
||||
"SAMPLER( sampler_CameraSortingLayerTexture );" };
|
||||
private readonly string URP2DFunctionHeader = "float4( ASESample2DSortingLayer({0}.xy), 1.0 )";
|
||||
private readonly string[] URP2DFunctionBody =
|
||||
{
|
||||
"float3 ASESample2DSortingLayer( float2 uv )\n" +
|
||||
"{\n"+
|
||||
"\treturn SAMPLE_TEXTURE2D_X(_CameraSortingLayerTexture, sampler_CameraSortingLayerTexture, UnityStereoTransformScreenSpaceTex(uv)).rgb;\n"+
|
||||
"}\n"
|
||||
};
|
||||
#endif
|
||||
|
||||
private const string HDSampleSceneColorHeader5 = "ASEHDSampleSceneColor({0}.xy, {1}, {2})";
|
||||
private readonly string[] HDSampleSceneColorFunc5 =
|
||||
{
|
||||
"float4 ASEHDSampleSceneColor(float2 uv, float lod, float exposureMultiplier)\n",
|
||||
"{\n",
|
||||
"\t#if defined(REQUIRE_OPAQUE_TEXTURE) && defined(_SURFACE_TYPE_TRANSPARENT) && defined(SHADERPASS) && (SHADERPASS != SHADERPASS_LIGHT_TRANSPORT)\n",
|
||||
"\treturn float4( SampleCameraColor(uv, lod) * exposureMultiplier, 1.0 );\n",
|
||||
"\t#endif\n",
|
||||
"\treturn float4(0.0, 0.0, 0.0, 1.0);\n",
|
||||
"}\n",
|
||||
};
|
||||
|
||||
private const string HDSampleSceneColorHeader4 = "ASEHDSampleSceneColor({0}.xy)";
|
||||
private readonly string[] HDSampleSceneColorFunc4 =
|
||||
{
|
||||
"float4 ASEHDSampleSceneColor( float2 uv )\n",
|
||||
"{\n",
|
||||
"\t#if defined(REQUIRE_OPAQUE_TEXTURE) && defined(_SURFACE_TYPE_TRANSPARENT) && defined(SHADERPASS) && (SHADERPASS != SHADERPASS_LIGHT_TRANSPORT)\n",
|
||||
"\treturn float4( SampleCameraColor(uv), 1.0 );\n",
|
||||
"\t#endif\n",
|
||||
"\treturn float4(0.0, 0.0, 0.0, 1.0);\n",
|
||||
"}\n",
|
||||
};
|
||||
|
||||
public ScreenColorNode() : base() { }
|
||||
public ScreenColorNode( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { }
|
||||
|
||||
protected override void CommonInit( int uniqueId )
|
||||
{
|
||||
base.CommonInit( uniqueId );
|
||||
|
||||
AddInputPort( WirePortDataType.FLOAT2, false, "UV" );
|
||||
AddInputPort( WirePortDataType.FLOAT, false, "LOD" );
|
||||
m_inputPorts[ 1 ].FloatInternalData = 0;
|
||||
|
||||
AddOutputColorPorts( "RGBA" );
|
||||
|
||||
m_currentParameterType = PropertyType.Global;
|
||||
m_underscoredGlobal = true;
|
||||
m_useVarSubtitle = true;
|
||||
m_customPrefix = "Grab Screen ";
|
||||
m_freeType = false;
|
||||
m_drawAttributes = false;
|
||||
m_showTitleWhenNotEditing = false;
|
||||
m_textLabelWidth = 125;
|
||||
m_showAutoRegisterUI = true;
|
||||
m_globalDefaultBehavior = false;
|
||||
m_showVariableMode = true;
|
||||
}
|
||||
|
||||
protected override void OnUniqueIDAssigned()
|
||||
{
|
||||
base.OnUniqueIDAssigned();
|
||||
if( m_referenceType == TexReferenceType.Object )
|
||||
UIUtils.RegisterScreenColorNode( this );
|
||||
|
||||
if( UniqueId > -1 )
|
||||
ContainerGraph.ScreenColorNodes.OnReorderEventComplete += OnReorderEventComplete;
|
||||
|
||||
}
|
||||
|
||||
private void OnReorderEventComplete()
|
||||
{
|
||||
if( m_referenceType == TexReferenceType.Instance && m_referenceNode != null )
|
||||
{
|
||||
m_referenceArrayId = ContainerGraph.ScreenColorNodes.GetNodeRegisterIdx( m_referenceNode.UniqueId );
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateHeaderColor()
|
||||
{
|
||||
m_headerColorModifier = ( m_referenceType == TexReferenceType.Object ) ? Color.white : ReferenceHeaderColor;
|
||||
}
|
||||
|
||||
public override void OnNodeLogicUpdate( DrawInfo drawInfo )
|
||||
{
|
||||
base.OnNodeLogicUpdate( drawInfo );
|
||||
if( m_referenceNodeId > -1 && m_referenceNode == null )
|
||||
{
|
||||
m_referenceNode = UIUtils.GetScreenColorNode( m_referenceNodeId ) as ScreenColorNode;
|
||||
if( m_referenceNode == null )
|
||||
{
|
||||
m_referenceNodeId = -1;
|
||||
m_referenceArrayId = -1;
|
||||
m_sizeIsDirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
if( m_showSubtitle == m_containerGraph.IsSRP )
|
||||
{
|
||||
m_showSubtitle = !m_containerGraph.IsSRP;
|
||||
m_sizeIsDirty = true;
|
||||
}
|
||||
|
||||
if( ContainerGraph.IsHDRP || ContainerGraph.ParentWindow.IsShaderFunctionWindow )
|
||||
{
|
||||
m_inputPorts[ 1 ].Visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_inputPorts[ 1 ].Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void ChangeSizeFinished()
|
||||
{
|
||||
if( m_referenceType == TexReferenceType.Instance )
|
||||
{
|
||||
m_position.width += 20;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Draw( DrawInfo drawInfo )
|
||||
{
|
||||
base.Draw( drawInfo );
|
||||
|
||||
CheckReference();
|
||||
|
||||
if( SoftValidReference )
|
||||
{
|
||||
m_content.text = m_referenceNode.TitleContent.text + Constants.InstancePostfixStr;
|
||||
SetAdditonalTitleText( m_referenceNode.AdditonalTitleContent.text );
|
||||
|
||||
if( m_referenceIconStyle == null )
|
||||
{
|
||||
m_referenceIconStyle = UIUtils.GetCustomStyle( CustomStyle.SamplerTextureIcon );
|
||||
}
|
||||
|
||||
Rect iconPos = m_globalPosition;
|
||||
iconPos.width = 19 * drawInfo.InvertedZoom;
|
||||
iconPos.height = 19 * drawInfo.InvertedZoom;
|
||||
|
||||
iconPos.y += 6 * drawInfo.InvertedZoom;
|
||||
iconPos.x += m_globalPosition.width - iconPos.width - 7 * drawInfo.InvertedZoom;
|
||||
|
||||
if( GUI.Button( iconPos, string.Empty, m_referenceIconStyle ) )
|
||||
{
|
||||
UIUtils.FocusOnNode( m_referenceNode, 1, true );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CheckReference()
|
||||
{
|
||||
if( m_referenceType != TexReferenceType.Instance )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( m_referenceArrayId > -1 )
|
||||
{
|
||||
ParentNode newNode = UIUtils.GetScreenColorNode( m_referenceArrayId );
|
||||
if( newNode == null || newNode.UniqueId != m_referenceNodeId )
|
||||
{
|
||||
m_referenceNode = null;
|
||||
int count = UIUtils.GetScreenColorNodeAmount();
|
||||
for( int i = 0; i < count; i++ )
|
||||
{
|
||||
ParentNode node = UIUtils.GetScreenColorNode( i );
|
||||
if( node.UniqueId == m_referenceNodeId )
|
||||
{
|
||||
m_referenceNode = node as ScreenColorNode;
|
||||
m_referenceArrayId = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( m_referenceNode == null && m_referenceNodeId > -1 )
|
||||
{
|
||||
m_referenceNodeId = -1;
|
||||
m_referenceArrayId = -1;
|
||||
}
|
||||
}
|
||||
|
||||
public override void DrawMainPropertyBlock()
|
||||
{
|
||||
EditorGUI.BeginChangeCheck();
|
||||
m_referenceType = (TexReferenceType)EditorGUILayoutPopup( Constants.ReferenceTypeStr, (int)m_referenceType, Constants.ReferenceArrayLabels );
|
||||
if( EditorGUI.EndChangeCheck() )
|
||||
{
|
||||
m_sizeIsDirty = true;
|
||||
if( m_referenceType == TexReferenceType.Object )
|
||||
{
|
||||
UIUtils.RegisterScreenColorNode( this );
|
||||
m_content.text = m_propertyInspectorName;
|
||||
}
|
||||
else
|
||||
{
|
||||
UIUtils.UnregisterScreenColorNode( this );
|
||||
if( SoftValidReference )
|
||||
{
|
||||
m_content.text = m_referenceNode.TitleContent.text + Constants.InstancePostfixStr;
|
||||
}
|
||||
}
|
||||
UpdateHeaderColor();
|
||||
}
|
||||
|
||||
if( m_referenceType == TexReferenceType.Object )
|
||||
{
|
||||
EditorGUI.BeginDisabledGroup( m_containerGraph.IsSRP );
|
||||
{
|
||||
EditorGUI.BeginChangeCheck();
|
||||
m_useCustomGrab = EditorGUILayoutToggle( "Custom Grab Pass", m_useCustomGrab );
|
||||
EditorGUI.BeginDisabledGroup( !m_useCustomGrab );
|
||||
DrawMainPropertyBlockNoPrecision();
|
||||
EditorGUI.EndDisabledGroup();
|
||||
|
||||
m_normalize = EditorGUILayoutToggle( "Normalize", m_normalize );
|
||||
if( EditorGUI.EndChangeCheck() )
|
||||
{
|
||||
UpdatePort();
|
||||
if( m_useCustomGrab )
|
||||
{
|
||||
BeginPropertyFromInspectorCheck();
|
||||
}
|
||||
}
|
||||
}
|
||||
EditorGUI.EndDisabledGroup();
|
||||
}
|
||||
else
|
||||
{
|
||||
string[] arr = UIUtils.ScreenColorNodeArr();
|
||||
bool guiEnabledBuffer = GUI.enabled;
|
||||
if( arr != null && arr.Length > 0 )
|
||||
{
|
||||
GUI.enabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_referenceArrayId = -1;
|
||||
GUI.enabled = false;
|
||||
}
|
||||
|
||||
m_referenceArrayId = EditorGUILayoutPopup( Constants.AvailableReferenceStr, m_referenceArrayId, arr );
|
||||
GUI.enabled = guiEnabledBuffer;
|
||||
EditorGUI.BeginDisabledGroup( m_containerGraph.IsSRP );
|
||||
{
|
||||
EditorGUI.BeginChangeCheck();
|
||||
m_normalize = EditorGUILayoutToggle( "Normalize", m_normalize );
|
||||
if( EditorGUI.EndChangeCheck() )
|
||||
{
|
||||
UpdatePort();
|
||||
}
|
||||
}
|
||||
EditorGUI.EndDisabledGroup();
|
||||
}
|
||||
ShowVariableMode();
|
||||
ShowAutoRegister();
|
||||
if( ContainerGraph.IsHDRP || ContainerGraph.ParentWindow.IsShaderFunctionWindow )
|
||||
{
|
||||
m_exposure = EditorGUILayoutToggle( "Exposure", m_exposure );
|
||||
}
|
||||
|
||||
#if UNITY_2021_1_OR_NEWER
|
||||
if( ( ContainerGraph.IsLWRP || ContainerGraph.ParentWindow.IsShaderFunctionWindow ) && ASEPackageManagerHelper.CurrentHDRPBaseline >= ASESRPBaseline.ASE_SRP_11 )
|
||||
{
|
||||
m_isURP2D = EditorGUILayoutToggle( "2D Renderer" , m_isURP2D);
|
||||
if( m_isURP2D )
|
||||
{
|
||||
EditorGUILayout.HelpBox( URP2DHelpBox , MessageType.Info );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
private void UpdatePort()
|
||||
{
|
||||
if( m_normalize )
|
||||
m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false );
|
||||
else
|
||||
m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT2, false );
|
||||
}
|
||||
|
||||
public override void DrawTitle( Rect titlePos )
|
||||
{
|
||||
if( !m_isEditing && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD3 )
|
||||
{
|
||||
GUI.Label( titlePos, "Grab Screen Color", UIUtils.GetCustomStyle( CustomStyle.NodeTitle ) );
|
||||
}
|
||||
|
||||
if( m_useCustomGrab || SoftValidReference )
|
||||
{
|
||||
base.DrawTitle( titlePos );
|
||||
m_previousAdditonalTitle = m_additionalContent.text;
|
||||
}
|
||||
else
|
||||
if( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD3 )
|
||||
{
|
||||
SetAdditonalTitleTextOnCallback( GrabTextureDefault, ( instance, newSubTitle ) => instance.AdditonalTitleContent.text = string.Format( Constants.SubTitleVarNameFormatStr, newSubTitle ) );
|
||||
//GUI.Label( titlePos, PropertyInspectorName, UIUtils.GetCustomStyle( CustomStyle.NodeTitle ) );
|
||||
}
|
||||
}
|
||||
|
||||
public void SetMacros( ref MasterNodeDataCollector dataCollector )
|
||||
{
|
||||
if( !dataCollector.IsTemplate || dataCollector.CurrentSRPType == TemplateSRPType.BiRP )
|
||||
{
|
||||
for( int i = 0; i < ASEDeclareMacro.Length; i++ )
|
||||
{
|
||||
dataCollector.AddToDirectives( ASEDeclareMacro[ i ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar )
|
||||
{
|
||||
SetMacros( ref dataCollector );
|
||||
|
||||
if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) )
|
||||
return GetOutputColorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) );
|
||||
|
||||
string valueName = string.Empty;
|
||||
if( dataCollector.IsSRP )
|
||||
{
|
||||
valueName = FetchVarName + OutputId;
|
||||
dataCollector.AddToDirectives( OpaqueTextureDefine, -1 , AdditionalLineType.Define);
|
||||
string uvCoords = GetUVCoords( ref dataCollector, ignoreLocalVar, false );
|
||||
if( dataCollector.TemplateDataCollectorInstance.IsLWRP )
|
||||
{
|
||||
|
||||
#if UNITY_2021_1_OR_NEWER
|
||||
if( m_isURP2D )
|
||||
{
|
||||
dataCollector.AddToUniforms( UniqueId , URP2DDeclaration[ 0 ] );
|
||||
dataCollector.AddToUniforms( UniqueId , URP2DDeclaration[ 1 ] );
|
||||
dataCollector.AddFunction( URP2DFunctionBody[ 0 ] , URP2DFunctionBody , false );
|
||||
dataCollector.AddLocalVariable( UniqueId , CurrentPrecisionType , WirePortDataType.FLOAT4 , valueName , string.Format( URP2DFunctionHeader , uvCoords ) );
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
dataCollector.AddLocalVariable( UniqueId , CurrentPrecisionType , WirePortDataType.FLOAT4 , valueName , string.Format( LWFetchOpaqueTexture , uvCoords ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string lod = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector );
|
||||
dataCollector.AddFunction( HDSampleSceneColorFunc5[ 0 ], HDSampleSceneColorFunc5, false );
|
||||
string exposureValue = m_exposure ? "1.0" : "GetInverseCurrentExposureMultiplier()";
|
||||
dataCollector.AddLocalVariable( UniqueId, m_currentPrecisionType, WirePortDataType.FLOAT4, valueName, string.Format( HDSampleSceneColorHeader5, uvCoords, lod, exposureValue ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalVar );
|
||||
string propertyName = CurrentPropertyReference;
|
||||
OnPropertyNameChanged();
|
||||
//bool emptyName = string.IsNullOrEmpty( m_propertyInspectorName ) || propertyName == GrabTextureDefault;
|
||||
bool emptyName = string.IsNullOrEmpty( m_propertyInspectorName ) || !m_useCustomGrab;
|
||||
dataCollector.AddGrabPass( emptyName ? string.Empty : propertyName );
|
||||
valueName = SetFetchedData( ref dataCollector, ignoreLocalVar );
|
||||
}
|
||||
|
||||
m_outputPorts[ 0 ].SetLocalValue( valueName, dataCollector.PortCategory );
|
||||
return GetOutputColorItem( 0, outputId, valueName );
|
||||
}
|
||||
|
||||
|
||||
public override void OnPropertyNameChanged()
|
||||
{
|
||||
base.OnPropertyNameChanged();
|
||||
UIUtils.UpdateScreenColorDataNode( UniqueId, DataToArray );
|
||||
}
|
||||
|
||||
public string SetFetchedData( ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar )
|
||||
{
|
||||
string propertyName = CurrentPropertyReference;
|
||||
|
||||
bool isProjecting = m_normalize;
|
||||
|
||||
if( !m_inputPorts[ 0 ].IsConnected ) // to generate proper screen pos by itself
|
||||
isProjecting = true;
|
||||
|
||||
if( ignoreLocalVar )
|
||||
{
|
||||
string samplerValue = SamplerType + ( isProjecting ? "proj" : "" ) + "( " + propertyName + ", " + GetUVCoords( ref dataCollector, ignoreLocalVar, isProjecting ) + " )";
|
||||
return samplerValue;
|
||||
}
|
||||
|
||||
if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) )
|
||||
return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory );
|
||||
|
||||
string uvValue = GetUVCoords( ref dataCollector, ignoreLocalVar, isProjecting );
|
||||
if( isProjecting )
|
||||
{
|
||||
uvValue = string.Format( "{0}.xy/{0}.w", uvValue );
|
||||
}
|
||||
string samplerOp = string.Format( "UNITY_SAMPLE_SCREENSPACE_TEXTURE({0},{1})", propertyName, uvValue );
|
||||
dataCollector.AddLocalVariable( UniqueId, UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ) + " " + ScreenColorStr + OutputId + " = " + samplerOp + ";" );
|
||||
return ScreenColorStr + OutputId;
|
||||
}
|
||||
|
||||
private string GetUVCoords( ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar, bool isProjecting )
|
||||
{
|
||||
string result = string.Empty;
|
||||
|
||||
if( m_inputPorts[ 0 ].IsConnected )
|
||||
{
|
||||
result = m_inputPorts[ 0 ].GenerateShaderForOutput( ref dataCollector, ( isProjecting ? WirePortDataType.FLOAT4 : WirePortDataType.FLOAT2 ), ignoreLocalVar, true );
|
||||
}
|
||||
else
|
||||
{
|
||||
string customScreenPos = null;
|
||||
|
||||
if( dataCollector.IsTemplate )
|
||||
customScreenPos = dataCollector.TemplateDataCollectorInstance.GetScreenPosRaw( CurrentPrecisionType );
|
||||
|
||||
if( isProjecting )
|
||||
result = GeneratorUtils.GenerateGrabScreenPosition( ref dataCollector, UniqueId, CurrentPrecisionType, !dataCollector.UsingCustomScreenPos, customScreenPos );
|
||||
else
|
||||
result = GeneratorUtils.GenerateGrabScreenPositionNormalized( ref dataCollector, UniqueId, CurrentPrecisionType, !dataCollector.UsingCustomScreenPos, customScreenPos );
|
||||
}
|
||||
|
||||
if( isProjecting && !dataCollector.IsSRP )
|
||||
return result;
|
||||
else
|
||||
return result;
|
||||
}
|
||||
|
||||
public override void Destroy()
|
||||
{
|
||||
base.Destroy();
|
||||
if( m_referenceType == TexReferenceType.Object )
|
||||
{
|
||||
UIUtils.UnregisterScreenColorNode( this );
|
||||
}
|
||||
if( UniqueId > -1 )
|
||||
ContainerGraph.ScreenColorNodes.OnReorderEventComplete -= OnReorderEventComplete;
|
||||
}
|
||||
|
||||
public bool SoftValidReference
|
||||
{
|
||||
get
|
||||
{
|
||||
if( m_referenceType == TexReferenceType.Instance && m_referenceArrayId > -1 )
|
||||
{
|
||||
m_referenceNode = UIUtils.GetScreenColorNode( m_referenceArrayId );
|
||||
if( m_referenceNode == null )
|
||||
{
|
||||
m_referenceArrayId = -1;
|
||||
m_referenceWidth = -1;
|
||||
}
|
||||
else if( m_referenceWidth != m_referenceNode.Position.width )
|
||||
{
|
||||
m_referenceWidth = m_referenceNode.Position.width;
|
||||
m_sizeIsDirty = true;
|
||||
}
|
||||
return m_referenceNode != null;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public string CurrentPropertyReference
|
||||
{
|
||||
get
|
||||
{
|
||||
string propertyName = string.Empty;
|
||||
if( m_referenceType == TexReferenceType.Instance && m_referenceArrayId > -1 )
|
||||
{
|
||||
ScreenColorNode node = UIUtils.GetScreenColorNode( m_referenceArrayId );
|
||||
propertyName = ( node != null ) ? node.PropertyName : m_propertyName;
|
||||
}
|
||||
else if( !m_useCustomGrab )
|
||||
{
|
||||
propertyName = GrabTextureDefault;
|
||||
}
|
||||
else
|
||||
{
|
||||
propertyName = m_propertyName;
|
||||
}
|
||||
return propertyName;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override void ReadFromString( ref string[] nodeParams )
|
||||
{
|
||||
base.ReadFromString( ref nodeParams );
|
||||
if( UIUtils.CurrentShaderVersion() > 12 )
|
||||
{
|
||||
m_referenceType = (TexReferenceType)Enum.Parse( typeof( TexReferenceType ), GetCurrentParam( ref nodeParams ) );
|
||||
if( UIUtils.CurrentShaderVersion() > 22 )
|
||||
{
|
||||
m_referenceNodeId = Convert.ToInt32( GetCurrentParam( ref nodeParams ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_referenceArrayId = Convert.ToInt32( GetCurrentParam( ref nodeParams ) );
|
||||
}
|
||||
|
||||
if( m_referenceType == TexReferenceType.Instance )
|
||||
{
|
||||
UIUtils.UnregisterScreenColorNode( this );
|
||||
}
|
||||
|
||||
UpdateHeaderColor();
|
||||
}
|
||||
|
||||
if( UIUtils.CurrentShaderVersion() > 12101 )
|
||||
{
|
||||
m_useCustomGrab = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_useCustomGrab = true;
|
||||
}
|
||||
|
||||
if( UIUtils.CurrentShaderVersion() > 14102 )
|
||||
{
|
||||
m_normalize = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) );
|
||||
}
|
||||
|
||||
if( UIUtils.CurrentShaderVersion() > 18801 )
|
||||
{
|
||||
m_exposure = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) );
|
||||
}
|
||||
|
||||
if( UIUtils.CurrentShaderVersion() > 18923 )
|
||||
{
|
||||
m_isURP2D = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) );
|
||||
}
|
||||
|
||||
if( !m_isNodeBeingCopied && m_referenceType == TexReferenceType.Object )
|
||||
{
|
||||
ContainerGraph.ScreenColorNodes.UpdateDataOnNode( UniqueId, DataToArray );
|
||||
}
|
||||
}
|
||||
|
||||
public override void WriteToString( ref string nodeInfo, ref string connectionsInfo )
|
||||
{
|
||||
base.WriteToString( ref nodeInfo, ref connectionsInfo );
|
||||
IOUtils.AddFieldValueToString( ref nodeInfo, m_referenceType );
|
||||
IOUtils.AddFieldValueToString( ref nodeInfo, ( ( m_referenceNode != null ) ? m_referenceNode.UniqueId : -1 ) );
|
||||
IOUtils.AddFieldValueToString( ref nodeInfo, m_useCustomGrab );
|
||||
IOUtils.AddFieldValueToString( ref nodeInfo, m_normalize );
|
||||
IOUtils.AddFieldValueToString( ref nodeInfo, m_exposure );
|
||||
IOUtils.AddFieldValueToString( ref nodeInfo , m_isURP2D );
|
||||
}
|
||||
|
||||
public override void RefreshExternalReferences()
|
||||
{
|
||||
base.RefreshExternalReferences();
|
||||
if( m_referenceType == TexReferenceType.Instance )
|
||||
{
|
||||
if( UIUtils.CurrentShaderVersion() > 22 )
|
||||
{
|
||||
m_referenceNode = UIUtils.GetNode( m_referenceNodeId ) as ScreenColorNode;
|
||||
m_referenceArrayId = UIUtils.GetScreenColorNodeRegisterId( m_referenceNodeId );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_referenceNode = UIUtils.GetScreenColorNode( m_referenceArrayId );
|
||||
if( m_referenceNode != null )
|
||||
{
|
||||
m_referenceNodeId = m_referenceNode.UniqueId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( UIUtils.CurrentShaderVersion() <= 14102 )
|
||||
{
|
||||
if( m_inputPorts[ 0 ].DataType == WirePortDataType.FLOAT4 )
|
||||
m_normalize = true;
|
||||
else
|
||||
m_normalize = false;
|
||||
}
|
||||
}
|
||||
|
||||
public override string PropertyName
|
||||
{
|
||||
get
|
||||
{
|
||||
if( m_useCustomGrab )
|
||||
return base.PropertyName;
|
||||
else
|
||||
return GrabTextureDefault;
|
||||
}
|
||||
}
|
||||
|
||||
public override string GetPropertyValStr()
|
||||
{
|
||||
return PropertyName;
|
||||
}
|
||||
|
||||
public override string DataToArray { get { return m_propertyName; } }
|
||||
|
||||
public override string GetUniformValue()
|
||||
{
|
||||
if( SoftValidReference )
|
||||
{
|
||||
if( m_referenceNode.IsConnected )
|
||||
return string.Empty;
|
||||
|
||||
return m_referenceNode.GetUniformValue();
|
||||
}
|
||||
return "ASE_DECLARE_SCREENSPACE_TEXTURE( " + PropertyName + " )";
|
||||
}
|
||||
|
||||
public override bool GetUniformData( out string dataType, out string dataName, ref bool fullValue )
|
||||
{
|
||||
if( SoftValidReference )
|
||||
{
|
||||
//if ( m_referenceNode.IsConnected )
|
||||
//{
|
||||
// dataType = string.Empty;
|
||||
// dataName = string.Empty;
|
||||
//}
|
||||
|
||||
return m_referenceNode.GetUniformData( out dataType, out dataName, ref fullValue );
|
||||
}
|
||||
dataName = "ASE_DECLARE_SCREENSPACE_TEXTURE( " + PropertyName + " )";
|
||||
dataType = string.Empty;
|
||||
fullValue = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void CheckIfAutoRegister( ref MasterNodeDataCollector dataCollector )
|
||||
{
|
||||
if( m_autoRegister && (m_connStatus != NodeConnectionStatus.Connected || InsideShaderFunction ))
|
||||
{
|
||||
SetMacros( ref dataCollector );
|
||||
RegisterProperty( ref dataCollector );
|
||||
string propertyName = CurrentPropertyReference;
|
||||
bool emptyName = string.IsNullOrEmpty( m_propertyInspectorName ) || propertyName == GrabTextureDefault;
|
||||
dataCollector.AddGrabPass( emptyName ? string.Empty : propertyName );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
12
Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenColorNode.cs.meta
generated
Normal file
12
Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenColorNode.cs.meta
generated
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b266c7cca236bcb469d6d4f13df55df5
|
||||
timeCreated: 1481126958
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,179 @@
|
||||
// Amplify Shader Editor - Visual Shader Editing Tool
|
||||
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
using System;
|
||||
namespace AmplifyShaderEditor
|
||||
{
|
||||
[Serializable]
|
||||
[NodeAttributes( "Screen Depth", "Camera And Screen", "Given a screen position returns the depth of the scene to the object as seen by the camera" )]
|
||||
public sealed class ScreenDepthNode : ParentNode
|
||||
{
|
||||
|
||||
|
||||
[SerializeField]
|
||||
private int m_viewSpaceInt = ( int )DepthMode.DepthEye;
|
||||
private DepthMode m_depthMode { get { return ( DepthMode )m_viewSpaceInt; } }
|
||||
|
||||
private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper();
|
||||
|
||||
protected override void CommonInit( int uniqueId )
|
||||
{
|
||||
base.CommonInit( uniqueId );
|
||||
AddInputPort( WirePortDataType.FLOAT4, false, "Pos" );
|
||||
AddOutputPort( WirePortDataType.FLOAT, "Depth" );
|
||||
m_autoWrapProperties = true;
|
||||
m_hasLeftDropdown = true;
|
||||
UpdateAdditonalTitleText();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
private void UpdateAdditonalTitleText()
|
||||
{
|
||||
SetAdditonalTitleText( string.Format( Constants.SubTitleModeFormatStr, GeneratorUtils.DepthModeStr[ m_viewSpaceInt ] ) );
|
||||
}
|
||||
|
||||
public override void Draw( DrawInfo drawInfo )
|
||||
{
|
||||
base.Draw( drawInfo );
|
||||
EditorGUI.BeginChangeCheck();
|
||||
m_viewSpaceInt = m_upperLeftWidget.DrawWidget( this, m_viewSpaceInt, GeneratorUtils.DepthModeStr );
|
||||
if( EditorGUI.EndChangeCheck() )
|
||||
{
|
||||
UpdateAdditonalTitleText();
|
||||
}
|
||||
}
|
||||
|
||||
public override void DrawProperties()
|
||||
{
|
||||
base.DrawProperties();
|
||||
EditorGUI.BeginChangeCheck();
|
||||
m_viewSpaceInt = EditorGUILayoutPopup( "Depth Mode", m_viewSpaceInt, GeneratorUtils.DepthModeStr );
|
||||
if ( EditorGUI.EndChangeCheck() )
|
||||
{
|
||||
UpdateAdditonalTitleText();
|
||||
}
|
||||
}
|
||||
|
||||
public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar )
|
||||
{
|
||||
if ( dataCollector.PortCategory == MasterNodePortCategory.Tessellation )
|
||||
{
|
||||
UIUtils.ShowNoVertexModeNodeMessage( this );
|
||||
return "0";
|
||||
}
|
||||
|
||||
if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) )
|
||||
return GetOutputColorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) );
|
||||
|
||||
if ( !( dataCollector.IsTemplate && dataCollector.IsSRP ) )
|
||||
dataCollector.AddToIncludes( UniqueId, Constants.UnityCgLibFuncs );
|
||||
|
||||
if ( !dataCollector.IsTemplate || dataCollector.TemplateDataCollectorInstance.CurrentSRPType != TemplateSRPType.HDRP )
|
||||
{
|
||||
if ( dataCollector.IsTemplate && dataCollector.CurrentSRPType == TemplateSRPType.URP )
|
||||
{
|
||||
dataCollector.AddToDirectives( Constants.CameraDepthTextureLWEnabler, -1, AdditionalLineType.Define );
|
||||
}
|
||||
else
|
||||
{
|
||||
dataCollector.AddToUniforms( UniqueId, Constants.CameraDepthTextureValue );
|
||||
dataCollector.AddToUniforms( UniqueId, Constants.CameraDepthTextureTexelSize );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
string screenPosNorm = string.Empty;
|
||||
if ( m_inputPorts[ 0 ].IsConnected )
|
||||
{
|
||||
screenPosNorm = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( dataCollector.IsTemplate )
|
||||
{
|
||||
if ( !dataCollector.TemplateDataCollectorInstance.GetCustomInterpolatedData( TemplateInfoOnSematics.SCREEN_POSITION_NORMALIZED, WirePortDataType.FLOAT4, PrecisionType.Float, ref screenPosNorm, true, MasterNodePortCategory.Fragment ) )
|
||||
{
|
||||
screenPosNorm = GeneratorUtils.GenerateScreenPositionNormalized( ref dataCollector, UniqueId, CurrentPrecisionType, !dataCollector.UsingCustomScreenPos );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
screenPosNorm = GeneratorUtils.GenerateScreenPositionNormalized( ref dataCollector, UniqueId, CurrentPrecisionType, !dataCollector.UsingCustomScreenPos );
|
||||
}
|
||||
}
|
||||
|
||||
string screenDepthInstruction = TemplateHelperFunctions.CreateDepthFetch( dataCollector, screenPosNorm );
|
||||
|
||||
if ( m_depthMode == DepthMode.DepthLinearEye || m_depthMode == DepthMode.DepthLinear01 )
|
||||
{
|
||||
string viewSpace = ( m_depthMode == DepthMode.DepthLinearEye ) ? "LinearEyeDepth" : "Linear01Depth";
|
||||
if ( dataCollector.IsTemplate && dataCollector.IsSRP )
|
||||
{
|
||||
screenDepthInstruction = string.Format( "{0}( {1}, _ZBufferParams )", viewSpace, screenDepthInstruction );
|
||||
}
|
||||
else
|
||||
{
|
||||
screenDepthInstruction = string.Format( "{0}( {1} )", viewSpace, screenDepthInstruction );
|
||||
}
|
||||
}
|
||||
else if ( m_depthMode == DepthMode.DepthEye )
|
||||
{
|
||||
screenDepthInstruction = string.Format( "{0} * ( _ProjectionParams.z - _ProjectionParams.y )", screenDepthInstruction );
|
||||
}
|
||||
|
||||
dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT, GeneratorUtils.DepthModeVarNameStr[ m_viewSpaceInt ] + OutputId, screenDepthInstruction );
|
||||
|
||||
m_outputPorts[ 0 ].SetLocalValue( GeneratorUtils.DepthModeVarNameStr[ m_viewSpaceInt ] + OutputId, dataCollector.PortCategory );
|
||||
return GetOutputColorItem( 0, outputId, GeneratorUtils.DepthModeVarNameStr[ m_viewSpaceInt ] + OutputId );
|
||||
}
|
||||
|
||||
public override void ReadFromString( ref string[] nodeParams )
|
||||
{
|
||||
base.ReadFromString( ref nodeParams );
|
||||
m_viewSpaceInt = Convert.ToInt32( GetCurrentParam( ref nodeParams ) );
|
||||
if( UIUtils.CurrentShaderVersion() >= 13901 && UIUtils.CurrentShaderVersion() < 19702 )
|
||||
{
|
||||
bool convertToLinear = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) );
|
||||
if ( !convertToLinear )
|
||||
{
|
||||
if ( m_viewSpaceInt == ( int )DepthMode.DepthLinearEye )
|
||||
{
|
||||
m_viewSpaceInt = ( int )DepthMode.DepthEye;
|
||||
}
|
||||
else if ( m_viewSpaceInt == ( int )DepthMode.DepthLinear01 )
|
||||
{
|
||||
m_viewSpaceInt = ( int )DepthMode.Depth01;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UpdateAdditonalTitleText();
|
||||
}
|
||||
|
||||
public override void WriteToString( ref string nodeInfo, ref string connectionsInfo )
|
||||
{
|
||||
base.WriteToString( ref nodeInfo, ref connectionsInfo );
|
||||
IOUtils.AddFieldValueToString( ref nodeInfo, m_viewSpaceInt );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
12
Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenDepthNode.cs.meta
generated
Normal file
12
Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenDepthNode.cs.meta
generated
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 52266d8a6f7f4fe428dcee2ddb0514ac
|
||||
timeCreated: 1481126955
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,163 @@
|
||||
// Amplify Shader Editor - Visual Shader Editing Tool
|
||||
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System;
|
||||
|
||||
namespace AmplifyShaderEditor
|
||||
{
|
||||
[Serializable]
|
||||
[NodeAttributes( "Screen Position", "Camera And Screen", "Gives access to the screen coordinates of the mesh vertex or fragment, where the X and Y values represent the horizontal and vertical positions. Use the Mode dropdown to choose the desired output mode." )]
|
||||
public sealed class ScreenPosInputsNode : SurfaceShaderINParentNode
|
||||
{
|
||||
enum Mode
|
||||
{
|
||||
Normalized = 0,
|
||||
Raw,
|
||||
Center,
|
||||
Tiled,
|
||||
Pixel
|
||||
};
|
||||
|
||||
private readonly string[] m_outputTypeStr = { "Normalized", "Raw", "Center", "Tiled", "Pixel" };
|
||||
|
||||
[SerializeField]
|
||||
private int m_outputTypeInt = ( int )Mode.Normalized;
|
||||
|
||||
[SerializeField]
|
||||
private bool m_scaleAndOffset = false;
|
||||
|
||||
private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper();
|
||||
|
||||
protected override void CommonInit( int uniqueId )
|
||||
{
|
||||
base.CommonInit( uniqueId );
|
||||
m_currentInput = SurfaceInputs.SCREEN_POS;
|
||||
InitialSetup();
|
||||
m_textLabelWidth = 65;
|
||||
m_autoWrapProperties = true;
|
||||
|
||||
m_hasLeftDropdown = true;
|
||||
m_previewShaderGUID = "a5e7295278a404175b732f1516fb68a6";
|
||||
|
||||
if( UIUtils.CurrentWindow != null && UIUtils.CurrentWindow.CurrentGraph != null && UIUtils.CurrentShaderVersion() <= 2400 )
|
||||
{
|
||||
m_outputTypeInt = ( int )Mode.Raw;
|
||||
m_previewMaterialPassId = ( int )m_outputTypeInt;
|
||||
}
|
||||
|
||||
ConfigureHeader();
|
||||
}
|
||||
|
||||
public override void Draw( DrawInfo drawInfo )
|
||||
{
|
||||
base.Draw( drawInfo );
|
||||
EditorGUI.BeginChangeCheck();
|
||||
m_outputTypeInt = m_upperLeftWidget.DrawWidget( this, m_outputTypeInt, m_outputTypeStr );
|
||||
if( EditorGUI.EndChangeCheck() )
|
||||
{
|
||||
ConfigureHeader();
|
||||
}
|
||||
}
|
||||
|
||||
public override void DrawProperties()
|
||||
{
|
||||
//base.DrawProperties();
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
m_outputTypeInt = EditorGUILayoutPopup( "Mode", m_outputTypeInt, m_outputTypeStr );
|
||||
if( EditorGUI.EndChangeCheck() )
|
||||
{
|
||||
ConfigureHeader();
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigureHeader()
|
||||
{
|
||||
SetAdditonalTitleText( string.Format( Constants.SubTitleModeFormatStr, m_outputTypeStr[ m_outputTypeInt ] ) );
|
||||
m_previewMaterialPassId = m_outputTypeInt;
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
base.Reset();
|
||||
}
|
||||
|
||||
public override void Destroy()
|
||||
{
|
||||
base.Destroy();
|
||||
m_upperLeftWidget = null;
|
||||
}
|
||||
|
||||
public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar )
|
||||
{
|
||||
if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) )
|
||||
{
|
||||
return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) );
|
||||
}
|
||||
m_currentPrecisionType = PrecisionType.Float;
|
||||
|
||||
// TODO: these kinds of calls need a serious cleanup, too much redundancy
|
||||
string screenPos = string.Empty;
|
||||
if ( dataCollector.TesselationActive && dataCollector.IsFragmentCategory || dataCollector.IsTemplate )
|
||||
{
|
||||
switch ( ( Mode )m_outputTypeInt )
|
||||
{
|
||||
case Mode.Normalized: screenPos = GeneratorUtils.GenerateScreenPositionNormalizedOnFrag( ref dataCollector, UniqueId, CurrentPrecisionType ); break;
|
||||
case Mode.Raw: screenPos = GeneratorUtils.GenerateScreenPositionRawOnFrag( ref dataCollector, UniqueId, CurrentPrecisionType ); break;
|
||||
case Mode.Center: screenPos = GeneratorUtils.GenerateScreenPositionCenterOnFrag( ref dataCollector, UniqueId, CurrentPrecisionType ); break;
|
||||
case Mode.Tiled: screenPos = GeneratorUtils.GenerateScreenPositionTiledOnFrag( ref dataCollector, UniqueId, CurrentPrecisionType ); break;
|
||||
case Mode.Pixel: screenPos = GeneratorUtils.GenerateScreenPositionPixelOnFrag( ref dataCollector, UniqueId, CurrentPrecisionType ); break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch ( ( Mode )m_outputTypeInt )
|
||||
{
|
||||
case Mode.Normalized: screenPos = GeneratorUtils.GenerateScreenPositionNormalized( ref dataCollector, UniqueId, CurrentPrecisionType ); break;
|
||||
case Mode.Raw: screenPos = GeneratorUtils.GenerateScreenPositionRaw( ref dataCollector, UniqueId, CurrentPrecisionType ); break;
|
||||
case Mode.Center: screenPos = GeneratorUtils.GenerateScreenPositionCenter( ref dataCollector, UniqueId, CurrentPrecisionType ); break;
|
||||
case Mode.Tiled: screenPos = GeneratorUtils.GenerateScreenPositionTiled( ref dataCollector, UniqueId, CurrentPrecisionType ); break;
|
||||
case Mode.Pixel: screenPos = GeneratorUtils.GenerateScreenPositionPixel( ref dataCollector, UniqueId, CurrentPrecisionType ); break;
|
||||
}
|
||||
}
|
||||
|
||||
m_outputPorts[ 0 ].SetLocalValue( screenPos, dataCollector.PortCategory );
|
||||
return GetOutputVectorItem( 0, outputId, screenPos );
|
||||
|
||||
}
|
||||
|
||||
public override void ReadFromString( ref string[] nodeParams )
|
||||
{
|
||||
base.ReadFromString( ref nodeParams );
|
||||
if( UIUtils.CurrentShaderVersion() > 2400 )
|
||||
{
|
||||
if( UIUtils.CurrentShaderVersion() < 6102 )
|
||||
{
|
||||
bool project = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) );
|
||||
m_outputTypeInt = project ? ( int )Mode.Normalized : ( int )Mode.Raw;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_outputTypeInt = Convert.ToInt32( GetCurrentParam( ref nodeParams ) );
|
||||
}
|
||||
}
|
||||
|
||||
if( UIUtils.CurrentShaderVersion() > 3107 )
|
||||
{
|
||||
m_scaleAndOffset = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) );
|
||||
m_scaleAndOffset = false;
|
||||
}
|
||||
|
||||
ConfigureHeader();
|
||||
}
|
||||
|
||||
public override void WriteToString( ref string nodeInfo, ref string connectionsInfo )
|
||||
{
|
||||
base.WriteToString( ref nodeInfo, ref connectionsInfo );
|
||||
IOUtils.AddFieldValueToString( ref nodeInfo, m_outputTypeInt );
|
||||
IOUtils.AddFieldValueToString( ref nodeInfo, m_scaleAndOffset );
|
||||
}
|
||||
}
|
||||
}
|
12
Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenPosInputsNode.cs.meta
generated
Normal file
12
Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenPosInputsNode.cs.meta
generated
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 32cea8ff65efa3844a0047477ec789da
|
||||
timeCreated: 1481126954
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,122 @@
|
||||
// Amplify Shader Editor - Visual Shader Editing Tool
|
||||
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
|
||||
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AmplifyShaderEditor
|
||||
{
|
||||
[Serializable]
|
||||
public class SurfaceShaderINParentNode : ParentNode
|
||||
{
|
||||
[SerializeField]
|
||||
protected SurfaceInputs m_currentInput;
|
||||
|
||||
[SerializeField]
|
||||
protected string m_currentInputValueStr;
|
||||
|
||||
[SerializeField]
|
||||
protected string m_currentInputDecStr;
|
||||
|
||||
protected override void CommonInit( int uniqueId )
|
||||
{
|
||||
base.CommonInit( uniqueId );
|
||||
m_currentInput = SurfaceInputs.UV_COORDS;
|
||||
m_textLabelWidth = 65;
|
||||
m_customPrecision = true;
|
||||
}
|
||||
|
||||
public override void DrawProperties()
|
||||
{
|
||||
base.DrawProperties();
|
||||
DrawPrecisionProperty();
|
||||
}
|
||||
//This needs to be called on the end of the CommonInit on all children
|
||||
protected void InitialSetup()
|
||||
{
|
||||
m_currentInputValueStr = Constants.InputVarStr + "." + UIUtils.GetInputValueFromType( m_currentInput );
|
||||
|
||||
string outputName = "Out";
|
||||
switch ( m_currentInput )
|
||||
{
|
||||
case SurfaceInputs.DEPTH:
|
||||
{
|
||||
AddOutputPort( WirePortDataType.FLOAT, outputName );
|
||||
}
|
||||
break;
|
||||
case SurfaceInputs.UV_COORDS:
|
||||
{
|
||||
outputName = "UV";
|
||||
AddOutputVectorPorts( WirePortDataType.FLOAT2, outputName );
|
||||
}
|
||||
break;
|
||||
case SurfaceInputs.UV2_COORDS:
|
||||
{
|
||||
outputName = "UV";
|
||||
AddOutputVectorPorts( WirePortDataType.FLOAT2, outputName );
|
||||
}
|
||||
break;
|
||||
case SurfaceInputs.VIEW_DIR:
|
||||
{
|
||||
outputName = "XYZ";
|
||||
AddOutputVectorPorts( WirePortDataType.FLOAT3, outputName );
|
||||
}
|
||||
break;
|
||||
case SurfaceInputs.COLOR:
|
||||
{
|
||||
outputName = "RGBA";
|
||||
AddOutputVectorPorts( WirePortDataType.FLOAT4, outputName );
|
||||
}
|
||||
break;
|
||||
case SurfaceInputs.SCREEN_POS:
|
||||
{
|
||||
outputName = "XYZW";
|
||||
AddOutputVectorPorts( WirePortDataType.FLOAT4, outputName );
|
||||
}
|
||||
break;
|
||||
case SurfaceInputs.WORLD_POS:
|
||||
{
|
||||
outputName = "XYZ";
|
||||
AddOutputVectorPorts( WirePortDataType.FLOAT3, outputName );
|
||||
}
|
||||
break;
|
||||
case SurfaceInputs.WORLD_REFL:
|
||||
{
|
||||
outputName = "XYZ";
|
||||
AddOutputVectorPorts( WirePortDataType.FLOAT3, outputName );
|
||||
}
|
||||
break;
|
||||
case SurfaceInputs.WORLD_NORMAL:
|
||||
{
|
||||
outputName = "XYZ";
|
||||
AddOutputVectorPorts( WirePortDataType.FLOAT3, outputName );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar )
|
||||
{
|
||||
dataCollector.AddToInput( UniqueId, m_currentInput, UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision );
|
||||
switch ( m_currentInput )
|
||||
{
|
||||
case SurfaceInputs.VIEW_DIR:
|
||||
case SurfaceInputs.WORLD_REFL:
|
||||
case SurfaceInputs.WORLD_NORMAL:
|
||||
{
|
||||
dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false );
|
||||
}
|
||||
break;
|
||||
case SurfaceInputs.WORLD_POS:
|
||||
case SurfaceInputs.DEPTH:
|
||||
case SurfaceInputs.UV_COORDS:
|
||||
case SurfaceInputs.UV2_COORDS:
|
||||
case SurfaceInputs.COLOR:
|
||||
case SurfaceInputs.SCREEN_POS: break;
|
||||
};
|
||||
|
||||
return GetOutputVectorItem( 0, outputId, m_currentInputValueStr );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 71628885b2fde0944bf7dd8e4eb2770f
|
||||
timeCreated: 1481126956
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,340 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System;
|
||||
namespace AmplifyShaderEditor
|
||||
{
|
||||
[Serializable]
|
||||
[NodeAttributes( "Texel Size", "Textures", "Texel Size for a given texture object" )]
|
||||
public sealed class TexelSizeNode : ParentNode
|
||||
{
|
||||
private readonly string[] Dummy = { string.Empty };
|
||||
|
||||
[SerializeField]
|
||||
private int m_referenceSamplerId = -1;
|
||||
|
||||
[SerializeField]
|
||||
private int m_referenceNodeId = -1;
|
||||
|
||||
[SerializeField]
|
||||
private TexturePropertyNode m_inputReferenceNode = null;
|
||||
|
||||
private TexturePropertyNode m_referenceNode = null;
|
||||
|
||||
private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper();
|
||||
|
||||
[SerializeField]
|
||||
private string m_previousTexture = string.Empty;
|
||||
|
||||
[SerializeField]
|
||||
private VariableMode m_variableMode = VariableMode.Create;
|
||||
|
||||
private int m_cachedSamplerId = -1;
|
||||
private int m_cachedSamplerIdArray = -1;
|
||||
private int m_cachedSamplerIdCube = -1;
|
||||
private int m_cachedSamplerId3D = -1;
|
||||
|
||||
protected override void CommonInit( int uniqueId )
|
||||
{
|
||||
base.CommonInit( uniqueId );
|
||||
AddInputPort( WirePortDataType.SAMPLER2D, false, "Tex" );
|
||||
m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.SAMPLER1D, WirePortDataType.SAMPLER2D, WirePortDataType.SAMPLER3D, WirePortDataType.SAMPLERCUBE, WirePortDataType.SAMPLER2DARRAY, WirePortDataType.OBJECT );
|
||||
AddOutputVectorPorts( WirePortDataType.FLOAT4, Constants.EmptyPortValue );
|
||||
ChangeOutputName( 1, "1/Width" );
|
||||
ChangeOutputName( 2, "1/Height" );
|
||||
ChangeOutputName( 3, "Width" );
|
||||
ChangeOutputName( 4, "Height" );
|
||||
m_textLabelWidth = 80;
|
||||
m_autoWrapProperties = true;
|
||||
m_hasLeftDropdown = true;
|
||||
m_previewShaderGUID = "6b20226576a059443b58aa2d0b942276";
|
||||
}
|
||||
|
||||
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 OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true )
|
||||
{
|
||||
base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode );
|
||||
m_inputPorts[ 0 ].MatchPortToConnection();
|
||||
m_inputReferenceNode = m_inputPorts[ 0 ].GetOutputNodeWhichIsNotRelay() as TexturePropertyNode;
|
||||
UpdateTitle();
|
||||
}
|
||||
|
||||
public override void OnInputPortDisconnected( int portId )
|
||||
{
|
||||
base.OnInputPortDisconnected( portId );
|
||||
m_inputReferenceNode = null;
|
||||
UpdateTitle();
|
||||
}
|
||||
|
||||
public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type )
|
||||
{
|
||||
base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type );
|
||||
m_inputPorts[ 0 ].MatchPortToConnection();
|
||||
UpdateTitle();
|
||||
}
|
||||
|
||||
void UpdateTitle()
|
||||
{
|
||||
if( m_inputReferenceNode != null )
|
||||
{
|
||||
m_additionalContent.text = string.Format( Constants.PropertyValueLabel, m_inputReferenceNode.PropertyInspectorName );
|
||||
}
|
||||
else if( m_referenceSamplerId > -1 && m_referenceNode != null )
|
||||
{
|
||||
m_additionalContent.text = string.Format( Constants.PropertyValueLabel, m_referenceNode.PropertyInspectorName );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_additionalContent.text = string.Empty;
|
||||
}
|
||||
m_sizeIsDirty = true;
|
||||
}
|
||||
|
||||
public override void DrawProperties()
|
||||
{
|
||||
base.DrawProperties();
|
||||
bool guiEnabledBuffer = GUI.enabled;
|
||||
EditorGUI.BeginChangeCheck();
|
||||
List<string> arr = new List<string>( UIUtils.TexturePropertyNodeArr() );
|
||||
|
||||
if( arr != null && arr.Count > 0 )
|
||||
{
|
||||
arr.Insert( 0, "None" );
|
||||
GUI.enabled = true && ( !m_inputPorts[ 0 ].IsConnected );
|
||||
m_referenceSamplerId = EditorGUILayoutPopup( Constants.AvailableReferenceStr, m_referenceSamplerId + 1, arr.ToArray() ) - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_referenceSamplerId = -1;
|
||||
GUI.enabled = false;
|
||||
EditorGUILayoutPopup( Constants.AvailableReferenceStr, m_referenceSamplerId, Dummy );
|
||||
}
|
||||
|
||||
GUI.enabled = guiEnabledBuffer;
|
||||
if( EditorGUI.EndChangeCheck() )
|
||||
{
|
||||
m_referenceNode = UIUtils.GetTexturePropertyNode( m_referenceSamplerId );
|
||||
if( m_referenceNode != null )
|
||||
{
|
||||
m_referenceNodeId = m_referenceNode.UniqueId;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_referenceNodeId = -1;
|
||||
m_referenceSamplerId = -1;
|
||||
}
|
||||
UpdateTitle();
|
||||
}
|
||||
|
||||
m_variableMode = ( VariableMode )EditorGUILayoutEnumPopup( "Variable Mode", m_variableMode );
|
||||
}
|
||||
|
||||
public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar )
|
||||
{
|
||||
base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar );
|
||||
string texelName = string.Empty;
|
||||
|
||||
if( m_inputPorts[ 0 ].IsConnected )
|
||||
{
|
||||
texelName = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ) + "_TexelSize";
|
||||
}
|
||||
else if( m_referenceNode != null )
|
||||
{
|
||||
m_referenceNode.BaseGenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar );
|
||||
texelName = m_referenceNode.PropertyName + "_TexelSize";
|
||||
}
|
||||
else
|
||||
{
|
||||
texelName = "_TexelSize";
|
||||
UIUtils.ShowMessage( UniqueId, "Please specify a texture sample on the Texel Size node", MessageSeverity.Warning );
|
||||
}
|
||||
|
||||
if ( m_variableMode == VariableMode.Create )
|
||||
{
|
||||
dataCollector.AddToUniforms( UniqueId, "float4 " + texelName + ";", dataCollector.IsSRP );
|
||||
}
|
||||
|
||||
switch( outputId )
|
||||
{
|
||||
case 0: return texelName;
|
||||
case 1: return ( texelName + ".x" );
|
||||
case 2: return ( texelName + ".y" );
|
||||
case 3: return ( texelName + ".z" );
|
||||
case 4: return ( texelName + ".w" );
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
void SetPreviewTexture( Texture newValue )
|
||||
{
|
||||
if( newValue is Cubemap )
|
||||
{
|
||||
m_previewMaterialPassId = 3;
|
||||
if( m_cachedSamplerIdCube == -1 )
|
||||
m_cachedSamplerIdCube = Shader.PropertyToID( "_Cube" );
|
||||
|
||||
PreviewMaterial.SetTexture( m_cachedSamplerIdCube, newValue as Cubemap );
|
||||
}
|
||||
else if( newValue is Texture2DArray )
|
||||
{
|
||||
|
||||
m_previewMaterialPassId = 2;
|
||||
if( m_cachedSamplerIdArray == -1 )
|
||||
m_cachedSamplerIdArray = Shader.PropertyToID( "_Array" );
|
||||
|
||||
PreviewMaterial.SetTexture( m_cachedSamplerIdArray, newValue as Texture2DArray );
|
||||
}
|
||||
else if( newValue is Texture3D )
|
||||
{
|
||||
m_previewMaterialPassId = 1;
|
||||
if( m_cachedSamplerId3D == -1 )
|
||||
m_cachedSamplerId3D = Shader.PropertyToID( "_Sampler3D" );
|
||||
|
||||
PreviewMaterial.SetTexture( m_cachedSamplerId3D, newValue as Texture3D );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_previewMaterialPassId = 0;
|
||||
if( m_cachedSamplerId == -1 )
|
||||
m_cachedSamplerId = Shader.PropertyToID( "_Sampler" );
|
||||
|
||||
PreviewMaterial.SetTexture( m_cachedSamplerId, newValue );
|
||||
}
|
||||
}
|
||||
|
||||
public override void SetPreviewInputs()
|
||||
{
|
||||
base.SetPreviewInputs();
|
||||
if( m_inputPorts[ 0 ].IsConnected )
|
||||
{
|
||||
SetPreviewTexture( m_inputPorts[ 0 ].InputPreviewTexture( ContainerGraph ) );
|
||||
}
|
||||
else if( m_referenceNode != null )
|
||||
{
|
||||
if( m_referenceNode.Value != null )
|
||||
{
|
||||
SetPreviewTexture( m_referenceNode.Value );
|
||||
}
|
||||
else
|
||||
{
|
||||
SetPreviewTexture( m_referenceNode.PreviewTexture );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnNodeLogicUpdate( DrawInfo drawInfo )
|
||||
{
|
||||
base.OnNodeLogicUpdate( drawInfo );
|
||||
|
||||
if( m_referenceNode != null && m_previousTexture != m_referenceNode.AdditonalTitleContent.text )
|
||||
{
|
||||
m_previousTexture = m_referenceNode.AdditonalTitleContent.text;
|
||||
PreviewIsDirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Draw( DrawInfo drawInfo )
|
||||
{
|
||||
base.Draw( drawInfo );
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
{
|
||||
List<string> arr = new List<string>( UIUtils.TexturePropertyNodeArr() );
|
||||
bool guiEnabledBuffer = GUI.enabled;
|
||||
|
||||
if( arr != null && arr.Count > 0 )
|
||||
{
|
||||
arr.Insert( 0, "None" );
|
||||
GUI.enabled = true && ( !m_inputPorts[ 0 ].IsConnected );
|
||||
m_referenceSamplerId = m_upperLeftWidget.DrawWidget( this, m_referenceSamplerId + 1, arr.ToArray() ) - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_referenceSamplerId = -1;
|
||||
GUI.enabled = false;
|
||||
m_upperLeftWidget.DrawWidget( this, m_referenceSamplerId, Dummy );
|
||||
}
|
||||
GUI.enabled = guiEnabledBuffer;
|
||||
}
|
||||
if( EditorGUI.EndChangeCheck() )
|
||||
{
|
||||
m_referenceNode = UIUtils.GetTexturePropertyNode( m_referenceSamplerId );
|
||||
if( m_referenceNode != null )
|
||||
{
|
||||
m_referenceNodeId = m_referenceNode.UniqueId;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_referenceNodeId = -1;
|
||||
m_referenceSamplerId = -1;
|
||||
}
|
||||
UpdateTitle();
|
||||
}
|
||||
}
|
||||
|
||||
public override void RefreshExternalReferences()
|
||||
{
|
||||
base.RefreshExternalReferences();
|
||||
if( UIUtils.CurrentShaderVersion() > 2404 )
|
||||
{
|
||||
m_referenceNode = UIUtils.GetNode( m_referenceNodeId ) as TexturePropertyNode;
|
||||
m_referenceSamplerId = UIUtils.GetTexturePropertyNodeRegisterId( m_referenceNodeId );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_referenceNode = UIUtils.GetTexturePropertyNode( m_referenceSamplerId );
|
||||
if( m_referenceNode != null )
|
||||
{
|
||||
m_referenceNodeId = m_referenceNode.UniqueId;
|
||||
}
|
||||
}
|
||||
UpdateTitle();
|
||||
}
|
||||
|
||||
public override void ReadFromString( ref string[] nodeParams )
|
||||
{
|
||||
base.ReadFromString( ref nodeParams );
|
||||
if( UIUtils.CurrentShaderVersion() > 2404 )
|
||||
{
|
||||
m_referenceNodeId = Convert.ToInt32( GetCurrentParam( ref nodeParams ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_referenceSamplerId = Convert.ToInt32( GetCurrentParam( ref nodeParams ) );
|
||||
}
|
||||
|
||||
if ( UIUtils.CurrentShaderVersion() >= 19801 )
|
||||
{
|
||||
m_variableMode = ( VariableMode )Enum.Parse( typeof( VariableMode ), GetCurrentParam( ref nodeParams ) );
|
||||
}
|
||||
}
|
||||
|
||||
public override void WriteToString( ref string nodeInfo, ref string connectionsInfo )
|
||||
{
|
||||
base.WriteToString( ref nodeInfo, ref connectionsInfo );
|
||||
IOUtils.AddFieldValueToString( ref nodeInfo, m_referenceNodeId );
|
||||
IOUtils.AddFieldValueToString( ref nodeInfo, m_variableMode );
|
||||
}
|
||||
|
||||
public override void Destroy()
|
||||
{
|
||||
base.Destroy();
|
||||
m_referenceNode = null;
|
||||
m_inputReferenceNode = null;
|
||||
m_upperLeftWidget = null;
|
||||
}
|
||||
}
|
||||
}
|
12
Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/TexelSizeNode.cs.meta
generated
Normal file
12
Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/TexelSizeNode.cs.meta
generated
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1a23decd88779d24f9af6ae30c3d5a5f
|
||||
timeCreated: 1481126953
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,112 @@
|
||||
//// Amplify Shader Editor - Visual Shader Editing Tool
|
||||
//// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
|
||||
|
||||
//using UnityEngine;
|
||||
//using UnityEditor;
|
||||
//using System;
|
||||
|
||||
//namespace AmplifyShaderEditor
|
||||
//{
|
||||
// [Serializable]
|
||||
// [NodeAttributes( "[Old]Texture Coordinates", "Surface Data", "Texture UV coordinates set", null, KeyCode.U, false )]
|
||||
// public sealed class UVCoordsParentNode : ParentNode
|
||||
// {
|
||||
// private const string TilingStr = "Tiling";
|
||||
|
||||
// [SerializeField]
|
||||
// private int m_textureCoordChannel = 0;
|
||||
|
||||
// [SerializeField]
|
||||
// private int m_textureCoordSet = 0;
|
||||
|
||||
// [SerializeField]
|
||||
// private Vector2 m_tiling = new Vector2( 1, 1 );
|
||||
|
||||
// protected override void CommonInit( int uniqueId )
|
||||
// {
|
||||
// base.CommonInit( uniqueId );
|
||||
// AddOutputVectorPorts( WirePortDataType.FLOAT2, Constants.EmptyPortValue );
|
||||
// m_textLabelWidth = 75;
|
||||
// }
|
||||
|
||||
// public override void DrawProperties()
|
||||
// {
|
||||
// base.DrawProperties();
|
||||
// int newChannel = EditorGUILayoutIntPopup( Constants.AvailableUVChannelLabel, m_textureCoordChannel, Constants.AvailableUVChannelsStr, Constants.AvailableUVChannels );
|
||||
// if ( newChannel != m_textureCoordChannel )
|
||||
// {
|
||||
// if ( UIUtils.IsChannelAvailable( newChannel ) )
|
||||
// {
|
||||
// UIUtils.ShowMessage( "Attempting to use an unoccupied used texture channel" );
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// m_textureCoordChannel = newChannel;
|
||||
// }
|
||||
// }
|
||||
// else if ( m_textureCoordChannel > -1 && UIUtils.IsChannelAvailable( m_textureCoordChannel ) )
|
||||
// {
|
||||
// UIUtils.ShowMessage( "Texture Channel " + m_textureCoordChannel + " is unavailable for TextureCoordinate node" );
|
||||
// m_textureCoordChannel = -1;
|
||||
// }
|
||||
|
||||
// m_textureCoordSet = EditorGUILayoutIntPopup( Constants.AvailableUVSetsLabel, m_textureCoordSet, Constants.AvailableUVSetsStr, Constants.AvailableUVSets );
|
||||
|
||||
// m_tiling = EditorGUILayoutVector2Field( TilingStr, m_tiling );
|
||||
// }
|
||||
|
||||
// public override void Draw( DrawInfo drawInfo )
|
||||
// {
|
||||
// base.Draw( drawInfo );
|
||||
// if ( m_isVisible )
|
||||
// {
|
||||
// m_propertyDrawPos.x = m_globalPosition.x + Constants.FLOAT_WIDTH_SPACING;
|
||||
// m_propertyDrawPos.y = m_outputPorts[ 1 ].Position.y;
|
||||
// m_propertyDrawPos.width = 2.7f * drawInfo.InvertedZoom * Constants.FLOAT_DRAW_WIDTH_FIELD_SIZE;
|
||||
// m_propertyDrawPos.height = drawInfo.InvertedZoom * Constants.FLOAT_DRAW_HEIGHT_FIELD_SIZE;
|
||||
|
||||
// m_propertyDrawPos.y = m_outputPorts[ 1 ].Position.y;
|
||||
// UIUtils.DrawFloat( this, ref m_propertyDrawPos, ref m_tiling.x );
|
||||
|
||||
// m_propertyDrawPos.y = m_outputPorts[ 2 ].Position.y;
|
||||
// UIUtils.DrawFloat( this, ref m_propertyDrawPos, ref m_tiling.y );
|
||||
// }
|
||||
// }
|
||||
|
||||
// public override void ReadFromString( ref string[] nodeParams )
|
||||
// {
|
||||
// base.ReadFromString( ref nodeParams );
|
||||
// m_textureCoordChannel = Convert.ToInt32( GetCurrentParam( ref nodeParams ) );
|
||||
// m_tiling.x = Convert.ToSingle( GetCurrentParam( ref nodeParams ) );
|
||||
// m_tiling.y = Convert.ToSingle( GetCurrentParam( ref nodeParams ) );
|
||||
// }
|
||||
|
||||
// public override void WriteToString( ref string nodeInfo, ref string connectionsInfo )
|
||||
// {
|
||||
// base.WriteToString( ref nodeInfo, ref connectionsInfo );
|
||||
// IOUtils.AddFieldValueToString( ref nodeInfo, m_textureCoordChannel );
|
||||
// IOUtils.AddFieldValueToString( ref nodeInfo, m_tiling.x );
|
||||
// IOUtils.AddFieldValueToString( ref nodeInfo, m_tiling.y );
|
||||
// }
|
||||
|
||||
// public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar )
|
||||
// {
|
||||
// string uvChannelDeclaration = IOUtils.GetUVChannelDeclaration( UIUtils.GetChannelName( m_textureCoordChannel ), m_textureCoordChannel, m_textureCoordSet );
|
||||
// dataCollector.AddToInput( UniqueId, uvChannelDeclaration, true );
|
||||
|
||||
// if ( dataCollector.GetChannelUsage( m_textureCoordChannel ) != TextureChannelUsage.Used )
|
||||
// dataCollector.SetChannelUsage( m_textureCoordChannel, TextureChannelUsage.Required );
|
||||
|
||||
// string uvTileStr = string.Empty;
|
||||
// switch ( outputId )
|
||||
// {
|
||||
// case 0: { uvTileStr = "float2( " + m_tiling.x + " , " + m_tiling.y + " )"; } break;
|
||||
// case 1: { uvTileStr = m_tiling.x.ToString(); } break;
|
||||
// case 2: { uvTileStr = m_tiling.y.ToString(); } break;
|
||||
// }
|
||||
// string uvChannelName = IOUtils.GetUVChannelName( UIUtils.GetChannelName( m_textureCoordChannel ), m_textureCoordSet );
|
||||
// return ( uvTileStr + "*" + GetOutputVectorItem( 0, outputId, Constants.InputVarStr + "." + uvChannelName ) );
|
||||
// }
|
||||
|
||||
// }
|
||||
//}
|
12
Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/UVCoordsParentNode.cs.meta
generated
Normal file
12
Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/UVCoordsParentNode.cs.meta
generated
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 73fb18e7d547d514695cb0b83a29f80e
|
||||
timeCreated: 1481126956
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,151 @@
|
||||
// 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 ViewSpace
|
||||
{
|
||||
Tangent,
|
||||
World,
|
||||
Object,
|
||||
View
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
[NodeAttributes( "View Dir", "Camera And Screen", "Normalized View Direction vector.", tags: "camera vector" )]
|
||||
public sealed class ViewDirInputsCoordNode : SurfaceShaderINParentNode
|
||||
{
|
||||
private const string SpaceStr = "Space";
|
||||
private const string NormalizeOptionStr = "Safe Normalize";
|
||||
|
||||
[SerializeField]
|
||||
private bool m_safeNormalize = false;
|
||||
|
||||
[SerializeField]
|
||||
private ViewSpace m_viewDirSpace = ViewSpace.World;
|
||||
|
||||
private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper();
|
||||
|
||||
protected override void CommonInit( int uniqueId )
|
||||
{
|
||||
base.CommonInit( uniqueId );
|
||||
m_currentInput = SurfaceInputs.VIEW_DIR;
|
||||
InitialSetup();
|
||||
m_textLabelWidth = 120;
|
||||
m_autoWrapProperties = true;
|
||||
m_drawPreviewAsSphere = true;
|
||||
m_hasLeftDropdown = true;
|
||||
UpdateTitle();
|
||||
m_previewShaderGUID = "07b57d9823df4bd4d8fe6dcb29fca36a";
|
||||
}
|
||||
|
||||
private void UpdateTitle()
|
||||
{
|
||||
m_additionalContent.text = string.Format( Constants.SubTitleSpaceFormatStr, m_viewDirSpace.ToString() );
|
||||
m_sizeIsDirty = true;
|
||||
}
|
||||
|
||||
public override void Draw( DrawInfo drawInfo )
|
||||
{
|
||||
base.Draw( drawInfo );
|
||||
m_upperLeftWidget.DrawWidget<ViewSpace>( ref m_viewDirSpace, this, OnWidgetUpdate );
|
||||
}
|
||||
|
||||
private readonly Action<ParentNode> OnWidgetUpdate = ( x ) =>
|
||||
{
|
||||
( x as ViewDirInputsCoordNode ).UpdateTitle();
|
||||
};
|
||||
|
||||
public override void DrawProperties()
|
||||
{
|
||||
//base.DrawProperties();
|
||||
EditorGUI.BeginChangeCheck();
|
||||
m_viewDirSpace = (ViewSpace)EditorGUILayoutEnumPopup( SpaceStr, m_viewDirSpace );
|
||||
if( EditorGUI.EndChangeCheck() )
|
||||
{
|
||||
UpdateTitle();
|
||||
}
|
||||
m_safeNormalize = EditorGUILayoutToggle( NormalizeOptionStr, m_safeNormalize );
|
||||
EditorGUILayout.HelpBox( "Having safe normalize ON makes sure your view vector is not zero even if you are using your shader with no cameras.", MessageType.None );
|
||||
}
|
||||
|
||||
public override void SetPreviewInputs()
|
||||
{
|
||||
base.SetPreviewInputs();
|
||||
|
||||
m_previewMaterialPassId = ( int )m_viewDirSpace;
|
||||
}
|
||||
|
||||
public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector )
|
||||
{
|
||||
base.PropagateNodeData( nodeData, ref dataCollector );
|
||||
if( m_viewDirSpace == ViewSpace.Tangent )
|
||||
dataCollector.DirtyNormal = true;
|
||||
|
||||
if( m_safeNormalize )
|
||||
dataCollector.SafeNormalizeViewDir = true;
|
||||
}
|
||||
|
||||
public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar )
|
||||
{
|
||||
if( dataCollector.IsTemplate )
|
||||
{
|
||||
TemplateDataCollector inst = dataCollector.TemplateDataCollectorInstance;
|
||||
string varName = inst.GetViewDir(useMasterNodeCategory: true, customCategory: MasterNodePortCategory.Fragment, normalizeType: m_safeNormalize ? NormalizeType.Safe : NormalizeType.Regular, space: m_viewDirSpace );
|
||||
return GetOutputVectorItem( 0, outputId, varName );
|
||||
}
|
||||
|
||||
|
||||
if( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation )
|
||||
{
|
||||
string result = GeneratorUtils.GenerateViewDirection( ref dataCollector, UniqueId, normalizeType: m_safeNormalize ? NormalizeType.Safe : NormalizeType.Regular, space: m_viewDirSpace );
|
||||
return GetOutputVectorItem( 0, outputId, result );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( m_viewDirSpace == ViewSpace.Tangent )
|
||||
{
|
||||
string result = base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalVar );
|
||||
if ( m_safeNormalize )
|
||||
{
|
||||
result = TemplateHelperFunctions.SafeNormalize( dataCollector, result );
|
||||
}
|
||||
return result;
|
||||
}
|
||||
else
|
||||
{
|
||||
dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_POS );
|
||||
string result = GeneratorUtils.GenerateViewDirection( ref dataCollector, UniqueId, m_safeNormalize ? NormalizeType.Safe : NormalizeType.Regular, space: m_viewDirSpace );
|
||||
return GetOutputVectorItem( 0, outputId, result );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public override void ReadFromString( ref string[] nodeParams )
|
||||
{
|
||||
base.ReadFromString( ref nodeParams );
|
||||
if( UIUtils.CurrentShaderVersion() > 2402 )
|
||||
{
|
||||
m_viewDirSpace = ( ViewSpace )Enum.Parse( typeof( ViewSpace ), GetCurrentParam( ref nodeParams ) );
|
||||
}
|
||||
|
||||
if( UIUtils.CurrentShaderVersion() > 15201 )
|
||||
{
|
||||
m_safeNormalize = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) );
|
||||
}
|
||||
|
||||
UpdateTitle();
|
||||
}
|
||||
|
||||
public override void WriteToString( ref string nodeInfo, ref string connectionsInfo )
|
||||
{
|
||||
base.WriteToString( ref nodeInfo, ref connectionsInfo );
|
||||
IOUtils.AddFieldValueToString( ref nodeInfo, m_viewDirSpace );
|
||||
IOUtils.AddFieldValueToString( ref nodeInfo, m_safeNormalize );
|
||||
}
|
||||
}
|
||||
}
|
12
Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ViewDirInputsCoordNode.cs.meta
generated
Normal file
12
Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ViewDirInputsCoordNode.cs.meta
generated
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4755b85e957e31d4b96d341070b156b5
|
||||
timeCreated: 1481126955
|
||||
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 UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace AmplifyShaderEditor
|
||||
{
|
||||
[Serializable]
|
||||
[NodeAttributes( "View Vector", "Camera And Screen", "Unnormalized View Direction vector.", tags: "camera vector" )]
|
||||
public sealed class ViewVectorNode : ParentNode
|
||||
{
|
||||
private const string SpaceStr = "Space";
|
||||
|
||||
[SerializeField]
|
||||
private ViewSpace m_viewDirSpace = ViewSpace.World;
|
||||
|
||||
private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper();
|
||||
|
||||
protected override void CommonInit( int uniqueId )
|
||||
{
|
||||
base.CommonInit( uniqueId );
|
||||
|
||||
AddOutputVectorPorts( WirePortDataType.FLOAT3, "XYZ" );
|
||||
//m_outputPorts[ 4 ].Visible = false;
|
||||
|
||||
m_textLabelWidth = 120;
|
||||
m_autoWrapProperties = true;
|
||||
m_drawPreviewAsSphere = true;
|
||||
m_hasLeftDropdown = true;
|
||||
UpdateTitle();
|
||||
m_previewShaderGUID = "30c17cf801c339f489ed656ff9d66a5b";
|
||||
}
|
||||
|
||||
private void UpdateTitle()
|
||||
{
|
||||
m_additionalContent.text = string.Format( Constants.SubTitleSpaceFormatStr, m_viewDirSpace.ToString() );
|
||||
m_sizeIsDirty = true;
|
||||
}
|
||||
|
||||
public override void Draw( DrawInfo drawInfo )
|
||||
{
|
||||
base.Draw( drawInfo );
|
||||
m_upperLeftWidget.DrawWidget<ViewSpace>( ref m_viewDirSpace, this, OnWidgetUpdate );
|
||||
}
|
||||
|
||||
private readonly Action<ParentNode> OnWidgetUpdate = ( x ) =>
|
||||
{
|
||||
( x as ViewVectorNode ).UpdateTitle();
|
||||
};
|
||||
|
||||
public override void DrawProperties()
|
||||
{
|
||||
base.DrawProperties();
|
||||
EditorGUI.BeginChangeCheck();
|
||||
m_viewDirSpace = ( ViewSpace )EditorGUILayoutEnumPopup( SpaceStr, m_viewDirSpace );
|
||||
if ( EditorGUI.EndChangeCheck() )
|
||||
{
|
||||
UpdateTitle();
|
||||
}
|
||||
}
|
||||
|
||||
public override void SetPreviewInputs()
|
||||
{
|
||||
base.SetPreviewInputs();
|
||||
|
||||
m_previewMaterialPassId = ( int )m_viewDirSpace;
|
||||
}
|
||||
|
||||
public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector )
|
||||
{
|
||||
base.PropagateNodeData( nodeData, ref dataCollector );
|
||||
if ( m_viewDirSpace == ViewSpace.Tangent )
|
||||
{
|
||||
dataCollector.DirtyNormal = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar )
|
||||
{
|
||||
if ( dataCollector.IsTemplate )
|
||||
{
|
||||
TemplateDataCollector inst = dataCollector.TemplateDataCollectorInstance;
|
||||
string varName = inst.GetViewVector( useMasterNodeCategory: true, customCategory: MasterNodePortCategory.Fragment, space: m_viewDirSpace );
|
||||
return GetOutputVectorItem( 0, outputId, varName );
|
||||
}
|
||||
|
||||
if ( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation )
|
||||
{
|
||||
string result = GeneratorUtils.GenerateViewVector( ref dataCollector, UniqueId, space: m_viewDirSpace );
|
||||
return GetOutputVectorItem( 0, outputId, result );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( m_viewDirSpace == ViewSpace.Tangent )
|
||||
{
|
||||
dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_NORMAL, UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision );
|
||||
dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false );
|
||||
dataCollector.ForceNormal = true;
|
||||
}
|
||||
dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_POS );
|
||||
string result = GeneratorUtils.GenerateViewVector( ref dataCollector, UniqueId, space: m_viewDirSpace );
|
||||
return GetOutputVectorItem( 0, outputId, result );
|
||||
}
|
||||
}
|
||||
|
||||
public override void ReadFromString( ref string[] nodeParams )
|
||||
{
|
||||
base.ReadFromString( ref nodeParams );
|
||||
m_viewDirSpace = ( ViewSpace )Enum.Parse( typeof( ViewSpace ), GetCurrentParam( ref nodeParams ) );
|
||||
UpdateTitle();
|
||||
}
|
||||
|
||||
public override void WriteToString( ref string nodeInfo, ref string connectionsInfo )
|
||||
{
|
||||
base.WriteToString( ref nodeInfo, ref connectionsInfo );
|
||||
IOUtils.AddFieldValueToString( ref nodeInfo, m_viewDirSpace );
|
||||
}
|
||||
}
|
||||
}
|
12
Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ViewVectorNode.cs.meta
generated
Normal file
12
Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ViewVectorNode.cs.meta
generated
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 558019813ea988c418aa3f28bd104b29
|
||||
timeCreated: 1481126955
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,119 @@
|
||||
// Amplify Shader Editor - Visual Shader Editing Tool
|
||||
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System;
|
||||
|
||||
namespace AmplifyShaderEditor
|
||||
{
|
||||
[Serializable]
|
||||
[NodeAttributes( "[Deprecated] World Normal", "Surface Data", "Vertex Normal World", null, KeyCode.None, true, true, "World Normal", typeof( WorldNormalVector ) )]
|
||||
public sealed class WorldNormalInputsNode : SurfaceShaderINParentNode
|
||||
{
|
||||
private const string PerPixelLabelStr = "Per Pixel";
|
||||
|
||||
[SerializeField]
|
||||
private bool m_perPixel = true;
|
||||
|
||||
[SerializeField]
|
||||
private string m_precisionString;
|
||||
|
||||
[SerializeField]
|
||||
private bool m_addInstruction = false;
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
base.Reset();
|
||||
m_addInstruction = true;
|
||||
}
|
||||
|
||||
protected override void CommonInit( int uniqueId )
|
||||
{
|
||||
base.CommonInit( uniqueId );
|
||||
m_currentInput = SurfaceInputs.WORLD_NORMAL;
|
||||
InitialSetup();
|
||||
//UIUtils.AddNormalDependentCount();
|
||||
}
|
||||
|
||||
//public override void Destroy()
|
||||
//{
|
||||
// ContainerGraph.RemoveNormalDependentCount();
|
||||
// base.Destroy();
|
||||
//}
|
||||
|
||||
public override void DrawProperties()
|
||||
{
|
||||
base.DrawProperties();
|
||||
m_perPixel = EditorGUILayoutToggleLeft( PerPixelLabelStr, m_perPixel );
|
||||
}
|
||||
|
||||
public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar )
|
||||
{
|
||||
if ( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation )
|
||||
{
|
||||
if ( m_addInstruction )
|
||||
{
|
||||
string precision = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, WirePortDataType.FLOAT3 );
|
||||
dataCollector.AddVertexInstruction( precision + " worldNormal = UnityObjectToWorldNormal(" + Constants.VertexShaderInputStr + ".normal)", UniqueId );
|
||||
m_addInstruction = false;
|
||||
}
|
||||
|
||||
return GetOutputVectorItem( 0, outputId, "worldNormal" );
|
||||
}
|
||||
else
|
||||
{
|
||||
dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_NORMAL, UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision );
|
||||
dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false );
|
||||
if ( dataCollector.PortCategory != MasterNodePortCategory.Debug && m_perPixel && dataCollector.DirtyNormal )
|
||||
{
|
||||
//string result = "WorldNormalVector( " + Constants.InputVarStr + " , float3( 0,0,1 ))";
|
||||
m_precisionString = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, WirePortDataType.FLOAT3 );
|
||||
string result = string.Format( Constants.WorldNormalLocalDecStr, m_precisionString );
|
||||
int count = 0;
|
||||
for ( int i = 0; i < m_outputPorts.Count; i++ )
|
||||
{
|
||||
if ( m_outputPorts[ i ].IsConnected )
|
||||
{
|
||||
if ( m_outputPorts[ i ].ConnectionCount > 2 )
|
||||
{
|
||||
count = 2;
|
||||
break;
|
||||
}
|
||||
count += 1;
|
||||
if ( count > 1 )
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( count > 1 )
|
||||
{
|
||||
string localVarName = "WorldNormal" + OutputId;
|
||||
dataCollector.AddToLocalVariables( UniqueId, CurrentPrecisionType, m_outputPorts[ 0 ].DataType, localVarName, result );
|
||||
return GetOutputVectorItem( 0, outputId, localVarName );
|
||||
}
|
||||
else
|
||||
{
|
||||
return GetOutputVectorItem( 0, outputId, result );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalVar );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void ReadFromString( ref string[] nodeParams )
|
||||
{
|
||||
base.ReadFromString( ref nodeParams );
|
||||
if ( UIUtils.CurrentShaderVersion() > 2504 )
|
||||
m_perPixel = 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_perPixel );
|
||||
}
|
||||
}
|
||||
}
|
12
Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldNormalInputsNode.cs.meta
generated
Normal file
12
Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldNormalInputsNode.cs.meta
generated
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 891e3ffa10c12c54e83a1e40df03df2f
|
||||
timeCreated: 1481126957
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,178 @@
|
||||
// Amplify Shader Editor - Visual Shader Editing Tool
|
||||
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
|
||||
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AmplifyShaderEditor
|
||||
{
|
||||
[Serializable]
|
||||
[NodeAttributes( "World Normal", "Surface Data", "Per pixel world normal vector, accepts a <b>Normal</b> vector in tangent space (ie: normalmap)" )]
|
||||
public sealed class WorldNormalVector : ParentNode
|
||||
{
|
||||
private const string NormalVecValStr = "newWorldNormal";
|
||||
private const string NormalVecDecStr = "float3 {0} = {1};";
|
||||
|
||||
private const string NormalizeOptionStr = "Normalize";
|
||||
private const string NormalizeFunc = "normalize( {0} )";
|
||||
|
||||
[SerializeField]
|
||||
private bool m_normalize = false;
|
||||
|
||||
protected override void CommonInit( int uniqueId )
|
||||
{
|
||||
base.CommonInit( uniqueId );
|
||||
AddInputPort( WirePortDataType.FLOAT3, false, "Normal" );
|
||||
AddOutputVectorPorts( WirePortDataType.FLOAT3, "XYZ" );
|
||||
m_inputPorts[ 0 ].Vector3InternalData = Vector3.forward;
|
||||
m_previewShaderGUID = "5f55f4841abb61e45967957788593a9d";
|
||||
m_drawPreviewAsSphere = true;
|
||||
m_autoWrapProperties = true;
|
||||
m_textLabelWidth = 80;
|
||||
}
|
||||
|
||||
public override void SetPreviewInputs()
|
||||
{
|
||||
base.SetPreviewInputs();
|
||||
|
||||
if( m_inputPorts[ 0 ].IsConnected )
|
||||
m_previewMaterialPassId = 1;
|
||||
else
|
||||
m_previewMaterialPassId = 0;
|
||||
}
|
||||
|
||||
public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector )
|
||||
{
|
||||
base.PropagateNodeData( nodeData, ref dataCollector );
|
||||
if( m_inputPorts[ 0 ].IsConnected )
|
||||
dataCollector.DirtyNormal = true;
|
||||
}
|
||||
|
||||
public override void DrawProperties()
|
||||
{
|
||||
base.DrawProperties();
|
||||
m_normalize = EditorGUILayoutToggle( NormalizeOptionStr, m_normalize );
|
||||
}
|
||||
|
||||
public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar )
|
||||
{
|
||||
if( dataCollector.IsTemplate )
|
||||
{
|
||||
if( m_inputPorts[ 0 ].IsConnected )
|
||||
{
|
||||
if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) )
|
||||
return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) );
|
||||
|
||||
|
||||
string value = dataCollector.TemplateDataCollectorInstance.GetWorldNormal( UniqueId, CurrentPrecisionType, m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ), OutputId );
|
||||
if( m_normalize )
|
||||
{
|
||||
value = string.Format( NormalizeFunc, value );
|
||||
}
|
||||
RegisterLocalVariable( 0, value, ref dataCollector, "worldNormal" + OutputId );
|
||||
return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
string value = dataCollector.TemplateDataCollectorInstance.GetWorldNormal( CurrentPrecisionType );
|
||||
string name;
|
||||
if( m_normalize )
|
||||
{
|
||||
name = "normalizedWorldNormal";
|
||||
value = string.Format( NormalizeFunc, value );
|
||||
RegisterLocalVariable( 0, value, ref dataCollector, name );
|
||||
}
|
||||
else
|
||||
{
|
||||
name = value;
|
||||
}
|
||||
return GetOutputVectorItem( 0, outputId, name );
|
||||
}
|
||||
}
|
||||
|
||||
if( dataCollector.PortCategory == MasterNodePortCategory.Fragment || dataCollector.PortCategory == MasterNodePortCategory.Debug )
|
||||
{
|
||||
dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_NORMAL, UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision );
|
||||
|
||||
string result = string.Empty;
|
||||
if( m_inputPorts[ 0 ].IsConnected )
|
||||
{
|
||||
dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false );
|
||||
dataCollector.ForceNormal = true;
|
||||
|
||||
result = "(WorldNormalVector( " + Constants.InputVarStr + " , " + m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ) + " ))";
|
||||
if( m_normalize )
|
||||
{
|
||||
result = string.Format( NormalizeFunc, result );
|
||||
}
|
||||
|
||||
int connCount = 0;
|
||||
for( int i = 0; i < m_outputPorts.Count; i++ )
|
||||
{
|
||||
connCount += m_outputPorts[ i ].ConnectionCount;
|
||||
}
|
||||
|
||||
if( connCount > 1 )
|
||||
{
|
||||
dataCollector.AddToFragmentLocalVariables( UniqueId, string.Format( NormalVecDecStr, NormalVecValStr + OutputId, result ) );
|
||||
return GetOutputVectorItem( 0, outputId, NormalVecValStr + OutputId );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( !dataCollector.DirtyNormal )
|
||||
{
|
||||
result = GeneratorUtils.GenerateWorldNormal( ref dataCollector, UniqueId, m_normalize );
|
||||
}
|
||||
else
|
||||
{
|
||||
dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false );
|
||||
result = GeneratorUtils.GenerateWorldNormal( ref dataCollector, UniqueId, m_normalize );
|
||||
dataCollector.ForceNormal = true;
|
||||
}
|
||||
}
|
||||
|
||||
return GetOutputVectorItem( 0, outputId, result );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( m_inputPorts[ 0 ].IsConnected )
|
||||
{
|
||||
string inputTangent = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector );
|
||||
|
||||
string normal = GeneratorUtils.GenerateWorldNormal( ref dataCollector, UniqueId );
|
||||
string tangent = GeneratorUtils.GenerateWorldTangent( ref dataCollector, UniqueId );
|
||||
dataCollector.AddToVertexLocalVariables( UniqueId, "float3x3 tangentToWorld = CreateTangentToWorldPerVertex( " + normal + ", " + tangent + ", " + Constants.VertexShaderInputStr + ".tangent.w );" );
|
||||
dataCollector.AddToVertexLocalVariables( UniqueId, "float3 tangentNormal" + OutputId + " = " + inputTangent + ";" );
|
||||
string result = "(tangentToWorld[0] * tangentNormal" + OutputId + ".x + tangentToWorld[1] * tangentNormal" + OutputId + ".y + tangentToWorld[2] * tangentNormal" + OutputId + ".z)";
|
||||
if( m_normalize )
|
||||
{
|
||||
result = string.Format( NormalizeFunc, result );
|
||||
}
|
||||
dataCollector.AddToVertexLocalVariables( UniqueId, "float3 modWorldNormal" + OutputId + " = " + result + ";" );
|
||||
return GetOutputVectorItem( 0, outputId, "modWorldNormal" + OutputId );
|
||||
}
|
||||
else
|
||||
{
|
||||
string result = GeneratorUtils.GenerateWorldNormal( ref dataCollector, UniqueId, m_normalize );
|
||||
return GetOutputVectorItem( 0, outputId, result );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void ReadFromString( ref string[] nodeParams )
|
||||
{
|
||||
base.ReadFromString( ref nodeParams );
|
||||
if( UIUtils.CurrentShaderVersion() > 14202 )
|
||||
{
|
||||
m_normalize = 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_normalize );
|
||||
}
|
||||
}
|
||||
}
|
12
Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldNormalVector.cs.meta
generated
Normal file
12
Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldNormalVector.cs.meta
generated
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d61a084db19701c4fb3030ee953ac509
|
||||
timeCreated: 1481126959
|
||||
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>
|
||||
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AmplifyShaderEditor
|
||||
{
|
||||
[Serializable]
|
||||
[NodeAttributes( "World Position", "Surface Data", "World space position" )]
|
||||
public sealed class WorldPosInputsNode : SurfaceShaderINParentNode
|
||||
{
|
||||
protected override void CommonInit( int uniqueId )
|
||||
{
|
||||
base.CommonInit( uniqueId );
|
||||
m_currentInput = SurfaceInputs.WORLD_POS;
|
||||
m_drawPreviewAsSphere = true;
|
||||
m_previewShaderGUID = "70d5405009b31a349a4d8285f30cf5d9";
|
||||
InitialSetup();
|
||||
}
|
||||
|
||||
public override void DrawProperties() { }
|
||||
|
||||
public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar )
|
||||
{
|
||||
if ( dataCollector.IsTemplate )
|
||||
{
|
||||
string varName = dataCollector.TemplateDataCollectorInstance.GetWorldPos();
|
||||
return GetOutputVectorItem( 0, outputId, varName );
|
||||
}
|
||||
|
||||
string worldPosition = GeneratorUtils.GenerateWorldPosition( ref dataCollector, UniqueId );
|
||||
|
||||
return GetOutputVectorItem( 0, outputId, worldPosition );
|
||||
}
|
||||
}
|
||||
}
|
12
Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldPosInputsNode.cs.meta
generated
Normal file
12
Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldPosInputsNode.cs.meta
generated
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 850bb0065928b7f499b869b8adc1ce5c
|
||||
timeCreated: 1481126957
|
||||
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( "[Deprecated] World Reflection", "Surface Data", "World reflection vector", null, KeyCode.None, true, true, "World Reflection", typeof( WorldReflectionVector ) )]
|
||||
public sealed class WorldReflInputsNode : SurfaceShaderINParentNode
|
||||
{
|
||||
protected override void CommonInit( int uniqueId )
|
||||
{
|
||||
base.CommonInit( uniqueId );
|
||||
m_currentInput = SurfaceInputs.WORLD_REFL;
|
||||
InitialSetup();
|
||||
}
|
||||
}
|
||||
}
|
12
Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldReflInputsNode.cs.meta
generated
Normal file
12
Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldReflInputsNode.cs.meta
generated
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e4f39f3a52f10644392decce9d1e6790
|
||||
timeCreated: 1481126959
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,215 @@
|
||||
// Amplify Shader Editor - Visual Shader Editing Tool
|
||||
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
|
||||
|
||||
using System;
|
||||
using UnityEngine;
|
||||
namespace AmplifyShaderEditor
|
||||
{
|
||||
[Serializable]
|
||||
[NodeAttributes( "World Reflection", "Surface Data", "Per pixel world reflection vector, accepts a <b>Normal</b> vector in tangent space (ie: normalmap)" )]
|
||||
public sealed class WorldReflectionVector : ParentNode
|
||||
{
|
||||
private const string ReflectionVecValStr = "newWorldReflection";
|
||||
private const string ReflectionVecDecStr = "{0} {1} = {2};";
|
||||
|
||||
private const string NormalizeOptionStr = "Normalize";
|
||||
private const string NormalizeFunc = "normalize( {0} )";
|
||||
|
||||
[SerializeField]
|
||||
private bool m_normalize = false;
|
||||
|
||||
protected override void CommonInit( int uniqueId )
|
||||
{
|
||||
base.CommonInit( uniqueId );
|
||||
AddInputPort( WirePortDataType.FLOAT3, false, "Normal" );
|
||||
AddOutputVectorPorts( WirePortDataType.FLOAT3, "XYZ" );
|
||||
m_drawPreviewAsSphere = true;
|
||||
m_previewShaderGUID = "8e267e9aa545eeb418585a730f50273e";
|
||||
m_autoWrapProperties = true;
|
||||
m_textLabelWidth = 80;
|
||||
//UIUtils.AddNormalDependentCount();
|
||||
}
|
||||
|
||||
public override void SetPreviewInputs()
|
||||
{
|
||||
base.SetPreviewInputs();
|
||||
|
||||
if( m_inputPorts[ 0 ].IsConnected )
|
||||
m_previewMaterialPassId = 1;
|
||||
else
|
||||
m_previewMaterialPassId = 0;
|
||||
}
|
||||
|
||||
public override void DrawProperties()
|
||||
{
|
||||
base.DrawProperties();
|
||||
m_normalize = EditorGUILayoutToggle( NormalizeOptionStr, m_normalize );
|
||||
}
|
||||
|
||||
//public override void Destroy()
|
||||
//{
|
||||
// ContainerGraph.RemoveNormalDependentCount();
|
||||
// base.Destroy();
|
||||
//}
|
||||
|
||||
public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector )
|
||||
{
|
||||
base.PropagateNodeData( nodeData, ref dataCollector );
|
||||
if( m_inputPorts[ 0 ].IsConnected )
|
||||
dataCollector.DirtyNormal = true;
|
||||
}
|
||||
|
||||
public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar )
|
||||
{
|
||||
if( dataCollector.IsTemplate )
|
||||
{
|
||||
if( m_inputPorts[ 0 ].IsConnected )
|
||||
{
|
||||
if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) )
|
||||
return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) );
|
||||
|
||||
|
||||
string value = dataCollector.TemplateDataCollectorInstance.GetWorldReflection( CurrentPrecisionType, m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ) );
|
||||
if( m_normalize )
|
||||
{
|
||||
value = string.Format( NormalizeFunc, value );
|
||||
}
|
||||
RegisterLocalVariable( 0, value, ref dataCollector, "worldRefl" + OutputId );
|
||||
return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
string name;
|
||||
string value = dataCollector.TemplateDataCollectorInstance.GetWorldReflection( CurrentPrecisionType );
|
||||
if( m_normalize )
|
||||
{
|
||||
name = "normalizedWorldRefl";
|
||||
value = string.Format( NormalizeFunc, value );
|
||||
RegisterLocalVariable( 0, value, ref dataCollector, name );
|
||||
}
|
||||
else
|
||||
{
|
||||
name = value;
|
||||
}
|
||||
return GetOutputVectorItem( 0, outputId, name );
|
||||
}
|
||||
}
|
||||
|
||||
bool isVertex = ( dataCollector.PortCategory == MasterNodePortCategory.Tessellation || dataCollector.PortCategory == MasterNodePortCategory.Vertex );
|
||||
if( isVertex )
|
||||
{
|
||||
if( m_inputPorts[ 0 ].IsConnected )
|
||||
{
|
||||
if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) )
|
||||
return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) );
|
||||
|
||||
string normal = GeneratorUtils.GenerateWorldNormal( ref dataCollector, UniqueId );
|
||||
string tangent = GeneratorUtils.GenerateWorldTangent( ref dataCollector, UniqueId );
|
||||
dataCollector.AddToVertexLocalVariables( UniqueId, "float3x3 tangentToWorld = CreateTangentToWorldPerVertex( " + normal + ", "+ tangent + ", "+ Constants.VertexShaderInputStr + ".tangent.w );" );
|
||||
string inputTangent = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector );
|
||||
dataCollector.AddToVertexLocalVariables( UniqueId, "float3 tangentNormal" + OutputId + " = " + inputTangent + ";" );
|
||||
|
||||
string viewDir = GeneratorUtils.GenerateViewDirection( ref dataCollector, UniqueId );
|
||||
dataCollector.AddToVertexLocalVariables( UniqueId, "float3 modWorldNormal" + OutputId + " = ( tangentToWorld[0] * tangentNormal" + OutputId + ".x + tangentToWorld[1] * tangentNormal" + OutputId + ".y + tangentToWorld[2] * tangentNormal" + OutputId + ".z);" );
|
||||
|
||||
string value = "reflect( -" + viewDir + ", modWorldNormal" + OutputId + " )";
|
||||
if( m_normalize )
|
||||
{
|
||||
value = string.Format( NormalizeFunc, value );
|
||||
}
|
||||
|
||||
RegisterLocalVariable( 0, value, ref dataCollector, "modReflection" + OutputId );
|
||||
return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) )
|
||||
return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) );
|
||||
|
||||
string worldNormal = GeneratorUtils.GenerateWorldNormal( ref dataCollector, UniqueId );
|
||||
string viewDir = GeneratorUtils.GenerateViewDirection( ref dataCollector, UniqueId );
|
||||
|
||||
string value = "reflect( -" + viewDir + ", " + worldNormal + " )";
|
||||
if( m_normalize )
|
||||
{
|
||||
value = string.Format( NormalizeFunc, value );
|
||||
}
|
||||
RegisterLocalVariable( 0, value, ref dataCollector, ReflectionVecValStr + OutputId );
|
||||
return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) )
|
||||
return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) );
|
||||
|
||||
dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_REFL, CurrentPrecisionType );
|
||||
|
||||
string result = string.Empty;
|
||||
if( m_inputPorts[ 0 ].IsConnected )
|
||||
{
|
||||
dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false );
|
||||
dataCollector.ForceNormal = true;
|
||||
|
||||
result = "WorldReflectionVector( " + Constants.InputVarStr + " , " + m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ) + " )";
|
||||
if( m_normalize )
|
||||
{
|
||||
result = String.Format( NormalizeFunc, result );
|
||||
}
|
||||
int connCount = 0;
|
||||
for( int i = 0; i < m_outputPorts.Count; i++ )
|
||||
{
|
||||
connCount += m_outputPorts[ i ].ConnectionCount;
|
||||
}
|
||||
|
||||
if( connCount > 1 )
|
||||
{
|
||||
string precisionType = UIUtils.PrecisionWirePortToCgType( UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision, WirePortDataType.FLOAT3 );
|
||||
|
||||
dataCollector.AddToFragmentLocalVariables( UniqueId, string.Format( ReflectionVecDecStr, precisionType, ReflectionVecValStr + OutputId, result ) );
|
||||
RegisterLocalVariable( 0, result, ref dataCollector, ReflectionVecValStr + OutputId );
|
||||
return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false );
|
||||
result = GeneratorUtils.GenerateWorldReflection( ref dataCollector, UniqueId , m_normalize );
|
||||
if( dataCollector.DirtyNormal )
|
||||
dataCollector.ForceNormal = true;
|
||||
}
|
||||
|
||||
return GetOutputVectorItem( 0, outputId, result );
|
||||
//RegisterLocalVariable( 0, result, ref dataCollector, "worldrefVec" + OutputId );
|
||||
//return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue );
|
||||
}
|
||||
}
|
||||
|
||||
public override void ReadFromString( ref string[] nodeParams )
|
||||
{
|
||||
base.ReadFromString( ref nodeParams );
|
||||
if( UIUtils.CurrentShaderVersion() > 14202 )
|
||||
{
|
||||
m_normalize = 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_normalize );
|
||||
}
|
||||
|
||||
public override void RefreshExternalReferences()
|
||||
{
|
||||
base.RefreshExternalReferences();
|
||||
if( UIUtils.CurrentShaderVersion() <= 14202 )
|
||||
{
|
||||
if( !m_inputPorts[ 0 ].IsConnected )
|
||||
{
|
||||
m_normalize = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
12
Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldReflectionVector.cs.meta
generated
Normal file
12
Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldReflectionVector.cs.meta
generated
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bd82e1d90bd90fc4d924e97e5fdcc7de
|
||||
timeCreated: 1481126959
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user