فهرست منبع

Updated import system to make updating a resource (without creating a brand new one) easier

Marko Pintera 11 سال پیش
والد
کامیت
ceeed54f18
34فایلهای تغییر یافته به همراه175 افزوده شده و 65 حذف شده
  1. 1 1
      BansheeEngine/Source/BsCamera.cpp
  2. 2 2
      BansheeEngine/Source/BsGUIManager.cpp
  3. 9 1
      CamelotClient/Source/BsProjectLibrary.cpp
  4. 1 1
      CamelotCore/Include/CmCoreObject.h
  5. 3 2
      CamelotCore/Include/CmFont.h
  6. 1 1
      CamelotCore/Include/CmFontManager.h
  7. 1 0
      CamelotCore/Include/CmGpuProgInclude.h
  8. 1 1
      CamelotCore/Include/CmGpuProgIncludeImporter.h
  9. 1 1
      CamelotCore/Include/CmGpuProgramImporter.h
  10. 3 0
      CamelotCore/Include/CmHighLevelGpuProgram.h
  11. 8 0
      CamelotCore/Include/CmImporter.h
  12. 11 0
      CamelotCore/Include/CmMesh.h
  13. 9 9
      CamelotCore/Include/CmResourceHandle.h
  14. 1 1
      CamelotCore/Include/CmResourceHandleRTTI.h
  15. 1 1
      CamelotCore/Include/CmSpecificImporter.h
  16. 8 0
      CamelotCore/Include/CmTexture.h
  17. 1 1
      CamelotCore/Source/CmCoreObject.cpp
  18. 8 3
      CamelotCore/Source/CmFont.cpp
  19. 1 1
      CamelotCore/Source/CmFontManager.cpp
  20. 6 1
      CamelotCore/Source/CmGpuProgInclude.cpp
  21. 2 4
      CamelotCore/Source/CmGpuProgIncludeImporter.cpp
  22. 3 3
      CamelotCore/Source/CmGpuProgramImporter.cpp
  23. 11 7
      CamelotCore/Source/CmHighLevelGpuProgram.cpp
  24. 30 2
      CamelotCore/Source/CmImporter.cpp
  25. 21 3
      CamelotCore/Source/CmMesh.cpp
  26. 2 2
      CamelotCore/Source/CmResourceHandle.cpp
  27. 1 1
      CamelotCore/Source/CmResources.cpp
  28. 16 2
      CamelotCore/Source/CmTexture.cpp
  29. 1 1
      CamelotFBXImporter/Include/CmFBXImporter.h
  30. 2 3
      CamelotFBXImporter/Source/CmFBXImporter.cpp
  31. 1 1
      CamelotFontImporter/Include/CmFontImporter.h
  32. 2 2
      CamelotFontImporter/Source/CmFontImporter.cpp
  33. 1 1
      CamelotFreeImgImporter/Include/CmFreeImgImporter.h
  34. 5 6
      CamelotFreeImgImporter/Source/CmFreeImgImporter.cpp

+ 1 - 1
BansheeEngine/Source/BsCamera.cpp

@@ -93,7 +93,7 @@ namespace BansheeEngine
     }
     }
 	void Camera::initialize(RenderTargetPtr target, float left, float top, float width, float height)
 	void Camera::initialize(RenderTargetPtr target, float left, float top, float width, float height)
 	{
 	{
-		target->synchonize();
+		target->synchronize();
 
 
 		mViewport = cm_shared_ptr<Viewport, PoolAlloc>(target, left, top, width, height);
 		mViewport = cm_shared_ptr<Viewport, PoolAlloc>(target, left, top, width, height);
 	}
 	}

+ 2 - 2
BansheeEngine/Source/BsGUIManager.cpp

@@ -581,7 +581,7 @@ namespace BansheeEngine
 		if(mCaretTexture == nullptr)
 		if(mCaretTexture == nullptr)
 		{
 		{
 			HTexture newTex = Texture::create(TEX_TYPE_2D, 1, 1, 0, PF_R8G8B8A8);
 			HTexture newTex = Texture::create(TEX_TYPE_2D, 1, 1, 0, PF_R8G8B8A8);
-			newTex->synchonize(); // TODO - Required due to a bug in allocateSubresourceBuffer
+			newTex->synchronize(); // TODO - Required due to a bug in allocateSubresourceBuffer
 			mCaretTexture = SpriteTexture::create(newTex);
 			mCaretTexture = SpriteTexture::create(newTex);
 		}
 		}
 
 
@@ -599,7 +599,7 @@ namespace BansheeEngine
 		if(mTextSelectionTexture == nullptr)
 		if(mTextSelectionTexture == nullptr)
 		{
 		{
 			HTexture newTex = Texture::create(TEX_TYPE_2D, 1, 1, 0, PF_R8G8B8A8);
 			HTexture newTex = Texture::create(TEX_TYPE_2D, 1, 1, 0, PF_R8G8B8A8);
-			newTex->synchonize(); // TODO - Required due to a bug in allocateSubresourceBuffer
+			newTex->synchronize(); // TODO - Required due to a bug in allocateSubresourceBuffer
 			mTextSelectionTexture = SpriteTexture::create(newTex);
 			mTextSelectionTexture = SpriteTexture::create(newTex);
 		}
 		}
 
 

+ 9 - 1
CamelotClient/Source/BsProjectLibrary.cpp

@@ -349,14 +349,21 @@ namespace BansheeEditor
 			else
 			else
 				importOptions = Importer::instance().createImportOptions(resource->path);
 				importOptions = Importer::instance().createImportOptions(resource->path);
 
 
-			HResource importedResource = Importer::instance().import(resource->path, importOptions);
+			HResource importedResource;
 
 
 			if(resource->meta == nullptr)
 			if(resource->meta == nullptr)
 			{
 			{
+				importedResource = Importer::instance().import(resource->path, importOptions);
+
 				resource->meta = ResourceMeta::create(importedResource.getUUID(), importOptions);
 				resource->meta = ResourceMeta::create(importedResource.getUUID(), importOptions);
 				FileSerializer fs;
 				FileSerializer fs;
 				fs.encode(resource->meta.get(), metaPath);
 				fs.encode(resource->meta.get(), metaPath);
 			}
 			}
