Пример #1
0
        /// <summary>
        /// Displays the content of the base injection tab
        /// </summary>
        private void DisplayBaseInjectionArea()
        {
            EditorGUILayout.BeginVertical(EditorStyles.miniButton);

            GUILayout.Button(new GUIContent(" Ambient Injection", injectionIconTexture), GuiStyles.areaTitleBarStyle);
            GuiHelpers.DrawContextualHelpBox("The \"Ambient Injection\" parameters set the starting Density, Color and Anisotropy of the environment.");

            EditorGUILayout.BeginVertical();

            EditorGUILayout.Separator();

            GuiHelpers.DrawPositiveOnlyFloatField(ref _baseDensityProperty, "Ambient Density");

            EditorGUILayout.Separator();

            GuiHelpers.DrawSlider(ref _baseAnisotropyProperty, 0, 1, "Ambient Anisotropy");

            EditorGUILayout.Separator();

            EditorGUILayout.LabelField("Ambient Light");
            EditorGUILayout.PropertyField(_baseColorProperty);

            GuiHelpers.DrawPositiveOnlyFloatField(ref _baseColorStrengthProperty, "Ambient Light Strength");

            EditorGUILayout.Separator();

            EditorGUILayout.EndVertical();

            EditorGUILayout.EndVertical();

            EditorGUILayout.Separator();
        }
        /// <summary>
        /// Displays Color Injection Tab
        /// </summary>
        private void DisplayColorInjectionTab()
        {
            EditorGUILayout.BeginVertical();
            GUILayout.Button(new GUIContent(" Color Injection", injectionIconTexture), GuiStyles.areaTitleBarStyle);
            GuiHelpers.DrawContextualHelpBox("The \"Color Injection\" parameters allows you to add/remove color inside the system.\n\nIn other words, you will be able to add/remove light inside a defined area.\n TIP :The \"Strength\" parameter will accept negative values. Meaning that you will be able to remove Color.");
            EditorGUILayout.BeginVertical();

            EditorGUILayout.Separator();

            _colorInjectionBoolProperty.boolValue = EditorGUILayout.ToggleLeft("Enabled", _colorInjectionBoolProperty.boolValue);
            if (_colorInjectionBoolProperty.boolValue)
            {
                EditorGUILayout.BeginVertical();

                EditorGUILayout.Separator();

                EditorGUILayout.PropertyField(_colorInjectionColorProperty);

                GuiHelpers.DrawArea <VolumeInjectionCommonParameters>(ref _colorInjectionParametersProperty, "Parameters", (object)((_textureMaskBoolProperty.boolValue ? 1 : 0) + (_noiseMaskBoolProperty.boolValue ? 2 : 0)));

                EditorGUILayout.EndVertical();
            }

            EditorGUILayout.Separator();

            EditorGUILayout.EndVertical();

            EditorGUILayout.EndVertical();

            EditorGUILayout.Separator();
        }
        /// <summary>
        /// Displays Density Injection Tab
        /// </summary>
        private void DisplayDensityInjectionTab()
        {
            EditorGUILayout.BeginVertical();

            GUILayout.Button(new GUIContent(" Density Injection", injectionIconTexture), GuiStyles.areaTitleBarStyle);
            GuiHelpers.DrawContextualHelpBox("The \"Density Injection\" parameters allows you to add/remove density inside the system.\n\nIn other words, you will be able to increase/decrease the amount of micro particles inside a defined area.\n TIP :The \"Strength\" parameter will accept negative values. Meaning that you will be able to remove Density, Color or Anisotropy as well.");
            EditorGUILayout.BeginVertical();

            EditorGUILayout.Separator();

            _densityInjectionBoolProperty.boolValue = EditorGUILayout.ToggleLeft("Enabled", _densityInjectionBoolProperty.boolValue);
            if (_densityInjectionBoolProperty.boolValue)
            {
                EditorGUILayout.BeginVertical();

                EditorGUILayout.Separator();

                GuiHelpers.DrawArea <VolumeInjectionCommonParameters>(ref _densityInjectionParametersProperty, "Parameters", (object)((_textureMaskBoolProperty.boolValue ? 1 : 0) + (_noiseMaskBoolProperty.boolValue ? 2 : 0)));

                EditorGUILayout.EndVertical();
            }

            EditorGUILayout.Separator();

            EditorGUILayout.EndVertical();

            EditorGUILayout.EndVertical();

            EditorGUILayout.Separator();
        }
