add BLEND_WEIGHTED_MULTIPLY and BLEND_INVERT_DEST blend modes
This commit is contained in:
@@ -1175,6 +1175,8 @@ void Actor::SetBlendModeString( const RString &s )
|
||||
{
|
||||
if (s.EqualsNoCase("normal")) this->SetBlendMode( BLEND_NORMAL );
|
||||
else if(s.EqualsNoCase("add")) this->SetBlendMode( BLEND_ADD );
|
||||
else if(s.EqualsNoCase("weightedmultiply")) this->SetBlendMode( BLEND_WEIGHTED_MULTIPLY );
|
||||
else if(s.EqualsNoCase("invertdest")) this->SetBlendMode( BLEND_INVERT_DEST );
|
||||
else if(s.EqualsNoCase("noeffect")) this->SetBlendMode( BLEND_NO_EFFECT );
|
||||
else ASSERT(0);
|
||||
}
|
||||
|
||||
@@ -1416,6 +1416,14 @@ void RageDisplay_OGL::SetBlendMode( BlendMode mode )
|
||||
{
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
if( GLExt.glBlendEquation != NULL )
|
||||
{
|
||||
if( mode == BLEND_INVERT_DEST )
|
||||
GLExt.glBlendEquation( GL_FUNC_SUBTRACT );
|
||||
else
|
||||
GLExt.glBlendEquation( GL_FUNC_ADD );
|
||||
}
|
||||
|
||||
switch( mode )
|
||||
{
|
||||
case BLEND_NORMAL:
|
||||
@@ -1424,6 +1432,16 @@ void RageDisplay_OGL::SetBlendMode( BlendMode mode )
|
||||
case BLEND_ADD:
|
||||
glBlendFunc( GL_SRC_ALPHA, GL_ONE );
|
||||
break;
|
||||
case BLEND_WEIGHTED_MULTIPLY:
|
||||
/* output = 2*(dst*src). 0.5,0.5,0.5 is identity; darker colors darken the image,
|
||||
* and brighter colors lighten the image. */
|
||||
glBlendFunc( GL_DST_COLOR, GL_SRC_COLOR );
|
||||
|
||||
break;
|
||||
case BLEND_INVERT_DEST:
|
||||
/* out = src - dst. The source color should almost always be #FFFFFF, to make it "1 - dst". */
|
||||
glBlendFunc( GL_ONE, GL_ONE );
|
||||
break;
|
||||
case BLEND_NO_EFFECT:
|
||||
/* XXX: Would it be faster and have the same effect to say glDisable(GL_COLOR_WRITEMASK)? */
|
||||
glBlendFunc( GL_ZERO, GL_ONE );
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#ifndef RAGETYPES_H
|
||||
#define RAGETYPES_H
|
||||
|
||||
enum BlendMode { BLEND_NORMAL, BLEND_ADD, BLEND_NO_EFFECT, BLEND_INVALID };
|
||||
enum BlendMode { BLEND_NORMAL, BLEND_ADD, BLEND_WEIGHTED_MULTIPLY, BLEND_INVERT_DEST, BLEND_NO_EFFECT, BLEND_INVALID };
|
||||
enum CullMode { CULL_BACK, CULL_FRONT, CULL_NONE };
|
||||
enum ZTestMode { ZTEST_OFF, ZTEST_WRITE_ON_PASS, ZTEST_WRITE_ON_FAIL };
|
||||
enum PolygonMode { POLYGON_FILL, POLYGON_LINE };
|
||||
|
||||
Reference in New Issue
Block a user