Exemple #1
0
        //------------------------------------------------------------------------------------------------------------------
        private void SetWeatherType_1()
        {
            this.m_ambientEquatorColor = new Color(1.0f, 1.0f, 1.0f);
            this.m_ambientGroundColor  = new Color(1.0f, 1.0f, 1.0f);
            this.m_ambientIntensity    = 1.0f;
            this.m_ambientLight        = new Color(1.0f, 1.0f, 1.0f);
            this.m_ambientMode         = AmbientMode.Skybox;
            //this.m_ambientProbe = SphericalHarmonicsL2;
            this.m_ambientSkyColor             = new Color(1.0f, 1.0f, 1.0f);
            this.m_customReflection            = null;
            this.m_defaultReflectionMode       = DefaultReflectionMode.Skybox;
            this.m_defaultReflectionResolution = 128;
            this.m_flareFadeSpeed      = 3.0f;
            this.m_flareStrength       = 1.0f;
            this.m_fog                 = true;
            this.m_fogColor            = new Color(0.5f, 0.5f, 0.5f);
            this.m_fogDensity          = 0.01f;
            this.m_fogEndDistance      = 300.0f;
            this.m_fogMode             = FogMode.Linear;
            this.m_fogStartDistance    = 0;
            this.m_haloStrength        = 0.5f;
            this.m_reflectionBounces   = 1;
            this.m_reflectionIntensity = 1.0f;

            Material skyboxMaterial = null;

            this.m_skybox = skyboxMaterial;
        }
    void Reset()
    {
        lastResetTime = System.DateTime.Now.ToString ();

        ambientEquatorColor = RenderSettings.ambientEquatorColor;
        ambientGroundColor = RenderSettings.ambientGroundColor;
        ambientIntensity = RenderSettings.ambientIntensity;
        ambientLight = RenderSettings.ambientLight;
        ambientMode = RenderSettings.ambientMode;
        ambientProbe = RenderSettings.ambientProbe;
        ambientSkyColor = RenderSettings.ambientSkyColor;
        customReflection = RenderSettings.customReflection;
        defaultReflectionMode = RenderSettings.defaultReflectionMode;
        defaultReflectionResolution = RenderSettings.defaultReflectionResolution;
        flareFadeSpeed = RenderSettings.flareFadeSpeed;
        flareStrength = RenderSettings.flareStrength;
        fog = RenderSettings.fog;
        fogColor = RenderSettings.fogColor;
        fogDensity = RenderSettings.fogDensity;
        fogEndDistance = RenderSettings.fogEndDistance;
        fogMode = RenderSettings.fogMode;
        fogStartDistance = RenderSettings.fogStartDistance;
        haloStrength = RenderSettings.haloStrength;
        reflectionBounces = RenderSettings.reflectionBounces;
        reflectionIntensity = RenderSettings.reflectionIntensity;
        skybox = RenderSettings.skybox;
    }
 public void PasteEnvironmentSettings()
 {
     skybox                      = t_skybox;
     sourceLighting              = t_sourceLighting;
     ambientSkyColor             = t_ambientSkyColor;
     ambientEquatorColor         = t_ambientEquatorColor;
     ambientGroundColor          = t_ambientGroundColor;
     ambientIntensity            = t_ambientIntensity;
     defaultReflectionMode       = t_defaultReflectionMode;
     defaultReflectionResolution = t_defaultReflectionResolution;
     customReflection            = t_customReflection;
     reflectionIntensity         = t_reflectionIntensity;
     reflectionBounces           = t_reflectionBounces;
 }
 public void CopyEnvironmentSettings()
 {
     t_skybox                      = skybox;
     t_sourceLighting              = sourceLighting;
     t_ambientSkyColor             = ambientSkyColor;
     t_ambientEquatorColor         = ambientEquatorColor;
     t_ambientGroundColor          = ambientGroundColor;
     t_ambientIntensity            = ambientIntensity;
     t_defaultReflectionMode       = defaultReflectionMode;
     t_defaultReflectionResolution = defaultReflectionResolution;
     t_customReflection            = customReflection;
     t_reflectionIntensity         = reflectionIntensity;
     t_reflectionBounces           = reflectionBounces;
 }
    private static int set_defaultReflectionMode(IntPtr L)
    {
        int result;

        try
        {
            DefaultReflectionMode defaultReflectionMode = (DefaultReflectionMode)((int)ToLua.CheckObject(L, 2, typeof(DefaultReflectionMode)));
            RenderSettings.defaultReflectionMode = defaultReflectionMode;
            result = 0;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
Exemple #6
0
        public void UseSceneRenderSettings()
        {
            m_AmbientSkyColor        = RenderSettings.ambientSkyColor;
            m_AmbientEquatorColor    = RenderSettings.ambientEquatorColor;
            m_AmbientGroundColor     = RenderSettings.ambientGroundColor;
            m_AmbientIntensity       = RenderSettings.ambientIntensity;
            m_AmbientLight           = RenderSettings.ambientLight;
            m_SubtractiveShadowColor = RenderSettings.subtractiveShadowColor;
            m_Skybox                      = RenderSettings.skybox;
            m_CustomReflection            = RenderSettings.customReflection;
            m_ReflectionIntensity         = RenderSettings.reflectionIntensity;
            m_ReflectionBounces           = RenderSettings.reflectionBounces;
            m_DefaultReflectionMode       = RenderSettings.defaultReflectionMode;
            m_DefaultReflectionResolution = RenderSettings.defaultReflectionResolution;
            m_HaloStrength                = RenderSettings.haloStrength;
            m_FlareStrength               = RenderSettings.flareStrength;
            m_FlareFadeSpeed              = RenderSettings.flareFadeSpeed;

            m_UseSceneSun = true;
            UpdateUsingSunSceneRenderSettingsValues();
        }
        private void SetEnvironmentReflections(LightingProfile current, LightingProfile source, float blend)
        {
            if (customReflection != source.customReflection)
            {
                customReflection = source.customReflection;
            }
            if (defaultReflectionMode != source.defaultReflectionMode)
            {
                defaultReflectionMode = source.defaultReflectionMode;
            }
            if (defaultReflectionResolution != source.defaultReflectionResolution)
            {
                defaultReflectionResolution = source.defaultReflectionResolution;
            }
            if (reflectionBounces != source.reflectionBounces)
            {
                reflectionBounces = source.reflectionBounces;
            }

            reflectionIntensity = Mathf.Lerp(current.reflectionIntensity, source.reflectionIntensity, blend);
        }
 public void CopyFromCurrentScene()
 {
     ambientEquatorColor         = RenderSettings.ambientEquatorColor;
     ambientGroundColor          = RenderSettings.ambientGroundColor;
     ambientIntensity            = RenderSettings.ambientIntensity;
     sourceLighting              = (SourceLighting)RenderSettings.ambientMode;
     ambientSkyColor             = RenderSettings.ambientSkyColor;
     customReflection            = RenderSettings.customReflection;
     defaultReflectionMode       = RenderSettings.defaultReflectionMode;
     defaultReflectionResolution = RenderSettings.defaultReflectionResolution;
     flareFadeSpeed              = RenderSettings.flareFadeSpeed;
     flareStrength          = RenderSettings.flareStrength;
     fog                    = RenderSettings.fog;
     fogColor               = RenderSettings.fogColor;
     fogDensity             = RenderSettings.fogDensity;
     fogEndDistance         = RenderSettings.fogEndDistance;
     fogMode                = RenderSettings.fogMode;
     fogStartDistance       = RenderSettings.fogStartDistance;
     haloStrength           = RenderSettings.haloStrength;
     reflectionBounces      = RenderSettings.reflectionBounces;
     reflectionIntensity    = RenderSettings.reflectionIntensity;
     skybox                 = RenderSettings.skybox;
     subtractiveShadowColor = RenderSettings.subtractiveShadowColor;
 }
Exemple #9
0
        private void DrawGUI()
        {
            Material material = this.m_SkyboxMaterial.objectReferenceValue as Material;

            this.m_bShowEnvironment = EditorGUILayout.FoldoutTitlebar(this.m_bShowEnvironment, LightingEditor.Styles.env_top, true);
            if (this.m_bShowEnvironment)
            {
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(this.m_SkyboxMaterial, LightingEditor.Styles.env_skybox_mat, new GUILayoutOption[0]);
                if (material && !EditorMaterialUtility.IsBackgroundMaterial(material))
                {
                    EditorGUILayout.HelpBox(LightingEditor.Styles.skyboxWarning.text, MessageType.Warning);
                }
                EditorGUILayout.PropertyField(this.m_Sun, LightingEditor.Styles.env_skybox_sun, new GUILayoutOption[0]);
                EditorGUILayout.Space();
                EditorGUILayout.LabelField(LightingEditor.Styles.env_amb_top, new GUILayoutOption[0]);
                EditorGUI.indentLevel++;
                EditorGUILayout.IntPopup(this.m_AmbientSource, LightingEditor.Styles.kFullAmbientSource, LightingEditor.Styles.kFullAmbientSourceValues, LightingEditor.Styles.env_amb_src, new GUILayoutOption[0]);
                AmbientMode intValue = (AmbientMode)this.m_AmbientSource.intValue;
                if (intValue != AmbientMode.Trilight)
                {
                    if (intValue != AmbientMode.Flat)
                    {
                        if (intValue == AmbientMode.Skybox)
                        {
                            if (material == null)
                            {
                                EditorGUI.BeginChangeCheck();
                                Color colorValue = EditorGUILayout.ColorField(LightingEditor.Styles.ambient, this.m_AmbientSkyColor.colorValue, true, false, true, ColorPicker.defaultHDRConfig, new GUILayoutOption[0]);
                                if (EditorGUI.EndChangeCheck())
                                {
                                    this.m_AmbientSkyColor.colorValue = colorValue;
                                }
                            }
                            else
                            {
                                EditorGUILayout.Slider(this.m_AmbientIntensity, 0f, 8f, LightingEditor.Styles.env_amb_int, new GUILayoutOption[0]);
                            }
                        }
                    }
                    else
                    {
                        EditorGUI.BeginChangeCheck();
                        Color colorValue2 = EditorGUILayout.ColorField(LightingEditor.Styles.ambient, this.m_AmbientSkyColor.colorValue, true, false, true, ColorPicker.defaultHDRConfig, new GUILayoutOption[0]);
                        if (EditorGUI.EndChangeCheck())
                        {
                            this.m_AmbientSkyColor.colorValue = colorValue2;
                        }
                    }
                }
                else
                {
                    EditorGUI.BeginChangeCheck();
                    Color colorValue3 = EditorGUILayout.ColorField(LightingEditor.Styles.ambientUp, this.m_AmbientSkyColor.colorValue, true, false, true, ColorPicker.defaultHDRConfig, new GUILayoutOption[0]);
                    Color colorValue4 = EditorGUILayout.ColorField(LightingEditor.Styles.ambientMid, this.m_AmbientEquatorColor.colorValue, true, false, true, ColorPicker.defaultHDRConfig, new GUILayoutOption[0]);
                    Color colorValue5 = EditorGUILayout.ColorField(LightingEditor.Styles.ambientDown, this.m_AmbientGroundColor.colorValue, true, false, true, ColorPicker.defaultHDRConfig, new GUILayoutOption[0]);
                    if (EditorGUI.EndChangeCheck())
                    {
                        this.m_AmbientSkyColor.colorValue     = colorValue3;
                        this.m_AmbientEquatorColor.colorValue = colorValue4;
                        this.m_AmbientGroundColor.colorValue  = colorValue5;
                    }
                }
                if (LightModeUtil.Get().IsAnyGIEnabled())
                {
                    int  selectedValue;
                    bool ambientLightingMode = LightModeUtil.Get().GetAmbientLightingMode(out selectedValue);
                    using (new EditorGUI.DisabledScope(!ambientLightingMode))
                    {
                        int[] optionValues = new int[]
                        {
                            0,
                            1
                        };
                        if (ambientLightingMode)
                        {
                            this.m_AmbientLightingMode.intValue = EditorGUILayout.IntPopup(LightingEditor.Styles.AmbientLightingMode, this.m_AmbientLightingMode.intValue, LightingEditor.Styles.AmbientLightingModes, optionValues, new GUILayoutOption[0]);
                        }
                        else
                        {
                            EditorGUILayout.IntPopup(LightingEditor.Styles.AmbientLightingMode, selectedValue, LightingEditor.Styles.AmbientLightingModes, optionValues, new GUILayoutOption[0]);
                        }
                    }
                }
                EditorGUI.indentLevel--;
                EditorGUILayout.Space();
                EditorGUILayout.LabelField(LightingEditor.Styles.env_refl_top, new GUILayoutOption[0]);
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(this.m_DefaultReflectionMode, LightingEditor.Styles.env_refl_src, new GUILayoutOption[0]);
                DefaultReflectionMode intValue2 = (DefaultReflectionMode)this.m_DefaultReflectionMode.intValue;
                if (intValue2 != DefaultReflectionMode.FromSkybox)
                {
                    if (intValue2 == DefaultReflectionMode.Custom)
                    {
                        EditorGUILayout.PropertyField(this.m_CustomReflection, LightingEditor.Styles.customReflection, new GUILayoutOption[0]);
                    }
                }
                else
                {
                    EditorGUILayout.IntPopup(this.m_DefaultReflectionResolution, LightingEditor.Styles.defaultReflectionSizes, LightingEditor.Styles.defaultReflectionSizesValues, LightingEditor.Styles.env_refl_res, new GUILayoutOption[]
                    {
                        GUILayout.MinWidth(40f)
                    });
                }
                EditorGUILayout.PropertyField(this.m_ReflectionCompression, LightingEditor.Styles.env_refl_cmp, new GUILayoutOption[0]);
                EditorGUILayout.Slider(this.m_ReflectionIntensity, 0f, 1f, LightingEditor.Styles.env_refl_int, new GUILayoutOption[0]);
                EditorGUILayout.IntSlider(this.m_ReflectionBounces, 1, 5, LightingEditor.Styles.env_refl_bnc, new GUILayoutOption[0]);
                EditorGUI.indentLevel--;
                EditorGUI.indentLevel--;
                EditorGUILayout.Space();
            }
        }
        private void DrawGUI()
        {
            Material skyboxMaterial = m_SkyboxMaterial.objectReferenceValue as Material;

            m_bShowEnvironment = EditorGUILayout.FoldoutTitlebar(m_bShowEnvironment, Styles.env_top, true);

            if (m_bShowEnvironment)
            {
                EditorGUI.indentLevel++;

                EditorGUILayout.PropertyField(m_SkyboxMaterial, Styles.env_skybox_mat);
                if (skyboxMaterial && !EditorMaterialUtility.IsBackgroundMaterial(skyboxMaterial))
                {
                    EditorGUILayout.HelpBox(Styles.skyboxWarning.text, MessageType.Warning);
                }

                EditorGUILayout.PropertyField(m_Sun, Styles.env_skybox_sun);
                EditorGUILayout.Space();

                EditorGUILayout.LabelField(Styles.env_amb_top);
                EditorGUI.indentLevel++;

                EditorGUILayout.IntPopup(m_AmbientSource, Styles.kFullAmbientSource, Styles.kFullAmbientSourceValues, Styles.env_amb_src);
                switch ((AmbientMode)m_AmbientSource.intValue)
                {
                case AmbientMode.Trilight:
                {
                    EditorGUI.BeginChangeCheck();
                    Color newValueUp   = EditorGUILayout.ColorField(Styles.ambientUp, m_AmbientSkyColor.colorValue, true, false, true);
                    Color newValueMid  = EditorGUILayout.ColorField(Styles.ambientMid, m_AmbientEquatorColor.colorValue, true, false, true);
                    Color newValueDown = EditorGUILayout.ColorField(Styles.ambientDown, m_AmbientGroundColor.colorValue, true, false, true);
                    if (EditorGUI.EndChangeCheck())
                    {
                        m_AmbientSkyColor.colorValue     = newValueUp;
                        m_AmbientEquatorColor.colorValue = newValueMid;
                        m_AmbientGroundColor.colorValue  = newValueDown;
                    }
                }
                break;

                case AmbientMode.Flat:
                {
                    EditorGUI.BeginChangeCheck();
                    Color newValue = EditorGUILayout.ColorField(Styles.ambient, m_AmbientSkyColor.colorValue, true, false, true);
                    if (EditorGUI.EndChangeCheck())
                    {
                        m_AmbientSkyColor.colorValue = newValue;
                    }
                }
                break;

                case AmbientMode.Skybox:
                    if (skyboxMaterial == null)
                    {
                        EditorGUI.BeginChangeCheck();
                        Color newValue = EditorGUILayout.ColorField(Styles.ambient, m_AmbientSkyColor.colorValue, true, false, true);
                        if (EditorGUI.EndChangeCheck())
                        {
                            m_AmbientSkyColor.colorValue = newValue;
                        }
                    }
                    else
                    {
                        // Ambient intensity - maximum is kEmissiveRGBMMax
                        EditorGUILayout.Slider(m_AmbientIntensity, 0.0F, 8.0F, Styles.env_amb_int);
                    }
                    break;
                }

                // ambient GI - realtime / baked
                bool realtimeGISupported = SupportedRenderingFeatures.IsLightmapBakeTypeSupported(LightmapBakeType.Realtime);
                bool bakedGISupported    = SupportedRenderingFeatures.IsLightmapBakeTypeSupported(LightmapBakeType.Baked);

                if ((m_EnabledBakedGI.boolValue || m_EnabledRealtimeGI.boolValue) && (bakedGISupported || realtimeGISupported))
                {
                    int[] modeVals = { 0, 1 };

                    if (m_EnabledBakedGI.boolValue && m_EnabledRealtimeGI.boolValue)
                    {
                        // if the user has selected the only state that is supported, then gray it out
                        using (new EditorGUI.DisabledScope(((m_AmbientLightingMode.intValue == 0) && realtimeGISupported && !bakedGISupported) || ((m_AmbientLightingMode.intValue == 1) && bakedGISupported && !realtimeGISupported)))
                        {
                            EditorGUILayout.IntPopup(m_AmbientLightingMode, Styles.AmbientLightingModes, modeVals, Styles.AmbientLightingMode);
                        }

                        // if they have selected a state that isnt supported, show dialog, and still make the box editable
                        if (((m_AmbientLightingMode.intValue == 0) && !realtimeGISupported) ||
                            ((m_AmbientLightingMode.intValue == 1) && !bakedGISupported))
                        {
                            EditorGUILayout.HelpBox("The following mode is not supported and will fallback on " + (((m_AmbientLightingMode.intValue == 0) && !realtimeGISupported) ? "Baked" : "Realtime"), MessageType.Warning);
                        }
                    }
                    // Show "Baked" if precomputed GI is disabled and "Realtime" if baked GI is disabled (but we don't wanna show the box if the whole mode is not supported.)
                    else if ((m_EnabledBakedGI.boolValue && bakedGISupported) || (m_EnabledRealtimeGI.boolValue && realtimeGISupported))
                    {
                        using (new EditorGUI.DisabledScope(true))
                        {
                            EditorGUILayout.IntPopup(Styles.AmbientLightingMode, m_EnabledBakedGI.boolValue ? 1 : 0, Styles.AmbientLightingModes, modeVals);
                        }
                    }
                }

                EditorGUI.indentLevel--;
                EditorGUILayout.Space();

                EditorGUILayout.LabelField(Styles.env_refl_top);
                EditorGUI.indentLevel++;

                EditorGUILayout.PropertyField(m_DefaultReflectionMode, Styles.env_refl_src);

                DefaultReflectionMode defReflectionMode = (DefaultReflectionMode)m_DefaultReflectionMode.intValue;
                switch (defReflectionMode)
                {
                case DefaultReflectionMode.FromSkybox:
                {
                    int[]        reflectionResolutionValuesArray = null;
                    GUIContent[] reflectionResolutionTextArray   = null;
                    ReflectionProbeEditor.GetResolutionArray(ref reflectionResolutionValuesArray, ref reflectionResolutionTextArray);
                    EditorGUILayout.IntPopup(m_DefaultReflectionResolution, reflectionResolutionTextArray, reflectionResolutionValuesArray, Styles.env_refl_res, GUILayout.MinWidth(40));
                }
                break;

                case DefaultReflectionMode.Custom:
                    EditorGUILayout.PropertyField(m_CustomReflection, Styles.customReflection);
                    break;
                }

                EditorGUILayout.PropertyField(m_ReflectionCompression, Styles.env_refl_cmp);
                EditorGUILayout.Slider(m_ReflectionIntensity, 0.0F, 1.0F, Styles.env_refl_int);
                EditorGUILayout.IntSlider(m_ReflectionBounces, 1, 5, Styles.env_refl_bnc);

                EditorGUI.indentLevel--;

                EditorGUI.indentLevel--;
                EditorGUILayout.Space();
            }
        }
        public override void OnInspectorGUI()
        {
            base.serializedObject.Update();
            this.m_lightmapSettings.Update();
            EditorGUILayout.Space();
            this.m_ShowEditor = EditorGUILayout.FoldoutTitlebar(this.m_ShowEditor, LightingEditor.Styles.environmentHeader);
            if (!this.m_ShowEditor)
            {
                return;
            }
            EditorGUI.indentLevel++;
            EditorGUILayout.PropertyField(this.m_SkyboxMaterial, LightingEditor.Styles.skyboxLabel, new GUILayoutOption[0]);
            Material material = this.m_SkyboxMaterial.objectReferenceValue as Material;

            if (material && !EditorMaterialUtility.IsBackgroundMaterial(material))
            {
                EditorGUILayout.HelpBox(LightingEditor.Styles.skyboxWarning.text, MessageType.Warning);
            }
            EditorGUILayout.PropertyField(this.m_Sun, LightingEditor.Styles.sunLabel, new GUILayoutOption[0]);
            EditorGUILayout.Space();
            EditorGUILayout.IntPopup(this.m_AmbientMode, LightingEditor.kFullAmbientModes, LightingEditor.kFullAmbientModeValues, LightingEditor.Styles.ambientModeLabel, new GUILayoutOption[0]);
            EditorGUI.indentLevel++;
            switch (this.m_AmbientMode.intValue)
            {
            case 0:
                if (material == null)
                {
                    EditorGUILayout.PropertyField(this.m_AmbientSkyColor, LightingEditor.Styles.ambient, new GUILayoutOption[0]);
                }
                break;

            case 1:
                EditorGUILayout.PropertyField(this.m_AmbientSkyColor, LightingEditor.Styles.ambientUp, new GUILayoutOption[0]);
                EditorGUILayout.PropertyField(this.m_AmbientEquatorColor, LightingEditor.Styles.ambientMid, new GUILayoutOption[0]);
                EditorGUILayout.PropertyField(this.m_AmbientGroundColor, LightingEditor.Styles.ambientDown, new GUILayoutOption[0]);
                break;

            case 3:
                EditorGUILayout.PropertyField(this.m_AmbientSkyColor, LightingEditor.Styles.ambient, new GUILayoutOption[0]);
                break;
            }
            EditorGUI.indentLevel--;
            EditorGUILayout.Slider(this.m_AmbientIntensity, 0f, 8f, LightingEditor.Styles.ambientIntensity, new GUILayoutOption[0]);
            this.m_ShowAmbientBakeMode.target = LightingEditor.ShowAmbientField();
            if (EditorGUILayout.BeginFadeGroup(this.m_ShowAmbientBakeMode.faded))
            {
                bool flag = Lightmapping.realtimeLightmapsEnabled && Lightmapping.bakedLightmapsEnabled;
                EditorGUI.BeginDisabledGroup(!flag);
                if (flag)
                {
                    EditorGUILayout.PropertyField(this.m_EnvironmentLightingMode, LightingEditor.Styles.SkyLightBaked, new GUILayoutOption[0]);
                }
                else
                {
                    int num = (!Lightmapping.bakedLightmapsEnabled) ? 0 : 1;
                    EditorGUILayout.LabelField(LightingEditor.Styles.SkyLightBaked, GUIContent.Temp(this.m_EnvironmentLightingMode.enumNames[num]), EditorStyles.popup, new GUILayoutOption[0]);
                }
                EditorGUI.EndDisabledGroup();
            }
            EditorGUILayout.EndFadeGroup();
            EditorGUILayout.Space();
            EditorGUILayout.PropertyField(this.m_DefaultReflectionMode, LightingEditor.Styles.reflectionModeLabel, new GUILayoutOption[0]);
            EditorGUI.indentLevel++;
            DefaultReflectionMode intValue = (DefaultReflectionMode)this.m_DefaultReflectionMode.intValue;

            if (intValue != DefaultReflectionMode.FromSkybox)
            {
                if (intValue == DefaultReflectionMode.Custom)
                {
                    EditorGUILayout.PropertyField(this.m_CustomReflection, LightingEditor.Styles.customReflection, new GUILayoutOption[0]);
                }
            }
            else
            {
                EditorGUILayout.IntPopup(this.m_DefaultReflectionResolution, LightingEditor.Styles.defaultReflectionSizes, LightingEditor.Styles.defaultReflectionSizesValues, LightingEditor.Styles.defaultReflectionResolution, new GUILayoutOption[]
                {
                    GUILayout.MinWidth(40f)
                });
            }
            EditorGUILayout.PropertyField(this.m_ReflectionCompression, LightingEditor.Styles.ReflectionCompression, new GUILayoutOption[0]);
            EditorGUI.indentLevel--;
            EditorGUILayout.Slider(this.m_ReflectionIntensity, 0f, 1f, LightingEditor.Styles.reflectionIntensity, new GUILayoutOption[0]);
            EditorGUILayout.IntSlider(this.m_ReflectionBounces, 1, 5, LightingEditor.Styles.reflectionBounces, new GUILayoutOption[0]);
            EditorGUI.indentLevel--;
            base.serializedObject.ApplyModifiedProperties();
            this.m_lightmapSettings.ApplyModifiedProperties();
        }
Exemple #12
0
 public override void OnInspectorGUI()
 {
     base.serializedObject.Update();
     this.m_lightmapSettings.Update();
     EditorGUILayout.Space();
     this.m_ShowEditor = EditorGUILayout.FoldoutTitlebar(this.m_ShowEditor, LightingEditor.Styles.environmentHeader);
     if (this.m_ShowEditor)
     {
         EditorGUI.indentLevel++;
         EditorGUILayout.PropertyField(this.m_SkyboxMaterial, LightingEditor.Styles.skyboxLabel, new GUILayoutOption[0]);
         Material material = this.m_SkyboxMaterial.objectReferenceValue as Material;
         if (material && !EditorMaterialUtility.IsBackgroundMaterial(material))
         {
             EditorGUILayout.HelpBox(LightingEditor.Styles.skyboxWarning.text, MessageType.Warning);
         }
         EditorGUILayout.PropertyField(this.m_Sun, LightingEditor.Styles.sunLabel, new GUILayoutOption[0]);
         EditorGUILayout.Space();
         EditorGUILayout.IntPopup(this.m_AmbientMode, LightingEditor.Styles.kFullAmbientModes, LightingEditor.Styles.kFullAmbientModeValues, LightingEditor.Styles.ambientModeLabel, new GUILayoutOption[0]);
         EditorGUI.indentLevel++;
         AmbientMode intValue = (AmbientMode)this.m_AmbientMode.intValue;
         if (intValue != AmbientMode.Trilight)
         {
             if (intValue != AmbientMode.Flat)
             {
                 if (intValue == AmbientMode.Skybox)
                 {
                     if (material == null)
                     {
                         EditorGUI.BeginChangeCheck();
                         Color colorValue = EditorGUILayout.ColorField(LightingEditor.Styles.ambient, this.m_AmbientSkyColor.colorValue, true, false, true, ColorPicker.defaultHDRConfig, new GUILayoutOption[0]);
                         if (EditorGUI.EndChangeCheck())
                         {
                             this.m_AmbientSkyColor.colorValue = colorValue;
                         }
                     }
                     else
                     {
                         EditorGUILayout.Slider(this.m_AmbientIntensity, 0f, 8f, LightingEditor.Styles.ambientIntensity, new GUILayoutOption[0]);
                     }
                 }
             }
             else
             {
                 EditorGUI.BeginChangeCheck();
                 Color colorValue2 = EditorGUILayout.ColorField(LightingEditor.Styles.ambient, this.m_AmbientSkyColor.colorValue, true, false, true, ColorPicker.defaultHDRConfig, new GUILayoutOption[0]);
                 if (EditorGUI.EndChangeCheck())
                 {
                     this.m_AmbientSkyColor.colorValue = colorValue2;
                 }
             }
         }
         else
         {
             EditorGUI.BeginChangeCheck();
             Color colorValue3 = EditorGUILayout.ColorField(LightingEditor.Styles.ambientUp, this.m_AmbientSkyColor.colorValue, true, false, true, ColorPicker.defaultHDRConfig, new GUILayoutOption[0]);
             Color colorValue4 = EditorGUILayout.ColorField(LightingEditor.Styles.ambientMid, this.m_AmbientEquatorColor.colorValue, true, false, true, ColorPicker.defaultHDRConfig, new GUILayoutOption[0]);
             Color colorValue5 = EditorGUILayout.ColorField(LightingEditor.Styles.ambientDown, this.m_AmbientGroundColor.colorValue, true, false, true, ColorPicker.defaultHDRConfig, new GUILayoutOption[0]);
             if (EditorGUI.EndChangeCheck())
             {
                 this.m_AmbientSkyColor.colorValue     = colorValue3;
                 this.m_AmbientEquatorColor.colorValue = colorValue4;
                 this.m_AmbientGroundColor.colorValue  = colorValue5;
             }
         }
         EditorGUI.indentLevel--;
         this.m_ShowAmbientBakeMode.target = LightingEditor.ShowAmbientField();
         if (EditorGUILayout.BeginFadeGroup(this.m_ShowAmbientBakeMode.faded))
         {
             bool flag = Lightmapping.realtimeGI && Lightmapping.bakedGI;
             using (new EditorGUI.DisabledScope(!flag))
             {
                 if (flag)
                 {
                     EditorGUILayout.PropertyField(this.m_EnvironmentLightingMode, LightingEditor.Styles.SkyLightBaked, new GUILayoutOption[0]);
                 }
                 else
                 {
                     int num = (!Lightmapping.bakedGI) ? 0 : 1;
                     EditorGUILayout.LabelField(LightingEditor.Styles.SkyLightBaked, GUIContent.Temp(this.m_EnvironmentLightingMode.enumNames[num]), EditorStyles.popup, new GUILayoutOption[0]);
                 }
             }
         }
         EditorGUILayout.EndFadeGroup();
         EditorGUILayout.Space();
         EditorGUILayout.PropertyField(this.m_DefaultReflectionMode, LightingEditor.Styles.reflectionModeLabel, new GUILayoutOption[0]);
         EditorGUI.indentLevel++;
         Cubemap exists = this.m_CustomReflection.objectReferenceValue as Cubemap;
         DefaultReflectionMode intValue2 = (DefaultReflectionMode)this.m_DefaultReflectionMode.intValue;
         if ((!material && intValue2 == DefaultReflectionMode.FromSkybox) || (!exists && intValue2 == DefaultReflectionMode.Custom))
         {
             EditorGUILayout.HelpBox(LightingEditor.Styles.defReflectionWarning.text, MessageType.Warning);
         }
         if (intValue2 != DefaultReflectionMode.FromSkybox)
         {
             if (intValue2 == DefaultReflectionMode.Custom)
             {
                 EditorGUILayout.PropertyField(this.m_CustomReflection, LightingEditor.Styles.customReflection, new GUILayoutOption[0]);
             }
         }
         else
         {
             EditorGUILayout.IntPopup(this.m_DefaultReflectionResolution, LightingEditor.Styles.defaultReflectionSizes, LightingEditor.Styles.defaultReflectionSizesValues, LightingEditor.Styles.defaultReflectionResolution, new GUILayoutOption[]
             {
                 GUILayout.MinWidth(40f)
             });
         }
         EditorGUILayout.PropertyField(this.m_ReflectionCompression, LightingEditor.Styles.ReflectionCompression, new GUILayoutOption[0]);
         EditorGUI.indentLevel--;
         EditorGUILayout.Slider(this.m_ReflectionIntensity, 0f, 1f, LightingEditor.Styles.reflectionIntensity, new GUILayoutOption[0]);
         EditorGUILayout.IntSlider(this.m_ReflectionBounces, 1, 5, LightingEditor.Styles.reflectionBounces, new GUILayoutOption[0]);
         EditorGUI.indentLevel--;
         base.serializedObject.ApplyModifiedProperties();
         this.m_lightmapSettings.ApplyModifiedProperties();
     }
 }
Exemple #13
0
    public void Save()
    {
        if (_ambientEquatorColor != RenderSettings.ambientEquatorColor)
        {
            _ambientEquatorColor = RenderSettings.ambientEquatorColor;
        }
        if (_ambientGroundColor != RenderSettings.ambientGroundColor)
        {
            _ambientGroundColor = RenderSettings.ambientGroundColor;
        }
        if (_ambientIntensity != RenderSettings.ambientIntensity)
        {
            _ambientIntensity = RenderSettings.ambientIntensity;
        }
        if (_subtractiveShadowColor != RenderSettings.subtractiveShadowColor)
        {
            _subtractiveShadowColor = RenderSettings.subtractiveShadowColor;
        }
        if (_ambientProbe != RenderSettings.ambientProbe)
        {
            _ambientProbe = RenderSettings.ambientProbe;
        }
        if (_ambientMode != RenderSettings.ambientMode)
        {
            _ambientMode = RenderSettings.ambientMode;
        }
        if (_ambientSkyColor != RenderSettings.ambientSkyColor)
        {
            _ambientSkyColor = RenderSettings.ambientSkyColor;
        }

        if (_defaultReflectionMode != RenderSettings.defaultReflectionMode)
        {
            _defaultReflectionMode = RenderSettings.defaultReflectionMode;
        }
        if (_defaultReflectionResolution != RenderSettings.defaultReflectionResolution)
        {
            _defaultReflectionResolution = RenderSettings.defaultReflectionResolution;
        }
        if (_reflectionBounces != RenderSettings.reflectionBounces)
        {
            _reflectionBounces = RenderSettings.reflectionBounces;
        }
        if (_reflectionIntensity != RenderSettings.reflectionIntensity)
        {
            _reflectionIntensity = RenderSettings.reflectionIntensity;
        }
        if (_aoExponentDirect != LightmapEditorSettings.aoExponentDirect)
        {
            _aoExponentDirect = LightmapEditorSettings.aoExponentDirect;
        }
        if (_aoExponentIndirect != LightmapEditorSettings.aoExponentIndirect)
        {
            _aoExponentIndirect = LightmapEditorSettings.aoExponentIndirect;
        }
        if (_aoMaxDistance != LightmapEditorSettings.aoMaxDistance)
        {
            _aoMaxDistance = LightmapEditorSettings.aoMaxDistance;
        }
        if (_bakeResolution != LightmapEditorSettings.bakeResolution)
        {
            _bakeResolution = LightmapEditorSettings.bakeResolution;
        }
        if (_enableAmbientOcclusion != LightmapEditorSettings.enableAmbientOcclusion)
        {
            _enableAmbientOcclusion = LightmapEditorSettings.enableAmbientOcclusion;
        }
        if (_maxAtlasSize != LightmapEditorSettings.maxAtlasSize)
        {
            _maxAtlasSize = LightmapEditorSettings.maxAtlasSize;
        }
        if (_padding != LightmapEditorSettings.padding)
        {
            _padding = LightmapEditorSettings.padding;
        }
        if (_realtimeResolution != LightmapEditorSettings.realtimeResolution)
        {
            _realtimeResolution = LightmapEditorSettings.realtimeResolution;
        }
        if (_reflectionCubemapCompression != LightmapEditorSettings.reflectionCubemapCompression)
        {
            _reflectionCubemapCompression = LightmapEditorSettings.reflectionCubemapCompression;
        }
        if (_textureCompression != LightmapEditorSettings.textureCompression)
        {
            _textureCompression = LightmapEditorSettings.textureCompression;
        }

        if (_bakedGI != Lightmapping.bakedGI)
        {
            _bakedGI = Lightmapping.bakedGI;
        }
        if (_bounceBoost != Lightmapping.bounceBoost)
        {
            _bounceBoost = Lightmapping.bounceBoost;
        }
        if (_giWorkflowMode != Lightmapping.giWorkflowMode)
        {
            _giWorkflowMode = Lightmapping.giWorkflowMode;
        }
        if (_indirectOutputScale != Lightmapping.indirectOutputScale)
        {
            _indirectOutputScale = Lightmapping.indirectOutputScale;
        }
        if (_realtimeGI != Lightmapping.realtimeGI)
        {
            _realtimeGI = Lightmapping.realtimeGI;
        }
        if (_lightmapsMode != LightmapSettings.lightmapsMode)
        {
            _lightmapsMode = LightmapSettings.lightmapsMode;
        }
    }
Exemple #14
0
        private void DrawGUI()
        {
            Material skyboxMaterial = m_SkyboxMaterial.objectReferenceValue as Material;

            m_bShowEnvironment = EditorGUILayout.FoldoutTitlebar(m_bShowEnvironment, Styles.env_top, true);

            if (m_bShowEnvironment)
            {
                EditorGUI.indentLevel++;

                EditorGUILayout.PropertyField(m_SkyboxMaterial, Styles.env_skybox_mat);
                if (skyboxMaterial && !EditorMaterialUtility.IsBackgroundMaterial(skyboxMaterial))
                {
                    EditorGUILayout.HelpBox(Styles.skyboxWarning.text, MessageType.Warning);
                }

                EditorGUILayout.PropertyField(m_Sun, Styles.env_skybox_sun);
                EditorGUILayout.Space();

                EditorGUILayout.PropertyField(m_SubtractiveShadowColor, Styles.SubtractiveColor);
                EditorGUILayout.Space();

                EditorGUILayout.LabelField(Styles.env_amb_top);
                EditorGUI.indentLevel++;

                EditorGUILayout.IntPopup(m_AmbientSource, Styles.kFullAmbientSource, Styles.kFullAmbientSourceValues, Styles.env_amb_src);
                switch ((AmbientMode)m_AmbientSource.intValue)
                {
                case AmbientMode.Trilight:
                {
                    EditorGUI.BeginChangeCheck();
                    Color newValueUp   = EditorGUILayout.ColorField(Styles.ambientUp, m_AmbientSkyColor.colorValue, true, false, true);
                    Color newValueMid  = EditorGUILayout.ColorField(Styles.ambientMid, m_AmbientEquatorColor.colorValue, true, false, true);
                    Color newValueDown = EditorGUILayout.ColorField(Styles.ambientDown, m_AmbientGroundColor.colorValue, true, false, true);
                    if (EditorGUI.EndChangeCheck())
                    {
                        m_AmbientSkyColor.colorValue     = newValueUp;
                        m_AmbientEquatorColor.colorValue = newValueMid;
                        m_AmbientGroundColor.colorValue  = newValueDown;
                    }
                }
                break;

                case AmbientMode.Flat:
                {
                    EditorGUI.BeginChangeCheck();
                    Color newValue = EditorGUILayout.ColorField(Styles.ambient, m_AmbientSkyColor.colorValue, true, false, true);
                    if (EditorGUI.EndChangeCheck())
                    {
                        m_AmbientSkyColor.colorValue = newValue;
                    }
                }
                break;

                case AmbientMode.Skybox:
                    if (skyboxMaterial == null)
                    {
                        EditorGUI.BeginChangeCheck();
                        Color newValue = EditorGUILayout.ColorField(Styles.ambient, m_AmbientSkyColor.colorValue, true, false, true);
                        if (EditorGUI.EndChangeCheck())
                        {
                            m_AmbientSkyColor.colorValue = newValue;
                        }
                    }
                    else
                    {
                        // Ambient intensity - maximum is kEmissiveRGBMMax
                        EditorGUILayout.Slider(m_AmbientIntensity, 0.0F, 8.0F, Styles.env_amb_int);
                    }
                    break;
                }

                EditorGUI.indentLevel--;
                EditorGUILayout.Space();

                EditorGUILayout.LabelField(Styles.env_refl_top);
                EditorGUI.indentLevel++;

                EditorGUILayout.PropertyField(m_DefaultReflectionMode, Styles.env_refl_src);

                DefaultReflectionMode defReflectionMode = (DefaultReflectionMode)m_DefaultReflectionMode.intValue;
                switch (defReflectionMode)
                {
                case DefaultReflectionMode.FromSkybox:
                {
                    int[]        reflectionResolutionValuesArray = null;
                    GUIContent[] reflectionResolutionTextArray   = null;
                    ReflectionProbeEditor.GetResolutionArray(ref reflectionResolutionValuesArray, ref reflectionResolutionTextArray);
                    EditorGUILayout.IntPopup(m_DefaultReflectionResolution, reflectionResolutionTextArray, reflectionResolutionValuesArray, Styles.env_refl_res, GUILayout.MinWidth(40));
                }
                break;

                case DefaultReflectionMode.Custom:
                    EditorGUILayout.PropertyField(m_CustomReflection, Styles.customReflection);
                    break;
                }

                EditorGUILayout.PropertyField(m_ReflectionCompression, Styles.env_refl_cmp);
                EditorGUILayout.Slider(m_ReflectionIntensity, 0.0F, 1.0F, Styles.env_refl_int);
                EditorGUILayout.IntSlider(m_ReflectionBounces, 1, 5, Styles.env_refl_bnc);

                EditorGUI.indentLevel--;

                EditorGUI.indentLevel--;
                EditorGUILayout.Space();
            }
        }
Exemple #15
0
        private void DrawGUI()
        {
            Material material = this.m_SkyboxMaterial.objectReferenceValue as Material;

            this.m_bShowEnvironment = EditorGUILayout.FoldoutTitlebar(this.m_bShowEnvironment, LightingEditor.Styles.env_top, true);
            if (this.m_bShowEnvironment)
            {
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(this.m_SkyboxMaterial, LightingEditor.Styles.env_skybox_mat, new GUILayoutOption[0]);
                if (material && !EditorMaterialUtility.IsBackgroundMaterial(material))
                {
                    EditorGUILayout.HelpBox(LightingEditor.Styles.skyboxWarning.text, MessageType.Warning);
                }
                EditorGUILayout.PropertyField(this.m_Sun, LightingEditor.Styles.env_skybox_sun, new GUILayoutOption[0]);
                EditorGUILayout.Space();
                EditorGUILayout.LabelField(LightingEditor.Styles.env_amb_top, new GUILayoutOption[0]);
                EditorGUI.indentLevel++;
                EditorGUILayout.IntPopup(this.m_AmbientSource, LightingEditor.Styles.kFullAmbientSource, LightingEditor.Styles.kFullAmbientSourceValues, LightingEditor.Styles.env_amb_src, new GUILayoutOption[0]);
                AmbientMode intValue = (AmbientMode)this.m_AmbientSource.intValue;
                if (intValue != AmbientMode.Trilight)
                {
                    if (intValue != AmbientMode.Flat)
                    {
                        if (intValue == AmbientMode.Skybox)
                        {
                            if (material == null)
                            {
                                EditorGUI.BeginChangeCheck();
                                Color colorValue = EditorGUILayout.ColorField(LightingEditor.Styles.ambient, this.m_AmbientSkyColor.colorValue, true, false, true, new GUILayoutOption[0]);
                                if (EditorGUI.EndChangeCheck())
                                {
                                    this.m_AmbientSkyColor.colorValue = colorValue;
                                }
                            }
                            else
                            {
                                EditorGUILayout.Slider(this.m_AmbientIntensity, 0f, 8f, LightingEditor.Styles.env_amb_int, new GUILayoutOption[0]);
                            }
                        }
                    }
                    else
                    {
                        EditorGUI.BeginChangeCheck();
                        Color colorValue2 = EditorGUILayout.ColorField(LightingEditor.Styles.ambient, this.m_AmbientSkyColor.colorValue, true, false, true, new GUILayoutOption[0]);
                        if (EditorGUI.EndChangeCheck())
                        {
                            this.m_AmbientSkyColor.colorValue = colorValue2;
                        }
                    }
                }
                else
                {
                    EditorGUI.BeginChangeCheck();
                    Color colorValue3 = EditorGUILayout.ColorField(LightingEditor.Styles.ambientUp, this.m_AmbientSkyColor.colorValue, true, false, true, new GUILayoutOption[0]);
                    Color colorValue4 = EditorGUILayout.ColorField(LightingEditor.Styles.ambientMid, this.m_AmbientEquatorColor.colorValue, true, false, true, new GUILayoutOption[0]);
                    Color colorValue5 = EditorGUILayout.ColorField(LightingEditor.Styles.ambientDown, this.m_AmbientGroundColor.colorValue, true, false, true, new GUILayoutOption[0]);
                    if (EditorGUI.EndChangeCheck())
                    {
                        this.m_AmbientSkyColor.colorValue     = colorValue3;
                        this.m_AmbientEquatorColor.colorValue = colorValue4;
                        this.m_AmbientGroundColor.colorValue  = colorValue5;
                    }
                }
                bool flag  = SupportedRenderingFeatures.IsLightmapBakeTypeSupported(LightmapBakeType.Realtime);
                bool flag2 = SupportedRenderingFeatures.IsLightmapBakeTypeSupported(LightmapBakeType.Baked);
                if ((this.m_EnabledBakedGI.boolValue || this.m_EnabledRealtimeGI.boolValue) && (flag2 || flag))
                {
                    int[] optionValues = new int[]
                    {
                        0,
                        1
                    };
                    if (this.m_EnabledBakedGI.boolValue && this.m_EnabledRealtimeGI.boolValue)
                    {
                        using (new EditorGUI.DisabledScope((this.m_AmbientLightingMode.intValue == 0 && flag && !flag2) || (this.m_AmbientLightingMode.intValue == 1 && flag2 && !flag)))
                        {
                            EditorGUILayout.IntPopup(this.m_AmbientLightingMode, LightingEditor.Styles.AmbientLightingModes, optionValues, LightingEditor.Styles.AmbientLightingMode, new GUILayoutOption[0]);
                        }
                        if ((this.m_AmbientLightingMode.intValue == 0 && !flag) || (this.m_AmbientLightingMode.intValue == 1 && !flag2))
                        {
                            EditorGUILayout.HelpBox("The following mode is not supported and will fallback on " + ((this.m_AmbientLightingMode.intValue != 0 || flag) ? "Realtime" : "Baked"), MessageType.Warning);
                        }
                    }
                    else if ((this.m_EnabledBakedGI.boolValue && flag2) || (this.m_EnabledRealtimeGI.boolValue && flag))
                    {
                        using (new EditorGUI.DisabledScope(true))
                        {
                            EditorGUILayout.IntPopup(LightingEditor.Styles.AmbientLightingMode, (!this.m_EnabledBakedGI.boolValue) ? 0 : 1, LightingEditor.Styles.AmbientLightingModes, optionValues, new GUILayoutOption[0]);
                        }
                    }
                }
                EditorGUI.indentLevel--;
                EditorGUILayout.Space();
                EditorGUILayout.LabelField(LightingEditor.Styles.env_refl_top, new GUILayoutOption[0]);
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(this.m_DefaultReflectionMode, LightingEditor.Styles.env_refl_src, new GUILayoutOption[0]);
                DefaultReflectionMode intValue2 = (DefaultReflectionMode)this.m_DefaultReflectionMode.intValue;
                if (intValue2 != DefaultReflectionMode.FromSkybox)
                {
                    if (intValue2 == DefaultReflectionMode.Custom)
                    {
                        EditorGUILayout.PropertyField(this.m_CustomReflection, LightingEditor.Styles.customReflection, new GUILayoutOption[0]);
                    }
                }
                else
                {
                    int[]        optionValues2    = null;
                    GUIContent[] displayedOptions = null;
                    ReflectionProbeEditor.GetResolutionArray(ref optionValues2, ref displayedOptions);
                    EditorGUILayout.IntPopup(this.m_DefaultReflectionResolution, displayedOptions, optionValues2, LightingEditor.Styles.env_refl_res, new GUILayoutOption[]
                    {
                        GUILayout.MinWidth(40f)
                    });
                }
                EditorGUILayout.PropertyField(this.m_ReflectionCompression, LightingEditor.Styles.env_refl_cmp, new GUILayoutOption[0]);
                EditorGUILayout.Slider(this.m_ReflectionIntensity, 0f, 1f, LightingEditor.Styles.env_refl_int, new GUILayoutOption[0]);
                EditorGUILayout.IntSlider(this.m_ReflectionBounces, 1, 5, LightingEditor.Styles.env_refl_bnc, new GUILayoutOption[0]);
                EditorGUI.indentLevel--;
                EditorGUI.indentLevel--;
                EditorGUILayout.Space();
            }
        }