Пример #4
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            GuiHelpers.DrawHeader(logoTexture);

            _tabIndex = GUILayout.Toolbar(_tabIndex, _tabsContent);

            EditorGUILayout.Separator();

            switch (_tabIndex)
            {
            case 0:
            {
                DisplayBaseInjectionArea();
            }
            break;

            case 1:
            {
                DisplaySettingsTab();
            }
            break;
            }

            GuiHelpers.DisplayHelpToShowHelpBox();

            EditorGUILayout.Separator();

            serializedObject.ApplyModifiedProperties();
        }
        /// <summary>
        /// Displays Noise Mask Area
        /// </summary>
        private void DisplayNoiseMaskArea()
        {
            EditorGUILayout.BeginVertical();
            GUILayout.Button(new GUIContent(" Noise Mask", noiseMaskIconTexture), GuiStyles.areaTitleBarStyle);
            GuiHelpers.DrawContextualHelpBox("The \"Noise Mask\" parameter allows you to assign a dynamic morphing noise mask to the volume.\nThis noise will be used for masking the data injected.");
            EditorGUILayout.BeginVertical();

            EditorGUILayout.Separator();

            _noiseMaskBoolProperty.boolValue = EditorGUILayout.ToggleLeft("Enabled", _noiseMaskBoolProperty.boolValue);
            if (_noiseMaskBoolProperty.boolValue)
            {
                EditorGUILayout.BeginVertical();

                EditorGUILayout.Separator();
                GUILayout.Button("Parameters", EditorStyles.boldLabel);
                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                GuiHelpers.DrawFloatField(ref _noiseMaskSpeedProperty, "Speed");
                EditorGUILayout.Separator();
                GuiHelpers.DrawFloatField(ref _noiseMaskOffsetProperty, "Offset");
                EditorGUILayout.EndVertical();

                EditorGUILayout.Separator();
                GuiHelpers.DrawArea <TransformParameters>(ref _noiseMaskTransformProperty, "Transform");

                EditorGUILayout.EndVertical();
            }

            EditorGUILayout.Separator();

            EditorGUILayout.EndVertical();

            EditorGUILayout.EndVertical();
        }
        /// <summary>
        /// Displays Anisotropy Injection Tab
        /// </summary>
        private void DisplayAnisotropyInjectionTab()
        {
            EditorGUILayout.BeginVertical();
            GUILayout.Button(new GUIContent(" Anisotropy Injection", injectionIconTexture), GuiStyles.areaTitleBarStyle);
            GuiHelpers.DrawContextualHelpBox("The \"Anisotropy Injection\" parameters allows you to add/remove anisotropy inside the system.\n\nIn other words, you will be able to modify how light from light sources will bounce inside the micro particles and will be deviated by them. Typically, how \"wet\" the micro particles are.\n TIP :The \"Strength\" parameter will accept negative values. Meaning that you will be able to remove Anisotropy as well.");

            EditorGUILayout.BeginVertical();

            EditorGUILayout.Separator();

            _anisotropyInjectionBoolProperty.boolValue = EditorGUILayout.ToggleLeft("Enabled", _anisotropyInjectionBoolProperty.boolValue);
            if (_anisotropyInjectionBoolProperty.boolValue)
            {
                EditorGUILayout.BeginVertical();

                EditorGUILayout.Separator();

                GuiHelpers.DrawArea <VolumeInjectionCommonParameters>(ref _anisotropyInjectionParametersProperty, "Parameters", (_textureMaskBoolProperty.boolValue ? 1 : 0) + (_noiseMaskBoolProperty.boolValue ? 2 : 0));

                EditorGUILayout.EndVertical();
            }

            EditorGUILayout.Separator();

            EditorGUILayout.EndVertical();

            EditorGUILayout.EndVertical();

            EditorGUILayout.Separator();
        }