+			else
+			{
+				importedResource = HResource(resource->meta->getUUID());
+				Importer::instance().reimport(importedResource, resource->path, importOptions);
+			}
 
 
 			WString internalResourcesPath = Path::combine(EditorApplication::instance().getActiveProjectPath(), INTERNAL_RESOURCES_DIR);
 			WString internalResourcesPath = Path::combine(EditorApplication::instance().getActiveProjectPath(), INTERNAL_RESOURCES_DIR);
 			if(!FileSystem::isDirectory(internalResourcesPath))
 			if(!FileSystem::isDirectory(internalResourcesPath))
@@ -365,6 +372,7 @@ namespace BansheeEditor
 			internalResourcesPath = Path::combine(internalResourcesPath, toWString(importedResource.getUUID()) + L".asset");
 			internalResourcesPath = Path::combine(internalResourcesPath, toWString(importedResource.getUUID()) + L".asset");
 
 
 			gResources().save(importedResource, internalResourcesPath, true);
 			gResources().save(importedResource, internalResourcesPath, true);
+			gResources().unload(importedResource);
 
 
 			ResourceManifestPtr manifest = gResources().getResourceManifest();
 			ResourceManifestPtr manifest = gResources().getResourceManifest();
 			manifest->registerResource(importedResource.getUUID(), internalResourcesPath);
 			manifest->registerResource(importedResource.getUUID(), internalResourcesPath);

+ 1 - 1
CamelotCore/Include/CmCoreObject.h

@@ -57,7 +57,7 @@ o		 *
 		 * @brief	Blocks the current thread until the resource is fully initialized.
 		 * @brief	Blocks the current thread until the resource is fully initialized.
 		 * 			If you call this without calling initialize first a deadlock will occurr.
 		 * 			If you call this without calling initialize first a deadlock will occurr.
 		 */
 		 */
-		void synchonize();
+		void synchronize();
 
 
 		/**
 		/**
 		 * @brief	Sets a shared this pointer to this object. This MUST be called immediately after construction.
 		 * @brief	Sets a shared this pointer to this object. This MUST be called immediately after construction.

+ 3 - 2
CamelotCore/Include/CmFont.h

@@ -33,7 +33,7 @@ namespace CamelotFramework
 	public:
 	public:
 		virtual ~Font();
 		virtual ~Font();
 
 
-		void initialize(Vector<FontData>::type& fontData);
+		void initialize(const Vector<FontData>::type& fontData);
 
 
 		const FontData* getFontDataForSize(UINT32 size) const;
 		const FontData* getFontDataForSize(UINT32 size) const;
 		INT32 getClosestAvailableSize(UINT32 size) const;
 		INT32 getClosestAvailableSize(UINT32 size) const;
@@ -59,6 +59,7 @@ namespace CamelotFramework
 		/************************************************************************/
 		/************************************************************************/
 		
 		
 	public:
 	public:
-		static HFont create(Vector<FontData>::type& fontInitData);
+		static HFont create(const Vector<FontData>::type& fontInitData);
+		static FontPtr _createPtr(const Vector<FontData>::type& fontInitData);
 	};
 	};
 }
 }

+ 1 - 1
CamelotCore/Include/CmFontManager.h

@@ -8,7 +8,7 @@ namespace CamelotFramework
 	class CM_EXPORT FontManager : public Module<FontManager>
 	class CM_EXPORT FontManager : public Module<FontManager>
 	{
 	{
 	public:
 	public:
-		FontPtr create(Vector<FontData>::type& fontData) const;
+		FontPtr create(const Vector<FontData>::type& fontData) const;
 		FontPtr createEmpty() const;
 		FontPtr createEmpty() const;
 	};
 	};
 }
 }

+ 1 - 0
CamelotCore/Include/CmGpuProgInclude.h

@@ -11,6 +11,7 @@ namespace CamelotFramework
 		const String& getString() const { return mString; }
 		const String& getString() const { return mString; }
 
 
 		static HGpuProgInclude create(const String& includeString);
 		static HGpuProgInclude create(const String& includeString);
+		static GpuProgIncludePtr _createPtr(const String& includeString);
 	private:
 	private:
 		GpuProgInclude(const String& includeString);
 		GpuProgInclude(const String& includeString);
 
 

+ 1 - 1
CamelotCore/Include/CmGpuProgIncludeImporter.h

@@ -18,7 +18,7 @@ namespace CamelotFramework
 		virtual bool isMagicNumberSupported(const UINT8* magicNumPtr, UINT32 numBytes) const; 
 		virtual bool isMagicNumberSupported(const UINT8* magicNumPtr, UINT32 numBytes) const; 
 
 
 		/** Inherited from SpecificImporter */
 		/** Inherited from SpecificImporter */
-		virtual HResource import(const WString& filePath, ConstImportOptionsPtr importOptions);
+		virtual ResourcePtr import(const WString& filePath, ConstImportOptionsPtr importOptions);
 	private:
 	private:
 	};
 	};
 }
 }

+ 1 - 1
CamelotCore/Include/CmGpuProgramImporter.h

@@ -21,7 +21,7 @@ namespace CamelotFramework
 		/**
 		/**
 		 * @copydoc SpecificImporter::import().
 		 * @copydoc SpecificImporter::import().
 		 */
 		 */
-		virtual HResource import(const WString& filePath, ConstImportOptionsPtr importOptions);
+		virtual ResourcePtr import(const WString& filePath, ConstImportOptionsPtr importOptions);
 
 
 		/**
 		/**
 		 * @copydoc SpecificImporter::createImportOptions().
 		 * @copydoc SpecificImporter::createImportOptions().

+ 3 - 0
CamelotCore/Include/CmHighLevelGpuProgram.h

@@ -95,6 +95,9 @@ namespace CamelotFramework {
 	public:
 	public:
 		static HHighLevelGpuProgram create(const String& source, const String& entryPoint, 
 		static HHighLevelGpuProgram create(const String& source, const String& entryPoint, 
 			const String& language, GpuProgramType gptype, GpuProgramProfile profile, const Vector<HGpuProgInclude>::type* includes = nullptr);
 			const String& language, GpuProgramType gptype, GpuProgramProfile profile, const Vector<HGpuProgInclude>::type* includes = nullptr);
+
+		static HighLevelGpuProgramPtr _createPtr(const String& source, const String& entryPoint, 
+			const String& language, GpuProgramType gptype, GpuProgramProfile profile, const Vector<HGpuProgInclude>::type* includes = nullptr);
     };
     };
 
 
 	/** @} */
 	/** @} */

+ 8 - 0
CamelotCore/Include/CmImporter.h

