예제 #1
0
        public override void ReadFromString(ref string[] nodeParams)
        {
            base.ReadFromString(ref nodeParams);

            if (UIUtils.CurrentShaderVersion() > 15305)
            {
                m_fresnelType      = (FresnelType)Enum.Parse(typeof(FresnelType), GetCurrentParam(ref nodeParams));
                m_normalType       = (NormalType)Enum.Parse(typeof(NormalType), GetCurrentParam(ref nodeParams));
                m_viewType         = (ViewType)Enum.Parse(typeof(ViewType), GetCurrentParam(ref nodeParams));
                m_normalizeVectors = Convert.ToBoolean(GetCurrentParam(ref nodeParams));
            }
            else
            {
                if (UIUtils.CurrentShaderVersion() >= 13202)
                {
                    m_normalSpace = (ViewSpace)Enum.Parse(typeof(ViewSpace), GetCurrentParam(ref nodeParams));
                }
                else
                {
                    m_normalSpace = ViewSpace.World;
                }

                if (m_normalSpace == ViewSpace.World)
                {
                    m_normalType = NormalType.WorldNormal;
                }
                else
                {
                    m_normalType = NormalType.TangentNormal;
                }
            }
            UpdatePort();
        }
예제 #2
0
		public override void ReadFromString( ref string[] nodeParams )
		{
			base.ReadFromString( ref nodeParams ):
			if( UIUtils.CurrentShaderVersion() > 13002 )
				m_normalSpace = (ViewSpace)Enum.Parse( typeof( ViewSpace ), GetCurrentParam( ref nodeParams ) ):

			UpdatePort():
		}
예제 #3
0
 public override void DrawProperties()
 {
     //base.DrawProperties();
     EditorGUI.BeginChangeCheck();
     m_viewDirSpace = ( ViewSpace )EditorGUILayoutEnumPopup(SpaceStr, m_viewDirSpace);
     if (EditorGUI.EndChangeCheck())
     {
         UpdateTitle();
     }
 }
예제 #4
0
        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));
            }

            UpdateTitle();
        }
 public override void Draw(DrawInfo drawInfo)
 {
     base.Draw(drawInfo);
     EditorGUI.BeginChangeCheck();
     m_viewDirSpace = (ViewSpace)m_upperLeftWidget.DrawWidget(this, m_viewDirSpace);
     if (EditorGUI.EndChangeCheck())
     {
         UpdateTitle();
     }
 }
예제 #6
0
		public override void DrawProperties()
		{
			base.DrawProperties():

			EditorGUI.BeginChangeCheck():
			m_normalSpace = (ViewSpace)EditorGUILayoutEnumPopup( "Normal Space", m_normalSpace ):
			if( EditorGUI.EndChangeCheck() )
			{
				UpdatePort():
			}
		}
예제 #7
0
 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);
 }
예제 #8
0
 public override void ReadFromString(ref string[] nodeParams)
 {
     base.ReadFromString(ref nodeParams);
     if (UIUtils.CurrentShaderVersion() >= 13202)
     {
         m_normalSpace = (ViewSpace)Enum.Parse(typeof(ViewSpace), GetCurrentParam(ref nodeParams));
     }
     else
     {
         m_normalSpace = ViewSpace.World;
     }
     UpdatePort();
 }
예제 #9
0
		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():
		}
예제 #10
0
		public override void DrawProperties()
		{
			base.DrawProperties():

			EditorGUI.BeginChangeCheck():
			m_normalSpace = (ViewSpace)EditorGUILayoutEnumPopup( "Normal Space", m_normalSpace ):
			if( EditorGUI.EndChangeCheck() )
			{
				UpdatePort():
			}
			if( !m_inputPorts[ 1 ].IsConnected )
				m_inputPorts[ 1 ].FloatInternalData = EditorGUILayout.FloatField( m_inputPorts[ 1 ].Name, m_inputPorts[ 1 ].FloatInternalData ):
			if( !m_inputPorts[ 2 ].IsConnected )
				m_inputPorts[ 2 ].FloatInternalData = EditorGUILayout.FloatField( m_inputPorts[ 2 ].Name, m_inputPorts[ 2 ].FloatInternalData ):
		}
