- r_vanillatrans: Cache the cache! Transform the function into a global variable and recheck at the start of D_Display

This commit is contained in:
Rachael Alexanderson 2017-06-04 06:05:40 -04:00 committed by Christoph Oelckers
parent 5eaf085d58
commit c18134dbd3
6 changed files with 8 additions and 4 deletions

View file

@ -670,6 +670,8 @@ void D_Display ()
cycles.Reset(); cycles.Reset();
cycles.Clock(); cycles.Clock();
r_UseVanillaTransparency = UseVanillaTransparency(); // [SP] Cache UseVanillaTransparency() call
if (players[consoleplayer].camera == NULL) if (players[consoleplayer].camera == NULL)
{ {
players[consoleplayer].camera = players[consoleplayer].mo; players[consoleplayer].camera = players[consoleplayer].mo;

View file

@ -993,7 +993,7 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal)
{ {
trans = 1.f; trans = 1.f;
} }
if (UseVanillaTransparency()) if (r_UseVanillaTransparency)
{ {
// [SP] "canonical transparency" - with the flip of a CVar, disable transparency for Doom objects, // [SP] "canonical transparency" - with the flip of a CVar, disable transparency for Doom objects,
// and disable 'additive' translucency for certain objects from other games. // and disable 'additive' translucency for certain objects from other games.

View file

@ -146,7 +146,7 @@ void RenderPolySprite::Render(const TriMatrix &worldToClip, const PolyClipPlane
args.SetStencilTestValue(stencilValue); args.SetStencilTestValue(stencilValue);
args.SetWriteStencil(true, stencilValue); args.SetWriteStencil(true, stencilValue);
args.SetClipPlane(clipPlane); args.SetClipPlane(clipPlane);
if ((thing->renderflags & RF_ZDOOMTRANS) && UseVanillaTransparency()) if ((thing->renderflags & RF_ZDOOMTRANS) && r_UseVanillaTransparency)
args.SetStyle(LegacyRenderStyles[STYLE_Normal], 1.0f, thing->fillcolor, thing->Translation, tex, fullbrightSprite); args.SetStyle(LegacyRenderStyles[STYLE_Normal], 1.0f, thing->fillcolor, thing->Translation, tex, fullbrightSprite);
else else
args.SetStyle(thing->RenderStyle, thing->Alpha, thing->fillcolor, thing->Translation, tex, fullbrightSprite); args.SetStyle(thing->RenderStyle, thing->Alpha, thing->fillcolor, thing->Translation, tex, fullbrightSprite);

View file

@ -32,6 +32,7 @@
#include "c_dispatch.h" #include "c_dispatch.h"
#endif #endif
bool r_UseVanillaTransparency;
CVAR (Int, r_vanillatrans, 2, CVAR_ARCHIVE) CVAR (Int, r_vanillatrans, 2, CVAR_ARCHIVE)
namespace namespace

View file

@ -22,4 +22,5 @@
void UpdateVanillaTransparency(); void UpdateVanillaTransparency();
bool UseVanillaTransparency(); bool UseVanillaTransparency();
extern bool r_UseVanillaTransparency;

View file

@ -213,7 +213,7 @@ namespace swrenderer
if (thing->flags5 & MF5_BRIGHT) if (thing->flags5 & MF5_BRIGHT)
vis->renderflags |= RF_FULLBRIGHT; // kg3D vis->renderflags |= RF_FULLBRIGHT; // kg3D
vis->RenderStyle = thing->RenderStyle; vis->RenderStyle = thing->RenderStyle;
if (UseVanillaTransparency()) if (r_UseVanillaTransparency)
{ {
if (thing->renderflags & RF_ZDOOMTRANS) if (thing->renderflags & RF_ZDOOMTRANS)
vis->RenderStyle = LegacyRenderStyles[STYLE_Normal]; vis->RenderStyle = LegacyRenderStyles[STYLE_Normal];