Kaynağa Gözat

Added negative handles to scene axes handle
Scene axes are shorter so they don't overlap with the persp/ortho toggle box

BearishSun 10 yıl önce
ebeveyn
işleme
d70d5aa4cf

+ 1 - 1
MBansheeEditor/ConsoleWindow.cs

@@ -397,7 +397,7 @@ namespace BansheeEditor
             private const int CALLER_LABEL_HEIGHT = 11;
             private const int PADDING = 3;
             private const int MESSAGE_HEIGHT = ENTRY_HEIGHT - CALLER_LABEL_HEIGHT - PADDING * 2;
-            private static readonly Color BG_COLOR = Color.LightGray;
+            private static readonly Color BG_COLOR = Color.DarkGray;
             private static readonly Color SELECTION_COLOR = Color.DarkCyan;
 
             private GUIPanel overlay;

+ 1 - 1
MBansheeEditor/GameWindow.cs

@@ -8,7 +8,7 @@ namespace BansheeEditor
     public class GameWindow : EditorWindow
     {
         private const int HeaderHeight = 20;
-        private static readonly Color BG_COLOR = Color.DarkGray;
+        private static readonly Color BG_COLOR = Color.VeryDarkGray;
         private readonly AspectRatio[] aspectRatios =
         {
             new AspectRatio(16, 9), 

+ 78 - 13
MBansheeEditor/Scene/SceneAxesHandle.cs

@@ -14,13 +14,17 @@ namespace BansheeEditor
 
         private const float CONE_HEIGHT = 0.25f;
         private const float CONE_RADIUS = 0.175f;
+        private const float BOX_EXTENT = 0.2f;
 
         private HandleSliderLine xAxis;
         private HandleSliderLine yAxis;
         private HandleSliderLine zAxis;
+        private HandleSliderLine xNegAxis;
+        private HandleSliderLine yNegAxis;
+        private HandleSliderLine zNegAxis;
         private HandleSliderPlane projTypePlane;
 
-        private bool[] clickStates = new bool[4];
+        private bool[] clickStates = new bool[7];
 
         private Vector3 position = Vector3.Zero;
         private Quaternion rotation = Quaternion.Identity;
@@ -30,11 +34,15 @@ namespace BansheeEditor
         /// </summary>
         public SceneAxesHandle()
         {
-            xAxis = new HandleSliderLine(this, Vector3.XAxis, 1.0f, false, LAYER);
-            yAxis = new HandleSliderLine(this, Vector3.YAxis, 1.0f, false, LAYER);
-            zAxis = new HandleSliderLine(this, Vector3.ZAxis, 1.0f, false, LAYER);
+            xAxis = new HandleSliderLine(this, Vector3.XAxis, 1.0f - BOX_EXTENT, false, LAYER);
+            yAxis = new HandleSliderLine(this, Vector3.YAxis, 1.0f - BOX_EXTENT, false, LAYER);
+            zAxis = new HandleSliderLine(this, Vector3.ZAxis, 1.0f - BOX_EXTENT, false, LAYER);
 
-            projTypePlane = new HandleSliderPlane(this, Vector3.XAxis, Vector3.YAxis, 0.4f, false, LAYER);
+            xNegAxis = new HandleSliderLine(this, -Vector3.XAxis, 1.0f - BOX_EXTENT, false, LAYER);
+            yNegAxis = new HandleSliderLine(this, -Vector3.YAxis, 1.0f - BOX_EXTENT, false, LAYER);
+            zNegAxis = new HandleSliderLine(this, -Vector3.ZAxis, 1.0f - BOX_EXTENT, false, LAYER);
+
+            projTypePlane = new HandleSliderPlane(this, Vector3.XAxis, Vector3.YAxis, BOX_EXTENT * 2.0f, false, LAYER);
         }
 
         /// <inheritdoc/>
@@ -47,15 +55,23 @@ namespace BansheeEditor
             position = new Vector3(0, 0, -5.0f);
             rotation = cam.SceneObject.Rotation.Inverse;
 
-            xAxis.Position = position;
-            yAxis.Position = position;
-            zAxis.Position = position;
+            xAxis.Position = position + new Vector3(BOX_EXTENT, 0.0f, 0.0f);
+            yAxis.Position = position + new Vector3(0.0f, BOX_EXTENT, 0.0f);
+            zAxis.Position = position + new Vector3(0.0f, 0.0f, BOX_EXTENT);
 
             xAxis.Rotation = rotation;
             yAxis.Rotation = rotation;
             zAxis.Rotation = rotation;
 
-            Vector3 freeAxisOffset = new Vector3(-0.2f, -0.2f, 0.2f);
+            xNegAxis.Position = position - new Vector3(BOX_EXTENT, 0.0f, 0.0f);
+            yNegAxis.Position = position - new Vector3(0.0f, BOX_EXTENT, 0.0f);
+            zNegAxis.Position = position - new Vector3(0.0f, 0.0f, BOX_EXTENT);
+
+            xNegAxis.Rotation = rotation;
+            yNegAxis.Rotation = rotation;
+            zNegAxis.Rotation = rotation;
+
+            Vector3 freeAxisOffset = new Vector3(-BOX_EXTENT, -BOX_EXTENT, 0.2f);
             projTypePlane.Rotation = Quaternion.Identity;
             projTypePlane.Position = position + freeAxisOffset;
         }
@@ -68,6 +84,9 @@ namespace BansheeEditor
                 new Tuple<HandleSlider, Action>(xAxis, () => RotateCameraTo(Vector3.XAxis)),
                 new Tuple<HandleSlider, Action>(yAxis, () => RotateCameraTo(Vector3.YAxis)),
                 new Tuple<HandleSlider, Action>(zAxis, () => RotateCameraTo(Vector3.ZAxis)),
+                new Tuple<HandleSlider, Action>(xNegAxis, () => RotateCameraTo(-Vector3.XAxis)),
+                new Tuple<HandleSlider, Action>(yNegAxis, () => RotateCameraTo(-Vector3.YAxis)),
+                new Tuple<HandleSlider, Action>(zNegAxis, () => RotateCameraTo(-Vector3.ZAxis)),
                 new Tuple<HandleSlider, Action>(projTypePlane, ToggleProjectionType)
             };
 
