Просмотр исходного кода

Various tweaks related to handle rendering
Fixed a major bug in gui layout calculations

Marko Pintera 11 лет назад
Родитель
Сommit
9260710936

+ 18 - 0
BansheeEditor/Source/BsBuiltinEditorResources.cpp

@@ -1434,10 +1434,19 @@ namespace BansheeEngine
 
 		HDepthStencilState depthStencilState = DepthStencilState::create(depthStencilStateDesc);
 
+		BLEND_STATE_DESC blendDesc;
+		blendDesc.renderTargetDesc[0].blendEnable = true;
+		blendDesc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
+		blendDesc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
+		blendDesc.renderTargetDesc[0].blendOp = BO_ADD;
+
+		HBlendState blendState = BlendState::create(blendDesc);
+
 		PASS_DESC passDesc;
 		passDesc.vertexProgram = vsProgram;
 		passDesc.fragmentProgram = psProgram;
 		passDesc.depthStencilState = depthStencilState;
+		passDesc.blendState = blendState;
 
 		PassPtr newPass = Pass::create(passDesc);
 		TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererInvariant, { newPass });
@@ -1459,10 +1468,19 @@ namespace BansheeEngine
 
 		HDepthStencilState depthStencilState = DepthStencilState::create(depthStencilStateDesc);
 
+		BLEND_STATE_DESC blendDesc;
+		blendDesc.renderTargetDesc[0].blendEnable = true;
+		blendDesc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
+		blendDesc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
+		blendDesc.renderTargetDesc[0].blendOp = BO_ADD;
+
+		HBlendState blendState = BlendState::create(blendDesc);
+
 		PASS_DESC passDesc;
 		passDesc.vertexProgram = vsProgram;
 		passDesc.fragmentProgram = psProgram;
 		passDesc.depthStencilState = depthStencilState;
+		passDesc.blendState = blendState;
 
 		PassPtr newPass = Pass::create(passDesc);
 		TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererInvariant, { newPass });

+ 4 - 2
BansheeEditor/Source/BsHandleSliderPlane.cpp

@@ -12,10 +12,12 @@ namespace BansheeEngine
 		mDirection1 = Vector3::normalize(dir1);
 		mDirection2 = Vector3::normalize(dir2);
 
+		float halfLength = length * 0.5f;
 		std::array<Vector3, 2> axes = { mDirection1, mDirection2 };
-		std::array<float, 2> extents = { length, length };
+		std::array<float, 2> extents = { halfLength, halfLength };
 
-		mCollider = Rect3(Vector3::ZERO, axes, extents);
+		Vector3 center = (dir1 * length + dir2 * length) * 0.5f;
+		mCollider = Rect3(center, axes, extents);
 
 		HandleSliderManager& sliderManager = HandleManager::instance().getSliderManager();
 		sliderManager._registerSlider(this);

+ 1 - 1
BansheeEngine/Source/BsGUILayoutUtility.cpp

@@ -42,7 +42,7 @@ namespace BansheeEngine
 			if (child == elem)
 				myIndex = i;
 
-			optimalSizes.push_back(calcOptimalSize(elem));
+			optimalSizes.push_back(calcOptimalSize(child));
 		}
 
 		Rect2I* elementAreas = nullptr;

+ 8 - 6
BansheeUtility/Include/BsRect3.h

@@ -51,25 +51,27 @@ namespace BansheeEngine
 		/**
 		 * @brief	Returns the rectangles horizontal axis.
 		 */
-		const Vector3& getAxisHorz() const { return mAxes[0]; }
+		const Vector3& getAxisHorz() const { return mAxisHorz; }
 
 		/**
 		 * @brief	Returns the rectangles vertical axis.
 		 */
-		const Vector3& getAxisVert() const { return mAxes[1]; }
+		const Vector3& getAxisVert() const { return mAxisVert; }
 
 		/**
 		 * @brief	Gets the extent of the rectangle along its horizontal axis.
 		 */
-		const float& getExtentHorz() const { return mExtents[0]; }
+		const float& getExtentHorz() const { return mExtentHorz; }
 
 		/**
 		 * @brief	Gets the extent of the rectangle along its vertical axis.
 		 */
