Bläddra i källkod

Some more work on bounds and started work on EditorWindow

Marko Pintera 12 år sedan
förälder
incheckning
bf1dbf542a

+ 2 - 0
CamelotClient/CamelotClient.vcxproj

@@ -167,6 +167,7 @@
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="CmDebugCamera.h" />
+    <ClInclude Include="CmEditorWindow.h" />
     <ClInclude Include="CmTestTextSprite.h" />
     <ClInclude Include="stdafx.h" />
     <ClInclude Include="targetver.h" />
@@ -174,6 +175,7 @@
   <ItemGroup>
     <ClCompile Include="CamelotClient.cpp" />
     <ClCompile Include="CmDebugCamera.cpp" />
+    <ClCompile Include="CmEditorWindow.cpp" />
     <ClCompile Include="CmTestTextSprite.cpp" />
     <ClCompile Include="stdafx.cpp" />
   </ItemGroup>

+ 6 - 0
CamelotClient/CamelotClient.vcxproj.filters

@@ -30,6 +30,9 @@
     <ClInclude Include="CmTestTextSprite.h">
       <Filter>Header Files</Filter>
     </ClInclude>
+    <ClInclude Include="CmEditorWindow.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="stdafx.cpp">
@@ -44,5 +47,8 @@
     <ClCompile Include="CmTestTextSprite.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="CmEditorWindow.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
 </Project>

+ 1 - 1
CamelotClient/CmDebugCamera.cpp

@@ -93,7 +93,7 @@ namespace CamelotEngine
 
 		if (direction.squaredLength() != 0)
 		{
-			direction.normalise();
+			direction.normalize();
 
 			float multiplier = 1.0f;
 			if(mFastMove)

+ 21 - 0
CamelotClient/CmEditorWindow.cpp

@@ -0,0 +1,21 @@
+#include "CmEditorWindow.h"
+#include "CmRenderWindow.h"
+
+namespace CamelotEditor
+{
+	EditorWindow::EditorWindow(const String& name)
+	{
+		RENDER_WINDOW_DESC renderWindowDesc;
+		renderWindowDesc.width = 1280;
+		renderWindowDesc.height = 720;
+		renderWindowDesc.title = "EditorWindow";
+		renderWindowDesc.fullscreen = false;
+
+		mRenderWindow = RenderWindow::create(renderWindowDesc);
+	}
+
+	EditorWindow::~EditorWindow()
+	{
+		mRenderWindow->destroy();
+	}
+}

+ 18 - 0
CamelotClient/CmEditorWindow.h

@@ -0,0 +1,18 @@
+#pragma once
+
+#include "CmPrerequisites.h"
+
+using namespace CamelotEngine;
+
+namespace CamelotEditor
+{
+	class EditorWindow
+	{
+	public:
+		EditorWindow(const String& name);
+		virtual ~EditorWindow();
+
+	private:
+		RenderWindowPtr mRenderWindow;
+	};
+}

+ 1 - 0
CamelotCore/CamelotCore.vcxproj

@@ -179,6 +179,7 @@
     <ClInclude Include="Include\CmGameObjectHandle.h" />
     <ClInclude Include="Include\CmGameObject.h" />
     <ClInclude Include="Include\CmGameObjectRTTI.h" />
+    <ClInclude Include="Include\CmGUIMouseEvent.h" />
     <ClInclude Include="Include\CmSceneObjectRTTI.h" />
     <ClInclude Include="Include\CmMemAllocCategories.h" />
     <ClInclude Include="Include\CmOverlay.h" />

+ 3 - 0
CamelotCore/CamelotCore.vcxproj.filters

@@ -480,6 +480,9 @@
     <ClInclude Include="Include\CmGameObjectRTTI.h">
       <Filter>Header Files\RTTI</Filter>
     </ClInclude>
+    <ClInclude Include="Include\CmGUIMouseEvent.h">
+      <Filter>Header Files\GUI</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="Source\CamelotRenderer.cpp">

+ 4 - 0
CamelotCore/Include/CmGUIElement.h

@@ -62,6 +62,9 @@ namespace CamelotEngine
 
 		const Rect& getBounds() const { return mBounds; }
 
+		void setDepth(INT32 depth) { mDepth = depth; }
+		INT32 getDepth() const { return mDepth; }
+
 		//  onMouseMove
 		//	onMousePress
 		//	onMouseReleased
@@ -70,6 +73,7 @@ namespace CamelotEngine
 	protected:
 		GUIWidget* mParent;
 		Rect mBounds;
+		INT32 mDepth;
 		const GUIElementStyle* mStyle;
 	};
 }

