Ejemplo n.º 1
0
        private static void RenderBoxOutline(ReflectionProbe reflectionProbe, GizmoType gizmoType)
        {
            Color color = Gizmos.color;

            Gizmos.color  = ((!reflectionProbe.isActiveAndEnabled) ? ReflectionProbeEditor.kGizmoReflectionProbeDisabled : ReflectionProbeEditor.kGizmoReflectionProbe);
            Gizmos.matrix = ReflectionProbeEditor.GetLocalSpace(reflectionProbe);
            Gizmos.DrawWireCube(reflectionProbe.center, reflectionProbe.size);
            Gizmos.matrix = Matrix4x4.identity;
            Gizmos.color  = color;
        }
Ejemplo n.º 2
0
 private static void RenderBoxGizmo(ReflectionProbe reflectionProbe, GizmoType gizmoType)
 {
     if (!(ReflectionProbeEditor.s_LastInteractedEditor == null))
     {
         if (ReflectionProbeEditor.s_LastInteractedEditor.sceneViewEditing && EditMode.editMode == EditMode.SceneViewEditMode.ReflectionProbeBox)
         {
             Color color = Gizmos.color;
             Gizmos.color  = ReflectionProbeEditor.kGizmoReflectionProbe;
             Gizmos.matrix = ReflectionProbeEditor.GetLocalSpace(reflectionProbe);
             Gizmos.DrawCube(reflectionProbe.center, -1f * reflectionProbe.size);
             Gizmos.matrix = Matrix4x4.identity;
             Gizmos.color  = color;
         }
     }
 }
Ejemplo n.º 3
0
        private bool ValidateAABB(ref Vector3 center, ref Vector3 size)
        {
            ReflectionProbe reflectionProbe = (ReflectionProbe)base.target;
            Vector3         point           = ReflectionProbeEditor.GetLocalSpace(reflectionProbe).inverse.MultiplyPoint3x4(reflectionProbe.transform.position);
            Bounds          bounds          = new Bounds(center, size);
            bool            result;

            if (bounds.Contains(point))
            {
                result = false;
            }
            else
            {
                bounds.Encapsulate(point);
                center = bounds.center;
                size   = bounds.size;
                result = true;
            }
            return(result);
        }
Ejemplo n.º 4
0
        private void DoBoxEditing()
        {
            ReflectionProbe reflectionProbe = (ReflectionProbe)base.target;

            using (new Handles.DrawingScope(ReflectionProbeEditor.GetLocalSpace(reflectionProbe)))
            {
                this.m_BoundsHandle.center = reflectionProbe.center;
                this.m_BoundsHandle.size   = reflectionProbe.size;
                EditorGUI.BeginChangeCheck();
                this.m_BoundsHandle.DrawHandle();
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(reflectionProbe, "Modified Reflection Probe AABB");
                    Vector3 center = this.m_BoundsHandle.center;
                    Vector3 size   = this.m_BoundsHandle.size;
                    this.ValidateAABB(ref center, ref size);
                    reflectionProbe.center = center;
                    reflectionProbe.size   = size;
                    EditorUtility.SetDirty(base.target);
                }
            }
        }
Ejemplo n.º 5
0
        private void DoOriginEditing()
        {
            ReflectionProbe reflectionProbe = (ReflectionProbe)base.target;
            Vector3         position        = reflectionProbe.transform.position;
            Vector3         size            = reflectionProbe.size;

            EditorGUI.BeginChangeCheck();
            Vector3 v = Handles.PositionHandle(position, ReflectionProbeEditor.GetLocalSpaceRotation(reflectionProbe));

            if (EditorGUI.EndChangeCheck() || this.m_OldLocalSpace != ReflectionProbeEditor.GetLocalSpace((ReflectionProbe)base.target))
            {
                Vector3 vector = this.m_OldLocalSpace.inverse.MultiplyPoint3x4(v);
                Bounds  bounds = new Bounds(reflectionProbe.center, size);
                vector = bounds.ClosestPoint(vector);
                Undo.RecordObject(reflectionProbe.transform, "Modified Reflection Probe Origin");
                reflectionProbe.transform.position = this.m_OldLocalSpace.MultiplyPoint3x4(vector);
                Undo.RecordObject(reflectionProbe, "Modified Reflection Probe Origin");
                reflectionProbe.center = ReflectionProbeEditor.GetLocalSpace(reflectionProbe).inverse.MultiplyPoint3x4(this.m_OldLocalSpace.MultiplyPoint3x4(reflectionProbe.center));
                EditorUtility.SetDirty(base.target);
                this.UpdateOldLocalSpace();
            }
        }
Ejemplo n.º 6
0
 private void UpdateOldLocalSpace()
 {
     this.m_OldLocalSpace = ReflectionProbeEditor.GetLocalSpace((ReflectionProbe)base.target);
 }