static void Drawer_SectionProxySettings(PlanarReflectionProbeUI s, SerializedPlanarReflectionProbe d, Editor o)
        {
            EditorGUILayout.PropertyField(d.proxyVolumeReference, _.GetContent("Reference"));

            if (d.proxyVolumeReference.objectReferenceValue != null)
            {
                var proxy = (ReflectionProxyVolumeComponent)d.proxyVolumeReference.objectReferenceValue;
                if ((int)proxy.proxyVolume.shapeType != d.influenceVolume.shapeType.enumValueIndex)
                {
                    EditorGUILayout.HelpBox(
                        "Proxy volume and influence volume have different shape types, this is not supported.",
                        MessageType.Error,
                        true
                        );
                }
            }
            else
            {
                EditorGUILayout.HelpBox(
                    "When no Proxy setted, Influence shape will be used as Proxy shape too.",
                    MessageType.Info,
                    true
                    );
            }
        }
 static void Drawer_FieldCaptureType(PlanarReflectionProbeUI s, SerializedPlanarReflectionProbe d, Editor o)
 {
     GUI.enabled = false;
     EditorGUILayout.PropertyField(d.mode, _.GetContent("Type"));
     d.mode.enumValueIndex = (int)ReflectionProbeMode.Realtime;
     GUI.enabled           = true;
 }
        public override void Update()
        {
            SerializedPlanarReflectionProbe serialized = data as SerializedPlanarReflectionProbe;

            isSectionExpandedCaptureMirrorSettings.target = serialized.isMirrored;
            isSectionExpandedCaptureStaticSettings.target = !serialized.isMirrored;
            base.Update();
        }
        protected override void OnEnable()
        {
            m_SerializedHDProbe = new SerializedPlanarReflectionProbe(serializedObject);
            base.OnEnable();

            PlanarReflectionProbe probe = (PlanarReflectionProbe)target;

            probe.influenceVolume.Init(probe);
        }
Ejemplo n.º 5
0
        static void Drawer_SectionCaptureStatic(PlanarReflectionProbeUI s, SerializedPlanarReflectionProbe d, Editor o)
        {
            EditorGUILayout.PropertyField(d.captureLocalPosition, _.GetContent("Capture Local Position"));

            _.DrawMultipleFields(
                "Clipping Planes",
                new[] { d.captureNearPlane, d.captureFarPlane },
                new[] { _.GetContent("Near|The closest point relative to the camera that drawing will occur."), _.GetContent("Far|The furthest point relative to the camera that drawing will occur.\n") });
        }
Ejemplo n.º 6
0
        static void Drawer_SectionProbeModeCustomSettings(PlanarReflectionProbeUI s, SerializedPlanarReflectionProbe d, Editor o)
        {
            d.customTexture.objectReferenceValue = EditorGUILayout.ObjectField(_.GetContent("Capture"), d.customTexture.objectReferenceValue, typeof(Texture), false);
            var texture = d.customTexture.objectReferenceValue as Texture;

            if (texture != null && texture.dimension != TextureDimension.Tex2D)
            {
                EditorGUILayout.HelpBox("Provided Texture is not a 2D Texture, it will be ignored", MessageType.Warning);
            }
        }
Ejemplo n.º 7
0
        static void Drawer_SectionInfluenceSettings(PlanarReflectionProbeUI s, SerializedPlanarReflectionProbe d, Editor o)
        {
            EditorGUILayout.PropertyField(d.weight, _.GetContent("Weight"));


            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(d.multiplier, _.GetContent("Multiplier"));
            if (EditorGUI.EndChangeCheck())
            {
                d.multiplier.floatValue = Mathf.Max(0.0f, d.multiplier.floatValue);
            }
        }
        static void Drawer_DifferentShapeError(PlanarReflectionProbeUI s, SerializedPlanarReflectionProbe d, Editor o)
        {
            var proxy = d.proxyVolumeReference.objectReferenceValue as ReflectionProxyVolumeComponent;

            if (proxy != null && (int)proxy.proxyVolume.shapeType != d.influenceVolume.shapeType.enumValueIndex)
            {
                EditorGUILayout.HelpBox(
                    "Proxy volume and influence volume have different shape types, this is not supported.",
                    MessageType.Error,
                    true
                    );
            }
        }
        void OnEnable()
        {
            m_SerializedAsset = new SerializedPlanarReflectionProbe(serializedObject);
            m_UIState.Reset(m_SerializedAsset, Repaint);

            m_TypedTargets  = new PlanarReflectionProbe[targets.Length];
            m_UIHandleState = new PlanarReflectionProbeUI[m_TypedTargets.Length];
            for (var i = 0; i < m_TypedTargets.Length; i++)
            {
                m_TypedTargets[i]  = (PlanarReflectionProbe)targets[i];
                m_UIHandleState[i] = new PlanarReflectionProbeUI();
                m_UIHandleState[i].Reset(m_SerializedAsset, null);

                s_StateMap[m_TypedTargets[i]] = m_UIHandleState[i];
            }
        }
