- Fully implemented Graf's level.PreserveSectorColor() changes into the software renderers.

This commit is contained in:
Rachael Alexanderson 2017-01-28 09:53:24 -05:00
parent d27a152d9b
commit 2f9453bc86
13 changed files with 20 additions and 36 deletions

View file

@ -30,11 +30,11 @@
#include "d_player.h"
#include "swrenderer/scene/r_viewport.h"
#include "swrenderer/scene/r_light.h"
#include "g_levellocals.h"
EXTERN_CVAR(Bool, r_drawplayersprites)
EXTERN_CVAR(Bool, r_deathcamera)
EXTERN_CVAR(Bool, st_scale)
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor)
EXTERN_CVAR(Bool, r_shadercolormaps)
void RenderPolyPlayerSprites::Render()
@ -269,12 +269,12 @@ void RenderPolyPlayerSprites::RenderSprite(DPSprite *sprite, AActor *owner, floa
}
if (swrenderer::fixedlightlev >= 0)
{
BaseColormap = (r_fullbrightignoresectorcolor) ? &FullNormalLight : mybasecolormap;
BaseColormap = (!level.PreserveSectorColor()) ? &FullNormalLight : mybasecolormap;
ColormapNum = swrenderer::fixedlightlev >> COLORMAPSHIFT;
}
else if (!foggy && sprite->GetState()->GetFullbright())
{ // full bright
BaseColormap = (r_fullbrightignoresectorcolor) ? &FullNormalLight : mybasecolormap; // [RH] use basecolormap
BaseColormap = (!level.PreserveSectorColor()) ? &FullNormalLight : mybasecolormap; // [RH] use basecolormap
ColormapNum = 0;
}
else
@ -334,9 +334,9 @@ void RenderPolyPlayerSprites::RenderSprite(DPSprite *sprite, AActor *owner, floa
noaccel = true;
}
// [SP] If emulating GZDoom fullbright, disable acceleration
if (r_fullbrightignoresectorcolor && cameraLight->fixedlightlev >= 0)
if (!level.PreserveSectorColor() && cameraLight->fixedlightlev >= 0)
mybasecolormap = &FullNormalLight;
if (r_fullbrightignoresectorcolor && !foggy && sprite->GetState()->GetFullbright())
if (!level.PreserveSectorColor() && !foggy && sprite->GetState()->GetFullbright())
mybasecolormap = &FullNormalLight;
colormap_to_use = mybasecolormap;
}

View file