-		const float& getExtentVertical() const { return mExtents[1]; }
+		const float& getExtentVertical() const { return mExtentVert; }
 	private:
 		Vector3 mCenter;
-		std::array<Vector3, 2> mAxes;
-		std::array<float, 2> mExtents;
+		Vector3 mAxisHorz;
+		Vector3 mAxisVert;
+		float mExtentHorz;
+		float mExtentVert;
 	};
 }

+ 23 - 22
BansheeUtility/Source/BsRect3.cpp

@@ -9,7 +9,8 @@ namespace BansheeEngine
 
 	Rect3::Rect3(const Vector3& center, const std::array<Vector3, 2>& axes,
 		const std::array<float, 2>& extents)
-		:mCenter(center), mAxes(axes), mExtents(extents)
+		:mCenter(center), mAxisHorz(axes[0]), mAxisVert(axes[1]),
+		mExtentHorz(extents[0]), mExtentVert(extents[1])
 	{
 
 	}
@@ -40,8 +41,8 @@ namespace BansheeEngine
 		if (!foundNearest)
 		{
 			Vector3 scaledAxes[2];
-			scaledAxes[0] = mExtents[0] * mAxes[0];
-			scaledAxes[1] = mExtents[1] * mAxes[1];
+			scaledAxes[0] = mExtentHorz * mAxisHorz;
+			scaledAxes[1] = mExtentVert * mAxisVert;;
 
 			distance = std::numeric_limits<float>::max();
 			for (UINT32 i = 0; i < 2; i++)
@@ -85,22 +86,22 @@ namespace BansheeEngine
 	std::pair<Vector3, float> Rect3::getNearestPoint(const Vector3& point) const
 	{
 		Vector3 diff = mCenter - point;
-		float b0 = diff.dot(mAxes[0]);
-		float b1 = diff.dot(mAxes[1]);
+		float b0 = diff.dot(mAxisHorz);
+		float b1 = diff.dot(mAxisVert);
 		float s0 = -b0, s1 = -b1;
 		float sqrDistance = diff.dot(diff);
 
-		if (s0 < -mExtents[0])
-			s0 = -mExtents[0];
-		else if (s0 > mExtents[0])
-			s0 = mExtents[0];
+		if (s0 < -mExtentHorz)
+			s0 = -mExtentHorz;
+		else if (s0 > mExtentHorz)
+			s0 = mExtentHorz;
 
 		sqrDistance += s0*(s0 + 2.0f*b0);
 
-		if (s1 < -mExtents[1])
-			s1 = -mExtents[1];
-		else if (s1 > mExtents[1])
-			s1 = mExtents[1];
+		if (s1 < -mExtentVert)
+			s1 = -mExtentVert;
+		else if (s1 > mExtentVert)
+			s1 = mExtentVert;
 
 		sqrDistance += s1*(s1 + 2.0f*b1);
 
@@ -108,7 +109,7 @@ namespace BansheeEngine
 			sqrDistance = 0.0f;
 
 		float dist = std::sqrt(sqrDistance);
-		Vector3 nearestPoint = mCenter + s0 * mAxes[0] + s1 * mAxes[1];
+		Vector3 nearestPoint = mCenter + s0 * mAxisHorz + s1 * mAxisVert;
 
 		return std::make_pair(nearestPoint, dist);
 	}
@@ -118,7 +119,7 @@ namespace BansheeEngine
 		const Vector3& org = ray.getOrigin();
 		const Vector3& dir = ray.getDirection();
 
-		Vector3 normal = mAxes[0].cross(mAxes[1]);
+		Vector3 normal = mAxisHorz.cross(mAxisVert);
 		float NdotD = normal.dot(ray.getDirection());
 		if (fabs(NdotD) > 0.0f)
 		{
@@ -128,21 +129,21 @@ namespace BansheeEngine
 			basis[0] = ray.getDirection();
 			basis[0].orthogonalComplement(basis[1], basis[2]);
 
-			float UdD0 = basis[1].dot(mAxes[0]);
-			float UdD1 = basis[1].dot(mAxes[1]);
+			float UdD0 = basis[1].dot(mAxisHorz);
+			float UdD1 = basis[1].dot(mAxisVert);
 			float UdPmC = basis[1].dot(diff);
-			float VdD0 = basis[2].dot(mAxes[0]);
-			float VdD1 = basis[2].dot(mAxes[1]);
+			float VdD0 = basis[2].dot(mAxisHorz);
+			float VdD1 = basis[2].dot(mAxisVert);
 			float VdPmC = basis[2].dot(diff);
 			float invDet = 1.0f / (UdD0*VdD1 - UdD1*VdD0);
 
 			float s0 = (VdD1*UdPmC - UdD1*VdPmC)*invDet;
 			float s1 = (UdD0*VdPmC - VdD0*UdPmC)*invDet;
 
-			if (fabs(s0) <= mExtents[0] && fabs(s1) <= mExtents[1])
+			if (fabs(s0) <= mExtentHorz && fabs(s1) <= mExtentVert)
 			{
-				float DdD0 = dir.dot(mAxes[0]);
-				float DdD1 = dir.dot(mAxes[1]);
+				float DdD0 = dir.dot(mAxisHorz);
+				float DdD1 = dir.dot(mAxisVert);
 				float DdDiff = dir.dot(diff);
 
 				float t = s0 * DdD0 + s1 * DdD1 - DdDiff;

+ 16 - 0
MBansheeEditor/EditorStyles.cs

@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BansheeEditor
+{
+    public static class EditorStyles
+    {
+        public const string Label = "Label";
+        public const string Button = "Button";
+        public const string Toggle = "Toggle";
+        public const string InputBox = "InputBox";
+    }
+}

+ 1 - 0
MBansheeEditor/MBansheeEditor.csproj

@@ -50,6 +50,7 @@
     <Compile Include="Debug_Component2.cs" />
     <Compile Include="EditorApplication.cs" />
     <Compile Include="EditorSettings.cs" />
+    <Compile Include="EditorStyles.cs" />
     <Compile Include="EditorUtility.cs" />
     <Compile Include="EditorWindow.cs" />
     <Compile Include="GUI\GUIFoldout.cs" />

+ 2 - 2
MBansheeEditor/Scene/HandleDrawing.cs

@@ -67,7 +67,7 @@ namespace BansheeEditor
 
         public static void DrawRect(Rect3 area, float size = 1.0f)
         {
-            Internal_DrawRect(area, size);
+            Internal_DrawRect(area.center, area.axisHorz, area.axisVert, area.extentHorz, area.extentVert, size);
         }
 
         [MethodImpl(MethodImplOptions.InternalCall)]
@@ -107,6 +107,6 @@ namespace BansheeEditor
         private static extern void Internal_DrawWireArc(Vector3 position, Vector3 normal, float radius, Degree startAngle, Degree amountAngle, float size);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_DrawRect(Rect3 area, float size);
+        private static extern void Internal_DrawRect(Vector3 center, Vector3 axisH, Vector3 axisV, float extentH, float extentV, float size);
     }
 }

+ 108 - 6
MBansheeEditor/Scene/MoveHandle.cs

@@ -13,6 +13,10 @@ namespace BansheeEditor
         private HandleSliderLine yAxis;
         private HandleSliderLine zAxis;
 
+        private HandleSliderPlane xyPlane;
+        private HandleSliderPlane yzPlane;
+        private HandleSliderPlane zxPlane;
+
         public Vector3 Delta
         {
             get { return delta; }
@@ -22,7 +26,10 @@ namespace BansheeEditor
         {
             return xAxis.State == HandleSlider.StateType.Active ||
                     yAxis.State == HandleSlider.StateType.Active ||
-                    zAxis.State == HandleSlider.StateType.Active;
+                    zAxis.State == HandleSlider.StateType.Active ||
+                    xyPlane.State == HandleSlider.StateType.Active ||
+                    yzPlane.State == HandleSlider.StateType.Active ||
+                    zxPlane.State == HandleSlider.StateType.Active;
         }
 
         public MoveHandle()
@@ -30,6 +37,10 @@ namespace BansheeEditor
             xAxis = new HandleSliderLine(this, Vector3.xAxis, 1.0f);
             yAxis = new HandleSliderLine(this, Vector3.yAxis, 1.0f);
             zAxis = new HandleSliderLine(this, Vector3.zAxis, 1.0f);
+
+            xyPlane = new HandleSliderPlane(this, Vector3.xAxis, Vector3.yAxis, 0.3f);
+            yzPlane = new HandleSliderPlane(this, Vector3.yAxis, Vector3.zAxis, 0.3f);
+            zxPlane = new HandleSliderPlane(this, Vector3.zAxis, Vector3.xAxis, 0.3f);
         }
 
         protected override void PreInput()
@@ -38,9 +49,17 @@ namespace BansheeEditor
             yAxis.Position = position;
             zAxis.Position = position;
 
+            xyPlane.Position = position;
+            yzPlane.Position = position;
+            zxPlane.Position = position;
+
             xAxis.Rotation = rotation;
             yAxis.Rotation = rotation;
             zAxis.Rotation = rotation;
+
+            xyPlane.Rotation = rotation;
+            yzPlane.Rotation = rotation;
+            zxPlane.Rotation = rotation;
         }
 
         protected override void PostInput()
