Bläddra i källkod

Properly sync window resize/move events from core to sim thread

Marko Pintera 11 år sedan
förälder
incheckning
af7981f618

+ 36 - 36
BansheeCore/BansheeCore.vcxproj.filters

@@ -16,9 +16,6 @@
     <Filter Include="Header Files\Utility">
     <Filter Include="Header Files\Utility">
       <UniqueIdentifier>{2c09857e-4a4a-480f-8ebb-1661a9ce78dd}</UniqueIdentifier>
       <UniqueIdentifier>{2c09857e-4a4a-480f-8ebb-1661a9ce78dd}</UniqueIdentifier>
     </Filter>
     </Filter>
-    <Filter Include="Source Files\RenderSystem">
-      <UniqueIdentifier>{e0bdc5fc-afd1-46f9-9e3e-f85ca3e220b8}</UniqueIdentifier>
-    </Filter>
     <Filter Include="Header Files\Importer">
     <Filter Include="Header Files\Importer">
       <UniqueIdentifier>{f1fb2bc5-43c6-476a-89e3-b7de86c5aebe}</UniqueIdentifier>
       <UniqueIdentifier>{f1fb2bc5-43c6-476a-89e3-b7de86c5aebe}</UniqueIdentifier>
     </Filter>
     </Filter>
@@ -88,6 +85,9 @@
     <Filter Include="Header Files\RenderAPI">
     <Filter Include="Header Files\RenderAPI">
       <UniqueIdentifier>{3480589d-111c-44b8-b0f1-a178cd00f31e}</UniqueIdentifier>
       <UniqueIdentifier>{3480589d-111c-44b8-b0f1-a178cd00f31e}</UniqueIdentifier>
     </Filter>
     </Filter>
+    <Filter Include="Source Files\RenderAPI">
+      <UniqueIdentifier>{e0bdc5fc-afd1-46f9-9e3e-f85ca3e220b8}</UniqueIdentifier>
+    </Filter>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <ClInclude Include="Include\BsRenderStats.h">
     <ClInclude Include="Include\BsRenderStats.h">
@@ -630,94 +630,94 @@
       <Filter>Source Files\Resources</Filter>
       <Filter>Source Files\Resources</Filter>
     </ClCompile>
     </ClCompile>
     <ClCompile Include="Source\BsBlendState.cpp">
     <ClCompile Include="Source\BsBlendState.cpp">
-      <Filter>Source Files\RenderSystem</Filter>
+      <Filter>Source Files\RenderAPI</Filter>
     </ClCompile>
     </ClCompile>
     <ClCompile Include="Source\BsDepthStencilState.cpp">
     <ClCompile Include="Source\BsDepthStencilState.cpp">
-      <Filter>Source Files\RenderSystem</Filter>
+      <Filter>Source Files\RenderAPI</Filter>
     </ClCompile>
     </ClCompile>
     <ClCompile Include="Source\BsEventQuery.cpp">
     <ClCompile Include="Source\BsEventQuery.cpp">
-      <Filter>Source Files\RenderSystem</Filter>
+      <Filter>Source Files\RenderAPI</Filter>
     </ClCompile>
     </ClCompile>
     <ClCompile Include="Source\BsGpuBuffer.cpp">
     <ClCompile Include="Source\BsGpuBuffer.cpp">
-      <Filter>Source Files\RenderSystem</Filter>
+      <Filter>Source Files\RenderAPI</Filter>
     </ClCompile>
     </ClCompile>
     <ClCompile Include="Source\BsGpuBufferView.cpp">
     <ClCompile Include="Source\BsGpuBufferView.cpp">
-      <Filter>Source Files\RenderSystem</Filter>
+      <Filter>Source Files\RenderAPI</Filter>
     </ClCompile>
     </ClCompile>
     <ClCompile Include="Source\BsGpuParam.cpp">
     <ClCompile Include="Source\BsGpuParam.cpp">
-      <Filter>Source Files\RenderSystem</Filter>
+      <Filter>Source Files\RenderAPI</Filter>
     </ClCompile>
     </ClCompile>
     <ClCompile Include="Source\BsGpuParamBlockBuffer.cpp">
     <ClCompile Include="Source\BsGpuParamBlockBuffer.cpp">