+ 18 - 0
CamelotCore/Include/CmGUIMouseEvent.h

@@ -0,0 +1,18 @@
+#pragma once
+
+#include "CmPrerequisites.h"
+#include "CmVector2.h"
+
+namespace CamelotEngine
+{
+	class CM_EXPORT GUIMouseEvent
+	{
+	public:
+		GUIMouseEvent(const Vector2& position)
+			:mPosition(position)
+		{ }
+
+	private:
+		Vector2 mPosition;
+	};
+}

+ 13 - 5
CamelotCore/Include/CmGUIWidget.h

@@ -3,6 +3,7 @@
 #include "CmPrerequisites.h"
 #include "CmOverlay.h"
 #include "CmTextSprite.h"
+#include "CmORect.h"
 
 namespace CamelotEngine
 {
@@ -11,24 +12,31 @@ namespace CamelotEngine
 	public:
 		virtual ~GUIWidget();
 
+		GUILabel* addLabel(const String& text, UINT32 fixedWidth = 0, UINT32 fixedHeight = 0, bool wordWrap = false, TextHorzAlign horzAlign = THA_Left, TextVertAlign vertAlign = TVA_Top);
+		GUILabel* addLabel(const String& text, TextHorzAlign horzAlign = THA_Left, TextVertAlign vertAlign = TVA_Top);
+
+		void setSkin(const GUISkin* skin);
+		const GUISkin* getGUISkin() const;
+
 		virtual void render(const Camera* camera, DeferredRenderContextPtr& renderContext) const;
 	protected:
 		friend class SceneObject;
 
 		GUIWidget(const HSceneObject& parent);
 
-		GUILabel* addLabel(const String& text, UINT32 fixedWidth = 0, UINT32 fixedHeight = 0, bool wordWrap = false, TextHorzAlign horzAlign = THA_Left, TextVertAlign vertAlign = TVA_Top);
-		GUILabel* addLabel(const String& text, TextHorzAlign horzAlign = THA_Left, TextVertAlign vertAlign = TVA_Top);
-
-		void setSkin(const GUISkin* skin);
-		const GUISkin* getGUISkin() const;
+		void mouseEvent(const GUIMouseEvent& ev);
 	private:
 
 		void updateMeshes() const;
+		void updateBounds() const;
 
 		vector<GUIElement*>::type mElements;
+		
+		mutable Rect mBounds;
+		mutable vector<std::pair<ORect, GUIElement*>>::type mCachedBounds;
 		mutable vector<HMesh>::type mCachedMeshes;
 		mutable vector<HMaterial>::type mCachedMaterials;
+
 		const GUISkin* mSkin;
 		static GUISkin DefaultSkin;
 	};

+ 1 - 0
CamelotCore/Include/CmPrerequisites.h

