You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

38 lines
1.7 KiB

using UnityEngine;
using UnityEngine.Rendering.HighDefinition;
namespace UnityEditor.Rendering.HighDefinition
{
/// <summary>
/// Material GUI for TerrainLit ShaderGraph
/// </summary>
internal class TerrainLitShaderGraphGUI : HDShaderGUI, ITerrainLayerCustomUI
{
const SurfaceOptionUIBlock.Features surfaceOptionFeatures = SurfaceOptionUIBlock.Features.Unlit | SurfaceOptionUIBlock.Features.ReceiveDecal | SurfaceOptionUIBlock.Features.AlphaCutoff;
const AdvancedOptionsUIBlock.Features advancedOptionsFeatures = AdvancedOptionsUIBlock.Features.Instancing;
protected MaterialUIBlockList uiBlocks = new MaterialUIBlockList
{
new SurfaceOptionUIBlock(MaterialUIBlock.ExpandableBit.Base, features: surfaceOptionFeatures),
new TerrainSurfaceOptionsUIBlock(MaterialUIBlock.ExpandableBit.Other),
new ShaderGraphUIBlock(MaterialUIBlock.ExpandableBit.ShaderGraph),
new AdvancedOptionsUIBlock(MaterialUIBlock.ExpandableBit.Advance, features: advancedOptionsFeatures),
};
protected override void OnMaterialGUI(MaterialEditor materialEditor, MaterialProperty[] props)
{
uiBlocks.OnGUI(materialEditor, props);
}
bool ITerrainLayerCustomUI.OnTerrainLayerGUI(TerrainLayer terrainLayer, Terrain terrain)
{
var terrainSurfaceOptions = uiBlocks.FetchUIBlock<TerrainSurfaceOptionsUIBlock>();
if (terrainSurfaceOptions == null)
return false;
return terrainSurfaceOptions.OnTerrainLayerGUI(terrainLayer, terrain);
}
public override void ValidateMaterial(Material material) => TerrainLitAPI.ValidateMaterial(material);
}
}