@@ -105,8 +124,9 @@ namespace BansheeEditor
             xColor.a = MathEx.Lerp(1.0f, 0.0f, MathEx.Abs(Vector3.Dot(cameraForward, Vector3.XAxis)), 0.8f, 1.0f);
             HandleDrawing.Color = xColor;
 
+            Vector3 xLineStart = Vector3.XAxis* BOX_EXTENT;
             Vector3 xConeStart = Vector3.XAxis * (1.0f - CONE_HEIGHT);
-            HandleDrawing.DrawLine(Vector3.Zero, xConeStart);
+            HandleDrawing.DrawLine(xLineStart, xConeStart);
             HandleDrawing.DrawCone(xConeStart, Vector3.XAxis, CONE_HEIGHT, CONE_RADIUS);
 
             Color yColor = Color.Green;
@@ -118,8 +138,9 @@ namespace BansheeEditor
             yColor.a = MathEx.Lerp(1.0f, 0.0f, MathEx.Abs(Vector3.Dot(cameraForward, Vector3.YAxis)), 0.8f, 1.0f);
             HandleDrawing.Color = yColor;
 
+            Vector3 yLineStart = Vector3.YAxis * BOX_EXTENT;
             Vector3 yConeStart = Vector3.YAxis * (1.0f - CONE_HEIGHT);
-            HandleDrawing.DrawLine(Vector3.Zero, yConeStart);
+            HandleDrawing.DrawLine(yLineStart, yConeStart);
             HandleDrawing.DrawCone(yConeStart, Vector3.YAxis, CONE_HEIGHT, CONE_RADIUS);
 
             Color zColor = Color.Blue;
@@ -131,10 +152,54 @@ namespace BansheeEditor
             zColor.a = MathEx.Lerp(1.0f, 0.0f, MathEx.Abs(Vector3.Dot(cameraForward, Vector3.ZAxis)), 0.8f, 1.0f);
             HandleDrawing.Color = zColor;
 
+            Vector3 zLineStart = Vector3.ZAxis * BOX_EXTENT;
             Vector3 zConeStart = Vector3.ZAxis * (1.0f - CONE_HEIGHT);
-            HandleDrawing.DrawLine(Vector3.Zero, zConeStart);
+            HandleDrawing.DrawLine(zLineStart, zConeStart);
             HandleDrawing.DrawCone(zConeStart, Vector3.ZAxis, CONE_HEIGHT, CONE_RADIUS);
 