@@ -175,6 +175,7 @@ namespace CamelotEngine {
 	class GUILabel;
 	struct GUIElementStyle;
 	class GUISkin;
+	struct GUIMouseEvent;
 	// RTTI
 	class MeshRTTI;
 	// Desc structs

+ 1 - 1
CamelotCore/Source/CmApplication.cpp

@@ -70,7 +70,7 @@ namespace CamelotEngine
 		renderWindowDesc.fullscreen = false;
 
 		mPrimaryRenderWindow = RenderWindow::create(renderWindowDesc);
-		mPrimaryRenderWindow->waitUntilInitialized(); // TODO: Created window is required for proper initialization of the render system so I need to wait
+		mPrimaryRenderWindow->waitUntilInitialized(); // TODO: Created window is required for proper initialization of the render system so I need to wait.
 		                                              // I plan on handling this differently. Either by somehow allowing the RS to be initialized without a window,
 		                                              // or forcing a window to be created with RenderSystemManager::startUp. Initializing OpenGL context without a window
 		                                              // is especially troublesome (apparently possible just poorly documented)

+ 1 - 1
CamelotCore/Source/CmCamera.cpp

@@ -593,7 +593,7 @@ namespace CamelotEngine {
 		// Renormalise any normals which were not unit length
 		for(int i=0; i<6; i++ ) 
 		{
-			float length = mFrustumPlanes[i].normal.normalise();
+			float length = mFrustumPlanes[i].normal.normalize();
 			mFrustumPlanes[i].d /= length;
 		}
 

+ 33 - 3
CamelotCore/Source/CmGUIWidget.cpp

@@ -58,6 +58,11 @@ namespace CamelotEngine
 			return &DefaultSkin;
 	}
 
+	void GUIWidget::mouseEvent(const GUIMouseEvent& ev)
+	{
+
+	}
+
 	void GUIWidget::updateMeshes() const
 	{
 		struct TempMeshData
@@ -109,8 +114,18 @@ namespace CamelotEngine
 			numMeshes++;
 		}
 
+		// TODO - Sorting from scratch every time is not optimal.
+		//  If more performance is needed, try re-sorting only modified elements
+		//  Sort so that farthest away elements get drawn first (needed due to transparency)
+		std::vector<GUIElement*> sortedElements = mElements;
+		std::sort(sortedElements.begin(), sortedElements.end(), 
+			[](GUIElement* a, GUIElement* b)
+		{
+			return a->getDepth() > b->getDepth();
+		});
+
 		// Fill buffers for each group
-		for(auto& elem : mElements)
+		for(auto& elem : sortedElements)
 		{
 			UINT32 numRenderElems = elem->getNumRenderElements();
 
@@ -156,12 +171,27 @@ namespace CamelotEngine
 
 			meshIdx++;
 		}
+
+		updateBounds();
 	}
 
