Browse Source

CamelotUtility is now .dll
More work on FreeImage importer

Marko Pintera 13 years ago
parent
commit
b377957703
36 changed files with 451 additions and 306 deletions
  1. 2 2
      CamelotD3D9Renderer/CamelotD3D9Renderer.vcxproj
  2. 6 6
      CamelotFreeImgImporter/CamelotFreeImgImporter.vcxproj
  3. 25 2
      CamelotFreeImgImporter/Include/CmFreeImgImporter.h
  4. 228 166
      CamelotFreeImgImporter/Source/CmFreeImgImporter.cpp
  5. 3 0
      CamelotRenderer.sln
  6. 10 2
      CamelotRenderer/Include/CmImporter.h
  7. 30 0
      CamelotRenderer/Include/CmPrerequisites.h
  8. 3 7
      CamelotRenderer/Include/CmSpecificImporter.h
  9. 21 27
      CamelotRenderer/Source/CmImporter.cpp
  10. 12 6
      CamelotUtility/CamelotUtility.vcxproj
  11. 2 2
      CamelotUtility/Include/CmAxisAlignedBox.h
  12. 1 1
      CamelotUtility/Include/CmBox.h
  13. 2 2
      CamelotUtility/Include/CmColor.h
  14. 3 3
      CamelotUtility/Include/CmDataStream.h
  15. 2 2
      CamelotUtility/Include/CmDebug.h
  16. 1 1
      CamelotUtility/Include/CmDynLib.h
  17. 2 2
      CamelotUtility/Include/CmDynLibManager.h
  18. 10 10
      CamelotUtility/Include/CmException.h
  19. 5 0
      CamelotUtility/Include/CmFwdDeclUtil.h
  20. 2 2
      CamelotUtility/Include/CmLog.h
  21. 3 3
      CamelotUtility/Include/CmMath.h
  22. 4 4
      CamelotUtility/Include/CmMatrix3.h
  23. 2 2
      CamelotUtility/Include/CmMatrix4.h
  24. 2 2
      CamelotUtility/Include/CmPixelUtil.h
  25. 2 2
      CamelotUtility/Include/CmPlane.h
  26. 7 7
      CamelotUtility/Include/CmPlatform.h
  27. 3 3
      CamelotUtility/Include/CmPrerequisitesUtil.h
  28. 3 3
      CamelotUtility/Include/CmQuaternion.h
  29. 1 1
      CamelotUtility/Include/CmRay.h
  30. 1 1
      CamelotUtility/Include/CmSphere.h
  31. 18 0
      CamelotUtility/Include/CmStdHeaders.h
  32. 28 28
      CamelotUtility/Include/CmString.h
  33. 2 2
      CamelotUtility/Include/CmVector2.h
  34. 2 2
      CamelotUtility/Include/CmVector3.h
  35. 2 2
      CamelotUtility/Include/CmVector4.h
  36. 1 1
      CamelotUtility/Source/CmDebug.cpp

+ 2 - 2
CamelotD3D9Renderer/CamelotD3D9Renderer.vcxproj

@@ -53,7 +53,7 @@
     </ClCompile>
     </ClCompile>
     <Link>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>d3d9.lib;d3dx9.lib;DxErr.lib;dxguid.lib;CamelotRenderer.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>d3d9.lib;d3dx9.lib;DxErr.lib;dxguid.lib;CamelotRenderer.lib;CamelotUtility.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <AdditionalLibraryDirectories>C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x86;..\lib\$(Configuration);..\Dependencies\lib\Debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <AdditionalLibraryDirectories>C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x86;..\lib\$(Configuration);..\Dependencies\lib\Debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <ImportLibrary>..\lib\$(Configuration)\$(TargetName).lib</ImportLibrary>
       <ImportLibrary>..\lib\$(Configuration)\$(TargetName).lib</ImportLibrary>
     </Link>
     </Link>
@@ -71,7 +71,7 @@
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <OptimizeReferences>true</OptimizeReferences>
       <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>d3d9.lib;d3dx9.lib;DxErr.lib;dxguid.lib;CamelotRenderer.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>d3d9.lib;d3dx9.lib;DxErr.lib;dxguid.lib;CamelotRenderer.lib;CamelotUtility.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <AdditionalLibraryDirectories>C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x86;..\lib\$(Configuration);..\Dependencies\lib\Release</AdditionalLibraryDirectories>
       <AdditionalLibraryDirectories>C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x86;..\lib\$(Configuration);..\Dependencies\lib\Release</AdditionalLibraryDirectories>
       <ImportLibrary>..\lib\$(Configuration)\$(TargetName).lib</ImportLibrary>
       <ImportLibrary>..\lib\$(Configuration)\$(TargetName).lib</ImportLibrary>
     </Link>
     </Link>

+ 6 - 6
CamelotFreeImgImporter/CamelotFreeImgImporter.vcxproj

@@ -56,13 +56,13 @@
     <ClCompile>
     <ClCompile>
       <WarningLevel>Level3</WarningLevel>
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <Optimization>Disabled</Optimization>
-      <PreprocessorDefinitions>CM_FREEIMG_EXPORTS;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>CM_FREEIMG_EXPORTS;_MBCS;FREEIMAGE_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories>../CamelotRenderer/Include;../CamelotUtility/Include;./Include;./Dependencies/Include;../Dependencies/Include</AdditionalIncludeDirectories>
       <AdditionalIncludeDirectories>../CamelotRenderer/Include;../CamelotUtility/Include;./Include;./Dependencies/Include;../Dependencies/Include</AdditionalIncludeDirectories>
     </ClCompile>
     </ClCompile>
     <Link>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>CamelotRenderer.lib;FreeImaged.lib;libboost_signals-vc110-mt-gd-1_49.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>../lib/$(Configuration);./Dependencies/lib/Debug</AdditionalLibraryDirectories>
+      <AdditionalDependencies>CamelotRenderer.lib;CamelotUtility.lib;FreeImaged.lib;libboost_signals-vc110-mt-gd-1_49.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>../lib/$(Configuration);./Dependencies/lib/Debug;../Dependencies/lib/Debug</AdditionalLibraryDirectories>
       <ImportLibrary>..\lib\$(Configuration)\$(TargetName).lib</ImportLibrary>
       <ImportLibrary>..\lib\$(Configuration)\$(TargetName).lib</ImportLibrary>
     </Link>
     </Link>
   </ItemDefinitionGroup>
   </ItemDefinitionGroup>
@@ -72,15 +72,15 @@
       <Optimization>MaxSpeed</Optimization>
       <Optimization>MaxSpeed</Optimization>
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <IntrinsicFunctions>true</IntrinsicFunctions>
-      <PreprocessorDefinitions>CM_FREEIMG_EXPORTS;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>CM_FREEIMG_EXPORTS;_MBCS;FREEIMAGE_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories>../CamelotRenderer/Include;../CamelotUtility/Include;./Include;./Dependencies/Include;../Dependencies/Include</AdditionalIncludeDirectories>
       <AdditionalIncludeDirectories>../CamelotRenderer/Include;../CamelotUtility/Include;./Include;./Dependencies/Include;../Dependencies/Include</AdditionalIncludeDirectories>
     </ClCompile>
     </ClCompile>
     <Link>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <OptimizeReferences>true</OptimizeReferences>
       <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>CamelotRenderer.lib;FreeImage.lib;libboost_signals-vc110-mt-1_49.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>../lib/$(Configuration);./Dependencies/lib/Release</AdditionalLibraryDirectories>
+      <AdditionalDependencies>CamelotRenderer.lib;CamelotUtility.lib;FreeImage.lib;libboost_signals-vc110-mt-1_49.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>../lib/$(Configuration);./Dependencies/lib/Release;../Dependencies/lib/Release</AdditionalLibraryDirectories>
       <ImportLibrary>..\lib\$(Configuration)\$(TargetName).lib</ImportLibrary>
       <ImportLibrary>..\lib\$(Configuration)\$(TargetName).lib</ImportLibrary>
     </Link>
     </Link>
   </ItemDefinitionGroup>
   </ItemDefinitionGroup>

+ 25 - 2
CamelotFreeImgImporter/Include/CmFreeImgImporter.h

@@ -1,23 +1,46 @@
 #include "CmFreeImgPrerequisites.h"
 #include "CmFreeImgPrerequisites.h"
 #include "CmSpecificImporter.h"
 #include "CmSpecificImporter.h"
 #include "CmImporter.h"
 #include "CmImporter.h"
