- 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.

# Conflicts:
#	src/hwrenderer/scene/hw_sprites.cpp
#	src/r_data/renderstyle.cpp
#	src/r_data/renderstyle.h

With additional render styles from " - abstraction of render style in render state.". drfrag

# Conflicts:
#	src/r_data/renderstyle.cpp
#	src/r_data/renderstyle.h

With additional render styles from "- made the screen blend work for the software renderer.". drfrag
This commit is contained in:
Christoph Oelckers 2018-11-27 19:43:10 +01:00 committed by drfrag666
parent 273c02ee73
commit 0ddb5038c3
6 changed files with 34 additions and 4 deletions

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

@ -8616,7 +8616,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

@ -742,6 +742,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

@ -58,6 +58,11 @@ FRenderStyle LegacyRenderStyles[STYLE_Count] =
{ { STYLEOP_RevSub, STYLEALPHA_Src, STYLEALPHA_One, 0 } }, /* STYLE_Subtract*/
{ { STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_One, STYLEF_ColorIsFixed } }, /* STYLE_AddStencil */
{ { STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_One, STYLEF_RedIsAlpha | STYLEF_ColorIsFixed } }, /* STYLE_AddShaded */
{ { STYLEOP_Add, STYLEALPHA_DstCol, STYLEALPHA_Zero, 0 } }, /* STYLE_Multiply */
{ { 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)
@ -68,7 +73,7 @@ double GetAlpha(int type, double alpha)
case STYLEALPHA_One: return 1.;
case STYLEALPHA_Src: return alpha;
case STYLEALPHA_InvSrc: return 1. - alpha;
default: return 0;
default: return 0.5; // undeterminable
}
}

View file

@ -61,6 +61,11 @@ enum ERenderStyle
STYLE_Subtract, // Actually this is 'reverse subtract' but this is what normal people would expect by 'subtract'.
STYLE_AddStencil, // Fill image interior with alphacolor
STYLE_AddShaded, // Treat patch data as alpha values for alphacolor
STYLE_Multiply, // Multiply source with destination (HW renderer only.)
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
};
@ -87,6 +92,11 @@ enum ERenderAlpha
STYLEALPHA_One, // Blend factor is 1.0
STYLEALPHA_Src, // Blend factor is alpha
STYLEALPHA_InvSrc, // Blend factor is 1.0 - alpha
STYLEALPHA_SrcCol, // Blend factor is color (HWR only)
STYLEALPHA_InvSrcCol, // Blend factor is 1.0 - color (HWR only)
STYLEALPHA_DstCol, // Blend factor is dest. color (HWR only)
STYLEALPHA_InvDstCol, // Blend factor is 1.0 - dest. color (HWR only)
STYLEALPHA_MAX
};
enum ERenderFlags
@ -134,6 +144,7 @@ union FRenderStyle
inline FRenderStyle &operator= (ERenderStyle legacy);
bool operator==(const FRenderStyle &o) const { return AsDWORD == o.AsDWORD; }
bool operator!=(const FRenderStyle &o) const { return AsDWORD != o.AsDWORD; }
void CheckFuzz();
bool IsVisible(double alpha) const throw();
private:

View file

@ -717,12 +717,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;