-	void GUIWidget::render(const Camera* camera, DeferredRenderContextPtr& renderContext) const
+	void GUIWidget::updateBounds() const
 	{
-		SO()->setPosition(Vector3(200, 100, 0));
+		mCachedBounds.clear();
 
+		const Matrix4& worldTfrm = SO()->getWorldTfrm();
+
+		for(auto& elem : mElements)
+		{
+			ORect elemBounds(elem->getBounds());
+			elemBounds.applyTransform(worldTfrm);
+
+			mCachedBounds.push_back(std::make_pair(elemBounds, elem));
+		}
+	}
+
+	void GUIWidget::render(const Camera* camera, DeferredRenderContextPtr& renderContext) const
+	{
 		// Mesh is re-created every frame. There might be a better approach that only recreates it upon change,
 		// but for now it seems like too much hassle for something like GUI that is pretty dynamic anyway.
 		updateMeshes();

+ 3 - 3
CamelotCore/Source/CmSceneObject.cpp

@@ -121,7 +121,7 @@ namespace CamelotEngine
 	void SceneObject::lookAt(const Vector3& location, const Vector3& up)
 	{
 		Vector3 forward = location - mPosition;
-		forward.normalise();
+		forward.normalize();
 
 		// TODO - I'm ignoring "up" direction
 		setForward(forward);
@@ -172,7 +172,7 @@ namespace CamelotEngine
 
 		// Normalize the quat to avoid cumulative problems with precision
 		Quaternion qnorm = q;
-		qnorm.normalise();
+		qnorm.normalize();
 		setRotation(qnorm * mRotation);
 	}
 
@@ -201,7 +201,7 @@ namespace CamelotEngine
 		if (forwardDir == Vector3::ZERO) 
 			return;
 
-		Vector3 nrmForwardDir = forwardDir.normalisedCopy();
+		Vector3 nrmForwardDir = forwardDir.normalizedCopy();
 		Vector3 currentForwardDir = getForward();
 		
 		const Quaternion& currentRotation = getWorldRotation();

+ 2 - 0
CamelotUtility/CamelotUtility.vcxproj

@@ -163,6 +163,7 @@
     <ClCompile Include="Source\CmBitmapWriter.cpp" />
     <ClCompile Include="Source\CmInt2.cpp" />
     <ClCompile Include="Source\CmManagedDataBlock.cpp" />
+    <ClCompile Include="Source\CmORect.cpp" />
     <ClCompile Include="Source\CmPixelData.cpp" />
     <ClCompile Include="Source\CmTexAtlasGenerator.cpp" />
     <ClCompile Include="Source\CmUUID.cpp" />
@@ -187,6 +188,7 @@
     <ClInclude Include="Include\CmMathAsm.h" />
     <ClInclude Include="Include\CmMemoryAllocator.h" />
     <ClInclude Include="Include\CmModule.h" />
+    <ClInclude Include="Include\CmORect.h" />
     <ClInclude Include="Include\CmPath.h" />
     <ClInclude Include="Include\CmPixelData.h" />
     <ClInclude Include="Include\CmPixelDataRTTI.h" />

+ 6 - 0
CamelotUtility/CamelotUtility.vcxproj.filters

@@ -222,6 +222,9 @@
     <ClInclude Include="Include\CmMemoryAllocator.h">
       <Filter>Header Files</Filter>
     </ClInclude>
+    <ClInclude Include="Include\CmORect.h">
+      <Filter>Header Files\Math</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="Include\CmAxisAlignedBox.cpp">
@@ -323,5 +326,8 @@
     <ClCompile Include="Source\CmTexAtlasGenerator.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="Source\CmORect.cpp">
+      <Filter>Source Files\Math</Filter>
+    </ClCompile>
   </ItemGroup>
 </Project>

+ 1 - 1
CamelotUtility/Include/CmMatrix4.h

@@ -244,7 +244,7 @@ namespace CamelotEngine
 			ret.normal.x = v4.x; 
 			ret.normal.y = v4.y; 
 			ret.normal.z = v4.z;
-			ret.d = v4.w / ret.normal.normalise();
+			ret.d = v4.w / ret.normal.normalize();
 
             return ret;
         }

+ 32 - 0
CamelotUtility/Include/CmORect.h

@@ -0,0 +1,32 @@
+#pragma once
+
+#include "CmPrerequisitesUtil.h"
+#include "CmVector2.h"
+#include "CmRect.h"
+#include "CmMatrix4.h"
+
+namespace CamelotEngine
+{
+	/**
+	 * @brief	Oriented rectangle. Can be rotated/translated/scaled. Skewing and similar transformations
+	 * 			are not supported.
+	 * 			TODO - Can be made faster. Speed wasn't my concern when designing the class.
+	 */
+	class CM_UTILITY_EXPORT ORect
+	{
+	public:
+		ORect();
+		ORect(const Rect& rect);
+		
+		void applyTransform(const Matrix4& tfrm);
+		bool contains(const Vector2& point);
+
+		Vector2 getMin() const;
+		Vector2 getMax() const;
+
+	private:
+		Vector2 mOrigin;
+		Vector2 mSides[2];
+		float mSideLengths[2]; // Redundant but I want my side normals to be normalized
+	};
+}

+ 1 - 1
CamelotUtility/Include/CmPlane.h