+#include "CmPixelUtil.h"
 
 
 namespace CamelotEngine
 namespace CamelotEngine
 {
 {
 	class FreeImgImporter : public SpecificImporter
 	class FreeImgImporter : public SpecificImporter
 	{
 	{
+		struct RawImageData;
+
 	public:
 	public:
 		FreeImgImporter();
 		FreeImgImporter();
 		virtual ~FreeImgImporter();
 		virtual ~FreeImgImporter();
 
 
 		/** Inherited from SpecificImporter */
 		/** Inherited from SpecificImporter */
-		virtual const std::vector<String>& extensions() const;
+		virtual bool isExtensionSupported(const String& ext) const;
+
+		/** Inherited from SpecificImporter */
+		virtual bool isMagicNumberSupported(const UINT8* magicNumPtr, UINT32 numBytes) const; 
 
 
 		/** Inherited from SpecificImporter */
 		/** Inherited from SpecificImporter */
-		virtual ResourcePtr import(const String& filePath);
+		virtual ResourcePtr import(DataStream* fileData);
 
 
 	private:
 	private:
 		vector<String>::type mExtensions;
 		vector<String>::type mExtensions;
+		std::unordered_map<String, int> mExtensionToFID;
+
+		String magicNumToExtension(const UINT8* magic, UINT32 maxBytes) const;
+		RawImageData importRawImage(DataStream* fileData);
+
+		struct RawImageData
+		{
+			RawImageData()
+				:width(0), height(0), size(0), format(PF_UNKNOWN)
+			{ }
+
+			UINT32 width;
+			UINT32 height;
+			UINT32 size;
+			PixelFormat format;
+			MemoryDataStreamPtr data;
+		};
 
 
 		class InitOnStart
 		class InitOnStart
 		{
 		{

+ 228 - 166
CamelotFreeImgImporter/Source/CmFreeImgImporter.cpp

@@ -1,10 +1,23 @@
 #include "CmFreeImgImporter.h"
 #include "CmFreeImgImporter.h"
 #include "CmResource.h"
 #include "CmResource.h"
 #include "CmDebug.h"
 #include "CmDebug.h"
-#include "CmPixelUtil.h"
+#include "CmDataStream.h"
+#include "CmPath.h"
 
 
 #include "FreeImage.h"
 #include "FreeImage.h"
 
 
+// freeimage 3.9.1~3.11.0 interoperability fix
+#ifndef FREEIMAGE_COLORORDER
+// we have freeimage 3.9.1, define these symbols in such way as 3.9.1 really work (do not use 3.11.0 definition, as color order was changed between these two versions on Apple systems)
+#define FREEIMAGE_COLORORDER_BGR	0
+#define FREEIMAGE_COLORORDER_RGB	1
+#if defined(FREEIMAGE_BIGENDIAN)
+#define FREEIMAGE_COLORORDER FREEIMAGE_COLORORDER_RGB
+#else
+#define FREEIMAGE_COLORORDER FREEIMAGE_COLORORDER_BGR
+#endif
+#endif
+
 namespace CamelotEngine
 namespace CamelotEngine
 {
 {
 	void FreeImageLoadErrorHandler(FREE_IMAGE_FORMAT fif, const char *message) 
 	void FreeImageLoadErrorHandler(FREE_IMAGE_FORMAT fif, const char *message) 
@@ -54,7 +67,11 @@ namespace CamelotEngine
 
 
 				if(findIter == mExtensions.end())
 				if(findIter == mExtensions.end())
 				{
 				{
-					mExtensions.push_back(*v);
+					String ext = *v;
+					StringUtil::toLowerCase(ext);
+
+					mExtensionToFID.insert(std::make_pair(ext, i));
+					mExtensions.push_back(ext);
 				}
 				}
 			}
 			}
 		}
 		}
@@ -68,176 +85,221 @@ namespace CamelotEngine
 		FreeImage_DeInitialise();
 		FreeImage_DeInitialise();
 	}
 	}
 
 
-	const std::vector<String>& FreeImgImporter::extensions() const
+	bool FreeImgImporter::isExtensionSupported(const String& ext) const
+	{
+		String lowerCaseExt = ext;
+		StringUtil::toLowerCase(lowerCaseExt);
+
+		return find(mExtensions.begin(), mExtensions.end(), lowerCaseExt) != mExtensions.end();
+	}
+
+	bool FreeImgImporter::isMagicNumberSupported(const UINT8* magicNumPtr, UINT32 numBytes) const
+	{
+		String ext = magicNumToExtension(magicNumPtr, numBytes);
+
+		return isExtensionSupported(ext);
+	}
+
+	String FreeImgImporter::magicNumToExtension(const UINT8* magic, UINT32 maxBytes) const
 	{
 	{
-		return mExtensions;
+		// Set error handler
+		FreeImage_SetOutputMessage(FreeImageLoadErrorHandler);
+
+		FIMEMORY* fiMem = 
+			FreeImage_OpenMemory((BYTE*)magic, static_cast<DWORD>(maxBytes));
+
+		FREE_IMAGE_FORMAT fif = FreeImage_GetFileTypeFromMemory(fiMem, (int)maxBytes);
+		FreeImage_CloseMemory(fiMem);
+
+		if (fif != FIF_UNKNOWN)
+		{
+			String ext(FreeImage_GetFormatFromFIF(fif));
+			StringUtil::toLowerCase(ext);
+			return ext;
+		}
+		else
+		{
+			return StringUtil::BLANK;
+		}
 	}
 	}
 
 
-	ResourcePtr FreeImgImporter::import(const String& filePath)
+	ResourcePtr FreeImgImporter::import(DataStream* fileData)
 	{
 	{
-		// TODO - Magic number to extension conversion? Its probably needed so I can detect file types on Linux
-		
-//		// Set error handler
-//		FreeImage_SetOutputMessage(FreeImageLoadErrorHandler);
-//
-//		// Buffer stream into memory (TODO: override IO functions instead?)
-//		MemoryDataStream memStream(input, true);
-//
-//		FIMEMORY* fiMem = 
-//			FreeImage_OpenMemory(memStream.getPtr(), static_cast<DWORD>(memStream.size()));
-//
-//		FIBITMAP* fiBitmap = FreeImage_LoadFromMemory(
-//			(FREE_IMAGE_FORMAT)mFreeImageType, fiMem);
-//		if (!fiBitmap)
-//		{
-//			CM_EXCEPT(InternalErrorException, "Error decoding image");
-//		}
-//
-//
-//		ImageData* imgData = OGRE_NEW ImageData();
-//		MemoryDataStreamPtr output;
-//
-//		imgData->depth = 1; // only 2D formats handled by this codec
-//		imgData->width = FreeImage_GetWidth(fiBitmap);
-//		imgData->height = FreeImage_GetHeight(fiBitmap);
-//		imgData->num_mipmaps = 0; // no mipmaps in non-DDS 
-//		imgData->flags = 0;
-//
-//		// Must derive format first, this may perform conversions
-//
-//		FREE_IMAGE_TYPE imageType = FreeImage_GetImageType(fiBitmap);
-//		FREE_IMAGE_COLOR_TYPE colourType = FreeImage_GetColorType(fiBitmap);
-//		unsigned bpp = FreeImage_GetBPP(fiBitmap);
-//
-//		switch(imageType)
-//		{
-//		case FIT_UNKNOWN:
-//		case FIT_COMPLEX:
-//		case FIT_UINT32:
-//		case FIT_INT32:
-//		case FIT_DOUBLE:
-//		default:
-//			CM_EXCEPT(ItemIdentityException, "Unknown or unsupported image format");
-//
-//			break;
-//		case FIT_BITMAP:
-//			// Standard image type
-//			// Perform any colour conversions for greyscale
-//			if (colourType == FIC_MINISWHITE || colourType == FIC_MINISBLACK)
-//			{
-//				FIBITMAP* newBitmap = FreeImage_ConvertToGreyscale(fiBitmap);
-//				// free old bitmap and replace
-//				FreeImage_Unload(fiBitmap);
-//				fiBitmap = newBitmap;
-//				// get new formats
-//				bpp = FreeImage_GetBPP(fiBitmap);
-//				colourType = FreeImage_GetColorType(fiBitmap);
-//			}
-//			// Perform any colour conversions for RGB
-//			else if (bpp < 8 || colourType == FIC_PALETTE || colourType == FIC_CMYK)
-//			{
-//				FIBITMAP* newBitmap = FreeImage_ConvertTo24Bits(fiBitmap);
-//				// free old bitmap and replace
-//				FreeImage_Unload(fiBitmap);
-//				fiBitmap = newBitmap;
-//				// get new formats
-//				bpp = FreeImage_GetBPP(fiBitmap);
-//				colourType = FreeImage_GetColorType(fiBitmap);
-//			}
-//
-//			// by this stage, 8-bit is greyscale, 16/24/32 bit are RGB[A]
-//			switch(bpp)
-//			{
-//			case 8:
-//				imgData->format = PF_L8;
-//				break;
-//			case 16:
-//				// Determine 555 or 565 from green mask
-//				// cannot be 16-bit greyscale since that's FIT_UINT16
-//				if(FreeImage_GetGreenMask(fiBitmap) == FI16_565_GREEN_MASK)
-//				{
-//					imgData->format = PF_R5G6B5;
-//				}
-//				else
-//				{
-//					// FreeImage doesn't support 4444 format so must be 1555
-//					imgData->format = PF_A1R5G5B5;
-//				}
-//				break;
-//			case 24:
-//				// FreeImage differs per platform
-//				//     PF_BYTE_BGR[A] for little endian (== PF_ARGB native)
-//				//     PF_BYTE_RGB[A] for big endian (== PF_RGBA native)
-//#if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_RGB
-//				imgData->format = PF_BYTE_RGB;
-//#else
-//				imgData->format = PF_BYTE_BGR;
-//#endif
-//				break;
-//			case 32:
-//#if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_RGB
-//				imgData->format = PF_BYTE_RGBA;
-//#else
-//				imgData->format = PF_BYTE_BGRA;
-//#endif
-//				break;
-//
-//
-//			};
-//			break;
-//		case FIT_UINT16:
-//		case FIT_INT16:
-//			// 16-bit greyscale
-//			imgData->format = PF_L16;
-//			break;
-//		case FIT_FLOAT:
-//			// Single-component floating point data
-//			imgData->format = PF_FLOAT32_R;
-//			break;
-//		case FIT_RGB16:
-//			imgData->format = PF_SHORT_RGB;
-//			break;
-//		case FIT_RGBA16:
-//			imgData->format = PF_SHORT_RGBA;
-//			break;
-//		case FIT_RGBF:
-//			imgData->format = PF_FLOAT32_RGB;
-//			break;
-//		case FIT_RGBAF:
-//			imgData->format = PF_FLOAT32_RGBA;
-//			break;
-//
-//
-//		};
-//
-//		unsigned char* srcData = FreeImage_GetBits(fiBitmap);
-//		unsigned srcPitch = FreeImage_GetPitch(fiBitmap);
-//
-//		// Final data - invert image and trim pitch at the same time
-//		size_t dstPitch = imgData->width * PixelUtil::getNumElemBytes(imgData->format);
-//		imgData->size = dstPitch * imgData->height;
-//		// Bind output buffer
-//		output.bind(OGRE_NEW MemoryDataStream(imgData->size));
-//
-//		uchar* pSrc;
-//		uchar* pDst = output->getPtr();
-//		for (size_t y = 0; y < imgData->height; ++y)
-//		{
-//			pSrc = srcData + (imgData->height - y - 1) * srcPitch;
-//			memcpy(pDst, pSrc, dstPitch);
-//			pDst += dstPitch;
-//		}
-//
-//
-//		FreeImage_Unload(fiBitmap);
-//		FreeImage_CloseMemory(fiMem);
-//
-//		DecodeResult ret;
-//		ret.first = output;
-//		ret.second = CodecDataPtr(imgData);
-//		return ret;
+		RawImageData imgData = importRawImage(fileData);
+		if(imgData.data == nullptr)
+			return nullptr;
 
 
 
 
 		return nullptr;
 		return nullptr;
 	}
 	}
+
+	FreeImgImporter::RawImageData FreeImgImporter::importRawImage(DataStream* fileData)
+	{
+		size_t magicLen = std::min(fileData->size(), (size_t)32);
+		UINT8 magicBuf[32];
+		fileData->read(magicBuf, magicLen);
+		// return to start
+		fileData->seek(0);
+
+		String fileExtension = magicNumToExtension(magicBuf, magicLen);
+		auto findFormat = mExtensionToFID.find(fileExtension);
+		if(findFormat == mExtensionToFID.end())
+		{
+			CM_EXCEPT(InvalidParametersException, "Type of the file provided is not supported by this importer. File type: " + fileExtension);
+		}
+
+		FREE_IMAGE_FORMAT imageFormat = (FREE_IMAGE_FORMAT)findFormat->second;
+
+		// Set error handler
+		FreeImage_SetOutputMessage(FreeImageLoadErrorHandler);
+
+		// Buffer stream into memory (TODO: override IO functions instead?)
+		MemoryDataStream memStream(fileData, true);
+
+		FIMEMORY* fiMem = FreeImage_OpenMemory(memStream.getPtr(), static_cast<DWORD>(memStream.size()));
+
+		FIBITMAP* fiBitmap = FreeImage_LoadFromMemory(
+			(FREE_IMAGE_FORMAT)imageFormat, fiMem);
+		if (!fiBitmap)
+		{
+			CM_EXCEPT(InternalErrorException, "Error decoding image");
+		}
+
+		RawImageData imageData;
+		imageData.width = FreeImage_GetWidth(fiBitmap);
+		imageData.height = FreeImage_GetHeight(fiBitmap);
+		imageData.format = PF_UNKNOWN;
+
+		// Must derive format first, this may perform conversions
+
+		FREE_IMAGE_TYPE imageType = FreeImage_GetImageType(fiBitmap);
+		FREE_IMAGE_COLOR_TYPE colourType = FreeImage_GetColorType(fiBitmap);
+		unsigned bpp = FreeImage_GetBPP(fiBitmap);
+
+		switch(imageType)
+		{
+		case FIT_UNKNOWN:
+		case FIT_COMPLEX:
+		case FIT_UINT32:
+		case FIT_INT32:
+		case FIT_DOUBLE:
+		default:
+			CM_EXCEPT(ItemIdentityException, "Unknown or unsupported image format");
+
+			break;
+		case FIT_BITMAP:
+			// Standard image type
+			// Perform any colour conversions for greyscale
+			if (colourType == FIC_MINISWHITE || colourType == FIC_MINISBLACK)
+			{
+				FIBITMAP* newBitmap = FreeImage_ConvertToGreyscale(fiBitmap);
+				// free old bitmap and replace
+				FreeImage_Unload(fiBitmap);
+				fiBitmap = newBitmap;
+				// get new formats
+				bpp = FreeImage_GetBPP(fiBitmap);
+				colourType = FreeImage_GetColorType(fiBitmap);
+			}
+			// Perform any colour conversions for RGB
+			else if (bpp < 8 || colourType == FIC_PALETTE || colourType == FIC_CMYK)
+			{
+				FIBITMAP* newBitmap = FreeImage_ConvertTo24Bits(fiBitmap);
+				// free old bitmap and replace
+				FreeImage_Unload(fiBitmap);
+				fiBitmap = newBitmap;
+				// get new formats
+				bpp = FreeImage_GetBPP(fiBitmap);
+				colourType = FreeImage_GetColorType(fiBitmap);
+			}
+
+			// by this stage, 8-bit is greyscale, 16/24/32 bit are RGB[A]
+			switch(bpp)
+			{
+			case 8:
+				imageData.format = PF_L8;
+				break;
+			case 16:
+				// Determine 555 or 565 from green mask
+				// cannot be 16-bit greyscale since that's FIT_UINT16
+				if(FreeImage_GetGreenMask(fiBitmap) == FI16_565_GREEN_MASK)
+				{
+					imageData.format = PF_R5G6B5;
+				}
+				else
+				{
+					// FreeImage doesn't support 4444 format so must be 1555
+					imageData.format = PF_A1R5G5B5;
+				}
+				break;
+			case 24:
+				// FreeImage differs per platform
+				//     PF_BYTE_BGR[A] for little endian (== PF_ARGB native)
+				//     PF_BYTE_RGB[A] for big endian (== PF_RGBA native)
+#if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_RGB
+				imageData.format = PF_BYTE_RGB;
+#else
+				imageData.format = PF_BYTE_BGR;
+#endif
+				break;
+			case 32:
+#if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_RGB
+				imageData.format = PF_BYTE_RGBA;
+#else
+				imageData.format = PF_BYTE_BGRA;
+#endif
+				break;
+
+
+			};
+			break;
+		case FIT_UINT16:
+		case FIT_INT16:
+			// 16-bit greyscale
+			imageData.format = PF_L16;
+			break;
+		case FIT_FLOAT:
+			// Single-component floating point data
+			imageData.format = PF_FLOAT32_R;
+			break;
+		case FIT_RGB16:
+			imageData.format = PF_SHORT_RGB;
+			break;
+		case FIT_RGBA16:
+			imageData.format = PF_SHORT_RGBA;
+			break;
+		case FIT_RGBF:
+			imageData.format = PF_FLOAT32_RGB;
+			break;
+		case FIT_RGBAF:
+			imageData.format = PF_FLOAT32_RGBA;
+			break;
+
+
+		};
+
+		unsigned char* srcData = FreeImage_GetBits(fiBitmap);
+		unsigned srcPitch = FreeImage_GetPitch(fiBitmap);
+
+		// Final data - invert image and trim pitch at the same time
+		size_t dstPitch = imageData.width * PixelUtil::getNumElemBytes(imageData.format);
+		size_t size = dstPitch * imageData.height;
+		// Bind output buffer
+		MemoryDataStreamPtr output(new MemoryDataStream(size));
+
+		UINT8* pSrc;
+		UINT8* pDst = output->getPtr();
+		for (size_t y = 0; y < imageData.height; ++y)
+		{
+			pSrc = srcData + (imageData.height - y - 1) * srcPitch;
+			memcpy(pDst, pSrc, dstPitch);
+			pDst += dstPitch;
+		}
+
+		FreeImage_Unload(fiBitmap);
+		FreeImage_CloseMemory(fiMem);
+
+		imageData.data = output;
+
+		return imageData;
+	}
 }
 }

