private static HBAO StackPostFXOnTop() { Camera camera = Camera.main; if (camera == null) { camera = FindObjectOfType <Camera>(); } if (camera == null) { EditorUtility.DisplayDialog("OOPS!", "Could not find camera to add camera effects to. Please add a camera to your scene.", "OK"); return(null); } // add HBAO to camera HBAO hbao = camera.GetComponent <HBAO>(); if (hbao != null) { DestroyImmediate(hbao); } hbao = camera.gameObject.AddComponent <HBAO>(); // stack it on top while (camera.GetComponents <MonoBehaviour>()[0] != hbao) { UnityEditorInternal.ComponentUtility.MoveComponentUp(hbao); } return(hbao); }
void OnEnable() { m_HBAO = (HBAO)target; m_HBAOTex = Resources.Load <Texture2D>("hbao"); var settingsGroups = typeof(HBAO).GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance) .Where(x => x.GetCustomAttributes(typeof(HBAO.SettingsGroup), false).Any()); foreach (var group in settingsGroups) { foreach (var setting in group.FieldType.GetFields(BindingFlags.Instance | BindingFlags.Public)) { if (!m_GroupFields.ContainsKey(group)) { m_GroupFields[group] = new List <SerializedProperty>(); } var property = serializedObject.FindProperty(group.Name + "." + setting.Name); if (property != null) { m_GroupFields[group].Add(property); } } } m_SelectedPreset = m_Presets.Values.ToList().IndexOf(m_HBAO.presets.preset); }
private void OnEnable() { this.MyCamera = base.gameObject.GetComponent <Camera>(); this.frostEffect = base.GetComponent <Frost>(); this.ScionStuff = base.GetComponent <ScionPostProcess>(); this.bleedEffect = base.GetComponent <BleedBehavior>(); this.aa_FXAA = base.GetComponent <FXAA>(); this.aa_SMAA = base.GetComponent <SMAA>(); this.amplifyMotion = base.GetComponent <AmplifyMotionEffect>(); this.sessao = base.GetComponent <SESSAO>(); this.hbao = base.GetComponent <HBAO>(); this.waterViz = base.gameObject.GetComponent <WaterViz>(); this.waterBlur = base.gameObject.GetComponent <WaterBlurEffect>(); this.waterBlurCeto = base.gameObject.GetComponent <UnderWaterPostEffect>(); this.farShadowCascade = base.gameObject.GetComponent <FarShadowCascade>(); if (Sunshine.Instance) { this.SunshineOccluders = Sunshine.Instance.Occluders; } this.reflexionMode_complex = LayerMask.GetMask(new string[] { "Camera", "Ignore Raycast" }); this.reflexionMode_simple = LayerMask.GetMask(new string[] { "Camera" }); this.reflexionMode_off = 0; }
private static void MarkDirty(HBAO hbao) { EditorUtility.SetDirty(hbao); if (!EditorApplication.isPlaying) { UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(UnityEngine.SceneManagement.SceneManager.GetActiveScene()); } }
public static void GX_Presets_HighestQuality() { HBAO hbao = StackPostFXOnTop(); if (hbao != null) { hbao.ApplyPreset(HBAO.Preset.HighestQuality); MarkDirty(hbao); } }
public static void GX_Presets_Normal() { HBAO hbao = StackPostFXOnTop(); if (hbao != null) { hbao.ApplyPreset(HBAO.Preset.Normal); MarkDirty(hbao); } }
public static void GX_Presets_FastPerformance() { HBAO hbao = StackPostFXOnTop(); if (hbao != null) { hbao.ApplyPreset(HBAO.Preset.FastPerformance); MarkDirty(hbao); } }
private static void MarkDirty(HBAO hbao) { EditorUtility.SetDirty(hbao); if (!EditorApplication.isPlaying) { #if (UNITY_5_2 || UNITY_5_1 || UNITY_5_0) EditorApplication.MarkSceneDirty(); #else UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(UnityEngine.SceneManagement.SceneManager.GetActiveScene()); #endif } }
// Use this for initialization private void Awake() { amp = GetComponent <AmplifyMotionEffect>(); hb = GetComponent <HBAO>(); mad = GetComponent <MadGoat_SSAA.MadGoatSSAA>(); int level = QualitySettings.GetQualityLevel(); if (level < 4) { mad.enabled = false; hb.enabled = false; } if (level < 3) { amp.enabled = false; } }
public string _initialize(string seed) { if (String.IsNullOrEmpty(seed)) { if (String.IsNullOrEmpty(randomWord)) { seed = GameUtils.GenerateSeed(5).Trim(); } else { seed = randomWord; } } else { seed = seed.ToUpper().Trim(); } int n; if (int.TryParse(seed, out n)) { UnityEngine.Random.InitState(n); } else { UnityEngine.Random.InitState(seed.GetHashCode()); } // these two must happen before anything else kicks off GameUtils.SetHash(); GameUtils.CreateSeedTable(); // start generating world parameters NoiseConfig.Initialize(); ColorFactory.GeneratePalette(); Blocks.Initialize(); cosmos.CreateSky(); World.Seed = seed; Serialization.Decompress(); // These populate the object pools ChunkData.SetLoadOrder(); World.Spawn.Initialize(firstRun); // Initialize graphics edgeDetect.enabled = Config.Outlines; edgeDetect.sampleDist = ((float)Screen.height / 1080f) * 1.4f; hbao = mainCamera.GetComponent <HBAO>(); hbao.enabled = Config.ContactShadows; RenderSettings.fog = true; if (Config.ShadowsEnabled) { if (Config.QualityLevel == Quality.Ultra) { sun.shadows = LightShadows.Soft; moon.shadows = LightShadows.Soft; } else { sun.shadows = LightShadows.Soft; moon.shadows = LightShadows.Soft; } } else { sun.shadows = LightShadows.None; moon.shadows = LightShadows.None; } RenderSettings.ambientIntensity = 0f; sun.intensity = 0f; boids.StartBoids(); firstRun = false; return(seed); }
public void ApplyPreset(HBAO.Preset preset) { if (preset == HBAO.Preset.Custom) { this.m_Presets.preset = preset; return; } HBAO.DisplayMode displayMode = this.generalSettings.displayMode; this.m_GeneralSettings = HBAO.GeneralSettings.defaultSettings; this.m_AOSettings = HBAO.AOSettings.defaultSettings; this.m_ColorBleedingSettings = HBAO.ColorBleedingSettings.defaultSettings; this.m_BlurSettings = HBAO.BlurSettings.defaultSettings; this.m_GeneralSettings.displayMode = displayMode; switch (preset) { case HBAO.Preset.FastestPerformance: this.m_GeneralSettings.quality = HBAO.Quality.Lowest; this.m_AOSettings.radius = 0.5f; this.m_AOSettings.maxRadiusPixels = 64f; this.m_BlurSettings.amount = HBAO.Blur.ExtraWide; goto IL_149; case HBAO.Preset.FastPerformance: this.m_GeneralSettings.quality = HBAO.Quality.Low; this.m_AOSettings.maxRadiusPixels = 128f; this.m_AOSettings.radius = 0.5f; this.m_BlurSettings.amount = HBAO.Blur.Wide; goto IL_149; case HBAO.Preset.HighQuality: this.m_GeneralSettings.quality = HBAO.Quality.High; goto IL_149; case HBAO.Preset.HighestQuality: this.m_GeneralSettings.quality = HBAO.Quality.Highest; this.m_AOSettings.radius = 1.2f; this.m_BlurSettings.amount = HBAO.Blur.Narrow; goto IL_149; } this.m_AOSettings.radius = 0.8f; IL_149: this.m_Presets.preset = preset; }