using System ;
using System ;
using UnityEngine ;
using UnityEngine.Rendering ;
using UnityEngine.Experimental.Rendering ;
public static GUIContent normalMapText = new GUIContent ( "Normal Map" , "Normal Map (BC7/BC5/DXT5(nm))" ) ;
public static GUIContent normalMapOSText = new GUIContent ( "Normal Map OS" , "Normal Map (BC7/DXT1/RGB)" ) ;
public static GUIContent specularOcclusionMapText = new GUIContent ( "Specular Occlusion Map (RGBA)" , "Specular Occlusion Map" ) ;
public static GUIContent horizonFadeText = new GUIContent ( "Horizon Fade (Spec occlusion)" , "horizon fade is use to control specular occlusion" ) ;
public static GUIContent heightMapText = new GUIContent ( "Height Map (R)" , "Height Map" ) ;
public static GUIContent heightMapAmplitudeText = new GUIContent ( "Height Map Amplitude" , "Height Map amplitude in world units." ) ;
public static GUIContent texWorldScaleText = new GUIContent ( "World scale" , "Tiling factor applied to Planar/Trilinear mapping" ) ;
// Details
public static string detailText = "Inputs Detail" ;
public static string detailText = "Detail Inputs " ;
public static GUIContent UVDetailMappingText = new GUIContent ( "Detail UV mapping" , "" ) ;
public static GUIContent detailMapNormalText = new GUIContent ( "Detail Map A(R) Ny(G) S(B) Nx(A)" , "Detail Map" ) ;
public static GUIContent detailMaskText = new GUIContent ( "Detail Mask (G)" , "Mask for detailMap" ) ;
public static GUIContent specularColorText = new GUIContent ( "Specular Color" , "Specular color (RGB)" ) ;
// Emissive
public static string lightingText = "Inputs Lighting" ;
public static string lightingText = "Lighting Inputs " ;
public static GUIContent emissiveText = new GUIContent ( "Emissive Color" , "Emissive" ) ;
public static GUIContent emissiveIntensityText = new GUIContent ( "Emissive Intensity" , "Emissive" ) ;
public static GUIContent emissiveColorModeText = new GUIContent ( "Emissive Color Usage" , "Use emissive color or emissive mask" ) ;
// Lit shader is not layered but some layered materials inherit from it. In order to share code we need LitUI to account for this.
protected const int kMaxLayerCount = 4 ;
protected int m_LayerCount = 1 ;
protected string [ ] m_PropertySuffixes = { "" , "" , "" , "" } ;
Planar ,
Triplanar
Planar = 4 ,
Triplanar = 5
}
public enum NormalMapSpace
UseEmissiveMask ,
}
protected MaterialProperty UVBase = null ;
protected MaterialProperty [ ] UVBase = new MaterialProperty [ kMaxLayerCount ] ;
protected MaterialProperty TexWorldScale = null ;
protected MaterialProperty [ ] TexWorldScale = new MaterialProperty [ kMaxLayerCount ] ;
protected MaterialProperty UVMappingMask = null ;
protected MaterialProperty [ ] UVMappingMask = new MaterialProperty [ kMaxLayerCount ] ;
protected MaterialProperty baseColor = null ;
protected MaterialProperty [ ] baseColor = new MaterialProperty [ kMaxLayerCount ] ;
protected MaterialProperty baseColorMap = null ;
protected MaterialProperty [ ] baseColorMap = new MaterialProperty [ kMaxLayerCount ] ;
protected MaterialProperty metallic = null ;
protected MaterialProperty [ ] metallic = new MaterialProperty [ kMaxLayerCount ] ;
protected MaterialProperty smoothness = null ;
protected MaterialProperty [ ] smoothness = new MaterialProperty [ kMaxLayerCount ] ;
protected MaterialProperty maskMap = null ;
protected MaterialProperty [ ] maskMap = new MaterialProperty [ kMaxLayerCount ] ;
protected MaterialProperty specularOcclusionMap = null ;
protected MaterialProperty [ ] specularOcclusionMap = new MaterialProperty [ kMaxLayerCount ] ;
protected MaterialProperty horizonFade = null ;
protected const string kHorizonFade = "_HorizonFade" ;
protected MaterialProperty normalMap = null ;
protected MaterialProperty [ ] normalMap = new MaterialProperty [ kMaxLayerCount ] ;
protected MaterialProperty normalMapO S = null ;
protected MaterialProperty [ ] normalMapOS = new MaterialProperty [ kMaxLayerCount ] ;
protected MaterialProperty normalScale = null ;
protected MaterialProperty [ ] normalScale = new MaterialProperty [ kMaxLayerCount ] ;
protected MaterialProperty normalMapSpace = null ;
protected MaterialProperty [ ] normalMapSpace = new MaterialProperty [ kMaxLayerCount ] ;
protected MaterialProperty heightMap = null ;
protected MaterialProperty [ ] heightMap = new MaterialProperty [ kMaxLayerCount ] ;
protected MaterialProperty heightAmplitude = null ;
protected MaterialProperty [ ] heightAmplitude = new MaterialProperty [ kMaxLayerCount ] ;
protected MaterialProperty heightCenter = null ;
protected MaterialProperty [ ] heightCenter = new MaterialProperty [ kMaxLayerCount ] ;
protected MaterialProperty tangentMap = null ;
protected const string kTangentMap = "_TangentMap" ;
protected MaterialProperty tangentMapOS = null ;
protected const string kTangentMapOS = "_TangentMapOS" ;
protected MaterialProperty anisotropy = null ;
protected const string kAnisotropy = "_Anisotropy" ;
protected MaterialProperty anisotropyMap = null ;
protected const string kAnisotropyMap = "_AnisotropyMap" ;
protected MaterialProperty specularColor = null ;
protected const string kSpecularColor = "_SpecularColor" ;
protected MaterialProperty specularColorMap = null ;
protected const string kSpecularColorMap = "_SpecularColorMap" ;
protected MaterialProperty UVDetail = null ;
protected MaterialProperty [ ] UVDetail = new MaterialProperty [ kMaxLayerCount ] ;
protected MaterialProperty UVDetailsMappingMask = null ;
protected MaterialProperty [ ] UVDetailsMappingMask = new MaterialProperty [ kMaxLayerCount ] ;
protected MaterialProperty detailMap = null ;
protected MaterialProperty [ ] detailMap = new MaterialProperty [ kMaxLayerCount ] ;
protected MaterialProperty detailMask = null ;
protected MaterialProperty [ ] detailMask = new MaterialProperty [ kMaxLayerCount ] ;
protected MaterialProperty detailAlbedoScale = null ;
protected MaterialProperty [ ] detailAlbedoScale = new MaterialProperty [ kMaxLayerCount ] ;
protected MaterialProperty detailNormalScale = null ;
protected MaterialProperty [ ] detailNormalScale = new MaterialProperty [ kMaxLayerCount ] ;
protected MaterialProperty detailSmoothnessScale = null ;
protected MaterialProperty [ ] detailSmoothnessScale = new MaterialProperty [ kMaxLayerCount ] ;
protected MaterialProperty specularColor = null ;
protected const string kSpecularColor = "_SpecularColor" ;
protected MaterialProperty specularColorMap = null ;
protected const string kSpecularColorMap = "_SpecularColorMap" ;
protected MaterialProperty tangentMap = null ;
protected const string kTangentMap = "_TangentMap" ;
protected MaterialProperty tangentMapOS = null ;
protected const string kTangentMapOS = "_TangentMapOS" ;
protected MaterialProperty anisotropy = null ;
protected const string kAnisotropy = "_Anisotropy" ;
protected MaterialProperty anisotropyMap = null ;
protected const string kAnisotropyMap = "_AnisotropyMap" ;
protected SubsurfaceScatteringProfile subsurfaceProfile = null ;
protected MaterialProperty subsurfaceProfileID = null ;
protected const string kSubsurfaceProfileID = "_SubsurfaceProfile" ;
protected MaterialProperty emissiveIntensity = null ;
protected const string kEmissiveIntensity = "_EmissiveIntensity" ;
protected void FindMaterialLayerProperties ( MaterialProperty [ ] props )
{
for ( int i = 0 ; i < m_LayerCount ; + + i )
{
UVBase [ i ] = FindProperty ( string . Format ( "{0}{1}" , kUVBase , m_PropertySuffixes [ i ] ) , props ) ;
TexWorldScale [ i ] = FindProperty ( string . Format ( "{0}{1}" , kTexWorldScale , m_PropertySuffixes [ i ] ) , props ) ;
UVMappingMask [ i ] = FindProperty ( string . Format ( "{0}{1}" , kUVMappingMask , m_PropertySuffixes [ i ] ) , props ) ;
baseColor [ i ] = FindProperty ( string . Format ( "{0}{1}" , kBaseColor , m_PropertySuffixes [ i ] ) , props ) ;
baseColorMap [ i ] = FindProperty ( string . Format ( "{0}{1}" , kBaseColorMap , m_PropertySuffixes [ i ] ) , props ) ;
metallic [ i ] = FindProperty ( string . Format ( "{0}{1}" , kMetallic , m_PropertySuffixes [ i ] ) , props ) ;
smoothness [ i ] = FindProperty ( string . Format ( "{0}{1}" , kSmoothness , m_PropertySuffixes [ i ] ) , props ) ;
maskMap [ i ] = FindProperty ( string . Format ( "{0}{1}" , kMaskMap , m_PropertySuffixes [ i ] ) , props ) ;
specularOcclusionMap [ i ] = FindProperty ( string . Format ( "{0}{1}" , kSpecularOcclusionMap , m_PropertySuffixes [ i ] ) , props ) ;
normalMap [ i ] = FindProperty ( string . Format ( "{0}{1}" , kNormalMap , m_PropertySuffixes [ i ] ) , props ) ;
normalMapOS [ i ] = FindProperty ( string . Format ( "{0}{1}" , kNormalMapOS , m_PropertySuffixes [ i ] ) , props ) ;
normalScale [ i ] = FindProperty ( string . Format ( "{0}{1}" , kNormalScale , m_PropertySuffixes [ i ] ) , props ) ;
normalMapSpace [ i ] = FindProperty ( string . Format ( "{0}{1}" , kNormalMapSpace , m_PropertySuffixes [ i ] ) , props ) ;
heightMap [ i ] = FindProperty ( string . Format ( "{0}{1}" , kHeightMap , m_PropertySuffixes [ i ] ) , props ) ;
heightAmplitude [ i ] = FindProperty ( string . Format ( "{0}{1}" , kHeightAmplitude , m_PropertySuffixes [ i ] ) , props ) ;
heightCenter [ i ] = FindProperty ( string . Format ( "{0}{1}" , kHeightCenter , m_PropertySuffixes [ i ] ) , props ) ;
// Details
UVDetail [ i ] = FindProperty ( string . Format ( "{0}{1}" , kUVDetail , m_PropertySuffixes [ i ] ) , props ) ;
UVDetailsMappingMask [ i ] = FindProperty ( string . Format ( "{0}{1}" , kUVDetailsMappingMask , m_PropertySuffixes [ i ] ) , props ) ;
detailMap [ i ] = FindProperty ( string . Format ( "{0}{1}" , kDetailMap , m_PropertySuffixes [ i ] ) , props ) ;
detailMask [ i ] = FindProperty ( string . Format ( "{0}{1}" , kDetailMask , m_PropertySuffixes [ i ] ) , props ) ;
detailAlbedoScale [ i ] = FindProperty ( string . Format ( "{0}{1}" , kDetailAlbedoScale , m_PropertySuffixes [ i ] ) , props ) ;
detailNormalScale [ i ] = FindProperty ( string . Format ( "{0}{1}" , kDetailNormalScale , m_PropertySuffixes [ i ] ) , props ) ;
detailSmoothnessScale [ i ] = FindProperty ( string . Format ( "{0}{1}" , kDetailSmoothnessScale , m_PropertySuffixes [ i ] ) , props ) ;
}
}
protected void FindMaterialEmissiveProperties ( MaterialProperty [ ] props )
{
emissiveColorMode = FindProperty ( kEmissiveColorMode , props ) ;
emissiveColor = FindProperty ( kEmissiveColor , props ) ;
emissiveColorMap = FindProperty ( kEmissiveColorMap , props ) ;
emissiveIntensity = FindProperty ( kEmissiveIntensity , props ) ;
}
UVBase = FindProperty ( kUVBase , props ) ;
TexWorldScale = FindProperty ( kTexWorldScale , props ) ;
UVMappingMask = FindProperty ( kUVMappingMask , props ) ;
FindMaterialLayerProperties ( props ) ;
FindMaterialEmissiveProperties ( props ) ;
// The next properties are only supported for regular Lit shader (not layered ones) because it's complicated to blend those parameters if they are different on a per layer basis.
// Specular Color
specularColor = FindProperty ( kSpecularColor , props ) ;
specularColorMap = FindProperty ( kSpecularColorMap , props ) ;
baseColor = FindProperty ( kBaseColor , props ) ;
baseColorMap = FindProperty ( kBaseColorMap , props ) ;
metallic = FindProperty ( kMetallic , props ) ;
smoothness = FindProperty ( kSmoothness , props ) ;
maskMap = FindProperty ( kMaskMap , props ) ;
specularOcclusionMap = FindProperty ( kSpecularOcclusionMap , props ) ;
horizonFade = FindProperty ( kHorizonFade , props ) ;
normalMap = FindProperty ( kNormalMap , props ) ;
normalMapOS = FindProperty ( kNormalMapOS , props ) ;
normalScale = FindProperty ( kNormalScale , props ) ;
normalMapSpace = FindProperty ( kNormalMapSpace , props ) ;
heightMap = FindProperty ( kHeightMap , props ) ;
heightAmplitude = FindProperty ( kHeightAmplitude , props ) ;
heightCenter = FindProperty ( kHeightCenter , props ) ;
// Anisotropy
specularColor = FindProperty ( kSpecularColor , props ) ;
specularColorMap = FindProperty ( kSpecularColorMap , props ) ;
// Details
UVDetail = FindProperty ( kUVDetail , props ) ;
UVDetailsMappingMask = FindProperty ( kUVDetailsMappingMask , props ) ;
detailMap = FindProperty ( kDetailMap , props ) ;
detailMask = FindProperty ( kDetailMask , props ) ;
detailAlbedoScale = FindProperty ( kDetailAlbedoScale , props ) ;
detailNormalScale = FindProperty ( kDetailNormalScale , props ) ;
detailSmoothnessScale = FindProperty ( kDetailSmoothnessScale , props ) ;
// Sub surface
subsurfaceProfileID = FindProperty ( kSubsurfaceProfileID , props ) ;
// clear coat
coatCoverage = FindProperty ( kCoatCoverage , props ) ;
coatIOR = FindProperty ( kCoatIOR , props ) ;
// Emissive
emissiveColorMode = FindProperty ( kEmissiveColorMode , props ) ;
emissiveColor = FindProperty ( kEmissiveColor , props ) ;
emissiveColorMap = FindProperty ( kEmissiveColorMap , props ) ;
emissiveIntensity = FindProperty ( kEmissiveIntensity , props ) ;
}
protected void ShaderSSSInputGUI ( Material material )
protected void ShaderAnisoInputGUI ( )
{
if ( ( NormalMapSpace ) normalMapSpace . floatValue = = NormalMapSpace . TangentSpace )
if ( ( NormalMapSpace ) normalMapSpace [ 0 ] . floatValue = = NormalMapSpace . TangentSpace )
{
m_MaterialEditor . TexturePropertySingleLine ( Styles . tangentMapText , tangentMap ) ;
}
m_MaterialEditor . TexturePropertySingleLine ( Styles . anisotropyMapText , anisotropyMap ) ;
}
protected override void MaterialPropertiesGUI ( Material material )
protected void DoLayerGUI ( Material material , bool useEmissiveMask , int layerIndex )
bool useEmissiveMask = ( EmissiveColorMode ) emissiveColorMode . floatValue = = EmissiveColorMode . UseEmissiveMask ;
GUILayout . Label ( Styles . InputsText , EditorStyles . boldLabel ) ;
EditorGUILayout . LabelField ( Styles . InputsText , EditorStyles . boldLabel ) ;
m_MaterialEditor . TexturePropertySingleLine ( Styles . baseColorText , baseColorMap , baseColor ) ;
m_MaterialEditor . TexturePropertySingleLine ( Styles . baseColorText , baseColorMap [ layerIndex ] , baseColor [ layerIndex ] ) ;
if ( ( Lit . MaterialId ) materialID . floatValue = = Lit . MaterialId . LitStandard | | ( Lit . MaterialId ) materialID . floatValue = = Lit . MaterialId . LitAniso )
if ( materialID = = null | | // Will be the case for Layered materials where we only support standard and the parameter does not exist
( Lit . MaterialId ) materialID . floatValue = = Lit . MaterialId . LitStandard | | ( Lit . MaterialId ) materialID . floatValue = = Lit . MaterialId . LitAniso )
m_MaterialEditor . ShaderProperty ( metallic , Styles . metallicText ) ;
m_MaterialEditor . ShaderProperty ( metallic [ layerIndex ] , Styles . metallicText ) ;
m_MaterialEditor . ShaderProperty ( smoothness , Styles . smoothnessText ) ;
m_MaterialEditor . ShaderProperty ( smoothness [ layerIndex ] , Styles . smoothnessText ) ;
m_MaterialEditor . TexturePropertySingleLine ( Styles . maskMapESText , maskMap ) ;
m_MaterialEditor . TexturePropertySingleLine ( Styles . maskMapESText , maskMap [ layerIndex ] ) ;
m_MaterialEditor . TexturePropertySingleLine ( Styles . maskMapSText , maskMap ) ;
m_MaterialEditor . TexturePropertySingleLine ( Styles . maskMapSText , maskMap [ layerIndex ] ) ;
m_MaterialEditor . TexturePropertySingleLine ( Styles . specularOcclusionMapText , specularOcclusionMap ) ;
m_MaterialEditor . ShaderProperty ( horizonFade , Styles . horizonFadeText ) ;
m_MaterialEditor . TexturePropertySingleLine ( Styles . specularOcclusionMapText , specularOcclusionMap [ layerIndex ] ) ;
m_MaterialEditor . ShaderProperty ( normalMapSpace , Styles . normalMapSpaceText ) ;
m_MaterialEditor . ShaderProperty ( normalMapSpace [ layerIndex ] , Styles . normalMapSpaceText ) ;
if ( ( NormalMapSpace ) normalMapSpace . floatValue = = NormalMapSpace . ObjectSpace & & ( ( UVBaseMapping ) UVBase . floatValue = = UVBaseMapping . Triplanar ) )
if ( ( NormalMapSpace ) normalMapSpace [ layerIndex ] . floatValue = = NormalMapSpace . ObjectSpace & & ( ( UVBaseMapping ) UVBase [ layerIndex ] . floatValue = = UVBaseMapping . Triplanar ) )
{
EditorGUILayout . HelpBox ( Styles . normalMapSpaceWarning . text , MessageType . Error ) ;
}
// 2. to avoid the warning that ask to fix the object normal map texture (normalOS are just linear RGB texture
if ( ( NormalMapSpace ) normalMapSpace . floatValue = = NormalMapSpace . TangentSpace )
if ( ( NormalMapSpace ) normalMapSpace [ layerIndex ] . floatValue = = NormalMapSpace . TangentSpace )
m_MaterialEditor . TexturePropertySingleLine ( Styles . normalMapText , normalMap , normalScale ) ;
m_MaterialEditor . TexturePropertySingleLine ( Styles . normalMapText , normalMap [ layerIndex ] , normalScale [ layerIndex ] ) ;
m_MaterialEditor . TexturePropertySingleLine ( Styles . normalMapOSText , normalMapOS ) ;
m_MaterialEditor . TexturePropertySingleLine ( Styles . normalMapOSText , normalMapOS [ layerIndex ] ) ;
m_MaterialEditor . TexturePropertySingleLine ( Styles . heightMapText , heightMap ) ;
if ( ! heightMap . hasMixedValue & & heightMap . textureValue ! = null )
m_MaterialEditor . TexturePropertySingleLine ( Styles . heightMapText , heightMap [ layerIndex ] ) ;
if ( ! heightMap [ layerIndex ] . hasMixedValue & & heightMap [ layerIndex ] . textureValue ! = null )
m_MaterialEditor . ShaderProperty ( heightAmplitude , Styles . heightMapAmplitudeText ) ;
heightAmplitude . floatValue = Math . Max ( 0.0f , heightAmplitude . floatValue ) ; // Must be positive
m_MaterialEditor . ShaderProperty ( heightCenter , Styles . heightMapCenterText ) ;
m_MaterialEditor . ShaderProperty ( heightAmplitude [ layerIndex ] , Styles . heightMapAmplitudeText ) ;
heightAmplitude [ layerIndex ] . floatValue = Math . Max ( 0.0f , heightAmplitude [ layerIndex ] . floatValue ) ; // Must be positive
m_MaterialEditor . ShaderProperty ( heightCenter [ layerIndex ] , Styles . heightMapCenterText ) ;
if ( materialID ! = null )
{
switch ( ( Lit . MaterialId ) materialID . floatValue )
{
case Lit . MaterialId . LitSSS :
Debug . Assert ( false , "Encountered an unsupported MaterialID." ) ;
break ;
}
}
GUILayout . Label ( " " + Styles . textureControlText , EditorStyles . label ) ;
m_MaterialEditor . ShaderProperty ( UVBase , Styles . UVBaseMappingText ) ;
EditorGUILayout . LabelField ( Styles . textureControlText , EditorStyles . label ) ;
m_MaterialEditor . ShaderProperty ( UVBase [ layerIndex ] , Styles . UVBaseMappingText ) ;
UVMappingMask . colorValue = new Color ( 1.0f , 0.0f , 0.0f , 0.0f ) ; // This is override in the shader anyway but just in case.
if ( ( ( UVBaseMapping ) UVBase . floatValue = = UVBaseMapping . Planar ) | | ( ( UVBaseMapping ) UVBase . floatValue = = UVBaseMapping . Triplanar ) )
UVMappingMask [ layerIndex ] . colorValue = new Color ( 1.0f , 0.0f , 0.0f , 0.0f ) ; // This is override in the shader anyway but just in case.
if ( ( ( UVBaseMapping ) UVBase [ layerIndex ] . floatValue = = UVBaseMapping . Planar ) | | ( ( UVBaseMapping ) UVBase [ layerIndex ] . floatValue = = UVBaseMapping . Triplanar ) )
m_MaterialEditor . ShaderProperty ( TexWorldScale , Styles . texWorldScaleText ) ;
m_MaterialEditor . ShaderProperty ( TexWorldScale [ layerIndex ] , Styles . texWorldScaleText ) ;
m_MaterialEditor . TextureScaleOffsetProperty ( baseColorMap ) ;
m_MaterialEditor . TextureScaleOffsetProperty ( baseColorMap [ layerIndex ] ) ;
EditorGUI . indentLevel - - ;
GUILayout . Label ( Styles . detailText , EditorStyles . boldLabel ) ;
m_MaterialEditor . TexturePropertySingleLine ( Styles . detailMaskText , detailMask ) ;
m_MaterialEditor . TexturePropertySingleLine ( Styles . detailMapNormalText , detailMap ) ;
EditorGUILayout . LabelField ( Styles . detailText , EditorStyles . boldLabel ) ;
m_MaterialEditor . TexturePropertySingleLine ( Styles . detailMaskText , detailMask [ layerIndex ] ) ;
m_MaterialEditor . TexturePropertySingleLine ( Styles . detailMapNormalText , detailMap [ layerIndex ] ) ;
if ( ( UVBaseMapping ) UVBase . floatValue = = UVBaseMapping . UV0 )
if ( ( UVBaseMapping ) UVBase [ layerIndex ] . floatValue = = UVBaseMapping . UV0 )
m_MaterialEditor . ShaderProperty ( UVDetail , Styles . UVDetailMappingText ) ;
m_MaterialEditor . ShaderProperty ( UVDetail [ layerIndex ] , Styles . UVDetailMappingText ) ;
else if ( ( UVBaseMapping ) UVBase . floatValue = = UVBaseMapping . Planar )
else if ( ( UVBaseMapping ) UVBase [ layerIndex ] . floatValue = = UVBaseMapping . Planar )
GUILayout . Label ( " " + Styles . UVDetailMappingText . text + ": Planar" ) ;
EditorGUILayout . LabelField ( Styles . UVDetailMappingText . text + ": Planar" ) ;
else if ( ( UVBaseMapping ) UVBase . floatValue = = UVBaseMapping . Triplanar )
else if ( ( UVBaseMapping ) UVBase [ layerIndex ] . floatValue = = UVBaseMapping . Triplanar )
GUILayout . Label ( " " + Styles . UVDetailMappingText . text + ": Triplanar" ) ;
EditorGUILayout . LabelField ( Styles . UVDetailMappingText . text + ": Triplanar" ) ;
X = ( ( UVDetailMapping ) UVDetail . floatValue = = UVDetailMapping . UV0 ) ? 1.0f : 0.0f ;
Y = ( ( UVDetailMapping ) UVDetail . floatValue = = UVDetailMapping . UV1 ) ? 1.0f : 0.0f ;
Z = ( ( UVDetailMapping ) UVDetail . floatValue = = UVDetailMapping . UV2 ) ? 1.0f : 0.0f ;
W = ( ( UVDetailMapping ) UVDetail . floatValue = = UVDetailMapping . UV3 ) ? 1.0f : 0.0f ;
UVDetailsMappingMask . colorValue = new Color ( X , Y , Z , W ) ;
X = ( ( UVDetailMapping ) UVDetail [ layerIndex ] . floatValue = = UVDetailMapping . UV0 ) ? 1.0f : 0.0f ;
Y = ( ( UVDetailMapping ) UVDetail [ layerIndex ] . floatValue = = UVDetailMapping . UV1 ) ? 1.0f : 0.0f ;
Z = ( ( UVDetailMapping ) UVDetail [ layerIndex ] . floatValue = = UVDetailMapping . UV2 ) ? 1.0f : 0.0f ;
W = ( ( UVDetailMapping ) UVDetail [ layerIndex ] . floatValue = = UVDetailMapping . UV3 ) ? 1.0f : 0.0f ;
UVDetailsMappingMask [ layerIndex ] . colorValue = new Color ( X , Y , Z , W ) ;
m_MaterialEditor . TextureScaleOffsetProperty ( detailMap [ layerIndex ] ) ;
m_MaterialEditor . ShaderProperty ( detailAlbedoScale [ layerIndex ] , Styles . detailAlbedoScaleText ) ;
m_MaterialEditor . ShaderProperty ( detailNormalScale [ layerIndex ] , Styles . detailNormalScaleText ) ;
m_MaterialEditor . ShaderProperty ( detailSmoothnessScale [ layerIndex ] , Styles . detailSmoothnessScaleText ) ;
m_MaterialEditor . TextureScaleOffsetProperty ( detailMap ) ;
m_MaterialEditor . ShaderProperty ( detailAlbedoScale , Styles . detailAlbedoScaleText ) ;
m_MaterialEditor . ShaderProperty ( detailNormalScale , Styles . detailNormalScaleText ) ;
m_MaterialEditor . ShaderProperty ( detailSmoothnessScale , Styles . detailSmoothnessScaleText ) ;
}
protected override void MaterialPropertiesGUI ( Material material )
{
bool useEmissiveMask = ( EmissiveColorMode ) emissiveColorMode . floatValue = = EmissiveColorMode . UseEmissiveMask ;
DoLayerGUI ( material , useEmissiveMask , 0 ) ;
GUILayout . Label ( Styles . lightingText , EditorStyles . boldLabel ) ;
EditorGUILayout . LabelField ( Styles . lightingText , EditorStyles . boldLabel ) ;
EditorGUI . indentLevel + + ;
m_MaterialEditor . ShaderProperty ( emissiveColorMode , Styles . emissiveColorModeText ) ;
if ( ! useEmissiveMask )
m_MaterialEditor . ShaderProperty ( emissiveIntensity , Styles . emissiveIntensityText ) ;
EditorGUI . indentLevel - - ;
// The parent Base.ShaderPropertiesGUI will call DoEmissionArea
}