5 namespace droid.Runtime.Shaders.Experimental.Skybox_Shaders.Editor {
6 public class HorizonWithSunSkyboxInspector : MaterialEditor {
7 public override void OnInspectorGUI() {
8 this.serializedObject.Update();
11 EditorGUI.BeginChangeCheck();
13 GUILayout.Label(
"Background Parameters");
15 EditorGUILayout.Space();
17 this.ColorProperty(GetMaterialProperty(this.targets,
"_SkyColor1"),
"Top Color");
18 this.FloatProperty(GetMaterialProperty(this.targets,
"_SkyExponent1"),
"Exponential Factor");
20 EditorGUILayout.Space();
22 this.ColorProperty(GetMaterialProperty(this.targets,
"_SkyColor2"),
"Horizon Color");
24 EditorGUILayout.Space();
26 this.ColorProperty(GetMaterialProperty(this.targets,
"_SkyColor3"),
"Bottom Color");
27 this.FloatProperty(GetMaterialProperty(this.targets,
"_SkyExponent2"),
"Exponential Factor");
29 EditorGUILayout.Space();
31 this.FloatProperty(GetMaterialProperty(this.targets,
"_SkyIntensity"),
"Intensity");
33 EditorGUILayout.Space();
35 GUILayout.Label(
"Sun Parameters");
37 EditorGUILayout.Space();
39 this.ColorProperty(GetMaterialProperty(this.targets,
"_SunColor"),
"Color");
40 this.FloatProperty(GetMaterialProperty(this.targets,
"_SunIntensity"),
"Intensity");
42 EditorGUILayout.Space();
44 this.FloatProperty(GetMaterialProperty(this.targets,
"_SunAlpha"),
"Alpha");
45 this.FloatProperty(GetMaterialProperty(this.targets,
"_SunBeta"),
"Beta");
47 EditorGUILayout.Space();
49 var az = GetMaterialProperty(this.targets,
"_SunAzimuth");
50 var al = GetMaterialProperty(this.targets,
"_SunAltitude");
52 if (az.hasMixedValue || al.hasMixedValue) {
53 EditorGUILayout.HelpBox(
"Editing angles is disabled because they have mixed values.",
56 this.FloatProperty(az,
"Azimuth");
57 this.FloatProperty(al,
"Altitude");
60 if (EditorGUI.EndChangeCheck()) {
61 var raz = az.floatValue * Mathf.Deg2Rad;
62 var ral = al.floatValue * Mathf.Deg2Rad;
64 var up_vector =
new Vector4(Mathf.Cos(ral) * Mathf.Sin(raz),
66 Mathf.Cos(ral) * Mathf.Cos(raz),
68 GetMaterialProperty(this.targets,
"_SunVector").vectorValue = up_vector;
70 this.PropertiesChanged();