-      <Filter>Source Files\RenderSystem</Filter>
+      <Filter>Source Files\RenderAPI</Filter>
     </ClCompile>
     </ClCompile>
     <ClCompile Include="Source\BsGpuParams.cpp">
     <ClCompile Include="Source\BsGpuParams.cpp">
-      <Filter>Source Files\RenderSystem</Filter>
+      <Filter>Source Files\RenderAPI</Filter>
     </ClCompile>
     </ClCompile>
     <ClCompile Include="Source\BsGpuProgram.cpp">
     <ClCompile Include="Source\BsGpuProgram.cpp">
-      <Filter>Source Files\RenderSystem</Filter>
+      <Filter>Source Files\RenderAPI</Filter>
     </ClCompile>
     </ClCompile>
     <ClCompile Include="Source\BsGpuProgramManager.cpp">
     <ClCompile Include="Source\BsGpuProgramManager.cpp">
-      <Filter>Source Files\RenderSystem</Filter>
+      <Filter>Source Files\RenderAPI</Filter>
     </ClCompile>
     </ClCompile>
     <ClCompile Include="Source\BsHardwareBufferManager.cpp">
     <ClCompile Include="Source\BsHardwareBufferManager.cpp">
-      <Filter>Source Files\RenderSystem</Filter>
+      <Filter>Source Files\RenderAPI</Filter>
     </ClCompile>
     </ClCompile>
     <ClCompile Include="Source\BsIndexBuffer.cpp">
     <ClCompile Include="Source\BsIndexBuffer.cpp">
-      <Filter>Source Files\RenderSystem</Filter>
+      <Filter>Source Files\RenderAPI</Filter>
     </ClCompile>
     </ClCompile>
     <ClCompile Include="Source\BsMeshManager.cpp">
     <ClCompile Include="Source\BsMeshManager.cpp">
-      <Filter>Source Files\RenderSystem</Filter>
+      <Filter>Source Files\RenderAPI</Filter>
     </ClCompile>
     </ClCompile>
     <ClCompile Include="Source\BsMultiRenderTexture.cpp">
     <ClCompile Include="Source\BsMultiRenderTexture.cpp">
-      <Filter>Source Files\RenderSystem</Filter>
+      <Filter>Source Files\RenderAPI</Filter>
     </ClCompile>
     </ClCompile>
     <ClCompile Include="Source\BsOcclusionQuery.cpp">
     <ClCompile Include="Source\BsOcclusionQuery.cpp">
-      <Filter>Source Files\RenderSystem</Filter>
+      <Filter>Source Files\RenderAPI</Filter>
     </ClCompile>
     </ClCompile>
     <ClCompile Include="Source\BsPixelBuffer.cpp">
     <ClCompile Include="Source\BsPixelBuffer.cpp">
-      <Filter>Source Files\RenderSystem</Filter>
+      <Filter>Source Files\RenderAPI</Filter>
     </ClCompile>
     </ClCompile>
     <ClCompile Include="Source\BsQueryManager.cpp">
     <ClCompile Include="Source\BsQueryManager.cpp">
-      <Filter>Source Files\RenderSystem</Filter>
+      <Filter>Source Files\RenderAPI</Filter>
     </ClCompile>
     </ClCompile>
     <ClCompile Include="Source\BsRasterizerState.cpp">
     <ClCompile Include="Source\BsRasterizerState.cpp">
-      <Filter>Source Files\RenderSystem</Filter>
+      <Filter>Source Files\RenderAPI</Filter>
     </ClCompile>
     </ClCompile>
     <ClCompile Include="Source\BsRenderStateManager.cpp">
     <ClCompile Include="Source\BsRenderStateManager.cpp">
-      <Filter>Source Files\RenderSystem</Filter>
+      <Filter>Source Files\RenderAPI</Filter>
     </ClCompile>
     </ClCompile>
     <ClCompile Include="Source\BsRenderTarget.cpp">
     <ClCompile Include="Source\BsRenderTarget.cpp">
-      <Filter>Source Files\RenderSystem</Filter>
+      <Filter>Source Files\RenderAPI</Filter>
     </ClCompile>
     </ClCompile>
     <ClCompile Include="Source\BsRenderTexture.cpp">
     <ClCompile Include="Source\BsRenderTexture.cpp">
-      <Filter>Source Files\RenderSystem</Filter>
+      <Filter>Source Files\RenderAPI</Filter>
     </ClCompile>
     </ClCompile>
     <ClCompile Include="Source\BsRenderWindow.cpp">
     <ClCompile Include="Source\BsRenderWindow.cpp">