@@ -52,28 +71,44 @@ namespace BansheeEditor
                 delta += Handles.SnapValue(xAxis.Delta, Handles.MoveSnapAmount) * GetXDir();
                 delta += Handles.SnapValue(yAxis.Delta, Handles.MoveSnapAmount) * GetYDir();
                 delta += Handles.SnapValue(zAxis.Delta, Handles.MoveSnapAmount) * GetZDir();
+
+                delta += Handles.SnapValue(xyPlane.Delta.x, Handles.MoveSnapAmount) * GetXDir();
+                delta += Handles.SnapValue(xyPlane.Delta.y, Handles.MoveSnapAmount) * GetYDir();
+                delta += Handles.SnapValue(yzPlane.Delta.x, Handles.MoveSnapAmount) * GetYDir();
+                delta += Handles.SnapValue(yzPlane.Delta.y, Handles.MoveSnapAmount) * GetZDir();
+                delta += Handles.SnapValue(zxPlane.Delta.x, Handles.MoveSnapAmount) * GetZDir();
+                delta += Handles.SnapValue(zxPlane.Delta.y, Handles.MoveSnapAmount) * GetXDir();
             }
             else
             {
                 delta += xAxis.Delta * GetXDir();
                 delta += yAxis.Delta * GetYDir();
                 delta += zAxis.Delta * GetZDir();
+
+                delta += xyPlane.Delta.x * GetXDir();
+                delta += xyPlane.Delta.y * GetYDir();
+                delta += yzPlane.Delta.x * GetYDir();
+                delta += yzPlane.Delta.y * GetZDir();
+                delta += zxPlane.Delta.x * GetZDir();
+                delta += zxPlane.Delta.y * GetXDir();
             }
         }
 
         protected override void Draw()
         {
             HandleDrawing.SetTransform(Matrix4.TRS(Position, Rotation, Vector3.one));
+            float handleSize = Handles.GetHandleSize(EditorApplication.SceneViewCamera, position);
+
+            // Draw 1D arrows
+            Color axisHover = new Color(0.8f, 0.8f, 0.8f, 1.0f);
 
             if (xAxis.State == HandleSlider.StateType.Active)
                 HandleDrawing.SetColor(Color.white);
             else if(xAxis.State == HandleSlider.StateType.Hover)
-                HandleDrawing.SetColor(Color.red * 0.8f);
+                HandleDrawing.SetColor(Color.red * axisHover);
             else
                 HandleDrawing.SetColor(Color.red);
 
-            float handleSize = Handles.GetHandleSize(EditorApplication.SceneViewCamera, position);
-
             Vector3 xConeStart = Vector3.xAxis*(1.0f - CONE_HEIGHT);
             HandleDrawing.DrawLine(Vector3.zero, xConeStart, handleSize);
             HandleDrawing.DrawCone(xConeStart, Vector3.xAxis, CONE_HEIGHT, CONE_RADIUS, handleSize);
@@ -81,7 +116,7 @@ namespace BansheeEditor
             if (yAxis.State == HandleSlider.StateType.Active)
                 HandleDrawing.SetColor(Color.white);
             else if (yAxis.State == HandleSlider.StateType.Hover)
-                HandleDrawing.SetColor(Color.green * 0.8f);
+                HandleDrawing.SetColor(Color.green * axisHover);
             else
                 HandleDrawing.SetColor(Color.green);
 
@@ -92,13 +127,80 @@ namespace BansheeEditor
             if (zAxis.State == HandleSlider.StateType.Active)
                 HandleDrawing.SetColor(Color.white);
             else if (zAxis.State == HandleSlider.StateType.Hover)
-                HandleDrawing.SetColor(Color.blue * 0.8f);
+                HandleDrawing.SetColor(Color.blue * axisHover);
             else
                 HandleDrawing.SetColor(Color.blue);
 
             Vector3 zConeStart = Vector3.zAxis * (1.0f - CONE_HEIGHT);
             HandleDrawing.DrawLine(Vector3.zero, zConeStart, handleSize);
             HandleDrawing.DrawCone(zConeStart, Vector3.zAxis, CONE_HEIGHT, CONE_RADIUS, handleSize);
+
+            // Draw 2D planes
+            Color planeNormal = new Color(1.0f, 1.0f, 1.0f, 0.2f);
+            Color planeHover = new Color(1.0f, 1.0f, 1.0f, 0.4f);
+            Color planeActive = new Color(1.0f, 1.0f, 1.0f, 0.6f);
+
+            Vector3 planeXOffset = Vector3.xAxis * 0.3f;
+            Vector3 planeYOffset = Vector3.yAxis * 0.3f;
+            Vector3 planeZOffset = Vector3.zAxis * 0.3f;
+
+            //// XY plane
+            HandleDrawing.SetColor(Color.blue);
+
+            HandleDrawing.DrawLine(planeXOffset, planeXOffset + planeYOffset, handleSize);
+            HandleDrawing.DrawLine(planeYOffset, planeYOffset + planeXOffset, handleSize);
+
+            if (xyPlane.State == HandleSlider.StateType.Active)
+                HandleDrawing.SetColor(Color.blue * planeActive);
+            else if (xyPlane.State == HandleSlider.StateType.Hover)
+                HandleDrawing.SetColor(Color.blue * planeHover);
+            else
+                HandleDrawing.SetColor(Color.blue * planeNormal);
+
+            Rect3 xyPlaneArea = new Rect3(
+                (planeXOffset + planeYOffset) * 0.5f,
+                new Vector3[] { Vector3.xAxis, Vector3.yAxis}, 
+                new float[] { 0.15f, 0.15f});
+            HandleDrawing.DrawRect(xyPlaneArea, handleSize);
+
+            //// YZ plane
+            HandleDrawing.SetColor(Color.red);
+
+            HandleDrawing.DrawLine(planeYOffset, planeYOffset + planeZOffset, handleSize);
+            HandleDrawing.DrawLine(planeZOffset, planeZOffset + planeYOffset, handleSize);
+
+            if (yzPlane.State == HandleSlider.StateType.Active)
+                HandleDrawing.SetColor(Color.red * planeActive);
+            else if (yzPlane.State == HandleSlider.StateType.Hover)
+                HandleDrawing.SetColor(Color.red * planeHover);
+            else
+                HandleDrawing.SetColor(Color.red * planeNormal);
+
+            Rect3 yzPlaneArea = new Rect3(
+                (planeYOffset + planeZOffset) * 0.5f,
+                new Vector3[] { Vector3.yAxis, Vector3.zAxis },
+                new float[] { 0.15f, 0.15f });
+
+            HandleDrawing.DrawRect(yzPlaneArea, handleSize);
+
+            //// ZX plane
+            HandleDrawing.SetColor(Color.green);
+
+            HandleDrawing.DrawLine(planeZOffset, planeZOffset + planeXOffset, handleSize);
+            HandleDrawing.DrawLine(planeXOffset, planeXOffset + planeZOffset, handleSize);
+
+            if (zxPlane.State == HandleSlider.StateType.Active)
+                HandleDrawing.SetColor(Color.green * planeActive);
+            else if (zxPlane.State == HandleSlider.StateType.Hover)
+                HandleDrawing.SetColor(Color.green * planeHover);
+            else
+                HandleDrawing.SetColor(Color.green * planeNormal);
+
+            Rect3 zxPlaneArea = new Rect3(
+                (planeZOffset + planeXOffset) * 0.5f,
+                new Vector3[] { Vector3.zAxis, Vector3.xAxis },
+                new float[] { 0.15f, 0.15f });
+            HandleDrawing.DrawRect(zxPlaneArea, handleSize);
         }
 
         private Vector3 GetXDir()

