Browse Source

Renamed ResourceRef to ResourceHandle

Marko Pintera 13 years ago
parent
commit
cca0196f6c
36 changed files with 290 additions and 298 deletions
  1. 5 5
      CamelotClient/CamelotClient.cpp
  2. 1 1
      CamelotD3D9Renderer/Include/CmD3D9RenderSystem.h
  3. 2 2
      CamelotD3D9Renderer/Source/CmD3D9RenderSystem.cpp
  4. 1 1
      CamelotFBXImporter/Include/CmFBXImporter.h
  5. 2 2
      CamelotFBXImporter/Source/CmFBXImporter.cpp
  6. 8 8
      CamelotForwardRenderer/Source/CmForwardRenderer.cpp
  7. 1 1
      CamelotFreeImgImporter/Include/CmFreeImgImporter.h
  8. 2 2
      CamelotFreeImgImporter/Source/CmFreeImgImporter.cpp
  9. 1 1
      CamelotGLRenderer/Include/CmGLRenderSystem.h
  10. 2 2
      CamelotGLRenderer/Source/CmGLRenderSystem.cpp
  11. 3 3
      CamelotRenderer/CamelotRenderer.vcxproj
  12. 9 9
      CamelotRenderer/CamelotRenderer.vcxproj.filters
  13. 4 4
      CamelotRenderer/Include/CmGpuProgramParams.h
  14. 1 1
      CamelotRenderer/Include/CmImporter.h
  15. 1 1
      CamelotRenderer/Include/CmMaterial.h
  16. 4 4
      CamelotRenderer/Include/CmMaterialRTTI.h
  17. 9 9
      CamelotRenderer/Include/CmPass.h
  18. 6 6
      CamelotRenderer/Include/CmPassRTTI.h
  19. 9 9
      CamelotRenderer/Include/CmPrerequisites.h
  20. 2 2
      CamelotRenderer/Include/CmRenderSystem.h
  21. 6 6
      CamelotRenderer/Include/CmRenderable.h
  22. 26 26
      CamelotRenderer/Include/CmResourceHandle.h
  23. 83 0
      CamelotRenderer/Include/CmResourceHandleRTTI.h
  24. 0 83
      CamelotRenderer/Include/CmResourceRefRTTI.h
  25. 12 12
      CamelotRenderer/Include/CmResources.h
  26. 1 1
      CamelotRenderer/Include/CmSpecificImporter.h
  27. 4 4
      CamelotRenderer/Source/CmGpuProgramParams.cpp
  28. 2 2
      CamelotRenderer/Source/CmImporter.cpp
  29. 4 4
      CamelotRenderer/Source/CmMaterial.cpp
  30. 1 1
      CamelotRenderer/Source/CmMaterialRTTI.cpp
  31. 6 6
      CamelotRenderer/Source/CmPass.cpp
  32. 2 2
      CamelotRenderer/Source/CmRenderSystem.cpp
  33. 59 0
      CamelotRenderer/Source/CmResourceHandle.cpp
  34. 0 59
      CamelotRenderer/Source/CmResourceRef.cpp
  35. 10 10
      CamelotRenderer/Source/CmResources.cpp
  36. 1 9
      CamelotRenderer/TODO.txt

+ 5 - 5
CamelotClient/CamelotClient.cpp

@@ -102,12 +102,12 @@ int _tmain(int argc, _TCHAR* argv[])
 	vertProg =  HighLevelGpuProgramManager::instance().createProgram(vertShaderCode, "vs_main", "cg", GPT_VERTEX_PROGRAM, GPP_VS_2_0);
 	vertProg->init();
 
-	HighLevelGpuProgramRef vertProgRef(vertProg);
+	HighLevelGpuProgramHandle vertProgRef(vertProg);
 
 	gResources().create(vertProgRef, "C:\\vertProgCg.vprog", true);
 	vertProgRef = static_resource_cast<HighLevelGpuProgram>(gResources().load("C:\\vertProgCg.vprog"));
 
-	HighLevelGpuProgramRef fragProgRef(fragProg);
+	HighLevelGpuProgramHandle fragProgRef(fragProg);
 
 	gResources().create(fragProgRef, "C:\\fragProgCg.vprog", true);
 	fragProgRef = static_resource_cast<HighLevelGpuProgram>(gResources().load("C:\\fragProgCg.vprog"));
@@ -150,12 +150,12 @@ int _tmain(int argc, _TCHAR* argv[])
 	newPassDX->setVertexProgram(vertProgRef);
 	newPassDX->setFragmentProgram(fragProgRef);
 
-	MaterialRef testMaterial = MaterialPtr(new Material());
+	MaterialHandle testMaterial = MaterialPtr(new Material());
 	testMaterial->setShader(testShader);
 
 	/*TextureRef testTex = static_resource_cast<Texture>(Importer::instance().import("C:\\ImportTest.tga"));*/
-	TextureRef testTex = static_resource_cast<Texture>(Importer::instance().import("C:\\ArenaTowerDFS.psd"));
-	MeshRef dbgMesh = static_resource_cast<Mesh>(Importer::instance().import("C:\\X_Arena_Tower.FBX"));
+	TextureHandle testTex = static_resource_cast<Texture>(Importer::instance().import("C:\\ArenaTowerDFS.psd"));
+	MeshHandle dbgMesh = static_resource_cast<Mesh>(Importer::instance().import("C:\\X_Arena_Tower.FBX"));
 
 	//int tmpFlag = _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_CHECK_CRT_DF | _CRTDBG_DELAY_FREE_MEM_DF);
 

+ 1 - 1
CamelotD3D9Renderer/Include/CmD3D9RenderSystem.h

@@ -240,7 +240,7 @@ namespace CamelotEngine
 		void destroyRenderTarget_internal(const String& name);
 		void setRenderTarget_internal(RenderTarget *target);
 
-		void bindGpuProgram_internal(GpuProgramRef prg);
+		void bindGpuProgram_internal(GpuProgramHandle prg);
 		void unbindGpuProgram_internal(GpuProgramType gptype);
 		void bindGpuProgramParameters_internal(GpuProgramType gptype, 
 			GpuProgramParametersSharedPtr params, UINT16 variabilityMask);

+ 2 - 2
CamelotD3D9Renderer/Source/CmD3D9RenderSystem.cpp

@@ -269,7 +269,7 @@ namespace CamelotEngine
 		asyncOp.completeOperation(static_cast<RenderWindow*>(renderWindow));
 	}	
 
