- fixed the mapping of additive translucency to color-based translucency.

The destination mode sould be 'One', not 'InvSrcColor'.
Now both of these are available as explicit modes, not just through the optional mapping.
This commit is contained in:
Christoph Oelckers 2018-11-27 19:43:10 +01:00
parent 3d3a00fd0d
commit 59b4e297c0
7 changed files with 20 additions and 4 deletions

View file

@ -94,7 +94,7 @@ void GLSprite::DrawSprite(HWDrawInfo *di, FRenderState &state, bool translucent)
gl_usecolorblending && !di->isFullbrightScene() && actor &&
fullbright && gltexture && !gltexture->tex->GetTranslucency())
{
RenderStyle = LegacyRenderStyles[STYLE_ColorBlend];
RenderStyle = LegacyRenderStyles[STYLE_ColorAdd];
}
state.SetRenderStyle(RenderStyle);

View file

@ -46,6 +46,9 @@ xx(Shadow)
xx(Subtract)
xx(Subtractive)
xx(FillColor)
xx(ColorBlend)
xx(ColorAdd)
xx(Multiply)
// Healingradius types
xx(Mana)

View file

@ -8602,7 +8602,7 @@ void PrintMiscActorInfo(AActor *query)
/*for (flagi = 0; flagi < 31; flagi++)
if (query->BounceFlags & 1<<flagi) Printf(" %s", flagnamesb[flagi]);*/
Printf("\nRender style = %i:%s, alpha %f\nRender flags: %x",
querystyle, (querystyle < STYLE_Count ? renderstyles[querystyle] : "Unknown"),
querystyle, (querystyle < countof(renderstyles) ? renderstyles[querystyle] : "Custom"),
query->Alpha, query->renderflags.GetValue());
/*for (flagi = 0; flagi < 31; flagi++)
if (query->renderflags & 1<<flagi) Printf(" %s", flagnamesr[flagi]);*/

View file

@ -739,6 +739,15 @@ public:
case NAME_Subtractive:
th->RenderStyle = STYLE_Subtract;
break;
case NAME_ColorBlend:
th->RenderStyle = STYLE_ColorBlend;
break;
case NAME_ColorAdd:
th->RenderStyle = STYLE_ColorAdd;
break;
case NAME_Multiply:
th->RenderStyle = STYLE_Multiply;
break;
default:
break;
}

View file

@ -62,6 +62,7 @@ FRenderStyle LegacyRenderStyles[STYLE_Count] =
{ { STYLEOP_Add, STYLEALPHA_InvDstCol, STYLEALPHA_Zero, 0 } }, /* STYLE_InverseMultiply */
{ { STYLEOP_Add, STYLEALPHA_SrcCol, STYLEALPHA_InvSrcCol, 0 } }, /* STYLE_ColorBlend */
{ { STYLEOP_Add, STYLEALPHA_One, STYLEALPHA_Zero, 0 } }, /* STYLE_Source */
{ { STYLEOP_Add, STYLEALPHA_SrcCol, STYLEALPHA_One, 0 } }, /* STYLE_ColorAdd */
};
double GetAlpha(int type, double alpha)

View file

@ -78,6 +78,7 @@ enum ERenderStyle
STYLE_InverseMultiply, // Multiply source with inverse of destination (HW renderer only.)
STYLE_ColorBlend, // Use color intensity as transparency factor
STYLE_Source, // No blending (only used internally)
STYLE_ColorAdd, // Use color intensity as transparency factor and blend additively.
STYLE_Count
};

View file

@ -700,12 +700,14 @@ DEFINE_PROPERTY(renderstyle, S, Actor)
PROP_STRING_PARM(str, 0);
static const char * renderstyles[]={
"NONE", "NORMAL", "FUZZY", "SOULTRANS", "OPTFUZZY", "STENCIL",
"TRANSLUCENT", "ADD", "SHADED", "SHADOW", "SUBTRACT", "ADDSTENCIL", "ADDSHADED", NULL };
"TRANSLUCENT", "ADD", "SHADED", "SHADOW", "SUBTRACT", "ADDSTENCIL",
"ADDSHADED", "COLORBLEND", "COLORADD", "MULTIPLY", NULL };
static const int renderstyle_values[]={
STYLE_None, STYLE_Normal, STYLE_Fuzzy, STYLE_SoulTrans, STYLE_OptFuzzy,
STYLE_TranslucentStencil, STYLE_Translucent, STYLE_Add, STYLE_Shaded,
STYLE_Shadow, STYLE_Subtract, STYLE_AddStencil, STYLE_AddShaded};
STYLE_Shadow, STYLE_Subtract, STYLE_AddStencil, STYLE_AddShaded,
STYLE_ColorBlend, STYLE_ColorAdd, STYLE_Multiply};
// make this work for old style decorations, too.
if (!strnicmp(str, "style_", 6)) str+=6;