Przeglądaj źródła

Added documentation

BearishSun 11 lat temu
rodzic
commit
c1724b3fbf

+ 9 - 0
CamelotUtility/Include/CmFwdDeclUtil.h

@@ -1,5 +1,7 @@
 #pragma once
 
+// Contains forward declares used as a convenience
+
 namespace CamelotFramework 
 {
 	/**
@@ -60,4 +62,11 @@ namespace CamelotFramework
 	typedef std::shared_ptr<MeshData> MeshDataPtr;
 	typedef std::shared_ptr<PixelData> PixelDataPtr;
 	typedef std::shared_ptr<GpuResourceData> GpuResourceDataPtr;
+
+	enum TypeID_Utility
+	{
+		TID_Abstract = 50, // Special type ID used for Abstract classes. Only type ID that may be used by more than one class.
+		TID_WString = 51,
+		TID_WPath = 52
+	};
 }

+ 0 - 25
CamelotUtility/Include/CmPrerequisitesUtil.h

@@ -1,28 +1,3 @@
-/*-------------------------------------------------------------------------
-This source file is a 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 <assert.h>

+ 0 - 18
CamelotUtility/Include/CmStdHeaders.h

@@ -4,20 +4,6 @@
     #define __STD_ALGORITHM
 #endif
 
-#if defined ( CM_GCC_VISIBILITY ) && (CM_PLATFORM != CM_PLATFORM_APPLE)
-/* Until libstdc++ for gcc 4.2 is released, we have to declare all
- * symbols in libstdc++.so externally visible, otherwise we end up
- * with them marked as hidden by -fvisible=hidden.
- *
- * See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20218
- *
- * Due to a more strict linker included with Xcode 4, this is disabled on Mac OS X and iOS.
- * The reason? It changes the visibility of Boost functions.  The mismatch between visibility Boost when used in the engine (default)
- * and Boost when compiled (hidden) results in mysterious link errors such as "Bad codegen, pointer diff".
- */
-#   pragma GCC visibility push(default)
-#endif
-
 #include <cassert>
 #include <cstdio>
 #include <cstdlib>
@@ -114,10 +100,6 @@ extern "C" {
 }
 #endif
 
-#if defined ( CM_GCC_VISIBILITY ) && (CM_PLATFORM != CM_PLATFORM_APPLE)
-#   pragma GCC visibility pop
-#endif
-
 namespace CamelotFramework
 {
 	// Standard containers, for easier access in my own namespace

+ 2 - 7
CamelotUtility/Include/CmTypes.h

@@ -2,6 +2,8 @@
 
 #include "CmPlatformDefines.h"
 
+// Contains commonly used types
+
 namespace CamelotFramework
 {
 	typedef char INT8;
@@ -19,11 +21,4 @@ namespace CamelotFramework
 	typedef unsigned long long UINT64;
 	typedef long long INT64;
 #endif
-
-	enum TypeID_Utility
-	{
-		TID_Abstract = 50, // Special type ID used for Abstract classes. Only type ID that may be used by more than one class.
-		TID_WString = 51,
-		TID_WPath = 52
-	};
 }

+ 19 - 29
CamelotUtility/Include/CmVector2.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	A two dimensional vector.
+	 */
     class CM_UTILITY_EXPORT Vector2
     {
     public:
@@ -54,14 +30,14 @@ namespace CamelotFramework
 			std::swap(y, other.y);
 		}
 
-		float operator[] (size_t i) const
+		float operator[] (UINT32 i) const
         {
             assert(i < 2);
 
             return *(&x+i);
         }
 
-		float& operator[] (size_t i)
+		float& operator[] (UINT32 i)
         {
             assert(i < 2);
 
@@ -370,6 +346,9 @@ namespace CamelotFramework
 			v.normalize();
 		}
 
+		/**
+		 * @brief	Normalizes the provided vector and returns a new normalized instance.
+		 */
 		static Vector2 normalize(const Vector2& val)
 		{
 			float len = Math::sqrt(val.x * val.x + val.y * val.y);
@@ -386,16 +365,27 @@ namespace CamelotFramework
 			return normalizedVec;
 		}
 
+		/**
+		 * @brief	Checks are any of the vector components NaN.
+		 */
 		bool isNaN() const
 		{
 			return Math::isNaN(x) || Math::isNaN(y);
 		}
 
+		/**
+		 * @brief	Returns the minimum of all the vector components as a 
+		 *			new vector.
+		 */
 		static Vector2 min(const Vector2& a, const Vector2& b)
 		{
 			return Vector2(std::min(a.x, b.x), std::min(a.y, b.y));
 		}
 
+		/**
+		 * @brief	Returns the maximum of all the vector components as a 
+		 *			new vector.
+		 */
 		static Vector2 max(const Vector2& a, const Vector2& b)
 		{
 			return Vector2(std::max(a.x, b.x), std::max(a.y, b.y));

+ 10 - 0
CamelotUtility/Include/CmVector2I.h

@@ -4,6 +4,10 @@
 
 namespace CamelotFramework
 {
+	/**
+	 * @brief	A two dimensional vector with integer
+	 *			coordinates.
+	 */
 	struct CM_UTILITY_EXPORT Vector2I
 	{
 		INT32 x;
@@ -21,12 +25,18 @@ namespace CamelotFramework
             :x(val), y(val)
         { }
 
+		/**
+		 * @brief	Exchange the contents of this vector with another.
+		 */
 		void swap(Vector2I& other)
 		{
 			std::swap(x, other.x);
 			std::swap(y, other.y);
 		}
 
+		/**
+		 * @brief	Returns the manhattan distance between this and another vector.
+		 */
 		UINT32 manhattanDist(const Vector2I& other)
 		{
 			return (UINT32)fabs(float(other.x - x)) + (UINT32)fabs(float(other.y - y));

+ 19 - 29
CamelotUtility/Include/CmVector3.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	A three dimensional vector.
+	 */
     class CM_UTILITY_EXPORT Vector3
     {
     public:
@@ -55,14 +31,14 @@ namespace CamelotFramework
 			std::swap(z, other.z);
 		}
 
-		float operator[] (size_t i) const
+		float operator[] (UINT32 i) const
         {
             assert(i < 3);
 
             return *(&x+i);
         }
 
-		float& operator[] (size_t i)
+		float& operator[] (UINT32 i)
         {
             assert(i < 3);
 
@@ -417,6 +393,9 @@ namespace CamelotFramework
 			vec2.normalize();
 		}
 
+		/**
+		 * @brief	Normalizes the provided vector and returns a new normalized instance.
+		 */
 		static Vector3 normalize(const Vector3& val)
 		{
 			float len = Math::sqrt(val.x * val.x + val.y * val.y + val.z * val.z);
@@ -437,16 +416,27 @@ namespace CamelotFramework
 				return val;
 		}
 
+		/**
+		 * @brief	Checks are any of the vector components NaN.
+		 */
 		bool isNaN() const
 		{
 			return Math::isNaN(x) || Math::isNaN(y) || Math::isNaN(z);
 		}
 
+		/**
+		 * @brief	Returns the minimum of all the vector components as a 
+		 *			new vector.
+		 */
 		static Vector3 min(const Vector3& a, const Vector3& b)
 		{
 			return Vector3(std::min(a.x, b.x), std::min(a.y, b.y), std::min(a.z, b.z));
 		}
 
+		/**
+		 * @brief	Returns the maximum of all the vector components as a 
+		 *			new vector.
+		 */
 		static Vector3 max(const Vector3& a, const Vector3& b)
 		{
 			return Vector3(std::max(a.x, b.x), std::max(a.y, b.y), std::max(a.z, b.z));

+ 6 - 27
CamelotUtility/Include/CmVector4.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	A four dimensional vector.
+	 */
     class CM_UTILITY_EXPORT Vector4
     {
     public:
@@ -285,6 +261,9 @@ namespace CamelotFramework
             return x * vec.x + y * vec.y + z * vec.z + w * vec.w;
         }
 
+		/**
+		 * @brief	Checks are any of the vector components NaN.
+		 */
 		bool isNaN() const
 		{
 			return Math::isNaN(x) || Math::isNaN(y) || Math::isNaN(z) || Math::isNaN(w);

+ 4 - 4
CamelotUtility/Source/CmAABox.cpp

@@ -191,14 +191,14 @@ namespace CamelotFramework
 		float s, d = 0;
 		for (int i = 0; i < 3; ++i)
 		{
-			if (center.ptr()[i] < min.ptr()[i])
+			if (center[i] < min[i])
 			{
-				s = center.ptr()[i] - min.ptr()[i];
+				s = center[i] - min[i];
 				d += s * s; 
 			}
-			else if(center.ptr()[i] > max.ptr()[i])
+			else if(center[i] > max[i])
 			{
-				s = center.ptr()[i] - max.ptr()[i];
+				s = center[i] - max[i];
 				d += s * s; 
 			}
 		}

+ 0 - 28
CamelotUtility/Source/CmVector2.cpp

@@ -1,31 +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 "CmVector2.h"
 #include "CmMath.h"
 

+ 0 - 27
CamelotUtility/Source/CmVector3.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 "CmVector3.h"
 #include "CmMath.h"
 

+ 0 - 27
CamelotUtility/Source/CmVector4.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 "CmVector4.h"
 #include "CmMath.h"