Ejemplo n.º 10
0
        static void Drawer_Toolbar(PlanarReflectionProbeUI s, SerializedPlanarReflectionProbe d, Editor o)
        {
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            GUI.changed = false;

            EditMode.DoInspectorToolbar(k_Toolbar_SceneViewEditModes, toolbar_Contents, GetBoundsGetter(o), o);

            if (d.isMirrored)
            {
                EditMode.DoInspectorToolbar(k_Toolbar_Mirror_SceneViewEditModes, toolbar_Mirror_Contents, GetBoundsGetter(o), o);
            }
            else
            {
                EditMode.DoInspectorToolbar(k_Toolbar_Static_SceneViewEditModes, toolbar_Static_Contents, GetBoundsGetter(o), o);
            }

            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
        }
Ejemplo n.º 11
0
        static void Drawer_SectionCaptureSettings(PlanarReflectionProbeUI s, SerializedPlanarReflectionProbe d, Editor o)
        {
            var hdrp = GraphicsSettings.renderPipelineAsset as HDRenderPipelineAsset;

            GUI.enabled = false;
            EditorGUILayout.LabelField(
                _.GetContent("Probe Texture Size (Set By HDRP)"),
                _.GetContent(hdrp.renderPipelineSettings.lightLoopSettings.planarReflectionTextureSize.ToString()),
                EditorStyles.label);
            EditorGUILayout.Toggle(
                _.GetContent("Probe Compression (Set By HDRP)"),
                hdrp.renderPipelineSettings.lightLoopSettings.planarReflectionCacheCompressed);
            GUI.enabled = true;

            EditorGUILayout.PropertyField(d.overrideFieldOfView, _.GetContent("Override FOV"));
            if (d.overrideFieldOfView.boolValue)
            {
                ++EditorGUI.indentLevel;
                EditorGUILayout.PropertyField(d.fieldOfViewOverride, _.GetContent("Field Of View"));
                --EditorGUI.indentLevel;
            }
        }
