Ejemplo n.º 1
0
 static void Drawer_FieldClippingPlanes(SerializedHDCamera p, Editor owner)
 {
     CoreEditorUtils.DrawMultipleFields(
         clippingPlaneMultiFieldTitle,
         new[] { p.baseCameraSettings.nearClippingPlane, p.baseCameraSettings.farClippingPlane },
         new[] { nearPlaneContent, farPlaneContent });
 }
Ejemplo n.º 2
0
        void DrawSurfaceFoamSettings()
        {
            EditorGUILayout.Space();

            if (!surfaceFoamEnabled)
            {
                EditorGUILayout.HelpBox("Feature disabled.", MessageType.Info);
                EditorGUILayout.Space();
                return;
            }

            EditorGUILayout.LabelField("General", EditorStyles.helpBox);
            EditorGUILayout.PropertyField(surfaceFoamTexture, EditorGUIUtility.TrTextContent("Texture"));
            EditorGUILayout.PropertyField(surfaceFoamCutoff, EditorGUIUtility.TrTextContent("Cutoff"));
            EditorGUILayout.PropertyField(surfaceFoamDistortion, EditorGUIUtility.TrTextContent("Distortion"));
            EditorGUILayout.PropertyField(surfaceFoamBlend, EditorGUIUtility.TrTextContent("Color Blend"));

            if (stylizedWater.meshRenderer.sharedMaterial.shader.name == shaderName)
            {
                EditorGUILayout.Space();
                EditorGUILayout.PropertyField(enableHeightMask, EditorGUIUtility.TrTextContent("Wave Mask"));
            }

            if (enableHeightMask.boolValue)
            {
                if (waveSteepness.floatValue == 0f)
                {
                    EditorGUILayout.Space();
                    EditorGUILayout.HelpBox("Wave steepness is set to zero.", MessageType.Warning);
                }

                else
                {
                    EditorGUILayout.PropertyField(surfaceFoamHeightMask, EditorGUIUtility.TrTextContent("Height"));
                    EditorGUILayout.PropertyField(surfaceFoamHeightMaskSmoothness, EditorGUIUtility.TrTextContent("Blend"));
                }
            }

            EditorGUILayout.Space(); EditorGUILayout.Space();
            EditorGUILayout.LabelField("Primary", EditorStyles.helpBox);
            EditorGUILayout.PropertyField(surfaceFoamColor1, EditorGUIUtility.TrTextContent("Color"));
            EditorGUILayout.PropertyField(surfaceFoamScale1, EditorGUIUtility.TrTextContent("Scale"));
            EditorGUILayout.PropertyField(surfaceFoamDirection1, EditorGUIUtility.TrTextContent("Direction"));
            EditorGUILayout.PropertyField(surfaceFoamSpeed1, EditorGUIUtility.TrTextContent("Speed"));

            EditorGUILayout.Space(); EditorGUILayout.Space();
            EditorGUILayout.LabelField("Secondary", EditorStyles.helpBox);
            EditorGUILayout.PropertyField(surfaceFoamColor2, EditorGUIUtility.TrTextContent("Color"));
            EditorGUILayout.PropertyField(surfaceFoamScale2, EditorGUIUtility.TrTextContent("Scale"));
            EditorGUILayout.PropertyField(surfaceFoamDirection2, EditorGUIUtility.TrTextContent("Direction"));
            EditorGUILayout.PropertyField(surfaceFoamSpeed2, EditorGUIUtility.TrTextContent("Speed"));

            var labelWidth = EditorGUIUtility.labelWidth;

            EditorGUIUtility.labelWidth = 80;
            CoreEditorUtils.DrawMultipleFields("Offset", new[] { surfaceFoamOffsetX, surfaceFoamOffsetY }, new[] { EditorGUIUtility.TrTextContent("X"), EditorGUIUtility.TrTextContent("Y") });
            EditorGUIUtility.labelWidth = labelWidth;

            EditorGUILayout.Space(); EditorGUILayout.Space();
        }