+ 24 - 14
MBansheeEditor/Scene/SceneWindow.cs

@@ -9,9 +9,12 @@ namespace BansheeEditor
 {
     internal sealed class SceneWindow : EditorWindow
     {
+        private const int HeaderHeight = 20;
+
         private Camera camera;
         private SceneCamera cameraController;
         private RenderTexture2D renderTexture;
+        private GUILayoutY mainLayout;
 
         private GUIRenderTexture renderTextureGUI;
         private SceneViewHandler sceneViewHandler;
@@ -31,21 +34,28 @@ namespace BansheeEditor
 
         private void OnInitialize()
         {
-            //GUIToggleGroup handlesTG = new GUIToggleGroup();
+            mainLayout = GUI.layout.AddLayoutY();
+
+            GUIToggleGroup handlesTG = new GUIToggleGroup();
+
+            viewButton = new GUIToggle("V", handlesTG, EditorStyles.Button);
+            moveButton = new GUIToggle("M", handlesTG, EditorStyles.Button);
+            rotateButton = new GUIToggle("R", handlesTG, EditorStyles.Button);
+            scaleButton = new GUIToggle("S", handlesTG, EditorStyles.Button);
 
-            //viewButton = new GUIToggle("V", handlesTG);
-            //moveButton = new GUIToggle("M", handlesTG);
-            //rotateButton = new GUIToggle("R", handlesTG);
-            //scaleButton = new GUIToggle("S", handlesTG);
+            viewButton.OnClick += () => EditorApplication.ActiveSceneTool = SceneViewTool.View;
+            moveButton.OnClick += () => EditorApplication.ActiveSceneTool = SceneViewTool.Move;
+            rotateButton.OnClick += () => EditorApplication.ActiveSceneTool = SceneViewTool.Rotate;
+            scaleButton.OnClick += () => EditorApplication.ActiveSceneTool = SceneViewTool.Scale;
 
-            //GUILayout handlesLayout = GUI.layout.AddLayoutX();
-            //handlesLayout.AddElement(viewButton);
-            //handlesLayout.AddElement(moveButton);
-            //handlesLayout.AddElement(rotateButton);
-            //handlesLayout.AddElement(scaleButton);
-            //handlesLayout.AddFlexibleSpace();
+            GUILayout handlesLayout = mainLayout.AddLayoutX();
+            handlesLayout.AddElement(viewButton);
+            handlesLayout.AddElement(moveButton);
+            handlesLayout.AddElement(rotateButton);
+            handlesLayout.AddElement(scaleButton);
+            handlesLayout.AddFlexibleSpace();
 
-            UpdateRenderTexture(Width, Height);
+            UpdateRenderTexture(Width, Height - HeaderHeight);
         }
 
         private void OnDestroy()
@@ -115,7 +125,7 @@ namespace BansheeEditor
 
         protected override void WindowResized(int width, int height)
         {
-            UpdateRenderTexture(width, height);
+            UpdateRenderTexture(width, height - HeaderHeight);
 
             base.WindowResized(width, height);
         }
@@ -153,7 +163,7 @@ namespace BansheeEditor
                 cameraController = sceneCameraSO.AddComponent<SceneCamera>();
 
                 renderTextureGUI = new GUIRenderTexture(renderTexture);
-                GUI.layout.AddElement(renderTextureGUI);
+                mainLayout.AddElement(renderTextureGUI);
 
                 sceneViewHandler = new SceneViewHandler(this, camera);
 		    }

+ 1 - 1
SBansheeEditor/Include/BsScriptHandleDrawing.h

@@ -28,6 +28,6 @@ namespace BansheeEngine
 		static void internal_DrawWireDisc(Vector3 position, Vector3 normal, float radius, float size);
 		static void internal_DrawArc(Vector3 position, Vector3 normal, float radius, Degree startAngle, Degree amountAngle, float size);
 		static void internal_DrawWireArc(Vector3 position, Vector3 normal, float radius, Degree startAngle, Degree amountAngle, float size);
-		static void internal_DrawRect(Rect3 area, float size);
+		static void internal_DrawRect(Vector3 center, Vector3 horzAxis, Vector3 vertAxis, float extentH, float extentV, float size);
 	};
 }