@@ -26,6 +26,14 @@ namespace CamelotFramework
 		 */
 		 */
 		HResource import(const WString& inputFilePath, ConstImportOptionsPtr importOptions = nullptr);
 		HResource import(const WString& inputFilePath, ConstImportOptionsPtr importOptions = nullptr);
 
 
+		/**
+		 * @brief	Imports a resource and replaces the contents of the provided existing resource with new imported data.
+		 *
+		 * @param	inputFilePath	Pathname of the input file.
+		 * @param	importOptions	(optional) Options for controlling the import.
+		 */
+		void reimport(HResource& existingResource, const WString& inputFilePath, ConstImportOptionsPtr importOptions = nullptr);
+
 		/**
 		/**
 		 * @brief	Automatically detects the importer needed for the provided file and returns valid type of
 		 * @brief	Automatically detects the importer needed for the provided file and returns valid type of
 		 * 			import options for that importer.
 		 * 			import options for that importer.

+ 11 - 0
CamelotCore/Include/CmMesh.h

@@ -122,5 +122,16 @@ namespace CamelotFramework
 
 
 		static HMesh create(const MeshDataPtr& initialMeshData, MeshBufferType bufferType = MeshBufferType::Static, 
 		static HMesh create(const MeshDataPtr& initialMeshData, MeshBufferType bufferType = MeshBufferType::Static, 
 			DrawOperationType drawOp = DOT_TRIANGLE_LIST);
 			DrawOperationType drawOp = DOT_TRIANGLE_LIST);
+
+		static MeshPtr _createPtr(UINT32 numVertices, UINT32 numIndices, 
+			const VertexDataDescPtr& vertexDesc, MeshBufferType bufferType = MeshBufferType::Static, 
+			DrawOperationType drawOp = DOT_TRIANGLE_LIST, IndexBuffer::IndexType indexType = IndexBuffer::IT_32BIT);
+
+		static MeshPtr _createPtr(UINT32 numVertices, UINT32 numIndices, const VertexDataDescPtr& vertexDesc, const MeshDataPtr& initialMeshData, 
+			MeshBufferType bufferType = MeshBufferType::Static, DrawOperationType drawOp = DOT_TRIANGLE_LIST, 
+			IndexBuffer::IndexType indexType = IndexBuffer::IT_32BIT);
+
+		static MeshPtr _createPtr(const MeshDataPtr& initialMeshData, MeshBufferType bufferType = MeshBufferType::Static, 
+			DrawOperationType drawOp = DOT_TRIANGLE_LIST);
 	};
 	};
 }
 }

+ 9 - 9
CamelotCore/Include/CmResourceHandle.h

@@ -43,11 +43,6 @@ namespace CamelotFramework
 		 */
 		 */
 		const std::shared_ptr<ResourceHandleData>& getHandleData() const { return mData; }
 		const std::shared_ptr<ResourceHandleData>& getHandleData() const { return mData; }
 
 
-	protected:
-		ResourceHandleBase();
-
-		std::shared_ptr<ResourceHandleData> mData;
-
 		/**
 		/**
 		 * @brief	Sets the created flag to true and assigns the resource pointer. Called
 		 * @brief	Sets the created flag to true and assigns the resource pointer. Called
 		 * 			by the constructors, or if you constructed just using a UUID, then you need to
 		 * 			by the constructors, or if you constructed just using a UUID, then you need to
@@ -55,7 +50,12 @@ namespace CamelotFramework
 		 * 			
 		 * 			
 		 * @note	Two set construction is sometimes required due to multithreaded nature of resource loading.
 		 * @note	Two set construction is sometimes required due to multithreaded nature of resource loading.
 		 */
 		 */
-		void setHandleData(std::shared_ptr<Resource> ptr, const String& uuid);
+		void _setHandleData(std::shared_ptr<Resource> ptr, const String& uuid);
+
+	protected:
+		ResourceHandleBase();
+
+		std::shared_ptr<ResourceHandleData> mData;
 
 
 	private:
 	private:
 		friend class Resources;
 		friend class Resources;
@@ -83,7 +83,7 @@ namespace CamelotFramework
 			:ResourceHandleBase()
 			:ResourceHandleBase()
 		{ }
 		{ }
 
 
-		// Note: This constructor requires you to call "resolve" with the actual resource pointer,
+		// Note: This constructor requires you to call "setHandleData" with the actual resource pointer,
 		// before the resource is considered as loaded
 		// before the resource is considered as loaded
 		ResourceHandle(const String& uuid)
 		ResourceHandle(const String& uuid)
 			:ResourceHandleBase()
 			:ResourceHandleBase()
@@ -147,14 +147,14 @@ namespace CamelotFramework
 			:ResourceHandleBase()
 			:ResourceHandleBase()
 		{
 		{
 			mData = cm_shared_ptr<ResourceHandleData, PoolAlloc>();
 			mData = cm_shared_ptr<ResourceHandleData, PoolAlloc>();
-			setHandleData(std::shared_ptr<Resource>(ptr, uuid));
+			_setHandleData(std::shared_ptr<Resource>(ptr, uuid));
 		}
 		}
 
 
 		ResourceHandle(std::shared_ptr<T> ptr, const String& uuid)
 		ResourceHandle(std::shared_ptr<T> ptr, const String& uuid)
 			:ResourceHandleBase()
 			:ResourceHandleBase()
 		{
 		{
 			mData = cm_shared_ptr<ResourceHandleData, PoolAlloc>();
 			mData = cm_shared_ptr<ResourceHandleData, PoolAlloc>();
-			setHandleData(ptr, uuid);
+			_setHandleData(ptr, uuid);
 		}
 		}
 	};
 	};
 
 

+ 1 - 1
CamelotCore/Include/CmResourceHandleRTTI.h

@@ -35,7 +35,7 @@ namespace CamelotFramework
 				HResource loadedResource = gResources().loadFromUUID(resourceHandle->mData->mUUID);
 				HResource loadedResource = gResources().loadFromUUID(resourceHandle->mData->mUUID);
 
 
 				if(loadedResource)
 				if(loadedResource)
-					resourceHandle->setHandleData(loadedResource.getInternalPtr(), resourceHandle->mData->mUUID);
+					resourceHandle->_setHandleData(loadedResource.getInternalPtr(), resourceHandle->mData->mUUID);
 			}
 			}
 		}
 		}
 
 