-	void D3D9RenderSystem::bindGpuProgram_internal(GpuProgramRef prg)
+	void D3D9RenderSystem::bindGpuProgram_internal(GpuProgramHandle prg)
 	{
 		THROW_IF_NOT_RENDER_THREAD;
 
@@ -356,7 +356,7 @@ namespace CamelotEngine
 					if (i->second.variability & variability)
 					{
 						size_t logicalIndex = i->first;
-						TextureRef texture = params->getTexture(i->second.physicalIndex);
+						TextureHandle texture = params->getTexture(i->second.physicalIndex);
 
 						const SamplerState& samplerState = params->getSamplerState(i->second.physicalIndex);
 

+ 1 - 1
CamelotFBXImporter/Include/CmFBXImporter.h

@@ -35,7 +35,7 @@ namespace CamelotEngine
 		virtual bool isMagicNumberSupported(const UINT8* magicNumPtr, UINT32 numBytes) const; 
 
 		/** Inherited from SpecificImporter */
-		virtual BaseResourceRef import(const String& filePath);
+		virtual BaseResourceHandle import(const String& filePath);
 	private:
 		vector<String>::type mExtensions;
 

+ 2 - 2
CamelotFBXImporter/Source/CmFBXImporter.cpp

@@ -35,7 +35,7 @@ namespace CamelotEngine
 		return true; // FBX files can be plain-text so I don't even check for magic number
 	}
 
-	BaseResourceRef FBXImporter::import(const String& filePath)
+	BaseResourceHandle FBXImporter::import(const String& filePath)
 	{
 		FbxManager* fbxManager = nullptr;
 		FbxScene* fbxScene = nullptr;
@@ -47,7 +47,7 @@ namespace CamelotEngine
 
 		shutDownSdk(fbxManager);
 
-		MeshRef mesh(new Mesh());
+		MeshHandle mesh(new Mesh());
 		mesh->setMeshData(meshData);
 
 		return mesh;

+ 8 - 8
CamelotForwardRenderer/Source/CmForwardRenderer.cpp

@@ -61,12 +61,12 @@ namespace CamelotEngine
 		// TODO - sort renderables by material/pass/parameters to minimize state changes
 		for(auto iter = allRenderables.begin(); iter != allRenderables.end(); ++iter)
 		{
-			MaterialRef material = (*iter)->getMaterial();
+			MaterialHandle material = (*iter)->getMaterial();
 
 			if(material == nullptr || !material.isResolved())
 				continue;
 
-			MeshRef mesh = (*iter)->getMesh();
+			MeshHandle mesh = (*iter)->getMesh();
 
 			if(mesh == nullptr || !mesh.isResolved())
 				continue;
@@ -100,7 +100,7 @@ namespace CamelotEngine
 
 		RenderSystem* renderSystem = RenderSystemManager::getActive();
 
-		GpuProgramRef vertProgram = pass->getVertexProgram();
+		GpuProgramHandle vertProgram = pass->getVertexProgram();
 		if(vertProgram)
 		{
 			renderSystem->bindGpuProgram(vertProgram);
@@ -111,7 +111,7 @@ namespace CamelotEngine
 				renderSystem->unbindGpuProgram(GPT_VERTEX_PROGRAM);
 		}
 
-		GpuProgramRef fragProgram = pass->getFragmentProgram();
+		GpuProgramHandle fragProgram = pass->getFragmentProgram();
 		if(fragProgram)
 		{
 			renderSystem->bindGpuProgram(fragProgram);
@@ -122,7 +122,7 @@ namespace CamelotEngine
 				renderSystem->unbindGpuProgram(GPT_FRAGMENT_PROGRAM);
 		}
 
-		GpuProgramRef geomProgram = pass->getGeometryProgram();
+		GpuProgramHandle geomProgram = pass->getGeometryProgram();
 		if(geomProgram)
 		{
 			renderSystem->bindGpuProgram(geomProgram);
@@ -207,15 +207,15 @@ namespace CamelotEngine
 		if(mActivePass == nullptr)
 			CM_EXCEPT(InternalErrorException, "Trying to set pass parameters, but no pass is set.");
 
-		GpuProgramRef vertProgram = mActivePass->getVertexProgram();
+		GpuProgramHandle vertProgram = mActivePass->getVertexProgram();
 		if(vertProgram)
 			renderSystem->bindGpuProgramParameters(GPT_VERTEX_PROGRAM, params->mVertParams, GPV_ALL);
 
-		GpuProgramRef fragProgram = mActivePass->getFragmentProgram();
+		GpuProgramHandle fragProgram = mActivePass->getFragmentProgram();
 		if(fragProgram)
 			renderSystem->bindGpuProgramParameters(GPT_FRAGMENT_PROGRAM, params->mFragParams, GPV_ALL);
 
-		GpuProgramRef geomProgram = mActivePass->getGeometryProgram();
+		GpuProgramHandle geomProgram = mActivePass->getGeometryProgram();
 		if(geomProgram)
 			renderSystem->bindGpuProgramParameters(GPT_GEOMETRY_PROGRAM, params->mGeomParams, GPV_ALL);
 	}

+ 1 - 1
CamelotFreeImgImporter/Include/CmFreeImgImporter.h

@@ -32,7 +32,7 @@ namespace CamelotEngine
 		virtual bool isMagicNumberSupported(const UINT8* magicNumPtr, UINT32 numBytes) const; 
 
 		/** Inherited from SpecificImporter */
-		virtual BaseResourceRef import(const String& filePath);
+		virtual BaseResourceHandle import(const String& filePath);
 	private:
 		vector<String>::type mExtensions;
 		std::unordered_map<String, int> mExtensionToFID;

+ 2 - 2
CamelotFreeImgImporter/Source/CmFreeImgImporter.cpp

@@ -127,7 +127,7 @@ namespace CamelotEngine
 		}
 	}
 
-	BaseResourceRef FreeImgImporter::import(const String& filePath)
+	BaseResourceHandle FreeImgImporter::import(const String& filePath)
 	{
 		DataStreamPtr fileData = FileSystem::open(filePath, true);
 
@@ -135,7 +135,7 @@ namespace CamelotEngine
 		if(imgData == nullptr || imgData->getData() == nullptr)
 			return nullptr;
 
-		TextureRef newTexture(TextureManager::instance().create(TEX_TYPE_2D, 
+		TextureHandle newTexture(TextureManager::instance().create(TEX_TYPE_2D, 
 			imgData->getWidth(), imgData->getHeight(), imgData->getNumMipmaps(), imgData->getFormat()));
 
 		newTexture->setTextureData(0, imgData);

+ 1 - 1
CamelotGLRenderer/Include/CmGLRenderSystem.h

@@ -209,7 +209,7 @@ namespace CamelotEngine {
 		/** See
           RenderSystem
          */
-		void bindGpuProgram_internal(GpuProgramRef prg);
+		void bindGpuProgram_internal(GpuProgramHandle prg);
         /** See
           RenderSystem
          */

+ 2 - 2
CamelotGLRenderer/Source/CmGLRenderSystem.cpp

@@ -254,7 +254,7 @@ namespace CamelotEngine {
 	}
 
 	//---------------------------------------------------------------------
-	void GLRenderSystem::bindGpuProgram_internal(GpuProgramRef prg)
+	void GLRenderSystem::bindGpuProgram_internal(GpuProgramHandle prg)
 	{
 		THROW_IF_NOT_RENDER_THREAD;
 
@@ -353,7 +353,7 @@ namespace CamelotEngine {
 				if(def.constType == GCT_SAMPLER2D || def.constType == GCT_SAMPLERCUBE || def.constType == GCT_SAMPLER1D 
 					|| def.constType == GCT_SAMPLER2DSHADOW || def.constType == GCT_SAMPLER3D || def.constType == GCT_SAMPLER1DSHADOW)
 				{
-					TextureRef curTexture = params->getTexture(def.physicalIndex);
+					TextureHandle curTexture = params->getTexture(def.physicalIndex);
 					setTexture_internal(def.physicalIndex, true, curTexture.getInternalPtr());
 
 					const SamplerState& samplerState = params->getSamplerState(def.physicalIndex);

+ 3 - 3
CamelotRenderer/CamelotRenderer.vcxproj

@@ -143,8 +143,8 @@
     <ClInclude Include="Include\CmRenderTexture.h" />
     <ClInclude Include="Include\CmRenderWindow.h" />
     <ClInclude Include="Include\CmResource.h" />
-    <ClInclude Include="Include\CmResourceRef.h" />
-    <ClInclude Include="Include\CmResourceRefRTTI.h" />
+    <ClInclude Include="Include\CmResourceHandle.h" />
+    <ClInclude Include="Include\CmResourceHandleRTTI.h" />
     <ClInclude Include="Include\CmResources.h" />
     <ClInclude Include="Include\CmResourcesRTTI.h" />
     <ClInclude Include="Include\CmSceneManager.h" />
@@ -203,7 +203,7 @@
     <ClCompile Include="Source\CmRenderTexture.cpp" />
     <ClCompile Include="Source\CmRenderWindow.cpp" />
     <ClCompile Include="Source\CmResource.cpp" />
-    <ClCompile Include="Source\CmResourceRef.cpp" />
+    <ClCompile Include="Source\CmResourceHandle.cpp" />
     <ClCompile Include="Source\CmResources.cpp" />
     <ClCompile Include="Source\CmSceneManager.cpp" />
     <ClCompile Include="Source\CmShader.cpp" />

+ 9 - 9
CamelotRenderer/CamelotRenderer.vcxproj.filters

@@ -259,12 +259,6 @@
     <ClInclude Include="Include\CmMaterial.h">
       <Filter>Header Files\Material</Filter>
     </ClInclude>
-    <ClInclude Include="Include\CmResourceRef.h">
-      <Filter>Header Files\Resources</Filter>
-    </ClInclude>
-    <ClInclude Include="Include\CmResourceRefRTTI.h">
-      <Filter>Header Files\RTTI</Filter>
-    </ClInclude>
     <ClInclude Include="Include\CmGpuProgramRTTI.h">
       <Filter>Header Files\RTTI</Filter>
     </ClInclude>
@@ -310,6 +304,12 @@
     <ClInclude Include="Include\CmRenderSystemContext.h">
       <Filter>Header Files\RenderSystem</Filter>
     </ClInclude>
+    <ClInclude Include="Include\CmResourceHandle.h">
+      <Filter>Header Files\Resources</Filter>
+    </ClInclude>
+    <ClInclude Include="Include\CmResourceHandleRTTI.h">
+      <Filter>Header Files\RTTI</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="Source\CamelotRenderer.cpp">
@@ -438,9 +438,6 @@
     <ClCompile Include="Source\CmMaterial.cpp">
       <Filter>Source Files\Material</Filter>
     </ClCompile>
-    <ClCompile Include="Source\CmResourceRef.cpp">
-      <Filter>Source Files\Resources</Filter>
-    </ClCompile>
     <ClCompile Include="Source\CmRendererManager.cpp">
       <Filter>Source Files\Renderer</Filter>
     </ClCompile>
@@ -456,5 +453,8 @@
     <ClCompile Include="Source\CmRenderSystemContext.cpp">
       <Filter>Source Files\RenderSystem</Filter>
     </ClCompile>
+    <ClCompile Include="Source\CmResourceHandle.cpp">
+      <Filter>Source Files\Resources</Filter>
+    </ClCompile>
   </ItemGroup>
 </Project>

+ 4 - 4
CamelotRenderer/Include/CmGpuProgramParams.h

@@ -339,7 +339,7 @@ namespace CamelotEngine {
 	 */
 	struct GpuTextureEntry
 	{
-		TextureRef texture;
+		TextureHandle texture;
 		SamplerState samplerState;
 	};
 
@@ -585,7 +585,7 @@ namespace CamelotEngine {
 		@param physicalIndex The array position of the texture
 		@param dest Reference of the texture to store
 		*/
-		void _readTexture(size_t physicalIndex, TextureRef& dest);
+		void _readTexture(size_t physicalIndex, TextureHandle& dest);
 		/** Write a 4-element floating-point parameter to the program directly to 
 		the underlying constants buffer.
 		@note You can use these methods if you have already derived the physical
@@ -727,7 +727,7 @@ namespace CamelotEngine {
 		/// Get a pointer to the 'nth' item in the int buffer
 		const int* getIntPointer(size_t pos) const { return &mIntConstants[pos]; }
 		const GpuLogicalBufferStructPtr& getSamplerLogicalBufferStruct() const { return mSamplerLogicalToPhysical; }
-		TextureRef getTexture(size_t pos) const;
+		TextureHandle getTexture(size_t pos) const;
 		const SamplerState& getSamplerState(size_t pos) const;
 		/// Get a reference to the list of textures
 		const TextureList& getTextureList() const { return mTextures; }
@@ -756,7 +756,7 @@ namespace CamelotEngine {
 		@param name The name of the parameter
 		@param val The value to set
 		*/
-		void setNamedConstant(const String& name, TextureRef val);
+		void setNamedConstant(const String& name, TextureHandle val);
 
 		/** Sets a sampler state to the program. Name of the sampler should be the same
 		as the name of the texture parameter it is being set for.

+ 1 - 1
CamelotRenderer/Include/CmImporter.h

@@ -23,7 +23,7 @@ namespace CamelotEngine
 		 *
 		 * @param	inputFilePath 	Pathname of the input file.
 		 */
-		BaseResourceRef import(const String& inputFilePath);
+		BaseResourceHandle import(const String& inputFilePath);
 
 
 		/**

+ 1 - 1
CamelotRenderer/Include/CmMaterial.h

@@ -35,7 +35,7 @@ namespace CamelotEngine
 
 		ShaderPtr getShader() const { return mShader; }
 
-		void setTexture(const String& name, TextureRef& value);
+		void setTexture(const String& name, TextureHandle& value);
 		void setFloat(const String& name, float value);
 		void setColor(const String& name, const Color& value);
 		void setVec2(const String& name, const Vector2& value);

+ 4 - 4
CamelotRenderer/Include/CmMaterialRTTI.h

@@ -77,7 +77,7 @@ namespace CamelotEngine
 		};
 
 		class TexParamKVPRTTI;
-		typedef KeyValuePair<String, TextureRef, TexParamKVPRTTI> TexParamKVP;
+		typedef KeyValuePair<String, TextureHandle, TexParamKVPRTTI> TexParamKVP;
 
 		class TexParamKVPRTTI : public RTTIType<TexParamKVP, IReflectable, TexParamKVPRTTI>
 		{
@@ -85,8 +85,8 @@ namespace CamelotEngine
 			String& getKey(TexParamKVP* obj) { return obj->mKey; }
 			void setKey(TexParamKVP* obj,  String& val) { obj->mKey = val; }
 
-			TextureRef& getValue(TexParamKVP* obj) { return obj->mValue; }
-			void setValue(TexParamKVP* obj,  TextureRef& val) { obj->mValue = val; }
+			TextureHandle& getValue(TexParamKVP* obj) { return obj->mValue; }
+			void setValue(TexParamKVP* obj,  TextureHandle& val) { obj->mValue = val; }
 
 		public:
 			TexParamKVPRTTI()
@@ -155,7 +155,7 @@ namespace CamelotEngine
 		struct MaterialParams : public IReflectable
 		{
 			map<String, FloatParam>::type mFloatParams;
-			map<String, TextureRef>::type mTextureParams;
+			map<String, TextureHandle>::type mTextureParams;
 			map<String, SamplerState>::type mSamplerStateParams;
 
 			vector<float>::type mFloatBuffer;

+ 9 - 9
CamelotRenderer/Include/CmPass.h

@@ -64,11 +64,11 @@ namespace CamelotEngine
         //-------------------------------------------------------------------------
 
 		// Vertex program
-		GpuProgramRef mVertexProgram;
+		GpuProgramHandle mVertexProgram;
 		// Fragment program
-		GpuProgramRef mFragmentProgram;
+		GpuProgramHandle mFragmentProgram;
 		// Geometry program
-		GpuProgramRef mGeometryProgram;
+		GpuProgramHandle mGeometryProgram;
 
 		// point size, applies when not using per-vertex point size
 		float mPointSize;
@@ -410,24 +410,24 @@ namespace CamelotEngine
 
 		/** Sets the details of the vertex program to use.
 		*/
-		void setVertexProgram(GpuProgramRef gpuProgram);
+		void setVertexProgram(GpuProgramHandle gpuProgram);
 
 		/** Gets the vertex program used by this pass, only available after _load(). */
-		const GpuProgramRef& getVertexProgram(void) const;
+		const GpuProgramHandle& getVertexProgram(void) const;
 
 		/** Sets the details of the fragment program to use.
 		*/
-		void setFragmentProgram(GpuProgramRef gpuProgram);
+		void setFragmentProgram(GpuProgramHandle gpuProgram);
 		
 		/** Gets the fragment program used by this pass, only available after _load(). */
-		const GpuProgramRef& getFragmentProgram(void) const;
+		const GpuProgramHandle& getFragmentProgram(void) const;
 
 		/** Sets the details of the geometry program to use.
 		*/
-		void setGeometryProgram(GpuProgramRef gpuProgram);
+		void setGeometryProgram(GpuProgramHandle gpuProgram);
 		
 		/** Gets the geometry program used by this pass, only available after _load(). */
-		const GpuProgramRef& getGeometryProgram(void) const;
+		const GpuProgramHandle& getGeometryProgram(void) const;
 
 		/************************************************************************/
 		/* 								RTTI		                     		*/

+ 6 - 6
CamelotRenderer/Include/CmPassRTTI.h

@@ -78,14 +78,14 @@ namespace CamelotEngine
 		float& getPointMaxSize(Pass* obj) { return obj->mPointMaxSize; }
 		void setPointMaxSize(Pass* obj, float& val) { obj->mPointMaxSize = val; } 
 
-		GpuProgramRef& getVertexProgram(Pass* obj) { return obj->mVertexProgram; }
-		void setVertexProgram(Pass* obj, GpuProgramRef& val) { obj->mVertexProgram = val; } 
+		GpuProgramHandle& getVertexProgram(Pass* obj) { return obj->mVertexProgram; }
+		void setVertexProgram(Pass* obj, GpuProgramHandle& val) { obj->mVertexProgram = val; } 
 
-		GpuProgramRef& getFragmentProgram(Pass* obj) { return obj->mFragmentProgram; }
-		void setFragmentProgram(Pass* obj, GpuProgramRef& val) { obj->mFragmentProgram = val; } 
+		GpuProgramHandle& getFragmentProgram(Pass* obj) { return obj->mFragmentProgram; }
+		void setFragmentProgram(Pass* obj, GpuProgramHandle& val) { obj->mFragmentProgram = val; } 
 
-		GpuProgramRef& getGeometryProgram(Pass* obj) { return obj->mGeometryProgram; }
-		void setGeometryProgram(Pass* obj, GpuProgramRef& val) { obj->mGeometryProgram = val; } 
+		GpuProgramHandle& getGeometryProgram(Pass* obj) { return obj->mGeometryProgram; }
+		void setGeometryProgram(Pass* obj, GpuProgramHandle& val) { obj->mGeometryProgram = val; } 
 	public:
 		PassRTTI()
 		{

+ 9 - 9
CamelotRenderer/Include/CmPrerequisites.h

@@ -163,9 +163,9 @@ namespace CamelotEngine
 		TID_Component = 1006,
 		TID_Camera = 1007,
 		TID_Renderable = 1008,
-		TID_ResourceRef = 1009,
+		TID_ResourceHandle = 1009,
 		TID_GpuProgram = 1010,
-		TID_ResourceRefData = 1011,
+		TID_ResourceHandleData = 1011,
 		TID_CgProgram = 1012,
 		TID_ResourceMetaData = 1013,
 		TID_Pass = 1014,
@@ -184,16 +184,16 @@ namespace CamelotEngine
 /* 							Resource references                   		*/
 /************************************************************************/
 
-#include "CmResourceRef.h"
+#include "CmResourceHandle.h"
 
 namespace CamelotEngine
 {
-	typedef ResourceRef<Resource> BaseResourceRef;
-	typedef ResourceRef<Texture> TextureRef;
-	typedef ResourceRef<Mesh> MeshRef;
-	typedef ResourceRef<GpuProgram> GpuProgramRef;
-	typedef ResourceRef<HighLevelGpuProgram> HighLevelGpuProgramRef;
-	typedef ResourceRef<Material> MaterialRef;
+	typedef ResourceHandle<Resource> BaseResourceHandle;
+	typedef ResourceHandle<Texture> TextureHandle;
+	typedef ResourceHandle<Mesh> MeshHandle;
+	typedef ResourceHandle<GpuProgram> GpuProgramHandle;
+	typedef ResourceHandle<HighLevelGpuProgram> HighLevelGpuProgramHandle;
+	typedef ResourceHandle<Material> MaterialHandle;
 }
 
 #endif // __OgrePrerequisites_H__

+ 2 - 2
CamelotRenderer/Include/CmRenderSystem.h

@@ -755,8 +755,8 @@ namespace CamelotEngine
 		@remarks Only one GpuProgram of each type can be bound at once, binding another
 		one will simply replace the existing one.
 		*/
-		void bindGpuProgram(GpuProgramRef prg);
-		virtual void bindGpuProgram_internal(GpuProgramRef prg);
+		void bindGpuProgram(GpuProgramHandle prg);
+		virtual void bindGpuProgram_internal(GpuProgramHandle prg);
 
 		/** Bind Gpu program parameters.
 		@param gptype The type of program to bind the parameters to

+ 6 - 6
CamelotRenderer/Include/CmRenderable.h

@@ -8,14 +8,14 @@ namespace CamelotEngine
 	class CM_EXPORT Renderable : public Component
 	{
 	public:
-		void setMesh(MeshRef mesh) { mMesh = mesh; }
-		void setMaterial(MaterialRef material) { mMaterial = material; }
+		void setMesh(MeshHandle mesh) { mMesh = mesh; }
+		void setMaterial(MaterialHandle material) { mMaterial = material; }
 
-		MeshRef getMesh() const { return mMesh; }
-		MaterialRef getMaterial() const { return mMaterial; }
+		MeshHandle getMesh() const { return mMesh; }
+		MaterialHandle getMaterial() const { return mMaterial; }
 	private:
-		MeshRef mMesh;
-		MaterialRef mMaterial;
+		MeshHandle mMesh;
+		MaterialHandle mMaterial;
 
 		/************************************************************************/
 		/* 							COMPONENT OVERRIDES                    		*/

+ 26 - 26
CamelotRenderer/Include/CmResourceRef.h → CamelotRenderer/Include/CmResourceHandle.h

@@ -11,11 +11,11 @@ struct CM_Bool_struct
 namespace CamelotEngine
 {
 	template <typename T>
-	class ResourceRef;
+	class ResourceHandle;
 
-	struct CM_EXPORT ResourceRefData : public IReflectable
+	struct CM_EXPORT ResourceHandleData : public IReflectable
 	{
-		ResourceRefData()
+		ResourceHandleData()
 			:mIsResolved(false)
 		{ }
 
@@ -27,12 +27,12 @@ namespace CamelotEngine
 		/* 								RTTI		                     		*/
 		/************************************************************************/
 	public:
-		friend class ResourceRefDataRTTI;
+		friend class ResourceHandleDataRTTI;
 		static RTTITypeBase* getRTTIStatic();
 		virtual RTTITypeBase* getRTTI() const;		
 	};
 
-	class CM_EXPORT ResourceRefBase : public IReflectable
+	class CM_EXPORT ResourceHandleBase : public IReflectable
 	{
 	public:
 		/**
@@ -41,15 +41,15 @@ namespace CamelotEngine
 		bool isResolved() const { return mData->mIsResolved; }
 
 	protected:
-		ResourceRefBase();
+		ResourceHandleBase();
 
-		std::shared_ptr<ResourceRefData> mData;
+		std::shared_ptr<ResourceHandleData> mData;
 
 		void init(Resource* ptr);
 		void init(std::shared_ptr<Resource> ptr);
 
 		template <typename T1>
-		void init(const ResourceRef<T1>& ptr)
+		void init(const ResourceHandle<T1>& ptr)
 		{
 			mData = ptr.mData;
 		}
@@ -62,50 +62,50 @@ namespace CamelotEngine
 		void resolve(std::shared_ptr<Resource> ptr);
 
 		/**
-		 * @brief	Sets an uuid of the ResourceRef. Should only be called by
+		 * @brief	Sets an uuid of the ResourceHandle. Should only be called by
 		 * 			Resources class.
 		 */
-		void ResourceRefBase::setUUID(const String& uuid);
+		void ResourceHandleBase::setUUID(const String& uuid);
 
 		/************************************************************************/
 		/* 								RTTI		                     		*/
 		/************************************************************************/
 	public:
-		friend class ResourceRefRTTI;
+		friend class ResourceHandleRTTI;
 		static RTTITypeBase* getRTTIStatic();
 		virtual RTTITypeBase* getRTTI() const;
 	};
 
 	template <typename T>
-	class ResourceRef : public ResourceRefBase
+	class ResourceHandle : public ResourceHandleBase
 	{
 	public:
-		ResourceRef()
-			:ResourceRefBase()
+		ResourceHandle()
+			:ResourceHandleBase()
 		{	}
 
-		explicit ResourceRef(T* ptr)
-			:ResourceRefBase()
+		explicit ResourceHandle(T* ptr)
+			:ResourceHandleBase()
 		{
 			init(ptr);
 		}
 
-		ResourceRef(std::shared_ptr<T> ptr)
-			:ResourceRefBase()
+		ResourceHandle(std::shared_ptr<T> ptr)
+			:ResourceHandleBase()
 		{
 			init(ptr);
 		}
 
 		template <typename T1>
-		ResourceRef(const ResourceRef<T1>& ptr)
-			:ResourceRefBase()
+		ResourceHandle(const ResourceHandle<T1>& ptr)
+			:ResourceHandleBase()
 		{
 			init(ptr);
 		}
 
-		operator ResourceRef<Resource>() 
+		operator ResourceHandle<Resource>() 
 		{
-			return ResourceRef<Resource>(mData->mPtr); 
+			return ResourceHandle<Resource>(mData->mPtr); 
 		}
 
 		// TODO Low priority - User can currently try to access these even if resource ptr is not resolved
@@ -130,19 +130,19 @@ namespace CamelotEngine
 	};
 
 	template<class _Ty1, class _Ty2>
-		ResourceRef<_Ty1> static_resource_cast(const ResourceRef<_Ty2>& other)
+		ResourceHandle<_Ty1> static_resource_cast(const ResourceHandle<_Ty2>& other)
 	{	
-		return ResourceRef<_Ty1>(other);
+		return ResourceHandle<_Ty1>(other);
 	}
 
 	template<class _Ty1, class _Ty2>
-	bool operator==(const ResourceRef<_Ty1>& _Left, const ResourceRef<_Ty2>& _Right)
+	bool operator==(const ResourceHandle<_Ty1>& _Left, const ResourceHandle<_Ty2>& _Right)
 	{	
 		return (_Left.get() == _Right.get());
 	}
 
 	template<class _Ty1, class _Ty2>
-	bool operator!=(const ResourceRef<_Ty1>& _Left, const ResourceRef<_Ty2>& _Right)
+	bool operator!=(const ResourceHandle<_Ty1>& _Left, const ResourceHandle<_Ty2>& _Right)
 	{	
 		return (!(_Left == _Right));
 	}

+ 83 - 0
CamelotRenderer/Include/CmResourceHandleRTTI.h

@@ -0,0 +1,83 @@
+#pragma once
+
+#include "CmPrerequisites.h"
+#include "CmRTTIType.h"
+#include "CmResourceHandle.h"
+#include "CmResources.h"
+
+namespace CamelotEngine
+{
+	class CM_EXPORT ResourceHandleDataRTTI : public RTTIType<ResourceHandleData, IReflectable, ResourceHandleDataRTTI>
+	{
+	private:
+		String& getUUID(ResourceHandleData* obj) { return obj->mUUID; }
+		void setUUID(ResourceHandleData* obj, String& uuid) 
+		{ 
+			obj->mUUID = uuid; 
+		} 
+	public:
+		ResourceHandleDataRTTI()
+		{
+			addPlainField("mUUID", 0, &ResourceHandleDataRTTI::getUUID, &ResourceHandleDataRTTI::setUUID);
+		}
+
+		virtual const String& getRTTIName()
+		{
+			static String name = "ResourceHandleData";
+			return name;
+		}
+
+		virtual UINT32 getRTTIId()
+		{
+			return TID_ResourceHandleData;
+		}
+
+		virtual std::shared_ptr<IReflectable> newRTTIObject()
+		{
+			return std::shared_ptr<ResourceHandleData>(new ResourceHandleData());
+		}
+	};
+
+	class CM_EXPORT ResourceHandleRTTI : public RTTIType<ResourceHandleBase, IReflectable, ResourceHandleRTTI>
+	{
+	private:
+		std::shared_ptr<ResourceHandleData> getResData(ResourceHandleBase* obj) { return obj->mData; }
+		void setResData(ResourceHandleBase* obj, std::shared_ptr<ResourceHandleData> val) { obj->mData = val; }
+	public:
+		ResourceHandleRTTI()
+		{
+			addReflectablePtrField("mData", 0, &ResourceHandleRTTI::getResData, &ResourceHandleRTTI::setResData);
+		}
+
+		void onDeserializationEnded(IReflectable* obj)
+		{
+			ResourceHandleBase* resourceHandle = static_cast<ResourceHandleBase*>(obj);
+
+			if(resourceHandle->mData && resourceHandle->mData->mUUID != "")
+			{
+				// NOTE: This will cause Resources::load to be called recursively with resources that contain other
+				// resources. This might cause problems. Keep this note here as a warning until I prove otherwise.
+				BaseResourceHandle loadedResource = gResources().loadFromUUID(resourceHandle->mData->mUUID);
+
+				if(loadedResource)
+					resourceHandle->resolve(loadedResource.getInternalPtr());
+			}
+		}
+
+		virtual const String& getRTTIName()
+		{
+			static String name = "ResourceHandleBase";
+			return name;
+		}
+
+		virtual UINT32 getRTTIId()
+		{
+			return TID_ResourceHandle;
+		}
+
+		virtual std::shared_ptr<IReflectable> newRTTIObject()
+		{
+			return std::shared_ptr<ResourceHandleBase>(new ResourceHandleBase());
+		}
+	};
+}

+ 0 - 83
CamelotRenderer/Include/CmResourceRefRTTI.h

@@ -1,83 +0,0 @@
-#pragma once
-
-#include "CmPrerequisites.h"
-#include "CmRTTIType.h"
-#include "CmResourceRef.h"
-#include "CmResources.h"
-
-namespace CamelotEngine
-{
-	class CM_EXPORT ResourceRefDataRTTI : public RTTIType<ResourceRefData, IReflectable, ResourceRefDataRTTI>
-	{
-	private:
-		String& getUUID(ResourceRefData* obj) { return obj->mUUID; }
-		void setUUID(ResourceRefData* obj, String& uuid) 
-		{ 
-			obj->mUUID = uuid; 
-		} 
-	public:
-		ResourceRefDataRTTI()
-		{
-			addPlainField("mUUID", 0, &ResourceRefDataRTTI::getUUID, &ResourceRefDataRTTI::setUUID);
-		}
-
-		virtual const String& getRTTIName()
-		{
-			static String name = "ResourceRefData";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId()
-		{
-			return TID_ResourceRefData;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject()
-		{
-			return std::shared_ptr<ResourceRefData>(new ResourceRefData());
-		}
-	};
-
-	class CM_EXPORT ResourceRefRTTI : public RTTIType<ResourceRefBase, IReflectable, ResourceRefRTTI>
-	{
-	private:
-		std::shared_ptr<ResourceRefData> getResData(ResourceRefBase* obj) { return obj->mData; }
-		void setResData(ResourceRefBase* obj, std::shared_ptr<ResourceRefData> val) { obj->mData = val; }
-	public:
-		ResourceRefRTTI()
-		{
-			addReflectablePtrField("mData", 0, &ResourceRefRTTI::getResData, &ResourceRefRTTI::setResData);
-		}
-
-		void onDeserializationEnded(IReflectable* obj)
-		{
-			ResourceRefBase* resourceRef = static_cast<ResourceRefBase*>(obj);
-
-			if(resourceRef->mData && resourceRef->mData->mUUID != "")
-			{
-				// NOTE: This will cause Resources::load to be called recursively with resources that contain other
-				// resources. This might cause problems. Keep this note here as a warning until I prove otherwise.
-				BaseResourceRef loadedResource = gResources().loadFromUUID(resourceRef->mData->mUUID);
-
-				if(loadedResource)
-					resourceRef->resolve(loadedResource.getInternalPtr());
-			}
-		}
-
-		virtual const String& getRTTIName()
-		{
-			static String name = "ResourceRefBase";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId()
-		{
-			return TID_ResourceRef;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject()
-		{
-			return std::shared_ptr<ResourceRefBase>(new ResourceRefBase());
-		}
-	};
-}

+ 12 - 12
CamelotRenderer/Include/CmResources.h

@@ -24,7 +24,7 @@ namespace CamelotEngine
 		struct CM_EXPORT ResourceLoadRequest
 		{
 			String filePath;
-			BaseResourceRef resource;
+			BaseResourceHandle resource;
 		};
 
 		struct CM_EXPORT ResourceLoadResponse
@@ -34,7 +34,7 @@ namespace CamelotEngine
 
 		struct CM_EXPORT ResourceAsyncOp
 		{
-			BaseResourceRef resource;
+			BaseResourceHandle resource;
 			WorkQueue::RequestID requestID;
 		};
 
@@ -68,17 +68,17 @@ namespace CamelotEngine
 		 *
 		 * @return	Loaded resource, or null if it cannot be found.
 		 */
-		BaseResourceRef load(const String& filePath);
+		BaseResourceHandle load(const String& filePath);
 
 		/**
 		 * @brief	Loads the resource asynchronously. Initially returned resource should not be used
-		 * 			until BaseResourceRef.isResolved gets set to true. (Set only at the end of each frame)
+		 * 			until BaseResourceHandle.isResolved gets set to true. (Set only at the end of each frame)
 		 *
 		 * @param	filePath	Full pathname of the file.
 		 * 						
 		 * @return	Resource where the data will eventually be loaded, or null if the file cannot be found.
 		 */
-		BaseResourceRef loadAsync(const String& filePath);
+		BaseResourceHandle loadAsync(const String& filePath);
 
 		/**
 		 * @brief	Loads the resource with the given uuid.
@@ -87,24 +87,24 @@ namespace CamelotEngine
 		 *
 		 * @return	Loaded resource, or null if it cannot be found.
 		 */
-		BaseResourceRef loadFromUUID(const String& uuid);
+		BaseResourceHandle loadFromUUID(const String& uuid);
 
 		/**
 		* @brief	Loads the resource with the given UUID asynchronously. Initially returned resource should not be used
-		* 			until BaseResourceRef.isResolved gets set to true. (Set only at the end of each frame)
+		* 			until BaseResourceHandle.isResolved gets set to true. (Set only at the end of each frame)
 		 *
 		 * @param	uuid	UUID of the resource to load. 
 		 *
 		 * @return	Resource where the data will eventually be loaded, or null if the file cannot be found.
 		 */
-		BaseResourceRef loadFromUUIDAsync(const String& uuid);
+		BaseResourceHandle loadFromUUIDAsync(const String& uuid);
 
 		/**
 		 * @brief	Saves the resource. Resource must be registered using Resources::create beforehand.
 		 *
 		 * @param	resource   	The resource.
 		 */
-		void save(BaseResourceRef resource);
+		void save(BaseResourceHandle resource);
 
 		/**
 		 * @brief	Creates a new resource at the specified location. Throws an exception if resource already exists.
@@ -115,7 +115,7 @@ namespace CamelotEngine
 		 * @param	overwrite	(optional) If true, any existing resource at the specified location
 		 * 						will be overwritten.
 		 */
-		void create(BaseResourceRef resource, const String& filePath, bool overwrite = false);
+		void create(BaseResourceHandle resource, const String& filePath, bool overwrite = false);
 
 	public:
 		struct ResourceMetaData : public IReflectable
@@ -143,10 +143,10 @@ namespace CamelotEngine
 		WorkQueuePtr mWorkQueue; // TODO Low priority - I might want to make this more global so other classes can use it
 		UINT16 mWorkQueueChannel;
 
-		unordered_map<String, BaseResourceRef>::type mLoadedResources; // TODO Low priority - I'm not sure how will filePath as key do performance wise
+		unordered_map<String, BaseResourceHandle>::type mLoadedResources; // TODO Low priority - I'm not sure how will filePath as key do performance wise
 		unordered_map<String, ResourceAsyncOp>::type mInProgressResources; // Resources that are being asynchronously loaded
 
-		BaseResourceRef loadInternal(const String& filePath, bool synchronous); 
+		BaseResourceHandle loadInternal(const String& filePath, bool synchronous); 
 		ResourcePtr loadFromDiskAndDeserialize(const String& filePath);
 
 		void loadMetaData();

+ 1 - 1
CamelotRenderer/Include/CmSpecificImporter.h

@@ -28,6 +28,6 @@ namespace CamelotEngine
 		 *
 		 * @return	null if it fails, otherwise the loaded object.
 		 */
-		virtual BaseResourceRef import(const String& filePath) = 0;
+		virtual BaseResourceHandle import(const String& filePath) = 0;
 	};
 }

+ 4 - 4
CamelotRenderer/Source/CmGpuProgramParams.cpp

@@ -392,7 +392,7 @@ namespace CamelotEngine
 		memcpy(dest, &mIntConstants[physicalIndex], sizeof(int) * count);
 	}
 	//-----------------------------------------------------------------------------
-	void GpuProgramParameters::_readTexture(size_t physicalIndex, TextureRef& dest)
+	void GpuProgramParameters::_readTexture(size_t physicalIndex, TextureHandle& dest)
 	{
 		assert(physicalIndex < mTextures.size());
 		dest = mTextures[physicalIndex]->texture;
@@ -671,11 +671,11 @@ namespace CamelotEngine
 		return *def;
 	}
 	//----------------------------------------------------------------------------
-	TextureRef GpuProgramParameters::getTexture(size_t pos) const 
+	TextureHandle GpuProgramParameters::getTexture(size_t pos) const 
 	{ 
 		if(mTextures[pos] == nullptr)
 		{
-			return TextureRef();
+			return TextureHandle();
 		}
 
 		return mTextures[pos]->texture; 
@@ -728,7 +728,7 @@ namespace CamelotEngine
 		}
 	}
 	//----------------------------------------------------------------------------
-	void GpuProgramParameters::setNamedConstant(const String& name, TextureRef val)
+	void GpuProgramParameters::setNamedConstant(const String& name, TextureHandle val)
 	{
 		// look up, and throw an exception if we're not ignoring missing
 		const GpuConstantDefinition* def = 

+ 2 - 2
CamelotRenderer/Source/CmImporter.cpp

@@ -45,7 +45,7 @@ namespace CamelotEngine
 		return false;
 	}
 
-	BaseResourceRef Importer::import(const String& inputFilePath)
+	BaseResourceHandle Importer::import(const String& inputFilePath)
 	{
 		if(!FileSystem::fileExists(inputFilePath))
 		{
@@ -70,7 +70,7 @@ namespace CamelotEngine
 			}
 		}
 
-		BaseResourceRef importedResource = importer->import(inputFilePath);
+		BaseResourceHandle importedResource = importer->import(inputFilePath);
 		importedResource->init();
 
 		return importedResource;

+ 4 - 4
CamelotRenderer/Source/CmMaterial.cpp

@@ -35,15 +35,15 @@ namespace CamelotEngine
 
 					PassParametersPtr params = PassParametersPtr(new PassParameters());
 
-					GpuProgramRef vertProgram = curPass->getVertexProgram();
+					GpuProgramHandle vertProgram = curPass->getVertexProgram();
 					if(vertProgram)
 						params->mVertParams = vertProgram->createParameters();
 
-					GpuProgramRef fragProgram = curPass->getFragmentProgram();
+					GpuProgramHandle fragProgram = curPass->getFragmentProgram();
 					if(fragProgram)
 						params->mFragParams = fragProgram->createParameters();
 
-					GpuProgramRef geomProgram = curPass->getGeometryProgram();
+					GpuProgramHandle geomProgram = curPass->getGeometryProgram();
 					if(geomProgram)
 						params->mGeomParams = geomProgram->createParameters();	
 
@@ -66,7 +66,7 @@ namespace CamelotEngine
 		}
 	}
 
-	void Material::setTexture(const String& name, TextureRef& value)
+	void Material::setTexture(const String& name, TextureHandle& value)
 	{
 		throwIfNotInitialized();
 		setParam(name, value);

+ 1 - 1
CamelotRenderer/Source/CmMaterialRTTI.cpp

@@ -41,7 +41,7 @@ namespace CamelotEngine
 
 				if(def.constType == GCT_SAMPLER2D)
 				{
-					TextureRef texture;
+					TextureHandle texture;
 					allParams[i]->_readTexture(iter->second.physicalIndex, texture);
 					params->mTextureParams[iter->first] = texture;
 

+ 6 - 6
CamelotRenderer/Source/CmPass.cpp

@@ -306,32 +306,32 @@ namespace CamelotEngine
 		return mDepthBiasPerIteration;
 	}
     //-----------------------------------------------------------------------
-	void Pass::setVertexProgram(GpuProgramRef gpuProgram)
+	void Pass::setVertexProgram(GpuProgramHandle gpuProgram)
 	{
 		mVertexProgram = gpuProgram;
 	}
     //-----------------------------------------------------------------------
-	void Pass::setFragmentProgram(GpuProgramRef gpuProgram)
+	void Pass::setFragmentProgram(GpuProgramHandle gpuProgram)
 	{
 		mFragmentProgram = gpuProgram;
 	}
 	//-----------------------------------------------------------------------
-	void Pass::setGeometryProgram(GpuProgramRef gpuProgram)
+	void Pass::setGeometryProgram(GpuProgramHandle gpuProgram)
 	{
 		mGeometryProgram = gpuProgram;
 	}
 	//-----------------------------------------------------------------------
-	const GpuProgramRef& Pass::getVertexProgram(void) const
+	const GpuProgramHandle& Pass::getVertexProgram(void) const
 	{
 		return mVertexProgram;
 	}
 	//-----------------------------------------------------------------------
-	const GpuProgramRef& Pass::getFragmentProgram(void) const
+	const GpuProgramHandle& Pass::getFragmentProgram(void) const
 	{
 		return mFragmentProgram;
 	}
 	//-----------------------------------------------------------------------
-	const GpuProgramRef& Pass::getGeometryProgram(void) const
+	const GpuProgramHandle& Pass::getGeometryProgram(void) const
 	{
 		return mGeometryProgram;
 	}

+ 2 - 2
CamelotRenderer/Source/CmRenderSystem.cpp

@@ -722,7 +722,7 @@ namespace CamelotEngine {
 		}
 	}
 	//-----------------------------------------------------------------------
-	void RenderSystem::bindGpuProgram(GpuProgramRef prg)
+	void RenderSystem::bindGpuProgram(GpuProgramHandle prg)
 	{
 		THROW_IF_INVALID_CONTEXT;
 		CM_LOCK_MUTEX(mActiveContextMutex);
@@ -730,7 +730,7 @@ namespace CamelotEngine {
 		mActiveContext->queueCommand(boost::bind(&RenderSystem::bindGpuProgram_internal, this, prg));
 	}
 	//-----------------------------------------------------------------------
-	void RenderSystem::bindGpuProgram_internal(GpuProgramRef prg)
+	void RenderSystem::bindGpuProgram_internal(GpuProgramHandle prg)
 	{
 		THROW_IF_NOT_RENDER_THREAD;
 

+ 59 - 0
CamelotRenderer/Source/CmResourceHandle.cpp

@@ -0,0 +1,59 @@
+#include "CmPrerequisites.h"
+#include "CmResourceHandle.h"
+#include "CmResource.h"
+#include "CmResourceHandleRTTI.h"
+#include "CmResources.h"
+
+namespace CamelotEngine
+{
+	RTTITypeBase* ResourceHandleData::getRTTIStatic()
+	{
+		return ResourceHandleDataRTTI::instance();
+	}
+
+	RTTITypeBase* ResourceHandleData::getRTTI() const
+	{
+		return ResourceHandleData::getRTTIStatic();
+	}
+
+	ResourceHandleBase::ResourceHandleBase()
+	{
+		mData = std::shared_ptr<ResourceHandleData>(new ResourceHandleData());
+	}
+
+	void ResourceHandleBase::resolve(std::shared_ptr<Resource> ptr) 
+	{ 
+		init(ptr);
+	}
+
+	void ResourceHandleBase::setUUID(const String& uuid) 
+	{ 
+		mData->mUUID = uuid;
+	}
+
+	void ResourceHandleBase::init(Resource* ptr)
+	{
+		init(std::shared_ptr<Resource>(ptr));
+	}
+
+	void ResourceHandleBase::init(std::shared_ptr<Resource> ptr)
+	{
+		mData->mPtr = ptr;
+
+		if(mData->mPtr)
+		{
+			mData->mUUID = mData->mPtr->getUUID();
+			mData->mIsResolved = true; 
+		}
+	}
+
+	RTTITypeBase* ResourceHandleBase::getRTTIStatic()
+	{
+		return ResourceHandleRTTI::instance();
+	}
+
+	RTTITypeBase* ResourceHandleBase::getRTTI() const
+	{
+		return ResourceHandleBase::getRTTIStatic();
+	}
+}

+ 0 - 59
CamelotRenderer/Source/CmResourceRef.cpp

@@ -1,59 +0,0 @@
-#include "CmPrerequisites.h"
-#include "CmResourceRef.h"
-#include "CmResource.h"
-#include "CmResourceRefRTTI.h"
-#include "CmResources.h"
-
-namespace CamelotEngine
-{
-	RTTITypeBase* ResourceRefData::getRTTIStatic()
-	{
-		return ResourceRefDataRTTI::instance();
-	}
-
-	RTTITypeBase* ResourceRefData::getRTTI() const
-	{
-		return ResourceRefData::getRTTIStatic();
-	}
-
-	ResourceRefBase::ResourceRefBase()
-	{
-		mData = std::shared_ptr<ResourceRefData>(new ResourceRefData());
-	}
-
-	void ResourceRefBase::resolve(std::shared_ptr<Resource> ptr) 
-	{ 
-		init(ptr);
-	}
-
-	void ResourceRefBase::setUUID(const String& uuid) 
-	{ 
-		mData->mUUID = uuid;
-	}
-
-	void ResourceRefBase::init(Resource* ptr)
-	{
-		init(std::shared_ptr<Resource>(ptr));
-	}
-
-	void ResourceRefBase::init(std::shared_ptr<Resource> ptr)
-	{
-		mData->mPtr = ptr;
-
-		if(mData->mPtr)
-		{
-			mData->mUUID = mData->mPtr->getUUID();
-			mData->mIsResolved = true; 
-		}
-	}
-
-	RTTITypeBase* ResourceRefBase::getRTTIStatic()
-	{
-		return ResourceRefRTTI::instance();
-	}
-
-	RTTITypeBase* ResourceRefBase::getRTTI() const
-	{
-		return ResourceRefBase::getRTTIStatic();
-	}
-}

+ 10 - 10
CamelotRenderer/Source/CmResources.cpp

@@ -113,17 +113,17 @@ namespace CamelotEngine
 		mWorkQueue->processResponses();
 	}
 
-	BaseResourceRef Resources::load(const String& filePath)
+	BaseResourceHandle Resources::load(const String& filePath)
 	{
 		return loadInternal(filePath, true);
 	}
 
-	BaseResourceRef Resources::loadAsync(const String& filePath)
+	BaseResourceHandle Resources::loadAsync(const String& filePath)
 	{
 		return loadInternal(filePath, false);
 	}
 
-	BaseResourceRef Resources::loadFromUUID(const String& uuid)
+	BaseResourceHandle Resources::loadFromUUID(const String& uuid)
 	{
 		if(!metaExists_UUID(uuid))
 		{
@@ -136,7 +136,7 @@ namespace CamelotEngine
 		return load(metaEntry->mPath);
 	}
 
-	BaseResourceRef Resources::loadFromUUIDAsync(const String& uuid)
+	BaseResourceHandle Resources::loadFromUUIDAsync(const String& uuid)
 	{
 		if(!metaExists_UUID(uuid))
 		{
@@ -149,7 +149,7 @@ namespace CamelotEngine
 		return loadAsync(metaEntry->mPath);
 	}
 
-	BaseResourceRef Resources::loadInternal(const String& filePath, bool synchronous)
+	BaseResourceHandle Resources::loadInternal(const String& filePath, bool synchronous)
 	{
 		auto iterFind = mLoadedResources.find(filePath);
 		if(iterFind != mLoadedResources.end()) // Resource is already loaded
@@ -181,15 +181,15 @@ namespace CamelotEngine
 		// TODO Low priority - Right now I don't allow loading of resources that don't have meta-data, because I need to know resources UUID
 		// at this point. And I can't do that without having meta-data. Other option is to partially load the resource to read the UUID but due to the
 		// nature of the serializer it could complicate things. (But possible if this approach proves troublesome)
-		// The reason I need the UUID is that when resource is loaded Async, the returned ResourceRef needs to have a valid UUID, in case I assign that
-		// ResourceRef to something and then save that something. If I didn't assign it, the saved ResourceRef would have a blank (i.e. invalid) UUID.
+		// The reason I need the UUID is that when resource is loaded Async, the returned ResourceHandle needs to have a valid UUID, in case I assign that
+		// ResourceHandle to something and then save that something. If I didn't assign it, the saved ResourceHandle would have a blank (i.e. invalid) UUID.
 		if(!metaExists_Path(filePath))
 		{
 			CM_EXCEPT(InternalErrorException, "Cannot load resource that isn't registered in the meta database. Call Resources::create first.");
 		}
 
 		String uuid = getUUIDFromPath(filePath);
-		BaseResourceRef newResource;
+		BaseResourceHandle newResource;
 		newResource.setUUID(uuid); // UUID needs to be set immediately if the resource gets loaded async
 
 		ResourceLoadRequestPtr resRequest = ResourceLoadRequestPtr(new Resources::ResourceLoadRequest());
@@ -222,7 +222,7 @@ namespace CamelotEngine
 		return resource;
 	}
 
-	void Resources::create(BaseResourceRef resource, const String& filePath, bool overwrite)
+	void Resources::create(BaseResourceHandle resource, const String& filePath, bool overwrite)
 	{
 		assert(resource.get() != nullptr);
 
@@ -248,7 +248,7 @@ namespace CamelotEngine
 		save(resource);
 	}
 
-	void Resources::save(BaseResourceRef resource)
+	void Resources::save(BaseResourceHandle resource)
 	{
 		assert(resource.get() != nullptr);
 

+ 1 - 9
CamelotRenderer/TODO.txt

@@ -16,25 +16,18 @@ High-level TODO:
 
 
 Command buffer TODO:
- - Make sure no internal methods call the external interface
-  - Debug checks to make sure external methods don't get called from render thread, and that internal methods ONLY get called from render thread
- - Don't make _internal methods protected. Other classes like RenderTarget, buffers, etc. will be executing from render thread and they need direct access to them
  - My current approach doesn't allow multiple threads to use the RenderSystem (contexts should be handled differently)
  - Make sure the user knows resources are shared between contexts. All resource updates are executed before rendering a frame, so whichever context updated the resource last,
    was the version that will be used.
 
  Immediate:
   - Resource updates shouldn't happen once per frame. Resources should be submitted to render thread immediately.
-  - Port the rest of the RenderSystem of use RenderContext
   - Port resource creation to use RenderContext (texture/mesh/shader/etc initialization and updates)
-  - Make sure to add thread checks (surrounded by #if DEBUG) to RenderSystem and Vertex/Index/Pixel buffers, textures, meshes, etc.
+  - Make sure to add thread checks (surrounded by #if DEBUG) to Vertex/Index/Pixel buffers, textures, meshes, etc.
 
  Later:
-  - Add resource creation "culling" to avoid updating some resource multiple times in a single frame
   - Modify resource loading so we don't need a special Response handler on the main thread. We should be able to immediately queue up resource command instead.
-  - Provide Async versions of all read commands
   - Add documentation that tells the user that reading a resource non-async will block the thread and execute all queued render commands first
-  - Add documentation that tells the user that resource updates only get applied at the end of the frame, unless you manually override it.
   - Create render thread in Application, and not in RenderSystem?
 
 HIGH PRIORITY TODO:
@@ -45,7 +38,6 @@ HIGH PRIORITY TODO:
  - HLSL & Cg don't handle include files yet
 
 Mid priority TODO:
- - Rename ResourceRef to ResourceHandle?
  - Add a field that tracks % of resource deserialization in BinarySerializer
 
  - Separate render thread