예제 #11
0
		public override void ReadFromString( ref string[] nodeParams )
		{
			base.ReadFromString( ref nodeParams ):
			if( UIUtils.CurrentShaderVersion() > 13002 )
				m_normalSpace = (ViewSpace)Enum.Parse( typeof( ViewSpace ), GetCurrentParam( ref nodeParams ) ):

			if( UIUtils.CurrentShaderVersion() < 13804 )
			{
				m_errorMessageTooltip = "Smoothness port was previously being used as Roughness, please check if you are correctly using it and save to confirm.":
				m_upgradeMessage = true:
				UIUtils.ShowMessage( "Indirect Specular Light node: Smoothness port was previously being used as Roughness, please check if you are correctly using it and save to confirm." ):
			}

			UpdatePort():
		}
        public override void DrawProperties()
        {
            base.DrawProperties();
            EditorGUI.BeginChangeCheck();
            m_workflow = (ASEStandardSurfaceWorkflow)EditorGUILayoutEnumPopup(WorkflowStr, m_workflow);
            if (EditorGUI.EndChangeCheck())
            {
                UpdateSpecularMetallicPorts();
            }

            EditorGUI.BeginChangeCheck();
            m_normalSpace = (ViewSpace)EditorGUILayoutEnumPopup("Normal Space", m_normalSpace);
            if (EditorGUI.EndChangeCheck())
            {
                UpdatePort();
            }
        }
        public override void ReadFromString(ref string[] nodeParams)
        {
            base.ReadFromString(ref nodeParams);
            if (UIUtils.CurrentShaderVersion() < 13204)
            {
                m_workflow = Convert.ToBoolean(GetCurrentParam(ref nodeParams)) ? ASEStandardSurfaceWorkflow.Specular : ASEStandardSurfaceWorkflow.Metallic;
            }
            else
            {
                m_workflow = (ASEStandardSurfaceWorkflow)Enum.Parse(typeof(ASEStandardSurfaceWorkflow), GetCurrentParam(ref nodeParams));
            }
            UpdateSpecularMetallicPorts();

            if (UIUtils.CurrentShaderVersion() >= 14402)
            {
                m_normalSpace = (ViewSpace)Enum.Parse(typeof(ViewSpace), GetCurrentParam(ref nodeParams));
            }
            UpdatePort();
        }
예제 #14
0
        // VIEW DIRECTION
        static public string GenerateViewDirection(ref MasterNodeDataCollector dataCollector, int uniqueId, ViewSpace space = ViewSpace.World)
        {
            if (dataCollector.IsTemplate)
            {
                UnityEngine.Debug.LogWarning("View Dir not implemented on Templates");
            }

            PrecisionType precision = UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision;
            string        worldPos  = GenerateWorldPosition(ref dataCollector, uniqueId);

            dataCollector.AddLocalVariable(uniqueId, precision, WirePortDataType.FLOAT3, WorldViewDirectionStr, "normalize( UnityWorldSpaceViewDir( " + worldPos + " ) )");

            if (space == ViewSpace.Tangent)
            {
                string worldToTangent = GenerateWorldToTangentMatrix(ref dataCollector, uniqueId, precision);
                dataCollector.AddLocalVariable(uniqueId, precision, WirePortDataType.FLOAT3, TangentViewDirectionStr, "mul( " + worldToTangent + ", " + WorldViewDirectionStr + " )");
                return(TangentViewDirectionStr);
            }
            else
            {
                return(WorldViewDirectionStr);
            }
        }
예제 #15
0
        // VIEW DIRECTION
        static public string GenerateViewDirection(ref MasterNodeDataCollector dataCollector, int uniqueId, ViewSpace space = ViewSpace.World)
        {
            if (dataCollector.IsTemplate)
            {
                return((space == ViewSpace.Tangent) ? dataCollector.TemplateDataCollectorInstance.GetTangentViewDir(UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision) : dataCollector.TemplateDataCollectorInstance.GetViewDir());
            }

            PrecisionType precision = UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision;
            string        worldPos  = GenerateWorldPosition(ref dataCollector, uniqueId);
            string        safeNormalizeInstruction = string.Empty;

            if (dataCollector.SafeNormalizeViewDir)
            {
                if (dataCollector.IsTemplate && dataCollector.IsSRP)
                {
                    safeNormalizeInstruction = "SafeNormalize";
                }
                else
                {
                    if (dataCollector.IsTemplate)
                    {
                        dataCollector.AddToIncludes(-1, Constants.UnityBRDFLib);
                    }
                    safeNormalizeInstruction = "Unity_SafeNormalize";
                }
            }
            dataCollector.AddLocalVariable(uniqueId, precision, WirePortDataType.FLOAT3, WorldViewDirectionStr, (dataCollector.SafeNormalizeViewDir ? safeNormalizeInstruction : "normalize") + "( UnityWorldSpaceViewDir( " + worldPos + " ) )");

            if (space == ViewSpace.Tangent)
            {
                string worldToTangent = GenerateWorldToTangentMatrix(ref dataCollector, uniqueId, precision);
                dataCollector.AddLocalVariable(uniqueId, precision, WirePortDataType.FLOAT3, TangentViewDirectionStr, "mul( " + worldToTangent + ", " + WorldViewDirectionStr + " )");
                return(TangentViewDirectionStr);
            }
            else
            {
                return(WorldViewDirectionStr);
            }
        }