+            // Draw negative 1D arrows
+            Color xNegColor = Color.LightGray;
+            if (xNegAxis.State == HandleSlider.StateType.Active)
+                xNegColor = Color.White;
+            else if (xNegAxis.State == HandleSlider.StateType.Hover)
+                xNegColor = Color.BansheeOrange;
+
+            xNegColor.a = MathEx.Lerp(1.0f, 0.0f, MathEx.Abs(Vector3.Dot(cameraForward, Vector3.XAxis)), 0.8f, 1.0f);
+            HandleDrawing.Color = xNegColor;
+
+            Vector3 xNegLineStart = -Vector3.XAxis * BOX_EXTENT;
+            Vector3 xNegConeStart = -Vector3.XAxis * (1.0f - CONE_HEIGHT);
+            HandleDrawing.DrawLine(xNegLineStart, xNegConeStart);
+            HandleDrawing.DrawCone(xNegConeStart, -Vector3.XAxis, CONE_HEIGHT, CONE_RADIUS);
+
+            Color yNegColor = Color.LightGray;
+            if (yNegAxis.State == HandleSlider.StateType.Active)
+                yNegColor = Color.White;
+            else if (yNegAxis.State == HandleSlider.StateType.Hover)
+                yNegColor = Color.BansheeOrange;
+
+            yNegColor.a = MathEx.Lerp(1.0f, 0.0f, MathEx.Abs(Vector3.Dot(cameraForward, Vector3.YAxis)), 0.8f, 1.0f);
+            HandleDrawing.Color = yNegColor;
+
+            Vector3 yNegLineStart = -Vector3.YAxis * BOX_EXTENT;
+            Vector3 yNegConeStart = -Vector3.YAxis * (1.0f - CONE_HEIGHT);
+            HandleDrawing.DrawLine(yNegLineStart, yNegConeStart);
+            HandleDrawing.DrawCone(yNegConeStart, -Vector3.YAxis, CONE_HEIGHT, CONE_RADIUS);
+
+            Color zNegcolor = Color.LightGray;
+            if (zNegAxis.State == HandleSlider.StateType.Active)
+                zNegcolor = Color.White;
+            else if (zNegAxis.State == HandleSlider.StateType.Hover)
+                zNegcolor = Color.BansheeOrange;
+
+            zNegcolor.a = MathEx.Lerp(1.0f, 0.0f, MathEx.Abs(Vector3.Dot(cameraForward, Vector3.ZAxis)), 0.8f, 1.0f);
+            HandleDrawing.Color = zNegcolor;
+
+            Vector3 zNegLineStart = -Vector3.ZAxis * BOX_EXTENT;
+            Vector3 zNegConeStart = -Vector3.ZAxis * (1.0f - CONE_HEIGHT);
+            HandleDrawing.DrawLine(zNegLineStart, zNegConeStart);
+            HandleDrawing.DrawCone(zNegConeStart, -Vector3.ZAxis, CONE_HEIGHT, CONE_RADIUS);
+
             // Draw projection type handle
             if (projTypePlane.State == HandleSlider.StateType.Active)
                 HandleDrawing.Color = Color.White;
@@ -143,7 +208,7 @@ namespace BansheeEditor
             else
                 HandleDrawing.Color = Color.White;
 
-            HandleDrawing.DrawCube(Vector3.Zero, new Vector3(0.2f, 0.2f, 0.2f));
+            HandleDrawing.DrawCube(Vector3.Zero, new Vector3(BOX_EXTENT, BOX_EXTENT, BOX_EXTENT));
 
             // TODO - Add a text notifying the user whether ortho/proj is active
         }

+ 3 - 2
MBansheeEngine/Color.cs

@@ -23,8 +23,9 @@ namespace BansheeEngine
         public static Color White { get { return new Color(1.0f, 1.0f, 1.0f, 1.0f); } }
         public static Color Black { get { return new Color(0.0f, 0.0f, 0.0f, 1.0f); } }
         public static Color DarkCyan { get { return new Color(0.0f, (114.0f / 255.0f), (188.0f / 255.0f), 1.0f); } }
-        public static Color DarkGray { get { return new Color(23.0f / 255.0f, 23.0f / 255.0f, 23.0f / 255.0f, 1.0f); } }
-        public static Color LightGray { get { return new Color(63.0f / 255.0f, 63.0f / 255.0f, 63.0f / 255.0f, 1.0f); } }
+        public static Color VeryDarkGray { get { return new Color(23.0f / 255.0f, 23.0f / 255.0f, 23.0f / 255.0f, 1.0f); } }
+        public static Color DarkGray { get { return new Color(63.0f / 255.0f, 63.0f / 255.0f, 63.0f / 255.0f, 1.0f); } }
+        public static Color LightGray { get { return new Color(200.0f / 255.0f, 200.0f / 255.0f, 200.0f / 255.0f, 1.0f); } }
         public static Color BansheeOrange { get { return new Color(1.0f, (168.0f/255.0f), 0.0f, 1.0f); } }
 
         /// <summary>