public GameSceneManager() { Transform root = GameObject.Find("GameRoot").transform; Assert.IsTrue(root != null, "Game Root must always exist."); if (root == null) { return; } GameObject manager = new GameObject(typeof(GameSceneManager).ToString()); manager.transform.SetParent(root.transform); m_currentSceneSlot = manager.AddComponent <SceneSlot>(); m_currentSceneSlot.AddCallbackAfterLoaded(delegate() { CameraService.Instance.UpdateCurrentCamera(); //DisplayCurrentSceneNameTip (); CinemachineManager.Instance.SetBoundingVolumeByName(GetCurrentSceneEnum().ToString());// set camera move range //Active scene and skybox setting UnityEngine.SceneManagement.Scene loadedScene = new UnityEngine.SceneManagement.Scene(); bool result = StarPlatinum.PrefabManager.Instance.GetLoadedScene(m_currentSceneSlot.GetCurrentSceneEnum(), ref loadedScene); if (result) { UnityEngine.SceneManagement.SceneManager.SetActiveScene(loadedScene); SkyboxManager.Instance().RefreshSkyboxSettingAfterNewGameSceneIsLoaded(RenderSettings.skybox, RenderSettings.ambientLight); } }); }
private const string GAMESCENE = "GameScene"; // Scene where gameplay takes place #endregion // Set color costs and load game data void Start() { PlayerData.SetColorCosts(costOfEachColor); SaveSystem.LoadGame(); OpenMainMenu(); SkyboxManager.UpdateSkybox(); }
private bool videoAdChecker = false; // Is a video ad being played #endregion // Initialize managers, colors, and start procedural generation void Start() { colors = new Color[2]; colors[0] = PlayerData.GetColor1(); colors[1] = PlayerData.GetColor2(); _ColorCheck(); // Assert that there are enough colors in the game _FindObjects(); // Find player and managers _UpdateMaterialColors(); // Handle color changing of materials pg.SetMaterials(materials); // Set materials in Procedural Generator _SetAlphaColors(); // Establish an array of transparent colors for changing materials materials[currIndex].SetColor("_BaseColor", colorsAlpha[currIndex]); // Set starting material to be transparent _SetStartingProceduralVariables(); // Alter procedural values to prepare for first procedural generation pg.GenerateChunk(currStartZ, currEndZ, currStep, currFrequency, maxConsecutiveColor); // First procedural generation chunk SkyboxManager.UpdateSkybox(); if (adsController.DistanceSinceAdChecker()) // Has the player gone far enough to trigger a video ad { PlayerPrefsController.SetDistanceSinceAd(0); // Reset the distance counter adsController.ShowVideoAd(); } }
void Awake() { if (Instance == null) { Instance = this; skybox = gameObject.GetComponent <Skybox>(); } SetSkyboxColor(); }
private IEnumerator Start() { yield return(new WaitUntil(() => { switch (KKAPI.KoikatuAPI.GetCurrentGameMode()) { case KKAPI.GameMode.Maker: return KKAPI.Maker.MakerAPI.InsideAndLoaded; case KKAPI.GameMode.Studio: return KKAPI.Studio.StudioAPI.StudioLoaded; case KKAPI.GameMode.MainGame: return null != GameObject.Find("MapScene") && SceneManager.GetActiveScene().isLoaded&& null != Camera.main; //KKAPI doesn't provide an api for in game check default: return false; } })); Settings = new GlobalSettings(); CameraSettings = new CameraSettings(); LightingSettings = new LightingSettings(); PostProcessingSettings = new PostProcessingSettings(CameraSettings.MainCamera); _skyboxManager = Instance.GetOrAddComponent <SkyboxManager>(); _skyboxManager.Parent = this; _skyboxManager.AssetPath = ConfigCubeMapPath.Value; _skyboxManager.Logger = Logger; DontDestroyOnLoad(_skyboxManager); _postProcessingManager = Instance.GetOrAddComponent <PostProcessingManager>(); _postProcessingManager.Parent = this; _postProcessingManager.LensDirtTexturesPath = ConfigLensDirtPath.Value; DontDestroyOnLoad(_postProcessingManager); _lightManager = new LightManager(this); _focusPuller = Instance.GetOrAddComponent <FocusPuller>(); _focusPuller.init(this); DontDestroyOnLoad(_focusPuller); _presetManager = new PresetManager(ConfigPresetPath.Value, this); _inspector = new Inspector.Inspector(this); // It takes some time to fully loaded in studio to save/load stuffs. yield return(new WaitUntil(() => { return (KoikatuAPI.GetCurrentGameMode() == GameMode.Studio) ? KKAPI.Studio.StudioAPI.InsideStudio && _skyboxManager != null : true; })); _isLoaded = true; }
public void ApplyParameters() { pp.LoadParameters(); SkyboxManager manager = AIGraphics.Instance.SkyboxManager; if (manager) { manager.skyboxParams = skybox; manager.LoadSkyboxParams(); } }
// Ensure only one manager exists in the current scene void Awake() { GameObject[] objs = GameObject.FindGameObjectsWithTag("Skybox"); if (objs.Length > 1) { Destroy(this.gameObject); } DontDestroyOnLoad(this.gameObject); Instance = this; }
public void ApplyParameters() { pp.LoadParameters(); SkyboxManager manager = Graphics.Instance.SkyboxManager; if (manager) { if (skyboxSetting != null) { manager.dynSkyboxSetting = skyboxSetting; } manager.skyboxParams = skybox; manager.PresetUpdate = true; manager.LoadSkyboxParams(); } }
private IEnumerator Start() { if (IsStudio()) { StudioHooks.Init(); } yield return(new WaitUntil(() => { return IsLoaded(); })); Settings = new GlobalSettings(); CameraSettings = new CameraSettings(); LightingSettings = new LightingSettings(); PostProcessingSettings = new PostProcessingSettings(CameraSettings.MainCamera); SSSSettings = new SSSSettings(); _sssManager = new SSSManager(); _sssManager.Initialize(); _skyboxManager = Instance.GetOrAddComponent <SkyboxManager>(); _skyboxManager.Parent = this; _skyboxManager.AssetPath = ConfigCubeMapPath.Value; _skyboxManager.Logger = Logger; DontDestroyOnLoad(_skyboxManager); _postProcessingManager = Instance.GetOrAddComponent <PostProcessingManager>(); _postProcessingManager.Parent = this; _postProcessingManager.LensDirtTexturesPath = ConfigLensDirtPath.Value; DontDestroyOnLoad(_postProcessingManager); LocalizationManager.Parent = this; LocalizationManager.CurrentLanguage = ConfigLanguage.Value; _lightManager = new LightManager(this); _presetManager = new PresetManager(ConfigPresetPath.Value, this); yield return(new WaitUntil(() => PCSSLight.LoadAssets())); yield return(new WaitUntil(() => SEGI.LoadAssets())); _inspector = new Inspector.Inspector(this); _isLoaded = true; }
public void UpdateParameters() { pp.SaveParameters(); sss?.SaveParameters(); SkyboxManager manager = Graphics.Instance.SkyboxManager; Material mat = manager.Skybox; if (mat) { SkyboxSettings setting = null; // Generate Setting Class // TODO: Find better way... // TODO: Add EnviroSky Support (AI) // TODO: Add AIOSky Support (HS2) // TODO: Stronger exception handling for different games. if (mat.shader.name == ProceduralSkyboxSettings.shaderName) { setting = new ProceduralSkyboxSettings(); } else if (mat.shader.name == TwoPointColorSkyboxSettings.shaderName) { setting = new TwoPointColorSkyboxSettings(); } else if (mat.shader.name == FourPointGradientSkyboxSetting.shaderName) { setting = new FourPointGradientSkyboxSetting(); } else if (mat.shader.name == HemisphereGradientSkyboxSetting.shaderName) { setting = new HemisphereGradientSkyboxSetting(); } if (setting != null) { setting.Save(); skyboxSetting = setting; } } skybox = manager.skyboxParams; }
private void Awake() { if (Instance != null) { Destroy(Instance.gameObject); } Instance = this; skyboxIndex = 0; // Try to get a reference to the Skybox if (profile = GameObject.FindObjectOfType <Volume>()) { profile.profile.TryGet(out skybox); } else { Debug.LogError("We could not find the Volume profile in your scene"); } }
internal SkyboxRenderable(ITextureHolder texture, ISamplerHolder sampler, SkyboxManager manager) { if (texture == null) { throw new ArgumentNullException(nameof(texture)); } if (sampler == null) { throw new ArgumentNullException(nameof(sampler)); } _manager = manager; _uniformBuffer = new SingleBuffer <SkyboxUniformInfo>(new SkyboxUniformInfo(), BufferUsage.UniformBuffer, "SpriteUniformBuffer"); ResourceSet = new SkyboxResourceSet { Name = $"RS_Sky:{texture.Name}", Texture = texture, Sampler = sampler, Uniform = _uniformBuffer }; AttachChild(_uniformBuffer); AttachChild(ResourceSet); On <EngineUpdateEvent>(_ => { var config = Resolve <CoreConfig>().Visual.Skybox; if (Resolve <ICamera>() is not PerspectiveCamera camera) { return; } _uniformBuffer.Data = new SkyboxUniformInfo { uYaw = camera.Yaw, uPitch = camera.Pitch, uVisibleProportion = config.VisibleProportion }; }); }
public void UpdateParameters() { pp.SaveParameters(); SkyboxManager manager = Graphics.Instance.SkyboxManager; Material mat = manager.Skybox; if (mat) { SkyboxSettings setting = null; // Generate Setting Class // TODO: Find better way if (mat.shader.name == ProceduralSkyboxSettings.shaderName) { setting = new ProceduralSkyboxSettings(); } else if (mat.shader.name == TwoPointColorSkyboxSettings.shaderName) { setting = new TwoPointColorSkyboxSettings(); } else if (mat.shader.name == FourPointGradientSkyboxSetting.shaderName) { setting = new FourPointGradientSkyboxSetting(); } else if (mat.shader.name == HemisphereGradientSkyboxSetting.shaderName) { setting = new HemisphereGradientSkyboxSetting(); } if (setting != null) { setting.Save(); skyboxSetting = setting; } } skybox = manager.skyboxParams; }
private void SetNextAction(StoryAction storyAction) { if (storyAction == null) { EventManager.Instance.SendEvent(new LabelEndEvent() { LabelID = m_currentID }); m_currentID = null; SetActionState(ActionState.Waiting); if (m_nextIDQueue.Count > 0) { return; } if (RecoverRecord()) { return; } InvokeHidePanel(); UIPanelDataProvider.OnTalkEnd?.Invoke(); return; } m_actionType = storyAction.Type; m_curAction = storyAction; SetActionState(ActionState.Actioning); Debug.LogWarning($"当前行为:{m_actionType}"); switch (storyAction.Type) { case StoryActionType.WaitClick: WaitClickEnd(); break; case StoryActionType.Name: SetNameContent(storyAction.Content); break; case StoryActionType.Content: if (m_typewriterCoroutine != null) { StopCoroutine(m_typewriterCoroutine); } m_typewriterCoroutine = StartCoroutine(Typewriter(storyAction.Content)); break; case StoryActionType.Color: m_textHelp.PushColor(storyAction.Content); SetActionState(ActionState.End); break; case StoryActionType.Font: m_textHelp.PushFont(storyAction.Content); SetActionState(ActionState.End); break; case StoryActionType.Jump: var jumpAction = storyAction as StoryJumpAction; if (jumpAction == null) { Debug.LogError("JumpAction null!!!!!!!Please check"); SetActionState(ActionState.End); return; } Debug.Log($"=== options:{jumpAction.Options}"); ShowJumpOption(jumpAction.Options); break; case StoryActionType.Picture: var pictureAction = storyAction as StoryShowPictureAction; if (pictureAction == null) { Debug.LogError("pictureAction null!!!!!!!Please check"); SetActionState(ActionState.End); return; } ShowPicture(pictureAction.Content, pictureAction.Pos); SetActionState(ActionState.End); break; case StoryActionType.Waiting: SetActionState(ActionState.Actioning); if (m_skip == false) { CallbackTime(float.Parse(storyAction.Content), () => { SetActionState(ActionState.End); }); } else { SetActionState(ActionState.End); } break; case StoryActionType.PictureMove: var pictureMoveAction = storyAction as StoryPictureMoveAction; MovePicture(pictureMoveAction.PicID, pictureMoveAction.StartX, pictureMoveAction.StartY, pictureMoveAction.EndX, pictureMoveAction.EndY, pictureMoveAction.Ease, pictureMoveAction.Duration); break; case StoryActionType.FontSize: m_textHelp.PushFontSize(storyAction.Content); SetActionState(ActionState.End); break; case StoryActionType.Bold: m_textHelp.PushBold(); SetActionState(ActionState.End); break; case StoryActionType.ChangeBGM: SetBgm(storyAction.Content); break; case StoryActionType.ChangeEffectMusic: PlayEffectMusic(storyAction.Content); break; case StoryActionType.TypewriterInterval: m_textHelp.TypewriterInterval = float.Parse(storyAction.Content); SetActionState(ActionState.End); break; case StoryActionType.ShowEvidence: InvokeShowPanel(UIPanelType.UICommonDetectiveNotesPanel, new EvidenceDataProvider() { OnShowEvidence = OnSelectEvidenceEnd, IsOnEvidence = true, CurState = CommonMapsTipsEvidencesPanel.ShowState.Evidences, IsShowSelectBtn = true }); return; case StoryActionType.LoadGameScene: GameSceneManager.Instance.LoadScene(SceneLookup.GetEnum(m_curAction.Content, false)); bool result = MissionSceneManager.Instance.LoadCurrentMissionScene(); if (result == false) { Debug.LogError("Current Game Scene: " + m_curAction.Content + " doesn`t contain Mission Scene " + MissionSceneManager.Instance.GetCurrentMissionEnum().ToString()); } SetActionState(ActionState.End); break; case StoryActionType.LoadMission: var action = m_curAction as StoryLoadMissionAction; MissionSceneManager.Instance.SetCurrentMission(action.Mission); MissionSceneManager.Instance.LoadCurrentMissionScene(); //if (MissionSceneManager.Instance.IsMissionSceneExist(action.Mission)) //{ // MissionSceneManager.Instance.LoadMissionScene(action.Mission); //} //else //{ // MissionSceneManager.Instance.LoadMissionScene(MissionEnum.None); //} SetActionState(ActionState.End); break; case StoryActionType.LoadCgScene: UI.UIManager.Instance().ShowStaticPanel(UIPanelType.UICommonCgscenePanel, new CGSceneDataProvider() { CGSceneID = m_curAction.Content }); SetActionState(ActionState.End); break; case StoryActionType.CloseCgScene: if (UIManager.Instance().IsPanelShow(UIPanelType.UICommonCgscenePanel)) { StarPlatinum.TimerService.Instance.AddTimer(0.01f, () => { EventManager.Instance.SendEvent(new CGSceneCloseEvent() { m_cgSceneId = m_curAction.Content }); }); } SetActionState(ActionState.End); break; case StoryActionType.TriggerEvent: var triggerAction = m_curAction as StoryEventAction; EventManager.Instance.SendEvent(triggerAction.Event); SetActionState(ActionState.End); break; case StoryActionType.PlayAnimation: SetActionState(ActionState.End); //TODO:播放动画 break; case StoryActionType.PlayInteractionAnimation: EventManager.Instance.SendEvent(new PlayInteractionAnimationEvent() { m_itemName = m_curAction.Content }); SetActionState(ActionState.End); break; case StoryActionType.ChangeBackground: ShowBG(storyAction.Content); SetActionState(ActionState.End); break; case StoryActionType.Wrap: m_txtPro_content_TextMeshProUGUI.text += '\n'; SetActionState(ActionState.End); break; case StoryActionType.ChangeSoundVolume: int volume = int.Parse(m_curAction.Content); SoundService.Instance.SetVolumePercentage(volume); SetActionState(ActionState.End); break; case StoryActionType.EnterControversy: UIManager.Instance().ShowPanel(UIPanelType.UIJudgmentControversyPanel, new ControversyDataProvider() { ID = m_curAction.Content }); SetActionState(ActionState.End); break; case StoryActionType.CutIn: UIManager.Instance().ShowPanel(UIPanelType.UICommonBreaktheoryPanel, new BreakTheoryDataProvider() { Type = EnumBreakTheoryType.CutIn, ImgKey = m_curAction.Content, CloseCallback = () => { SetActionState(ActionState.End); } }); break; case StoryActionType.LoadSkybox: { StoryLoadSkyboxAction skyboxAction = m_curAction as StoryLoadSkyboxAction; SkyboxManager.Instance().UpdateSkybox(skyboxAction.m_skyEnum); SetActionState(ActionState.End); } break; case StoryActionType.ChangeTalkPanelType: SetTalkPanelType(m_curAction.Content); break; case StoryActionType.ChangeFrontImg: SetFrontImg(m_curAction.Content); break; case StoryActionType.RemoveAllExhibit: EvidenceDataManager.Instance.RemoveAllEvidence(); SetActionState(ActionState.End); break; case StoryActionType.TimeLine: PrefabManager.Instance.LoadAssetAsync <TimelineAsset>(m_curAction.Content, (res) => { if (res.status != RequestStatus.FAIL) { gameObject.SetActive(false); TimelineManager.Instance().PlayTimeline(res.result as TimelineAsset, null, () => { gameObject.SetActive(true); SetActionState(ActionState.End); }); } else { SetActionState(ActionState.End); } }); break; case StoryActionType.AddEvidence: EvidenceDataManager.Instance.AddEvidence(m_curAction.Content); SetActionState(ActionState.End); break; case StoryActionType.RemoveEvidence: EvidenceDataManager.Instance.RemoveEvidence(m_curAction.Content); SetActionState(ActionState.End); break; case StoryActionType.AddTip: Tips.TipsManager.Instance.UnlockTip(m_curAction.Content, Tips.TipsManager.ConvertDateTimeToLong(System.DateTime.Now)); // 添加tip 数据 SetActionState(ActionState.End); break; case StoryActionType.Position: { StoryVector3Action vector3Action = m_curAction as StoryVector3Action; CoreContainer.Instance.SetPlayerPosition(vector3Action.m_vector); SetActionState(ActionState.End); } break; case StoryActionType.Rotation: { StoryVector3Action vector3Action = m_curAction as StoryVector3Action; VMCameraManager.Instance().SetLookAtRotation(vector3Action.m_vector.x, vector3Action.m_vector.y, vector3Action.m_vector.z); SetActionState(ActionState.End); } break; case StoryActionType.GameEvent: { EventManager.Instance.SendEvent(new GameEvent() { EventName = m_curAction.Content }); SetActionState(ActionState.End); } break; default: Debug.LogError($"未处理对话行为:{storyAction.Type}"); break; } }
internal static void Draw(LightingSettings lightingSettings, SkyboxManager skyboxManager, bool showAdvanced) { GUILayout.BeginVertical(GUIStyles.Skin.box); { Label("Environment Skybox", "", true); GUILayout.Space(1); //inactivate controls if no cubemap if (skyboxManager.TexturePaths.IsNullOrEmpty()) { Label("No custom cubemaps found", ""); } else { cubeMapScrollView = GUILayout.BeginScrollView(cubeMapScrollView, GUILayout.MaxHeight(300)); int selectedCubeMapIdx = GUILayout.SelectionGrid(skyboxManager.CurrentTextureIndex, skyboxManager.Previews.ToArray(), Inspector.Width / 150, GUIStyles.Skin.box); if (-1 != selectedCubeMapIdx) { skyboxManager.CurrentTexturePath = skyboxManager.TexturePaths[selectedCubeMapIdx]; } GUILayout.EndScrollView(); } DrawDynSkyboxOptions(lightingSettings, skyboxManager, showAdvanced); GUILayout.Space(10); if (showAdvanced) { Label("Skybox Material", lightingSettings?.SkyboxSetting?.name ?? ""); Label("Sun Source", lightingSettings?.SunSetting?.name ?? ""); GUILayout.Space(10); } Label("Environment Lighting", "", true); GUILayout.Space(1); Selection("Source", lightingSettings.AmbientModeSetting, mode => { lightingSettings.AmbientModeSetting = mode; if (mode != LightingSettings.AIAmbientMode.Skybox) { skyboxManager.CurrentTexturePath = SkyboxManager.noCubemap; } }); Slider("Intensity", lightingSettings.AmbientIntensity, LightSettings.IntensityMin, LightSettings.IntensityMax, "N1", intensity => { lightingSettings.AmbientIntensity = intensity; }); if (null != skyboxManager.Skybox && null != skyboxManager.Skyboxbg) { Material skybox = skyboxManager.Skybox; if (skybox.HasProperty("_Exposure")) { Slider("Exposure", skyboxManager.Exposure, ExposureMin, ExposureMax, "N1", exp => { skyboxManager.Exposure = exp; skyboxManager.Update = true; }); } if (skybox.HasProperty("_Rotation")) { Slider("Rotation", skyboxManager.Rotation, RotationMin, RotationMax, "N1", rot => { skyboxManager.Rotation = rot; skyboxManager.Update = true; }); } GUILayout.Space(10); if (skybox.HasProperty("_Tint")) { SliderColor("Skybox Tint", skyboxManager.Tint, c => { skyboxManager.Tint = c; skyboxManager.Update = true; }, true); } } GUILayout.Space(10); Label("Environment Reflections", "", true); GUILayout.Space(1); Selection("Resolution", lightingSettings.ReflectionResolution, LightingSettings.ReflectionResolutions, resolution => lightingSettings.ReflectionResolution = resolution); Slider("Intensity", lightingSettings.ReflectionIntensity, 0f, 1f, "N1", intensity => { lightingSettings.ReflectionIntensity = intensity; }); Slider("Bounces", lightingSettings.ReflectionBounces, 1, 5, bounces => { lightingSettings.ReflectionBounces = bounces; }); } GUILayout.EndVertical(); GUILayout.Space(1); GUILayout.BeginVertical(GUIStyles.Skin.box); { Toggle("Reflection Probes", inspectReflectionProbes, true, inspect => inspectReflectionProbes = inspect); if (inspectReflectionProbes) { ReflectionProbe[] rps = skyboxManager.GetReflectinProbes(); if (0 < rps.Length) { string[] probeNames = rps.Select(probe => probe.name).ToArray(); selectedProbe = GUILayout.SelectionGrid(selectedProbe, probeNames, 3, GUIStyles.toolbarbutton); ReflectionProbe rp = rps[selectedProbe]; GUILayout.Space(1); GUILayout.BeginVertical(GUIStyles.Skin.box); probeSettingsScrollView = GUILayout.BeginScrollView(probeSettingsScrollView); { Label("Type", rp.mode.ToString()); Label("Runtime settings", ""); Slider("Importance", rp.importance, 0, 1000, importance => rp.importance = importance); Slider("Intensity", rp.intensity, 0, 10, "N2", intensity => rp.intensity = intensity); Toggle("Box Projection", rp.boxProjection, false, box => rp.boxProjection = box); Text("Blend Distance", rp.blendDistance, "N2", distance => rp.blendDistance = distance); Dimension("Box Size", rp.size, size => rp.size = size); Dimension("Box Offset", rp.center, size => rp.center = size); GUILayout.Space(10); Label("Cubemap capture settings", ""); Selection("Resolution", rp.resolution, LightingSettings.ReflectionResolutions, resolution => rp.resolution = resolution); Toggle("HDR", rp.hdr, false, hdr => rp.hdr = hdr); Text("Shadow Distance", rp.shadowDistance, "N2", distance => rp.shadowDistance = distance); Selection("Clear Flags", rp.clearFlags, flag => rp.clearFlags = flag); if (showAdvanced) { SelectionMask("Culling Mask", rp.cullingMask, mask => rp.cullingMask = mask); } Text("Clipping Planes - Near", rp.nearClipPlane, "N2", plane => rp.nearClipPlane = plane); Text("Clipping Planes - Far", rp.farClipPlane, "N2", plane => rp.farClipPlane = plane); SliderColor("Background", rp.backgroundColor, colour => { rp.backgroundColor = colour; }); Selection("Time Slicing Mode", rp.timeSlicingMode, mode => rp.timeSlicingMode = mode); } GUILayout.EndScrollView(); GUILayout.EndVertical(); } } } GUILayout.EndVertical(); GUILayout.BeginVertical(GUIStyles.Skin.box); { Toggle("SEGI (Experimental)", inspectSEGI, true, inspect => inspectSEGI = inspect); if (inspectSEGI) { if (null != Graphics.Instance.CameraSettings.MainCamera && null == segi) { segi = Graphics.Instance.CameraSettings.MainCamera.GetOrAddComponent <SEGI>(); if (null != segi) { segi.enabled = false; } } if (null != segi) { Toggle("Enable", segi.enabled, false, enable => segi.enabled = enable); if (segi.enabled) { GUILayout.BeginVertical(GUIStyles.Skin.box); segiScrollView = GUILayout.BeginScrollView(segiScrollView); { Label("Main Configuration", "", true); Selection("Voxel Resolution", segi.voxelResolution, resolution => segi.voxelResolution = resolution); Toggle("Volex AA", segi.voxelAA, false, aa => segi.voxelAA = aa); Slider("Inner Occlusion Layers", segi.innerOcclusionLayers, 0, 2, layers => segi.innerOcclusionLayers = layers); Toggle("Gaussian Mip Filter", segi.gaussianMipFilter, false, filter => segi.gaussianMipFilter = filter); Text("Voxel Space Size", segi.voxelSpaceSize, "N2", size => segi.voxelSpaceSize = size); Text("Shadow Space Size", segi.shadowSpaceSize, "N2", size => segi.shadowSpaceSize = size); SelectionMask("GI Culling Mask", segi.giCullingMask, mask => segi.giCullingMask = mask); Toggle("Update GI", segi.updateGI, false, update => segi.updateGI = update); Toggle("Infinite Bounces", segi.infiniteBounces, false, bounce => segi.infiniteBounces = bounce); Label("VRAM usage", segi.vramUsage.ToString("N2") + " MB"); GUILayout.Space(10); Label("Environmental Properties", "", true); string sun = segi.sun ? segi.sun.ToString() : "Please set one directional light as sunlight"; Label("Sun", sun); Slider("Soft Sunlight", segi.softSunlight, 0f, 16f, "N2", soft => segi.softSunlight = soft); SliderColor("Sky Colour", segi.skyColor, colour => segi.skyColor = colour); Slider("Sky Intensity", segi.skyIntensity, 0f, 8f, "N2", intensity => segi.skyIntensity = intensity); Toggle("Spherical Skylight", segi.sphericalSkylight, false, spherical => segi.sphericalSkylight = spherical); GUILayout.Space(10); Label("Tracing Properties", "", true); Slider("Temporal Blend Weight", segi.temporalBlendWeight, 0f, 1f, "N2", weight => segi.temporalBlendWeight = weight); Toggle("Bilateral Filtering", segi.useBilateralFiltering, false, filter => segi.useBilateralFiltering = filter); Toggle("Half Resolution", segi.halfResolution, false, half => segi.halfResolution = half); Toggle("Stochastic Sampling", segi.stochasticSampling, false, sampling => segi.stochasticSampling = sampling); Slider("Cones", segi.cones, 1, 128, cones => segi.cones = cones); Slider("Cones Trace Steps", segi.coneTraceSteps, 1, 32, cones => segi.coneTraceSteps = cones); Slider("Cones Length", segi.coneLength, 0.1f, 2f, "N2", cones => segi.coneLength = cones); Slider("Cones Width", segi.coneWidth, 0.5f, 6f, "N2", cones => segi.coneWidth = cones); Slider("Cones Trace Bias", segi.coneTraceBias, 0f, 4f, "N2", cones => segi.coneTraceBias = cones); Slider("Occlusion Strength", segi.occlusionStrength, 0f, 4f, "N2", cones => segi.occlusionStrength = cones); Slider("Near Occlusion Strength", segi.nearOcclusionStrength, 0f, 4f, "N2", cones => segi.nearOcclusionStrength = cones); Slider("Far Occlusion Strength", segi.farOcclusionStrength, 0f, 4f, "N2", cones => segi.farOcclusionStrength = cones); Slider("Farthest Occlusion Strength", segi.farthestOcclusionStrength, 0f, 4f, "N2", cones => segi.farthestOcclusionStrength = cones); Slider("Occlusion Power", segi.occlusionPower, 0.001f, 4f, "N2", cones => segi.occlusionPower = cones); Slider("Near Light Gain", segi.nearLightGain, 0f, 4f, "N2", cones => segi.nearLightGain = cones); Slider("GI Gain", segi.giGain, 0f, 4f, "N2", cones => segi.giGain = cones); GUILayout.Space(10); Slider("Secondary Bounce Gain", segi.secondaryBounceGain, 0f, 4f, "N2", cones => segi.secondaryBounceGain = cones); Slider("Secondary Cones", segi.secondaryCones, 3, 16, cones => segi.secondaryCones = cones); Slider("Secondary Occlusion Strength", segi.secondaryOcclusionStrength, 0.1f, 4f, "N2", cones => segi.secondaryOcclusionStrength = cones); GUILayout.Space(10); Label("Reflection Properties", "", true); Toggle("Do Reflections", segi.doReflections, false, reflections => segi.doReflections = reflections); Slider("Reflection Steps", segi.reflectionSteps, 12, 128, cones => segi.reflectionSteps = cones); Slider("Reflection Occlusion Power", segi.reflectionOcclusionPower, 0.001f, 4f, "N2", cones => segi.reflectionOcclusionPower = cones); Slider("Sky Reflection Intensity", segi.skyReflectionIntensity, 0f, 1f, "N2", intensity => segi.skyReflectionIntensity = intensity); GUILayout.Space(10); Label("Debug Tools", "", true); Toggle("Visualize Sun Depth Texture", segi.visualizeSunDepthTexture, false, visual => segi.visualizeSunDepthTexture = visual); Toggle("Visualize GI", segi.visualizeGI, false, visual => segi.visualizeGI = visual); Toggle("Visualize Voxels", segi.visualizeVoxels, false, visual => segi.visualizeVoxels = visual); } GUILayout.EndScrollView(); GUILayout.EndVertical(); } } } } GUILayout.EndVertical(); }
public void LoadGameObjects() { Debug.Log("Loading Game Objects Into Game Manager"); if (this.Mendelbulb == null) { this.Mendelbulb = GameObject.Find("Mandelbulb"); } if (this.Sun == null) { this.Sun = GameObject.Find("Sun"); } if (this.Moon == null) { this.Moon = GameObject.Find("Moon"); } if (this.StarSprites == null) { this.StarSprites = GameObject.Find("Stars"); } if (this.InteractableOrbs == null) { this.InteractableOrbs = GameObject.Find("InteractableOrbs"); } if (this.interactableManager == null && this.InteractableOrbs != null) { this.interactableManager = this.InteractableOrbs.GetComponent <InteractableManager>(); } if (this.RFloor == null) { this.RFloor = GameObject.Find("Floor- Reflective"); } if (this.Rings == null) { this.Rings = GameObject.Find("Rings"); } if (this.ringManagerScript == null) { this.ringManagerScript = this.Rings.GetComponent <RingManager>(); } if (this.PlanetOrbit == null) { this.PlanetOrbit = GameObject.Find("PlanetOrbit"); } if (this.mandelBulbOrbitScript == null) { this.mandelBulbOrbitScript = this.PlanetOrbit.GetComponent <Orbit>(); } if (this.dayNightScript == null) { this.dayNightScript = this.GetComponent <DayNight>(); } if (this.mandelBulbScript == null && Mendelbulb != null) { this.mandelBulbScript = Mendelbulb.GetComponent <FractalManager>(); } if (this.mandelBulbRig == null && Mendelbulb != null) { this.mandelBulbRig = Mendelbulb.GetComponent <Rigidbody>(); } if (this.skyboxManager == null) { this.skyboxManager = this.GetComponent <SkyboxManager>(); } }
internal static void Draw(LightingSettings lightingSettings, SkyboxManager skyboxManager, bool showAdvanced) { GUILayout.BeginVertical(GUIStyles.Skin.box); { Label("Environment Skybox", "", true); GUILayout.Space(1); //inactivate controls if no cubemap if (skyboxManager.TexturePaths.IsNullOrEmpty()) { Label("No custom cubemaps found", ""); } else { cubeMapScrollView = GUILayout.BeginScrollView(cubeMapScrollView, GUILayout.MaxHeight(300)); int selectedCubeMapIdx = GUILayout.SelectionGrid(skyboxManager.CurrentTextureIndex, skyboxManager.Previews.ToArray(), Inspector.Width / 150, GUIStyles.Skin.box); if (-1 != selectedCubeMapIdx) { skyboxManager.CurrentTexturePath = skyboxManager.TexturePaths[selectedCubeMapIdx]; } GUILayout.EndScrollView(); } DrawDynSkyboxOptions(lightingSettings, skyboxManager, showAdvanced); GUILayout.Space(10); if (showAdvanced) { Label("Skybox Material", lightingSettings?.SkyboxSetting?.name ?? ""); Label("Sun Source", lightingSettings?.SunSetting?.name ?? ""); GUILayout.Space(10); } Label("Environment Lighting", "", true); GUILayout.Space(1); Selection("Source", lightingSettings.AmbientModeSetting, mode => { lightingSettings.AmbientModeSetting = mode; if (mode != LightingSettings.AIAmbientMode.Skybox) { skyboxManager.CurrentTexturePath = SkyboxManager.noCubemap; } }); Slider("Intensity", lightingSettings.AmbientIntensity, LightSettings.IntensityMin, LightSettings.IntensityMax, "N1", intensity => { lightingSettings.AmbientIntensity = intensity; }); if (null != skyboxManager.Skybox && null != skyboxManager.Skyboxbg) { Material skybox = skyboxManager.Skybox; if (skybox.HasProperty("_Exposure")) { Slider("Exposure", skyboxManager.Exposure, ExposureMin, ExposureMax, "N1", exp => { skyboxManager.Exposure = exp; skyboxManager.Update = true; }); } if (skybox.HasProperty("_Rotation")) { Slider("Rotation", skyboxManager.Rotation, RotationMin, RotationMax, "N1", rot => { skyboxManager.Rotation = rot; skyboxManager.Update = true; }); } GUILayout.Space(10); if (skybox.HasProperty("_Tint")) { SliderColor("Skybox Tint", skyboxManager.Tint, c => { skyboxManager.Tint = c; skyboxManager.Update = true; }, true); } } GUILayout.Space(10); Label("Environment Reflections", "", true); GUILayout.Space(1); Selection("Resolution", lightingSettings.ReflectionResolution, LightingSettings.ReflectionResolutions, resolution => lightingSettings.ReflectionResolution = resolution); Slider("Intensity", lightingSettings.ReflectionIntensity, 0f, 1f, "N1", intensity => { lightingSettings.ReflectionIntensity = intensity; }); Slider("Bounces", lightingSettings.ReflectionBounces, 1, 5, bounces => { lightingSettings.ReflectionBounces = bounces; }); } GUILayout.EndVertical(); GUILayout.Space(1); GUILayout.BeginVertical(GUIStyles.Skin.box); { Label("Reflection Probes", "", true); ReflectionProbe[] rps = skyboxManager.GetReflectinProbes(); if (0 < rps.Length) { string[] probeNames = rps.Select(probe => probe.name).ToArray(); selectedProbe = GUILayout.SelectionGrid(selectedProbe, probeNames, 3, GUIStyles.toolbarbutton); ReflectionProbe rp = rps[selectedProbe]; GUILayout.Space(1); GUILayout.BeginVertical(GUIStyles.Skin.box); probeSettingsScrollView = GUILayout.BeginScrollView(probeSettingsScrollView); { Label("Type", rp.mode.ToString()); Label("Runtime settings", ""); Slider("Importance", rp.importance, 0, 1000, importance => rp.importance = importance); Slider("Intensity", rp.intensity, 0, 10, "N2", intensity => rp.intensity = intensity); rp.boxProjection = Toggle("Box Projection", rp.boxProjection); rp.blendDistance = Text("Blend Distance", rp.blendDistance); Dimension("Box Size", rp.size, size => rp.size = size); Dimension("Box Offset", rp.center, size => rp.center = size); GUILayout.Space(10); Label("Cubemap capture settings", ""); Selection("Resolution", rp.resolution, LightingSettings.ReflectionResolutions, resolution => rp.resolution = resolution); rp.hdr = Toggle("HDR", rp.hdr); rp.shadowDistance = Text("Shadow Distance", rp.shadowDistance); Selection("Clear Flags", rp.clearFlags, flag => rp.clearFlags = flag); if (showAdvanced) { SelectionMask("Culling Mask", rp.cullingMask, mask => rp.cullingMask = mask); } rp.nearClipPlane = Text("Clipping Planes - Near", rp.nearClipPlane, "N2"); rp.farClipPlane = Text("Clipping Planes - Far", rp.farClipPlane, "N2"); SliderColor("Background", rp.backgroundColor, colour => { rp.backgroundColor = colour; }); Selection("Time Slicing Mode", rp.timeSlicingMode, mode => rp.timeSlicingMode = mode); } GUILayout.EndScrollView(); GUILayout.EndVertical(); } } GUILayout.EndVertical(); }
internal static void DrawDynSkyboxOptions(LightingSettings lightingSettings, SkyboxManager skyboxManager, bool showAdvanced) { if (skyboxManager != null && skyboxManager.Skybox != null) { GUILayout.Space(10); GUILayout.BeginVertical(GUIStyles.Skin.box); dynSkyScrollView = GUILayout.BeginScrollView(dynSkyScrollView); { Material mat = skyboxManager.Skybox; if (mat.shader.name == ProceduralSkyboxSettings.shaderName) { Label("Unity Skybox Settings", "", true); Selection("Sun", (ProceduralSkyboxSettings.SunDisk)mat.GetInt("_SunDisk"), quality => { mat.SetInt("_SunDisk", (int)quality); skyboxManager.Update = true; }); Slider("Sun Size", mat.GetFloat("_SunSize"), 0, 1, "N2", value => { mat.SetFloat("_SunSize", value); skyboxManager.Update = true; }); Slider("Sun Size Convergence", mat.GetFloat("_SunSizeConvergence"), 1, 10, "N2", value => { mat.SetFloat("_SunSizeConvergence", value); skyboxManager.Update = true; }); Slider("Atmosphere Thickness", mat.GetFloat("_AtmosphereThickness"), 0, 5, "N2", value => { mat.SetFloat("_AtmosphereThickness", value); skyboxManager.Update = true; }); SliderColor("Sky Tint", mat.GetColor("_SkyTint"), c => { mat.SetColor("_SkyTint", c); skyboxManager.Update = true; }, true); SliderColor("Ground Color", mat.GetColor("_GroundColor"), c => { mat.SetColor("_GroundColor", c); skyboxManager.Update = true; }, true); Slider("Exposure", mat.GetFloat("_Exposure"), 0, 8, "N2", value => { mat.SetFloat("_Exposure", value); skyboxManager.Update = true; }); } else if (mat.shader.name == TwoPointColorSkyboxSettings.shaderName) { Label("Two Point Color Skybox Settings", "", true); SliderColor("Colour A", mat.GetColor("_ColorA"), c => { mat.SetColor("_ColorA", c); skyboxManager.Update = true; }, true); Slider("Intensity A", mat.GetFloat("_IntensityA"), 0, 2, "N2", intensity => { mat.SetFloat("_IntensityA", intensity); skyboxManager.Update = true; }); Dimension("Box Size", mat.GetVector("_DirA"), direction => { mat.SetVector("_DirA", direction); skyboxManager.Update = true; }); SliderColor("Colour B", mat.GetColor("_ColorB"), c => { mat.SetColor("_ColorB", c); skyboxManager.Update = true; }, true); Slider("Intensity B", mat.GetFloat("_IntensityB"), 0, 2, "N2", intensity => { mat.SetFloat("_IntensityB", intensity); skyboxManager.Update = true; }); Dimension("Box Size", mat.GetVector("_DirB"), direction => { mat.SetVector("_DirB", direction); skyboxManager.Update = true; }); } else if (mat.shader.name == HemisphereGradientSkyboxSetting.shaderName) { Label("Hemisphere Skybox Settings", "", true); SliderColor("North Pole", mat.GetColor("_TopColor"), c => { mat.SetColor("_TopColor", c); skyboxManager.Update = true; }, true); SliderColor("Equator", mat.GetColor("_MiddleColor"), c => { mat.SetColor("_MiddleColor", c); skyboxManager.Update = true; }, true); SliderColor("South Pole", mat.GetColor("_BottomColor"), c => { mat.SetColor("_BottomColor", c); skyboxManager.Update = true; }, true); } else if (mat.shader.name == FourPointGradientSkyboxSetting.shaderName) { Label("Four Point Gradient Skybox Settings", "", true); SliderColor("Base Color", mat.GetColor("_BaseColor"), c => { mat.SetColor("_BaseColor", c); skyboxManager.Update = true; }, true); for (int i = 1; i <= 4; i++) { // Switch is compile time property. SliderColor("Color " + i, mat.GetColor("_Color" + i), c => { mat.SetColor("_Color" + i, c); skyboxManager.Update = true; }, true); Dimension("Direction " + i, mat.GetVector("_Direction" + i), direction => { mat.SetVector("_Direction" + i, direction); skyboxManager.Update = true; }); Slider("Exponent " + i, mat.GetFloat("_Exponent" + i), 0, 2, "N1", intensity => { mat.SetFloat("_Exponent" + i, intensity); skyboxManager.Update = true; }); } } } GUILayout.EndScrollView(); GUILayout.EndVertical(); } }