Пример #7
0
        /// <summary>
        /// Draws the field required to draw a VolumeInjectionParameters object
        /// </summary>
        /// <param name="injectionProperty">The related serialized property</param>
        /// <param name="displayMask">Int mask to display texture/noise mask</param>
        public static void DrawInjectionField(ref SerializedProperty injectionProperty, int displayMask)
        {
            SerializedProperty strengthProperty = injectionProperty.FindPropertyRelative("strength");

            GuiHelpers.DrawFloatField(ref strengthProperty, "Strength");

            if (displayMask == 1 || displayMask == 3)
            {
                EditorGUILayout.Separator();
                EditorGUILayout.BeginVertical();
                EditorGUILayout.LabelField("Texture Mask Levels", EditorStyles.boldLabel);
                SerializedProperty textureMaskLevelsProperty = injectionProperty.FindPropertyRelative("textureMaskLevelParameters");
                GuiHelpers.DrawLevelsField(ref textureMaskLevelsProperty);
                EditorGUILayout.EndVertical();
            }

            if (displayMask == 2 || displayMask == 3)
            {
                EditorGUILayout.Separator();
                EditorGUILayout.BeginVertical();
                EditorGUILayout.LabelField("Noise Mask Levels", EditorStyles.boldLabel);
                SerializedProperty noiseMaskLevelsProperty = injectionProperty.FindPropertyRelative("noiseMaskLevelParameters");
                GuiHelpers.DrawLevelsField(ref noiseMaskLevelsProperty);
                EditorGUILayout.EndVertical();
            }
        }
Пример #8
0
        /// <summary>
        /// Draw an area for specific types
        /// </summary>
        /// <typeparam name="T">The desired type area</typeparam>
        /// <param name="property">The related serialized property</param>
        /// <param name="label">The label to write</param>
        /// <param name="parameters">Some formatted parameters</param>
        public static void DrawArea <T>(ref SerializedProperty property, string label, object parameters = null)
        {
            GUILayout.Button(label, EditorStyles.boldLabel);

            EditorGUILayout.BeginVertical(EditorStyles.helpBox);

            if (typeof(T) == typeof(Texture2D))
            {
                GuiHelpers.DrawTexture2DField(ref property);
            }
            else if (typeof(T) == typeof(Texture3D))
            {
                GuiHelpers.DrawTexture3DField(ref property);
            }
            else if (typeof(T) == typeof(TransformParameters))
            {
                GuiHelpers.DrawTransformField(ref property);
            }
            else if (typeof(T) == typeof(VolumeInjectionCommonParameters))
            {
                GuiHelpers.DrawInjectionField(ref property, (int)parameters);
            }

            EditorGUILayout.EndVertical();
        }
Пример #9
0
        /// <summary>
        /// Displays the additional parameters tab for directional lights
        /// </summary>
        private void DisplayDirectionalLightAdditionalSettingsArea()
        {
            EditorGUILayout.BeginVertical(EditorStyles.miniButton);
            GUILayout.Button(new GUIContent(" Additional Parameters", lightIconTexture), GuiStyles.areaTitleBarStyle);
            EditorGUILayout.BeginVertical();

            EditorGUILayout.Separator();

            GuiHelpers.DrawContextualHelpBox("The \"Enable Out-Of-Phase Color\" parameter allows you to use a color when the view angle is not towards the directional light (the decay is controlled by the anisotropy factor.");
            _enableOutOfPhaseColorProperty.boolValue = EditorGUILayout.ToggleLeft("Enable Out-Of-Phase Color", _enableOutOfPhaseColorProperty.boolValue);
            EditorGUILayout.Separator();
            if (_enableOutOfPhaseColorProperty.boolValue)
            {
                EditorGUILayout.BeginVertical();

                GuiHelpers.DrawContextualHelpBox("The strength of the color.");
                GuiHelpers.DrawFloatField(ref _outOfPhaseColorStrengthProperty, "Strength");

                GuiHelpers.DrawContextualHelpBox("The color when the view direction is not towards the directional light.");
                EditorGUILayout.PropertyField(_outOfPhaseColorProperty);

                EditorGUILayout.EndVertical();
            }

            EditorGUILayout.EndVertical();

            EditorGUILayout.EndVertical();

            EditorGUILayout.Separator();
        }
Пример #10
0
        /// <summary>
        /// Draws a header with a logo texture
        /// </summary>
        /// <param name="logoTexture">The logo to draw</param>
        public static void DrawHeader(Texture2D logoTexture)
        {
            EditorGUILayout.Separator();

            EditorGUILayout.Separator();

            GuiHelpers.DrawTexture(logoTexture, 512);

            GuiHelpers.DisplayGeneralHelpBox();
        }