-      <Filter>Source Files\RenderSystem</Filter>
+      <Filter>Source Files\RenderAPI</Filter>
     </ClCompile>
     </ClCompile>
     <ClCompile Include="Source\BsRenderWindowManager.cpp">
     <ClCompile Include="Source\BsRenderWindowManager.cpp">
-      <Filter>Source Files\RenderSystem</Filter>
+      <Filter>Source Files\RenderAPI</Filter>
     </ClCompile>
     </ClCompile>
     <ClCompile Include="Source\BsSamplerState.cpp">
     <ClCompile Include="Source\BsSamplerState.cpp">
-      <Filter>Source Files\RenderSystem</Filter>
+      <Filter>Source Files\RenderAPI</Filter>
     </ClCompile>
     </ClCompile>
     <ClCompile Include="Source\BsTextureView.cpp">
     <ClCompile Include="Source\BsTextureView.cpp">
-      <Filter>Source Files\RenderSystem</Filter>
+      <Filter>Source Files\RenderAPI</Filter>
     </ClCompile>
     </ClCompile>
     <ClCompile Include="Source\BsTimerQuery.cpp">
     <ClCompile Include="Source\BsTimerQuery.cpp">
-      <Filter>Source Files\RenderSystem</Filter>
+      <Filter>Source Files\RenderAPI</Filter>
     </ClCompile>
     </ClCompile>
     <ClCompile Include="Source\BsVertexBuffer.cpp">
     <ClCompile Include="Source\BsVertexBuffer.cpp">
-      <Filter>Source Files\RenderSystem</Filter>
+      <Filter>Source Files\RenderAPI</Filter>
     </ClCompile>
     </ClCompile>
     <ClCompile Include="Source\BsVertexData.cpp">
     <ClCompile Include="Source\BsVertexData.cpp">
-      <Filter>Source Files\RenderSystem</Filter>
+      <Filter>Source Files\RenderAPI</Filter>
     </ClCompile>
     </ClCompile>
     <ClCompile Include="Source\BsVertexDeclaration.cpp">
     <ClCompile Include="Source\BsVertexDeclaration.cpp">
-      <Filter>Source Files\RenderSystem</Filter>
+      <Filter>Source Files\RenderAPI</Filter>
     </ClCompile>
     </ClCompile>
     <ClCompile Include="Source\BsVideoModeInfo.cpp">
     <ClCompile Include="Source\BsVideoModeInfo.cpp">
-      <Filter>Source Files\RenderSystem</Filter>
+      <Filter>Source Files\RenderAPI</Filter>
     </ClCompile>
     </ClCompile>
     <ClCompile Include="Source\BsRendererManager.cpp">
     <ClCompile Include="Source\BsRendererManager.cpp">
       <Filter>Source Files\Renderer</Filter>
       <Filter>Source Files\Renderer</Filter>
@@ -810,13 +810,13 @@
       <Filter>Source Files\Renderer</Filter>
       <Filter>Source Files\Renderer</Filter>
     </ClCompile>
     </ClCompile>
     <ClCompile Include="Source\BsRenderAPI.cpp">
     <ClCompile Include="Source\BsRenderAPI.cpp">
-      <Filter>Source Files\RenderSystem</Filter>
+      <Filter>Source Files\RenderAPI</Filter>
     </ClCompile>
     </ClCompile>
     <ClCompile Include="Source\BsRenderAPIManager.cpp">
     <ClCompile Include="Source\BsRenderAPIManager.cpp">
-      <Filter>Source Files\RenderSystem</Filter>
+      <Filter>Source Files\RenderAPI</Filter>
     </ClCompile>
     </ClCompile>
     <ClCompile Include="Source\BsRenderAPICapabilities.cpp">
     <ClCompile Include="Source\BsRenderAPICapabilities.cpp">
-      <Filter>Source Files\RenderSystem</Filter>
+      <Filter>Source Files\RenderAPI</Filter>
     </ClCompile>
     </ClCompile>
     <ClCompile Include="Source\BsIResourceListener.cpp">
     <ClCompile Include="Source\BsIResourceListener.cpp">
       <Filter>Source Files</Filter>
       <Filter>Source Files</Filter>

+ 1 - 0
BansheeCore/Include/BsRenderTarget.h