+ 3 - 0
CamelotRenderer.sln

@@ -29,6 +29,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
 	EndProjectSection
 	EndProjectSection
 EndProject
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CamelotFreeImgImporter", "CamelotFreeImgImporter\CamelotFreeImgImporter.vcxproj", "{122B7A22-0C62-4B35-B661-EBF3F394EA79}"
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CamelotFreeImgImporter", "CamelotFreeImgImporter\CamelotFreeImgImporter.vcxproj", "{122B7A22-0C62-4B35-B661-EBF3F394EA79}"
+	ProjectSection(ProjectDependencies) = postProject
+		{9B21D41C-516B-43BF-9B10-E99B599C7589} = {9B21D41C-516B-43BF-9B10-E99B599C7589}
+	EndProjectSection
 EndProject
 EndProject
 Global
 Global
 	GlobalSection(SubversionScc) = preSolution
 	GlobalSection(SubversionScc) = preSolution

+ 10 - 2
CamelotRenderer/Include/CmImporter.h

@@ -45,7 +45,15 @@ namespace CamelotEngine
 		 *
 		 *
 		 * @param	extension	The extension without leading dot.
 		 * @param	extension	The extension without leading dot.
 		 */
 		 */
-		bool supportsFileType(const std::string& extension);
+		bool supportsFileType(const std::string& extension) const;
+
+		/**
+		 * @brief	Checks if we can import a file with the specified magic number.
+		 *
+		 * @param	magicNumber 	The buffer containing the magic number.
+		 * @param	magicNumSize	Size of the magic number buffer.
+		 */
+		bool supportsFileType(const UINT8* magicNumber, UINT32 magicNumSize) const;
 
 
 		/**
 		/**
 		 * @brief	Adds a new asset importer for the specified file extension. If an asset importer for that extension
 		 * @brief	Adds a new asset importer for the specified file extension. If an asset importer for that extension
@@ -58,6 +66,6 @@ namespace CamelotEngine
 		 */
 		 */
 		void registerAssetImporter(SpecificImporter* importer);
 		void registerAssetImporter(SpecificImporter* importer);
 	private:
 	private:
-		std::unordered_map<std::string, SpecificImporter*> mAssetImporters;
+		vector<SpecificImporter*>::type mAssetImporters;
 	};
 	};
 }
 }

+ 30 - 0
CamelotRenderer/Include/CmPrerequisites.h

@@ -31,6 +31,36 @@ THE SOFTWARE
 #define CM_MAX_TEXTURE_LAYERS 16
 #define CM_MAX_TEXTURE_LAYERS 16
 #define CM_MAX_MULTIPLE_RENDER_TARGETS 8
 #define CM_MAX_MULTIPLE_RENDER_TARGETS 8
 
 
+//----------------------------------------------------------------------------
+// Windows Settings
+#if CM_PLATFORM == CM_PLATFORM_WIN32
+
+// If we're not including this from a client build, specify that the stuff
+// should get exported. Otherwise, import it.
+#	if defined( CM_STATIC_LIB )
+// Linux compilers don't have symbol import/export directives.
+#   	define CM_EXPORT
+#   else
+#   	if defined( CM_EXPORTS )
+#       	define CM_EXPORT __declspec( dllexport )
+#   	else
+#           if defined( __MINGW32__ )
+#               define CM_EXPORT
+#           else
+#       	    define CM_EXPORT __declspec( dllimport )
+#           endif
+#   	endif
+#	endif
+// Win32 compilers use _DEBUG for specifying debug builds.
+// for MinGW, we set DEBUG
+#   if defined(_DEBUG) || defined(DEBUG)
+#       define CM_DEBUG_MODE 1
+#   else
+#       define CM_DEBUG_MODE 0
+#   endif
+
+#endif // CM_PLATFORM == CM_PLATFORM_WIN32
+
 namespace CamelotEngine {
 namespace CamelotEngine {
 
 
 // Pre-declare classes
 // Pre-declare classes

+ 3 - 7
CamelotRenderer/Include/CmSpecificImporter.h

@@ -18,12 +18,8 @@ namespace CamelotEngine
 		SpecificImporter() {}
 		SpecificImporter() {}
 		virtual ~SpecificImporter() {}
 		virtual ~SpecificImporter() {}
 
 
-		/**
-		 * @brief	Returns the list of extensions this importer is responsible for importing.
-		 *
-		 * @return	A list of extensions, without a leading dot.
-		 */
-		virtual const std::vector<String>& extensions() const = 0;
+		virtual bool isExtensionSupported(const String& ext) const = 0;
+		virtual bool isMagicNumberSupported(const UINT8* magicNumPtr, UINT32 numBytes) const = 0; 
 
 
 		/**
 		/**
 		 * @brief	Imports the given file.
 		 * @brief	Imports the given file.
@@ -32,6 +28,6 @@ namespace CamelotEngine
 		 *
 		 *
 		 * @return	null if it fails, otherwise the loaded object.
 		 * @return	null if it fails, otherwise the loaded object.
 		 */
 		 */
-		virtual ResourcePtr import(const String& filePath) = 0;
+		virtual ResourcePtr import(DataStream* fileData) = 0;
 	};
 	};
 }
 }

