Exemple #1
0
        static void CreateSceneSettingsGameObject(MenuCommand menuCommand)
        {
            var parent   = menuCommand.context as GameObject;
            var settings = CoreEditorUtils.CreateGameObject(parent, "Sky and Fog Volume");

            GameObjectUtility.SetParentAndAlign(settings, menuCommand.context as GameObject);
            Undo.RegisterCreatedObjectUndo(settings, "Create " + settings.name);
            Selection.activeObject = settings;

            var profile   = VolumeProfileFactory.CreateVolumeProfile(settings.scene, "Sky and Fog Settings");
            var visualEnv = VolumeProfileFactory.CreateVolumeComponent <VisualEnvironment>(profile, true, false);

            visualEnv.skyType.value = SkySettings.GetUniqueID <PhysicallyBasedSky>();
            visualEnv.skyAmbientMode.overrideState = false;
            VolumeProfileFactory.CreateVolumeComponent <PhysicallyBasedSky>(profile, false, false);
            var fog = VolumeProfileFactory.CreateVolumeComponent <Fog>(profile, false, true);

            fog.enabled.Override(true);
            fog.enableVolumetricFog.Override(true);

            var volume = settings.AddComponent <Volume>();

            volume.isGlobal      = true;
            volume.sharedProfile = profile;
        }
        static void CreateSceneSettingsGameObject(MenuCommand menuCommand)
        {
            var parent        = menuCommand.context as GameObject;
            var sceneSettings = CoreEditorUtils.CreateGameObject(parent, "Scene Settings");

            GameObjectUtility.SetParentAndAlign(sceneSettings, menuCommand.context as GameObject);
            Undo.RegisterCreatedObjectUndo(sceneSettings, "Create " + sceneSettings.name);
            Selection.activeObject = sceneSettings;

            var profile = VolumeProfileFactory.CreateVolumeProfile(sceneSettings.scene, "Scene Settings");

            VolumeProfileFactory.CreateVolumeComponent <HDShadowSettings>(profile, true, false);
            var visualEnv = VolumeProfileFactory.CreateVolumeComponent <VisualEnvironment>(profile, true, false);

            visualEnv.skyType.value = SkySettings.GetUniqueID <ProceduralSky>();
            visualEnv.fogType.value = FogType.Exponential;
            VolumeProfileFactory.CreateVolumeComponent <ProceduralSky>(profile, true, false);
            VolumeProfileFactory.CreateVolumeComponent <ExponentialFog>(profile, true, true);

            var volume = sceneSettings.AddComponent <Volume>();

            volume.isGlobal      = true;
            volume.sharedProfile = profile;

            var bakingSky = sceneSettings.AddComponent <BakingSky>();

            bakingSky.profile           = volume.sharedProfile;
            bakingSky.bakingSkyUniqueID = SkySettings.GetUniqueID <ProceduralSky>();
        }
        static void CreateSceneSettingsGameObject(MenuCommand menuCommand)
        {
            var parent   = menuCommand.context as GameObject;
            var settings = CoreEditorUtils.CreateGameObject("Sky and Fog Global Volume", parent);

            var profile   = VolumeProfileFactory.CreateVolumeProfile(settings.scene, "Sky and Fog Settings");
            var visualEnv = VolumeProfileFactory.CreateVolumeComponent <VisualEnvironment>(profile, true, false);

            visualEnv.skyType.value = SkySettings.GetUniqueID <PhysicallyBasedSky>();
            visualEnv.skyAmbientMode.overrideState = false;
            VolumeProfileFactory.CreateVolumeComponent <PhysicallyBasedSky>(profile, false, false);
            var fog = VolumeProfileFactory.CreateVolumeComponent <Fog>(profile, false, true);

            fog.enabled.Override(true);
            fog.enableVolumetricFog.Override(true);

            var volume = settings.AddComponent <Volume>();

            volume.isGlobal      = true;
            volume.sharedProfile = profile;
        }