@@ -180,6 +180,7 @@ namespace BansheeEngine
     class BS_CORE_EXPORT RenderTarget : public CoreObject
     class BS_CORE_EXPORT RenderTarget : public CoreObject
     {
     {
     public:
     public:
+		RenderTarget();
 		virtual ~RenderTarget() { }
 		virtual ~RenderTarget() { }
 
 
 		/**
 		/**

+ 5 - 5
BansheeCore/Include/BsRenderWindow.h

@@ -161,17 +161,17 @@ namespace BansheeEngine
 		 */
 		 */
 		const RenderWindowProperties& getProperties() const;
 		const RenderWindowProperties& getProperties() const;
 
 
-	protected:
-		friend class RenderWindow;
-		friend class RenderWindowManager;
-
 		/**
 		/**
 		 * @brief	Called when window is moved or resized.
 		 * @brief	Called when window is moved or resized.
 		 *
 		 *
-		 * @note	Core thread.
+		 * @note	Core thread. Internal method.
 		 */
 		 */
 		virtual void _windowMovedOrResized();
 		virtual void _windowMovedOrResized();
 
 
+	protected:
+		friend class RenderWindow;
+		friend class RenderWindowManager;
+
 		/**
 		/**
 		 * @brief	Called when window has received focus.
 		 * @brief	Called when window has received focus.
 		 *
 		 *

+ 4 - 4
BansheeCore/Include/BsRenderWindowManager.h

@@ -68,14 +68,14 @@ namespace BansheeEngine
 		void windowFocusLost(RenderWindowCore* window);
 		void windowFocusLost(RenderWindowCore* window);
 
 
 		/**
 		/**
-		 * @brief	Called by the core thread when window is moved or resized.
+		 * @brief	Called by the core thread when mouse leaves a window.
 		 */
 		 */
-		void windowMovedOrResized(RenderWindowCore* window);
+		void windowMouseLeft(RenderWindowCore* window);
 
 
 		/**
 		/**
-		 * @brief	Called by the core thread when mouse leaves a window.
+		 * @brief	Called by the sim thread when window is moved or resized.
 		 */
 		 */
-		void windowMouseLeft(RenderWindowCore* window);
+		void windowMovedOrResized(RenderWindow* window);
 
 
 		/**
 		/**
 		 * @brief	Finds a sim thread equivalent of the provided core thread window implementation.
 		 * @brief	Finds a sim thread equivalent of the provided core thread window implementation.

+ 6 - 0
BansheeCore/Source/BsRenderTarget.cpp

@@ -38,6 +38,12 @@ namespace BansheeEngine
 		BS_EXCEPT(InvalidParametersException, "Attribute not found.");
 		BS_EXCEPT(InvalidParametersException, "Attribute not found.");
 	}
 	}
 
 
+	RenderTarget::RenderTarget()
+	{
+		// We never sync from sim to core, so mark it clean to avoid overwriting core thread changes
+		markCoreClean();
+	}
+
 	void RenderTarget::setPriority(CoreAccessor& accessor, INT32 priority)
 	void RenderTarget::setPriority(CoreAccessor& accessor, INT32 priority)
 	{
 	{
 		std::function<void(SPtr<RenderTargetCore>, INT32)> windowedFunc =
 		std::function<void(SPtr<RenderTargetCore>, INT32)> windowedFunc =

+ 9 - 1
BansheeCore/Source/BsRenderWindow.cpp

@@ -210,7 +210,15 @@ namespace BansheeEngine
 	void RenderWindow::syncFromCore(const CoreSyncData& data)
 	void RenderWindow::syncFromCore(const CoreSyncData& data)
 	{
 	{
 		RenderWindowProperties& props = const_cast<RenderWindowProperties&>(getProperties());
 		RenderWindowProperties& props = const_cast<RenderWindowProperties&>(getProperties());
-		props = data.getData<RenderWindowProperties>();
+
+		const RenderWindowProperties& newProps = data.getData<RenderWindowProperties>();
+
+		bool movedOrResized = props.getHeight() != newProps.getHeight() || props.getWidth() != newProps.getWidth() || props.getLeft() != newProps.getLeft()
+			|| props.getTop() != newProps.getTop() || props.isFullScreen() != newProps.isFullScreen();
+
+		props = newProps;
+		if (movedOrResized)
+			RenderWindowManager::instance().windowMovedOrResized(this);
 	}
 	}
 
 
 	const RenderWindowProperties& RenderWindow::getProperties() const
 	const RenderWindowProperties& RenderWindow::getProperties() const

+ 1 - 5
BansheeCore/Source/BsRenderWindowManager.cpp

@@ -10,7 +10,6 @@ namespace BansheeEngine
 	{
 	{
 		Platform::onWindowFocusReceived.connect(std::bind(&RenderWindowManager::windowFocusReceived, this, _1));
 		Platform::onWindowFocusReceived.connect(std::bind(&RenderWindowManager::windowFocusReceived, this, _1));
 		Platform::onWindowFocusLost.connect(std::bind(&RenderWindowManager::windowFocusLost, this, _1));
 		Platform::onWindowFocusLost.connect(std::bind(&RenderWindowManager::windowFocusLost, this, _1));
-		Platform::onWindowMovedOrResized.connect(std::bind(&RenderWindowManager::windowMovedOrResized, this, _1));
 		Platform::onMouseLeftWindow.connect(std::bind(&RenderWindowManager::windowMouseLeft, this, _1));
 		Platform::onMouseLeftWindow.connect(std::bind(&RenderWindowManager::windowMouseLeft, this, _1));
 	}
 	}
 
 
@@ -68,9 +67,8 @@ namespace BansheeEngine
 		mNewWindowInFocus = nullptr;
 		mNewWindowInFocus = nullptr;
 	}
 	}
 
 
-	void RenderWindowManager::windowMovedOrResized(RenderWindowCore* coreWindow)
+	void RenderWindowManager::windowMovedOrResized(RenderWindow* window)
 	{
 	{
-		RenderWindow* window = getNonCore(coreWindow);
 		bool isValidWindow = false;
 		bool isValidWindow = false;
 		{
 		{
 			BS_LOCK_MUTEX(mWindowMutex);
 			BS_LOCK_MUTEX(mWindowMutex);
@@ -81,8 +79,6 @@ namespace BansheeEngine
 		if(!isValidWindow)
 		if(!isValidWindow)
 			return;
 			return;
 
 
-		coreWindow->_windowMovedOrResized();
-
 		BS_LOCK_MUTEX(mWindowMutex);
 		BS_LOCK_MUTEX(mWindowMutex);
 
 
 		auto iterFind = std::find(begin(mMovedOrResizedWindows), end(mMovedOrResizedWindows), window);
 		auto iterFind = std::find(begin(mMovedOrResizedWindows), end(mMovedOrResizedWindows), window);

+ 3 - 0
BansheeCore/Source/Win32/BsPlatformWndProc.cpp

@@ -135,12 +135,15 @@ namespace BansheeEngine
 				return 0;
 				return 0;
 			break;
 			break;
 		case WM_MOVE:
 		case WM_MOVE:
+			win->_windowMovedOrResized();
 			windowMovedOrResized(win);
 			windowMovedOrResized(win);
 			break;
 			break;
 		case WM_DISPLAYCHANGE:
 		case WM_DISPLAYCHANGE:
+			win->_windowMovedOrResized();
 			windowMovedOrResized(win);
 			windowMovedOrResized(win);
 			break;
 			break;
 		case WM_SIZE:
 		case WM_SIZE:
+			win->_windowMovedOrResized();
 			windowMovedOrResized(win);
 			windowMovedOrResized(win);
 			break;
 			break;
 		case WM_SETCURSOR:
 		case WM_SETCURSOR:

+ 1 - 3
BansheeD3D11RenderSystem/Source/BsD3D11RenderWindow.cpp

@@ -294,8 +294,7 @@ namespace BansheeEngine
 			props.mTop = top;
 			props.mTop = top;
 			props.mLeft = left;
 			props.mLeft = left;
 
 
-			SetWindowPos(mHWnd, 0, top, left, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
-			markCoreDirty();			
+			SetWindowPos(mHWnd, 0, top, left, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);		
 		}
 		}
 	}
 	}
 
 
@@ -316,7 +315,6 @@ namespace BansheeEngine
 			height = rc.bottom - rc.top;
 			height = rc.bottom - rc.top;
 
 
 			SetWindowPos(mHWnd, 0, 0, 0, width, height, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
 			SetWindowPos(mHWnd, 0, 0, 0, width, height, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
-			markCoreDirty();
 		}
 		}
 	}
 	}
 
 

+ 0 - 3
BansheeD3D9RenderSystem/Source/BsD3D9RenderWindow.cpp

@@ -359,7 +359,6 @@ namespace BansheeEngine
 			props.mTop = top;
 			props.mTop = top;
 
 
 			SetWindowPos(mHWnd, 0, top, left, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
 			SetWindowPos(mHWnd, 0, top, left, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
-			markCoreDirty();
 		}
 		}
 	}
 	}
 
 
@@ -379,8 +378,6 @@ namespace BansheeEngine
 
 
 			SetWindowPos(mHWnd, 0, 0, 0, winWidth, winHeight,
 			SetWindowPos(mHWnd, 0, 0, 0, winWidth, winHeight,
 				SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
 				SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
-
-			markCoreDirty();
 		}
 		}
 	}
 	}
 
 

+ 0 - 4
BansheeGLRenderSystem/Source/BsWin32Window.cpp

@@ -467,8 +467,6 @@ namespace BansheeEngine
 
 
 			SetWindowPos(mHWnd, 0, left, top, 0, 0,
 			SetWindowPos(mHWnd, 0, left, top, 0, 0,
 				SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
 				SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
-
-			markCoreDirty();
 		}
 		}
 	}
 	}
 
 
@@ -488,8 +486,6 @@ namespace BansheeEngine
 			height = rc.bottom - rc.top;
 			height = rc.bottom - rc.top;
 			SetWindowPos(mHWnd, 0, 0, 0, width, height,
 			SetWindowPos(mHWnd, 0, 0, 0, width, height,
 				SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
 				SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
-
-			markCoreDirty();
 		}
 		}
 	}
 	}
 
 

+ 1 - 1
MBansheeEditor/EditorApplication.cs

@@ -69,7 +69,7 @@ namespace BansheeEditor
             // Register controls
             // Register controls
             InputConfiguration inputConfig = VirtualInput.KeyConfig;
             InputConfiguration inputConfig = VirtualInput.KeyConfig;
 
 
-		    inputConfig.RegisterButton(SceneCamera.MoveForwardBinding, ButtonCode.W);
+            inputConfig.RegisterButton(SceneCamera.MoveForwardBinding, ButtonCode.W);
             inputConfig.RegisterButton(SceneCamera.MoveBackBinding, ButtonCode.S);
             inputConfig.RegisterButton(SceneCamera.MoveBackBinding, ButtonCode.S);
             inputConfig.RegisterButton(SceneCamera.MoveLeftBinding, ButtonCode.A);
             inputConfig.RegisterButton(SceneCamera.MoveLeftBinding, ButtonCode.A);
             inputConfig.RegisterButton(SceneCamera.MoveRightBinding, ButtonCode.D);
             inputConfig.RegisterButton(SceneCamera.MoveRightBinding, ButtonCode.D);

+ 15 - 15
MBansheeEditor/Scene/SceneWindow.cs

@@ -61,7 +61,7 @@ namespace BansheeEditor
                 {
                 {
                     bool ctrlHeld = Input.IsButtonHeld(ButtonCode.LeftControl) || Input.IsButtonHeld(ButtonCode.RightControl);
                     bool ctrlHeld = Input.IsButtonHeld(ButtonCode.LeftControl) || Input.IsButtonHeld(ButtonCode.RightControl);
 
 
-                    if(sceneViewHandler.IsHandleActive())
+                    if (sceneViewHandler.IsHandleActive())
                         sceneViewHandler.ClearHandleSelection();
                         sceneViewHandler.ClearHandleSelection();
                     else
                     else
                         sceneViewHandler.PickObject(Input.PointerPosition, ctrlHeld);
                         sceneViewHandler.PickObject(Input.PointerPosition, ctrlHeld);
@@ -105,32 +105,32 @@ namespace BansheeEditor
 
 
         private void UpdateRenderTexture(int width, int height)
         private void UpdateRenderTexture(int width, int height)
 	    {
 	    {
-		    width = Math.Max(20, width);
-		    height = Math.Max(20, height);
+            width = Math.Max(20, width);
+            height = Math.Max(20, height);
 
 
             renderTexture = new RenderTexture2D(PixelFormat.R8G8B8A8, width, height);
             renderTexture = new RenderTexture2D(PixelFormat.R8G8B8A8, width, height);
             renderTexture.Priority = 1;
             renderTexture.Priority = 1;
 
 
 		    if (camera == null)
 		    if (camera == null)
 		    {
 		    {
-			    SceneObject sceneCameraSO = new SceneObject("SceneCamera");
-			    camera = sceneCameraSO.AddComponent<Camera>();
-		        camera.target = renderTexture;
-		        camera.viewportRect = new Rect2(0.0f, 0.0f, 1.0f, 1.0f);
+                SceneObject sceneCameraSO = new SceneObject("SceneCamera");
+                camera = sceneCameraSO.AddComponent<Camera>();
+                camera.target = renderTexture;
+                camera.viewportRect = new Rect2(0.0f, 0.0f, 1.0f, 1.0f);
 
 
-			    sceneCameraSO.position = new Vector3(0, 0.5f, 1);
-			    sceneCameraSO.LookAt(new Vector3(0, 0, 0));
+                sceneCameraSO.position = new Vector3(0, 0.5f, 1);
+                sceneCameraSO.LookAt(new Vector3(0, 0, 0));
 
 
-		        camera.priority = 1;
-		        camera.nearClipPlane = 0.005f;
-		        camera.farClipPlane = 1000.0f;
+                camera.priority = 1;
+                camera.nearClipPlane = 0.005f;
+                camera.farClipPlane = 1000.0f;
 
 
-			    cameraController = sceneCameraSO.AddComponent<SceneCamera>();
+                cameraController = sceneCameraSO.AddComponent<SceneCamera>();
 
 
                 renderTextureGUI = new GUIRenderTexture(renderTexture);
                 renderTextureGUI = new GUIRenderTexture(renderTexture);
-		        GUI.layout.AddElement(renderTextureGUI);
+                GUI.layout.AddElement(renderTextureGUI);
 
 
-		        sceneViewHandler = new SceneViewHandler(this, camera);
+                sceneViewHandler = new SceneViewHandler(this, camera);
 		    }
 		    }
 		    else
 		    else
 		    {
 		    {

+ 5 - 1
MBansheeEngine/Math/MathEx.cs

@@ -118,11 +118,15 @@ namespace BansheeEngine
 
 
         public static float Abs(float f)
         public static float Abs(float f)
         {
         {
+            // TODO - Try newer mono version
+            throw new NotImplementedException("Mono seems to have a problem calling Math.Abs()? Call it directly if you need it.");
             return Math.Abs(f);
             return Math.Abs(f);
         }
         }
 
 
         public static int Abs(int value)
         public static int Abs(int value)
         {
         {
+            // TODO - Try newer mono version
+            throw new NotImplementedException("Mono seems to have a problem calling Math.Abs()? Call it directly if you need it.");
             return Math.Abs(value);
             return Math.Abs(value);
         }
         }
 
 
@@ -266,7 +270,7 @@ namespace BansheeEngine
         {
         {
             const float inv360 = 1.0f/360.0f;
             const float inv360 = 1.0f/360.0f;
             float angleVal = angle.GetDegrees();
             float angleVal = angle.GetDegrees();
-            float wrapCount = MathEx.Floor(MathEx.Abs(angleVal*inv360));
+            float wrapCount = (float)MathEx.Floor(Math.Abs(angleVal * inv360));
 
 
             if (angleVal > 0.0f)
             if (angleVal > 0.0f)
                 angleVal -= 360.0f * wrapCount;
                 angleVal -= 360.0f * wrapCount;

+ 1 - 2
TODO.txt

@@ -12,12 +12,11 @@
 
 
 See GDrive/Resources doc for resources refactor
 See GDrive/Resources doc for resources refactor
 
 
-Fix the weird Mono crash that seems to happen in SceneCamera but gets fixed by commenting out various bits of code. However it can be consistently reproduced.
 Scene view initial viewport size isn't valid size
 Scene view initial viewport size isn't valid size
+ - Window resize message arrives before sync happens
 Screen grid isn't rendered
 Screen grid isn't rendered
 Handles aren't properly rendered
 Handles aren't properly rendered
 Icon gizmo seems to sometimes get struck to the side of the camera
 Icon gizmo seems to sometimes get struck to the side of the camera
-Clicking the screen causes a white flash
 
 
 Other:
 Other:
 Window resize end callback
 Window resize end callback