Пример #11
0
        //// TODO : INVESTIGATE TO ACCESS THOSE VARIABLES AS THE DEFAULT INSPECTOR IS UGLY
        //private SerializedProperty wrapModeProperty;
        //private SerializedProperty filterModeProperty;
        //private SerializedProperty anisotropyLevelProperty;
        #endregion

        #region Overriden base class functions (https://docs.unity3d.com/ScriptReference/Editor.html)
        /// <summary>
        /// Draws the content of the Inspector
        /// </summary>
        public override void OnInspectorGUI()
        {
            GuiHelpers.DrawHeader(logoTexture);

            //serializedObject.Update();

            //// HAD TO DISABLE THE DEFAULT INSPECTOR AS IT MADE PREVIEW LAG
            //DrawDefaultInspector();

            //serializedObject.ApplyModifiedProperties();
        }
Пример #12
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            GuiHelpers.DrawHeader(logoTexture);

            _tabIndex = GUILayout.Toolbar(_tabIndex, _tabsContent);

            EditorGUILayout.Separator();

            switch (_tabIndex)
            {
            case 0:
            {
                DisplayCommonSettingsArea();
            }
            break;

            case 1:
            {
                switch (((AuraLight)serializedObject.targetObject).Type)
                {
                case LightType.Directional:
                {
                    DisplayDirectionalLightAdditionalSettingsArea();
                }
                break;

                case LightType.Spot:
                {
                    DisplaySpotLightAdditionalSettingsArea();
                }
                break;

                case LightType.Point:
                {
                    DisplayPointLightAdditionalSettingsArea();
                }
                break;
                }
            }

            break;
            }

            GuiHelpers.DisplayHelpToShowHelpBox();

            EditorGUILayout.Separator();

            serializedObject.ApplyModifiedProperties();
        }
        /// <summary>
        /// Displays Texture Mask Area
        /// </summary>
        private void DisplayTextureMaskArea()
        {
            EditorGUILayout.BeginVertical();
            GUILayout.Button(new GUIContent(" Texture Mask", textureMaskIconTexture), GuiStyles.areaTitleBarStyle);
            GuiHelpers.DrawContextualHelpBox("The \"Texture Mask\" parameter allows you to assign a volumetric texture mask to the volume.\nThis texture will be used for masking the data injected.\n\nThe channels of the texture are used as followed :\nRGB -> Will multiply the \"Strength\" parameter of the Color Injection.\nA -> Will multiply the \"Strength\" parameter of the Density and Anisotropy Injection.");
            EditorGUILayout.BeginVertical();

            EditorGUILayout.Separator();

            GUILayout.Button(new GUIContent(" Experimental Feature", experimentalFeaturesIconTexture), GuiStyles.topCenteredMiniGreyLabel);
            EditorGUILayout.HelpBox("\nATTENTION : \n\nThis feature is still at experimental stage.\n\nThis means that it can lead to performance, stability and/or visual issues.\n\nFeel free to contact me if you have any comment about it.\n", MessageType.Warning);

            EditorGUILayout.Separator();

            _textureMaskBoolProperty.boolValue = EditorGUILayout.ToggleLeft("Enabled", _textureMaskBoolProperty.boolValue);
            if (_textureMaskBoolProperty.boolValue)
            {
                EditorGUILayout.BeginVertical();

                EditorGUILayout.Separator();
                EditorGUILayout.PropertyField(_textureMaskTextureProperty);

                GuiHelpers.DrawArea <TransformParameters>(ref _textureMaskTransformProperty, "Transform");

                EditorGUILayout.Separator();
                GUILayout.Button("Other Parameters", EditorStyles.boldLabel);
                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                EditorGUILayout.PropertyField(_textureMaskWrapModeProperty, new GUIContent("Wrap Mode"));
                EditorGUILayout.Separator();
                EditorGUILayout.PropertyField(_textureMaskFilterModeProperty, new GUIContent("Filter Mode"));

                EditorGUILayout.Separator();
                _textureMaskClipOnAlphaProperty.boolValue = EditorGUILayout.Toggle("Clip on Alpha", _textureMaskClipOnAlphaProperty.boolValue);
                if (_textureMaskClipOnAlphaProperty.boolValue)
                {
                    EditorGUILayout.BeginVertical();
                    GuiHelpers.DrawSlider(ref _textureMaskClippingThresholdProperty, 0.0f, 1.0f, "Clipping Theshold");
                    EditorGUILayout.EndVertical();
                }

                EditorGUILayout.EndVertical();
                EditorGUILayout.EndVertical();
            }

            EditorGUILayout.Separator();

            EditorGUILayout.EndVertical();

            EditorGUILayout.EndVertical();
        }
