public readonly GUIContent layerMapMaskText = new GUIContent ( "Layer Mask" , "Layer mask" ) ;
public readonly GUIContent enableHeightBlending = new GUIContent ( "Enable Height Blending" , "Enables layer blending using heightmaps." ) ;
public readonly GUIContent heightTransition = new GUIContent ( "Height Transition" , "Size in world units of the smooth transition between layers." ) ;
public readonly GUIContent enableInstancedPerPixelNormal = new GUIContent ( "Enable Per-pixel Normal" , "Enable per-pixel normal when the terrain uses instanced rendering." ) ;
}
static StylesLayer s_Styles = null ;
MaterialProperty heightTransition = null ;
const string kHeightTransition = "_HeightTransition" ;
MaterialProperty enableInstancedPerPixelNormal = null ;
const string kEnableInstancedPerPixelNormal = "_EnableInstancedPerPixelNormal" ;
protected override void FindMaterialProperties ( MaterialProperty [ ] props )
{
enableHeightBlending = FindProperty ( kEnableHeightBlending , props , false ) ;
// Density/opacity mode
opacityAsDensity [ i ] = FindProperty ( string . Format ( "{0}{1}" , kOpacityAsDensity , i ) , props ) ;
}
enableInstancedPerPixelNormal = FindProperty ( kEnableInstancedPerPixelNormal , props , false ) ;
}
// We use the user data to save a string that represent the referenced lit material
// TODO: planar/triplannar supprt
//SetupLayersMappingKeywords(material);
bool enableInstancedPerPixelNormal = material . GetFloat ( kEnableInstancedPerPixelNormal ) > 0.0f ;
CoreUtils . SetKeyword ( material , "_TERRAIN_INSTANCED_PERPIXEL_NORMAL" , enableInstancedPerPixelNormal ) ;
}
public override void OnGUI ( MaterialEditor materialEditor , MaterialProperty [ ] props )
}
bool layerChanged = DoLayersGUI ( materialImporter ) ;
bool enablePerPixelNormalChanged = false ;
EditorGUILayout . Space ( ) ;
EditorGUILayout . LabelField ( StylesBaseUnlit . advancedText , EditorStyles . boldLabel ) ;
if ( m_MaterialEditor . IsInstancingEnabled ( ) )
{
EditorGUI . indentLevel + + ;
EditorGUI . BeginChangeCheck ( ) ;
m_MaterialEditor . ShaderProperty ( enableInstancedPerPixelNormal , styles . enableInstancedPerPixelNormal ) ;
enablePerPixelNormalChanged = EditorGUI . EndChangeCheck ( ) ;
EditorGUI . indentLevel - - ;
}
if ( layerChanged | | optionsChanged )
if ( layerChanged | | optionsChanged | | enablePerPixelNormalChanged )
{
foreach ( var obj in m_MaterialEditor . targets )
{