+ 1 - 1
CamelotCore/Include/CmSpecificImporter.h

@@ -28,7 +28,7 @@ namespace CamelotFramework
 		 *
 		 *
 		 * @return	null if it fails, otherwise the loaded object.
 		 * @return	null if it fails, otherwise the loaded object.
 		 */
 		 */
-		virtual HResource import(const WString& filePath, ConstImportOptionsPtr importOptions) = 0;
+		virtual ResourcePtr import(const WString& filePath, ConstImportOptionsPtr importOptions) = 0;
 
 
 		/**
 		/**
 		 * @brief	Creates import options specific for this importer. Import
 		 * @brief	Creates import options specific for this importer. Import

+ 8 - 0
CamelotCore/Include/CmTexture.h

@@ -295,5 +295,13 @@ namespace CamelotFramework
 		static HTexture create(TextureType texType, UINT32 width, UINT32 height, int num_mips,
 		static HTexture create(TextureType texType, UINT32 width, UINT32 height, int num_mips,
 			PixelFormat format, int usage = TU_DEFAULT,
 			PixelFormat format, int usage = TU_DEFAULT,
 			bool hwGammaCorrection = false, UINT32 fsaa = 0, const String& fsaaHint = StringUtil::BLANK);
 			bool hwGammaCorrection = false, UINT32 fsaa = 0, const String& fsaaHint = StringUtil::BLANK);
+
+		static TexturePtr _createPtr(TextureType texType, UINT32 width, UINT32 height, UINT32 depth, 
+			int num_mips, PixelFormat format, int usage = TU_DEFAULT,
+			bool hwGammaCorrection = false, UINT32 fsaa = 0, const String& fsaaHint = StringUtil::BLANK);
+
+		static TexturePtr _createPtr(TextureType texType, UINT32 width, UINT32 height, int num_mips,
+			PixelFormat format, int usage = TU_DEFAULT,
+			bool hwGammaCorrection = false, UINT32 fsaa = 0, const String& fsaaHint = StringUtil::BLANK);
     };
     };
 }
 }

+ 1 - 1
CamelotCore/Source/CmCoreObject.cpp

@@ -97,7 +97,7 @@ namespace CamelotFramework
 		}
 		}
 	}
 	}
 
 
-	void CoreObject::synchonize()
+	void CoreObject::synchronize()
 	{
 	{
 		if(!isInitialized())
 		if(!isInitialized())
 		{
 		{

+ 8 - 3
CamelotCore/Source/CmFont.cpp

@@ -32,7 +32,7 @@ namespace CamelotFramework
 	Font::~Font()
 	Font::~Font()
 	{ }
 	{ }
 
 
-	void Font::initialize(Vector<FontData>::type& fontData)
+	void Font::initialize(const Vector<FontData>::type& fontData)
 	{
 	{
 		for(auto iter = fontData.begin(); iter != fontData.end(); ++iter)
 		for(auto iter = fontData.begin(); iter != fontData.end(); ++iter)
 			mFontDataPerSize[iter->size] = *iter;
 			mFontDataPerSize[iter->size] = *iter;
@@ -82,13 +82,18 @@ namespace CamelotFramework
 		return bestSize;
 		return bestSize;
 	}
 	}
 
 
-	HFont Font::create(Vector<FontData>::type& fontData)
+	HFont Font::create(const Vector<FontData>::type& fontData)
 	{
 	{
-		FontPtr newFont = FontManager::instance().create(fontData);
+		FontPtr newFont = _createPtr(fontData);
 
 
 		return Resource::_createResourceHandle(newFont);
 		return Resource::_createResourceHandle(newFont);
 	}
 	}
 
 
+	FontPtr Font::_createPtr(const Vector<FontData>::type& fontData)
+	{
+		return FontManager::instance().create(fontData);
+	}
+
 	RTTITypeBase* Font::getRTTIStatic()
 	RTTITypeBase* Font::getRTTIStatic()
 	{
 	{
 		return FontRTTI::instance();
 		return FontRTTI::instance();

+ 1 - 1
CamelotCore/Source/CmFontManager.cpp

@@ -3,7 +3,7 @@
 
 
 namespace CamelotFramework
 namespace CamelotFramework
 {
 {
-	FontPtr FontManager::create(Vector<FontData>::type& fontData) const
+	FontPtr FontManager::create(const Vector<FontData>::type& fontData) const
 	{
 	{
 		FontPtr newFont = cm_core_ptr<Font, PoolAlloc>(new (cm_alloc<Font, PoolAlloc>()) Font());
 		FontPtr newFont = cm_core_ptr<Font, PoolAlloc>(new (cm_alloc<Font, PoolAlloc>()) Font());
 		newFont->setThisPtr(newFont);
 		newFont->setThisPtr(newFont);

+ 6 - 1
CamelotCore/Source/CmGpuProgInclude.cpp

@@ -9,12 +9,17 @@ namespace CamelotFramework
 	}
 	}
 
 
 	HGpuProgInclude GpuProgInclude::create(const String& includeString)
 	HGpuProgInclude GpuProgInclude::create(const String& includeString)
+	{
+		return static_resource_cast<GpuProgInclude>(Resource::_createResourceHandle(_createPtr(includeString)));
+	}
+
+	GpuProgIncludePtr GpuProgInclude::_createPtr(const String& includeString)
 	{
 	{
 		GpuProgIncludePtr gpuProgIncludePtr = cm_core_ptr<GpuProgInclude, PoolAlloc>(
 		GpuProgIncludePtr gpuProgIncludePtr = cm_core_ptr<GpuProgInclude, PoolAlloc>(
 			new (cm_alloc<GpuProgInclude, PoolAlloc>()) GpuProgInclude(includeString));
 			new (cm_alloc<GpuProgInclude, PoolAlloc>()) GpuProgInclude(includeString));
 		gpuProgIncludePtr->setThisPtr(gpuProgIncludePtr);
 		gpuProgIncludePtr->setThisPtr(gpuProgIncludePtr);
 		gpuProgIncludePtr->initialize();
 		gpuProgIncludePtr->initialize();
 
 
-		return static_resource_cast<GpuProgInclude>(Resource::_createResourceHandle(gpuProgIncludePtr));
+		return gpuProgIncludePtr;
 	}
 	}
 }
 }

+ 2 - 4
CamelotCore/Source/CmGpuProgIncludeImporter.cpp

@@ -29,13 +29,11 @@ namespace CamelotFramework
 		return true; // Plain-text so I don't even check for magic number
 		return true; // Plain-text so I don't even check for magic number
 	}
 	}
 
 
-	HResource GpuProgIncludeImporter::import(const WString& filePath, ConstImportOptionsPtr importOptions)
+	ResourcePtr GpuProgIncludeImporter::import(const WString& filePath, ConstImportOptionsPtr importOptions)
 	{
 	{
 		DataStreamPtr stream = FileSystem::openFile(filePath);
 		DataStreamPtr stream = FileSystem::openFile(filePath);
 		String includeString = stream->getAsString();
 		String includeString = stream->getAsString();
 
 
-		HGpuProgInclude gpuProgInclude = GpuProgInclude::create(includeString);
-
-		return gpuProgInclude;
+		return GpuProgInclude::_createPtr(includeString);
 	}
 	}
 }
 }

+ 3 - 3
CamelotCore/Source/CmGpuProgramImporter.cpp

@@ -21,7 +21,7 @@ namespace CamelotFramework
 		return true;
 		return true;
 	}
 	}
 
 
-	HResource GpuProgramImporter::import(const WString& filePath, ConstImportOptionsPtr importOptions)
+	ResourcePtr GpuProgramImporter::import(const WString& filePath, ConstImportOptionsPtr importOptions)
 	{
 	{
 		WString ext = Path::getExtension(filePath);
 		WString ext = Path::getExtension(filePath);
 		ext = ext.substr(1, ext.size() - 1); // Remove the .
 		ext = ext.substr(1, ext.size() - 1); // Remove the .
@@ -37,8 +37,8 @@ namespace CamelotFramework
 		GpuProgramType gptype = gpuProgImportOptions->getType();
 		GpuProgramType gptype = gpuProgImportOptions->getType();
 		Vector<HGpuProgInclude>::type includes = gpuProgImportOptions->getIncludes();
 		Vector<HGpuProgInclude>::type includes = gpuProgImportOptions->getIncludes();
 
 
-		HHighLevelGpuProgram gpuProgram = HighLevelGpuProgram::create(shaderSource, entryPoint, language, gptype, profile, &includes);
-		gpuProgram.synchronize();
+		HighLevelGpuProgramPtr gpuProgram = HighLevelGpuProgram::_createPtr(shaderSource, entryPoint, language, gptype, profile, &includes);
+		gpuProgram->synchronize();
 
 
 		return gpuProgram;
 		return gpuProgram;
 	}
 	}

+ 11 - 7
CamelotCore/Source/CmHighLevelGpuProgram.cpp

@@ -33,24 +33,22 @@ THE SOFTWARE.
 
 
 namespace CamelotFramework
 namespace CamelotFramework
 {
 {
-    //---------------------------------------------------------------------------
 	HighLevelGpuProgram::HighLevelGpuProgram(const String& source, const String& entryPoint, const String& language, 
 	HighLevelGpuProgram::HighLevelGpuProgram(const String& source, const String& entryPoint, const String& language, 
 		GpuProgramType gptype, GpuProgramProfile profile, const Vector<HGpuProgInclude>::type* includes, bool isAdjacencyInfoRequired)
 		GpuProgramType gptype, GpuProgramProfile profile, const Vector<HGpuProgInclude>::type* includes, bool isAdjacencyInfoRequired)
         : GpuProgram(source, entryPoint, language, gptype, profile, includes, isAdjacencyInfoRequired), 
         : GpuProgram(source, entryPoint, language, gptype, profile, includes, isAdjacencyInfoRequired), 
         mAssemblerProgram(nullptr)
         mAssemblerProgram(nullptr)
     {
     {
     }
     }
-	//---------------------------------------------------------------------------
+
 	HighLevelGpuProgram::~HighLevelGpuProgram()
 	HighLevelGpuProgram::~HighLevelGpuProgram()
 	{
 	{
 
 
 	}
 	}
-    //---------------------------------------------------------------------------
+
     void HighLevelGpuProgram::initialize_internal()
     void HighLevelGpuProgram::initialize_internal()
     {
     {
 		if (isSupported())
 		if (isSupported())
 		{
 		{
-			// load constructed assembler program (if it exists)
 			if (mAssemblerProgram != nullptr && mAssemblerProgram.get() != this)
 			if (mAssemblerProgram != nullptr && mAssemblerProgram.get() != this)
 			{
 			{
 				mAssemblerProgram->initialize();
 				mAssemblerProgram->initialize();
@@ -59,19 +57,25 @@ namespace CamelotFramework
 
 
 		GpuProgram::initialize_internal();
 		GpuProgram::initialize_internal();
     }
     }
-    //---------------------------------------------------------------------------
+
     void HighLevelGpuProgram::destroy_internal()
     void HighLevelGpuProgram::destroy_internal()
     {   
     {   
         mAssemblerProgram = nullptr;
         mAssemblerProgram = nullptr;
 
 
 		GpuProgram::destroy_internal();
 		GpuProgram::destroy_internal();
     }
     }
-	//---------------------------------------------------------------------
+
 	HHighLevelGpuProgram HighLevelGpuProgram::create(const String& source, const String& entryPoint, 
 	HHighLevelGpuProgram HighLevelGpuProgram::create(const String& source, const String& entryPoint, 
 		const String& language, GpuProgramType gptype, GpuProgramProfile profile, const Vector<HGpuProgInclude>::type* includes)
 		const String& language, GpuProgramType gptype, GpuProgramProfile profile, const Vector<HGpuProgInclude>::type* includes)
 	{
 	{
-		HighLevelGpuProgramPtr programPtr = HighLevelGpuProgramManager::instance().create(source, entryPoint, language, gptype, profile, includes);
+		HighLevelGpuProgramPtr programPtr = _createPtr(source, entryPoint, language, gptype, profile, includes);
 
 
 		return static_resource_cast<HighLevelGpuProgram>(Resource::_createResourceHandle(programPtr));
 		return static_resource_cast<HighLevelGpuProgram>(Resource::_createResourceHandle(programPtr));
 	}
 	}
+
+	HighLevelGpuProgramPtr HighLevelGpuProgram::_createPtr(const String& source, const String& entryPoint, 
+		const String& language, GpuProgramType gptype, GpuProgramProfile profile, const Vector<HGpuProgInclude>::type* includes)
+	{
+		return HighLevelGpuProgramManager::instance().create(source, entryPoint, language, gptype, profile, includes);
+	}
 }
 }

+ 30 - 2
CamelotCore/Source/CmImporter.cpp

@@ -9,6 +9,7 @@
 #include "CmDebug.h"
 #include "CmDebug.h"
 #include "CmDataStream.h"
 #include "CmDataStream.h"
 #include "CmException.h"
 #include "CmException.h"
+#include "CmUUID.h"
 
 
 namespace CamelotFramework
 namespace CamelotFramework
 {
 {
@@ -75,9 +76,36 @@ namespace CamelotFramework
 			}
 			}
 		}
 		}
 
 
-		HResource importedResource = importer->import(inputFilePath, importOptions);
+		ResourcePtr importedResource = importer->import(inputFilePath, importOptions);
+		return Resource::_createResourceHandle(importedResource);
+	}
+
+	void Importer::reimport(HResource& existingResource, const WString& inputFilePath, ConstImportOptionsPtr importOptions)
+	{
+		if(!FileSystem::isFile(inputFilePath))
+		{
+			LOGWRN("Trying to import asset that doesn't exists. Asset path: " + toString(inputFilePath));
+			return;
+		}
+
+		SpecificImporter* importer = getImporterForFile(inputFilePath);
+		if(importer == nullptr)
+			return;
+
+		if(importOptions == nullptr)
+			importOptions = importer->getDefaultImportOptions();
+		else
+		{
+			ConstImportOptionsPtr defaultImportOptions = importer->getDefaultImportOptions();
+			if(importOptions->getTypeId() != defaultImportOptions->getTypeId())
+			{
+				CM_EXCEPT(InvalidParametersException, "Provided import options is not of valid type. " \
+					"Expected: " + defaultImportOptions->getTypeName() + ". Got: " + importOptions->getTypeName() + ".");
+			}
+		}
 
 
-		return importedResource;
+		ResourcePtr importedResource = importer->import(inputFilePath, importOptions);
+		existingResource._setHandleData(importedResource, existingResource.getUUID());
 	}
 	}
 
 
 	ImportOptionsPtr Importer::createImportOptions(const WString& inputFilePath)
 	ImportOptionsPtr Importer::createImportOptions(const WString& inputFilePath)

+ 21 - 3
CamelotCore/Source/CmMesh.cpp

@@ -352,7 +352,7 @@ namespace CamelotFramework
 	HMesh Mesh::create(UINT32 numVertices, UINT32 numIndices, const VertexDataDescPtr& vertexDesc, 
 	HMesh Mesh::create(UINT32 numVertices, UINT32 numIndices, const VertexDataDescPtr& vertexDesc, 
 		MeshBufferType bufferType, DrawOperationType drawOp, IndexBuffer::IndexType indexType)
 		MeshBufferType bufferType, DrawOperationType drawOp, IndexBuffer::IndexType indexType)
 	{
 	{
-		MeshPtr meshPtr = MeshManager::instance().create(numVertices, numIndices, vertexDesc, bufferType, drawOp, indexType);
+		MeshPtr meshPtr = _createPtr(numVertices, numIndices, vertexDesc, bufferType, drawOp, indexType);
 
 
 		return static_resource_cast<Mesh>(Resource::_createResourceHandle(meshPtr));
 		return static_resource_cast<Mesh>(Resource::_createResourceHandle(meshPtr));
 	}
 	}
@@ -360,7 +360,7 @@ namespace CamelotFramework
 	HMesh Mesh::create(UINT32 numVertices, UINT32 numIndices, const VertexDataDescPtr& vertexDesc, 
 	HMesh Mesh::create(UINT32 numVertices, UINT32 numIndices, const VertexDataDescPtr& vertexDesc, 
 		const MeshDataPtr& initialMeshData, MeshBufferType bufferType, DrawOperationType drawOp, IndexBuffer::IndexType indexType)
 		const MeshDataPtr& initialMeshData, MeshBufferType bufferType, DrawOperationType drawOp, IndexBuffer::IndexType indexType)
 	{
 	{
-		MeshPtr meshPtr = MeshManager::instance().create(numVertices, numIndices, vertexDesc, 
+		MeshPtr meshPtr = _createPtr(numVertices, numIndices, vertexDesc, 
 			initialMeshData, bufferType, drawOp, indexType);
 			initialMeshData, bufferType, drawOp, indexType);
 
 
 		return static_resource_cast<Mesh>(Resource::_createResourceHandle(meshPtr));
 		return static_resource_cast<Mesh>(Resource::_createResourceHandle(meshPtr));
@@ -368,8 +368,26 @@ namespace CamelotFramework
 
 
 	HMesh Mesh::create(const MeshDataPtr& initialMeshData, MeshBufferType bufferType, DrawOperationType drawOp)
 	HMesh Mesh::create(const MeshDataPtr& initialMeshData, MeshBufferType bufferType, DrawOperationType drawOp)
 	{
 	{
-		MeshPtr meshPtr = MeshManager::instance().create(initialMeshData, bufferType, drawOp);
+		MeshPtr meshPtr = _createPtr(initialMeshData, bufferType, drawOp);
 
 
 		return static_resource_cast<Mesh>(Resource::_createResourceHandle(meshPtr));
 		return static_resource_cast<Mesh>(Resource::_createResourceHandle(meshPtr));
 	}
 	}
+
+	MeshPtr Mesh::_createPtr(UINT32 numVertices, UINT32 numIndices, const VertexDataDescPtr& vertexDesc, 
+		MeshBufferType bufferType, DrawOperationType drawOp, IndexBuffer::IndexType indexType)
+	{
+		return MeshManager::instance().create(numVertices, numIndices, vertexDesc, bufferType, drawOp, indexType);
+	}
+
+	MeshPtr Mesh::_createPtr(UINT32 numVertices, UINT32 numIndices, const VertexDataDescPtr& vertexDesc, 
+		const MeshDataPtr& initialMeshData, MeshBufferType bufferType, DrawOperationType drawOp, IndexBuffer::IndexType indexType)
+	{
+		return MeshManager::instance().create(numVertices, numIndices, vertexDesc, 
+			initialMeshData, bufferType, drawOp, indexType);
+	}
+
+	MeshPtr Mesh::_createPtr(const MeshDataPtr& initialMeshData, MeshBufferType bufferType, DrawOperationType drawOp)
+	{
+		return MeshManager::instance().create(initialMeshData, bufferType, drawOp);
+	}
 }
 }

+ 2 - 2
CamelotCore/Source/CmResourceHandle.cpp

@@ -33,10 +33,10 @@ namespace CamelotFramework
 			}
 			}
 		}
 		}
 
 
-		mData->mPtr->synchonize();
+		mData->mPtr->synchronize();
 	}
 	}
 
 
-	void ResourceHandleBase::setHandleData(std::shared_ptr<Resource> ptr, const String& uuid)
+	void ResourceHandleBase::_setHandleData(std::shared_ptr<Resource> ptr, const String& uuid)
 	{
 	{
 		mData->mPtr = ptr;
 		mData->mPtr = ptr;
 
 

+ 1 - 1
CamelotCore/Source/CmResources.cpp

@@ -45,7 +45,7 @@ namespace CamelotFramework
 			
 			
 			// This should be thread safe without any sync primitives, if other threads read a few cycles out of date value
 			// This should be thread safe without any sync primitives, if other threads read a few cycles out of date value
 			// and think this resource isn't created when it really is, it hardly makes any difference
 			// and think this resource isn't created when it really is, it hardly makes any difference
-			resRequest->resource.setHandleData(resResponse->rawResource, resRequest->resource.getUUID());
+			resRequest->resource._setHandleData(resResponse->rawResource, resRequest->resource.getUUID());
 
 
 			gResources().notifyNewResourceLoaded(resRequest->resource);
 			gResources().notifyNewResourceLoaded(resRequest->resource);
 		}
 		}

+ 16 - 2
CamelotCore/Source/CmTexture.cpp

@@ -328,7 +328,7 @@ namespace CamelotFramework
 	HTexture Texture::create(TextureType texType, UINT32 width, UINT32 height, UINT32 depth, 
 	HTexture Texture::create(TextureType texType, UINT32 width, UINT32 height, UINT32 depth, 
 		int num_mips, PixelFormat format, int usage, bool hwGammaCorrection, UINT32 fsaa, const String& fsaaHint)
 		int num_mips, PixelFormat format, int usage, bool hwGammaCorrection, UINT32 fsaa, const String& fsaaHint)
 	{
 	{
-		TexturePtr texturePtr = TextureManager::instance().createTexture(texType, 
+		TexturePtr texturePtr = _createPtr(texType, 
 			width, height, depth, num_mips, format, usage, hwGammaCorrection, fsaa, fsaaHint);
 			width, height, depth, num_mips, format, usage, hwGammaCorrection, fsaa, fsaaHint);
 
 
 		return static_resource_cast<Texture>(Resource::_createResourceHandle(texturePtr));
 		return static_resource_cast<Texture>(Resource::_createResourceHandle(texturePtr));
@@ -337,12 +337,26 @@ namespace CamelotFramework
 	HTexture Texture::create(TextureType texType, UINT32 width, UINT32 height, 
 	HTexture Texture::create(TextureType texType, UINT32 width, UINT32 height, 
 		int num_mips, PixelFormat format, int usage, bool hwGammaCorrection, UINT32 fsaa, const String& fsaaHint)
 		int num_mips, PixelFormat format, int usage, bool hwGammaCorrection, UINT32 fsaa, const String& fsaaHint)
 	{
 	{
-		TexturePtr texturePtr = TextureManager::instance().createTexture(texType, 
+		TexturePtr texturePtr = _createPtr(texType, 
 			width, height, num_mips, format, usage, hwGammaCorrection, fsaa, fsaaHint);
 			width, height, num_mips, format, usage, hwGammaCorrection, fsaa, fsaaHint);
 
 
 		return static_resource_cast<Texture>(Resource::_createResourceHandle(texturePtr));
 		return static_resource_cast<Texture>(Resource::_createResourceHandle(texturePtr));
 	}
 	}
 
 
+	TexturePtr Texture::_createPtr(TextureType texType, UINT32 width, UINT32 height, UINT32 depth, 
+		int num_mips, PixelFormat format, int usage, bool hwGammaCorrection, UINT32 fsaa, const String& fsaaHint)
+	{
+		return TextureManager::instance().createTexture(texType, 
+			width, height, depth, num_mips, format, usage, hwGammaCorrection, fsaa, fsaaHint);
+	}
+
+	TexturePtr Texture::_createPtr(TextureType texType, UINT32 width, UINT32 height, 
+		int num_mips, PixelFormat format, int usage, bool hwGammaCorrection, UINT32 fsaa, const String& fsaaHint)
+	{
+		return TextureManager::instance().createTexture(texType, 
+			width, height, num_mips, format, usage, hwGammaCorrection, fsaa, fsaaHint);
+	}
+
 	const HTexture& Texture::dummy()
 	const HTexture& Texture::dummy()
 	{
 	{
 		return TextureManager::instance().getDummyTexture();
 		return TextureManager::instance().getDummyTexture();

+ 1 - 1
CamelotFBXImporter/Include/CmFBXImporter.h

@@ -36,7 +36,7 @@ namespace CamelotFramework
 		virtual bool isMagicNumberSupported(const UINT8* magicNumPtr, UINT32 numBytes) const; 
 		virtual bool isMagicNumberSupported(const UINT8* magicNumPtr, UINT32 numBytes) const; 
 
 
 		/** Inherited from SpecificImporter */
 		/** Inherited from SpecificImporter */
