Browse Source

Renamed blend modes
Enabled blending for fonts

Marko Pintera 12 years ago
parent
commit
adf8226151

+ 10 - 0
CamelotClient/CamelotClient.cpp

@@ -21,6 +21,7 @@
 #include "CmGpuProgramImportOptions.h"
 #include "CmGpuProgramImportOptions.h"
 #include "CmFontImportOptions.h"
 #include "CmFontImportOptions.h"
 #include "CmCommandQueue.h"
 #include "CmCommandQueue.h"
+#include "CmBlendState.h"
 
 
 #include "CmDebugCamera.h"
 #include "CmDebugCamera.h"
 #include "CmTestTextSprite.h"
 #include "CmTestTextSprite.h"
@@ -88,6 +89,15 @@ MaterialHandle createTextMaterial()
 	newPassDX11->setVertexProgram(textShaderVertProgRef);
 	newPassDX11->setVertexProgram(textShaderVertProgRef);
 	newPassDX11->setFragmentProgram(textShaderFragProgRef);
 	newPassDX11->setFragmentProgram(textShaderFragProgRef);
 
 
+	BLEND_STATE_DESC desc;
+	desc.renderTargetDesc[0].blendEnable = true;
+	desc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
+	desc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
+	desc.renderTargetDesc[0].blendOp = BO_ADD;
+
+	BlendStateHandle blendState = BlendState::create(desc);
+	newPassDX11->setBlendState(blendState);
+
 	MaterialHandle textMaterial = Material::create();
 	MaterialHandle textMaterial = Material::create();
 	textMaterial->setShader(textShader);
 	textMaterial->setShader(textShader);
 
 

+ 18 - 18
CamelotCore/Include/CmBlendState.h

@@ -10,22 +10,22 @@ namespace CamelotEngine
 	{
 	{
 		RENDER_TARGET_BLEND_STATE_DESC()
 		RENDER_TARGET_BLEND_STATE_DESC()
 			: blendEnable(false)
 			: blendEnable(false)
-			, srcBlend(SBF_ONE)
-			, dstBlend(SBF_ZERO)
-			, blendOp(SBO_ADD)
-			, srcBlendAlpha(SBF_ONE)
-			, dstBlendAlpha(SBF_ZERO)
-			, blendOpAlpha(SBO_ADD)
+			, srcBlend(BF_ONE)
+			, dstBlend(BF_ZERO)
+			, blendOp(BO_ADD)
+			, srcBlendAlpha(BF_ONE)
+			, dstBlendAlpha(BF_ZERO)
+			, blendOpAlpha(BO_ADD)
 			, renderTargetWriteMask(0xFF)
 			, renderTargetWriteMask(0xFF)
 		{ }
 		{ }
 
 
 		bool blendEnable;
 		bool blendEnable;
-		SceneBlendFactor srcBlend;
-		SceneBlendFactor dstBlend;
-		SceneBlendOperation blendOp;
-		SceneBlendFactor srcBlendAlpha;
-		SceneBlendFactor dstBlendAlpha;
-		SceneBlendOperation blendOpAlpha;
+		BlendFactor srcBlend;
+		BlendFactor dstBlend;
+		BlendOperation blendOp;
+		BlendFactor srcBlendAlpha;
+		BlendFactor dstBlendAlpha;
+		BlendOperation blendOpAlpha;
 		// Enable write to RGBA channels separately by setting first four bits (0 - R, 1 - G, 2 - B, 3 - A)
 		// Enable write to RGBA channels separately by setting first four bits (0 - R, 1 - G, 2 - B, 3 - A)
 		UINT8 renderTargetWriteMask;
 		UINT8 renderTargetWriteMask;
 	};
 	};
@@ -52,12 +52,12 @@ namespace CamelotEngine
 		bool getIndependantBlendEnable() const { return mData.independantBlendEnable; }
 		bool getIndependantBlendEnable() const { return mData.independantBlendEnable; }
 
 
 		bool getBlendEnabled(UINT32 renderTargetIdx) const;
 		bool getBlendEnabled(UINT32 renderTargetIdx) const;
-		SceneBlendFactor getSrcBlend(UINT32 renderTargetIdx) const;
-		SceneBlendFactor getDstBlend(UINT32 renderTargetIdx) const;
-		SceneBlendOperation getBlendOperation(UINT32 renderTargetIdx) const;
-		SceneBlendFactor getAlphaSrcBlend(UINT32 renderTargetIdx) const;
-		SceneBlendFactor getAlphaDstBlend(UINT32 renderTargetIdx) const;
-		SceneBlendOperation getAlphaBlendOperation(UINT32 renderTargetIdx) const;
+		BlendFactor getSrcBlend(UINT32 renderTargetIdx) const;
+		BlendFactor getDstBlend(UINT32 renderTargetIdx) const;
+		BlendOperation getBlendOperation(UINT32 renderTargetIdx) const;
+		BlendFactor getAlphaSrcBlend(UINT32 renderTargetIdx) const;
+		BlendFactor getAlphaDstBlend(UINT32 renderTargetIdx) const;
+		BlendOperation getAlphaBlendOperation(UINT32 renderTargetIdx) const;
 		UINT8 getRenderTargetWriteMask(UINT32 renderTargetIdx) const;
 		UINT8 getRenderTargetWriteMask(UINT32 renderTargetIdx) const;
 
 
 		static BlendStateHandle create(const BLEND_STATE_DESC& desc);
 		static BlendStateHandle create(const BLEND_STATE_DESC& desc);

