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

Serialize/Deserialize sampler states

Marko Pintera 13 лет назад
Родитель
Сommit
4556df668c

+ 2 - 1
CamelotClient/CamelotClient.cpp

@@ -153,7 +153,8 @@ int _tmain(int argc, _TCHAR* argv[])
 	MaterialRef testMaterial = MaterialPtr(new Material());
 	MaterialRef testMaterial = MaterialPtr(new Material());
 	testMaterial->setShader(testShader);
 	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:\\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"));
 	MeshRef dbgMesh = static_resource_cast<Mesh>(Importer::instance().import("C:\\X_Arena_Tower.FBX"));
 
 
 	gResources().create(testTex, "C:\\ExportTest.tex", true);
 	gResources().create(testTex, "C:\\ExportTest.tex", true);

+ 1 - 1
CamelotD3D9Renderer/Include/CmD3D9Mappings.h

@@ -68,7 +68,7 @@ namespace CamelotEngine
 		/// return a D3D9 equivalent for a Ogre TexCoordCalsMethod value
 		/// return a D3D9 equivalent for a Ogre TexCoordCalsMethod value
 		static DWORD get(TexCoordCalcMethod m, const D3DCAPS9& caps);
 		static DWORD get(TexCoordCalcMethod m, const D3DCAPS9& caps);
 		/// return a D3D9 equivalent for a Ogre TextureAddressingMode value
 		/// return a D3D9 equivalent for a Ogre TextureAddressingMode value
-		static D3DTEXTUREADDRESS get(TextureState::TextureAddressingMode tam, const D3DCAPS9& devCaps);
+		static D3DTEXTUREADDRESS get(SamplerState::TextureAddressingMode tam, const D3DCAPS9& devCaps);
 		/// return a D3D9 equivalent for a Ogre SceneBlendFactor value
 		/// return a D3D9 equivalent for a Ogre SceneBlendFactor value
 		static D3DBLEND get(SceneBlendFactor sbf);
 		static D3DBLEND get(SceneBlendFactor sbf);
 		/// return a D3D9 equivlalent for a Ogre SceneBlendOperation value
 		/// return a D3D9 equivlalent for a Ogre SceneBlendOperation value

+ 1 - 1
CamelotD3D9Renderer/Include/CmD3D9RenderSystem.h

@@ -231,7 +231,7 @@ namespace CamelotEngine
 		void _setVertexTexture(size_t unit, const TexturePtr& tex);
 		void _setVertexTexture(size_t unit, const TexturePtr& tex);
 		void _disableTextureUnit(size_t texUnit);
 		void _disableTextureUnit(size_t texUnit);
 		void _setTextureCoordSet( size_t unit, size_t index );
 		void _setTextureCoordSet( size_t unit, size_t index );
-        void _setTextureAddressingMode(size_t stage, const TextureState::UVWAddressingMode& uvw);
+        void _setTextureAddressingMode(size_t stage, const SamplerState::UVWAddressingMode& uvw);
         void _setTextureBorderColour(size_t stage, const Color& colour);
         void _setTextureBorderColour(size_t stage, const Color& colour);
 		void _setTextureMipmapBias(size_t unit, float bias);
 		void _setTextureMipmapBias(size_t unit, float bias);
 		void _setSceneBlending( SceneBlendFactor sourceFactor, SceneBlendFactor destFactor, SceneBlendOperation op );
 		void _setSceneBlending( SceneBlendFactor sourceFactor, SceneBlendFactor destFactor, SceneBlendOperation op );

+ 5 - 5
CamelotD3D9Renderer/Source/CmD3D9Mappings.cpp

@@ -84,17 +84,17 @@ namespace CamelotEngine
 		return 0;
 		return 0;
 	}
 	}
 	//---------------------------------------------------------------------
 	//---------------------------------------------------------------------
