Add stencil blend mode as apparently the shaded mode uses indices whiles stencil uses mask/alpha..

This commit is contained in:
Magnus Norddahl 2016-11-21 05:52:02 +01:00
commit 5e9c9c825d
6 changed files with 33 additions and 12 deletions

View file

@ -185,14 +185,14 @@ void RenderPolySprite::Render(const TriMatrix &worldToClip, AActor *thing, subse
args.uniforms.destalpha = (uint32_t)(256 - thing->Alpha * 256);
args.uniforms.srcalpha = (uint32_t)(thing->Alpha * 256);
args.uniforms.color = 0xff000000 | thing->fillcolor;
blendmode = TriBlendMode::Shaded;
blendmode = TriBlendMode::Stencil;
}
else if (thing->RenderStyle == LegacyRenderStyles[STYLE_AddStencil])
{
args.uniforms.destalpha = 256;
args.uniforms.srcalpha = (uint32_t)(thing->Alpha * 256) * 2; // Don't know this needs to be multiplied by two..
args.uniforms.color = 0xff000000 | thing->fillcolor;
blendmode = TriBlendMode::Shaded;
blendmode = TriBlendMode::Stencil;
}
else if (thing->RenderStyle == LegacyRenderStyles[STYLE_Shaded])
{
@ -215,6 +215,11 @@ void RenderPolySprite::Render(const TriMatrix &worldToClip, AActor *thing, subse
blendmode = args.translation ? TriBlendMode::TranslateAdd : TriBlendMode::Add;
}
if (blendmode == TriBlendMode::Shaded)
{
args.SetTexture(tex, thing->Translation, true);
}
if (!r_swtruecolor)
{
uint32_t r = (args.uniforms.color >> 16) & 0xff;