Пример #14
0
        /// <summary>
        /// Draws the fields required for a TransformParameters object
        /// </summary>
        /// <param name="transformProperty">The related serialized property</param>
        public static void DrawTransformField(ref SerializedProperty transformProperty)
        {
            SerializedProperty spaceProperty = transformProperty.FindPropertyRelative("space");

            GuiHelpers.DrawSpaceField(ref spaceProperty, "Relative Space");

            EditorGUILayout.Separator();
            SerializedProperty positionProperty = transformProperty.FindPropertyRelative("position");

            EditorGUILayout.LabelField("Position", EditorStyles.boldLabel);
            GuiHelpers.DrawVector3Field(ref positionProperty);
            SerializedProperty animatePositionProperty = transformProperty.FindPropertyRelative("animatePosition");

            animatePositionProperty.boolValue = EditorGUILayout.Toggle("Animate", animatePositionProperty.boolValue);
            if (animatePositionProperty.boolValue)
            {
                EditorGUILayout.BeginVertical();
                SerializedProperty animatedPositionSpeedProperty = transformProperty.FindPropertyRelative("positionSpeed");
                EditorGUILayout.LabelField("Speed", EditorStyles.miniBoldLabel);
                GuiHelpers.DrawVector3Field(ref animatedPositionSpeedProperty);
                EditorGUILayout.EndVertical();
                GUILayout.Space(16);
            }

            EditorGUILayout.Separator();
            SerializedProperty rotationProperty = transformProperty.FindPropertyRelative("rotation");

            EditorGUILayout.LabelField("Rotation", EditorStyles.boldLabel);
            GuiHelpers.DrawVector3Field(ref rotationProperty);
            SerializedProperty animateRotationProperty = transformProperty.FindPropertyRelative("animateRotation");

            animateRotationProperty.boolValue = EditorGUILayout.Toggle("Animate", animateRotationProperty.boolValue);
            if (animateRotationProperty.boolValue)
            {
                EditorGUILayout.BeginVertical();
                SerializedProperty animatedRotationSpeedProperty = transformProperty.FindPropertyRelative("rotationSpeed");
                EditorGUILayout.LabelField("Speed", EditorStyles.miniBoldLabel);
                GuiHelpers.DrawVector3Field(ref animatedRotationSpeedProperty);
                EditorGUILayout.EndVertical();
                GUILayout.Space(16);
            }

            EditorGUILayout.Separator();
            SerializedProperty scaleProperty = transformProperty.FindPropertyRelative("scale");

            EditorGUILayout.LabelField("Scale", EditorStyles.boldLabel);
            GuiHelpers.DrawVector3Field(ref scaleProperty);
        }
Пример #15
0
        /// <summary>
        /// Displays the common parameters tab
        /// </summary>
        private void DisplayCommonSettingsArea()
        {
            EditorGUILayout.BeginVertical(EditorStyles.miniButton);
            GUILayout.Button(new GUIContent(" Base Parameters", lightIconTexture), GuiStyles.areaTitleBarStyle);
            EditorGUILayout.BeginVertical();

            EditorGUILayout.Separator();

            GuiHelpers.DrawContextualHelpBox("The \"Strength\" parameter allows you to multiply the intensity of the light source in the system.");
            GuiHelpers.DrawFloatField(ref _strengthProperty, "Strength");

            EditorGUILayout.Separator();

            GuiHelpers.DrawContextualHelpBox("The \"Override Color\" parameter allows you to replace the light's color in the system.");
            _overrideColorProperty.boolValue = EditorGUILayout.ToggleLeft("Override Color", _overrideColorProperty.boolValue);
            if (_overrideColorProperty.boolValue)
            {
                EditorGUILayout.BeginVertical();

                GuiHelpers.DrawContextualHelpBox("The \"Overriding Color\" is the color that will replace the light's color in the system.");
                EditorGUILayout.PropertyField(_overridingColorProperty);

                EditorGUILayout.EndVertical();
            }

            EditorGUILayout.Separator();

            GuiHelpers.DrawContextualHelpBox("The \"Enable Shadows\" parameter allows you to compute the light's shadows (if enabled) in the system.");
            _useShadowsProperty.boolValue = EditorGUILayout.ToggleLeft("Enable Shadows", _useShadowsProperty.boolValue);

            EditorGUILayout.Separator();

            GuiHelpers.DrawContextualHelpBox("The \"Enable Cookie\" parameter allows you to compute the light's cookie (if enabled) in the system.");
            _useCookieProperty.boolValue = EditorGUILayout.ToggleLeft("Enable Cookie", _useCookieProperty.boolValue);

            EditorGUILayout.Separator();

            EditorGUILayout.EndVertical();

            EditorGUILayout.EndVertical();

            EditorGUILayout.Separator();
        }