+ 5 - 1
SBansheeEditor/Source/BsScriptHandleDrawing.cpp

@@ -85,8 +85,12 @@ namespace BansheeEngine
 		HandleManager::instance().getDrawManager().drawWireArc(position, normal, radius, startAngle, amountAngle, size);
 	}
 
-	void ScriptHandleDrawing::internal_DrawRect(Rect3 area, float size)
+	void ScriptHandleDrawing::internal_DrawRect(Vector3 center, Vector3 horzAxis, Vector3 vertAxis, float extentH, float extentV, float size)
 	{
+		std::array<Vector3, 2> axes = { horzAxis, vertAxis };
+		std::array<float, 2> extents = { extentH, extentV };
+
+		Rect3 area(center, axes, extents);
 		HandleManager::instance().getDrawManager().drawRect(area, size);
 	}
 }

+ 21 - 0
TODO.txt

@@ -1,10 +1,26 @@
 --------- ALL LONG TERM TASKS / FIXES BELONG TO GOOGLE DOCS: ImplementationTODO OR PossibleImprovements ----------
 
+Do a cleanup pass on the editor? Fix the annoying little issues:
+ - When GUIToggle is initialy toggled the texture is missing
+ - Switching between button states seem to cause 1 frame of no texture for the gui element
+ - Much more I can't think of right now
+
 <<<<<Assembly refresh>>>>>
 
 When serializing Camera I cannot save the reference to RenderTexture. Make it a Resource?
 Possibly set up automatic refresh in debug mode after initialization? As an ad-hoc unit test
 
