63 lines
1.6 KiB
C#
63 lines
1.6 KiB
C#
using GISTech.GISTerrainLoader;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class UpdateTerrainShader : MonoBehaviour
|
|
{
|
|
public GISTerrainContainer container;
|
|
|
|
public Dropdown ShadersInput;
|
|
|
|
public Slider ContourInterval;
|
|
|
|
public Slider ContourLineWidth;
|
|
|
|
public Text IntervalValue;
|
|
|
|
public Text LineWidthValue;
|
|
|
|
private float ContourIntervalValue = 10f;
|
|
|
|
private float ContourLineWidthValue = 0.017f;
|
|
|
|
private void Start()
|
|
{
|
|
ShadersInput.onValueChanged.AddListener(OnTerrainShaderChanged);
|
|
ContourInterval.onValueChanged.AddListener(OnTerrainContourIntervalChanged);
|
|
ContourLineWidth.onValueChanged.AddListener(OnTerrainContourLineWidthChanged);
|
|
}
|
|
|
|
private void OnTerrainShaderChanged(int index)
|
|
{
|
|
container.UpdateTerrainMaterial((TerrainMaterialMode)index);
|
|
if (index == 2)
|
|
{
|
|
ContourInterval.gameObject.SetActive(value: true);
|
|
ContourLineWidth.gameObject.SetActive(value: true);
|
|
}
|
|
else
|
|
{
|
|
ContourInterval.gameObject.SetActive(value: false);
|
|
ContourLineWidth.gameObject.SetActive(value: false);
|
|
}
|
|
}
|
|
|
|
private void OnTerrainContourIntervalChanged(float value)
|
|
{
|
|
ContourIntervalValue = value;
|
|
container.UpdateTerrainMaterial((TerrainMaterialMode)ShadersInput.value, ContourIntervalValue);
|
|
IntervalValue.text = Mathf.Round(ContourIntervalValue) + " [m]";
|
|
}
|
|
|
|
private void OnTerrainContourLineWidthChanged(float value)
|
|
{
|
|
ContourLineWidthValue = value;
|
|
container.UpdateTerrainMaterial((TerrainMaterialMode)ShadersInput.value, ContourIntervalValue, ContourLineWidthValue);
|
|
LineWidthValue.text = Mathf.Round(ContourLineWidthValue).ToString();
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
}
|
|
}
|