@ -52,7 +52,6 @@
CVAR(Bool, r_fogboundary, true, 0)
CVAR(Bool, r_drawmirrors, true, 0)
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor);
namespace swrenderer
{
@ -935,7 +934,7 @@ namespace swrenderer
CameraLight *cameraLight = CameraLight::Instance();
if (cameraLight->fixedlightlev >= 0)
R_SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
R_SetColorMapLight((!level.PreserveSectorColor()) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
else if (cameraLight->fixedcolormap != nullptr)
R_SetColorMapLight(cameraLight->fixedcolormap, 0, 0);

View file

@ -41,8 +41,7 @@
#include "swrenderer/things/r_visiblesprite.h"
#include "swrenderer/scene/r_light.h"
#include "swrenderer/scene/r_viewport.h"
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor);
#include "g_levellocals.h"
namespace swrenderer
{
@ -142,7 +141,7 @@ namespace swrenderer
rw_scalestep = ds->iscalestep;
if (cameraLight->fixedlightlev >= 0)
R_SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
R_SetColorMapLight((!level.PreserveSectorColor()) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
else if (cameraLight->fixedcolormap != nullptr)
R_SetColorMapLight(cameraLight->fixedcolormap, 0, 0);
@ -445,7 +444,7 @@ namespace swrenderer
CameraLight *cameraLight = CameraLight::Instance();
if (cameraLight->fixedlightlev >= 0)
R_SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
R_SetColorMapLight((!level.PreserveSectorColor()) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
else if (cameraLight->fixedcolormap != nullptr)
R_SetColorMapLight(cameraLight->fixedcolormap, 0, 0);

View file

@ -32,9 +32,9 @@
#include "d_player.h"
#include "swrenderer/scene/r_light.h"
#include "swrenderer/scene/r_viewport.h"
#include "g_levellocals.h"
CVAR(Bool, r_shadercolormaps, true, CVAR_ARCHIVE)
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor)
namespace swrenderer
{
@ -75,7 +75,7 @@ namespace swrenderer
{
fixedlightlev = player->fixedlightlevel * 256;
// [SP] Emulate GZDoom's light-amp goggles.
if (r_fullbrightignoresectorcolor && fixedlightlev >= 0)
if (!level.PreserveSectorColor() && fixedlightlev >= 0)
{
fixedcolormap = &FullNormalLight;
}
@ -194,12 +194,12 @@ namespace swrenderer
}
else if (cameraLight->fixedlightlev >= 0)
{
BaseColormap = (r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap;
BaseColormap = (!level.PreserveSectorColor()) ? &FullNormalLight : basecolormap;
ColormapNum = cameraLight->fixedlightlev >> COLORMAPSHIFT;
}
else if (fullbright)
{
BaseColormap = (r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap;
BaseColormap = (!level.PreserveSectorColor()) ? &FullNormalLight : basecolormap;
ColormapNum = 0;
}
else

View file

@ -62,7 +62,6 @@
#include "r_data/colormaps.h"
#include "g_levellocals.h"
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor);
EXTERN_CVAR(Bool, r_drawvoxels);
namespace swrenderer
@ -494,7 +493,7 @@ namespace swrenderer
}
else
{
basecolormap = (r_fullbrightignoresectorcolor && cameraLight->fixedlightlev >= 0) ? &FullNormalLight : frontsector->ColorMap;
basecolormap = (!level.PreserveSectorColor() && cameraLight->fixedlightlev >= 0) ? &FullNormalLight : frontsector->ColorMap;
}
portal = frontsector->ValidatePortal(sector_t::ceiling);
@ -532,7 +531,7 @@ namespace swrenderer
}
else
{
basecolormap = (r_fullbrightignoresectorcolor && cameraLight->fixedlightlev >= 0) ? &FullNormalLight : frontsector->ColorMap;
basecolormap = (!level.PreserveSectorColor() && cameraLight->fixedlightlev >= 0) ? &FullNormalLight : frontsector->ColorMap;
}
// killough 3/7/98: Add (x,y) offsets to flats, add deep water check

View file

@ -43,8 +43,6 @@ EXTERN_CVAR(Int, r_drawfuzz)
EXTERN_CVAR(Bool, r_drawvoxels)
EXTERN_CVAR(Bool, r_blendmethod)
CVAR(Bool, r_fullbrightignoresectorcolor, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
namespace swrenderer
{
RenderTranslucentPass *RenderTranslucentPass::Instance()

View file

@ -42,8 +42,7 @@
#include "swrenderer/scene/r_light.h"
#include "swrenderer/things/r_wallsprite.h"
#include "swrenderer/r_memory.h"
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor);
#include "g_levellocals.h"
namespace swrenderer
{
@ -255,11 +254,11 @@ namespace swrenderer
light = lightleft + (x1 - savecoord.sx1) * lightstep;
cameraLight = CameraLight::Instance();
if (cameraLight->fixedlightlev >= 0)
R_SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : usecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
R_SetColorMapLight((!level.PreserveSectorColor()) ? &FullNormalLight : usecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
else if (cameraLight->fixedcolormap != NULL)
R_SetColorMapLight(cameraLight->fixedcolormap, 0, 0);
else if (!foggy && (decal->RenderFlags & RF_FULLBRIGHT))
R_SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : usecolormap, 0, 0);
R_SetColorMapLight((!level.PreserveSectorColor()) ? &FullNormalLight : usecolormap, 0, 0);
else
calclighting = true;

View file

@ -56,8 +56,6 @@
#include "swrenderer/drawers/r_draw_pal.h"
#include "swrenderer/r_memory.h"
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor);
namespace swrenderer
{
void RenderParticle::Project(particle_t *particle, const sector_t *sector, int shade, WaterFakeSide fakeside, bool foggy)

View file

@ -61,7 +61,6 @@ EXTERN_CVAR(Bool, st_scale)
EXTERN_CVAR(Bool, r_drawplayersprites)
EXTERN_CVAR(Bool, r_deathcamera)
EXTERN_CVAR(Bool, r_shadercolormaps)
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor)
namespace swrenderer
{

View file

@ -56,8 +56,6 @@
#include "swrenderer/things/r_sprite.h"
#include "swrenderer/r_memory.h"
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor)
namespace swrenderer
{
void RenderSprite::Project(AActor *thing, const DVector3 &pos, FTexture *tex, const DVector2 &spriteScale, int renderflags, WaterFakeSide fakeside, F3DFloor *fakefloor, F3DFloor *fakeceiling, sector_t *current_sector, int spriteshade, bool foggy, FDynamicColormap *basecolormap)

View file

@ -36,8 +36,6 @@
#include "swrenderer/scene/r_viewport.h"
#include "swrenderer/r_memory.h"
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor);
namespace swrenderer
{
void VisibleSprite::Render()

View file

@ -43,8 +43,6 @@
#include "swrenderer/scene/r_light.h"
#include "swrenderer/r_memory.h"
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor)
namespace swrenderer
{
void RenderVoxel::Project(AActor *thing, DVector3 pos, FVoxelDef *voxel, const DVector2 &spriteScale, int renderflags, WaterFakeSide fakeside, F3DFloor *fakefloor, F3DFloor *fakeceiling, sector_t *current_sector, int spriteshade, bool foggy, FDynamicColormap *basecolormap)

View file

@ -57,8 +57,7 @@
#include "swrenderer/line/r_wallsetup.h"
#include "swrenderer/line/r_walldraw.h"
#include "swrenderer/r_memory.h"
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor);
#include "g_levellocals.h"
namespace swrenderer
{
@ -190,7 +189,7 @@ namespace swrenderer
else if (cameraLight->fixedcolormap != NULL)
R_SetColorMapLight(cameraLight->fixedcolormap, 0, 0);
else if (!spr->foggy && (spr->renderflags & RF_FULLBRIGHT))
R_SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : usecolormap, 0, 0);
R_SetColorMapLight((!level.PreserveSectorColor()) ? &FullNormalLight : usecolormap, 0, 0);
else
calclighting = true;