Ejemplo n.º 12
0
        internal static void DrawHandles(PlanarReflectionProbeUI s, SerializedPlanarReflectionProbe d, Editor o)
        {
            PlanarReflectionProbe probe = d.target;

            HDProbeUI.DrawHandles(s, d, o);

            if (probe.useMirrorPlane)
            {
                var m   = Handles.matrix;
                var mat = Matrix4x4.TRS(probe.transform.position, probe.transform.rotation, Vector3.one * 1.5f);
                using (new Handles.DrawingScope(k_GizmoMirrorPlaneCamera, mat))
                {
                    Handles.ArrowHandleCap(
                        0,
                        probe.captureMirrorPlaneLocalPosition,
                        Quaternion.LookRotation(probe.captureMirrorPlaneLocalNormal),
                        HandleUtility.GetHandleSize(probe.captureMirrorPlaneLocalPosition),
                        Event.current.type
                        );
                }
            }
        }
        protected static void Drawer_SectionCaptureSettings(HDProbeUI s, SerializedHDProbe d, Editor o)
        {
            SerializedPlanarReflectionProbe serialized = (SerializedPlanarReflectionProbe)d;
            var hdrp = GraphicsSettings.renderPipelineAsset as HDRenderPipelineAsset;

            GUI.enabled = false;
            EditorGUILayout.LabelField(
                CoreEditorUtils.GetContent("Probe Texture Size (Set By HDRP)"),
                CoreEditorUtils.GetContent(hdrp.renderPipelineSettings.lightLoopSettings.planarReflectionTextureSize.ToString()),
                EditorStyles.label);
            EditorGUILayout.Toggle(
                CoreEditorUtils.GetContent("Probe Compression (Set By HDRP)"),
                hdrp.renderPipelineSettings.lightLoopSettings.planarReflectionCacheCompressed);
            GUI.enabled = true;

            bool on = serialized.overrideFieldOfView.boolValue;

            EditorGUI.BeginChangeCheck();
            on = EditorGUILayout.Toggle(overrideFieldOfViewContent, on);
            if (on)
            {
                serialized.fieldOfViewOverride.floatValue = EditorGUILayout.FloatField(fieldOfViewSolidAngleContent, serialized.fieldOfViewOverride.floatValue);
            }
            if (EditorGUI.EndChangeCheck())
            {
                serialized.overrideFieldOfView.boolValue = on;
                serialized.Apply();
            }

            //GUI.enabled = false;
            //EditorGUILayout.LabelField(resolutionContent, CoreEditorUtils.GetContent(((int)hdrp.GetRenderPipelineSettings().lightLoopSettings.reflectionCubemapSize).ToString()));
            //EditorGUILayout.LabelField(shadowDistanceContent, EditorStyles.label);
            //EditorGUILayout.LabelField(cullingMaskContent, EditorStyles.label);
            //EditorGUILayout.LabelField(useOcclusionCullingContent, EditorStyles.label);
            //EditorGUILayout.LabelField(nearClipCullingContent, EditorStyles.label);
            //EditorGUILayout.LabelField(farClipCullingContent, EditorStyles.label);
            //GUI.enabled = true;
        }
 static void Drawer_SectionInfluenceSettings(PlanarReflectionProbeUI s, SerializedPlanarReflectionProbe d, Editor o)
 {
     EditorGUILayout.PropertyField(d.dimmer, _.GetContent("Dimmer"));
 }
Ejemplo n.º 15
0
 static void Drawer_FieldProxyVolumeReference(PlanarReflectionProbeUI s, SerializedPlanarReflectionProbe d, Editor o)
 {
     EditorGUILayout.PropertyField(d.proxyVolumeReference, _.GetContent("Reference"));
 }
Ejemplo n.º 16
0
 static void Drawer_FieldCaptureType(PlanarReflectionProbeUI s, SerializedPlanarReflectionProbe d, Editor o)
 {
     EditorGUILayout.PropertyField(d.mode, _.GetContent("Type"));
 }
Ejemplo n.º 17
0
 static void Drawer_SectionProbeModeRealtimeSettings(PlanarReflectionProbeUI s, SerializedPlanarReflectionProbe d, Editor o)
 {
     EditorGUILayout.PropertyField(d.refreshMode, _.GetContent("Refresh Mode"));
     EditorGUILayout.PropertyField(d.capturePositionMode, _.GetContent("Capture Position Mode"));
 }
Ejemplo n.º 18
0
 static void Drawer_SectionBakeButton(PlanarReflectionProbeUI s, SerializedPlanarReflectionProbe d, Editor o)
 {
     EditorReflectionSystemGUI.DrawBakeButton((ReflectionProbeMode)d.mode.intValue, d.target);
 }
Ejemplo n.º 19
0
 static void Drawer_SectionCaptureMirror(PlanarReflectionProbeUI s, SerializedPlanarReflectionProbe d, Editor o)
 {
     EditorGUILayout.PropertyField(d.captureMirrorPlaneLocalPosition, _.GetContent("Plane Position"));
     EditorGUILayout.PropertyField(d.captureMirrorPlaneLocalNormal, _.GetContent("Plane Normal"));
 }