+ 21 - 27
CamelotRenderer/Source/CmImporter.cpp

@@ -10,29 +10,31 @@ namespace CamelotEngine
 	{
 	{
 		for(auto i = mAssetImporters.begin(); i != mAssetImporters.end(); ++i)
 		for(auto i = mAssetImporters.begin(); i != mAssetImporters.end(); ++i)
 		{
 		{
-			SpecificImporter* curImporter = i->second;
-			if(curImporter != nullptr)
-			{
-				const std::vector<String>& supportedExtensions = curImporter->extensions();
-				for(auto j = supportedExtensions.begin(); j != supportedExtensions.end(); ++j)
-				{
-					if(mAssetImporters[*j] == curImporter)
-						mAssetImporters[*j] = nullptr;
-				}
-
-				delete curImporter;
-			}
+			if((*i) != nullptr)
+				delete *i;
 		}
 		}
 
 
 		mAssetImporters.clear();
 		mAssetImporters.clear();
 	}
 	}
 
 
-	bool Importer::supportsFileType(const std::string& extension)
+	bool Importer::supportsFileType(const std::string& extension) const
 	{
 	{
-		auto found = mAssetImporters.find(extension);
+		for(auto iter = mAssetImporters.begin(); iter != mAssetImporters.end(); ++iter)
+		{
+			if(*iter != nullptr && (*iter)->isExtensionSupported(extension))
+				return true;
+		}
+
+		return false;
+	}
 
 
-		if(found != mAssetImporters.end())
-			return found->second != nullptr; // Even if we found it, it can still be null
+	bool Importer::supportsFileType(const UINT8* magicNumber, UINT32 magicNumSize) const
+	{
+		for(auto iter = mAssetImporters.begin(); iter != mAssetImporters.end(); ++iter)
+		{
+			if(*iter != nullptr && (*iter)->isMagicNumberSupported(magicNumber, magicNumSize))
+				return true;
+		}
 
 
 		return false;
 		return false;
 	}
 	}
@@ -53,9 +55,9 @@ namespace CamelotEngine
 			return;
 			return;
 		}
 		}
 
 
-		SpecificImporter* importer = mAssetImporters[ext];
+		//SpecificImporter* importer = mAssetImporters[ext];
 
 
-		ResourcePtr importedResource = importer->import(inputFilePath);
+		//ResourcePtr importedResource = importer->import(inputFilePath);
 
 
 		// TODO - Use AssetDatabase for loading the resource
 		// TODO - Use AssetDatabase for loading the resource
 		// TODO - Serialize the resource to output location
 		// TODO - Serialize the resource to output location
@@ -69,14 +71,6 @@ namespace CamelotEngine
 			return;
 			return;
 		}
 		}
 
 
-		const std::vector<String>& supportedExtensions = importer->extensions();
-		for(auto i = supportedExtensions.begin(); i != supportedExtensions.end(); ++i)
-		{
-			SpecificImporter* existingImporter = mAssetImporters[*i];
-			if(existingImporter != nullptr)
-				delete existingImporter;
-
-			mAssetImporters[*i] = importer;
-		}
+		mAssetImporters.push_back(importer);
 	}
 	}
 }
 }

+ 12 - 6
CamelotUtility/CamelotUtility.vcxproj

@@ -16,13 +16,13 @@
   </PropertyGroup>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
-    <ConfigurationType>StaticLibrary</ConfigurationType>
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
     <UseDebugLibraries>true</UseDebugLibraries>
     <UseDebugLibraries>true</UseDebugLibraries>
     <PlatformToolset>v110</PlatformToolset>
     <PlatformToolset>v110</PlatformToolset>
     <CharacterSet>NotSet</CharacterSet>
     <CharacterSet>NotSet</CharacterSet>
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
-    <ConfigurationType>StaticLibrary</ConfigurationType>
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
     <UseDebugLibraries>false</UseDebugLibraries>
     <UseDebugLibraries>false</UseDebugLibraries>
     <PlatformToolset>v110</PlatformToolset>
     <PlatformToolset>v110</PlatformToolset>
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <WholeProgramOptimization>true</WholeProgramOptimization>
@@ -39,20 +39,23 @@
   </ImportGroup>
   </ImportGroup>
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <OutDir>..\lib\$(Configuration)\</OutDir>
+    <OutDir>..\bin\$(Configuration)\</OutDir>
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <OutDir>..\lib\$(Configuration)\</OutDir>
+    <OutDir>..\bin\$(Configuration)\</OutDir>
   </PropertyGroup>
   </PropertyGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
     <ClCompile>
       <WarningLevel>Level3</WarningLevel>
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <Optimization>Disabled</Optimization>
       <AdditionalIncludeDirectories>./Include;../Dependencies/Include</AdditionalIncludeDirectories>
       <AdditionalIncludeDirectories>./Include;../Dependencies/Include</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>CM_EXPORTS</PreprocessorDefinitions>
+      <PreprocessorDefinitions>CM_UTILITY_EXPORTS</PreprocessorDefinitions>
     </ClCompile>
     </ClCompile>
     <Link>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ImportLibrary>..\lib\$(Configuration)\$(TargetName).lib</ImportLibrary>
+      <AdditionalDependencies>libboost_signals-vc110-mt-gd-1_49.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>../Dependencies/lib/Debug</AdditionalLibraryDirectories>
     </Link>
     </Link>
   </ItemDefinitionGroup>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@@ -61,13 +64,16 @@
       <Optimization>MaxSpeed</Optimization>
       <Optimization>MaxSpeed</Optimization>
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <IntrinsicFunctions>true</IntrinsicFunctions>
-      <PreprocessorDefinitions>CM_EXPORTS</PreprocessorDefinitions>
+      <PreprocessorDefinitions>CM_UTILITY_EXPORTS</PreprocessorDefinitions>
       <AdditionalIncludeDirectories>./Include;../Dependencies/Include</AdditionalIncludeDirectories>
       <AdditionalIncludeDirectories>./Include;../Dependencies/Include</AdditionalIncludeDirectories>
     </ClCompile>
     </ClCompile>
     <Link>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <OptimizeReferences>true</OptimizeReferences>
       <OptimizeReferences>true</OptimizeReferences>
+      <ImportLibrary>..\lib\$(Configuration)\$(TargetName).lib</ImportLibrary>
+      <AdditionalDependencies>libboost_signals-vc110-mt-1_49.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>../Dependencies/lib/Release</AdditionalLibraryDirectories>
     </Link>
     </Link>
   </ItemDefinitionGroup>
   </ItemDefinitionGroup>
   <ItemGroup>
   <ItemGroup>

+ 2 - 2
CamelotUtility/Include/CmAxisAlignedBox.h

@@ -51,7 +51,7 @@ namespace CamelotEngine {
 	for an axis-aligned bounding box (AABB) for collision and
 	for an axis-aligned bounding box (AABB) for collision and
 	visibility determination.
 	visibility determination.
 	*/
 	*/
-	class CM_EXPORT AxisAlignedBox
+	class CM_UTILITY_EXPORT AxisAlignedBox
 	{
 	{
 	public:
 	public:
 		enum Extent
 		enum Extent
@@ -352,7 +352,7 @@ namespace CamelotEngine {
 			}
 			}
 		}
 		}
 
 