Ejemplo n.º 3
0
        static void LevelValuesFieldGUI <T>(
            GUIContent label,
            SerializedScalableSetting scalableSetting,
            int count,
            ScalableSettingSchema schema
            )
            where T : struct
        {
            var labels = new GUIContent[count];

            Array.Copy(schema.levelNames, labels, count);
            var values = new T[count];

            for (var i = 0; i < count; ++i)
            {
                values[i] = scalableSetting.values.GetArrayElementAtIndex(i).GetInline <T>();
            }

            using (var scope = new EditorGUI.ChangeCheckScope())
            {
                CoreEditorUtils.DrawMultipleFields(label, labels, values);
                if (scope.changed)
                {
                    for (var i = 0; i < count; ++i)
                    {
                        scalableSetting.values.GetArrayElementAtIndex(i).SetInline(values[i]);
                    }
                }
            }
        }
Ejemplo n.º 4
0
        void DrawWaveSettings()
        {
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Visuals", EditorStyles.helpBox);
            EditorGUILayout.PropertyField(waveSteepness, EditorGUIUtility.TrTextContent("Steepness"));
            EditorGUILayout.PropertyField(waveLength, EditorGUIUtility.TrTextContent("Scale"));
            EditorGUILayout.PropertyField(waveSpeed, EditorGUIUtility.TrTextContent("Speed"));

            EditorGUILayout.Space();
            var labelWidth = EditorGUIUtility.labelWidth;

            EditorGUIUtility.labelWidth = 80;
            CoreEditorUtils.DrawMultipleFields("Directions", new[] { waveDirection1, waveDirection2, waveDirection3, waveDirection4 },
                                               new[] { EditorGUIUtility.TrTextContent("1"), EditorGUIUtility.TrTextContent("2"), EditorGUIUtility.TrTextContent("3"), EditorGUIUtility.TrTextContent("4") });
            EditorGUIUtility.labelWidth = labelWidth;
            EditorGUILayout.Space(); EditorGUILayout.Space();
        }