@@ -139,7 +139,7 @@ namespace CamelotEngine {
                 will be no changes made to their components.
             @returns The previous length of the plane's normal.
         */
-        float normalise(void);
+        float normalize(void);
 
 		Vector3 normal;
         float d;

+ 1 - 1
CamelotUtility/Include/CmQuaternion.h

@@ -173,7 +173,7 @@ namespace CamelotEngine {
         float Dot (const Quaternion& rkQ) const;  // dot product
         float Norm () const;  // squared-length
         /// Normalises this quaternion, and returns the previous length
-        float normalise(void); 
+        float normalize(void); 
         Quaternion Inverse () const;  // apply to non-zero quaternion
         Quaternion UnitInverse () const;  // apply to unit-length quaternion
         Quaternion Exp () const;

+ 3 - 3
CamelotUtility/Include/CmVector2.h

@@ -396,7 +396,7 @@ namespace CamelotEngine
                 will be no changes made to their components.
             @returns The previous length of the vector.
         */
-        inline float normalise()
+        inline float normalize()
         {
             float fLength = Math::Sqrt( x * x + y * y);
 
@@ -527,10 +527,10 @@ namespace CamelotEngine
 
         /** As normalise, except that this vector is unaffected and the
             normalised vector is returned as a copy. */
-        inline Vector2 normalisedCopy(void) const
+        inline Vector2 normalizedCopy(void) const
         {
             Vector2 ret = *this;
-            ret.normalise();
+            ret.normalize();
             return ret;
         }
 

+ 8 - 8
CamelotUtility/Include/CmVector3.h

@@ -438,7 +438,7 @@ namespace CamelotEngine
                 will be no changes made to their components.
             @returns The previous length of the vector.
         */
-        inline float normalise()
+        inline float normalize()
         {
             float fLength = Math::Sqrt( x * x + y * y + z * z );
 
@@ -570,7 +570,7 @@ namespace CamelotEngine
                 */
                 perp = this->crossProduct( Vector3::UNIT_Y );
             }
-			perp.normalise();
+			perp.normalize();
 
             return perp;
         }
@@ -653,8 +653,8 @@ namespace CamelotEngine
             // Copy, since cannot modify local
             Vector3 v0 = *this;
             Vector3 v1 = dest;
-            v0.normalise();
-            v1.normalise();
+            v0.normalize();
+            v1.normalize();
 
             float d = v0.dotProduct(v1);
             // If dot == 1, vectors are the same
@@ -675,7 +675,7 @@ namespace CamelotEngine
 					Vector3 axis = Vector3::UNIT_X.crossProduct(*this);
 					if (axis.isZeroLength()) // pick another if colinear
 						axis = Vector3::UNIT_Y.crossProduct(*this);
-					axis.normalise();
+					axis.normalize();
 					q.FromAngleAxis(Radian(Math::PI), axis);
 				}
 			}
@@ -690,7 +690,7 @@ namespace CamelotEngine
         	    q.y = c.y * invs;
             	q.z = c.z * invs;
             	q.w = s * 0.5f;
-				q.normalise();
+				q.normalize();
 			}
             return q;
         }
@@ -705,10 +705,10 @@ namespace CamelotEngine
 
         /** As normalise, except that this vector is unaffected and the
             normalised vector is returned as a copy. */
-        inline Vector3 normalisedCopy(void) const
+        inline Vector3 normalizedCopy(void) const
         {
             Vector3 ret = *this;
-            ret.normalise();
+            ret.normalize();
             return ret;
         }
 

+ 4 - 4
CamelotUtility/Source/CmMath.cpp

@@ -858,17 +858,17 @@ namespace CamelotEngine
 	    Vector3 side1 = position3 - position1;
 	    //Calculate face normal
 	    Vector3 normal = side1.crossProduct(side0);
-	    normal.normalise();
+	    normal.normalize();
 	    //Now we use a formula to calculate the tangent. 
 	    float deltaV0 = v1 - v2;
 	    float deltaV1 = v3 - v1;
 	    Vector3 tangent = deltaV1 * side0 - deltaV0 * side1;
-	    tangent.normalise();
+	    tangent.normalize();
 	    //Calculate binormal
 	    float deltaU0 = u1 - u2;
 	    float deltaU1 = u3 - u1;
 	    Vector3 binormal = deltaU1 * side0 - deltaU0 * side1;
-	    binormal.normalise();
+	    binormal.normalize();
 	    //Now, we take the cross product of the tangents to get a vector which 
 	    //should point in the same direction as our normal calculated above. 
 	    //If it points in the opposite direction (the dot product between the normals is less than zero), 