Ejemplo n.º 20
0
        internal static void DrawHandlesOverride(PlanarReflectionProbeUI s, SerializedPlanarReflectionProbe d, Editor o)
        {
            //Note: HDProbeUI.DrawHandles is called in parent
            PlanarReflectionProbe probe = d.target;

            switch (EditMode.editMode)
            {
            case EditBaseShape:
                if ((InfluenceShape)d.influenceVolume.shape.intValue != InfluenceShape.Box)
                {
                    return;
                }

                //override base handle behavior to also translate object along x and z axis and offset the y axis
                using (new Handles.DrawingScope(Matrix4x4.TRS(Vector3.zero, d.target.transform.rotation, Vector3.one)))
                {
                    Vector3 origin = Quaternion.Inverse(probe.transform.rotation) * probe.transform.position;
                    s.influenceVolume.boxBaseHandle.center = origin + probe.influenceVolume.offset;
                    s.influenceVolume.boxBaseHandle.size   = probe.influenceVolume.boxSize;

                    EditorGUI.BeginChangeCheck();
                    s.influenceVolume.boxBaseHandle.DrawHandle();
                    if (EditorGUI.EndChangeCheck())
                    {
                        Undo.RecordObjects(new Object[] { probe, probe.transform }, "Modified Planar Base Volume AABB");

                        Vector3 size = s.influenceVolume.boxBaseHandle.size;

                        //clamp offset value
                        float extend = probe.influenceVolume.boxSize.y * 0.5f;
                        float offset = s.influenceVolume.boxBaseHandle.center.y - origin.y;
                        if (offset < -extend)
                        {
                            size.y += 2f * (-offset - extend);
                            offset  = -extend;
                        }
                        if (offset > extend)
                        {
                            size.y += 2f * (offset - extend);
                            offset  = extend;
                        }
                        if (size.y < 0)
                        {
                            size.y = 0;
                        }
                        probe.influenceVolume.boxSize = size;
                        probe.influenceVolume.offset  = new Vector3(0, offset, 0);
                        Vector3 centerXZ = s.influenceVolume.boxBaseHandle.center;
                        centerXZ.y = origin.y;
                        Vector3 deltaXZ = probe.transform.rotation * centerXZ - probe.transform.position;
                        probe.transform.position += deltaXZ;
                    }
                }
                break;

            case EditCenter:
            {
                if ((InfluenceShape)d.influenceVolume.shape.intValue != InfluenceShape.Box)
                {
                    break;
                }

                //override base handle behavior to only translate object along y
                using (new Handles.DrawingScope(Matrix4x4.TRS(Vector3.zero, Quaternion.identity, Vector3.one)))
                {
                    EditorGUI.BeginChangeCheck();
                    var newCapturePosition = Handles.Slider(
                        probe.transform.position,
                        probe.transform.rotation * Vector3.up,
                        HandleUtility.GetHandleSize(probe.transform.position),
                        Handles.ArrowHandleCap,
                        0f
                        );
                    if (EditorGUI.EndChangeCheck())
                    {
                        Undo.RecordObjects(new Object[] { probe, probe.transform }, "Translate Influence Position");
                        Vector3   delta           = newCapturePosition - probe.transform.position;
                        Matrix4x4 oldLocalToWorld = Matrix4x4.TRS(probe.transform.position, probe.transform.rotation, Vector3.one);
                        probe.transform.position = newCapturePosition;
                        Vector3 offset = d.influenceVolume.offset.vector3Value - oldLocalToWorld.inverse.MultiplyVector(delta);

                        //clamp offset value
                        float extend = probe.influenceVolume.boxSize.y * 0.5f;
                        offset.y = Mathf.Clamp(offset.y, -extend, extend);
                        d.influenceVolume.offset.vector3Value = offset;

                        d.influenceVolume.Apply();
                    }
                }
                break;
            }
            }
        }
 static void Drawer_SectionProbeModeRealtimeSettings(PlanarReflectionProbeUI s, SerializedPlanarReflectionProbe d, Editor o)
 {
     GUI.enabled = false;
     EditorGUILayout.PropertyField(d.refreshMode, _.GetContent("Refresh Mode"));
     EditorGUILayout.PropertyField(d.capturePositionMode, _.GetContent("Capture Position Mode"));
     d.refreshMode.enumValueIndex         = (int)ReflectionProbeRefreshMode.EveryFrame;
     d.capturePositionMode.enumValueIndex = (int)PlanarReflectionProbe.CapturePositionMode.MirrorCamera;
     GUI.enabled = true;
 }