From 5b158af90739dcbb89c1538a6cb8c65a875dce80 Mon Sep 17 00:00:00 2001 From: chai Date: Thu, 26 Nov 2020 20:52:34 +0800 Subject: *misc --- .../Boxophobic.AtmosphericHeightFog.Editor.asmdef | 18 +++ ...ophobic.AtmosphericHeightFog.Editor.asmdef.meta | 7 + .../Core/Editor/HeightFogCreate.cs | 111 +++++++++++++++ .../Core/Editor/HeightFogCreate.cs.meta | 13 ++ .../Core/Editor/HeightFogGlobalInspector.cs | 46 ++++++ .../Core/Editor/HeightFogGlobalInspector.cs.meta | 11 ++ .../Core/Editor/HeightFogHub.cs | 158 +++++++++++++++++++++ .../Core/Editor/HeightFogHub.cs.meta | 12 ++ .../Core/Editor/HeightFogOverrideInspector.cs | 45 ++++++ .../Core/Editor/HeightFogOverrideInspector.cs.meta | 11 ++ .../Core/Editor/HeightFogShaderGUI.cs | 61 ++++++++ .../Core/Editor/HeightFogShaderGUI.cs.meta | 11 ++ .../Core/Editor/HeightFogWindows.cs | 41 ++++++ .../Core/Editor/HeightFogWindows.cs.meta | 11 ++ .../Core/Editor/Version.asset | 15 ++ .../Core/Editor/Version.asset.meta | 8 ++ 16 files changed, 579 insertions(+) create mode 100644 Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/Boxophobic.AtmosphericHeightFog.Editor.asmdef create mode 100644 Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/Boxophobic.AtmosphericHeightFog.Editor.asmdef.meta create mode 100644 Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogCreate.cs create mode 100644 Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogCreate.cs.meta create mode 100644 Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogGlobalInspector.cs create mode 100644 Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogGlobalInspector.cs.meta create mode 100644 Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogHub.cs create mode 100644 Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogHub.cs.meta create mode 100644 Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogOverrideInspector.cs create mode 100644 Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogOverrideInspector.cs.meta create mode 100644 Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogShaderGUI.cs create mode 100644 Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogShaderGUI.cs.meta create mode 100644 Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogWindows.cs create mode 100644 Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogWindows.cs.meta create mode 100644 Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/Version.asset create mode 100644 Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/Version.asset.meta (limited to 'Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor') diff --git a/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/Boxophobic.AtmosphericHeightFog.Editor.asmdef b/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/Boxophobic.AtmosphericHeightFog.Editor.asmdef new file mode 100644 index 00000000..ce3bc90c --- /dev/null +++ b/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/Boxophobic.AtmosphericHeightFog.Editor.asmdef @@ -0,0 +1,18 @@ +{ + "name": "Boxophobic.AtmosphericHeightFog.Editor", + "references": [ + "Boxophobic.Utils.Editor", + "Boxophobic.Utils.Scripts", + "Boxophobic.AtmosphericHeightFog.Runtime" + ], + "optionalUnityReferences": [], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [] +} \ No newline at end of file diff --git a/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/Boxophobic.AtmosphericHeightFog.Editor.asmdef.meta b/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/Boxophobic.AtmosphericHeightFog.Editor.asmdef.meta new file mode 100644 index 00000000..58c4c7ea --- /dev/null +++ b/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/Boxophobic.AtmosphericHeightFog.Editor.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 154764cb075aa0b4eb8b88ba5ca2617f +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogCreate.cs b/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogCreate.cs new file mode 100644 index 00000000..bc273fca --- /dev/null +++ b/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogCreate.cs @@ -0,0 +1,111 @@ +// Cristian Pop - https://boxophobic.com/ + +using UnityEditor; +using UnityEditor.SceneManagement; +using UnityEngine; + +namespace AtmosphericHeightFog +{ + public class HeightFogCreate + { + [MenuItem("GameObject/BOXOPHOBIC/Atmospheric Height Fog/Global", false, 9)] + static void CreateGlobalVolume() + { + if (GameObject.Find("Height Fog Global") != null) + { + Debug.Log("[Atmospheric Height Fog] " + "Height Fog Global is already added to your scene!"); + return; + } + + GameObject go = new GameObject(); + go.name = "Height Fog Global"; + go.AddComponent(); + + if (Selection.activeGameObject != null) + { + go.transform.parent = Selection.activeGameObject.transform; + } + + Selection.activeGameObject = go; + + EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene()); + } + + [MenuItem("GameObject/BOXOPHOBIC/Atmospheric Height Fog/Override Volume (Box)", false, 10)] + static void CreateOverrideBoxVolume() + { + if (GameObject.Find("Height Fog Global") == null) + { + Debug.Log("[Atmospheric Height Fog] " + "Height Fog Global must be added to the scene first!"); + return; + } + + GameObject go = new GameObject(); + go.name = "Height Fog Override (Box)"; + go.AddComponent(); + go.GetComponent().isTrigger = true; + go.AddComponent(); + + var sceneCamera = SceneView.lastActiveSceneView.camera; + + if (sceneCamera != null) + { + go.transform.position = sceneCamera.ViewportToWorldPoint(new Vector3(0.5f, 0.5f, 10f)); + } + else + { + go.transform.localPosition = Vector3.zero; + go.transform.localEulerAngles = Vector3.zero; + go.transform.localScale = Vector3.one; + } + + if (Selection.activeGameObject != null) + { + go.transform.parent = Selection.activeGameObject.transform; + } + + Selection.activeGameObject = go; + + EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene()); + } + + [MenuItem("GameObject/BOXOPHOBIC/Atmospheric Height Fog/Override Volume (Sphere)", false, 11)] + static void CreateOverrideSphereVolume() + { + if (GameObject.Find("Height Fog Global") == null) + { + Debug.Log("[Atmospheric Height Fog] " + "Height Fog Global must be added to the scene first!"); + return; + } + + GameObject go = new GameObject(); + go.name = "Height Fog Override (Sphere)"; + go.AddComponent(); + go.GetComponent().isTrigger = true; + go.AddComponent(); + + var sceneCamera = SceneView.lastActiveSceneView.camera; + + if (sceneCamera != null) + { + go.transform.position = sceneCamera.ViewportToWorldPoint(new Vector3(0.5f, 0.5f, 10f)); + } + else + { + go.transform.localPosition = Vector3.zero; + go.transform.localEulerAngles = Vector3.zero; + go.transform.localScale = Vector3.one; + } + + if (Selection.activeGameObject != null) + { + go.transform.parent = Selection.activeGameObject.transform; + } + + Selection.activeGameObject = go; + + EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene()); + } + } +} + diff --git a/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogCreate.cs.meta b/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogCreate.cs.meta new file mode 100644 index 00000000..5fd3fa0f --- /dev/null +++ b/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogCreate.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 272a11163456c6647affb81b9e5f31a4 +timeCreated: 1573480983 +licenseType: Store +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogGlobalInspector.cs b/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogGlobalInspector.cs new file mode 100644 index 00000000..65ff14aa --- /dev/null +++ b/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogGlobalInspector.cs @@ -0,0 +1,46 @@ +// Cristian Pop - https://boxophobic.com/ + +using UnityEditor; + +namespace AtmosphericHeightFog +{ + [CanEditMultipleObjects] + [CustomEditor(typeof(HeightFogGlobal))] + public class HeightFogGlobalInspector : Editor + { + readonly string[] scriptMode = { "m_Script", "presetMaterial", "presetDay", "presetNight", "timeOfDay" }; + readonly string[] presetMode = { "m_Script", "presetDay", "presetNight", "timeOfDay", "categoryFog", "fogIntensity", "fogAxisMode", "fogLayersMode", "fogColorStart", "fogColorEnd", "fogColorDuo", "fogDistanceStart", "fogDistanceEnd", "fogDistanceFalloff", "fogHeightStart", "fogHeightEnd", "fogHeightFalloff", "categorySkybox", "skyboxFogIntensity", "skyboxFogHeight", "skyboxFogFalloff", "skyboxFogFill", "categoryDirectional", "directionalIntensity", "directionalFalloff", "directionalColor", "categoryNoise", "noiseMode", "noiseIntensity", "noiseDistanceEnd", "noiseScale", "noiseSpeed" }; + readonly string[] timeOfDayMode = { "m_Script", "presetMaterial", "categoryFog", "fogIntensity", "fogAxisMode", "fogLayersMode", "fogColorStart", "fogColorEnd", "fogColorDuo", "fogDistanceStart", "fogDistanceEnd", "fogDistanceFalloff", "fogHeightStart", "fogHeightEnd", "fogHeightFalloff", "categorySkybox", "skyboxFogIntensity", "skyboxFogHeight", "skyboxFogFalloff", "skyboxFogFill", "categoryDirectional", "directionalIntensity", "directionalFalloff", "directionalColor", "categoryNoise", "noiseMode", "noiseIntensity", "noiseDistanceEnd", "noiseScale", "noiseSpeed" }; + HeightFogGlobal targetScript; + + void OnEnable() + { + targetScript = (HeightFogGlobal)target; + } + + public override void OnInspectorGUI() + { + DrawInspector(); + } + + void DrawInspector() + { + string[] exclude = scriptMode; + + if (targetScript.fogMode == FogMode.UsePresetSettings) + { + exclude = presetMode; + } + else if (targetScript.fogMode == FogMode.UseTimeOfDay) + { + exclude = timeOfDayMode; + } + + serializedObject.Update(); + + DrawPropertiesExcluding(serializedObject, exclude); + + serializedObject.ApplyModifiedProperties(); + } + } +} diff --git a/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogGlobalInspector.cs.meta b/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogGlobalInspector.cs.meta new file mode 100644 index 00000000..9dee906a --- /dev/null +++ b/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogGlobalInspector.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5742a0fb70ce25846bc3269f9cdcf0cc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogHub.cs b/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogHub.cs new file mode 100644 index 00000000..624b8446 --- /dev/null +++ b/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogHub.cs @@ -0,0 +1,158 @@ +// Cristian Pop - https://boxophobic.com/ + +using UnityEngine; +using UnityEditor; +using Boxophobic.StyledGUI; +using Boxophobic.Utils; +using System.IO; + +namespace AtmosphericHeightFog +{ + public class HeightFogHub : EditorWindow + { +#if UNITY_2019_3_OR_NEWER + const int GUI_HEIGHT = 18; +#else + const int GUI_HEIGHT = 14; +#endif + + string folderAsset = "Assets/BOXOPHOBIC/Atmospheric Height Fog"; + + string[] pipelinePaths; + string[] pipelineOptions; + string pipelinesPath; + int pipelineIndex; + + int assetVersion; + string bannerVersion; + + GUIStyle stylePopup; + + Color bannerColor; + string bannerText; + string helpURL; + static HeightFogHub window; + //Vector2 scrollPosition = Vector2.zero; + + [MenuItem("Window/BOXOPHOBIC/Atmospheric Height Fog/Hub", false, 1000)] + public static void ShowWindow() + { + window = GetWindow(false, "Atmospheric Height Fog", true); + window.minSize = new Vector2(389, 220); + } + + void OnEnable() + { + bannerColor = new Color(0.55f, 0.7f, 1f); + bannerText = "Atmospheric Height Fog"; + helpURL = "https://docs.google.com/document/d/1pIzIHIZ-cSh2ykODSZCbAPtScJ4Jpuu7lS3rNEHCLbc/edit#heading=h.hbq3w8ae720x"; + + //Safer search, there might be many user folders + string[] searchFolders; + + searchFolders = AssetDatabase.FindAssets("Atmospheric Height Fog"); + + for (int i = 0; i < searchFolders.Length; i++) + { + if (AssetDatabase.GUIDToAssetPath(searchFolders[i]).EndsWith("Atmospheric Height Fog.pdf")) + { + folderAsset = AssetDatabase.GUIDToAssetPath(searchFolders[i]); + folderAsset = folderAsset.Replace("/Atmospheric Height Fog.pdf", ""); + } + } + + pipelinesPath = folderAsset + "/Core/Pipelines"; + + GetPackages(); + + assetVersion = SettingsUtils.LoadSettingsData(folderAsset + "/Core/Editor/Version.asset", -99); + bannerVersion = assetVersion.ToString(); + bannerVersion = bannerVersion.Insert(1, "."); + bannerVersion = bannerVersion.Insert(3, "."); + + bannerColor = new Color(0.55f, 0.7f, 1f); + bannerText = "Atmospheric Height Fog " + bannerVersion; + } + + void OnGUI() + { + SetGUIStyles(); + + StyledGUI.DrawWindowBanner(bannerColor, bannerText, helpURL); + + GUILayout.BeginHorizontal(); + GUILayout.Space(20); + + GUILayout.BeginVertical(); + + //scrollPosition = GUILayout.BeginScrollView(scrollPosition, false, false, GUILayout.Width(this.position.width - 28), GUILayout.Height(this.position.height - 80)); + + EditorGUILayout.HelpBox("Click the Import Render Pipeline to switch to another render pipeline. For Universal Render Pipeline, follow the instructions below to enable the fog rendering!", MessageType.Info, true); + + if (pipelineOptions[pipelineIndex].Contains("Universal 7.1.8")) + { + EditorGUILayout.HelpBox("For Universal 7.1.8+ Pipeline, Depth Texture and one of the following features need to be enabled for the depth to work properly: Opaque Texure, HDR or Post Processing!", MessageType.Info, true); + } + + if (pipelineOptions[pipelineIndex].Contains("Universal 7.4.1")) + { + EditorGUILayout.HelpBox("For Universal 7.4.1+ Pipeline, Depth Texture need to be enabled on the render pipeline asset!", MessageType.Info, true); + } + + DrawInterface(); + + //GUILayout.EndScrollView(); + + GUILayout.EndVertical(); + + GUILayout.Space(13); + GUILayout.EndHorizontal(); + } + + void SetGUIStyles() + { + stylePopup = new GUIStyle(EditorStyles.popup) + { + alignment = TextAnchor.MiddleCenter + }; + } + + void DrawInterface() + { + GUILayout.Space(10); + + GUILayout.BeginHorizontal(); + EditorGUILayout.LabelField(new GUIContent("Render Pipeline", ""), GUILayout.Width(220)); + pipelineIndex = EditorGUILayout.Popup(pipelineIndex, pipelineOptions, stylePopup); + if (GUILayout.Button("Import", GUILayout.Width(80), GUILayout.Height(GUI_HEIGHT))) + { + ImportPackage(); + + GUIUtility.ExitGUI(); + } + GUILayout.EndHorizontal(); + } + + void GetPackages() + { + pipelinePaths = Directory.GetFiles(pipelinesPath, "*.unitypackage", SearchOption.TopDirectoryOnly); + + pipelineOptions = new string[pipelinePaths.Length]; + + for (int i = 0; i < pipelineOptions.Length; i++) + { + pipelineOptions[i] = Path.GetFileNameWithoutExtension(pipelinePaths[i].Replace("Built-in Pipeline", "Standard")); + } + } + + void ImportPackage() + { + AssetDatabase.ImportPackage(pipelinePaths[pipelineIndex], true); + AssetDatabase.SaveAssets(); + AssetDatabase.Refresh(); + + Debug.Log("[Atmospheric Height Fog] " + pipelineOptions[pipelineIndex] + " package imported in your project!"); + } + } +} + diff --git a/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogHub.cs.meta b/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogHub.cs.meta new file mode 100644 index 00000000..6a7dc147 --- /dev/null +++ b/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogHub.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 094779c9d6df2bd478d3045d5a486647 +timeCreated: 1538943308 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogOverrideInspector.cs b/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogOverrideInspector.cs new file mode 100644 index 00000000..3de6f79a --- /dev/null +++ b/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogOverrideInspector.cs @@ -0,0 +1,45 @@ + +using UnityEditor; + +namespace AtmosphericHeightFog +{ + [CanEditMultipleObjects] + [CustomEditor(typeof(HeightFogOverride))] + public class HeightFogOverrideInspector : Editor + { + readonly string[] scriptMode = { "m_Script", "presetMaterial", "presetDay", "presetNight", "timeOfDay" }; + readonly string[] presetMode = { "m_Script", "presetDay", "presetNight", "timeOfDay", "categoryFog", "fogIntensity", "fogAxisMode", "fogLayersMode", "fogColorStart", "fogColorEnd", "fogColorDuo", "fogDistanceStart", "fogDistanceEnd", "fogDistanceFalloff", "fogHeightStart", "fogHeightEnd", "fogHeightFalloff", "categorySkybox", "skyboxFogIntensity", "skyboxFogHeight", "skyboxFogFalloff", "skyboxFogFill", "categoryDirectional", "directionalIntensity", "directionalFalloff", "directionalColor", "categoryNoise", "noiseMode", "noiseIntensity", "noiseDistanceEnd", "noiseScale", "noiseSpeed" }; + readonly string[] timeOfDayMode = { "m_Script", "presetMaterial", "categoryFog", "fogIntensity", "fogAxisMode", "fogLayersMode", "fogColorStart", "fogColorEnd", "fogColorDuo", "fogDistanceStart", "fogDistanceEnd", "fogDistanceFalloff", "fogHeightStart", "fogHeightEnd", "fogHeightFalloff", "categorySkybox", "skyboxFogIntensity", "skyboxFogHeight", "skyboxFogFalloff", "skyboxFogFill", "categoryDirectional", "directionalIntensity", "directionalFalloff", "directionalColor", "categoryNoise", "noiseMode", "noiseIntensity", "noiseDistanceEnd", "noiseScale", "noiseSpeed" }; + HeightFogOverride targetScript; + + void OnEnable() + { + targetScript = (HeightFogOverride)target; + } + + public override void OnInspectorGUI() + { + DrawInspector(); + } + + void DrawInspector() + { + string[] exclude = scriptMode; + + if (targetScript.fogMode == FogMode.UsePresetSettings) + { + exclude = presetMode; + } + else if (targetScript.fogMode == FogMode.UseTimeOfDay) + { + exclude = timeOfDayMode; + } + + serializedObject.Update(); + + DrawPropertiesExcluding(serializedObject, exclude); + + serializedObject.ApplyModifiedProperties(); + } + } +} diff --git a/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogOverrideInspector.cs.meta b/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogOverrideInspector.cs.meta new file mode 100644 index 00000000..296414df --- /dev/null +++ b/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogOverrideInspector.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4fd498d1bc844c447b1f09b2d746282e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogShaderGUI.cs b/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogShaderGUI.cs new file mode 100644 index 00000000..91252ba1 --- /dev/null +++ b/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogShaderGUI.cs @@ -0,0 +1,61 @@ +//Cristian Pop - https://boxophobic.com/ + +using UnityEngine; +using UnityEditor; + +public class HeightFogShaderGUI : ShaderGUI +{ + Material material; + + public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props) + { + base.OnGUI(materialEditor, props); + + material = materialEditor.target as Material; + + SetBlendProps(); + } + + void SetBlendProps() + { + if (material.HasProperty("_FogAxisMode")) + { + if (material.GetInt("_FogAxisMode") == 0) + { + material.SetVector("_FogAxisOption", new Vector4(1, 0, 0, 0)); + } + else if (material.GetInt("_FogAxisMode") == 1) + { + material.SetVector("_FogAxisOption", new Vector4(0, 1, 0, 0)); + } + else if (material.GetInt("_FogAxisMode") == 2) + { + material.SetVector("_FogAxisOption", new Vector4(0, 0, 1, 0)); + } + } + + if (material.HasProperty("_DirectionalMode")) + { + if (material.GetInt("_DirectionalMode") == 0) + { + material.SetFloat("_DirectionalModeBlend", 0.0f); + } + else if (material.GetInt("_DirectionalMode") == 1) + { + material.SetFloat("_DirectionalModeBlend", 1.0f); + } + } + + if (material.HasProperty("_NoiseMode")) + { + if (material.GetInt("_NoiseMode") == 0) + { + material.SetFloat("_NoiseModeBlend", 0.0f); + } + else if (material.GetInt("_NoiseMode") == 2) + { + material.SetFloat("_NoiseModeBlend", 1.0f); + } + } + } +} diff --git a/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogShaderGUI.cs.meta b/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogShaderGUI.cs.meta new file mode 100644 index 00000000..cd445575 --- /dev/null +++ b/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogShaderGUI.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fefeae948a42a964faad5fe6c75c59de +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogWindows.cs b/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogWindows.cs new file mode 100644 index 00000000..bb6b0e2b --- /dev/null +++ b/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogWindows.cs @@ -0,0 +1,41 @@ +using UnityEditor; +using UnityEngine; + +namespace AtmosphericHeightFog +{ + public static class HeightFogWindows + { + + [MenuItem("Window/BOXOPHOBIC/Atmospheric Height Fog/Publisher Page", false, 2000)] + public static void MoreAssets() + { + Application.OpenURL("https://assetstore.unity.com/publishers/20529"); + } + + [MenuItem("Window/BOXOPHOBIC/Atmospheric Height Fog/Discord Server", false, 2001)] + public static void Discord() + { + Application.OpenURL("https://discord.com/invite/znxuXET"); + } + + [MenuItem("Window/BOXOPHOBIC/Atmospheric Height Fog/Documentation", false, 2002)] + public static void Documentation() + { + Application.OpenURL("https://docs.google.com/document/d/1pIzIHIZ-cSh2ykODSZCbAPtScJ4Jpuu7lS3rNEHCLbc/edit#"); + } + + [MenuItem("Window/BOXOPHOBIC/Atmospheric Height Fog/Changelog", false, 2003)] + public static void Chnagelog() + { + Application.OpenURL("https://docs.google.com/document/d/1pIzIHIZ-cSh2ykODSZCbAPtScJ4Jpuu7lS3rNEHCLbc/edit#heading=h.1rbujejuzjce"); + } + + [MenuItem("Window/BOXOPHOBIC/Atmospheric Height Fog/Write A Review", false, 3001)] + public static void WriteAReview() + { + Application.OpenURL("https://assetstore.unity.com/packages/vfx/shaders/fullscreen-camera-effects/atmospheric-height-fog-optimized-fog-shaders-for-consoles-mobile-143825#reviews"); + } + } +} + + diff --git a/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogWindows.cs.meta b/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogWindows.cs.meta new file mode 100644 index 00000000..48557f75 --- /dev/null +++ b/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/HeightFogWindows.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5fcdedd08e41e034790d1fa393bcb67e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/Version.asset b/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/Version.asset new file mode 100644 index 00000000..d45e51c2 --- /dev/null +++ b/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/Version.asset @@ -0,0 +1,15 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 93308045fbb3c5e42ba5ccb66d848632, type: 3} + m_Name: Version + m_EditorClassIdentifier: + data: 181 diff --git a/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/Version.asset.meta b/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/Version.asset.meta new file mode 100644 index 00000000..ccb072a9 --- /dev/null +++ b/Assets/BOXOPHOBIC/Atmospheric Height Fog/Core/Editor/Version.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 41b457a34c9fb7f45a332c79a90945b5 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: -- cgit v1.1-26-g67d0