Beispiel #1
0
        /// <summary>
        /// Draws the fields required for a LevelsParameters object
        /// </summary>
        /// <param name="levelsProperty">The related serialized property</param>
        public static void DrawLevelsField(ref SerializedProperty levelsProperty)
        {
            GuiHelpers.DrawContextualHelpBox("The \"Levels\" parameter will filter the input value.\n\nKeeps the value between the \"Level Thresholds\" and remaps the range from 0 to 1.\"");
            EditorGUILayout.BeginHorizontal();
            GUILayout.Label("Filter Range", GuiStyles.Label, GUILayout.MaxWidth(160));
            SerializedProperty levelLowThresholdProperty = levelsProperty.FindPropertyRelative("levelLowThreshold");
            SerializedProperty levelHiThresholdProperty  = levelsProperty.FindPropertyRelative("levelHiThreshold");

            GuiHelpers.DrawMinMaxSlider(ref levelLowThresholdProperty, ref levelHiThresholdProperty, 0, 1);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.Separator();

            SerializedProperty contrastProperty = levelsProperty.FindPropertyRelative("contrast");

            DrawFloatField(ref contrastProperty, new GUIContent("Contrast", "Contrast the input mask"));

            EditorGUILayout.Separator();

            GuiHelpers.DrawContextualHelpBox("The \"Output\" parameters will rescale this new range\n\n0 will now equal the lower \"Output Value\" and 1 will now equal the higher.");
            SerializedProperty outputLowValueProperty = levelsProperty.FindPropertyRelative("outputLowValue");

            DrawFloatField(ref outputLowValueProperty, new GUIContent("Output Min", "Output minimum value"));
            SerializedProperty outputHiValueProperty = levelsProperty.FindPropertyRelative("outputHiValue");

            DrawFloatField(ref outputHiValueProperty, new GUIContent("Output Max", "Output maximum value"));
        }
        /// <summary>
        /// Displays distance fadein parameters for spot/point lights' cookies
        /// </summary>
        private void DisplayCookieDistanceAttenuationParameters()
        {
            EditorGUILayout.BeginVertical();

            GUILayout.Label("Cookie Fade-In Attenuation", GuiStyles.LabelCenteredBig);
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();

            GuiHelpers.DrawContextualHelpBox("The \"Thresholds\" parameters are the normalized range where the cookie will fade in.");
            EditorGUILayout.BeginHorizontal();
            GUILayout.Label("Fade-In Thresholds", GuiStyles.Label, GUILayout.MaxWidth(160));
            GuiHelpers.DrawMinMaxSlider(ref _customCookieDistanceFalloffLowThresholdProperty, ref _customCookieDistanceFalloffHiThresholdProperty, 0.0f, 1.0f);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.Separator();

            GuiHelpers.DrawPositiveOnlyFloatField(ref _customCookieDistanceFalloffPowerProperty, new GUIContent("Strength", "The curve of the fading"));

            EditorGUILayout.Separator();
            EditorGUILayout.Separator();

            GuiHelpers.DrawContextualHelpBox("Allows to reset to Unity's default values.");
            if (GUILayout.Button("Reset", GuiStyles.Button))
            {
                _customCookieDistanceFalloffLowThresholdProperty.floatValue = 0.1f;
                _customCookieDistanceFalloffHiThresholdProperty.floatValue  = 0.25f;
                _customAngularFalloffPowerProperty.floatValue = 2.0f;
            }

            EditorGUILayout.EndVertical();
        }
        /// <summary>
        /// Displays Shape Settings Area
        /// </summary>
        private void DisplayShapeSettingsArea()
        {
            EditorGUILayout.BeginVertical();
            GuiHelpers.DrawContextualHelpBox("The \"Shape\" parameter allows you to define the volumetric shape of the volume used for injecting Density, Color or Scattering.\n\nYou will also be able to parameter the fading on the borders of the shape, allowing a smooth transition between the inside and the outside of the volume.");
            EditorGUILayout.Separator();
            EditorGUILayout.BeginHorizontal();
            GUILayout.Label("Shape", GuiStyles.Label, GUILayout.MaxWidth(160));
            EditorGUILayout.PropertyField(_volumeShapeProperty, new GUIContent(""));
            EditorGUILayout.EndHorizontal();

            if ((VolumeType)_volumeShapeProperty.enumValueIndex != VolumeType.Global)
            {
                switch ((VolumeType)_volumeShapeProperty.enumValueIndex)
                {
                case VolumeType.Box:
                {
                    EditorGUILayout.Separator();
                    EditorGUILayout.BeginHorizontal();
                    GUILayout.Label("Width Fade", GuiStyles.Label, GUILayout.MaxWidth(160));
                    GuiHelpers.DrawMinMaxSlider(ref _xNegativeCubeFadeProperty, ref _xPositiveCubeFadeProperty, 0, 1, true);
                    EditorGUILayout.EndHorizontal();
                    EditorGUILayout.Separator();
                    EditorGUILayout.BeginHorizontal();
                    GUILayout.Label("Height Fade", GuiStyles.Label, GUILayout.MaxWidth(160));
                    GuiHelpers.DrawMinMaxSlider(ref _yNegativeCubeFadeProperty, ref _yPositiveCubeFadeProperty, 0, 1, true);
                    EditorGUILayout.EndHorizontal();
                    EditorGUILayout.Separator();
                    EditorGUILayout.BeginHorizontal();
                    GUILayout.Label("Depth Fade", GuiStyles.Label, GUILayout.MaxWidth(160));
                    GuiHelpers.DrawMinMaxSlider(ref _zNegativeCubeFadeProperty, ref _zPositiveCubeFadeProperty, 0, 1, true);
                    EditorGUILayout.EndHorizontal();
                }
                break;

                case VolumeType.Cone:
                {
                    EditorGUILayout.Separator();
                    EditorGUILayout.BeginHorizontal();
                    GUILayout.Label("Angular Fade", GuiStyles.Label, GUILayout.MaxWidth(160));
                    GuiHelpers.DrawSlider(ref _angularConeFadeProperty, 0, 1, true);
                    EditorGUILayout.EndHorizontal();
                    EditorGUILayout.Separator();
                    EditorGUILayout.BeginHorizontal();
                    GUILayout.Label("Distance Fade", GuiStyles.Label, GUILayout.MaxWidth(160));
                    GuiHelpers.DrawSlider(ref _distanceConeFadeProperty, 0, 1, true);
                    EditorGUILayout.EndHorizontal();
                }
                break;

                case VolumeType.Cylinder:
                {
                    EditorGUILayout.Separator();
                    EditorGUILayout.BeginHorizontal();
                    GUILayout.Label("Width Fade", GuiStyles.Label, GUILayout.MaxWidth(160));
                    GuiHelpers.DrawSlider(ref _widthCylinderFadeProperty, 0, 1, true);
                    EditorGUILayout.EndHorizontal();
                    EditorGUILayout.Separator();
                    EditorGUILayout.BeginHorizontal();
                    GUILayout.Label("Height Fade", GuiStyles.Label, GUILayout.MaxWidth(160));
                    GuiHelpers.DrawMinMaxSlider(ref _yNegativeCylinderFadeProperty, ref _yPositiveCylinderFadeProperty, 0, 1, true);
                    EditorGUILayout.EndHorizontal();
                }
                break;

                case VolumeType.Sphere:
                {
                    EditorGUILayout.Separator();
                    EditorGUILayout.BeginHorizontal();
                    GUILayout.Label("Distance Fade", GuiStyles.Label, GUILayout.MaxWidth(160));
                    GuiHelpers.DrawSlider(ref _distanceSphereFadeProperty, 0, 1, true);
                    EditorGUILayout.EndHorizontal();
                }
                break;
                }

                EditorGUILayout.Separator();

                GuiHelpers.DrawPositiveOnlyFloatField(ref _falloffFadeProperty, new GUIContent("Fade Falloff", "The curve of the fading"));
            }
            EditorGUILayout.EndVertical();
        }