@@ -905,7 +905,7 @@ namespace CamelotEngine
     Vector3 Math::calculateBasicFaceNormal(const Vector3& v1, const Vector3& v2, const Vector3& v3)
     {
         Vector3 normal = (v2 - v1).crossProduct(v3 - v1);
-        normal.normalise();
+        normal.normalize();
         return normal;
     }
     //-----------------------------------------------------------------------

+ 1 - 1
CamelotUtility/Source/CmMatrix3.cpp

@@ -914,7 +914,7 @@ namespace CamelotEngine
                 rkAxis.x = m[2][1]-m[1][2];
                 rkAxis.y = m[0][2]-m[2][0];
                 rkAxis.z = m[1][0]-m[0][1];
-                rkAxis.normalise();
+                rkAxis.normalize();
             }
             else
             {

+ 74 - 0
CamelotUtility/Source/CmORect.cpp

@@ -0,0 +1,74 @@
+#include "CmORect.h"
+
+namespace CamelotEngine
+{
+	ORect::ORect()
+	{	}
+
+	ORect::ORect(const Rect& rect)
+	{
+		mOrigin = Vector2((float)rect.x, (float)rect.y);
+		mSides[0] = Vector2((float)rect.width, 0.0f);
+		mSides[1] = Vector2(0.0f, (float)rect.height);
+
+		mSideLengths[0] = mSides[0].normalize();
+		mSideLengths[1] = mSides[1].normalize();
+	}
+
+	void ORect::applyTransform(const Matrix4& tfrm)
+	{
+		Vector3 oldOrigin = Vector3(mOrigin.x, mOrigin.y, 0);
+
+		Vector3 oldCornerA = oldOrigin + Vector3(mSides[0].x, mSides[0].y, 0.0f);
+		Vector3 newCornerA = tfrm * oldCornerA;
+
+		Vector3 oldCornerB = oldOrigin + Vector3(mSides[1].x, mSides[1].y, 0.0f);
+		Vector3 newCornerB = tfrm * oldCornerB;
+
+		Vector3 newOrigin = tfrm * oldOrigin;
+		mOrigin.x = newOrigin.x;
+		mOrigin.y = newOrigin.y;
+
+		mSides[0].x = newCornerA.x - newOrigin.x;
+		mSides[0].y = newCornerA.y - newOrigin.y;
+
+		mSides[1].x = newCornerB.x - newOrigin.x;
+		mSides[1].y = newCornerB.y - newOrigin.y;
+
+		mSideLengths[0] = mSides[0].normalize();
+		mSideLengths[1] = mSides[1].normalize();
+	}
+
+	bool ORect::contains(const Vector2& point)
+	{
+		Vector2 localPoint = point - mOrigin;
+
+		float t1 = localPoint.x * mSides[0].x + localPoint.y * mSides[0].y;
+		float t2 = localPoint.x * mSides[1].x + localPoint.y * mSides[1].y;
+
+		if(t1 >= 0.0f && t1 <= mSideLengths[0] && t2 >= 0.0f && t1 <= mSideLengths[1])
+			return true;
+
+		return false;
+	}
+
+	Vector2 ORect::getMin() const
+	{
+		Vector2 result;
+
+		result.x = std::min(std::min(mOrigin.x, mOrigin.x + mSides[0].x), mOrigin.x + mSides[1].x);
+		result.y = std::min(std::min(mOrigin.y, mOrigin.y + mSides[0].y), mOrigin.y + mSides[1].y);
+
+		return result;
+	}
+
+	Vector2 ORect::getMax() const
+	{
+		Vector2 result;
+
+		result.x = std::max(std::max(mOrigin.x, mOrigin.x + mSides[0].x), mOrigin.x + mSides[1].x);
+		result.y = std::max(std::max(mOrigin.y, mOrigin.y + mSides[0].y), mOrigin.y + mSides[1].y);
+
+		return result;
+	}
+}

+ 2 - 2
CamelotUtility/Source/CmPlane.cpp

@@ -120,7 +120,7 @@ namespace CamelotEngine {
 		Vector3 kEdge1 = rkPoint1 - rkPoint0;
 		Vector3 kEdge2 = rkPoint2 - rkPoint0;
 		normal = kEdge1.crossProduct(kEdge2);
-		normal.normalise();
+		normal.normalize();
 		d = -normal.dotProduct(rkPoint0);
 	}
 	//-----------------------------------------------------------------------
@@ -147,7 +147,7 @@ namespace CamelotEngine {
 
 	}
 	//-----------------------------------------------------------------------
-    float Plane::normalise(void)
+    float Plane::normalize(void)
     {
         float fLength = normal.length();
 

+ 4 - 4
CamelotUtility/Source/CmQuaternion.cpp

@@ -85,7 +85,7 @@ namespace CamelotEngine {
             *apkQuat[k] = (kRot[k][i]+kRot[i][k])*fRoot;
         }
 
-		normalise();
+		normalize();
     }
     //-----------------------------------------------------------------------
     void Quaternion::ToRotationMatrix (Matrix3& kRot) const
@@ -459,7 +459,7 @@ namespace CamelotEngine {
             //    have method to fix this case, so just use linear interpolation here.
             Quaternion t = (1.0f - fT) * rkP + fT * rkT;
             // taking the complement requires renormalisation
-            t.normalise();
+            t.normalize();
             return t;
         }
     }