Пример #16
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");
        }
Пример #17
0
        /// <summary>
        /// Displays distance fadeout parameters for spot/point lights
        /// </summary>
        private void DisplayLightDistanceAttenuationParameters()
        {
            EditorGUILayout.BeginVertical();

            EditorGUILayout.LabelField("Distance Attenuation", EditorStyles.boldLabel);

            GuiHelpers.DrawContextualHelpBox("The \"Threshold\" parameter is the normalized distance when the fade will start, until 1.");
            GuiHelpers.DrawSlider(ref _customDistanceFalloffThresholdProperty, 0.0f, 1.0f, "Threshold");

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

            GuiHelpers.DrawContextualHelpBox("Allows to reset to Unity's default values.");
            if (GUILayout.Button("Reset"))
            {
                _customDistanceFalloffThresholdProperty.floatValue = 0.5f;
                _customDistanceFalloffPowerProperty.floatValue     = 2.0f;
            }

            EditorGUILayout.EndVertical();
        }
Пример #18
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();
        }
Пример #19
0
        private void OnGUI()
        {
            GuiHelpers.DrawHeader(logoTexture);

            EditorGUILayout.Separator();

            EditorGUILayout.BeginVertical(EditorStyles.miniButton);
            GUILayout.Button(new GUIContent(" Create Texture3D Asset", texture3DIcon), GuiStyles.areaTitleBarStyle);
            GuiHelpers.DrawContextualHelpBox("Create a composite Texture3D from a Texture2D.");

            EditorGUILayout.Separator();

            GuiHelpers.DrawContextualHelpBox("Source texture used to build the Texture3D.");
            EditorGUILayout.LabelField("Source Texture");
            _sourceTexture = (Texture2D)EditorGUILayout.ObjectField(_sourceTexture, typeof(Texture2D), false);

            EditorGUILayout.Separator();

            if (_sourceTexture != null)
            {
                _sourceTexturePath = AssetDatabase.GetAssetPath(_sourceTexture);
                TextureImporter textureImporter = (TextureImporter)AssetImporter.GetAtPath(_sourceTexturePath);

                if (textureImporter.isReadable)
                {
                    EditorGUILayout.Separator();

                    GuiHelpers.DrawContextualHelpBox("Target size of the 3D texture.");
                    _referenceSize = EditorGUILayout.DelayedIntField("Reference Size", _referenceSize);
                    _referenceSize = Mathf.Max(_referenceSize, 16);
                    _referenceSize = Mathf.ClosestPowerOfTwo(_referenceSize);

                    EditorGUILayout.Separator();

                    EditorGUILayout.HelpBox("\nHorizontal tiles count : " + HorizontalTilesCount + "\nVertical tiles count : " + VerticalTilesCount + "\n\nTotal amount of tiles : " + TotalTilesCount + "\n", MessageType.Info);

                    EditorGUILayout.Separator();

                    if (AreParametersValid)
                    {
                        GuiHelpers.DrawContextualHelpBox("The order of which the tiles should be assembled to create the 3D texture (should we assemble line by line or column by column?).");
                        EditorGUILayout.LabelField("Reading Order");
                        _readingOrder = (Texture3DReadingOrderEnum)EditorGUILayout.EnumPopup(_readingOrder);

                        EditorGUILayout.Separator();

                        GuiHelpers.DrawContextualHelpBox("Generates a new Texture3D from the source texture.");
                        if (GUILayout.Button(new GUIContent("Generate")))
                        {
                            GenerateVolumetricTexture(_sourceTexture);
                        }
                    }
                    else
                    {
                        EditorGUILayout.HelpBox("ERROR : the total amount of tiles should be equal to the reference tile size. In this case : " + _referenceSize, MessageType.Error);
                    }
                }
                else
                {
                    EditorGUILayout.HelpBox("ERROR : the source texture asset should be marked as \"READABLE\".", MessageType.Error);
                    if (GUILayout.Button(new GUIContent("Mark as \"READABLE\"")))
                    {
                        textureImporter.isReadable = true;
                        textureImporter.SaveAndReimport();
                    }
                }

                EditorGUILayout.Separator();
            }

            EditorGUILayout.EndVertical();

            GuiHelpers.DisplayHelpToShowHelpBox();
        }
