- support render styles on decals

This commit is contained in:
Magnus Norddahl 2017-03-27 21:59:43 +02:00
commit 5adf7463cd
4 changed files with 62 additions and 62 deletions

View file

@ -144,67 +144,8 @@ void RenderPolySprite::Render(const TriMatrix &worldToClip, const PolyClipPlane
args.SetFaceCullCCW(true);
args.SetStencilTestValue(stencilValue);
args.SetWriteStencil(true, stencilValue);
args.SetTexture(tex, thing->Translation);
args.SetClipPlane(clipPlane);
if (thing->RenderStyle == LegacyRenderStyles[STYLE_Normal] ||
(r_drawfuzz == 0 && thing->RenderStyle == LegacyRenderStyles[STYLE_OptFuzzy]))
{
args.SetStyle(args.Translation() ? TriBlendMode::TranslatedAdd : TriBlendMode::TextureAdd, 1.0, 0.0);
}
else if (thing->RenderStyle == LegacyRenderStyles[STYLE_Add] && fullbrightSprite && thing->Alpha == 1.0 && !args.Translation())
{
args.SetStyle(TriBlendMode::TextureAddSrcColor, 1.0, 1.0);
}
else if (thing->RenderStyle == LegacyRenderStyles[STYLE_Add])
{
args.SetStyle(args.Translation() ? TriBlendMode::TranslatedAdd : TriBlendMode::TextureAdd, thing->Alpha, 1.0);
}
else if (thing->RenderStyle == LegacyRenderStyles[STYLE_Subtract])
{
args.SetStyle(args.Translation() ? TriBlendMode::TranslatedRevSub : TriBlendMode::TextureRevSub, thing->Alpha, 1.0);
}
else if (thing->RenderStyle == LegacyRenderStyles[STYLE_SoulTrans])
{
args.SetStyle(args.Translation() ? TriBlendMode::TranslatedAdd : TriBlendMode::TextureAdd, transsouls, 1.0 - transsouls);
}
else if (thing->RenderStyle == LegacyRenderStyles[STYLE_Fuzzy] ||
(r_drawfuzz == 2 && thing->RenderStyle == LegacyRenderStyles[STYLE_OptFuzzy]))
{ // NYI - Fuzzy - for now, just a copy of "Shadow"
args.SetStyle(args.Translation() ? TriBlendMode::TranslatedAdd : TriBlendMode::TextureAdd, 0.0, 160 / 255.0);
}
else if (thing->RenderStyle == LegacyRenderStyles[STYLE_Shadow] ||
(r_drawfuzz == 1 && thing->RenderStyle == LegacyRenderStyles[STYLE_OptFuzzy]))
{
args.SetStyle(args.Translation() ? TriBlendMode::TranslatedAdd : TriBlendMode::TextureAdd, 0.0, 160 / 255.0);
}
else if (thing->RenderStyle == LegacyRenderStyles[STYLE_TranslucentStencil])
{
args.SetColor(0xff000000 | thing->fillcolor, thing->fillcolor >> 24);
args.SetStyle(TriBlendMode::Stencil, thing->Alpha, 1.0 - thing->Alpha);
}
else if (thing->RenderStyle == LegacyRenderStyles[STYLE_AddStencil])
{
args.SetColor(0xff000000 | thing->fillcolor, thing->fillcolor >> 24);
args.SetStyle(TriBlendMode::AddStencil, thing->Alpha, 1.0);
}
else if (thing->RenderStyle == LegacyRenderStyles[STYLE_Shaded])
{
args.SetColor(0xff000000 | thing->fillcolor, thing->fillcolor >> 24);
args.SetStyle(TriBlendMode::Shaded, thing->Alpha, 1.0 - thing->Alpha);
args.SetTexture(tex, thing->Translation, true);
}
else if (thing->RenderStyle == LegacyRenderStyles[STYLE_AddShaded])
{
args.SetColor(0xff000000 | thing->fillcolor, thing->fillcolor >> 24);
args.SetStyle(TriBlendMode::AddShaded, thing->Alpha, 1.0);
args.SetTexture(tex, thing->Translation, true);
}
else
{
args.SetStyle(args.Translation() ? TriBlendMode::TranslatedAdd : TriBlendMode::TextureAdd, thing->Alpha, 1.0 - thing->Alpha);
}
args.SetStyle(thing->RenderStyle, thing->Alpha, thing->fillcolor, thing->Translation, tex, fullbrightSprite);
args.SetSubsectorDepthTest(true);
args.SetWriteSubsectorDepth(false);
args.SetWriteStencil(false);