+ 17 - 18
CamelotCore/Include/CmCommonEnums.h

@@ -54,32 +54,31 @@ namespace CamelotEngine {
         SceneBlendType that you like, then you can specify the blending factors directly to affect the
         SceneBlendType that you like, then you can specify the blending factors directly to affect the
         combination of object and the existing scene. See Material::setSceneBlending for more details.
         combination of object and the existing scene. See Material::setSceneBlending for more details.
     */
     */
-    enum SceneBlendFactor
+    enum BlendFactor
     {
     {
-        SBF_ONE,
-        SBF_ZERO,
-        SBF_DEST_COLOUR,
-        SBF_SOURCE_COLOUR,
-        SBF_ONE_MINUS_DEST_COLOUR,
-        SBF_ONE_MINUS_SOURCE_COLOUR,
-        SBF_DEST_ALPHA,
-        SBF_SOURCE_ALPHA,
-        SBF_ONE_MINUS_DEST_ALPHA,
-        SBF_ONE_MINUS_SOURCE_ALPHA
-
+        BF_ONE,
+        BF_ZERO,
+        BF_DEST_COLOR,
+        BF_SOURCE_COLOR,
+        BF_INV_DEST_COLOR,
+        BF_INV_SOURCE_COLOR,
+        BF_DEST_ALPHA,
+        BF_SOURCE_ALPHA,
+        BF_INV_DEST_ALPHA,
+        BF_INV_SOURCE_ALPHA
     };
     };
 
 
 	/** Blending operations controls how objects are blended into the scene. The default operation
 	/** Blending operations controls how objects are blended into the scene. The default operation
 		is add (+) but by changing this you can change how drawn objects are blended into the
 		is add (+) but by changing this you can change how drawn objects are blended into the
 		existing scene.
 		existing scene.
 	*/
 	*/
-	enum SceneBlendOperation
+	enum BlendOperation
 	{
 	{
-		SBO_ADD,
-		SBO_SUBTRACT,
-		SBO_REVERSE_SUBTRACT,
-		SBO_MIN,
-		SBO_MAX
+		BO_ADD,
+		BO_SUBTRACT,
+		BO_REVERSE_SUBTRACT,
+		BO_MIN,
+		BO_MAX
 	};
 	};
 
 
     /** Comparison functions used for the depth/stencil buffer operations and 
     /** Comparison functions used for the depth/stencil buffer operations and 

+ 6 - 6
CamelotCore/Source/CmBlendState.cpp

@@ -24,42 +24,42 @@ namespace CamelotEngine
 		return mData.renderTargetDesc[renderTargetIdx].blendEnable;
 		return mData.renderTargetDesc[renderTargetIdx].blendEnable;
 	}
 	}
 
 
-	SceneBlendFactor BlendState::getSrcBlend(UINT32 renderTargetIdx) const
+	BlendFactor BlendState::getSrcBlend(UINT32 renderTargetIdx) const
 	{
 	{
 		assert(renderTargetIdx >= 0 && renderTargetIdx < CM_MAX_MULTIPLE_RENDER_TARGETS);
 		assert(renderTargetIdx >= 0 && renderTargetIdx < CM_MAX_MULTIPLE_RENDER_TARGETS);
 
 
 		return mData.renderTargetDesc[renderTargetIdx].srcBlend;
 		return mData.renderTargetDesc[renderTargetIdx].srcBlend;
 	}
 	}
 
 
-	SceneBlendFactor BlendState::getDstBlend(UINT32 renderTargetIdx) const
+	BlendFactor BlendState::getDstBlend(UINT32 renderTargetIdx) const
 	{
 	{
 		assert(renderTargetIdx >= 0 && renderTargetIdx < CM_MAX_MULTIPLE_RENDER_TARGETS);
 		assert(renderTargetIdx >= 0 && renderTargetIdx < CM_MAX_MULTIPLE_RENDER_TARGETS);
 
 
 		return mData.renderTargetDesc[renderTargetIdx].dstBlend;
 		return mData.renderTargetDesc[renderTargetIdx].dstBlend;
 	}
 	}
 
 
-	SceneBlendOperation BlendState::getBlendOperation(UINT32 renderTargetIdx) const
+	BlendOperation BlendState::getBlendOperation(UINT32 renderTargetIdx) const
 	{
 	{
 		assert(renderTargetIdx >= 0 && renderTargetIdx < CM_MAX_MULTIPLE_RENDER_TARGETS);
 		assert(renderTargetIdx >= 0 && renderTargetIdx < CM_MAX_MULTIPLE_RENDER_TARGETS);
 
 
 		return mData.renderTargetDesc[renderTargetIdx].blendOp;
 		return mData.renderTargetDesc[renderTargetIdx].blendOp;
 	}
 	}
 
 
-	SceneBlendFactor BlendState::getAlphaSrcBlend(UINT32 renderTargetIdx) const
+	BlendFactor BlendState::getAlphaSrcBlend(UINT32 renderTargetIdx) const
 	{
 	{
 		assert(renderTargetIdx >= 0 && renderTargetIdx < CM_MAX_MULTIPLE_RENDER_TARGETS);
 		assert(renderTargetIdx >= 0 && renderTargetIdx < CM_MAX_MULTIPLE_RENDER_TARGETS);
 
 
 		return mData.renderTargetDesc[renderTargetIdx].srcBlendAlpha;
 		return mData.renderTargetDesc[renderTargetIdx].srcBlendAlpha;
 	}
 	}
 
 
-	SceneBlendFactor BlendState::getAlphaDstBlend(UINT32 renderTargetIdx) const
+	BlendFactor BlendState::getAlphaDstBlend(UINT32 renderTargetIdx) const
 	{
 	{
 		assert(renderTargetIdx >= 0 && renderTargetIdx < CM_MAX_MULTIPLE_RENDER_TARGETS);
 		assert(renderTargetIdx >= 0 && renderTargetIdx < CM_MAX_MULTIPLE_RENDER_TARGETS);
 		
 		
 		return mData.renderTargetDesc[renderTargetIdx].dstBlendAlpha;
 		return mData.renderTargetDesc[renderTargetIdx].dstBlendAlpha;
 	}
 	}
 
 
-	SceneBlendOperation BlendState::getAlphaBlendOperation(UINT32 renderTargetIdx) const
+	BlendOperation BlendState::getAlphaBlendOperation(UINT32 renderTargetIdx) const
 	{
 	{
 		assert(renderTargetIdx >= 0 && renderTargetIdx < CM_MAX_MULTIPLE_RENDER_TARGETS);
 		assert(renderTargetIdx >= 0 && renderTargetIdx < CM_MAX_MULTIPLE_RENDER_TARGETS);
 
 

+ 5 - 5
CamelotCore/Source/CmPass.cpp

@@ -49,11 +49,11 @@ namespace CamelotEngine
 			for(UINT32 i = 0; i < CM_MAX_MULTIPLE_RENDER_TARGETS; i++)
 			for(UINT32 i = 0; i < CM_MAX_MULTIPLE_RENDER_TARGETS; i++)
 			{
 			{
 				// Transparent if destination color is taken into account
 				// Transparent if destination color is taken into account
-				if (mBlendState->getDstBlend(i) != SBF_ZERO ||
-					mBlendState->getSrcBlend(i) == SBF_DEST_COLOUR ||
-					mBlendState->getSrcBlend(i) == SBF_ONE_MINUS_DEST_COLOUR ||
-					mBlendState->getSrcBlend(i) == SBF_DEST_ALPHA ||
-					mBlendState->getSrcBlend(i) == SBF_ONE_MINUS_DEST_ALPHA)
+				if (mBlendState->getDstBlend(i) != BF_ZERO ||
+					mBlendState->getSrcBlend(i) == BF_DEST_COLOR ||
+					mBlendState->getSrcBlend(i) == BF_INV_DEST_COLOR ||
+					mBlendState->getSrcBlend(i) == BF_DEST_ALPHA ||
+					mBlendState->getSrcBlend(i) == BF_INV_DEST_ALPHA)
 				{
 				{
 					transparent = true;
 					transparent = true;
 				}
 				}

+ 2 - 2
CamelotD3D11RenderSystem/Include/CmD3D11Mappings.h

@@ -30,9 +30,9 @@ namespace CamelotEngine
 		/// return a D3D11 equivalent for an engine TextureAddressingMode value
 		/// return a D3D11 equivalent for an engine TextureAddressingMode value
 		static D3D11_TEXTURE_ADDRESS_MODE get(TextureAddressingMode tam);
 		static D3D11_TEXTURE_ADDRESS_MODE get(TextureAddressingMode tam);
 		/// return a D3D11 equivalent for an engine SceneBlendFactor value
 		/// return a D3D11 equivalent for an engine SceneBlendFactor value
-		static D3D11_BLEND get(SceneBlendFactor sbf);
+		static D3D11_BLEND get(BlendFactor sbf);
 		/// return a D3D11 equivalent for an engine SceneBlendOperation value
 		/// return a D3D11 equivalent for an engine SceneBlendOperation value
-		static D3D11_BLEND_OP get(SceneBlendOperation sbo);
+		static D3D11_BLEND_OP get(BlendOperation sbo);
 		/// return a D3D11 equivalent for an engine CompareFunction value
 		/// return a D3D11 equivalent for an engine CompareFunction value
 		static D3D11_COMPARISON_FUNC get(CompareFunction cf);
 		static D3D11_COMPARISON_FUNC get(CompareFunction cf);
 		/// return a D3D11 equivalent for an engine CillingMode value
 		/// return a D3D11 equivalent for an engine CillingMode value

+ 17 - 17
CamelotD3D11RenderSystem/Source/CmD3D11Mappings.cpp

@@ -20,47 +20,47 @@ namespace CamelotEngine
 		return D3D11_TEXTURE_ADDRESS_MIRROR_ONCE;
 		return D3D11_TEXTURE_ADDRESS_MIRROR_ONCE;
 	}
 	}
 
 
-	D3D11_BLEND D3D11Mappings::get(SceneBlendFactor sbf)
+	D3D11_BLEND D3D11Mappings::get(BlendFactor sbf)
 	{
 	{
 		switch( sbf )
 		switch( sbf )
 		{
 		{
-		case SBF_ONE:
+		case BF_ONE:
 			return D3D11_BLEND_ONE;
 			return D3D11_BLEND_ONE;
-		case SBF_ZERO:
+		case BF_ZERO:
 			return D3D11_BLEND_ZERO;
 			return D3D11_BLEND_ZERO;
-		case SBF_DEST_COLOUR:
+		case BF_DEST_COLOR:
 			return D3D11_BLEND_DEST_COLOR;
 			return D3D11_BLEND_DEST_COLOR;
-		case SBF_SOURCE_COLOUR:
+		case BF_SOURCE_COLOR:
 			return D3D11_BLEND_SRC_COLOR;
 			return D3D11_BLEND_SRC_COLOR;
-		case SBF_ONE_MINUS_DEST_COLOUR:
+		case BF_INV_DEST_COLOR:
 			return D3D11_BLEND_INV_DEST_COLOR;
 			return D3D11_BLEND_INV_DEST_COLOR;
-		case SBF_ONE_MINUS_SOURCE_COLOUR:
+		case BF_INV_SOURCE_COLOR:
 			return D3D11_BLEND_INV_SRC_COLOR;
 			return D3D11_BLEND_INV_SRC_COLOR;
-		case SBF_DEST_ALPHA:
+		case BF_DEST_ALPHA:
 			return D3D11_BLEND_DEST_ALPHA;
 			return D3D11_BLEND_DEST_ALPHA;
-		case SBF_SOURCE_ALPHA:
+		case BF_SOURCE_ALPHA:
 			return D3D11_BLEND_SRC_ALPHA;
 			return D3D11_BLEND_SRC_ALPHA;
-		case SBF_ONE_MINUS_DEST_ALPHA:
+		case BF_INV_DEST_ALPHA:
 			return D3D11_BLEND_INV_DEST_ALPHA;
 			return D3D11_BLEND_INV_DEST_ALPHA;
-		case SBF_ONE_MINUS_SOURCE_ALPHA:
+		case BF_INV_SOURCE_ALPHA:
 			return D3D11_BLEND_INV_SRC_ALPHA;
 			return D3D11_BLEND_INV_SRC_ALPHA;
 		}
 		}
 		return D3D11_BLEND_ZERO;
 		return D3D11_BLEND_ZERO;
 	}
 	}
 
 
-	D3D11_BLEND_OP D3D11Mappings::get(SceneBlendOperation sbo)
+	D3D11_BLEND_OP D3D11Mappings::get(BlendOperation sbo)
 	{
 	{
 		switch( sbo )
 		switch( sbo )
 		{
 		{
-		case SBO_ADD:
+		case BO_ADD:
 			return D3D11_BLEND_OP_ADD;
 			return D3D11_BLEND_OP_ADD;
-		case SBO_SUBTRACT:
+		case BO_SUBTRACT:
 			return D3D11_BLEND_OP_SUBTRACT;
 			return D3D11_BLEND_OP_SUBTRACT;
-		case SBO_REVERSE_SUBTRACT:
+		case BO_REVERSE_SUBTRACT:
 			return D3D11_BLEND_OP_REV_SUBTRACT;
 			return D3D11_BLEND_OP_REV_SUBTRACT;
-		case SBO_MIN:
+		case BO_MIN:
 			return D3D11_BLEND_OP_MIN;
 			return D3D11_BLEND_OP_MIN;
-		case SBO_MAX:
+		case BO_MAX:
 			return D3D11_BLEND_OP_MAX;
 			return D3D11_BLEND_OP_MAX;
 		}
 		}
 		return D3D11_BLEND_OP_ADD;
 		return D3D11_BLEND_OP_ADD;

+ 2 - 2
CamelotD3D9Renderer/Include/CmD3D9Mappings.h

@@ -66,9 +66,9 @@ namespace CamelotEngine
 		/// return a D3D9 equivalent for a Ogre TextureAddressingMode value
 		/// return a D3D9 equivalent for a Ogre TextureAddressingMode value
 		static D3DTEXTUREADDRESS get(TextureAddressingMode tam, const D3DCAPS9& devCaps);
 		static D3DTEXTUREADDRESS get(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(BlendFactor sbf);
 		/// return a D3D9 equivlalent for a Ogre SceneBlendOperation value
 		/// return a D3D9 equivlalent for a Ogre SceneBlendOperation value
-		static D3DBLENDOP get(SceneBlendOperation sbo);
+		static D3DBLENDOP get(BlendOperation sbo);
 		/// return a D3D9 equivalent for a Ogre CompareFunction value
 		/// return a D3D9 equivalent for a Ogre CompareFunction value
 		static DWORD get(CompareFunction cf);
 		static DWORD get(CompareFunction cf);
 		/// return a D3D9 equivalent for a Ogre CillingMode value
 		/// return a D3D9 equivalent for a Ogre CillingMode value

+ 3 - 3
CamelotD3D9Renderer/Include/CmD3D9RenderSystem.h

@@ -333,7 +333,7 @@ namespace CamelotEngine
 		@param destFactor The destination factor in the above calculation, i.e. multiplied by the pixel colour components.
 		@param destFactor The destination factor in the above calculation, i.e. multiplied by the pixel colour components.
 		@param op The blend operation mode for combining pixels
 		@param op The blend operation mode for combining pixels
 		*/
 		*/
-		void setSceneBlending( SceneBlendFactor sourceFactor, SceneBlendFactor destFactor, SceneBlendOperation op );
+		void setSceneBlending( BlendFactor sourceFactor, BlendFactor destFactor, BlendOperation op );
 
 
 		/** Sets the global blending factors for combining subsequent renders with the existing frame contents.
 		/** Sets the global blending factors for combining subsequent renders with the existing frame contents.
 		The result of the blending operation is:</p>
 		The result of the blending operation is:</p>
@@ -347,8 +347,8 @@ namespace CamelotEngine
 		@param op The blend operation mode for combining pixels
 		@param op The blend operation mode for combining pixels
 		@param alphaOp The blend operation mode for combining pixel alpha values
 		@param alphaOp The blend operation mode for combining pixel alpha values
 		*/
 		*/
-		void setSceneBlending( SceneBlendFactor sourceFactor, SceneBlendFactor destFactor, SceneBlendFactor sourceFactorAlpha, 
-			SceneBlendFactor destFactorAlpha, SceneBlendOperation op, SceneBlendOperation alphaOp );
+		void setSceneBlending( BlendFactor sourceFactor, BlendFactor destFactor, BlendFactor sourceFactorAlpha, 
+			BlendFactor destFactorAlpha, BlendOperation op, BlendOperation alphaOp );
 
 
 		/** Sets the global alpha rejection approach for future renders.
 		/** Sets the global alpha rejection approach for future renders.
 		By default images are rendered regardless of texture alpha. This method lets you change that.
 		By default images are rendered regardless of texture alpha. This method lets you change that.

+ 17 - 17
CamelotD3D9Renderer/Source/CmD3D9Mappings.cpp

@@ -52,47 +52,47 @@ namespace CamelotEngine
 		return D3DTADDRESS_FORCE_DWORD;
 		return D3DTADDRESS_FORCE_DWORD;
 	}
 	}
 	//---------------------------------------------------------------------
 	//---------------------------------------------------------------------
-	D3DBLEND D3D9Mappings::get(SceneBlendFactor sbf)
+	D3DBLEND D3D9Mappings::get(BlendFactor sbf)
 	{
 	{
 		switch( sbf )
 		switch( sbf )
 		{
 		{
-		case SBF_ONE:
+		case BF_ONE:
 			return D3DBLEND_ONE;
 			return D3DBLEND_ONE;
-		case SBF_ZERO:
+		case BF_ZERO:
 			return D3DBLEND_ZERO;
 			return D3DBLEND_ZERO;
-		case SBF_DEST_COLOUR:
+		case BF_DEST_COLOR:
 			return D3DBLEND_DESTCOLOR;
 			return D3DBLEND_DESTCOLOR;
-		case SBF_SOURCE_COLOUR:
+		case BF_SOURCE_COLOR:
 			return D3DBLEND_SRCCOLOR;
 			return D3DBLEND_SRCCOLOR;
-		case SBF_ONE_MINUS_DEST_COLOUR:
+		case BF_INV_DEST_COLOR:
 			return D3DBLEND_INVDESTCOLOR;
 			return D3DBLEND_INVDESTCOLOR;
-		case SBF_ONE_MINUS_SOURCE_COLOUR:
+		case BF_INV_SOURCE_COLOR:
 			return D3DBLEND_INVSRCCOLOR;
 			return D3DBLEND_INVSRCCOLOR;
-		case SBF_DEST_ALPHA:
+		case BF_DEST_ALPHA:
 			return D3DBLEND_DESTALPHA;
 			return D3DBLEND_DESTALPHA;
-		case SBF_SOURCE_ALPHA:
+		case BF_SOURCE_ALPHA:
 			return D3DBLEND_SRCALPHA;
 			return D3DBLEND_SRCALPHA;
-		case SBF_ONE_MINUS_DEST_ALPHA:
+		case BF_INV_DEST_ALPHA:
 			return D3DBLEND_INVDESTALPHA;
 			return D3DBLEND_INVDESTALPHA;
-		case SBF_ONE_MINUS_SOURCE_ALPHA:
+		case BF_INV_SOURCE_ALPHA:
 			return D3DBLEND_INVSRCALPHA;
 			return D3DBLEND_INVSRCALPHA;
 		}
 		}
 		return D3DBLEND_FORCE_DWORD;
 		return D3DBLEND_FORCE_DWORD;
 	}
 	}
 	//---------------------------------------------------------------------
 	//---------------------------------------------------------------------
-	D3DBLENDOP D3D9Mappings::get(CamelotEngine::SceneBlendOperation sbo)
+	D3DBLENDOP D3D9Mappings::get(CamelotEngine::BlendOperation sbo)
 	{
 	{
 		switch(sbo)
 		switch(sbo)
 		{
 		{
-		case SBO_ADD:
+		case BO_ADD:
 			return D3DBLENDOP_ADD;
 			return D3DBLENDOP_ADD;
-		case SBO_SUBTRACT:
+		case BO_SUBTRACT:
 			return D3DBLENDOP_SUBTRACT;
 			return D3DBLENDOP_SUBTRACT;
-		case SBO_REVERSE_SUBTRACT:
+		case BO_REVERSE_SUBTRACT:
 			return D3DBLENDOP_REVSUBTRACT;
 			return D3DBLENDOP_REVSUBTRACT;
-		case SBO_MIN:
+		case BO_MIN:
 			return D3DBLENDOP_MIN;
 			return D3DBLENDOP_MIN;
-		case SBO_MAX:
+		case BO_MAX:
 			return D3DBLENDOP_MAX;
 			return D3DBLENDOP_MAX;
 		}
 		}
 
 

+ 7 - 7
CamelotD3D9Renderer/Source/CmD3D9RenderSystem.cpp

@@ -584,7 +584,7 @@ namespace CamelotEngine
 		}
 		}
 		else
 		else
 		{
 		{
-			setSceneBlending(SBF_ONE, SBF_ZERO, SBO_ADD);
+			setSceneBlending(BF_ONE, BF_ZERO, BO_ADD);
 		}
 		}
 
 
 		// Color write mask
 		// Color write mask
@@ -672,12 +672,12 @@ namespace CamelotEngine
 			CM_EXCEPT(RenderingAPIException, "Failed to set texture border colour");
 			CM_EXCEPT(RenderingAPIException, "Failed to set texture border colour");
 	}
 	}
 	//---------------------------------------------------------------------
 	//---------------------------------------------------------------------
-	void D3D9RenderSystem::setSceneBlending( SceneBlendFactor sourceFactor, SceneBlendFactor destFactor, SceneBlendOperation op )
+	void D3D9RenderSystem::setSceneBlending( BlendFactor sourceFactor, BlendFactor destFactor, BlendOperation op )
 	{
 	{
 		THROW_IF_NOT_RENDER_THREAD;
 		THROW_IF_NOT_RENDER_THREAD;
 
 
 		HRESULT hr;
 		HRESULT hr;
-		if( sourceFactor == SBF_ONE && destFactor == SBF_ZERO)
+		if( sourceFactor == BF_ONE && destFactor == BF_ZERO)
 		{
 		{
 			if (FAILED(hr = __SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE)))
 			if (FAILED(hr = __SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE)))
 				CM_EXCEPT(RenderingAPIException, "Failed to set alpha blending option");
 				CM_EXCEPT(RenderingAPIException, "Failed to set alpha blending option");
@@ -700,14 +700,14 @@ namespace CamelotEngine
 			CM_EXCEPT(RenderingAPIException, "Failed to set scene blending operation option");
 			CM_EXCEPT(RenderingAPIException, "Failed to set scene blending operation option");
 	}
 	}
 	//---------------------------------------------------------------------
 	//---------------------------------------------------------------------
-	void D3D9RenderSystem::setSceneBlending( SceneBlendFactor sourceFactor, SceneBlendFactor destFactor, SceneBlendFactor sourceFactorAlpha, 
-		SceneBlendFactor destFactorAlpha, SceneBlendOperation op, SceneBlendOperation alphaOp )
+	void D3D9RenderSystem::setSceneBlending( BlendFactor sourceFactor, BlendFactor destFactor, BlendFactor sourceFactorAlpha, 
+		BlendFactor destFactorAlpha, BlendOperation op, BlendOperation alphaOp )
 	{
 	{
 		THROW_IF_NOT_RENDER_THREAD;
 		THROW_IF_NOT_RENDER_THREAD;
 
 
 		HRESULT hr;
 		HRESULT hr;
-		if( sourceFactor == SBF_ONE && destFactor == SBF_ZERO && 
-			sourceFactorAlpha == SBF_ONE && destFactorAlpha == SBF_ZERO)
+		if( sourceFactor == BF_ONE && destFactor == BF_ZERO && 
+			sourceFactorAlpha == BF_ONE && destFactorAlpha == BF_ZERO)
 		{
 		{
 			if (FAILED(hr = __SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE)))
 			if (FAILED(hr = __SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE)))
 				CM_EXCEPT(RenderingAPIException, "Failed to set alpha blending option");
 				CM_EXCEPT(RenderingAPIException, "Failed to set alpha blending option");

+ 4 - 4
CamelotGLRenderer/Include/CmGLRenderSystem.h

@@ -225,7 +225,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(BlendFactor ogreBlend) const;
 		GLint getTextureAddressingMode(TextureAddressingMode tam) const;
 		GLint getTextureAddressingMode(TextureAddressingMode tam) const;
 		void initialiseContext(GLContext* primary);
 		void initialiseContext(GLContext* primary);
 
 
@@ -370,7 +370,7 @@ namespace CamelotEngine {
 		@param destFactor The destination factor in the above calculation, i.e. multiplied by the pixel colour components.
 		@param destFactor The destination factor in the above calculation, i.e. multiplied by the pixel colour components.
 		@param op The blend operation mode for combining pixels
 		@param op The blend operation mode for combining pixels
 		*/
 		*/
-		void setSceneBlending( SceneBlendFactor sourceFactor, SceneBlendFactor destFactor, SceneBlendOperation op );
+		void setSceneBlending( BlendFactor sourceFactor, BlendFactor destFactor, BlendOperation op );
 
 
 		/** Sets the global blending factors for combining subsequent renders with the existing frame contents.
 		/** Sets the global blending factors for combining subsequent renders with the existing frame contents.
 		The result of the blending operation is:</p>
 		The result of the blending operation is:</p>
@@ -384,8 +384,8 @@ namespace CamelotEngine {
 		@param op The blend operation mode for combining pixels
 		@param op The blend operation mode for combining pixels
 		@param alphaOp The blend operation mode for combining pixel alpha values
 		@param alphaOp The blend operation mode for combining pixel alpha values
 		*/
 		*/
-		void setSceneBlending( SceneBlendFactor sourceFactor, SceneBlendFactor destFactor, SceneBlendFactor sourceFactorAlpha, 
-			SceneBlendFactor destFactorAlpha, SceneBlendOperation op, SceneBlendOperation alphaOp );
+		void setSceneBlending( BlendFactor sourceFactor, BlendFactor destFactor, BlendFactor sourceFactorAlpha, 
+			BlendFactor destFactorAlpha, BlendOperation op, BlendOperation alphaOp );
 
 
 		/** Sets the global alpha rejection approach for future renders.
 		/** Sets the global alpha rejection approach for future renders.
 		By default images are rendered regardless of texture alpha. This method lets you change that.
 		By default images are rendered regardless of texture alpha. This method lets you change that.

+ 34 - 34
CamelotGLRenderer/Source/CmGLRenderSystem.cpp

@@ -483,7 +483,7 @@ namespace CamelotEngine
 		}
 		}
 		else
 		else
 		{
 		{
-			setSceneBlending(SBF_ONE, SBF_ZERO, SBO_ADD);
+			setSceneBlending(BF_ONE, BF_ZERO, BO_ADD);
 		}
 		}
 
 
 		// Color write mask
 		// Color write mask
@@ -822,11 +822,11 @@ namespace CamelotEngine
 		}
 		}
 
 
 	}
 	}
-	void GLRenderSystem::setSceneBlending(SceneBlendFactor sourceFactor, SceneBlendFactor destFactor, SceneBlendOperation op )
+	void GLRenderSystem::setSceneBlending(BlendFactor sourceFactor, BlendFactor destFactor, BlendOperation op )
 	{
 	{
 		GLint sourceBlend = getBlendMode(sourceFactor);
 		GLint sourceBlend = getBlendMode(sourceFactor);
 		GLint destBlend = getBlendMode(destFactor);
 		GLint destBlend = getBlendMode(destFactor);
-		if(sourceFactor == SBF_ONE && destFactor == SBF_ZERO)
+		if(sourceFactor == BF_ONE && destFactor == BF_ZERO)
 		{
 		{
 			glDisable(GL_BLEND);
 			glDisable(GL_BLEND);
 		}
 		}
@@ -839,19 +839,19 @@ namespace CamelotEngine
 		GLint func = GL_FUNC_ADD;
 		GLint func = GL_FUNC_ADD;
 		switch(op)
 		switch(op)
 		{
 		{
-		case SBO_ADD:
+		case BO_ADD:
 			func = GL_FUNC_ADD;
 			func = GL_FUNC_ADD;
 			break;
 			break;
-		case SBO_SUBTRACT:
+		case BO_SUBTRACT:
 			func = GL_FUNC_SUBTRACT;
 			func = GL_FUNC_SUBTRACT;
 			break;
 			break;
-		case SBO_REVERSE_SUBTRACT:
+		case BO_REVERSE_SUBTRACT:
 			func = GL_FUNC_REVERSE_SUBTRACT;
 			func = GL_FUNC_REVERSE_SUBTRACT;
 			break;
 			break;
-		case SBO_MIN:
+		case BO_MIN:
 			func = GL_MIN;
 			func = GL_MIN;
 			break;
 			break;
-		case SBO_MAX:
+		case BO_MAX:
 			func = GL_MAX;
 			func = GL_MAX;
 			break;
 			break;
 		}
 		}
@@ -867,17 +867,17 @@ namespace CamelotEngine
 	}
 	}
 	//-----------------------------------------------------------------------------
 	//-----------------------------------------------------------------------------
 	void GLRenderSystem::setSceneBlending(
 	void GLRenderSystem::setSceneBlending(
-		SceneBlendFactor sourceFactor, SceneBlendFactor destFactor, 
-		SceneBlendFactor sourceFactorAlpha, SceneBlendFactor destFactorAlpha,
-		SceneBlendOperation op, SceneBlendOperation alphaOp )
+		BlendFactor sourceFactor, BlendFactor destFactor, 
+		BlendFactor sourceFactorAlpha, BlendFactor destFactorAlpha,
+		BlendOperation op, BlendOperation alphaOp )
 	{
 	{
 		GLint sourceBlend = getBlendMode(sourceFactor);
 		GLint sourceBlend = getBlendMode(sourceFactor);
 		GLint destBlend = getBlendMode(destFactor);
 		GLint destBlend = getBlendMode(destFactor);
 		GLint sourceBlendAlpha = getBlendMode(sourceFactorAlpha);
 		GLint sourceBlendAlpha = getBlendMode(sourceFactorAlpha);
 		GLint destBlendAlpha = getBlendMode(destFactorAlpha);
 		GLint destBlendAlpha = getBlendMode(destFactorAlpha);
 
 
-		if(sourceFactor == SBF_ONE && destFactor == SBF_ZERO && 
-			sourceFactorAlpha == SBF_ONE && destFactorAlpha == SBF_ZERO)
+		if(sourceFactor == BF_ONE && destFactor == BF_ZERO && 
+			sourceFactorAlpha == BF_ONE && destFactorAlpha == BF_ZERO)
 		{
 		{
 			glDisable(GL_BLEND);
 			glDisable(GL_BLEND);
 		}
 		}
@@ -891,38 +891,38 @@ namespace CamelotEngine
 
 
 		switch(op)
 		switch(op)
 		{
 		{
-		case SBO_ADD:
+		case BO_ADD:
 			func = GL_FUNC_ADD;
 			func = GL_FUNC_ADD;
 			break;
 			break;
-		case SBO_SUBTRACT:
+		case BO_SUBTRACT:
 			func = GL_FUNC_SUBTRACT;
 			func = GL_FUNC_SUBTRACT;
 			break;
 			break;
-		case SBO_REVERSE_SUBTRACT:
+		case BO_REVERSE_SUBTRACT:
 			func = GL_FUNC_REVERSE_SUBTRACT;
 			func = GL_FUNC_REVERSE_SUBTRACT;
 			break;
 			break;
-		case SBO_MIN:
+		case BO_MIN:
 			func = GL_MIN;
 			func = GL_MIN;
 			break;
 			break;
-		case SBO_MAX:
+		case BO_MAX:
 			func = GL_MAX;
 			func = GL_MAX;
 			break;
 			break;
 		}
 		}
 
 
 		switch(alphaOp)
 		switch(alphaOp)
 		{
 		{
-		case SBO_ADD:
+		case BO_ADD:
 			alphaFunc = GL_FUNC_ADD;
 			alphaFunc = GL_FUNC_ADD;
 			break;
 			break;
-		case SBO_SUBTRACT:
+		case BO_SUBTRACT:
 			alphaFunc = GL_FUNC_SUBTRACT;
 			alphaFunc = GL_FUNC_SUBTRACT;
 			break;
 			break;
-		case SBO_REVERSE_SUBTRACT:
+		case BO_REVERSE_SUBTRACT:
 			alphaFunc = GL_FUNC_REVERSE_SUBTRACT;
 			alphaFunc = GL_FUNC_REVERSE_SUBTRACT;
 			break;
 			break;
-		case SBO_MIN:
+		case BO_MIN:
 			alphaFunc = GL_MIN;
 			alphaFunc = GL_MIN;
 			break;
 			break;
-		case SBO_MAX:
+		case BO_MAX:
 			alphaFunc = GL_MAX;
 			alphaFunc = GL_MAX;
 			break;
 			break;
 		}
 		}
@@ -1547,29 +1547,29 @@ namespace CamelotEngine
 		return (errString != 0) ? String((const char*) errString) : StringUtil::BLANK;
 		return (errString != 0) ? String((const char*) errString) : StringUtil::BLANK;
 	}
 	}
 	//-----------------------------------------------------------------------------
 	//-----------------------------------------------------------------------------
-	GLint GLRenderSystem::getBlendMode(SceneBlendFactor blendMode) const
+	GLint GLRenderSystem::getBlendMode(BlendFactor blendMode) const
 	{
 	{
 		switch(blendMode)
 		switch(blendMode)
 		{
 		{
-		case SBF_ONE:
+		case BF_ONE:
 			return GL_ONE;
 			return GL_ONE;
-		case SBF_ZERO:
+		case BF_ZERO:
 			return GL_ZERO;
 			return GL_ZERO;
-		case SBF_DEST_COLOUR:
+		case BF_DEST_COLOR:
 			return GL_DST_COLOR;
 			return GL_DST_COLOR;
-		case SBF_SOURCE_COLOUR:
+		case BF_SOURCE_COLOR:
 			return GL_SRC_COLOR;
 			return GL_SRC_COLOR;
-		case SBF_ONE_MINUS_DEST_COLOUR:
+		case BF_INV_DEST_COLOR:
 			return GL_ONE_MINUS_DST_COLOR;
 			return GL_ONE_MINUS_DST_COLOR;
-		case SBF_ONE_MINUS_SOURCE_COLOUR:
+		case BF_INV_SOURCE_COLOR:
 			return GL_ONE_MINUS_SRC_COLOR;
 			return GL_ONE_MINUS_SRC_COLOR;
-		case SBF_DEST_ALPHA:
+		case BF_DEST_ALPHA:
 			return GL_DST_ALPHA;
 			return GL_DST_ALPHA;
-		case SBF_SOURCE_ALPHA:
+		case BF_SOURCE_ALPHA:
 			return GL_SRC_ALPHA;
 			return GL_SRC_ALPHA;
-		case SBF_ONE_MINUS_DEST_ALPHA:
+		case BF_INV_DEST_ALPHA:
 			return GL_ONE_MINUS_DST_ALPHA;
 			return GL_ONE_MINUS_DST_ALPHA;
-		case SBF_ONE_MINUS_SOURCE_ALPHA:
+		case BF_INV_SOURCE_ALPHA:
 			return GL_ONE_MINUS_SRC_ALPHA;
 			return GL_ONE_MINUS_SRC_ALPHA;
 		};
 		};
 		// to keep compiler happy
 		// to keep compiler happy