Пример #20
0
 /// <summary>
 /// Draws a float field
 /// </summary>
 /// <param name="floatProperty">The related serialized property</param>
 public static void DrawFloatField(ref SerializedProperty floatProperty)
 {
     GuiHelpers.DrawFloatField(ref floatProperty, "");
 }
Пример #21
0
        /// <summary>
        /// Displays the content of the settings tab
        /// </summary>
        private void DisplaySettingsTab()
        {
            EditorGUILayout.BeginVertical(EditorStyles.miniButton);
            GUILayout.Button(new GUIContent(" Grid", gridIconTexture), GuiStyles.areaTitleBarStyle);
            GuiHelpers.DrawContextualHelpBox("The \"Grid\" parameters allow you to determine the density of cells used to compute the volumetric lighting.\n\nThis cubic grid will be remapped on the frustum (the volume visible to the camera) and will range from the camera's near clip distance to the \"Range\" distance parameter (for performance saving and because behind a certain distance, changes are barely noticeable).");

            EditorGUILayout.BeginVertical();

            EditorGUILayout.Separator();

            _gridSettingsResolutionProperty.FindPropertyRelative("x").intValue = EditorGUILayout.IntField("Horizontal", _gridSettingsResolutionProperty.FindPropertyRelative("x").intValue);
            _gridSettingsResolutionProperty.FindPropertyRelative("y").intValue = EditorGUILayout.IntField("Vertical", _gridSettingsResolutionProperty.FindPropertyRelative("y").intValue);
            _gridSettingsResolutionProperty.FindPropertyRelative("z").intValue = EditorGUILayout.IntField("Depth", _gridSettingsResolutionProperty.FindPropertyRelative("z").intValue);
            if (GUILayout.Button("Set Resolution"))
            {
                ((Aura)serializedObject.targetObject).frustum.SetResolution(((Aura)serializedObject.targetObject).frustum.settings.resolution);
            }

            EditorGUILayout.Separator();

            GuiHelpers.DrawPositiveOnlyFloatField(ref _gridSettingsFarPlaneProperty, "Range");
            if (_gridSettingsFarPlaneProperty.floatValue < Aura.CameraComponent.nearClipPlane)
            {
                EditorGUILayout.HelpBox("\nATTENTION : \nRange must be bigger than the camera near clip distance.\n", MessageType.Warning);
            }

            EditorGUILayout.Separator();

            EditorGUILayout.EndVertical();

            EditorGUILayout.EndVertical();

            EditorGUILayout.Separator();

            EditorGUILayout.BeginVertical(EditorStyles.miniButton);
            GUILayout.Button(new GUIContent(" Contibution", injectionContributionIconTexture), GuiStyles.areaTitleBarStyle);
            GuiHelpers.DrawContextualHelpBox("The \"Selective Contribution\" parameters allow you to enable/disable what type of contribution will be allowed to be computed.\n\nNote that the existence of the different contributions are handled by the system at runtime.");

            EditorGUILayout.BeginVertical();

            EditorGUILayout.Separator();

            _applyAsPostProcessProperty.boolValue = EditorGUILayout.ToggleLeft("Apply as PostProcess", _applyAsPostProcessProperty.boolValue);

            //EditorGUILayout.Separator();
            //
            //executeInEditModeProperty.boolValue = EditorGUILayout.ToggleLeft("Execute in Edit Mode", executeInEditModeProperty.boolValue);

            EditorGUILayout.Separator();

            _enableVolumesProperty.boolValue            = EditorGUILayout.BeginToggleGroup("Enable Volumes", _enableVolumesProperty.boolValue);
            _enableVolumesTextureMaskProperty.boolValue = EditorGUILayout.ToggleLeft("Enable Texture Mask", _enableVolumesTextureMaskProperty.boolValue);
            _enableVolumesNoiseMaskProperty.boolValue   = EditorGUILayout.ToggleLeft("Enable Noise Mask", _enableVolumesNoiseMaskProperty.boolValue);
            EditorGUILayout.EndToggleGroup();

            EditorGUILayout.Separator();

            _enableDirectionalLightsProperty.boolValue        = EditorGUILayout.BeginToggleGroup("Enable Directional Lights", _enableDirectionalLightsProperty.boolValue);
            _enableDirectionalLightsShadowsProperty.boolValue = EditorGUILayout.ToggleLeft("Enable Shadows", _enableDirectionalLightsShadowsProperty.boolValue);
            EditorGUILayout.EndToggleGroup();

            EditorGUILayout.Separator();

            _enableSpotLightsProperty.boolValue        = EditorGUILayout.BeginToggleGroup("Enable Spot Lights", _enableSpotLightsProperty.boolValue);
            _enableSpotLightsShadowsProperty.boolValue = EditorGUILayout.ToggleLeft("Enable Shadows", _enableSpotLightsShadowsProperty.boolValue);
            EditorGUILayout.EndToggleGroup();

            EditorGUILayout.Separator();

            _enablePointLightsProperty.boolValue        = EditorGUILayout.BeginToggleGroup("Enable Point Lights", _enablePointLightsProperty.boolValue);
            _enablePointLightsShadowsProperty.boolValue = EditorGUILayout.ToggleLeft("Enable Shadows", _enablePointLightsShadowsProperty.boolValue);
            EditorGUILayout.EndToggleGroup();

            EditorGUILayout.Separator();

            EditorGUI.BeginDisabledGroup(!_enableSpotLightsProperty.boolValue && !_enableSpotLightsProperty.boolValue && !_enableDirectionalLightsProperty.boolValue);
            _enableLightsCookiesProperty.boolValue = EditorGUILayout.ToggleLeft("Enable Cookies", _enableLightsCookiesProperty.boolValue);
            EditorGUI.EndDisabledGroup();

            EditorGUILayout.Separator();

            EditorGUILayout.EndVertical();

            EditorGUILayout.EndVertical();

            EditorGUILayout.Separator();

            EditorGUILayout.BeginVertical(EditorStyles.miniButton);
            GUILayout.Button(new GUIContent(" Experimental Features", experimentalFeaturesIconTexture), GuiStyles.areaTitleBarStyle);
            EditorGUILayout.HelpBox("\nATTENTION : \n\nThe following features are still at experimental stage.\n\nThis means that, although stable, they can lead to visual artifacts.\n\nFeel free to contact me if you have any comment about them.\n", MessageType.Warning);

            EditorGUILayout.BeginVertical();

            EditorGUILayout.Separator();

            _enableOcclusionCullingProperty.boolValue = EditorGUILayout.BeginToggleGroup("Enable Occlusion Culling", _enableOcclusionCullingProperty.boolValue);
            GuiHelpers.DrawContextualHelpBox("The \"Occlusion Culling\" allows to compute the maximum visible depth of the frustum grid.\n\nThis leads to avoid computing cells that are invisible to the camera because hidden behind objects.");
            EditorGUILayout.PropertyField(_occlusionCullingAccuracyProperty, new GUIContent("Accuracy"));
            EditorGUILayout.EndToggleGroup();

            EditorGUILayout.Separator();

            _enableTemporalReprojectionProperty.boolValue = EditorGUILayout.BeginToggleGroup("Enable Reprojection", _enableTemporalReprojectionProperty.boolValue);
            GuiHelpers.DrawContextualHelpBox("The \"Reprojection\" allows to blend the current (jittered) computed frame with the previous one.\n\nThis leads to a smoother volumetric lighting, especially with a low resolution grid.");
            GuiHelpers.DrawSlider(ref _temporalReprojectionFactorProperty, 0, 1, "Reprojector factor");
            EditorGUILayout.EndToggleGroup();

            EditorGUILayout.Separator();

            EditorGUILayout.EndVertical();

            EditorGUILayout.EndVertical();

            EditorGUILayout.Separator();
        }
Пример #22
0
 /// <summary>
 /// Draws a Vector3 field
 /// </summary>
 /// <param name="vector3Property">The related serialized property</param>
 public static void DrawVector3Field(ref SerializedProperty vector3Property)
 {
     GuiHelpers.DrawVector3Field(ref vector3Property, "");
 }
        /// <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();
        }