-		virtual HResource import(const WString& filePath, ConstImportOptionsPtr importOptions);
+		virtual ResourcePtr import(const WString& filePath, ConstImportOptionsPtr importOptions);
 	private:
 	private:
 		Vector<WString>::type mExtensions;
 		Vector<WString>::type mExtensions;
 
 

+ 2 - 3
CamelotFBXImporter/Source/CmFBXImporter.cpp

@@ -37,7 +37,7 @@ namespace CamelotFramework
 		return true; // FBX files can be plain-text so I don't even check for magic number
 		return true; // FBX files can be plain-text so I don't even check for magic number
 	}
 	}
 
 
-	HResource FBXImporter::import(const WString& filePath, ConstImportOptionsPtr importOptions)
+	ResourcePtr FBXImporter::import(const WString& filePath, ConstImportOptionsPtr importOptions)
 	{
 	{
 		FbxManager* fbxManager = nullptr;
 		FbxManager* fbxManager = nullptr;
 		FbxScene* fbxScene = nullptr;
 		FbxScene* fbxScene = nullptr;
@@ -50,7 +50,7 @@ namespace CamelotFramework
 
 
 		shutDownSdk(fbxManager);
 		shutDownSdk(fbxManager);
 
 
-		HMesh mesh = Mesh::create(meshData);
+		MeshPtr mesh = Mesh::_createPtr(meshData);
 		mesh->setSubMeshes(subMeshes);
 		mesh->setSubMeshes(subMeshes);
 
 
 		return mesh;
 		return mesh;
@@ -76,7 +76,6 @@ namespace CamelotFramework
 	void FBXImporter::shutDownSdk(FbxManager* manager)
 	void FBXImporter::shutDownSdk(FbxManager* manager)
 	{
 	{
 		manager->Destroy();
 		manager->Destroy();
-
 	}
 	}
 
 
 	void FBXImporter::loadScene(FbxManager* manager, FbxScene* scene, const WString& filePath)
 	void FBXImporter::loadScene(FbxManager* manager, FbxScene* scene, const WString& filePath)

+ 1 - 1
CamelotFontImporter/Include/CmFontImporter.h

@@ -32,7 +32,7 @@ namespace CamelotFramework
 		virtual bool isMagicNumberSupported(const UINT8* magicNumPtr, UINT32 numBytes) const; 
 		virtual bool isMagicNumberSupported(const UINT8* magicNumPtr, UINT32 numBytes) const; 
 
 
 		/** Inherited from SpecificImporter */
 		/** Inherited from SpecificImporter */
-		virtual HResource import(const WString& filePath, ConstImportOptionsPtr importOptions);
+		virtual ResourcePtr import(const WString& filePath, ConstImportOptionsPtr importOptions);
 
 
 		/**
 		/**
 		 * @copydoc SpecificImporter::createImportOptions().
 		 * @copydoc SpecificImporter::createImportOptions().

+ 2 - 2
CamelotFontImporter/Source/CmFontImporter.cpp

@@ -45,7 +45,7 @@ namespace CamelotFramework
 		return cm_shared_ptr<FontImportOptions, ScratchAlloc>();
 		return cm_shared_ptr<FontImportOptions, ScratchAlloc>();
 	}
 	}
 
 
-	HResource FontImporter::import(const WString& filePath, ConstImportOptionsPtr importOptions)
+	ResourcePtr FontImporter::import(const WString& filePath, ConstImportOptionsPtr importOptions)
 	{
 	{
 		const FontImportOptions* fontImportOptions = static_cast<const FontImportOptions*>(importOptions.get());
 		const FontImportOptions* fontImportOptions = static_cast<const FontImportOptions*>(importOptions.get());
 
 
@@ -306,7 +306,7 @@ namespace CamelotFramework
 			dataPerSize.push_back(fontData);
 			dataPerSize.push_back(fontData);
 		}
 		}
 
 
-		HFont newFont = Font::create(dataPerSize);
+		FontPtr newFont = Font::_createPtr(dataPerSize);
 
 
 		FT_Done_FreeType(library);
 		FT_Done_FreeType(library);
 
 

+ 1 - 1
CamelotFreeImgImporter/Include/CmFreeImgImporter.h

@@ -34,7 +34,7 @@ namespace CamelotFramework
 		virtual bool isMagicNumberSupported(const UINT8* magicNumPtr, UINT32 numBytes) const; 
 		virtual bool isMagicNumberSupported(const UINT8* magicNumPtr, UINT32 numBytes) const; 
 
 
 		/** Inherited from SpecificImporter */
 		/** Inherited from SpecificImporter */
-		virtual HResource import(const WString& filePath, ConstImportOptionsPtr importOptions);
+		virtual ResourcePtr import(const WString& filePath, ConstImportOptionsPtr importOptions);
 	private:
 	private:
 		Vector<WString>::type mExtensions;
 		Vector<WString>::type mExtensions;
 		UnorderedMap<WString, int>::type mExtensionToFID;
 		UnorderedMap<WString, int>::type mExtensionToFID;

+ 5 - 6
CamelotFreeImgImporter/Source/CmFreeImgImporter.cpp

@@ -117,18 +117,18 @@ namespace CamelotFramework
 		}
 		}
 	}
 	}
 
 