@@ -508,7 +508,7 @@ namespace CamelotEngine {
         return Slerp(fSlerpT, kSlerpP ,kSlerpQ);
     }
     //-----------------------------------------------------------------------
-    float Quaternion::normalise(void)
+    float Quaternion::normalize(void)
     {
         float len = Norm();
         float factor = 1.0f / Math::Sqrt(len);
@@ -604,7 +604,7 @@ namespace CamelotEngine {
 		{
 			result = rkP + fT * (rkQ - rkP);
 		}
-        result.normalise();
+        result.normalize();
         return result;
     }
 }

+ 13 - 6
TODO.txt

@@ -25,6 +25,15 @@ Add TextUtil class
  - Ability to calculate a size of a line (will need this if I want to add "..." to text that doesn't fit)
  - Maybe even move line and word classes to it
 
+ SATURDAY:
+  - Get bounds working correctly
+  - (optional) Implement DirectDraw for drawing the bounds so I know they're correct
+  - Figure out a decent way how to deal with windows
+  - If there's time try to add GUIButton class and hook up GUI events
+  - (Adding a MessageBox-like class should probably be the initial test case)
+    - If I add it, it will probably belong in CamelotEditor project. So possibly rename (don't delete yet)
+	   CamelotEditor to CamelotEditorOLD and then start work on the new one.
+
 Immediate sprite related stuff:
  - Implement image shader for D3D11BuiltinMaterialManager
  - Improve text shader so it doesn't have resolution values hardcoded in
@@ -33,17 +42,15 @@ Immediate sprite related stuff:
  - A way to update mesh buffers without recreating vertex/index buffers (Setting data currently does exactly that)
  - Transformable GUI elements and their bounds
 
+  - TextSprite bounds are wrong. Y coordinate is flipped
+  - Calculate entire GUIWidget bounds and store them
+  - Current way of transforming ORect from GUIWidget is almost certainly not correct
+
  GUIWidget::update
- - Gets bounds from all elements and transforms them by its own transform matrix
-  - Stores them in a map so I can easily scan through them later and find referenced element
-  - Keeps a total bound of all elements so I can easily reject elements that not even under the cursor
  - Has mouseEvent, keyboardEvent handlers that it propagates to its children
    - (possibly not keyboardEvent, see below why)
    - mouse events only if cursor is over the element
    - events originate from GUIManager
- - When bounds are transformed it also transforms elements center
-   - Elements are sorted based on that center so when rendering we can render them back to front
-     - (back to front because they can be transparent)
 
 GUIElement
  - Extend it with "hasFocus" flag