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

More documentation and slight refactor

BearishSun 11 лет назад
Родитель
Сommit
65393b4e4b

+ 62 - 94
CamelotUtility/Include/CmBitwise.h

@@ -1,50 +1,19 @@
-/*
------------------------------------------------------------------------------
-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.
------------------------------------------------------------------------------
-*/
-#ifndef _Bitwise_H__
-#define _Bitwise_H__
+#pragma once
 
 #include "CmPrerequisitesUtil.h"
 
-namespace CamelotFramework {
-	/** \addtogroup Core
-	*  @{
-	*/
-	/** \addtogroup Math
-	*  @{
-	*/
-
-    /** Class for manipulating bit patterns.
-    */
-    class Bitwise {
+namespace CamelotFramework 
+{
+    /** 
+	 * @brief	Class for manipulating bit patterns.
+     */
+    class Bitwise 
+	{
     public:
-        /** Returns the most significant bit set in a value.
-        */
-        static FORCEINLINE unsigned int mostSignificantBitSet(unsigned int value)
+		/** 
+		 * @brief	Returns the most significant bit set in a value.
+		 */
+		static FORCEINLINE unsigned int mostSignificantBitSet(unsigned int value)
         {
             unsigned int result = 0;
             while (value != 0) {
@@ -53,10 +22,10 @@ namespace CamelotFramework {
             }
             return result-1;
         }
-        /** Returns the closest power-of-two number greater or equal to value.
-            @note 0 and 1 are powers of two, so 
-                firstPO2From(0)==0 and firstPO2From(1)==1.
-        */
+
+		/** 
+		 * @brief	Returns the closest power-of-two number greater or equal to value.
+		 */
         static FORCEINLINE UINT32 firstPO2From(UINT32 n)
         {
             --n;            
@@ -68,17 +37,20 @@ namespace CamelotFramework {
             ++n;
             return n;
         }
-        /** Determines whether the number is power-of-two or not.
-            @note 0 and 1 are tread as power of two.
-        */
+
+		/** 
+		 * @brief	Determines whether the number is power-of-two or not.
+		 */
         template<typename T>
         static FORCEINLINE bool isPO2(T n)
         {
             return (n & (n-1)) == 0;
         }
-        /** Returns the number of bits a pattern must be shifted right by to
-            remove right-hand zeros.
-        */
+
+		/** 
+		 * @brief	Returns the number of bits a pattern must be shifted right by to
+         *			remove right-hand zeros.
+		 */
 		template<typename T>
         static FORCEINLINE unsigned int getBitShift(T mask)
 		{
@@ -93,11 +65,10 @@ namespace CamelotFramework {
 			return result;
 		}
 
-        /** Takes a value with a given src bit mask, and produces another
-            value with a desired bit mask.
-            @remarks
-                This routine is useful for colour conversion.
-        */
+		/** 
+		 * @brief	Takes a value with a given src bit mask, and produces another
+         *			value with a desired bit mask.
+		 */
 		template<typename SrcT, typename DestT>
         static inline DestT convertBitPattern(SrcT srcValue, SrcT srcBitMask, DestT destBitMask)
 		{
@@ -120,10 +91,10 @@ namespace CamelotFramework {
 			return (destValue << destBitShift);
 		}
 
-        /**
-         * Convert N bit colour channel value to P bits. It fills P bits with the
-         * bit pattern repeated. (this is /((1<<n)-1) in fixed point)
-         */
+		/** 
+		 * @brief	Convert N bit colour channel value to P bits. It fills P bits with the
+         *			bit pattern repeated. (this is /((1<<n)-1) in fixed point).
+		 */
         static inline unsigned int fixedToFixed(UINT32 value, unsigned int n, unsigned int p) 
         {
             if(n > p) 
@@ -144,10 +115,10 @@ namespace CamelotFramework {
             return value;    
         }
 
-        /**
-         * Convert floating point colour channel value between 0.0 and 1.0 (otherwise clamped) 
-         * to integer of a certain number of bits. Works for any value of bits between 0 and 31.
-         */
+		/** 
+		 * @brief	Convert floating point color channel value between 0.0 and 1.0 (otherwise clamped) 
+         *			to integer of a certain number of bits. Works for any value of bits between 0 and 31.
+		 */
         static inline unsigned int floatToFixed(const float value, const unsigned int bits)
         {
             if(value <= 0.0f) return 0;
@@ -155,17 +126,17 @@ namespace CamelotFramework {
             else return (unsigned int)(value * (1<<bits));     
         }
 
-        /**
-         * Fixed point to float
-         */
+		/** 
+		 * @brief	Fixed point to float.
+		 */
         static inline float fixedToFloat(unsigned value, unsigned int bits)
         {
             return (float)value/(float)((1<<bits)-1);
         }
 
-        /**
-         * Write a n*8 bits integer value to memory in native endian.
-         */
+		/** 
+		 * @brief	Write a n*8 bits integer value to memory in native endian.
+		 */
         static inline void intWrite(void *dest, const int n, const unsigned int value)
         {
             switch(n) {
@@ -191,9 +162,10 @@ namespace CamelotFramework {
                     break;                
             }        
         }
-        /**
-         * Read a n*8 bits integer value to memory in native endian.
-         */
+
+		/** 
+		 * @brief	Read a n*8 bits integer value to memory in native endian.
+		 */
         static inline unsigned int intRead(const void *src, int n) {
             switch(n) {
                 case 1:
@@ -216,17 +188,19 @@ namespace CamelotFramework {
             return 0; // ?
         }
 
-        /** Convert a float32 to a float16 (NV_half_float)
-         	Courtesy of OpenEXR
-        */
+		/** 
+		 * @brief	Convert a float32 to a float16 (NV_half_float).
+		 */
         static inline UINT16 floatToHalf(float i)
         {
             union { float f; UINT32 i; } v;
             v.f = i;
             return floatToHalfI(v.i);
         }
-		/** Converts float in UINT32 format to a a half in UINT16 format
-		*/
+
+		/** 
+		 * @brief	Converts float in UINT32 format to a a half in UINT16 format.
+		 */
         static inline UINT16 floatToHalfI(UINT32 i)
         {
             register int s =  (i >> 16) & 0x00008000;
@@ -266,18 +240,19 @@ namespace CamelotFramework {
             }
         }
         
-        /**
-         * Convert a float16 (NV_half_float) to a float32
-         * Courtesy of OpenEXR
-         */
+		/** 
+		 * @brief	Convert a float16 (NV_half_float) to a float32.
+		 */
         static inline float halfToFloat(UINT16 y)
         {
             union { float f; UINT32 i; } v;
             v.i = halfToFloatI(y);
             return v.f;
         }
-		/** Converts a half in UINT16 format to a float
-		 	in UINT32 format
+
+		/** 
+		 * @brief	Converts a half in UINT16 format to a float
+		 *			in UINT32 format.
 		 */
         static inline UINT32 halfToFloatI(UINT16 y)
         {
@@ -320,12 +295,5 @@ namespace CamelotFramework {
         
             return (s << 31) | (e << 23) | m;
         }
-         
-
     };
-	/** @} */
-	/** @} */
-
-}
-
-#endif
+}

+ 95 - 166
CamelotUtility/Include/CmColor.h

@@ -1,59 +1,18 @@
-/*
------------------------------------------------------------------------------
-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.
------------------------------------------------------------------------------
-*/
-#ifndef _COLOURVALUE_H__
-#define _COLOURVALUE_H__
+#pragma once
 
 #include "CmPrerequisitesUtil.h"
 
-namespace CamelotFramework {
-	/** \addtogroup Core
-	*  @{
-	*/
-	/** \addtogroup General
-	*  @{
-	*/
-
+namespace CamelotFramework 
+{
     typedef UINT32 RGBA;
     typedef UINT32 ARGB;
     typedef UINT32 ABGR;
 	typedef UINT32 BGRA;
 
-    /** Class representing colour.
-	    @remarks
-		    Colour is represented as 4 components, each of which is a
-		    floating-point value from 0.0 to 1.0.
-	    @par
-		    The 3 'normal' colour components are red, green and blue, a higher
-		    number indicating greater amounts of that component in the colour.
-		    The forth component is the 'alpha' value, which represents
-		    transparency. In this case, 0.0 is completely transparent and 1.0 is
-		    fully opaque.
-    */
+	/** 
+	 * @brief	Color represented as 4 components, each being a floating point value ranging from
+	 *			0 to 1. Color components are Red, Green, Blue and Alpha.
+	 */
     class CM_UTILITY_EXPORT Color
     {
     public:
@@ -64,51 +23,28 @@ namespace CamelotFramework {
         static const Color Green;
         static const Color Blue;
 
-	    explicit Color( float red = 1.0f,
-				    float green = 1.0f,
-				    float blue = 1.0f,
-				    float alpha = 1.0f ) : r(red), g(green), b(blue), a(alpha)
+	    explicit Color(float red = 1.0f, float green = 1.0f,
+				    float blue = 1.0f, float alpha = 1.0f ) 
+					:r(red), g(green), b(blue), a(alpha)
         { }
 
 	    bool operator==(const Color& rhs) const;
 	    bool operator!=(const Color& rhs) const;
 
-        float r,g,b,a;
-
-	    /** Retrieves colour as RGBA.
-	    */
 	    RGBA getAsRGBA(void) const;
-
-	    /** Retrieves colour as ARGB.
-	    */
 	    ARGB getAsARGB(void) const;
-
-		/** Retrieves colour as BGRA.
-		*/
 		BGRA getAsBGRA(void) const;
-
-		/** Retrieves colours as ABGR */
 	    ABGR getAsABGR(void) const;
 
-	    /** Sets colour as RGBA.
-	    */
         void setAsRGBA(const RGBA val);
-
-	    /** Sets colour as ARGB.
-	    */
         void setAsARGB(const ARGB val);
-
-		/** Sets colour as BGRA.
-		*/
 		void setAsBGRA(const BGRA val);
-
-	    /** Sets colour as ABGR.
-	    */
         void setAsABGR(const ABGR val);
 
-        /** Clamps colour value to the range [0, 1].
-        */
-        void saturate(void)
+		/** 
+		 * @brief	Clamps colour value to the range [0, 1].
+		 */
+        void saturate()
         {
             if (r < 0)
                 r = 0;
@@ -131,81 +67,84 @@ namespace CamelotFramework {
                 a = 1;
         }
 
-        /** As saturate, except that this colour value is unaffected and
-            the saturated colour value is returned as a copy. */
-        Color saturateCopy(void) const
+		/** 
+		 * @brief	Clamps colour value to the range [0, 1]. Returned saturated
+		 *			color as a copy.
+		 */
+        Color saturateCopy() const
         {
             Color ret = *this;
             ret.saturate();
             return ret;
         }
 
-		/// Array accessor operator
-		inline float operator [] ( const size_t i ) const
+		inline float operator[] (const UINT32 i) const
 		{
-			assert( i < 4 );
+			assert(i < 4);
 
 			return *(&r+i);
 		}
 
-		/// Array accessor operator
-		inline float& operator [] ( const size_t i )
+		inline float& operator[] (const UINT32 i)
 		{
-			assert( i < 4 );
+			assert(i < 4);
 
 			return *(&r+i);
 		}
 
-		/// Pointer accessor for direct copying
+		/** 
+		 * @brief	Pointer accessor for direct copying.
+		 */
 		inline float* ptr()
 		{
 			return &r;
 		}
-		/// Pointer accessor for direct copying
+
+		/** 
+		 * @brief	Pointer accessor for direct copying.
+		 */
 		inline const float* ptr() const
 		{
 			return &r;
 		}
 
-		
-		// arithmetic operations
-        inline Color operator + ( const Color& rkVector ) const
+        inline Color operator+ (const Color& rhs) const
         {
             Color kSum;
 
-            kSum.r = r + rkVector.r;
-            kSum.g = g + rkVector.g;
-            kSum.b = b + rkVector.b;
-            kSum.a = a + rkVector.a;
+            kSum.r = r + rhs.r;
+            kSum.g = g + rhs.g;
+            kSum.b = b + rhs.b;
+            kSum.a = a + rhs.a;
 
             return kSum;
         }
 
-        inline Color operator - ( const Color& rkVector ) const
+        inline Color operator- ( const Color& rhs) const
         {
             Color kDiff;
 
-            kDiff.r = r - rkVector.r;
-            kDiff.g = g - rkVector.g;
-            kDiff.b = b - rkVector.b;
-            kDiff.a = a - rkVector.a;
+            kDiff.r = r - rhs.r;
+            kDiff.g = g - rhs.g;
+            kDiff.b = b - rhs.b;
+            kDiff.a = a - rhs.a;
 
             return kDiff;
         }
 
-        inline Color operator * (const float fScalar ) const
+        inline Color operator* (const float rhs) const
         {
             Color kProd;
 
-            kProd.r = fScalar*r;
-            kProd.g = fScalar*g;
-            kProd.b = fScalar*b;
-            kProd.a = fScalar*a;
+            kProd.r = rhs*r;
+            kProd.g = rhs*g;
+            kProd.b = rhs*b;
+            kProd.a = rhs*a;
 
             return kProd;
         }
 
-        inline Color operator * ( const Color& rhs) const
+        inline Color operator* (const Color& rhs) const
         {
             Color kProd;
 
@@ -217,7 +156,7 @@ namespace CamelotFramework {
             return kProd;
         }
 
-        inline Color operator / ( const Color& rhs) const
+        inline Color operator/ (const Color& rhs) const
         {
             Color kProd;
 
@@ -229,13 +168,13 @@ namespace CamelotFramework {
             return kProd;
         }
 
-        inline Color operator / (const float fScalar ) const
+        inline Color operator/ (const float rhs) const
         {
-            assert( fScalar != 0.0 );
+            assert(rhs != 0.0f);
 
             Color kDiv;
 
-            float fInv = 1.0f / fScalar;
+            float fInv = 1.0f / rhs;
             kDiv.r = r * fInv;
             kDiv.g = g * fInv;
             kDiv.b = b * fInv;
@@ -244,92 +183,82 @@ namespace CamelotFramework {
             return kDiv;
         }
 
-        inline friend Color operator * (const float fScalar, const Color& rkVector )
+        inline friend Color operator* (const float lhs, const Color& rhs)
         {
-            Color kProd;
+            Color result;
 
-            kProd.r = fScalar * rkVector.r;
-            kProd.g = fScalar * rkVector.g;
-            kProd.b = fScalar * rkVector.b;
-            kProd.a = fScalar * rkVector.a;
+            result.r = lhs * rhs.r;
+            result.g = lhs * rhs.g;
+            result.b = lhs * rhs.b;
+            result.a = lhs * rhs.a;
 
             return kProd;
         }
 
-        // arithmetic updates
-        inline Color& operator += ( const Color& rkVector )
+        inline Color& operator+= (const Color& rhs)
         {
-            r += rkVector.r;
-            g += rkVector.g;
-            b += rkVector.b;
-            a += rkVector.a;
+            r += rhs.r;
+            g += rhs.g;
+            b += rhs.b;
+            a += rhs.a;
 
             return *this;
         }
 
-        inline Color& operator -= ( const Color& rkVector )
+        inline Color& operator-= (const Color& rhs)
         {
-            r -= rkVector.r;
-            g -= rkVector.g;
-            b -= rkVector.b;
-            a -= rkVector.a;
+            r -= rhs.r;
+            g -= rhs.g;
+            b -= rhs.b;
+            a -= rhs.a;
 
             return *this;
         }
 
-        inline Color& operator *= (const float fScalar )
+        inline Color& operator*= (const float rhs)
         {
-            r *= fScalar;
-            g *= fScalar;
-            b *= fScalar;
-            a *= fScalar;
+            r *= rhs;
+            g *= rhs;
+            b *= rhs;
+            a *= rhs;
+
             return *this;
         }
 
-        inline Color& operator /= (const float fScalar )
+        inline Color& operator/= (const float rhs)
         {
-            assert( fScalar != 0.0 );
+            assert(rhs != 0.0f);
 
-            float fInv = 1.0f / fScalar;
+            float fInv = 1.0f / rhs;
 
-            r *= fInv;
-            g *= fInv;
-            b *= fInv;
-            a *= fInv;
+            r *= rhs;
+            g *= rhs;
+            b *= rhs;
+            a *= rhs;
 
             return *this;
         }
 
-		/** Set a colour value from Hue, Saturation and Brightness.
-		@param hue Hue value, scaled to the [0,1] range as opposed to the 0-360
-		@param saturation Saturation level, [0,1]
-		@param brightness Brightness level, [0,1]
-		*/
+		/** 
+		 * @brief	Set a colour value from Hue, Saturation and Brightness.
+		 *
+		 * @param hue				Hue value, scaled to the [0,1] range.
+		 * @param saturation		Saturation level, [0,1].
+		 * @param brightness		Brightness level, [0,1].
+		 */
 		void setHSB(float hue, float saturation, float brightness);
 
-		/** Convert the current colour to Hue, Saturation and Brightness values. 
-		@param hue Output hue value, scaled to the [0,1] range as opposed to the 0-360
-		@param saturation Output saturation level, [0,1]
-		@param brightness Output brightness level, [0,1]
-		*/
+		/** 
+		 * @brief Convert the current color to Hue, Saturation and Brightness values. 
+		 * 
+		 * @param hue			Output hue value, scaled to the [0,1] range.
+		 * @param saturation	Output saturation level, [0,1].
+		 * @param brightness	Output brightness level, [0,1].
+		 */
 		void getHSB(float* hue, float* saturation, float* brightness) const;
 
-
-
-		/** Function for writing to a stream.
-		*/
-		inline CM_UTILITY_EXPORT friend std::ostream& operator <<
-			( std::ostream& o, const Color& c )
-		{
-			o << "ColourValue(" << c.r << ", " << c.g << ", " << c.b << ", " << c.a << ")";
-			return o;
-		}
-
+		float r, g, b, a;
     };
-	/** @} */
-	/** @} */
 
 	CM_ALLOW_MEMCPY_SERIALIZATION(Color);
-} // namespace
-
-#endif
+}

+ 70 - 106
CamelotUtility/Include/CmDataStream.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,32 +5,10 @@ THE SOFTWARE.
 
 namespace CamelotFramework 
 {
-	/** \addtogroup Core
-	*  @{
-	*/
-	/** \addtogroup Resources
-	*  @{
-	*/
-
-	/** General purpose class used for encapsulating the reading and writing of data.
-	@remarks
-		This class performs basically the same tasks as std::basic_istream, 
-		except that it does not have any formatting capabilities, and is
-		designed to be subclassed to receive data from multiple sources,
-		including libraries which have no compatibility with the STL's
-		stream interfaces. As such, this is an abstraction of a set of 
-		wrapper classes which pretend to be standard stream classes but 
-		can actually be implemented quite differently. 
-	@par
-		Generally, if a plugin or application provides an ArchiveFactory, 
-		it should also provide a DataStream subclass which will be used
-		to stream data out of that Archive implementation, unless it can 
-		use one of the common implementations included.
-	@note
-		Ogre makes no guarantees about thread safety, for performance reasons.
-		If you wish to access stream data asynchronously then you should
-		organise your own mutexes to avoid race conditions. 
-	*/
+	/**
+	 * @brief	General purpose class used for encapsulating the reading and writing of data from
+	 *			and to various sources using a common interface.
+	 */
 	class CM_UTILITY_EXPORT DataStream
 	{
 	public:
@@ -66,15 +17,7 @@ namespace CamelotFramework
 			READ = 1, 
 			WRITE = 2
 		};
-	protected:
-		/// The name (e.g. resource name) that can be used to identify the source fot his data (optional)
-		String mName;		
-        /// Size of the data in the stream (may be 0 if size cannot be determined)
-        size_t mSize;
-		/// What type of access is allowed (AccessMode)
-		UINT16 mAccess;
 
-        #define OGRE_STREAM_TEMP_SIZE 128
 	public:
 		/// Constructor for creating unnamed streams
         DataStream(UINT16 accessMode = READ) : mSize(0), mAccess(accessMode) {}
@@ -184,7 +127,15 @@ namespace CamelotFramework
         /** Close the stream; this makes further operations invalid. */
         virtual void close(void) = 0;
 		
+	protected:
+		/// The name (e.g. resource name) that can be used to identify the source fot his data (optional)
+		String mName;		
+        /// Size of the data in the stream (may be 0 if size cannot be determined)
+        size_t mSize;
+		/// What type of access is allowed (AccessMode)
+		UINT16 mAccess;
 
+        #define OGRE_STREAM_TEMP_SIZE 128
 	};
 
 	/** Shared pointer to allow data streams to be passed around without
@@ -323,40 +274,49 @@ namespace CamelotFramework
 		/** Get a pointer to the current position in the memory block this stream holds. */
 		UINT8* getCurrentPtr(void) { return mPos; }
 		
-		/** @copydoc DataStream::read
-		*/
+        /** 
+		 * @copydoc DataStream::read
+         */
 		size_t read(void* buf, size_t count);
 
-		/** @copydoc DataStream::write
-		*/
+        /** 
+		 * @copydoc DataStream::write
+         */
 		size_t write(const void* buf, size_t count);
 
-		/** @copydoc DataStream::readLine
-		*/
+        /** 
+		 * @copydoc DataStream::readLine
+         */
 		size_t readLine(char* buf, size_t maxCount, const String& delim = "\n");
 		
-		/** @copydoc DataStream::skipLine
-		*/
+        /** 
+		 * @copydoc DataStream::skipLine
+         */
 		size_t skipLine(const String& delim = "\n");
 
-		/** @copydoc DataStream::skip
-		*/
+        /** 
+		 * @copydoc DataStream::skip
+         */
 		void skip(long count);
 	
-		/** @copydoc DataStream::seek
-		*/
+        /** 
+		 * @copydoc DataStream::seek
+         */
 	    void seek( size_t pos );
 		
-		/** @copydoc DataStream::tell
-		*/
+        /** 
+		 * @copydoc DataStream::tell
+         */
 	    size_t tell(void) const;
 
-		/** @copydoc DataStream::eof
-		*/
+        /** 
+		 * @copydoc DataStream::eof
+         */
 	    bool eof(void) const;
 
-        /** @copydoc DataStream::close
-        */
+        /** 
+		 * @copydoc DataStream::close
+         */
         void close(void);
 
 		/** Sets whether or not to free the encapsulated memory on close. */
@@ -459,41 +419,45 @@ namespace CamelotFramework
 
 		~FileDataStream();
 
-		/** @copydoc DataStream::read
-		*/
+        /** 
+		 * @copydoc DataStream::read
+         */
 		size_t read(void* buf, size_t count);
 
-		/** @copydoc DataStream::write
-		*/
+        /** 
+		 * @copydoc DataStream::write
+         */
 		size_t write(const void* buf, size_t count);
 
-		/** @copydoc DataStream::readLine
-		*/
+        /** 
+		 * @copydoc DataStream::readLine
+         */
         size_t readLine(char* buf, size_t maxCount, const String& delim = "\n");
 		
-		/** @copydoc DataStream::skip
-		*/
+        /** 
+		 * @copydoc DataStream::skip
+         */
 		void skip(long count);
 	
-		/** @copydoc DataStream::seek
-		*/
-	    void seek( size_t pos );
-
-		/** @copydoc DataStream::tell
-		*/
-		size_t tell(void) const;
-
-		/** @copydoc DataStream::eof
-		*/
-	    bool eof(void) const;
-
-        /** @copydoc DataStream::close
-        */
-        void close(void);
-		
-		
+        /** 
+		 * @copydoc DataStream::seek
+         */
+	    void seek(size_t pos);
+
+        /** 
+		 * @copydoc DataStream::tell
+         */
+		size_t tell() const;
+
+        /** 
+		 * @copydoc DataStream::eof
+         */
+	    bool eof() const;
+
+        /** 
+		 * @copydoc DataStream::close
+         */
+        void close();
 	};
-
-	/** @} */
 }
 

+ 28 - 0
CamelotUtility/Include/CmDebug.h

@@ -7,17 +7,45 @@ namespace CamelotFramework
 {
 	class Log;
 
+	/**
+	 * @brief	Utility class providing various debug functionality. Thread safe.
+	 */
 	class CM_UTILITY_EXPORT Debug
 	{
 	public:
+		/**
+		 * @brief	Adds a log entry in the "Debug" channel.
+		 */
 		void logDebug(const String& msg);
+
+		/**
+		 * @brief	Adds a log entry in the "Info" channel.
+		 */
 		void logInfo(const String& msg);
+
+		/**
+		 * @brief	Adds a log entry in the "Warning" channel.
+		 */
 		void logWarning(const String& msg);
+
+		/**
+		 * @brief	Adds a log entry in the "Error" channel.
+		 */
 		void logError(const String& msg);
+
+		/**
+		 * @brief	Adds a log entry in the specified channel. You may specify custom channels as needed.
+		 */
 		void log(const String& msg, const String& channel);
 
+		/**
+		 * @brief	Retrieves the Log used by the Debug instance.
+		 */
 		Log& getLog() { return mLog; }
 
+		/**
+		 * @brief	Converts raw pixels into a BMP image. See "BitmapWriter" for more information.
+		 */
 		void writeAsBMP(UINT8* rawPixels, UINT32 bytesPerPixel, UINT32 width, UINT32 height, const WString& filePath, bool overwrite = true) const;
 
 	private:

+ 38 - 81
CamelotUtility/Include/CmDynLib.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"
@@ -53,70 +26,54 @@ typedef struct HINSTANCE__* hInstance;
 
 #endif
 
-namespace CamelotFramework {
-	/** \addtogroup Core
-	*  @{
-	*/
-	/** \addtogroup General
-	*  @{
-	*/
-
-    /** Resource holding data about a dynamic library.
-        @remarks
-            This class holds the data required to get symbols from
-            libraries loaded at run-time (i.e. from DLL's for so's)
-        @author
-            Adrian Cearn„u ([email protected])
-        @since
-            27 January 2002
-        @see
-            Resource
-    */
+namespace CamelotFramework 
+{
+    /** 
+	 * @brief	Class that holds data about a dynamic library.
+	 */
 	class CM_UTILITY_EXPORT DynLib
     {
-	protected:
-		String mName;
-        /// Gets the last loading error
-        String dynlibError(void);
+
     public:
-        /** Default constructor - used by DynLibManager.
-            @warning
-                Do not call directly
-        */
-        DynLib( const String& name );
-
-        /** Default destructor.
-        */
         ~DynLib();
 
-        /** Load the library
-        */
+		/** 
+		 * @brief	Loads the library. Does nothing if library is already loaded.
+		 */
         void load();
-        /** Unload the library
-        */
+
+		/**
+		 * @brief	Unloads the library. Does nothing if library is not loaded.
+		 */
         void unload();
-		/// Get the name of the library
-		const String& getName(void) const { return mName; }
+
+		/** 
+		 * @brief	Get the name of the library.
+		 */
+		const String& getName() const { return mName; }
 
         /**
-            Returns the address of the given symbol from the loaded library.
-            @param
-                strName The name of the symbol to search for
-            @returns
-                If the function succeeds, the returned value is a handle to
-                the symbol.
-            @par
-                If the function fails, the returned value is <b>NULL</b>.
-
-        */
-        void* getSymbol( const String& strName ) const throw();
+		 * @brief	Returns the address of the given symbol from the loaded library.
+		 *
+		 * @param strName	The name of the symbol to search for.
+		 *
+         * @returns		If the function succeeds, the returned value is a handle to
+		 *				the symbol. Otherwise null.
+         */
+        void* getSymbol(const String& strName) const;
 
-    protected:
+	protected:
+		friend class DynLibManager;
 
-        /// Handle to the loaded library.
-        DYNLIB_HANDLE m_hInst;
-    };
-	/** @} */
-	/** @} */
+		DynLib(const String& name);
+
+		/** 
+		 * @brief	Gets the last loading error.
+		 */
+        String dynlibError();
 
+    protected:
+		String mName;
+        DYNLIB_HANDLE m_hInst; // Handle to the loaded library.
+    };
 }

+ 7 - 1
CamelotUtility/Include/CmVector2.h

@@ -43,12 +43,18 @@ namespace CamelotFramework
 
             return *(&x+i);
         }
-
+		
+		/** 
+		 * @brief	Pointer accessor for direct copying.
+		 */
 		float* ptr()
 		{
 			return &x;
 		}
 
+		/** 
+		 * @brief	Pointer accessor for direct copying.
+		 */
 		const float* ptr() const
 		{
 			return &x;

+ 6 - 0
CamelotUtility/Include/CmVector3.h

@@ -45,11 +45,17 @@ namespace CamelotFramework
             return *(&x+i);
         }
 
+		/** 
+		 * @brief	Pointer accessor for direct copying.
+		 */
 		float* ptr()
 		{
 			return &x;
 		}
 
+		/** 
+		 * @brief	Pointer accessor for direct copying.
+		 */
 		const float* ptr() const
 		{
 			return &x;

+ 8 - 2
CamelotUtility/Include/CmVector4.h

@@ -32,25 +32,31 @@ namespace CamelotFramework
 			std::swap(w, other.w);
 		}
 	
-		float operator[] (size_t i) const
+		float operator[] (UINT32 i) const
         {
             assert (i < 4);
 
             return *(&x+i);
         }
 
-		float& operator[] (size_t i)
+		float& operator[] (UINT32 i)
         {
             assert(i < 4);
 
             return *(&x+i);
         }
 
+		/** 
+		 * @brief	Pointer accessor for direct copying.
+		 */
 		float* ptr()
 		{
 			return &x;
 		}
 
+		/** 
+		 * @brief	Pointer accessor for direct copying.
+		 */
 		const float* ptr() const
 		{
 			return &x;

+ 4 - 9
CamelotUtility/Source/CmColor.cpp

@@ -10,7 +10,7 @@ namespace CamelotFramework
     const Color Color::Green = Color(0.0,1.0,0.0);
     const Color Color::Blue = Color(0.0,0.0,1.0);
 
-    ABGR Color::getAsABGR(void) const
+    ABGR Color::getAsABGR() const
     {
         UINT8 val8;
         UINT32 val32 = 0;
@@ -37,7 +37,7 @@ namespace CamelotFramework
         return val32;
     }
 
-    BGRA Color::getAsBGRA(void) const
+    BGRA Color::getAsBGRA() const
     {
         UINT8 val8;
         UINT32 val32 = 0;
@@ -61,11 +61,10 @@ namespace CamelotFramework
         val8 = static_cast<UINT8>(b * 255);
         val32 += val8;
 
-
         return val32;
     }
 
-	ARGB Color::getAsARGB(void) const
+	ARGB Color::getAsARGB() const
 	{
 		UINT8 val8;
 		UINT32 val32 = 0;
@@ -93,7 +92,7 @@ namespace CamelotFramework
 		return val32;
 	}
 
-    RGBA Color::getAsRGBA(void) const
+    RGBA Color::getAsRGBA() const
     {
         UINT8 val8;
         UINT32 val32 = 0;
@@ -246,7 +245,6 @@ namespace CamelotFramework
 			return;
 		}
 
-
 		float hueDomain  = hue * 6.0f;
 		if (hueDomain >= 6.0f)
 		{
@@ -297,13 +295,10 @@ namespace CamelotFramework
 			b = f2;
 			break;
 		}
-
-
 	}
 
 	void Color::getHSB(float* hue, float* saturation, float* brightness) const
 	{
-
 		float vMin = std::min(r, std::min(g, b));
 		float vMax = std::max(r, std::max(g, b));
 		float delta = vMax - vMin;

+ 3 - 6
CamelotUtility/Source/CmDataStream.cpp

@@ -139,7 +139,7 @@ namespace CamelotFramework
         return total;
     }
 
-    String DataStream::getAsString(void)
+    String DataStream::getAsString()
     {
         // Read the entire buffer - ideally in one read, but if the size of
         // the buffer is unknown, do multiple fixed size reads.
@@ -345,8 +345,7 @@ namespace CamelotFramework
 		return written;
 	}
 
-    size_t MemoryDataStream::readLine(char* buf, size_t maxCount, 
-        const String& delim)
+    size_t MemoryDataStream::readLine(char* buf, size_t maxCount, const String& delim)
     {
         // Deal with both Unix & Windows LFs
 		bool trimCR = false;
@@ -434,7 +433,6 @@ namespace CamelotFramework
             free(mData);
             mData = 0;
         }
-
     }
 
     FileDataStream::FileDataStream(std::shared_ptr<std::ifstream> s, bool freeOnClose)
@@ -532,8 +530,7 @@ namespace CamelotFramework
 		return written;
 	}
 
-    size_t FileDataStream::readLine(char* buf, size_t maxCount, 
-        const String& delim)
+    size_t FileDataStream::readLine(char* buf, size_t maxCount,  const String& delim)
     {
 		if (delim.empty())
 		{

+ 19 - 12
CamelotUtility/Source/CmDynLib.cpp

@@ -1,5 +1,4 @@
 #include "CmDynLib.h"
-
 #include "CmException.h"
 
 #if CM_PLATFORM == CM_PLATFORM_WIN32
@@ -17,7 +16,7 @@
 
 namespace CamelotFramework 
 {
-    DynLib::DynLib( const String& name )
+    DynLib::DynLib(const String& name)
     {
         mName = name;
         m_hInst = NULL;
@@ -29,6 +28,9 @@ namespace CamelotFramework
 
     void DynLib::load()
     {
+		if(m_hInst)
+			return;
+
 		String name = mName;
 #if CM_PLATFORM == CM_PLATFORM_LINUX
         // dlopen() does not add .so to the filename, like windows does for .dll
@@ -44,33 +46,38 @@ namespace CamelotFramework
 		if (name.substr(name.length() - 4, 4) != ".dll")
 			name += ".dll";
 #endif
-        m_hInst = (DYNLIB_HANDLE)DYNLIB_LOAD( name.c_str() );
+        m_hInst = (DYNLIB_HANDLE)DYNLIB_LOAD(name.c_str());
 
-        if( !m_hInst )
+        if(!m_hInst)
 		{
-            CM_EXCEPT(InternalErrorException, 
-                "Could not load dynamic library " + mName + 
+            CM_EXCEPT(InternalErrorException,  
+				"Could not load dynamic library " + mName + 
                 ".  System Error: " + dynlibError());
 		}
     }
 
     void DynLib::unload()
     {
-        if( DYNLIB_UNLOAD( m_hInst ) )
+		if(!m_hInst)
+			return;
+
+        if(DYNLIB_UNLOAD(m_hInst))
 		{
 			CM_EXCEPT(InternalErrorException, 
                 "Could not unload dynamic library " + mName +
                 ".  System Error: " + dynlibError());
 		}
-
     }
 
-    void* DynLib::getSymbol( const String& strName ) const throw()
+    void* DynLib::getSymbol(const String& strName) const
     {
-        return (void*)DYNLIB_GETSYM( m_hInst, strName.c_str() );
+		if(!m_hInst)
+			return nullptr;
+
+        return (void*)DYNLIB_GETSYM(m_hInst, strName.c_str());
     }
 
-    String DynLib::dynlibError( void ) 
+    String DynLib::dynlibError() 
     {
 #if CM_PLATFORM == CM_PLATFORM_WIN32
         LPVOID lpMsgBuf; 
@@ -87,7 +94,7 @@ namespace CamelotFramework
             ); 
         String ret = (char*)lpMsgBuf;
         // Free the buffer.
-        LocalFree( lpMsgBuf );
+        LocalFree(lpMsgBuf);
         return ret;
 #elif CM_PLATFORM == CM_PLATFORM_LINUX || CM_PLATFORM == CM_PLATFORM_APPLE
         return String(dlerror());