Ejemplo n.º 5
0
        public static void Draw(
            SerializedCameraSettings serialized, Editor owner,
            CameraSettingsOverride displayedFields
            )
        {
            const CameraSettingsFields bufferFields = CameraSettingsFields.bufferClearBackgroundColorHDR
                                                      | CameraSettingsFields.bufferClearClearDepth
                                                      | CameraSettingsFields.bufferClearColorMode;
            const CameraSettingsFields volumesFields = CameraSettingsFields.volumesAnchorOverride
                                                       | CameraSettingsFields.volumesLayerMask;
            const CameraSettingsFields cullingFields = CameraSettingsFields.cullingCullingMask
                                                       | CameraSettingsFields.cullingInvertFaceCulling
                                                       | CameraSettingsFields.cullingUseOcclusionCulling;
            const CameraSettingsFields frustumFields = CameraSettingsFields.frustumAspect
                                                       | CameraSettingsFields.frustumFarClipPlane
                                                       | CameraSettingsFields.frustumMode
                                                       | CameraSettingsFields.frustumNearClipPlane
                                                       | CameraSettingsFields.frustumProjectionMatrix
                                                       | CameraSettingsFields.frustumFieldOfView;
            const CameraSettingsFields frustumFarOrNearPlane = CameraSettingsFields.frustumFarClipPlane
                                                               | CameraSettingsFields.frustumNearClipPlane;

            if ((displayedFields.camera & bufferFields) != 0)
            {
                PropertyFieldWithoutToggle(CameraSettingsFields.bufferClearColorMode, serialized.bufferClearColorMode, Styles.bufferClearColorMode, displayedFields.camera);
                PropertyFieldWithoutToggle(CameraSettingsFields.bufferClearBackgroundColorHDR, serialized.bufferClearBackgroundColorHDR, Styles.bufferClearBackgroundColorHDR, displayedFields.camera);
                PropertyFieldWithoutToggle(CameraSettingsFields.bufferClearClearDepth, serialized.bufferClearClearDepth, Styles.bufferClearClearDepth, displayedFields.camera);
                EditorGUILayout.Space();
            }

            if ((displayedFields.camera & volumesFields) != 0)
            {
                PropertyFieldWithoutToggle(CameraSettingsFields.volumesLayerMask, serialized.volumesLayerMask, Styles.volumesLayerMask, displayedFields.camera);
                PropertyFieldWithoutToggle(CameraSettingsFields.volumesAnchorOverride, serialized.volumesAnchorOverride, Styles.volumesAnchorOverride, displayedFields.camera);
                EditorGUILayout.Space();
            }

            if ((displayedFields.camera & cullingFields) != 0)
            {
                PropertyFieldWithoutToggle(CameraSettingsFields.cullingUseOcclusionCulling, serialized.cullingUseOcclusionCulling, Styles.cullingUseOcclusionCulling, displayedFields.camera);
                PropertyFieldWithoutToggle(CameraSettingsFields.cullingCullingMask, serialized.cullingCullingMask, Styles.cullingCullingMask, displayedFields.camera);
                PropertyFieldWithoutToggle(CameraSettingsFields.cullingInvertFaceCulling, serialized.cullingInvertFaceCulling, Styles.cullingInvertFaceCulling, displayedFields.camera);
                EditorGUILayout.Space();
            }

            if ((displayedFields.camera & frustumFields) != 0)
            {
                PropertyFieldWithoutToggle(CameraSettingsFields.frustumAspect, serialized.frustumAspect, Styles.frustumAspect, displayedFields.camera);
                PropertyFieldWithoutToggle(CameraSettingsFields.frustumFieldOfView, serialized.frustumFieldOfView, Styles.frustumFieldOfView, displayedFields.camera);
                var areBothDisplayed = displayedFields.camera.HasFlag(frustumFarOrNearPlane);
                if (areBothDisplayed)
                {
                    CoreEditorUtils.DrawMultipleFields(
                        Styles.clippingPlanesLabel,
                        new[] { serialized.frustumNearClipPlane, serialized.frustumFarClipPlane },
                        Styles.clippingPlanes);
                }
                else
                {
                    PropertyFieldWithoutToggle(CameraSettingsFields.frustumFarClipPlane, serialized.frustumFarClipPlane, Styles.frustumFarClipPlane, displayedFields.camera);
                    PropertyFieldWithoutToggle(CameraSettingsFields.frustumNearClipPlane, serialized.frustumNearClipPlane, Styles.frustumNearClipPlane, displayedFields.camera);
                }

                // Enforce valid value range
                serialized.frustumNearClipPlane.floatValue = Mathf.Max(CameraSettings.Frustum.MinNearClipPlane, serialized.frustumNearClipPlane.floatValue);
                serialized.frustumFarClipPlane.floatValue  = Mathf.Max(serialized.frustumNearClipPlane.floatValue + CameraSettings.Frustum.MinFarClipPlane, serialized.frustumFarClipPlane.floatValue);
                EditorGUILayout.Space();
            }

            PropertyFieldWithoutToggle(CameraSettingsFields.flipYMode, serialized.flipYMode, Styles.flipYMode, displayedFields.camera);
            PropertyFieldWithoutToggle(CameraSettingsFields.probeLayerMask, serialized.probeLayerMask, Styles.probeLayerMask, displayedFields.camera);
            PropertyFieldWithoutToggle(CameraSettingsFields.customRenderingSettings, serialized.customRenderingSettings, Styles.customRenderingSettings, displayedFields.camera);

            if ((displayedFields.camera & CameraSettingsFields.frameSettings) != 0)
            {
                //Warning, fullscreenPassThrough have been removed from RenderingPath enum
                //and replaced with a toggle on the camera. If this script aim to be used
                //on camera too, add it here.

                if (serialized.customRenderingSettings.boolValue)
                {
                    --EditorGUI.indentLevel; //fix alignment issue for Planar Reflection and Reflection probe's FrameSettings
                    // TODO: place it in static cache
                    var drawer = FrameSettingsUI.Inspector(true);
                    drawer.Draw(serialized.frameSettings, owner);
                    ++EditorGUI.indentLevel;
                }
            }
        }