-		CM_EXPORT friend std::ostream& operator<<( std::ostream& o, const AxisAlignedBox aab )
+		CM_UTILITY_EXPORT friend std::ostream& operator<<( std::ostream& o, const AxisAlignedBox aab )
 		{
 		{
 			switch (aab.mExtent)
 			switch (aab.mExtent)
 			{
 			{

+ 1 - 1
CamelotUtility/Include/CmBox.h

@@ -8,7 +8,7 @@ namespace CamelotEngine
     Note that the left, top, and front edges are included but the right, 
     Note that the left, top, and front edges are included but the right, 
     bottom and back ones are not.
     bottom and back ones are not.
     */
     */
-	struct CM_EXPORT Box
+	struct CM_UTILITY_EXPORT Box
 	{
 	{
 		size_t left, top, right, bottom, front, back;
 		size_t left, top, right, bottom, front, back;
 		/// Parameterless constructor for setting the members manually
 		/// Parameterless constructor for setting the members manually

+ 2 - 2
CamelotUtility/Include/CmColor.h

@@ -54,7 +54,7 @@ namespace CamelotEngine {
 		    transparency. In this case, 0.0 is completely transparent and 1.0 is
 		    transparency. In this case, 0.0 is completely transparent and 1.0 is
 		    fully opaque.
 		    fully opaque.
     */
     */
-    class CM_EXPORT Color
+    class CM_UTILITY_EXPORT Color
     {
     {
     public:
     public:
         static const Color ZERO;
         static const Color ZERO;
@@ -318,7 +318,7 @@ namespace CamelotEngine {
 
 
 		/** Function for writing to a stream.
 		/** Function for writing to a stream.
 		*/
 		*/
-		inline CM_EXPORT friend std::ostream& operator <<
+		inline CM_UTILITY_EXPORT friend std::ostream& operator <<
 			( std::ostream& o, const Color& c )
 			( std::ostream& o, const Color& c )
 		{
 		{
 			o << "ColourValue(" << c.r << ", " << c.g << ", " << c.b << ", " << c.a << ")";
 			o << "ColourValue(" << c.r << ", " << c.g << ", " << c.b << ", " << c.a << ")";

+ 3 - 3
CamelotUtility/Include/CmDataStream.h

@@ -58,7 +58,7 @@ namespace CamelotEngine
 		If you wish to access stream data asynchronously then you should
 		If you wish to access stream data asynchronously then you should
 		organise your own mutexes to avoid race conditions. 
 		organise your own mutexes to avoid race conditions. 
 	*/
 	*/
-	class CM_EXPORT DataStream
+	class CM_UTILITY_EXPORT DataStream
 	{
 	{
 	public:
 	public:
 		enum AccessMode
 		enum AccessMode
@@ -199,7 +199,7 @@ namespace CamelotEngine
 
 
 	/** Common subclass of DataStream for handling data from chunks of memory.
 	/** Common subclass of DataStream for handling data from chunks of memory.
 	*/
 	*/
-	class CM_EXPORT MemoryDataStream : public DataStream
+	class CM_UTILITY_EXPORT MemoryDataStream : public DataStream
 	{
 	{
 	protected:
 	protected:
         /// Pointer to the start of the data area
         /// Pointer to the start of the data area
@@ -371,7 +371,7 @@ namespace CamelotEngine
     /** Common subclass of DataStream for handling data from 
     /** Common subclass of DataStream for handling data from 
 		std::basic_istream.
 		std::basic_istream.
 	*/
 	*/
-	class CM_EXPORT FileStreamDataStream : DataStream
+	class CM_UTILITY_EXPORT FileStreamDataStream : DataStream
 	{
 	{
 	protected:
 	protected:
 		/// Reference to source stream (read)
 		/// Reference to source stream (read)

+ 2 - 2
CamelotUtility/Include/CmDebug.h

@@ -7,7 +7,7 @@ namespace CamelotEngine
 {
 {
 	class Log;
 	class Log;
 
 
-	class CM_EXPORT Debug
+	class CM_UTILITY_EXPORT Debug
 	{
 	{
 	public:
 	public:
 		void logDebug(std::string msg);
 		void logDebug(std::string msg);
@@ -22,7 +22,7 @@ namespace CamelotEngine
 		Log mLog;
 		Log mLog;
 	};
 	};
 
 
-	CM_EXPORT Debug& gDebug();
+	CM_UTILITY_EXPORT Debug& gDebug();
 
 
 	template <typename T>
 	template <typename T>
 	std::string toStr(T number)
 	std::string toStr(T number)

+ 1 - 1
CamelotUtility/Include/CmDynLib.h

@@ -72,7 +72,7 @@ namespace CamelotEngine {
         @see
         @see
             Resource
             Resource
     */
     */
-	class CM_EXPORT DynLib
+	class CM_UTILITY_EXPORT DynLib
     {
     {
 	protected:
 	protected:
 		String mName;
 		String mName;

+ 2 - 2
CamelotUtility/Include/CmDynLibManager.h

@@ -43,7 +43,7 @@ namespace CamelotEngine {
             libraries, opens them and returns references to already-open
             libraries, opens them and returns references to already-open
             libraries.
             libraries.
     */
     */
-    class CM_EXPORT DynLibManager: public Module<DynLibManager>
+    class CM_UTILITY_EXPORT DynLibManager: public Module<DynLibManager>
     {
     {
 	protected:
 	protected:
 		typedef map<String, DynLib*>::type DynLibList;
 		typedef map<String, DynLib*>::type DynLibList;
@@ -77,7 +77,7 @@ namespace CamelotEngine {
 		void unload(DynLib* lib);
 		void unload(DynLib* lib);
     };
     };
 
 
-	DynLibManager& gDynLibManager();
+	CM_UTILITY_EXPORT DynLibManager& gDynLibManager();
 	/** @} */
 	/** @} */
 	/** @} */
 	/** @} */
 }
 }

+ 10 - 10
CamelotUtility/Include/CmException.h

@@ -12,7 +12,7 @@
 
 
 namespace CamelotEngine
 namespace CamelotEngine
 {
 {
-	class CM_EXPORT Exception : public std::exception
+	class CM_UTILITY_EXPORT Exception : public std::exception
     {
     {
     protected:
     protected:
         long mLine;
         long mLine;
@@ -75,55 +75,55 @@ namespace CamelotEngine
 		const char* what() const throw() { return getFullDescription().c_str(); }
 		const char* what() const throw() { return getFullDescription().c_str(); }
     };
     };
 
 
-	class CM_EXPORT NotImplementedException : public Exception 
+	class CM_UTILITY_EXPORT NotImplementedException : public Exception 
 	{
 	{
 	public:
 	public:
 		NotImplementedException(const std::string& inDescription, const std::string& inSource, const char* inFile, long inLine)
 		NotImplementedException(const std::string& inDescription, const std::string& inSource, const char* inFile, long inLine)
 			: Exception("NotImplementedException", inDescription, inSource, inFile, inLine) {}
 			: Exception("NotImplementedException", inDescription, inSource, inFile, inLine) {}
 	};
 	};
-	class CM_EXPORT FileNotFoundException : public Exception
+	class CM_UTILITY_EXPORT FileNotFoundException : public Exception
 	{
 	{
 	public:
 	public:
 		FileNotFoundException(const std::string& inDescription, const std::string& inSource, const char* inFile, long inLine)
 		FileNotFoundException(const std::string& inDescription, const std::string& inSource, const char* inFile, long inLine)
 			: Exception("FileNotFoundException", inDescription, inSource, inFile, inLine) {}
 			: Exception("FileNotFoundException", inDescription, inSource, inFile, inLine) {}
 	};
 	};
-	class CM_EXPORT IOException : public Exception
+	class CM_UTILITY_EXPORT IOException : public Exception
 	{
 	{
 	public:
 	public:
 		IOException(const std::string& inDescription, const std::string& inSource, const char* inFile, long inLine)
 		IOException(const std::string& inDescription, const std::string& inSource, const char* inFile, long inLine)
 			: Exception("IOException", inDescription, inSource, inFile, inLine) {}
 			: Exception("IOException", inDescription, inSource, inFile, inLine) {}
 	};
 	};
-	class CM_EXPORT InvalidStateException : public Exception
+	class CM_UTILITY_EXPORT InvalidStateException : public Exception
 	{
 	{
 	public:
 	public:
 		InvalidStateException(const std::string& inDescription, const std::string& inSource, const char* inFile, long inLine)
 		InvalidStateException(const std::string& inDescription, const std::string& inSource, const char* inFile, long inLine)
 			: Exception("InvalidStateException", inDescription, inSource, inFile, inLine) {}
 			: Exception("InvalidStateException", inDescription, inSource, inFile, inLine) {}
 	};
 	};
-	class CM_EXPORT InvalidParametersException : public Exception
+	class CM_UTILITY_EXPORT InvalidParametersException : public Exception
 	{
 	{
 	public:
 	public:
 		InvalidParametersException(const std::string& inDescription, const std::string& inSource, const char* inFile, long inLine)
 		InvalidParametersException(const std::string& inDescription, const std::string& inSource, const char* inFile, long inLine)
 			: Exception("InvalidParametersException", inDescription, inSource, inFile, inLine) {}
 			: Exception("InvalidParametersException", inDescription, inSource, inFile, inLine) {}
 	};
 	};
-	class CM_EXPORT ItemIdentityException : public Exception
+	class CM_UTILITY_EXPORT ItemIdentityException : public Exception
 	{
 	{
 	public:
 	public:
 		ItemIdentityException(const std::string& inDescription, const std::string& inSource, const char* inFile, long inLine)
 		ItemIdentityException(const std::string& inDescription, const std::string& inSource, const char* inFile, long inLine)
 			: Exception("ItemIdentityException", inDescription, inSource, inFile, inLine) {}
 			: Exception("ItemIdentityException", inDescription, inSource, inFile, inLine) {}
 	};
 	};
-	class CM_EXPORT InternalErrorException : public Exception
+	class CM_UTILITY_EXPORT InternalErrorException : public Exception
 	{
 	{
 	public:
 	public:
 		InternalErrorException(const std::string& inDescription, const std::string& inSource, const char* inFile, long inLine)
 		InternalErrorException(const std::string& inDescription, const std::string& inSource, const char* inFile, long inLine)
 			: Exception("InternalErrorException", inDescription, inSource, inFile, inLine) {}
 			: Exception("InternalErrorException", inDescription, inSource, inFile, inLine) {}
 	};
 	};
-	class CM_EXPORT RenderingAPIException : public Exception
+	class CM_UTILITY_EXPORT RenderingAPIException : public Exception
 	{
 	{
 	public:
 	public:
 		RenderingAPIException(const std::string& inDescription, const std::string& inSource, const char* inFile, long inLine)
 		RenderingAPIException(const std::string& inDescription, const std::string& inSource, const char* inFile, long inLine)
 			: Exception("RenderingAPIException", inDescription, inSource, inFile, inLine) {}
 			: Exception("RenderingAPIException", inDescription, inSource, inFile, inLine) {}
 	};
 	};
-	class CM_EXPORT RuntimeAssertionException : public Exception
+	class CM_UTILITY_EXPORT RuntimeAssertionException : public Exception
 	{
 	{
 	public:
 	public:
 		RuntimeAssertionException(const std::string& inDescription, const std::string& inSource, const char* inFile, long inLine)
 		RuntimeAssertionException(const std::string& inDescription, const std::string& inSource, const char* inFile, long inLine)

+ 5 - 0
CamelotUtility/Include/CmFwdDeclUtil.h

@@ -21,4 +21,9 @@ namespace CamelotEngine {
 	class Color;
 	class Color;
 	class DynLib;
 	class DynLib;
 	class DynLibManager;
 	class DynLibManager;
+	class DataStream;
+	class MemoryDataStream;
+	class FileDataStream;
+
+	typedef std::shared_ptr<MemoryDataStream> MemoryDataStreamPtr;
 }
 }

+ 2 - 2
CamelotUtility/Include/CmLog.h

@@ -9,7 +9,7 @@ namespace CamelotEngine
 	 * @brief	A single log entry, usually used in QtLogModel as
 	 * @brief	A single log entry, usually used in QtLogModel as
 	 * 			a representation of a log entry in the Console window.
 	 * 			a representation of a log entry in the Console window.
 	 */
 	 */
-	class CM_EXPORT LogEntry
+	class CM_UTILITY_EXPORT LogEntry
 	{
 	{
 	public:
 	public:
 		LogEntry(const String& msg, const String& channel);
 		LogEntry(const String& msg, const String& channel);
@@ -26,7 +26,7 @@ namespace CamelotEngine
 	 * @brief	Used for logging messages to a file. Can also send out callbacks to
 	 * @brief	Used for logging messages to a file. Can also send out callbacks to
 	 * 			registered classes when a message is received, so they can do with it as they wish.
 	 * 			registered classes when a message is received, so they can do with it as they wish.
 	 */
 	 */
-	class CM_EXPORT Log
+	class CM_UTILITY_EXPORT Log
 	{
 	{
 	public:
 	public:
 		/**
 		/**

+ 3 - 3
CamelotUtility/Include/CmMath.h

@@ -81,7 +81,7 @@ namespace CamelotEngine
 		bool operator >= ( const Radian& r ) const { return mRad >= r.mRad; }
 		bool operator >= ( const Radian& r ) const { return mRad >= r.mRad; }
 		bool operator >  ( const Radian& r ) const { return mRad >  r.mRad; }
 		bool operator >  ( const Radian& r ) const { return mRad >  r.mRad; }
 
 
-		inline CM_EXPORT friend std::ostream& operator <<
+		inline CM_UTILITY_EXPORT friend std::ostream& operator <<
 			( std::ostream& o, const Radian& v )
 			( std::ostream& o, const Radian& v )
 		{
 		{
 			o << "Radian(" << v.valueRadians() << ")";
 			o << "Radian(" << v.valueRadians() << ")";
@@ -132,7 +132,7 @@ namespace CamelotEngine
 		bool operator >= ( const Degree& d ) const { return mDeg >= d.mDeg; }
 		bool operator >= ( const Degree& d ) const { return mDeg >= d.mDeg; }
 		bool operator >  ( const Degree& d ) const { return mDeg >  d.mDeg; }
 		bool operator >  ( const Degree& d ) const { return mDeg >  d.mDeg; }
 
 
-		inline CM_EXPORT friend std::ostream& operator <<
+		inline CM_UTILITY_EXPORT friend std::ostream& operator <<
 			( std::ostream& o, const Degree& v )
 			( std::ostream& o, const Degree& v )
 		{
 		{
 			o << "Degree(" << v.valueDegrees() << ")";
 			o << "Degree(" << v.valueDegrees() << ")";
@@ -187,7 +187,7 @@ namespace CamelotEngine
             <br>This is based on MgcMath.h from
             <br>This is based on MgcMath.h from
             <a href="http://www.geometrictools.com/">Wild Magic</a>.
             <a href="http://www.geometrictools.com/">Wild Magic</a>.
     */
     */
-    class CM_EXPORT Math 
+    class CM_UTILITY_EXPORT Math 
     {
     {
    public:
    public:
        /** The angular units used by the API. This functionality is now deprecated in favor
        /** The angular units used by the API. This functionality is now deprecated in favor

+ 4 - 4
CamelotUtility/Include/CmMatrix3.h

@@ -65,7 +65,7 @@ namespace CamelotEngine
         @par
         @par
             The coordinate system is assumed to be <b>right-handed</b>.
             The coordinate system is assumed to be <b>right-handed</b>.
     */
     */
-    class CM_EXPORT Matrix3
+    class CM_UTILITY_EXPORT Matrix3
     {
     {
     public:
     public:
         /** Default constructor.
         /** Default constructor.
@@ -146,14 +146,14 @@ namespace CamelotEngine
         Vector3 operator* (const Vector3& rkVector) const;
         Vector3 operator* (const Vector3& rkVector) const;
 
 
         // vector * matrix [1x3 * 3x3 = 1x3]
         // vector * matrix [1x3 * 3x3 = 1x3]
-        CM_EXPORT friend Vector3 operator* (const Vector3& rkVector,
+        CM_UTILITY_EXPORT friend Vector3 operator* (const Vector3& rkVector,
             const Matrix3& rkMatrix);
             const Matrix3& rkMatrix);
 
 
         // matrix * scalar
         // matrix * scalar
         Matrix3 operator* (float fScalar) const;
         Matrix3 operator* (float fScalar) const;
 
 
         // scalar * matrix
         // scalar * matrix
-        CM_EXPORT friend Matrix3 operator* (float fScalar, const Matrix3& rkMatrix);
+        CM_UTILITY_EXPORT friend Matrix3 operator* (float fScalar, const Matrix3& rkMatrix);
 
 
         // utilities
         // utilities
         Matrix3 Transpose () const;
         Matrix3 Transpose () const;
@@ -232,7 +232,7 @@ namespace CamelotEngine
 
 
 		/** Function for writing to a stream.
 		/** Function for writing to a stream.
 		*/
 		*/
-		inline CM_EXPORT friend std::ostream& operator <<
+		inline CM_UTILITY_EXPORT friend std::ostream& operator <<
 			( std::ostream& o, const Matrix3& mat )
 			( std::ostream& o, const Matrix3& mat )
 		{
 		{
 			o << "Matrix3(" << mat[0][0] << ", " << mat[0][1] << ", " << mat[0][2] << ", " 
 			o << "Matrix3(" << mat[0][0] << ", " << mat[0][1] << ", " << mat[0][2] << ", " 

+ 2 - 2
CamelotUtility/Include/CmMatrix4.h

@@ -76,7 +76,7 @@ namespace CamelotEngine
                 [ m[3][0]  m[3][1]  m[3][2]  m[3][3] ]   {1}
                 [ m[3][0]  m[3][1]  m[3][2]  m[3][3] ]   {1}
             </pre>
             </pre>
     */
     */
-    class CM_EXPORT Matrix4
+    class CM_UTILITY_EXPORT Matrix4
     {
     {
     protected:
     protected:
         /// The matrix entries, indexed by [row][col].
         /// The matrix entries, indexed by [row][col].
@@ -524,7 +524,7 @@ namespace CamelotEngine
 
 
         /** Function for writing to a stream.
         /** Function for writing to a stream.
         */
         */
-        inline CM_EXPORT friend std::ostream& operator <<
+        inline CM_UTILITY_EXPORT friend std::ostream& operator <<
             ( std::ostream& o, const Matrix4& mat )
             ( std::ostream& o, const Matrix4& mat )
         {
         {
             o << "Matrix4(";
             o << "Matrix4(";

+ 2 - 2
CamelotUtility/Include/CmPixelUtil.h

@@ -190,7 +190,7 @@ namespace CamelotEngine {
      	Pixels are stored as a succession of "depth" slices, each containing "height" rows of 
      	Pixels are stored as a succession of "depth" slices, each containing "height" rows of 
      	"width" pixels.
      	"width" pixels.
     */
     */
-    class CM_EXPORT PixelData: public Box {
+    class CM_UTILITY_EXPORT PixelData: public Box {
     public:
     public:
     	/// Parameter constructor for setting the members manually
     	/// Parameter constructor for setting the members manually
     	PixelData() {}
     	PixelData() {}
@@ -298,7 +298,7 @@ namespace CamelotEngine {
     /**
     /**
      * Some utility functions for packing and unpacking pixel data
      * Some utility functions for packing and unpacking pixel data
      */
      */
-    class CM_EXPORT PixelUtil {
+    class CM_UTILITY_EXPORT PixelUtil {
     public:
     public:
         /** Returns the size in bytes of an element of the given pixel format.
         /** Returns the size in bytes of an element of the given pixel format.
          @returns
          @returns

+ 2 - 2
CamelotUtility/Include/CmPlane.h

@@ -58,7 +58,7 @@ namespace CamelotEngine {
             respectively), and a constant (D) which is the distance along
             respectively), and a constant (D) which is the distance along
             the normal you have to go to move the plane back to the origin.
             the normal you have to go to move the plane back to the origin.
      */
      */
-    class CM_EXPORT Plane
+    class CM_UTILITY_EXPORT Plane
     {
     {
     public:
     public:
         /** Default constructor - sets everything to 0.
         /** Default constructor - sets everything to 0.
@@ -154,7 +154,7 @@ namespace CamelotEngine {
             return (rhs.d != d || rhs.normal != normal);
             return (rhs.d != d || rhs.normal != normal);
         }
         }
 
 
-        CM_EXPORT friend std::ostream& operator<< (std::ostream& o, const Plane& p);
+        CM_UTILITY_EXPORT friend std::ostream& operator<< (std::ostream& o, const Plane& p);
     };
     };
 
 
     typedef vector<Plane>::type PlaneList;
     typedef vector<Plane>::type PlaneList;

+ 7 - 7
CamelotUtility/Include/CmPlatform.h

@@ -113,15 +113,15 @@ namespace CamelotEngine {
 // should get exported. Otherwise, import it.
 // should get exported. Otherwise, import it.
 #	if defined( CM_STATIC_LIB )
 #	if defined( CM_STATIC_LIB )
 		// Linux compilers don't have symbol import/export directives.
 		// Linux compilers don't have symbol import/export directives.
-#   	define CM_EXPORT
+#   	define CM_UTILITY_EXPORT
 #   else
 #   else
-#   	if defined( CM_EXPORTS )
-#       	define CM_EXPORT __declspec( dllexport )
+#   	if defined( CM_UTILITY_EXPORTS )
+#       	define CM_UTILITY_EXPORT __declspec( dllexport )
 #   	else
 #   	else
 #           if defined( __MINGW32__ )
 #           if defined( __MINGW32__ )
-#               define CM_EXPORT
+#               define CM_UTILITY_EXPORT
 #           else
 #           else
-#       	    define CM_EXPORT __declspec( dllimport )
+#       	    define CM_UTILITY_EXPORT __declspec( dllimport )
 #           endif
 #           endif
 #   	endif
 #   	endif
 #	endif
 #	endif
@@ -141,9 +141,9 @@ namespace CamelotEngine {
 
 
 // Enable GCC symbol visibility
 // Enable GCC symbol visibility
 #   if defined( CM_GCC_VISIBILITY )
 #   if defined( CM_GCC_VISIBILITY )
-#       define CM_EXPORT  __attribute__ ((visibility("default")))
+#       define CM_UTILITY_EXPORT  __attribute__ ((visibility("default")))
 #   else
 #   else
-#       define CM_EXPORT
+#       define CM_UTILITY_EXPORT
 #   endif
 #   endif
 
 
 // A quick define to overcome different names for the same function
 // A quick define to overcome different names for the same function

+ 3 - 3
CamelotUtility/Include/CmPrerequisitesUtil.h

@@ -55,10 +55,10 @@ THE SOFTWARE
 // Useful threading defines
 // Useful threading defines
 #include "CmThreadDefines.h"
 #include "CmThreadDefines.h"
 
 
-// Forward declarations
-#include "CmFwdDeclUtil.h"
-
 // Commonly used standard headers
 // Commonly used standard headers
 #include "CmStdHeaders.h"
 #include "CmStdHeaders.h"
 
 
+// Forward declarations
+#include "CmFwdDeclUtil.h"
+
 #include "CmString.h"
 #include "CmString.h"

+ 3 - 3
CamelotUtility/Include/CmQuaternion.h

@@ -49,7 +49,7 @@ namespace CamelotEngine {
 	*/
 	*/
 	/** Implementation of a Quaternion, i.e. a rotation around an axis.
 	/** Implementation of a Quaternion, i.e. a rotation around an axis.
     */
     */
-    class CM_EXPORT Quaternion
+    class CM_UTILITY_EXPORT Quaternion
     {
     {
     public:
     public:
         inline Quaternion (
         inline Quaternion (
@@ -157,7 +157,7 @@ namespace CamelotEngine {
         Quaternion operator- (const Quaternion& rkQ) const;
         Quaternion operator- (const Quaternion& rkQ) const;
         Quaternion operator* (const Quaternion& rkQ) const;
         Quaternion operator* (const Quaternion& rkQ) const;
         Quaternion operator* (float fScalar) const;
         Quaternion operator* (float fScalar) const;
-        CM_EXPORT friend Quaternion operator* (float fScalar,
+        CM_UTILITY_EXPORT friend Quaternion operator* (float fScalar,
             const Quaternion& rkQ);
             const Quaternion& rkQ);
         Quaternion operator- () const;
         Quaternion operator- () const;
         inline bool operator== (const Quaternion& rhs) const
         inline bool operator== (const Quaternion& rhs) const
@@ -252,7 +252,7 @@ namespace CamelotEngine {
         /** Function for writing to a stream. Outputs "Quaternion(w, x, y, z)" with w,x,y,z
         /** Function for writing to a stream. Outputs "Quaternion(w, x, y, z)" with w,x,y,z
             being the member values of the quaternion.
             being the member values of the quaternion.
         */
         */
-        inline CM_EXPORT friend std::ostream& operator <<
+        inline CM_UTILITY_EXPORT friend std::ostream& operator <<
             ( std::ostream& o, const Quaternion& q )
             ( std::ostream& o, const Quaternion& q )
         {
         {
             o << "Quaternion(" << q.w << ", " << q.x << ", " << q.y << ", " << q.z << ")";
             o << "Quaternion(" << q.w << ", " << q.x << ", " << q.y << ", " << q.z << ")";

+ 1 - 1
CamelotUtility/Include/CmRay.h

@@ -42,7 +42,7 @@ namespace CamelotEngine {
 	*  @{
 	*  @{
 	*/
 	*/
 	/** Representation of a ray in space, i.e. a line with an origin and direction. */
 	/** Representation of a ray in space, i.e. a line with an origin and direction. */
-    class CM_EXPORT Ray
+    class CM_UTILITY_EXPORT Ray
     {
     {
     protected:
     protected:
         Vector3 mOrigin;
         Vector3 mOrigin;

+ 1 - 1
CamelotUtility/Include/CmSphere.h

@@ -48,7 +48,7 @@ namespace CamelotEngine {
         x^2 + y^2 + z^2 = r^2 (for sphere's centered on the origin). Engine stores spheres
         x^2 + y^2 + z^2 = r^2 (for sphere's centered on the origin). Engine stores spheres
         simply as a center point and a radius.
         simply as a center point and a radius.
     */
     */
-    class CM_EXPORT Sphere
+    class CM_UTILITY_EXPORT Sphere
     {
     {
     protected:
     protected:
         float mRadius;
         float mRadius;

+ 18 - 0
CamelotUtility/Include/CmStdHeaders.h

@@ -187,6 +187,24 @@ namespace CamelotEngine
 		typedef typename std::multimap<K, V, P> type; 
 		typedef typename std::multimap<K, V, P> type; 
 	}; 
 	}; 
 
 
+	template <typename T, typename P = std::less<T>, typename A = char > 
+	struct unordered_set 
+	{ 
+		typedef typename std::unordered_set<T, P> type;    
+	}; 
+
+	template <typename K, typename V, typename P = std::less<K>, typename A = char > 
+	struct unordered_map 
+	{ 
+		typedef typename std::unordered_map<K, V, P> type; 
+	}; 
+
+	template <typename K, typename V, typename P = std::less<K>, typename A = char > 
+	struct unordered_multimap 
+	{ 
+		typedef typename std::unordered_multimap<K, V, P> type; 
+	}; 
+
 	// TODO - Once VC2012 grows up and adds proper C++11 support, uncomment this
 	// TODO - Once VC2012 grows up and adds proper C++11 support, uncomment this
 	//template <typename T, typename A = char> 
 	//template <typename T, typename A = char> 
 	//using deque = std::deque<T, A>;    
 	//using deque = std::deque<T, A>;    

+ 28 - 28
CamelotUtility/Include/CmString.h

@@ -88,7 +88,7 @@ namespace CamelotEngine {
 	*/
 	*/
 
 
     /** Utility class for manipulating Strings.  */
     /** Utility class for manipulating Strings.  */
-    class CM_EXPORT StringUtil
+    class CM_UTILITY_EXPORT StringUtil
     {
     {
 	public:
 	public:
 		typedef StringStream StrStreamType;
 		typedef StringStream StrStreamType;
@@ -215,49 +215,49 @@ namespace CamelotEngine {
 	/** @} */
 	/** @} */
 
 
 	    /** Converts a float to a String. */
 	    /** Converts a float to a String. */
-    CM_EXPORT String toString(float val, unsigned short precision = 6, 
+    CM_UTILITY_EXPORT String toString(float val, unsigned short precision = 6, 
         unsigned short width = 0, char fill = ' ', 
         unsigned short width = 0, char fill = ' ', 
         std::ios::fmtflags flags = std::ios::fmtflags(0) );
         std::ios::fmtflags flags = std::ios::fmtflags(0) );
     /** Converts a Radian to a String. */
     /** Converts a Radian to a String. */
-    CM_EXPORT String toString(Radian val, unsigned short precision = 6, 
+    CM_UTILITY_EXPORT String toString(Radian val, unsigned short precision = 6, 
         unsigned short width = 0, char fill = ' ', 
         unsigned short width = 0, char fill = ' ', 
         std::ios::fmtflags flags = std::ios::fmtflags(0) );
         std::ios::fmtflags flags = std::ios::fmtflags(0) );
     /** Converts a Degree to a String. */
     /** Converts a Degree to a String. */
-    CM_EXPORT String toString(Degree val, unsigned short precision = 6, 
+    CM_UTILITY_EXPORT String toString(Degree val, unsigned short precision = 6, 
         unsigned short width = 0, char fill = ' ', 
         unsigned short width = 0, char fill = ' ', 
         std::ios::fmtflags flags = std::ios::fmtflags(0) );
         std::ios::fmtflags flags = std::ios::fmtflags(0) );
     /** Converts an int to a String. */
     /** Converts an int to a String. */
-    CM_EXPORT String toString(int val, unsigned short width = 0, 
+    CM_UTILITY_EXPORT String toString(int val, unsigned short width = 0, 
         char fill = ' ', 
         char fill = ' ', 
         std::ios::fmtflags flags = std::ios::fmtflags(0) );
         std::ios::fmtflags flags = std::ios::fmtflags(0) );
 #if CM_ARCH_TYPE == CM_ARCHITECTURE_64 || CM_PLATFORM == CM_PLATFORM_APPLE
 #if CM_ARCH_TYPE == CM_ARCHITECTURE_64 || CM_PLATFORM == CM_PLATFORM_APPLE
     /** Converts an unsigned int to a String. */
     /** Converts an unsigned int to a String. */
-    CM_EXPORT String toString(unsigned int val, 
+    CM_UTILITY_EXPORT String toString(unsigned int val, 
         unsigned short width = 0, char fill = ' ', 
         unsigned short width = 0, char fill = ' ', 
         std::ios::fmtflags flags = std::ios::fmtflags(0) );
         std::ios::fmtflags flags = std::ios::fmtflags(0) );
     /** Converts a size_t to a String. */
     /** Converts a size_t to a String. */
-    CM_EXPORT String toString(size_t val, 
+    CM_UTILITY_EXPORT String toString(size_t val, 
         unsigned short width = 0, char fill = ' ', 
         unsigned short width = 0, char fill = ' ', 
         std::ios::fmtflags flags = std::ios::fmtflags(0) );
         std::ios::fmtflags flags = std::ios::fmtflags(0) );
     #if CM_COMPILER == CM_COMPILER_MSVC
     #if CM_COMPILER == CM_COMPILER_MSVC
             /** Converts an unsigned long to a String. */
             /** Converts an unsigned long to a String. */
-            CM_EXPORT String toString(unsigned long val, 
+            CM_UTILITY_EXPORT String toString(unsigned long val, 
                 unsigned short width = 0, char fill = ' ', 
                 unsigned short width = 0, char fill = ' ', 
                 std::ios::fmtflags flags = std::ios::fmtflags(0) );
                 std::ios::fmtflags flags = std::ios::fmtflags(0) );
 
 
     #endif
     #endif
 #else
 #else
     /** Converts a size_t to a String. */
     /** Converts a size_t to a String. */
-    CM_EXPORT String toString(size_t val, 
+    CM_UTILITY_EXPORT String toString(size_t val, 
         unsigned short width = 0, char fill = ' ', 
         unsigned short width = 0, char fill = ' ', 
         std::ios::fmtflags flags = std::ios::fmtflags(0) );
         std::ios::fmtflags flags = std::ios::fmtflags(0) );
     /** Converts an unsigned long to a String. */
     /** Converts an unsigned long to a String. */
-    CM_EXPORT String toString(unsigned long val, 
+    CM_UTILITY_EXPORT String toString(unsigned long val, 
         unsigned short width = 0, char fill = ' ', 
         unsigned short width = 0, char fill = ' ', 
         std::ios::fmtflags flags = std::ios::fmtflags(0) );
         std::ios::fmtflags flags = std::ios::fmtflags(0) );
 #endif
 #endif
     /** Converts a long to a String. */
     /** Converts a long to a String. */
-    CM_EXPORT String toString(long val, 
+    CM_UTILITY_EXPORT String toString(long val, 
         unsigned short width = 0, char fill = ' ', 
         unsigned short width = 0, char fill = ' ', 
         std::ios::fmtflags flags = std::ios::fmtflags(0) );
         std::ios::fmtflags flags = std::ios::fmtflags(0) );
 
 
@@ -266,90 +266,90 @@ namespace CamelotEngine {
     /** Converts a boolean to a String. 
     /** Converts a boolean to a String. 
     @param yesNo If set to true, result is 'yes' or 'no' instead of 'true' or 'false'
     @param yesNo If set to true, result is 'yes' or 'no' instead of 'true' or 'false'
     */
     */
-    CM_EXPORT String toString(bool val, bool yesNo = false);
+    CM_UTILITY_EXPORT String toString(bool val, bool yesNo = false);
 	/** Converts a Vector2 to a String. 
 	/** Converts a Vector2 to a String. 
     @remarks
     @remarks
         Format is "x y" (i.e. 2x float values, space delimited)
         Format is "x y" (i.e. 2x float values, space delimited)
     */
     */
-    CM_EXPORT String toString(const Vector2& val);
+    CM_UTILITY_EXPORT String toString(const Vector2& val);
     /** Converts a Vector3 to a String. 
     /** Converts a Vector3 to a String. 
     @remarks
     @remarks
         Format is "x y z" (i.e. 3x float values, space delimited)
         Format is "x y z" (i.e. 3x float values, space delimited)
     */
     */
-    CM_EXPORT String toString(const Vector3& val);
+    CM_UTILITY_EXPORT String toString(const Vector3& val);
 	/** Converts a Vector4 to a String. 
 	/** Converts a Vector4 to a String. 
     @remarks
     @remarks
         Format is "x y z w" (i.e. 4x float values, space delimited)
         Format is "x y z w" (i.e. 4x float values, space delimited)
     */
     */
-    CM_EXPORT String toString(const Vector4& val);
+    CM_UTILITY_EXPORT String toString(const Vector4& val);
     /** Converts a Matrix3 to a String. 
     /** Converts a Matrix3 to a String. 
     @remarks
     @remarks
         Format is "00 01 02 10 11 12 20 21 22" where '01' means row 0 column 1 etc.
         Format is "00 01 02 10 11 12 20 21 22" where '01' means row 0 column 1 etc.
     */
     */
-    CM_EXPORT String toString(const Matrix3& val);
+    CM_UTILITY_EXPORT String toString(const Matrix3& val);
     /** Converts a Matrix4 to a String. 
     /** Converts a Matrix4 to a String. 
     @remarks
     @remarks
         Format is "00 01 02 03 10 11 12 13 20 21 22 23 30 31 32 33" where 
         Format is "00 01 02 03 10 11 12 13 20 21 22 23 30 31 32 33" where 
         '01' means row 0 column 1 etc.
         '01' means row 0 column 1 etc.
     */
     */
-    CM_EXPORT String toString(const Matrix4& val);
+    CM_UTILITY_EXPORT String toString(const Matrix4& val);
     /** Converts a Quaternion to a String. 
     /** Converts a Quaternion to a String. 
     @remarks
     @remarks
         Format is "w x y z" (i.e. 4x float values, space delimited)
         Format is "w x y z" (i.e. 4x float values, space delimited)
     */
     */
-    CM_EXPORT String toString(const Quaternion& val);
+    CM_UTILITY_EXPORT String toString(const Quaternion& val);
     /** Converts a ColourValue to a String. 
     /** Converts a ColourValue to a String. 
     @remarks
     @remarks
         Format is "r g b a" (i.e. 4x float values, space delimited). 
         Format is "r g b a" (i.e. 4x float values, space delimited). 
     */
     */
-    CM_EXPORT String toString(const Color& val);
+    CM_UTILITY_EXPORT String toString(const Color& val);
     /** Converts a StringVector to a string.
     /** Converts a StringVector to a string.
     @remarks
     @remarks
         Strings must not contain spaces since space is used as a delimiter in
         Strings must not contain spaces since space is used as a delimiter in
         the output.
         the output.
     */
     */
-    CM_EXPORT String toString(const std::vector<CamelotEngine::String>& val);
+    CM_UTILITY_EXPORT String toString(const std::vector<CamelotEngine::String>& val);
 
 
     /** Converts a String to a float. 
     /** Converts a String to a float. 
     @returns
     @returns
         0.0 if the value could not be parsed, otherwise the float version of the String.
         0.0 if the value could not be parsed, otherwise the float version of the String.
     */
     */
-    CM_EXPORT float parseReal(const String& val, float defaultValue = 0);
+    CM_UTILITY_EXPORT float parseReal(const String& val, float defaultValue = 0);
     /** Converts a String to a whole number. 
     /** Converts a String to a whole number. 
     @returns
     @returns
         0.0 if the value could not be parsed, otherwise the numeric version of the String.
         0.0 if the value could not be parsed, otherwise the numeric version of the String.
     */
     */
-    CM_EXPORT int parseInt(const String& val, int defaultValue = 0);
+    CM_UTILITY_EXPORT int parseInt(const String& val, int defaultValue = 0);
     /** Converts a String to a whole number. 
     /** Converts a String to a whole number. 
     @returns
     @returns
         0.0 if the value could not be parsed, otherwise the numeric version of the String.
         0.0 if the value could not be parsed, otherwise the numeric version of the String.
     */
     */
-    CM_EXPORT unsigned int parseUnsignedInt(const String& val, unsigned int defaultValue = 0);
+    CM_UTILITY_EXPORT unsigned int parseUnsignedInt(const String& val, unsigned int defaultValue = 0);
     /** Converts a String to a whole number. 
     /** Converts a String to a whole number. 
     @returns
     @returns
         0.0 if the value could not be parsed, otherwise the numeric version of the String.
         0.0 if the value could not be parsed, otherwise the numeric version of the String.
     */
     */
-    CM_EXPORT long parseLong(const String& val, long defaultValue = 0);
+    CM_UTILITY_EXPORT long parseLong(const String& val, long defaultValue = 0);
     /** Converts a String to a whole number. 
     /** Converts a String to a whole number. 
     @returns
     @returns
         0.0 if the value could not be parsed, otherwise the numeric version of the String.
         0.0 if the value could not be parsed, otherwise the numeric version of the String.
     */
     */
-    CM_EXPORT unsigned long parseUnsignedLong(const String& val, unsigned long defaultValue = 0);
+    CM_UTILITY_EXPORT unsigned long parseUnsignedLong(const String& val, unsigned long defaultValue = 0);
     /** Converts a String to a boolean. 
     /** Converts a String to a boolean. 
     @remarks
     @remarks
         Returns true if case-insensitive match of the start of the string
         Returns true if case-insensitive match of the start of the string
 		matches "true", "yes" or "1", false otherwise.
 		matches "true", "yes" or "1", false otherwise.
     */
     */
-    CM_EXPORT bool parseBool(const String& val, bool defaultValue = 0);
+    CM_UTILITY_EXPORT bool parseBool(const String& val, bool defaultValue = 0);
 
 
     /** Pareses a StringVector from a string.
     /** Pareses a StringVector from a string.
     @remarks
     @remarks
         Strings must not contain spaces since space is used as a delimiter in
         Strings must not contain spaces since space is used as a delimiter in
         the output.
         the output.
     */
     */
-    CM_EXPORT std::vector<CamelotEngine::String> parseStringVector(const String& val);
+    CM_UTILITY_EXPORT std::vector<CamelotEngine::String> parseStringVector(const String& val);
     /** Checks the String is a valid number value. */
     /** Checks the String is a valid number value. */
-    CM_EXPORT bool isNumber(const String& val);
+    CM_UTILITY_EXPORT bool isNumber(const String& val);
 	/** @} */
 	/** @} */
 
 
 } // namespace CamelotEngine
 } // namespace CamelotEngine

+ 2 - 2
CamelotUtility/Include/CmVector2.h

@@ -48,7 +48,7 @@ namespace CamelotEngine
             scaling factors can be represented by a vector, depending on how
             scaling factors can be represented by a vector, depending on how
             you interpret the values.
             you interpret the values.
     */
     */
-    class CM_EXPORT Vector2
+    class CM_UTILITY_EXPORT Vector2
     {
     {
     public:
     public:
         float x, y;
         float x, y;
@@ -558,7 +558,7 @@ namespace CamelotEngine
 
 
         /** Function for writing to a stream.
         /** Function for writing to a stream.
         */
         */
-        inline CM_EXPORT friend std::ostream& operator <<
+        inline CM_UTILITY_EXPORT friend std::ostream& operator <<
             ( std::ostream& o, const Vector2& v )
             ( std::ostream& o, const Vector2& v )
         {
         {
             o << "Vector2(" << v.x << ", " << v.y <<  ")";
             o << "Vector2(" << v.x << ", " << v.y <<  ")";

+ 2 - 2
CamelotUtility/Include/CmVector3.h

@@ -48,7 +48,7 @@ namespace CamelotEngine
             scaling factors can be represented by a vector, depending on how
             scaling factors can be represented by a vector, depending on how
             you interpret the values.
             you interpret the values.
     */
     */
-    class CM_EXPORT Vector3
+    class CM_UTILITY_EXPORT Vector3
     {
     {
     public:
     public:
 		float x, y, z;
 		float x, y, z;
@@ -782,7 +782,7 @@ namespace CamelotEngine
 
 
         /** Function for writing to a stream.
         /** Function for writing to a stream.
         */
         */
-        inline CM_EXPORT friend std::ostream& operator <<
+        inline CM_UTILITY_EXPORT friend std::ostream& operator <<
             ( std::ostream& o, const Vector3& v )
             ( std::ostream& o, const Vector3& v )
         {
         {
             o << "Vector3(" << v.x << ", " << v.y << ", " << v.z << ")";
             o << "Vector3(" << v.x << ", " << v.y << ", " << v.z << ")";

+ 2 - 2
CamelotUtility/Include/CmVector4.h

@@ -42,7 +42,7 @@ namespace CamelotEngine
 	*/
 	*/
 	/** 4-dimensional homogeneous vector.
 	/** 4-dimensional homogeneous vector.
     */
     */
-    class CM_EXPORT Vector4
+    class CM_UTILITY_EXPORT Vector4
     {
     {
     public:
     public:
         float x, y, z, w;
         float x, y, z, w;
@@ -397,7 +397,7 @@ namespace CamelotEngine
 		}
 		}
         /** Function for writing to a stream.
         /** Function for writing to a stream.
         */
         */
-        inline CM_EXPORT friend std::ostream& operator <<
+        inline CM_UTILITY_EXPORT friend std::ostream& operator <<
             ( std::ostream& o, const Vector4& v )
             ( std::ostream& o, const Vector4& v )
         {
         {
             o << "Vector4(" << v.x << ", " << v.y << ", " << v.z << ", " << v.w << ")";
             o << "Vector4(" << v.x << ", " << v.y << ", " << v.z << ", " << v.w << ")";

+ 1 - 1
CamelotUtility/Source/CmDebug.cpp

@@ -28,7 +28,7 @@ namespace CamelotEngine
 		mLog.logMsg(msg, channel);
 		mLog.logMsg(msg, channel);
 	}
 	}
 
 
-	CM_EXPORT Debug& gDebug()
+	CM_UTILITY_EXPORT Debug& gDebug()
 	{
 	{
 		static Debug debug;
 		static Debug debug;
 		return debug;
 		return debug;