-	HResource FreeImgImporter::import(const WString& filePath, ConstImportOptionsPtr importOptions)
+	ResourcePtr FreeImgImporter::import(const WString& filePath, ConstImportOptionsPtr importOptions)
 	{
 	{
 		DataStreamPtr fileData = FileSystem::openFile(filePath, true);
 		DataStreamPtr fileData = FileSystem::openFile(filePath, true);
 
 
 		TextureDataPtr imgData = importRawImage(fileData);
 		TextureDataPtr imgData = importRawImage(fileData);
 		if(imgData == nullptr || imgData->getData() == nullptr)
 		if(imgData == nullptr || imgData->getData() == nullptr)
-			return HTexture();
+			return nullptr;
 
 
-		HTexture newTexture = Texture::create(TEX_TYPE_2D, 
+		TexturePtr newTexture = Texture::_createPtr(TEX_TYPE_2D, 
 			imgData->getWidth(), imgData->getHeight(), imgData->getNumMipmaps(), imgData->getFormat());
 			imgData->getWidth(), imgData->getHeight(), imgData->getNumMipmaps(), imgData->getFormat());
 
 
-		newTexture->synchonize(); // TODO - Required due to a bug in allocateSubresourceBuffer
+		newTexture->synchronize(); // TODO - Required due to a bug in allocateSubresourceBuffer
 
 
 		for(UINT32 mip = 0; mip <= imgData->getNumMipmaps(); ++mip)
 		for(UINT32 mip = 0; mip <= imgData->getNumMipmaps(); ++mip)
 		{
 		{
@@ -137,7 +137,7 @@ namespace CamelotFramework
 
 
 			imgData->getPixels(mip, *src);
 			imgData->getPixels(mip, *src);
 
 
-			gMainSyncedCA().writeSubresource(newTexture.getInternalPtr(), subresourceIdx, src);
+			gMainSyncedCA().writeSubresource(newTexture, subresourceIdx, src);
 		}
 		}
 
 
 		fileData->close();
 		fileData->close();
@@ -317,7 +317,6 @@ namespace CamelotFramework
 		FreeImage_Unload(fiBitmap);
 		FreeImage_Unload(fiBitmap);
 		FreeImage_CloseMemory(fiMem);
 		FreeImage_CloseMemory(fiMem);
 
 
-		
 		return texData;
 		return texData;
 	}
 	}
 }
 }