-	D3DTEXTUREADDRESS D3D9Mappings::get(TextureState::TextureAddressingMode tam, const D3DCAPS9& devCaps)
+	D3DTEXTUREADDRESS D3D9Mappings::get(SamplerState::TextureAddressingMode tam, const D3DCAPS9& devCaps)
 	{
 	{
 		switch( tam )
 		switch( tam )
 		{
 		{
-		case TextureState::TAM_WRAP:
+		case SamplerState::TAM_WRAP:
 			return D3DTADDRESS_WRAP;
 			return D3DTADDRESS_WRAP;
-		case TextureState::TAM_MIRROR:
+		case SamplerState::TAM_MIRROR:
 			return D3DTADDRESS_MIRROR;
 			return D3DTADDRESS_MIRROR;
-		case TextureState::TAM_CLAMP:
+		case SamplerState::TAM_CLAMP:
 			return D3DTADDRESS_CLAMP;
 			return D3DTADDRESS_CLAMP;
-        case TextureState::TAM_BORDER:
+        case SamplerState::TAM_BORDER:
             if (devCaps.TextureAddressCaps & D3DPTADDRESSCAPS_BORDER)
             if (devCaps.TextureAddressCaps & D3DPTADDRESSCAPS_BORDER)
                 return D3DTADDRESS_BORDER;
                 return D3DTADDRESS_BORDER;
             else
             else

+ 1 - 1
CamelotD3D9Renderer/Source/CmD3D9RenderSystem.cpp

@@ -1833,7 +1833,7 @@ namespace CamelotEngine
 	}
 	}
 	//---------------------------------------------------------------------
 	//---------------------------------------------------------------------
 	void D3D9RenderSystem::_setTextureAddressingMode( size_t stage, 
 	void D3D9RenderSystem::_setTextureAddressingMode( size_t stage, 
-		const TextureState::UVWAddressingMode& uvw )
+		const SamplerState::UVWAddressingMode& uvw )
 	{
 	{
 		HRESULT hr;
 		HRESULT hr;
 		if( FAILED( hr = __SetSamplerState( static_cast<DWORD>(stage), D3DSAMP_ADDRESSU, D3D9Mappings::get(uvw.u, mDeviceManager->getActiveDevice()->getD3D9DeviceCaps()) ) ) )
 		if( FAILED( hr = __SetSamplerState( static_cast<DWORD>(stage), D3DSAMP_ADDRESSU, D3D9Mappings::get(uvw.u, mDeviceManager->getActiveDevice()->getD3D9DeviceCaps()) ) ) )

+ 1 - 1
CamelotForwardRenderer/Include/CmForwardRenderer.h

@@ -11,7 +11,7 @@ namespace CamelotEngine
 		virtual const String& getName() const;
 		virtual const String& getName() const;
 
 
 		virtual void renderAll();
 		virtual void renderAll();
-		virtual void render(CameraPtr camera);
+		virtual void render(const CameraPtr camera);
 
 
 	protected:
 	protected:
 		/**
 		/**

+ 2 - 2
CamelotGLRenderer/Include/CmGLRenderSystem.h

@@ -72,7 +72,7 @@ namespace CamelotEngine {
         void makeGLMatrix(GLfloat gl_matrix[16], const Matrix4& m);
         void makeGLMatrix(GLfloat gl_matrix[16], const Matrix4& m);
  
  
         GLint getBlendMode(SceneBlendFactor ogreBlend) const;
         GLint getBlendMode(SceneBlendFactor ogreBlend) const;
-		GLint getTextureAddressingMode(TextureState::TextureAddressingMode tam) const;
+		GLint getTextureAddressingMode(SamplerState::TextureAddressingMode tam) const;
 				void initialiseContext(RenderWindow* primary);
 				void initialiseContext(RenderWindow* primary);
 
 
         void setLights();
         void setLights();
@@ -257,7 +257,7 @@ namespace CamelotEngine {
         /** See
         /** See
           RenderSystem
           RenderSystem
          */
          */
-        void _setTextureAddressingMode(size_t stage, const TextureState::UVWAddressingMode& uvw);
+        void _setTextureAddressingMode(size_t stage, const SamplerState::UVWAddressingMode& uvw);
         /** See
         /** See
           RenderSystem
           RenderSystem
          */
          */

+ 6 - 6
CamelotGLRenderer/Source/CmGLRenderSystem.cpp

@@ -1354,24 +1354,24 @@ namespace CamelotEngine {
 	}
 	}
 	//-----------------------------------------------------------------------------
 	//-----------------------------------------------------------------------------
 	GLint GLRenderSystem::getTextureAddressingMode(
 	GLint GLRenderSystem::getTextureAddressingMode(
-		TextureState::TextureAddressingMode tam) const
+		SamplerState::TextureAddressingMode tam) const
 	{
 	{
 		switch(tam)
 		switch(tam)
 		{
 		{
 		default:
 		default:
-		case TextureState::TAM_WRAP:
+		case SamplerState::TAM_WRAP:
 			return GL_REPEAT;
 			return GL_REPEAT;
-		case TextureState::TAM_MIRROR:
+		case SamplerState::TAM_MIRROR:
 			return GL_MIRRORED_REPEAT;
 			return GL_MIRRORED_REPEAT;
-		case TextureState::TAM_CLAMP:
+		case SamplerState::TAM_CLAMP:
 			return GL_CLAMP_TO_EDGE;
 			return GL_CLAMP_TO_EDGE;
-		case TextureState::TAM_BORDER:
+		case SamplerState::TAM_BORDER:
 			return GL_CLAMP_TO_BORDER;
 			return GL_CLAMP_TO_BORDER;
 		}
 		}
 
 
 	}
 	}
 	//-----------------------------------------------------------------------------
 	//-----------------------------------------------------------------------------
-	void GLRenderSystem::_setTextureAddressingMode(size_t stage, const TextureState::UVWAddressingMode& uvw)
+	void GLRenderSystem::_setTextureAddressingMode(size_t stage, const SamplerState::UVWAddressingMode& uvw)
 	{
 	{
 		if (!activateGLTextureUnit(stage))
 		if (!activateGLTextureUnit(stage))
 			return;
 			return;

+ 2 - 2
CamelotRenderer/CamelotRenderer.vcxproj

@@ -153,7 +153,7 @@
     <ClInclude Include="Include\CmTexture.h" />
     <ClInclude Include="Include\CmTexture.h" />
     <ClInclude Include="Include\CmTextureManager.h" />
     <ClInclude Include="Include\CmTextureManager.h" />
     <ClInclude Include="Include\CmTextureRTTI.h" />
     <ClInclude Include="Include\CmTextureRTTI.h" />
-    <ClInclude Include="Include\CmTextureState.h" />
+    <ClInclude Include="Include\CmSamplerState.h" />
     <ClInclude Include="Include\CmVertexIndexData.h" />
     <ClInclude Include="Include\CmVertexIndexData.h" />
     <ClInclude Include="Include\CmViewport.h" />
     <ClInclude Include="Include\CmViewport.h" />
     <ClInclude Include="Include\CmWindowEventUtilities.h" />
     <ClInclude Include="Include\CmWindowEventUtilities.h" />
@@ -208,7 +208,7 @@
     <ClCompile Include="Source\CmTechnique.cpp" />
     <ClCompile Include="Source\CmTechnique.cpp" />
     <ClCompile Include="Source\CmTexture.cpp" />
     <ClCompile Include="Source\CmTexture.cpp" />
     <ClCompile Include="Source\CmTextureManager.cpp" />
     <ClCompile Include="Source\CmTextureManager.cpp" />
-    <ClCompile Include="Source\CmTextureState.cpp" />
+    <ClCompile Include="Source\CmSamplerState.cpp" />
     <ClCompile Include="Source\CmVertexIndexData.cpp" />
     <ClCompile Include="Source\CmVertexIndexData.cpp" />
     <ClCompile Include="Source\CmViewport.cpp" />
     <ClCompile Include="Source\CmViewport.cpp" />
     <ClCompile Include="Source\CmWindowEventUtilities.cpp" />
     <ClCompile Include="Source\CmWindowEventUtilities.cpp" />

+ 6 - 6
CamelotRenderer/CamelotRenderer.vcxproj.filters

@@ -118,9 +118,6 @@
     <ClInclude Include="Include\CmVertexIndexData.h">
     <ClInclude Include="Include\CmVertexIndexData.h">
       <Filter>Header Files\RenderSystem</Filter>
       <Filter>Header Files\RenderSystem</Filter>
     </ClInclude>
     </ClInclude>
-    <ClInclude Include="Include\CmTextureState.h">
-      <Filter>Header Files\RenderSystem</Filter>
-    </ClInclude>
     <ClInclude Include="Include\CmRenderWindow.h">
     <ClInclude Include="Include\CmRenderWindow.h">
       <Filter>Header Files\RenderSystem</Filter>
       <Filter>Header Files\RenderSystem</Filter>
     </ClInclude>
     </ClInclude>
@@ -307,6 +304,9 @@
     <ClInclude Include="Include\Win32\CmOSCursorImpl.h">
     <ClInclude Include="Include\Win32\CmOSCursorImpl.h">
       <Filter>Header Files\Win32</Filter>
       <Filter>Header Files\Win32</Filter>
     </ClInclude>
     </ClInclude>
+    <ClInclude Include="Include\CmSamplerState.h">
+      <Filter>Header Files\RenderSystem</Filter>
+    </ClInclude>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <ClCompile Include="Source\CamelotRenderer.cpp">
     <ClCompile Include="Source\CamelotRenderer.cpp">
@@ -378,9 +378,6 @@
     <ClCompile Include="Source\CmRenderWindow.cpp">
     <ClCompile Include="Source\CmRenderWindow.cpp">
       <Filter>Source Files\RenderSystem</Filter>
       <Filter>Source Files\RenderSystem</Filter>
     </ClCompile>
     </ClCompile>
-    <ClCompile Include="Source\CmTextureState.cpp">
-      <Filter>Source Files\RenderSystem</Filter>
-    </ClCompile>
     <ClCompile Include="Source\CmVertexIndexData.cpp">
     <ClCompile Include="Source\CmVertexIndexData.cpp">
       <Filter>Source Files\RenderSystem</Filter>
       <Filter>Source Files\RenderSystem</Filter>
     </ClCompile>
     </ClCompile>
@@ -450,5 +447,8 @@
     <ClCompile Include="Source\Win32\CmOSCursorImpl.cpp">
     <ClCompile Include="Source\Win32\CmOSCursorImpl.cpp">
       <Filter>Source Files\Win32</Filter>
       <Filter>Source Files\Win32</Filter>
     </ClCompile>
     </ClCompile>
+    <ClCompile Include="Source\CmSamplerState.cpp">
+      <Filter>Source Files\RenderSystem</Filter>
+    </ClCompile>
   </ItemGroup>
   </ItemGroup>
 </Project>
 </Project>

+ 37 - 2
CamelotRenderer/Include/CmGpuProgramParams.h

@@ -31,6 +31,7 @@ THE SOFTWARE.
 // Precompiler options
 // Precompiler options
 #include "CmPrerequisites.h"
 #include "CmPrerequisites.h"
 #include "CmRenderOperation.h"
 #include "CmRenderOperation.h"
+#include "CmSamplerState.h"
 
 
 namespace CamelotEngine {
 namespace CamelotEngine {
 
 
@@ -336,6 +337,17 @@ namespace CamelotEngine {
 	};
 	};
 	typedef std::shared_ptr<GpuLogicalBufferStruct> GpuLogicalBufferStructPtr;
 	typedef std::shared_ptr<GpuLogicalBufferStruct> GpuLogicalBufferStructPtr;
 
 
+	/**
+	 * @brief	Contains a reference to a texture together with it's sampler properties
+	 */
+	struct GpuTextureEntry
+	{
+		TextureRef texture;
+		SamplerState samplerState;
+	};
+
+	typedef std::shared_ptr<GpuTextureEntry> GpuTextureEntryPtr;
+
 	/** Definition of container that holds the current float constants.
 	/** Definition of container that holds the current float constants.
 	@note Not necessarily in direct index order to constant indexes, logical
 	@note Not necessarily in direct index order to constant indexes, logical
 	to physical index map is derived from GpuProgram
 	to physical index map is derived from GpuProgram
@@ -350,7 +362,7 @@ namespace CamelotEngine {
 	@note Not necessarily in direct index order to constant indexes, logical
 	@note Not necessarily in direct index order to constant indexes, logical
 	to physical index map is derived from GpuProgram
 	to physical index map is derived from GpuProgram
 	*/
 	*/
-	typedef vector<TextureRef>::type TextureList;
+	typedef vector<GpuTextureEntryPtr>::type TextureList;
 
 
 	/** Collects together the program parameters used for a GpuProgram.
 	/** Collects together the program parameters used for a GpuProgram.
 	@remarks
 	@remarks
@@ -720,7 +732,8 @@ namespace CamelotEngine {
 		/// Get a pointer to the 'nth' item in the int buffer
 		/// Get a pointer to the 'nth' item in the int buffer
 		const int* getIntPointer(size_t pos) const { return &mIntConstants[pos]; }
 		const int* getIntPointer(size_t pos) const { return &mIntConstants[pos]; }
 		const GpuLogicalBufferStructPtr& getSamplerLogicalBufferStruct() const { return mSamplerLogicalToPhysical; }
 		const GpuLogicalBufferStructPtr& getSamplerLogicalBufferStruct() const { return mSamplerLogicalToPhysical; }
-		TextureRef getTexture(size_t pos) const { return mTextures[pos];}
+		TextureRef getTexture(size_t pos) const;
+		const SamplerState& getSamplerState(size_t pos) const;
 		/// Get a reference to the list of textures
 		/// Get a reference to the list of textures
 		const TextureList& getTextureList() const { return mTextures; }
 		const TextureList& getTextureList() const { return mTextures; }
 
 
@@ -749,6 +762,28 @@ namespace CamelotEngine {
 		*/
 		*/
 		void setNamedConstant(const String& name, TextureRef val);
 		void setNamedConstant(const String& name, TextureRef 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.
+		@remarks
+		Different types of GPU programs support different types of constant parameters.
+		For example, it's relatively common to find that vertex programs only support
+		floating point constants, and that fragment programs only support integer (fixed point)
+		parameters. This can vary depending on the program version supported by the
+		graphics card being used. You should consult the documentation for the type of
+		low level program you are using, or alternatively use the methods
+		provided on RenderSystemCapabilities to determine the options.
+		@par
+		Another possible limitation is that some systems only allow constants to be set
+		on certain boundaries, e.g. in sets of 4 values for example. Again, see
+		RenderSystemCapabilities for full details.
+		@note
+		This named option will only work if you are using a parameters object created
+		from a high-level program (HighLevelGpuProgram).
+		@param name The name of the parameter
+		@param val The value to set
+		*/
+		void setNamedConstant(const String& name, const SamplerState& val);
+
 		/** Sets a single value constant floating-point parameter to the program.
 		/** Sets a single value constant floating-point parameter to the program.
 		@remarks
 		@remarks
 		Different types of GPU programs support different types of constant parameters.
 		Different types of GPU programs support different types of constant parameters.

+ 80 - 1
CamelotRenderer/Include/CmMaterialRTTI.h

@@ -113,12 +113,50 @@ namespace CamelotEngine
 			}
 			}
 		};
 		};
 
 
+		class SamplerStateParamKVPRTTI;
+		typedef KeyValuePair<String, SamplerState, SamplerStateParamKVPRTTI> SamplerStateKVP;
+
+		class SamplerStateParamKVPRTTI : public RTTIType<SamplerStateKVP, IReflectable, SamplerStateParamKVPRTTI>
+		{
+		private:
+			String& getKey(SamplerStateKVP* obj) { return obj->mKey; }
+			void setKey(SamplerStateKVP* obj,  String& val) { obj->mKey = val; }
+
+			SamplerState& getValue(SamplerStateKVP* obj) { return obj->mValue; }
+			void setValue(SamplerStateKVP* obj,  SamplerState& val) { obj->mValue = val; }
+
+		public:
+			SamplerStateParamKVPRTTI()
+			{
+				addPlainField("mKey", 0, &SamplerStateParamKVPRTTI::getKey, &SamplerStateParamKVPRTTI::setKey);
+				addPlainField("mValue", 1, &SamplerStateParamKVPRTTI::getValue, &SamplerStateParamKVPRTTI::setValue);
+			}
+
+		public:
+			virtual const String& getRTTIName()
+			{
+				static String name = "SamplerStateKVP";
+				return name;
+			}
+
+			virtual UINT32 getRTTIId()
+			{
+				return TID_SamplerStateParamKVP;
+			}
+
+			virtual std::shared_ptr<IReflectable> newRTTIObject()
+			{
+				return std::shared_ptr<SamplerStateKVP>(new SamplerStateKVP());
+			}
+		};
+
 		class MaterialParamsRTTI;
 		class MaterialParamsRTTI;
 
 
 		struct MaterialParams : public IReflectable
 		struct MaterialParams : public IReflectable
 		{
 		{
 			map<String, FloatParam>::type mFloatParams;
 			map<String, FloatParam>::type mFloatParams;
 			map<String, TextureRef>::type mTextureParams;
 			map<String, TextureRef>::type mTextureParams;
+			map<String, SamplerState>::type mSamplerStateParams;
 
 
 			vector<float>::type mFloatBuffer;
 			vector<float>::type mFloatBuffer;
 
 
@@ -140,6 +178,7 @@ namespace CamelotEngine
 			{
 			{
 				vector<std::shared_ptr<FloatParamKVP>>::type mFloatParams;
 				vector<std::shared_ptr<FloatParamKVP>>::type mFloatParams;
 				vector<std::shared_ptr<TexParamKVP>>::type mTexParams;
 				vector<std::shared_ptr<TexParamKVP>>::type mTexParams;
+				vector<std::shared_ptr<SamplerStateKVP>>::type mSamplerStateParams;
 			};
 			};
 
 
 			std::shared_ptr<FloatParamKVP> getFloatParam(MaterialParams* obj, UINT32 idx)
 			std::shared_ptr<FloatParamKVP> getFloatParam(MaterialParams* obj, UINT32 idx)
@@ -206,6 +245,38 @@ namespace CamelotEngine
 				return obj->mTextureParams.size();
 				return obj->mTextureParams.size();
 			}
 			}
 
 
+			std::shared_ptr<SamplerStateKVP> getSamplerStateParam(MaterialParams* obj, UINT32 idx)
+			{
+				UINT32 curIdx = 0;
+				for(auto iter = obj->mSamplerStateParams.begin(); iter != obj->mSamplerStateParams.end(); ++iter)
+				{
+					if(curIdx == idx)
+					{
+						return std::shared_ptr<SamplerStateKVP>(new SamplerStateKVP(iter->first, iter->second));
+					}
+
+					curIdx++;
+				}
+
+				CM_EXCEPT(InternalErrorException, "Invalid index.");
+			}
+
+			void setSamplerStateParam(MaterialParams* obj, UINT32 idx, std::shared_ptr<SamplerStateKVP> value)
+			{
+				TempParams* tempParams = boost::any_cast<TempParams*>(obj->mRTTIData);
+				tempParams->mSamplerStateParams.push_back(value);
+			}
+
+			void setNumSamplerStateParams(MaterialParams* obj, UINT32 size)
+			{
+				// Do nothing. Map is expanded automatically as entries are added
+			}
+
+			UINT32 getNumSamplerStateParams(MaterialParams* obj)
+			{
+				return obj->mSamplerStateParams.size();
+			}
+
 			ManagedDataBlock getFloatBuffer(MaterialParams* obj)
 			ManagedDataBlock getFloatBuffer(MaterialParams* obj)
 			{
 			{
 				size_t bufferSize = obj->mFloatBuffer.size();
 				size_t bufferSize = obj->mFloatBuffer.size();
@@ -235,7 +306,9 @@ namespace CamelotEngine
 					&MaterialParamsRTTI::setFloatParam, &MaterialParamsRTTI::setNumFloatParams);
 					&MaterialParamsRTTI::setFloatParam, &MaterialParamsRTTI::setNumFloatParams);
 				addReflectablePtrArrayField("mTexParams", 1, &MaterialParamsRTTI::getTexParam, &MaterialParamsRTTI::getNumTexParams, 
 				addReflectablePtrArrayField("mTexParams", 1, &MaterialParamsRTTI::getTexParam, &MaterialParamsRTTI::getNumTexParams, 
 					&MaterialParamsRTTI::setTexParam, &MaterialParamsRTTI::setNumTexParams);
 					&MaterialParamsRTTI::setTexParam, &MaterialParamsRTTI::setNumTexParams);
-				addDataBlockField("mFloatBuffer", 2, &MaterialParamsRTTI::getFloatBuffer, &MaterialParamsRTTI::setFloatBuffer);
+				addReflectablePtrArrayField("mSamplerStateParams", 2, &MaterialParamsRTTI::getSamplerStateParam, &MaterialParamsRTTI::getNumSamplerStateParams, 
+					&MaterialParamsRTTI::setSamplerStateParam, &MaterialParamsRTTI::setNumSamplerStateParams);
+				addDataBlockField("mFloatBuffer", 3, &MaterialParamsRTTI::getFloatBuffer, &MaterialParamsRTTI::setFloatBuffer);
 			}
 			}
 
 
 			virtual void onDeserializationStarted(IReflectable* obj)
 			virtual void onDeserializationStarted(IReflectable* obj)
@@ -270,6 +343,12 @@ namespace CamelotEngine
 					materialParams->mTextureParams[texParam->mKey] = texParam->mValue;
 					materialParams->mTextureParams[texParam->mKey] = texParam->mValue;
 				}
 				}
 
 
+				for(auto iter = tempParams->mSamplerStateParams.begin(); iter != tempParams->mSamplerStateParams.end(); ++iter)
+				{
+					std::shared_ptr<SamplerStateKVP> samplerStateParam = *iter;
+					materialParams->mSamplerStateParams[samplerStateParam->mKey] = samplerStateParam->mValue;
+				}
+
 				materialParams->mRTTIData = nullptr;
 				materialParams->mRTTIData = nullptr;
 			}
 			}
 
 

+ 4 - 2
CamelotRenderer/Include/CmPrerequisites.h

@@ -91,7 +91,7 @@ namespace CamelotEngine {
     class RenderWindow;
     class RenderWindow;
     class RenderOperation;
     class RenderOperation;
     class StringInterface;
     class StringInterface;
-    class TextureState;
+    class SamplerState;
     class TextureManager;
     class TextureManager;
     class Viewport;
     class Viewport;
     class VertexBufferBinding;
     class VertexBufferBinding;
@@ -168,7 +168,9 @@ namespace CamelotEngine
 		TID_Material = 1017,
 		TID_Material = 1017,
 		TID_MaterialParams = 1018,
 		TID_MaterialParams = 1018,
 		TID_FloatParamKVP = 1019,
 		TID_FloatParamKVP = 1019,
-		TID_MaterialTexParamKVP = 1020
+		TID_MaterialTexParamKVP = 1020,
+		TID_SamplerState = 1021,
+		TID_SamplerStateParamKVP = 1022
 	};
 	};
 }
 }
 
 

+ 3 - 3
CamelotRenderer/Include/CmRenderSystem.h

@@ -35,7 +35,7 @@ THE SOFTWARE.
 
 
 #include "CmString.h"
 #include "CmString.h"
 
 
-#include "CmTextureState.h"
+#include "CmSamplerState.h"
 #include "CmCommon.h"
 #include "CmCommon.h"
 
 
 #include "CmRenderOperation.h"
 #include "CmRenderOperation.h"
@@ -540,7 +540,7 @@ namespace CamelotEngine
 		only sets those settings which are different from the current settings for this
 		only sets those settings which are different from the current settings for this
 		unit, thus minimising render state changes.
 		unit, thus minimising render state changes.
 		*/
 		*/
-		virtual void _setTextureUnitSettings(size_t texUnit, const TexturePtr& texture, TextureState& tl);
+		virtual void _setTextureUnitSettings(size_t texUnit, const TexturePtr& texture, SamplerState& tl);
 		/** Turns off a texture unit. */
 		/** Turns off a texture unit. */
 		virtual void _disableTextureUnit(size_t texUnit);
 		virtual void _disableTextureUnit(size_t texUnit);
 		/** Disables all texture units from the given unit upwards */
 		/** Disables all texture units from the given unit upwards */
@@ -661,7 +661,7 @@ namespace CamelotEngine
 		virtual void _setTextureLayerAnisotropy(size_t unit, unsigned int maxAnisotropy) = 0;
 		virtual void _setTextureLayerAnisotropy(size_t unit, unsigned int maxAnisotropy) = 0;
 
 
 		/** Sets the texture addressing mode for a texture unit.*/
 		/** Sets the texture addressing mode for a texture unit.*/
-		virtual void _setTextureAddressingMode(size_t unit, const TextureState::UVWAddressingMode& uvw) = 0;
+		virtual void _setTextureAddressingMode(size_t unit, const SamplerState::UVWAddressingMode& uvw) = 0;
 
 
 		/** Sets the texture border colour for a texture unit.*/
 		/** Sets the texture border colour for a texture unit.*/
 		virtual void _setTextureBorderColour(size_t unit, const Color& colour) = 0;
 		virtual void _setTextureBorderColour(size_t unit, const Color& colour) = 0;

+ 1 - 1
CamelotRenderer/Include/CmRenderer.h

@@ -23,6 +23,6 @@ namespace CamelotEngine
 		/**
 		/**
 		 * @brief	Sets the currently active pass.
 		 * @brief	Sets the currently active pass.
 		 */
 		 */
-		virtual void setPass(PassPtr pass) = 0;
+		virtual void setPass(const PassPtr pass) = 0;
 	};
 	};
 }
 }

+ 12 - 74
CamelotRenderer/Include/CmTextureState.h → CamelotRenderer/Include/CmSamplerState.h

@@ -25,8 +25,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 THE SOFTWARE.
 THE SOFTWARE.
 -----------------------------------------------------------------------------
 -----------------------------------------------------------------------------
 */
 */
-#ifndef __TextureState_H__
-#define __TextureState_H__
+#pragma once
 
 
 #include "CmPrerequisites.h"
 #include "CmPrerequisites.h"
 #include "CmCommon.h"
 #include "CmCommon.h"
@@ -42,25 +41,18 @@ namespace CamelotEngine {
 	/** \addtogroup Materials
 	/** \addtogroup Materials
 	*  @{
 	*  @{
 	*/
 	*/
-	/** Class representing the state of a single texture unit during a Pass of a
+	/** Class representing the state of a single sampler unit during a Pass of a
         Technique, of a Material.
         Technique, of a Material.
     @remarks
     @remarks
-        Texture units are pipelines for retrieving texture data for rendering onto
-        your objects in the world. Using them is common to both the fixed-function and 
-        the programmable (vertex and fragment program) pipeline, but some of the 
-        settings will only have an effect in the fixed-function pipeline (for example, 
-        setting a texture rotation will have no effect if you use the programmable
-        pipeline, because this is overridden by the fragment program). The effect
-        of each setting as regards the 2 pipelines is commented in each setting.
-    @par
-        When I use the term 'fixed-function pipeline' I mean traditional rendering
-        where you do not use vertex or fragment programs (shaders). Programmable 
-        pipeline means that for this pass you are using vertex or fragment programs.
+        Sampler units are pipelines for retrieving texture data for rendering onto
+        your objects in the world. 
     */
     */
-	class CM_EXPORT TextureState
+	class CM_EXPORT SamplerState
     {
     {
     public:
     public:
 
 
+		static SamplerState EMPTY;
+
         /** Texture addressing modes - default is TAM_WRAP.
         /** Texture addressing modes - default is TAM_WRAP.
         @note
         @note
             These settings are relevant in both the fixed-function and the
             These settings are relevant in both the fixed-function and the
@@ -98,15 +90,15 @@ namespace CamelotEngine {
 
 
         /** Default constructor.
         /** Default constructor.
         */
         */
-        TextureState(TextureType type);
+        SamplerState();
 
 
-        TextureState(const TextureState& oth );
+        SamplerState(const SamplerState& oth );
 
 
-        TextureState & operator = ( const TextureState& oth );
+        SamplerState & operator = ( const SamplerState& oth );
 
 
         /** Default destructor.
         /** Default destructor.
         */
         */
-        ~TextureState();
+        ~SamplerState();
 
 
 		/** The type of unit to bind the texture settings to. */
 		/** The type of unit to bind the texture settings to. */
 		enum BindingType
 		enum BindingType
@@ -134,50 +126,6 @@ namespace CamelotEngine {
 		*/
 		*/
 		BindingType getBindingType(void) const;
 		BindingType getBindingType(void) const;
 
 
-        /** Returns true if this texture unit is either a series of 6 2D textures, each
-            in it's own frame, or is a full 3D cube map. You can tell which by checking
-            getTextureType.
-        @note
-        Applies to both fixed-function and programmable pipeline.
-        */
-        bool isCubic(void) const;
-
-        /** Returns true if this texture layer uses a composite 3D cubic texture.
-        @note
-        Applies to both fixed-function and programmable pipeline.
-        */
-        bool is3D(void) const;
-
-        /** Returns the type of this texture.
-        @note
-        Applies to both fixed-function and programmable pipeline.
-        */
-        TextureType getTextureType(void) const;
-
-        /** Sets the desired pixel format when load the texture.
-        */
-        void setDesiredFormat(PixelFormat desiredFormat);
-
-        /** Gets the desired pixel format when load the texture.
-        */
-        PixelFormat getDesiredFormat(void) const;
-
-        /** Sets how many mipmaps have been requested for the texture.
-		*/
-        void setNumMipmaps(int numMipmaps);
-
-        /** Gets how many mipmaps have been requested for the texture.
-		*/
-        int getNumMipmaps(void) const;
-
-		/** Sets whether this texture is requested to be loaded as alpha if single channel
-		*/
-        void setIsAlpha(bool isAlpha);
-
-		/** Gets whether this texture is requested to be loaded as alpha if single channel
-		*/
-        bool getIsAlpha(void) const;
-
 		/// @copydoc Texture::setHardwareGammaEnabled
 		/// @copydoc Texture::setHardwareGammaEnabled
 		void setHardwareGammaEnabled(bool enabled);
 		void setHardwareGammaEnabled(bool enabled);
 		/// @copydoc Texture::isHardwareGammaEnabled
 		/// @copydoc Texture::isHardwareGammaEnabled
@@ -272,14 +220,8 @@ namespace CamelotEngine {
 		*/
 		*/
 		float getTextureMipmapBias(void) const { return mMipmapBias; }
 		float getTextureMipmapBias(void) const { return mMipmapBias; }
 protected:
 protected:
-        // State
-        TextureType mTextureType; 
-        PixelFormat mDesiredFormat;
-		int mTextureSrcMipmaps; // Request number of mipmaps
-
         UVWAddressingMode mAddressMode;
         UVWAddressingMode mAddressMode;
 
 
-        bool mIsAlpha;
 		bool mHwGamma;
 		bool mHwGamma;
 
 
         /// Texture filtering - minification
         /// Texture filtering - minification
@@ -293,8 +235,6 @@ protected:
 		/// Mipmap bias (always float, not float)
 		/// Mipmap bias (always float, not float)
 		float mMipmapBias;
 		float mMipmapBias;
 
 
-        bool mIsDefaultAniso;
-        bool mIsDefaultFiltering;
 		/// Binding type (fragment or vertex pipeline)
 		/// Binding type (fragment or vertex pipeline)
 		BindingType mBindingType;
 		BindingType mBindingType;
     };
     };
@@ -302,6 +242,4 @@ protected:
 	/** @} */
 	/** @} */
 	/** @} */
 	/** @} */
 
 
-}
-
-#endif
+}

+ 41 - 2
CamelotRenderer/Source/CmGpuProgramParams.cpp

@@ -396,7 +396,7 @@ namespace CamelotEngine
 	void GpuProgramParameters::_readTexture(size_t physicalIndex, TextureRef& dest)
 	void GpuProgramParameters::_readTexture(size_t physicalIndex, TextureRef& dest)
 	{
 	{
 		assert(physicalIndex < mTextures.size());
 		assert(physicalIndex < mTextures.size());
-		dest = mTextures[physicalIndex];
+		dest = mTextures[physicalIndex]->texture;
 	}
 	}
 	//---------------------------------------------------------------------
 	//---------------------------------------------------------------------
 	GpuLogicalIndexUse* GpuProgramParameters::_getFloatConstantLogicalIndexUse(
 	GpuLogicalIndexUse* GpuProgramParameters::_getFloatConstantLogicalIndexUse(
@@ -670,7 +670,26 @@ namespace CamelotEngine
 		const GpuConstantDefinition* def = _findNamedConstantDefinition(name, true);
 		const GpuConstantDefinition* def = _findNamedConstantDefinition(name, true);
 
 
 		return *def;
 		return *def;
+	}
+	//----------------------------------------------------------------------------
+	TextureRef GpuProgramParameters::getTexture(size_t pos) const 
+	{ 
+		if(mTextures[pos] == nullptr)
+		{
+			return TextureRef();
+		}
+
+		return mTextures[pos]->texture; 
+	}
+	//----------------------------------------------------------------------------
+	const SamplerState& GpuProgramParameters::getSamplerState(size_t pos) const 
+	{ 
+		if(mTextures[pos] == nullptr)
+		{
+			return SamplerState::EMPTY;
+		}
 
 
+		return mTextures[pos]->samplerState; 
 	}
 	}
 	//-----------------------------------------------------------------------------
 	//-----------------------------------------------------------------------------
 	bool GpuProgramParameters::hasNamedConstant(const String& name) const
 	bool GpuProgramParameters::hasNamedConstant(const String& name) const
@@ -717,7 +736,27 @@ namespace CamelotEngine
 			_findNamedConstantDefinition(name, !mIgnoreMissingParams);
 			_findNamedConstantDefinition(name, !mIgnoreMissingParams);
 
 
 		if (def)
 		if (def)
-			mTextures[def->physicalIndex] = val;
+		{
+			if(mTextures[def->physicalIndex] == nullptr)
+				mTextures[def->physicalIndex] = GpuTextureEntryPtr(new GpuTextureEntry());
+
+			mTextures[def->physicalIndex]->texture = val;
+		}
+	}
+	//-----------------------------------------------------------------------------
+	void GpuProgramParameters::setNamedConstant(const String& name, const SamplerState& val)
+	{
+		// look up, and throw an exception if we're not ignoring missing
+		const GpuConstantDefinition* def = 
+			_findNamedConstantDefinition(name, !mIgnoreMissingParams);
+
+		if (def)
+		{
+			if(mTextures[def->physicalIndex] == nullptr)
+				mTextures[def->physicalIndex] = GpuTextureEntryPtr(new GpuTextureEntry());
+
+			mTextures[def->physicalIndex]->samplerState = val;
+		}
 	}
 	}
 	//-----------------------------------------------------------------------------
 	//-----------------------------------------------------------------------------
 	void GpuProgramParameters::setNamedConstant(const String& name, float val)
 	void GpuProgramParameters::setNamedConstant(const String& name, float val)

+ 11 - 3
CamelotRenderer/Source/CmMaterialRTTI.cpp

@@ -41,9 +41,12 @@ namespace CamelotEngine
 
 
 				if(def.constType == GCT_SAMPLER2D)
 				if(def.constType == GCT_SAMPLER2D)
 				{
 				{
-					TextureRef value;
-					allParams[i]->_readTexture(iter->second.physicalIndex, value);
-					params->mTextureParams[iter->first] = value;
+					TextureRef texture;
+					allParams[i]->_readTexture(iter->second.physicalIndex, texture);
+					params->mTextureParams[iter->first] = texture;
+
+					SamplerState samplerState = allParams[i]->getSamplerState(iter->second.physicalIndex);
+					params->mSamplerStateParams[iter->first] = samplerState;
 				}
 				}
 				else
 				else
 				{
 				{
@@ -134,6 +137,11 @@ namespace CamelotEngine
 
 
 					if(iterFind != params->mTextureParams.end())
 					if(iterFind != params->mTextureParams.end())
 						allParams[i]->setNamedConstant(iter->first, iterFind->second);
 						allParams[i]->setNamedConstant(iter->first, iterFind->second);
+
+					auto iterFind2 = params->mSamplerStateParams.find(iter->first);
+
+					if(iterFind2 != params->mSamplerStateParams.end())
+						allParams[i]->setNamedConstant(iter->first, iterFind2->second);
 				}
 				}
 				else
 				else
 				{
 				{

+ 3 - 3
CamelotRenderer/Source/CmRenderSystem.cpp

@@ -278,7 +278,7 @@ namespace CamelotEngine {
         return mActiveViewport;
         return mActiveViewport;
     }
     }
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
-    void RenderSystem::_setTextureUnitSettings(size_t texUnit, const TexturePtr& tex, TextureState& tl)
+    void RenderSystem::_setTextureUnitSettings(size_t texUnit, const TexturePtr& tex, SamplerState& tl)
     {
     {
         // This method is only ever called to set a texture unit to valid details
         // This method is only ever called to set a texture unit to valid details
         // The method _disableTextureUnit is called to turn a unit off
         // The method _disableTextureUnit is called to turn a unit off
@@ -287,7 +287,7 @@ namespace CamelotEngine {
 		if (mCurrentCapabilities->hasCapability(RSC_VERTEX_TEXTURE_FETCH) &&
 		if (mCurrentCapabilities->hasCapability(RSC_VERTEX_TEXTURE_FETCH) &&
 			!mCurrentCapabilities->getVertexTextureUnitsShared())
 			!mCurrentCapabilities->getVertexTextureUnitsShared())
 		{
 		{
-			if (tl.getBindingType() == TextureState::BT_VERTEX)
+			if (tl.getBindingType() == SamplerState::BT_VERTEX)
 			{
 			{
 				// Bind vertex texture
 				// Bind vertex texture
 				_setVertexTexture(texUnit, tex);
 				_setVertexTexture(texUnit, tex);
@@ -322,7 +322,7 @@ namespace CamelotEngine {
 		_setTextureMipmapBias(texUnit, tl.getTextureMipmapBias());
 		_setTextureMipmapBias(texUnit, tl.getTextureMipmapBias());
 
 
         // Texture addressing mode
         // Texture addressing mode
-        const TextureState::UVWAddressingMode& uvw = tl.getTextureAddressingMode();
+        const SamplerState::UVWAddressingMode& uvw = tl.getTextureAddressingMode();
         _setTextureAddressingMode(texUnit, uvw);
         _setTextureAddressingMode(texUnit, uvw);
     }
     }
 	//-----------------------------------------------------------------------
 	//-----------------------------------------------------------------------

+ 28 - 82
CamelotRenderer/Source/CmTextureState.cpp → CamelotRenderer/Source/CmSamplerState.cpp

@@ -25,144 +25,94 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 THE SOFTWARE.
 THE SOFTWARE.
 -----------------------------------------------------------------------------
 -----------------------------------------------------------------------------
 */
 */
-#include "CmTextureState.h"
+#include "CmSamplerState.h"
 #include "CmException.h"
 #include "CmException.h"
 
 
 namespace CamelotEngine {
 namespace CamelotEngine {
 
 
+	SamplerState SamplerState::EMPTY;
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
-    TextureState::TextureState(TextureType type)
-		: mTextureType(type)
-        , mDesiredFormat(PF_UNKNOWN)
-		, mTextureSrcMipmaps(MIP_DEFAULT)
-		, mIsAlpha(false)
-		, mHwGamma(false)
+    SamplerState::SamplerState()
+		: mHwGamma(false)
 		, mMinFilter(FO_LINEAR)
 		, mMinFilter(FO_LINEAR)
 		, mMagFilter(FO_LINEAR)
 		, mMagFilter(FO_LINEAR)
 		, mMipFilter(FO_POINT)
 		, mMipFilter(FO_POINT)
 		, mMaxAniso(0)
 		, mMaxAniso(0)
 		, mMipmapBias(0)
 		, mMipmapBias(0)
-		, mIsDefaultAniso(true)
-		, mIsDefaultFiltering(true)
 		, mBindingType(BT_FRAGMENT)
 		, mBindingType(BT_FRAGMENT)
     {
     {
 		setTextureAddressingMode(TAM_WRAP);
 		setTextureAddressingMode(TAM_WRAP);
     }
     }
 
 
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
-    TextureState::TextureState(const TextureState& oth )
+    SamplerState::SamplerState(const SamplerState& oth )
     {
     {
         *this = oth;
         *this = oth;
     }
     }
 
 
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
-    TextureState::~TextureState()
+    SamplerState::~SamplerState()
     {
     {
     }
     }
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
-    TextureState & TextureState::operator = ( 
-        const TextureState &oth )
+    SamplerState & SamplerState::operator = ( 
+        const SamplerState &oth )
     {
     {
         return *this;
         return *this;
     }
     }
 	//-----------------------------------------------------------------------
 	//-----------------------------------------------------------------------
-	void TextureState::setBindingType(TextureState::BindingType bt)
+	void SamplerState::setBindingType(SamplerState::BindingType bt)
 	{
 	{
 		mBindingType = bt;
 		mBindingType = bt;
 
 
 	}
 	}
 	//-----------------------------------------------------------------------
 	//-----------------------------------------------------------------------
-	TextureState::BindingType TextureState::getBindingType(void) const
+	SamplerState::BindingType SamplerState::getBindingType(void) const
 	{
 	{
 		return mBindingType;
 		return mBindingType;
 	}
 	}
-    //-----------------------------------------------------------------------
-    bool TextureState::isCubic(void) const
-    {
-        return mTextureType == TEX_TYPE_CUBE_MAP;
-    }
-    //-----------------------------------------------------------------------
-    bool TextureState::is3D(void) const
-    {
-        return mTextureType == TEX_TYPE_3D;
-    }
-    //-----------------------------------------------------------------------
-    TextureType TextureState::getTextureType(void) const
-    {
-        return mTextureType;
-	}
-    //-----------------------------------------------------------------------
-    void TextureState::setDesiredFormat(PixelFormat desiredFormat)
-    {
-        mDesiredFormat = desiredFormat;
-    }
-    //-----------------------------------------------------------------------
-    PixelFormat TextureState::getDesiredFormat(void) const
-    {
-        return mDesiredFormat;
-    }
-    //-----------------------------------------------------------------------
-    void TextureState::setNumMipmaps(int numMipmaps)
-    {
-        mTextureSrcMipmaps = numMipmaps;
-    }
-    //-----------------------------------------------------------------------
-    int TextureState::getNumMipmaps(void) const
-    {
-        return mTextureSrcMipmaps;
-    }
-    //-----------------------------------------------------------------------
-    void TextureState::setIsAlpha(bool isAlpha)
-    {
-        mIsAlpha = isAlpha;
-    }
-    //-----------------------------------------------------------------------
-    bool TextureState::getIsAlpha(void) const
-    {
-        return mIsAlpha;
-    }
 	//-----------------------------------------------------------------------
 	//-----------------------------------------------------------------------
-	void TextureState::setHardwareGammaEnabled(bool g)
+	void SamplerState::setHardwareGammaEnabled(bool g)
 	{
 	{
 		mHwGamma = g;
 		mHwGamma = g;
 	}
 	}
 	//-----------------------------------------------------------------------
 	//-----------------------------------------------------------------------
-	bool TextureState::isHardwareGammaEnabled() const
+	bool SamplerState::isHardwareGammaEnabled() const
 	{
 	{
 		return mHwGamma;
 		return mHwGamma;
 	}
 	}
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
-    const TextureState::UVWAddressingMode& 
-	TextureState::getTextureAddressingMode(void) const
+    const SamplerState::UVWAddressingMode& 
+	SamplerState::getTextureAddressingMode(void) const
     {
     {
         return mAddressMode;
         return mAddressMode;
     }
     }
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
-    void TextureState::setTextureAddressingMode(
-		TextureState::TextureAddressingMode tam)
+    void SamplerState::setTextureAddressingMode(
+		SamplerState::TextureAddressingMode tam)
     {
     {
         mAddressMode.u = tam;
         mAddressMode.u = tam;
         mAddressMode.v = tam;
         mAddressMode.v = tam;
         mAddressMode.w = tam;
         mAddressMode.w = tam;
     }
     }
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
-    void TextureState::setTextureAddressingMode(
-		TextureState::TextureAddressingMode u, 
-		TextureState::TextureAddressingMode v,
-		TextureState::TextureAddressingMode w)
+    void SamplerState::setTextureAddressingMode(
+		SamplerState::TextureAddressingMode u, 
+		SamplerState::TextureAddressingMode v,
+		SamplerState::TextureAddressingMode w)
     {
     {
         mAddressMode.u = u;
         mAddressMode.u = u;
         mAddressMode.v = v;
         mAddressMode.v = v;
         mAddressMode.w = w;
         mAddressMode.w = w;
     }
     }
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
-    void TextureState::setTextureAddressingMode(
-		const TextureState::UVWAddressingMode& uvw)
+    void SamplerState::setTextureAddressingMode(
+		const SamplerState::UVWAddressingMode& uvw)
     {
     {
         mAddressMode = uvw;
         mAddressMode = uvw;
     }
     }
 	//-----------------------------------------------------------------------
 	//-----------------------------------------------------------------------
-	void TextureState::setTextureFiltering(TextureFilterOptions filterType)
+	void SamplerState::setTextureFiltering(TextureFilterOptions filterType)
 	{
 	{
         switch (filterType)
         switch (filterType)
         {
         {
@@ -179,10 +129,9 @@ namespace CamelotEngine {
             setTextureFiltering(FO_ANISOTROPIC, FO_ANISOTROPIC, FO_LINEAR);
             setTextureFiltering(FO_ANISOTROPIC, FO_ANISOTROPIC, FO_LINEAR);
             break;
             break;
         }
         }
-        mIsDefaultFiltering = false;
 	}
 	}
 	//-----------------------------------------------------------------------
 	//-----------------------------------------------------------------------
-    void TextureState::setTextureFiltering(FilterType ft, FilterOptions fo)
+    void SamplerState::setTextureFiltering(FilterType ft, FilterOptions fo)
     {
     {
         switch (ft)
         switch (ft)
         {
         {
@@ -196,19 +145,17 @@ namespace CamelotEngine {
             mMipFilter = fo;
             mMipFilter = fo;
             break;
             break;
         }
         }
-        mIsDefaultFiltering = false;
     }
     }
 	//-----------------------------------------------------------------------
 	//-----------------------------------------------------------------------
-    void TextureState::setTextureFiltering(FilterOptions minFilter, 
+    void SamplerState::setTextureFiltering(FilterOptions minFilter, 
         FilterOptions magFilter, FilterOptions mipFilter)
         FilterOptions magFilter, FilterOptions mipFilter)
     {
     {
         mMinFilter = minFilter;
         mMinFilter = minFilter;
         mMagFilter = magFilter;
         mMagFilter = magFilter;
         mMipFilter = mipFilter;
         mMipFilter = mipFilter;
-        mIsDefaultFiltering = false;
     }
     }
 	//-----------------------------------------------------------------------
 	//-----------------------------------------------------------------------
-	FilterOptions TextureState::getTextureFiltering(FilterType ft) const
+	FilterOptions SamplerState::getTextureFiltering(FilterType ft) const
 	{
 	{
         switch (ft)
         switch (ft)
         {
         {
@@ -224,13 +171,12 @@ namespace CamelotEngine {
 	}
 	}
 
 
 	//-----------------------------------------------------------------------
 	//-----------------------------------------------------------------------
-	void TextureState::setTextureAnisotropy(unsigned int maxAniso)
+	void SamplerState::setTextureAnisotropy(unsigned int maxAniso)
 	{
 	{
 		mMaxAniso = maxAniso;
 		mMaxAniso = maxAniso;
-        mIsDefaultAniso = false;
 	}
 	}
 	//-----------------------------------------------------------------------
 	//-----------------------------------------------------------------------
-	unsigned int TextureState::getTextureAnisotropy() const
+	unsigned int SamplerState::getTextureAnisotropy() const
 	{
 	{
         return mMaxAniso;
         return mMaxAniso;
 	}
 	}