+<<<<<<Handles>>>>>>>>
+
+When active handle in EditorApplication changes externally, update the GUI button in scene view
+Save/load active handle tool (it should also probably persist assembly refresh)
+
+Movement of plane (and possible line) sliders might need tweaking
+ - Move handle was moving object in the opposite direction at one point
+ - It also seems to move too slow
+Need to update ShapeMeshes3D::solidQuad to render both sides of the quad
+
+
 <<<<Multi-resource saving>>>>:
  - Modify Font so it doesn't contain a texture, but instead keeps a handle to it
  - Register it in its meta file
@@ -15,12 +31,17 @@ Possibly set up automatic refresh in debug mode after initialization? As an ad-h
 Other:
 Window resize end callback
 Add cutoff plane when rendering discs for rotation handle.
+There seems to be a delay when changing GUI element sprite textures (like 1 frame there is no texture at all)
 
 I can get mono errors by checking g_print calls in goutput.c
  - Calling thunks incorrectly can cause those weird errors with no real callstack
 
 Running embedded mono with VS attached causes managed null refs to be registered as access violations
 
+There seems to be a bug in Mono when passing complex structs from C# to C++. e.g. passing Rect3 as a parameter
+will corrupt the parameter after it, even if layout and size is exact as the C++ version. 
+Rect3 has child structs (Vector3) which could be the reason. Be aware of other similar problems.
+
 Create a stack allocatable custom vector implementation and make getResourceDependencies and getCoreDependencies use it.
  - These methods are called often and cause allocations whenever they are.