Browse Source

Added documentation to various utility classes
Refactored a few functions

Marko Pintera 11 years ago
parent
commit
1c696e40a9

+ 3 - 3
CamelotGLRenderer/Source/CmGLRenderSystem.cpp

@@ -1580,10 +1580,10 @@ namespace CamelotFramework
 	//-----------------------------------------------------------------------------
 	void GLRenderSystem::makeGLMatrix(GLfloat gl_matrix[16], const Matrix4& m)
 	{
-		size_t x = 0;
-		for (size_t i = 0; i < 4; i++)
+		UINT32 x = 0;
+		for (UINT32 i = 0; i < 4; i++)
 		{
-			for (size_t j = 0; j < 4; j++)
+			for (UINT32 j = 0; j < 4; j++)
 			{
 				gl_matrix[x] = m[j][i];
 				x++;

+ 0 - 3
CamelotUtility/CamelotUtility.vcxproj.filters

@@ -37,9 +37,6 @@
     <Filter Include="Header Files\Reflection">
       <UniqueIdentifier>{ceeeab21-95fc-4e22-922c-7c91ecaba0df}</UniqueIdentifier>
     </Filter>
-    <Filter Include="Header Files\RTTI">
-      <UniqueIdentifier>{e58e84a8-5f39-4bbd-874e-cfa000ebd881}</UniqueIdentifier>
-    </Filter>
     <Filter Include="Header Files\Debug">
       <UniqueIdentifier>{cdfa7307-cdee-490f-8d31-d8be0d929c70}</UniqueIdentifier>
     </Filter>

+ 47 - 4
CamelotUtility/Include/CmAABox.h

@@ -7,6 +7,9 @@
 
 namespace CamelotFramework 
 {
+	/**
+	 * @brief	Axis aligned box represented by minimum and maximum point.
+	 */
 	class CM_UTILITY_EXPORT AABox
 	{
 	public:
@@ -50,21 +53,54 @@ namespace CamelotFramework
 
 		Vector3 getCorner(CornerEnum cornerToGet) const;
 
+		/**
+		 * @brief	Merges the two boxes, creating a new 
+		 * 			bounding box that encapsulates them both.
+		 */
 		void merge(const AABox& rhs);
+
+		/**
+		 * @brief	Expands the bounding box so it includes
+		 * 			the provided point.
+		 */
 		void merge(const Vector3& point);
 
+		/**
+		 * @brief	Transforms the bounding box by the given matrix.
+		 *
+		 * @note	As the resulting box will no longer be axis aligned,
+		 * 			an axis align box is instead created from the transformed oriented bounding box.
+		 */
 		void transform(const Matrix4& matrix);
-		void transformAffine(const Matrix4& matrix);
 
-		AABox intersection(const AABox& b2) const;
+		/**
+		 * @brief	Transforms the bounding box by the given matrix.
+		 *
+		 * @note	As the resulting box will no longer be axis aligned,
+		 * 			an axis align box is instead created from the transformed oriented bounding box.
+		 * 			
+		 *			Provided matrix must be affine.
+		 */
+		void transformAffine(const Matrix4& matrix);
 
+		/**
+		 * @brief	Returns true if this and the provided box intersect.
+		 */
 		bool intersects(const AABox& b2) const;
+
+		/**
+		 * @brief	Returns true if the sphere intersects the bounding box.
+		 */
 		bool intersects(const Sphere& s) const;
+
+		/**
+		 * @brief	Returns true if the plane intersects the bounding box.
+		 */
 		bool intersects(const Plane& p) const;
-		bool intersects(const Vector3& v) const;
 
         /**
-         * @brief	Ray / box intersection, returns boolean result and distance.
+         * @brief	Ray / box intersection, returns a boolean result and nearest distance
+         * 			to intersection.
          */
         std::pair<bool, float> intersects(const Ray& ray) const;
 
@@ -79,7 +115,14 @@ namespace CamelotFramework
 		float getRadius() const;
 		float getVolume() const;
 
+        /**
+         * @brief	Returns true if the provided point is inside the bounding box.
+         */
         bool contains(const Vector3& v) const;
+
+        /**
+         * @brief	Returns true if the provided bounding box is completely inside the bounding box.
+         */
         bool contains(const AABox& other) const;
 
         bool operator== (const AABox& rhs) const;

+ 23 - 0
CamelotUtility/Include/CmBitmapWriter.h

@@ -4,10 +4,33 @@
 
 namespace CamelotFramework
 {
+	/**
+	 * @brief	Utility class from generating BMP images.
+	 */
 	class CM_UTILITY_EXPORT BitmapWriter
 	{
 	public:
+		/**
+		 * @brief	Generates bytes representing the BMP image format, from a set of raw RGB or RGBA pixels.
+		 *
+		 * @param	input		  	The input set of bytes in RGB or RGBA format. Starting byte represents the top left pixel of the image
+		 * 							and following pixels need to be set going from left to right, row after row.
+		 * @param [out]	output	Preallocated buffer where the BMP bytes will be stored. Use "getBMPSize" to retrieve the size needed for this buffer.
+		 * @param	width		  	The width of the image in pixels.
+		 * @param	height		  	The height of the image in pixels.
+		 * @param	bytesPerPixel 	Number of bytes per pixel. 3 for RGB images and 4 for RGBA images. Other values not supported.
+		 */
 		static void rawPixelsToBMP(const UINT8* input, UINT8* output, UINT32 width, UINT32 height, UINT32 bytesPerPixel);
+
+		/**
+		 * @brief	Returns the size of the BMP output buffer that needs to be allocated before calling "rawPixelsToBMP".
+		 *
+		 * @param	width		  	The width of the image in pixels.
+		 * @param	height		  	The height of the image in pixels.
+		 * @param	bytesPerPixel 	Number of bytes per pixel. 3 for RGB images and 4 for RGBA images. Other values not supported.
+		 *
+		 * @return	Size of the BMP output buffer needed to write a BMP of the specified size & bpp.
+		 */
 		static UINT32 getBMPSize(UINT32 width, UINT32 height, UINT32 bytesPerPixel);
 	};
 }

+ 3 - 3
CamelotUtility/Include/CmDegree.h

@@ -8,12 +8,12 @@ namespace CamelotFramework
 	/**
 	 * @brief	Wrapper class which indicates a given angle value is in Degrees.
 	 * 			
-	 *	@note Degree values are interchangeable with Radian values, and conversions
-	 *	will be done automatically between them.
+	 *	@note	Degree values are interchangeable with Radian values, and conversions
+	 *			will be done automatically between them.
 	 */
 	class CM_UTILITY_EXPORT Degree
 	{
-		float mDeg; // if you get an error here - make sure to define/typedef 'float' first
+		float mDeg;
 
 	public:
 		explicit Degree(float d = 0.0f) : mDeg(d) {}

+ 20 - 0
CamelotUtility/Include/CmHString.h

@@ -11,6 +11,8 @@ namespace CamelotFramework
 	 *			Actual value for this string is looked up in a global string table based
 	 *			on the provided identifier string and currently active language. If such value 
 	 *			doesn't exist then the identifier is used as is.
+	 *			
+	 *			Use {0}, {1}, etc. in the string value for values that might change dynamically.
 	 */
 	class CM_UTILITY_EXPORT HString
 	{
@@ -37,6 +39,11 @@ namespace CamelotFramework
 			void updateString();
 		};
 
+		/**
+		 * @brief	Creates a new localized string with the specified identifier. If the identifier
+		 * 			doesn't previously exist in the string table, identifier value will also be used 
+		 * 			for initializing the English version of the string.
+		 */
 		explicit HString(const WString& identifierString);
 		HString();
 		HString(const HString& copy);
@@ -45,10 +52,23 @@ namespace CamelotFramework
 		operator const WString& () const;
 		const WString& getValue() const;
 
+		/**
+		 * @brief	Sets a value of a string parameter. Parameters are specified as bracketed values
+		 * 			within the string itself (e.g. {0}, {1}) etc.
+		 *
+		 * @note	Useful for strings that have dynamically changing values, like numbers, embedded in them.
+		 */
 		void setParameter(UINT32 idx, const WString& value);
 		
+		/**
+		 * @brief	Registers a callback that gets triggered whenever string value changes. This may happen
+		 * 			when the string table is modified, or when the active language is changed.
+		 */
 		boost::signals::connection addOnStringModifiedCallback(std::function<void()> callback) const;
 
+		/**
+		 * @brief	Returns an empty string.
+		 */
 		static const HString& dummy();
 	private:
 		std::shared_ptr<StringData> mData;

+ 37 - 13
CamelotUtility/Include/CmIReflectable.h

@@ -7,6 +7,10 @@ namespace CamelotFramework
 {
 	/**
 	 * @brief	Interface implemented by classes that provide run time type information.
+	 * 			
+	 * @note	Any class implementing this interface must implement the "getRTTI" method, as well as
+	 * 			a static "getRTTIStatic" method, returning the same value as "getRTTI". Object returned by those
+	 * 			methods is used for retrieving actual RTTI data about the class.
 	 */
 	class CM_UTILITY_EXPORT IReflectable
 	{
@@ -14,17 +18,15 @@ namespace CamelotFramework
 		virtual ~IReflectable() {}
 
 		/**
-		 * @brief	Returns an interface you can use to access class Run Time Type Information.
+		 * @brief	Returns an interface you can use to access class' Run Time Type Information.
 		 *
-		 * @note	You must derive your own version of RTTIType, in which you
+		 * @note	You must derive your own version of RTTITypeBase, in which you
 		 * 			may encapsulate all reflection specific operations. 
 		 */
 		virtual RTTITypeBase* getRTTI() const = 0;
 
 		/**
 		 * @brief	Returns all classes deriving directly from IReflectable.
-		 * 			You can call another version of this method on the returned type class,
-		 * 			to find classes deeper in the hierarchy.
 		 */
 		static Vector<RTTITypeBase*>::type& getDerivedClasses()
 		{
@@ -32,23 +34,45 @@ namespace CamelotFramework
 			return mRTTIDerivedClasses;
 		}
 
-		/**
-		 * @brief	INTERNAL USE ONLY. Called by each type deriving from IReflectable,
-		 * 			on program load.
-		 */
-		static void registerDerivedClass(RTTITypeBase* derivedClass);
-		static std::shared_ptr<IReflectable> createInstanceFromTypeId(UINT32 rttiTypeId);
-		static RTTITypeBase* getRTTIfromTypeId(UINT32 rttiTypeId);
-		static bool isTypeIdDuplicate(UINT32 typeId);
-
 		/**
 		 * @brief	Returns true if current RTTI class is derived from "base".
 		 * 			(Or if it is the same type as base)
 		 */
 		bool isDerivedFrom(RTTITypeBase* base);
 
+		/**
+		 * @brief	Returns an unique type identifier of the class.
+		 */
 		UINT32 getTypeId() const;
+
+		/**
+		 * @brief	Returns the type name of the class.
+		 *
+		 * @note	Name is not necessarily unique.
+		 */
 		const String& getTypeName() const;
+
+		/**
+		 * @brief	Creates an empty instance of a class from a type identifier.
+		 */
+		static std::shared_ptr<IReflectable> createInstanceFromTypeId(UINT32 rttiTypeId);
+
+		/**
+		 * @brief	Internal method. Called by each type deriving from IReflectable,
+		 * 			on program load.
+		 */
+		static void _registerDerivedClass(RTTITypeBase* derivedClass);
+
+		/**
+		* @brief	Internal method. Returns class' RTTI type from type id.
+		*/
+		static RTTITypeBase* _getRTTIfromTypeId(UINT32 rttiTypeId);
+
+		/**
+		 * @brief	Internal method. Checks if the provided type id is unique.
+		 */
+		static bool _isTypeIdDuplicate(UINT32 typeId);
+
 	protected:
 		boost::any mRTTIData; // Temporary per-instance data storage used during various RTTI operations.
 							  // Needed since there is one RTTI class instance per type and sometimes we need per-instance data.

+ 3 - 27
CamelotUtility/Include/CmMath.h

@@ -1,30 +1,3 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-    (Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org/
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
 #pragma once
 
 #include "CmPrerequisitesUtil.h"
@@ -33,6 +6,9 @@ THE SOFTWARE.
 
 namespace CamelotFramework
 {
+    /**
+     * @brief	Utility class providing common scalar math operations.
+     */
     class CM_UTILITY_EXPORT Math 
     {
     public:

+ 68 - 33
CamelotUtility/Include/CmMatrix3.h

@@ -1,30 +1,3 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-    (Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org/
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
 #pragma once
 
 #include "CmPrerequisitesUtil.h"
@@ -32,6 +5,9 @@ THE SOFTWARE.
 
 namespace CamelotFramework
 {
+    /**
+     * @brief	Class representing a 3x3 matrix.
+     */
     class CM_UTILITY_EXPORT Matrix3
     {
 	private:
@@ -87,7 +63,7 @@ namespace CamelotFramework
         }
 
 		/**
-         * @brief	Construct a matrix from an angle/axis.
+         * @brief	Construct a matrix from an angle/axis pair.
          */
         explicit Matrix3(const Vector3& axis, const Radian& angle)
         {
@@ -122,6 +98,9 @@ namespace CamelotFramework
 			fromEulerAngles(xAngle, yAngle, zAngle, order);
 		}
 
+		/**
+		 * @brief	Swaps the contents of this matrix with another.
+		 */
 		void swap(Matrix3& other)
 		{
 			std::swap(m[0][0], other.m[0][0]);
@@ -135,13 +114,18 @@ namespace CamelotFramework
 			std::swap(m[2][2], other.m[2][2]);
 		}
 
-        inline float* operator[] (size_t row) const
+        /**
+         * @brief	Returns a row of the matrix.
+         */
+        inline float* operator[] (UINT32 row) const
 		{
+			assert(row < 3);
+
 			return (float*)m[row];
 		}
 
-        Vector3 getColumn(size_t col) const;
-        void setColumn(size_t col, const Vector3& vec);
+        Vector3 getColumn(UINT32 col) const;
+        void setColumn(UINT32 col, const Vector3& vec);
 
         Matrix3& operator= (const Matrix3& rhs)
 		{
@@ -159,14 +143,65 @@ namespace CamelotFramework
 
 		friend Matrix3 operator* (float lhs, const Matrix3& rhs);
 
+		/**
+		 * @brief	Transforms the given vector by this matrix and returns
+		 * 			the newly transformed vector.
+		 */
 		Vector3 transform(const Vector3& vec) const;
+
+        /**
+         * @brief	Returns a transpose of the matrix (switched columns and rows).
+         */
         Matrix3 transpose () const;
+
+        /**
+         * @brief	Calculates an inverse of the matrix if it exists.
+         *
+         * @param [out]	mat		Resulting matrix inverse.
+         * @param	fTolerance 	(optional) Tolerance to use when checking
+         * 						if determinant is zero (or near zero in this case).
+         * 						Zero determinant means inverse doesn't exist.
+         *
+         * @return	True if inverse exists, false otherwise.
+         */
         bool inverse(Matrix3& mat, float fTolerance = 1e-06f) const;
+
+        /**
+         * @brief	Calculates an inverse of the matrix if it exists.
+         *
+		 * @param	fTolerance 	(optional) Tolerance to use when checking
+		 * 						if determinant is zero (or near zero in this case).
+		 * 						Zero determinant means inverse doesn't exist.
+         *
+         * @return	Resulting matrix inverse if it exists, otherwise a zero matrix.
+         */
         Matrix3 inverse(float fTolerance = 1e-06f) const;
+
+        /**
+         * @brief	Calculates the matrix determinant.
+         */
         float determinant() const;
 
-        void singularValueDecomposition (Matrix3& matL, Vector3& matS, Matrix3& matR) const;
-		void QDUDecomposition (Matrix3& matQ, Vector3& vecD, Vector3& vecU) const;
+        /**
+         * @brief	Decomposes the matrix into various useful values.
+         *
+         * @param [out]	matL	Unitary matrix. Columns form orthonormal bases. If your matrix is affine and
+         * 						doesn't use non-uniform scaling this matrix will be a conjugate transpose of the rotation part of the matrix.
+         * @param [out]	matS	Singular values of the matrix. If your matrix is affine these will be scaling factors of the matrix.
+		 * @param [out]	matR	Unitary matrix. Columns form orthonormal bases. If your matrix is affine and
+		 * 						doesn't use non-uniform scaling this matrix will be the rotation part of the matrix.
+         */
+        void singularValueDecomposition(Matrix3& matL, Vector3& matS, Matrix3& matR) const;
+
+        /**
+         * @brief	Decomposes the matrix into various useful values.
+         *
+         * @param [out]	matQ	Columns form orthonormal bases. If your matrix is affine and
+         * 						doesn't use non-uniform scaling this matrix will be the rotation part of the matrix.
+         * @param [out]	vecD	If your matrix is affine these will be scaling factors of the matrix.
+		 * @param [out]	vecU	If your matrix is affine these will be shear factors of the matrix.
+         */
+		void QDUDecomposition(Matrix3& matQ, Vector3& vecD, Vector3& vecU) const;
 
         /**
          * @brief	Gram-Schmidt orthonormalization (applied to columns of rotation matrix)

+ 39 - 42
CamelotUtility/Include/CmMatrix4.h

@@ -1,30 +1,3 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-    (Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org/
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
 #pragma once
 
 #include "CmPrerequisitesUtil.h"
@@ -36,6 +9,9 @@ THE SOFTWARE.
 
 namespace CamelotFramework
 {
+	 /**
+     * @brief	Class representing a 4x4 matrix.
+     */
     class CM_UTILITY_EXPORT Matrix4
     {
     private:
@@ -97,6 +73,9 @@ namespace CamelotFramework
 			setTRS(translation, rot, scale);
         }
         
+		/**
+		 * @brief	Swaps the contents of this matrix with another.
+		 */
 		void swap(Matrix4& other)
 		{
 			std::swap(m[0][0], other.m[0][0]);
@@ -117,14 +96,17 @@ namespace CamelotFramework
 			std::swap(m[3][3], other.m[3][3]);
 		}
 
-		float* operator[] (size_t row)
+		/**
+         * @brief	Returns a row of the matrix.
+         */
+		float* operator[] (UINT32 row)
         {
             assert(row < 4);
 
             return m[row];
         }
 
-        const float *operator[] (size_t row) const
+        const float *operator[] (UINT32 row) const
         {
             assert(row < 4);
 
@@ -213,12 +195,14 @@ namespace CamelotFramework
 
         inline bool operator== (const Matrix4& rhs ) const
         {
-            if( 
-                m[0][0] != rhs.m[0][0] || m[0][1] != rhs.m[0][1] || m[0][2] != rhs.m[0][2] || m[0][3] != rhs.m[0][3] ||
-                m[1][0] != rhs.m[1][0] || m[1][1] != rhs.m[1][1] || m[1][2] != rhs.m[1][2] || m[1][3] != rhs.m[1][3] ||
-                m[2][0] != rhs.m[2][0] || m[2][1] != rhs.m[2][1] || m[2][2] != rhs.m[2][2] || m[2][3] != rhs.m[2][3] ||
-                m[3][0] != rhs.m[3][0] || m[3][1] != rhs.m[3][1] || m[3][2] != rhs.m[3][2] || m[3][3] != rhs.m[3][3] )
+            if(m[0][0] != rhs.m[0][0] || m[0][1] != rhs.m[0][1] || m[0][2] != rhs.m[0][2] || m[0][3] != rhs.m[0][3] ||
+               m[1][0] != rhs.m[1][0] || m[1][1] != rhs.m[1][1] || m[1][2] != rhs.m[1][2] || m[1][3] != rhs.m[1][3] ||
+               m[2][0] != rhs.m[2][0] || m[2][1] != rhs.m[2][1] || m[2][2] != rhs.m[2][2] || m[2][3] != rhs.m[2][3] ||
+               m[3][0] != rhs.m[3][0] || m[3][1] != rhs.m[3][1] || m[3][2] != rhs.m[3][2] || m[3][3] != rhs.m[3][3] )
+			{
                 return false;
+			}
+
             return true;
         }
 
@@ -229,13 +213,15 @@ namespace CamelotFramework
 
 		Matrix4 operator*(float rhs) const
 		{
-			return Matrix4(
-				rhs*m[0][0], rhs*m[0][1], rhs*m[0][2], rhs*m[0][3],
-				rhs*m[1][0], rhs*m[1][1], rhs*m[1][2], rhs*m[1][3],
-				rhs*m[2][0], rhs*m[2][1], rhs*m[2][2], rhs*m[2][3],
-				rhs*m[3][0], rhs*m[3][1], rhs*m[3][2], rhs*m[3][3]);
+			return Matrix4(rhs*m[0][0], rhs*m[0][1], rhs*m[0][2], rhs*m[0][3],
+						   rhs*m[1][0], rhs*m[1][1], rhs*m[1][2], rhs*m[1][3],
+						   rhs*m[2][0], rhs*m[2][1], rhs*m[2][2], rhs*m[2][3],
+						   rhs*m[3][0], rhs*m[3][1], rhs*m[3][2], rhs*m[3][3]);
 		}
 
+        /**
+         * @brief	Returns a transpose of the matrix (switched columns and rows).
+         */
         Matrix4 transpose() const
         {
             return Matrix4(m[0][0], m[1][0], m[2][0], m[3][0],
@@ -245,7 +231,7 @@ namespace CamelotFramework
         }
 
         /**
-         * @brief	Extracts the rotation/scaling part of the Matrix as a 3x3 matrix.
+         * @brief	Extracts the rotation/scaling part of the matrix as a 3x3 matrix.
          */
         void extract3x3Matrix(Matrix3& m3x3) const
         {
@@ -260,8 +246,19 @@ namespace CamelotFramework
             m3x3.m[2][2] = m[2][2];
         }
 
+		/**
+		 * @brief	Calculates the adjoint of the matrix.
+		 */
 		Matrix4 adjoint() const;
+
+		/**
+		 * @brief	Calculates the determinant of the matrix.
+		 */
 		float determinant() const;
+
+		/**
+		 * @brief	Calculates the inverse of the matrix.
+		 */
 		Matrix4 inverse() const;
         
         /**
@@ -303,7 +300,7 @@ namespace CamelotFramework
          *
          * @note	Matrix must be affine.
          */
-        Matrix4 inverseAffine(void) const;
+        Matrix4 inverseAffine() const;
 
         /**
          * @brief	Concatenate two affine matrices.
@@ -382,7 +379,7 @@ namespace CamelotFramework
         }
 
         /**
-         * @brief	Transform a 3D vector by this matrix.  
+         * @brief	Transform a 4D vector by this matrix.  
          *
          * @note	After transformation all components are projected back so that w remains 1.
          * 			

+ 5 - 5
CamelotUtility/Include/CmRTTIType.h

@@ -43,7 +43,7 @@ namespace CamelotFramework
 
 		virtual Vector<RTTITypeBase*>::type& getDerivedClasses() = 0;
 		virtual RTTITypeBase* getBaseClass() = 0;
-		virtual void registerDerivedClass(RTTITypeBase* derivedClass) = 0;
+		virtual void _registerDerivedClass(RTTITypeBase* derivedClass) = 0;
 		virtual std::shared_ptr<IReflectable> newRTTIObject() = 0;
 		virtual const String& getRTTIName() = 0;
 		virtual UINT32 getRTTIId() = 0;
@@ -344,7 +344,7 @@ namespace CamelotFramework
 	public:
 		InitRTTIOnStart()
 		{
-			BaseType::getRTTIStatic()->registerDerivedClass(Type::getRTTIStatic());
+			BaseType::getRTTIStatic()->_registerDerivedClass(Type::getRTTIStatic());
 		}
 
 		void makeSureIAmInstantiated() { }
@@ -359,7 +359,7 @@ namespace CamelotFramework
 	public:
 		InitRTTIOnStart()
 		{
-			IReflectable::registerDerivedClass(Type::getRTTIStatic());
+			IReflectable::_registerDerivedClass(Type::getRTTIStatic());
 		}
 
 		void makeSureIAmInstantiated() { }
@@ -426,9 +426,9 @@ namespace CamelotFramework
 			return GetRTTIType<BaseType>()();
 		}
 
-		virtual void registerDerivedClass(RTTITypeBase* derivedClass)
+		virtual void _registerDerivedClass(RTTITypeBase* derivedClass)
 		{
-			if(IReflectable::isTypeIdDuplicate(derivedClass->getRTTIId()))
+			if(IReflectable::_isTypeIdDuplicate(derivedClass->getRTTIId()))
 			{
 				CM_EXCEPT(InternalErrorException, "RTTI type \"" + derivedClass->getRTTIName() + 
 					"\" has a duplicate ID: " + toString(derivedClass->getRTTIId()));

+ 1 - 27
CamelotUtility/Source/CmAABox.cpp

@@ -102,7 +102,7 @@ namespace CamelotFramework
 		oldMax = mMaximum;
 
 		// We sequentially compute the corners in the following order :
-		// 0, 6, 5, 1, 2, 4 ,7 , 3
+		// 0, 6, 5, 1, 2, 4, 7, 3
 		// This sequence allows us to only change one member at a time to get at all corners.
 
 		// For each one, we transform it using the matrix
@@ -158,25 +158,6 @@ namespace CamelotFramework
 		setExtents(newCentre - newHalfSize, newCentre + newHalfSize);
 	}
 
-	AABox AABox::intersection(const AABox& b2) const
-	{
-		Vector3 intMin = mMinimum;
-        Vector3 intMax = mMaximum;
-
-        intMin.ceil(b2.getMin());
-        intMax.floor(b2.getMax());
-
-        // Check intersection isn't null
-        if (intMin.x < intMax.x &&
-            intMin.y < intMax.y &&
-            intMin.z < intMax.z)
-        {
-            return AABox(intMin, intMax);
-        }
-
-        return AABox();
-	}
-
 	bool AABox::intersects(const AABox& b2) const
 	{
 		// Use up to 6 separating planes
@@ -229,13 +210,6 @@ namespace CamelotFramework
 		return (p.getSide(*this) == Plane::BOTH_SIDE);
 	}
 
-	bool AABox::intersects(const Vector3& v) const
-	{
-		return(v.x >= mMinimum.x  &&  v.x <= mMaximum.x  && 
-			v.y >= mMinimum.y  &&  v.y <= mMaximum.y  && 
-			v.z >= mMinimum.z  &&  v.z <= mMaximum.z);
-	}
-
 	std::pair<bool, float> AABox::intersects(const Ray& ray) const
 	{
 		float lowt = 0.0f;

+ 6 - 6
CamelotUtility/Source/CmIReflectable.cpp

@@ -4,9 +4,9 @@
 
 namespace CamelotFramework
 {
-	void IReflectable::registerDerivedClass(RTTITypeBase* derivedClass)
+	void IReflectable::_registerDerivedClass(RTTITypeBase* derivedClass)
 	{
-		if(isTypeIdDuplicate(derivedClass->getRTTIId()))
+		if(_isTypeIdDuplicate(derivedClass->getRTTIId()))
 		{
 			CM_EXCEPT(InternalErrorException, "RTTI type \"" + derivedClass->getRTTIName() + 
 				"\" has a duplicate ID: " + toString(derivedClass->getRTTIId()));
@@ -17,7 +17,7 @@ namespace CamelotFramework
 
 	std::shared_ptr<IReflectable> IReflectable::createInstanceFromTypeId(UINT32 rttiTypeId)
 	{
-		RTTITypeBase* type = getRTTIfromTypeId(rttiTypeId);
+		RTTITypeBase* type = _getRTTIfromTypeId(rttiTypeId);
 
 		if(type != nullptr)
 			return type->newRTTIObject();
@@ -25,7 +25,7 @@ namespace CamelotFramework
 		return nullptr;
 	}
 
-	RTTITypeBase* IReflectable::getRTTIfromTypeId(UINT32 rttiTypeId)
+	RTTITypeBase* IReflectable::_getRTTIfromTypeId(UINT32 rttiTypeId)
 	{
 		Stack<RTTITypeBase*>::type todo;
 		Vector<RTTITypeBase*>::type& rootClasses = getDerivedClasses();
@@ -49,12 +49,12 @@ namespace CamelotFramework
 		return nullptr;
 	}
 
-	bool IReflectable::isTypeIdDuplicate(UINT32 typeId)
+	bool IReflectable::_isTypeIdDuplicate(UINT32 typeId)
 	{
 		if(typeId == TID_Abstract)
 			return false;
 
-		return IReflectable::getRTTIfromTypeId(typeId) != nullptr;
+		return IReflectable::_getRTTIfromTypeId(typeId) != nullptr;
 	}
 
 	bool IReflectable::isDerivedFrom(RTTITypeBase* base)

+ 0 - 27
CamelotUtility/Source/CmMath.cpp

@@ -1,30 +1,3 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-    (Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org/
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
 #include "CmMath.h"
 #include "CmVector2.h"
 #include "CmVector3.h"

+ 32 - 61
CamelotUtility/Source/CmMatrix3.cpp

@@ -1,36 +1,7 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-    (Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org/
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
 #include "CmMatrix3.h"
 #include "CmQuaternion.h"
 #include "CmMath.h"
 
-// Adapted from Matrix math by Wild Magic http://www.geometrictools.com/
-
 namespace CamelotFramework
 {
     const float Matrix3::EPSILON = 1e-06f;
@@ -43,16 +14,16 @@ namespace CamelotFramework
 		  { 1, 2, 0, 1.0f}, { 2, 0, 1,  1.0f}, { 2, 1, 0, -1.0f} };;
 
 
-    Vector3 Matrix3::getColumn(size_t col) const
+    Vector3 Matrix3::getColumn(UINT32 col) const
     {
-        assert(0 <= col && col < 3);
+        assert(col < 3);
         
 		return Vector3(m[0][col],m[1][col], m[2][col]);
     }
 
-    void Matrix3::setColumn(size_t col, const Vector3& vec)
+    void Matrix3::setColumn(UINT32 col, const Vector3& vec)
     {
-        assert(0 <= col && col < 3);
+        assert(col < 3);
 
         m[0][col] = vec.x;
         m[1][col] = vec.y;
@@ -68,9 +39,9 @@ namespace CamelotFramework
 
     bool Matrix3::operator== (const Matrix3& rhs) const
     {
-        for (size_t row = 0; row < 3; row++)
+        for (UINT32 row = 0; row < 3; row++)
         {
-            for (size_t col = 0; col < 3; col++)
+            for (UINT32 col = 0; col < 3; col++)
             {
                 if (m[row][col] != rhs.m[row][col])
                     return false;
@@ -88,9 +59,9 @@ namespace CamelotFramework
     Matrix3 Matrix3::operator+ (const Matrix3& rhs) const
     {
         Matrix3 sum;
-        for (size_t row = 0; row < 3; row++)
+        for (UINT32 row = 0; row < 3; row++)
         {
-            for (size_t col = 0; col < 3; col++)
+            for (UINT32 col = 0; col < 3; col++)
             {
                 sum.m[row][col] = m[row][col] + rhs.m[row][col];
             }
@@ -102,9 +73,9 @@ namespace CamelotFramework
     Matrix3 Matrix3::operator- (const Matrix3& rhs) const
     {
         Matrix3 diff;
-        for (size_t row = 0; row < 3; row++)
+        for (UINT32 row = 0; row < 3; row++)
         {
-            for (size_t col = 0; col < 3; col++)
+            for (UINT32 col = 0; col < 3; col++)
             {
                 diff.m[row][col] = m[row][col] -
                     rhs.m[row][col];
@@ -117,9 +88,9 @@ namespace CamelotFramework
     Matrix3 Matrix3::operator* (const Matrix3& rhs) const
     {
         Matrix3 prod;
-        for (size_t row = 0; row < 3; row++)
+        for (UINT32 row = 0; row < 3; row++)
         {
-            for (size_t col = 0; col < 3; col++)
+            for (UINT32 col = 0; col < 3; col++)
             {
                 prod.m[row][col] = m[row][0]*rhs.m[0][col] +
                     m[row][1]*rhs.m[1][col] + m[row][2]*rhs.m[2][col];
@@ -132,9 +103,9 @@ namespace CamelotFramework
     Matrix3 Matrix3::operator- () const
     {
         Matrix3 neg;
-        for (size_t row = 0; row < 3; row++)
+        for (UINT32 row = 0; row < 3; row++)
         {
-            for (size_t col = 0; col < 3; col++)
+            for (UINT32 col = 0; col < 3; col++)
                 neg[row][col] = -m[row][col];
         }
 
@@ -144,9 +115,9 @@ namespace CamelotFramework
     Matrix3 Matrix3::operator* (float rhs) const
     {
         Matrix3 prod;
-        for (size_t row = 0; row < 3; row++)
+        for (UINT32 row = 0; row < 3; row++)
         {
-            for (size_t col = 0; col < 3; col++)
+            for (UINT32 col = 0; col < 3; col++)
                 prod[row][col] = rhs*m[row][col];
         }
 
@@ -156,9 +127,9 @@ namespace CamelotFramework
     Matrix3 operator* (float lhs, const Matrix3& rhs)
     {
         Matrix3 prod;
-        for (size_t row = 0; row < 3; row++)
+        for (UINT32 row = 0; row < 3; row++)
         {
-            for (size_t col = 0; col < 3; col++)
+            for (UINT32 col = 0; col < 3; col++)
                 prod[row][col] = lhs*rhs.m[row][col];
         }
 
@@ -168,7 +139,7 @@ namespace CamelotFramework
 	Vector3 Matrix3::transform(const Vector3& vec) const
 	{
 		Vector3 prod;
-		for (size_t row = 0; row < 3; row++)
+		for (UINT32 row = 0; row < 3; row++)
 		{
 			prod[row] =
 				m[row][0]*vec[0] +
@@ -179,19 +150,19 @@ namespace CamelotFramework
 		return prod;
 	}
 
-    Matrix3 Matrix3::transpose () const
+    Matrix3 Matrix3::transpose() const
     {
         Matrix3 matTranspose;
-        for (size_t row = 0; row < 3; row++)
+        for (UINT32 row = 0; row < 3; row++)
         {
-            for (size_t col = 0; col < 3; col++)
+            for (UINT32 col = 0; col < 3; col++)
                 matTranspose[row][col] = m[col][row];
         }
 
         return matTranspose;
     }
 
-    bool Matrix3::inverse (Matrix3& matInv, float tolerance) const
+    bool Matrix3::inverse(Matrix3& matInv, float tolerance) const
     {
         matInv[0][0] = m[1][1]*m[2][2] - m[1][2]*m[2][1];
         matInv[0][1] = m[0][2]*m[2][1] - m[0][1]*m[2][2];
@@ -209,16 +180,16 @@ namespace CamelotFramework
             return false;
 
         float invDet = 1.0f/det;
-        for (size_t row = 0; row < 3; row++)
+        for (UINT32 row = 0; row < 3; row++)
         {
-            for (size_t col = 0; col < 3; col++)
+            for (UINT32 col = 0; col < 3; col++)
                 matInv[row][col] *= invDet;
         }
 
         return true;
     }
 
-    Matrix3 Matrix3::inverse (float tolerance) const
+    Matrix3 Matrix3::inverse(float tolerance) const
     {
         Matrix3 matInv = Matrix3::ZERO;
         inverse(matInv, tolerance);
@@ -374,7 +345,7 @@ namespace CamelotFramework
         matA[1][0] = -sin*matA[1][1];
         matA[1][1] *= cos;
 
-        size_t row;
+        UINT32 row;
         for (row = 0; row < 3; row++)
         {
             tmp0 = matR[0][row];
@@ -398,7 +369,7 @@ namespace CamelotFramework
         matA[0][2] = -sin*matA[1][2];
         matA[1][2] *= cos;
 
-        size_t col;
+        UINT32 col;
         for (col = 0; col < 3; col++)
         {
             tmp0 = matL[col][0];
@@ -454,7 +425,7 @@ namespace CamelotFramework
 
     void Matrix3::singularValueDecomposition(Matrix3& matL, Vector3& matS, Matrix3& matR) const
     {
-		size_t row, col;
+		UINT32 row, col;
 
         Matrix3 mat = *this;
         bidiagonalize(mat, matL, matR);
@@ -642,8 +613,8 @@ namespace CamelotFramework
 
         if (fDet < 0.0f)
         {
-            for (size_t row = 0; row < 3; row++)
-                for (size_t col = 0; col < 3; col++)
+            for (UINT32 row = 0; row < 3; row++)
+                for (UINT32 col = 0; col < 3; col++)
                     matQ[row][col] = -matQ[row][col];
         }
 
@@ -1039,7 +1010,7 @@ namespace CamelotFramework
         mat.tridiagonal(eigenValues, subDiag);
         mat.QLAlgorithm(eigenValues, subDiag);
 
-        for (size_t i = 0; i < 3; i++)
+        for (UINT32 i = 0; i < 3; i++)
         {
             eigenVectors[i][0] = mat[0][i];
             eigenVectors[i][1] = mat[1][i];

+ 2 - 29
CamelotUtility/Source/CmMatrix4.cpp

@@ -1,30 +1,3 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-(Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org/
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
 #include "CmMatrix4.h"
 
 #include "CmVector3.h"
@@ -45,8 +18,8 @@ namespace CamelotFramework
 		0.0f, 0.0f, 1.0f, 0.0f,
 		0.0f, 0.0f, 0.0f, 1.0f);
 
-    static float MINOR(const Matrix4& m, const size_t r0, const size_t r1, const size_t r2, 
-								const size_t c0, const size_t c1, const size_t c2)
+    static float MINOR(const Matrix4& m, const UINT32 r0, const UINT32 r1, const UINT32 r2, 
+								const UINT32 c0, const UINT32 c1, const UINT32 c2)
     {
         return m[r0][c0] * (m[r1][c1] * m[r2][c2] - m[r2][c1] * m[r1][c2]) -
             m[r0][c1] * (m[r1][c0] * m[r2][c2] - m[r2][c0] * m[r1][c2]) +

+ 4 - 4
CamelotUtility/Source/CmQuaternion.cpp

@@ -69,8 +69,8 @@ namespace CamelotFramework
         else
         {
             // |w| <= 1/2
-            static size_t nextLookup[3] = { 1, 2, 0 };
-            size_t i = 0;
+            static UINT32 nextLookup[3] = { 1, 2, 0 };
+            UINT32 i = 0;
 
             if (mat[1][1] > mat[0][0])
                 i = 1;
@@ -78,8 +78,8 @@ namespace CamelotFramework
             if (mat[2][2] > mat[i][i])
                 i = 2;
 
-            size_t j = nextLookup[i];
-            size_t k = nextLookup[j];
+            UINT32 j = nextLookup[i];
+            UINT32 k = nextLookup[j];
 
             root = Math::sqrt(mat[i][i]-mat[j][j]-mat[k][k] + 1.0f);
 

+ 2 - 1
Inspector.txt

@@ -26,7 +26,8 @@ Boost any replacement: http://www.codeproject.com/Articles/11250/High-Performanc
 Get rid of the CamelotFramework namespace
  - I shouldn't need to prefix each variable with CM::
 
-Fix C# interface to GUI elements
+Undocking a window wont remove the tabbed title bar
+While dragging an undocked window, dropping it over the main window (not over dock overlays) will not restore it
 
 REFACTOR c++ GUI a bit:
  - GameObjectField