Пример #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.\"");
            SerializedProperty levelLowThresholdProperty = levelsProperty.FindPropertyRelative("levelLowThreshold");
            SerializedProperty levelHiThresholdProperty  = levelsProperty.FindPropertyRelative("levelHiThreshold");

            GuiHelpers.DrawMinMaxSlider(ref levelLowThresholdProperty, ref levelHiThresholdProperty, 0, 1, "Level Thresholds");

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

            GuiHelpers.DrawFloatField(ref contrastProperty, "Contrast");

            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");

            GuiHelpers.DrawFloatField(ref outputLowValueProperty, "Output Low Value");
            SerializedProperty outputHiValueProperty = levelsProperty.FindPropertyRelative("outputHiValue");

            GuiHelpers.DrawFloatField(ref outputHiValueProperty, "Output High Value");
        }
Пример #2
0
        /// <summary>
        /// Displays distance fadein parameters for spot/point lights' cookies
        /// </summary>
        private void DisplayCookieDistanceAttenuationParameters()
        {
            EditorGUILayout.BeginVertical();

            EditorGUILayout.LabelField("Cookie Fade-In Attenuation", EditorStyles.boldLabel);

            GuiHelpers.DrawContextualHelpBox("The \"Thresholds\" parameters are the normalized range where the cookie will fade in.");
            GuiHelpers.DrawMinMaxSlider(ref _customCookieDistanceFalloffLowThresholdProperty, ref _customCookieDistanceFalloffHiThresholdProperty, 0.0f, 1.0f, "Fade-In Thresholds");

            GuiHelpers.DrawContextualHelpBox("The \"Exponent\" parameter is the curve of the fading.");
            GuiHelpers.DrawPositiveOnlyFloatField(ref _customCookieDistanceFalloffPowerProperty, "Exponent");

            GuiHelpers.DrawContextualHelpBox("Allows to reset to Unity's default values.");
            if (GUILayout.Button("Reset"))
            {
                _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();

            GUILayout.Button(new GUIContent(" Volume Shape", volumeShapeIconTexture), GuiStyles.areaTitleBarStyle);
            GuiHelpers.DrawContextualHelpBox("The \"Shape\" parameter allows you to define the volumetric shape of the volume used for injecting Density, Color or Anisotropy.\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.BeginVertical();

            EditorGUILayout.Separator();

            EditorGUILayout.PropertyField(_volumeShapeProperty, new GUIContent("Shape of the volume"));

            if ((VolumeTypeEnum)_volumeShapeProperty.enumValueIndex != VolumeTypeEnum.Global)
            {
                GUILayout.Button("Parameters", EditorStyles.boldLabel);
                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                switch ((VolumeTypeEnum)_volumeShapeProperty.enumValueIndex)
                {
                case VolumeTypeEnum.Box:
                {
                    GuiHelpers.DrawMinMaxSlider(ref _xNegativeCubeFadeProperty, ref _xPositiveCubeFadeProperty, 0, 1, "Width border attenuation", true);
                    GuiHelpers.DrawMinMaxSlider(ref _yNegativeCubeFadeProperty, ref _yPositiveCubeFadeProperty, 0, 1, "Height border attenuation", true);
                    GuiHelpers.DrawMinMaxSlider(ref _zNegativeCubeFadeProperty, ref _zPositiveCubeFadeProperty, 0, 1, "Depth border attenuation", true);
                }
                break;

                case VolumeTypeEnum.Cone:
                {
                    GuiHelpers.DrawSlider(ref _angularConeFadeProperty, 0, 1, "Angular border attenuation", true);
                    GuiHelpers.DrawSlider(ref _distanceConeFadeProperty, 0, 1, "Distance border attenuation", true);
                }
                break;

                case VolumeTypeEnum.Cylinder:
                {
                    GuiHelpers.DrawSlider(ref _widthCylinderFadeProperty, 0, 1, "Width border attenuation", true);
                    GuiHelpers.DrawMinMaxSlider(ref _yNegativeCylinderFadeProperty, ref _yPositiveCylinderFadeProperty, 0, 1, "Height border attenuation", true);
                }
                break;

                case VolumeTypeEnum.Planar:
                {
                    GuiHelpers.DrawSlider(ref _heightPlaneFadeProperty, 0, 1, "Height attenuation");
                }
                break;

                case VolumeTypeEnum.Sphere:
                {
                    GuiHelpers.DrawSlider(ref _distanceSphereFadeProperty, 0, 1, "Distance attenuation", true);
                }
                break;
                }

                EditorGUILayout.Separator();

                GuiHelpers.DrawPositiveOnlyFloatField(ref _falloffFadeProperty, "Falloff Exponent");

                EditorGUILayout.EndVertical();
            }

            EditorGUILayout.Separator();

            EditorGUILayout.EndVertical();

            EditorGUILayout.EndVertical();
        }