- fully implemented "nolightfade" to turn off diminishing lights in the software renderer.

- unfortunately, LIGHT2SHADE had to be transformed into a namespaced function.
This commit is contained in:
Rachael Alexanderson 2017-03-06 16:14:54 -05:00
parent 5c3b9d81ad
commit 28abc96aef
24 changed files with 84 additions and 52 deletions

View file

@ -2951,7 +2951,7 @@ void OpenGLSWFrameBuffer::FillSimplePoly(FTexture *texture, FVector2 *points, in
DAngle rotation, FDynamicColormap *colormap, PalEntry flatcolor, int lightlevel, int bottomclip)
{
// Use an equation similar to player sprites to determine shade
double fadelevel = clamp((LIGHT2SHADE(lightlevel) / 65536. - 12) / NUMCOLORMAPS, 0.0, 1.0);
double fadelevel = clamp((swrenderer::LIGHT2SHADE(lightlevel, true) / 65536. - 12) / NUMCOLORMAPS, 0.0, 1.0);
BufferedTris *quad;
FBVERTEX *verts;

View file

@ -139,7 +139,7 @@ void RenderPolyDecal::Render(const TriMatrix &worldToClip, const Vec4f &clipPlan
args.uniforms.flags = 0;
args.SetColormap(front->ColorMap);
args.SetTexture(tex, decal->Translation, true);
args.uniforms.globvis = (float)swrenderer::LightVisibility::Instance()->WallGlobVis();
args.uniforms.globvis = (float)swrenderer::LightVisibility::Instance()->WallGlobVis(foggy);
if (fullbrightSprite || cameraLight->FixedLightLevel() >= 0 || cameraLight->FixedColormap())
{
args.uniforms.light = 256;

View file

@ -74,7 +74,7 @@ void RenderPolyParticle::Render(const TriMatrix &worldToClip, const Vec4f &clipP
PolyDrawArgs args;
args.uniforms.globvis = (float)swrenderer::LightVisibility::Instance()->ParticleGlobVis();
args.uniforms.globvis = (float)swrenderer::LightVisibility::Instance()->ParticleGlobVis(foggy);
if (fullbrightSprite || cameraLight->FixedLightLevel() >= 0 || cameraLight->FixedColormap())
{

View file

@ -99,6 +99,7 @@ void RenderPolyPlane::Render3DFloor(const TriMatrix &worldToClip, const Vec4f &c
swrenderer::CameraLight *cameraLight = swrenderer::CameraLight::Instance();
int lightlevel = 255;
bool foggy = false;
if (cameraLight->FixedLightLevel() < 0 && sub->sector->e->XFloor.lightlist.Size())
{
lightlist_t *light = P_GetPlaneLight(sub->sector, &sub->sector->ceilingplane, false);
@ -109,7 +110,7 @@ void RenderPolyPlane::Render3DFloor(const TriMatrix &worldToClip, const Vec4f &c
UVTransform xform(ceiling ? fakeFloor->top.model->planes[sector_t::ceiling].xform : fakeFloor->top.model->planes[sector_t::floor].xform, tex);
PolyDrawArgs args;
args.uniforms.globvis = (float)swrenderer::LightVisibility::Instance()->SlopePlaneGlobVis() * 48.0f;
args.uniforms.globvis = (float)swrenderer::LightVisibility::Instance()->SlopePlaneGlobVis(foggy) * 48.0f;
args.uniforms.light = (uint32_t)(lightlevel / 255.0f * 256.0f);
if (cameraLight->FixedLightLevel() >= 0 || cameraLight->FixedColormap())
args.uniforms.light = 256;
@ -155,6 +156,7 @@ void RenderPolyPlane::Render(const TriMatrix &worldToClip, const Vec4f &clipPlan
{
std::vector<PolyPortalSegment> portalSegments;
FSectorPortal *portal = nullptr;// sub->sector->ValidatePortal(ceiling ? sector_t::ceiling : sector_t::floor);
bool foggy = false;
PolyDrawSectorPortal *polyportal = nullptr;
if (portal && (portal->mFlags & PORTSF_INSKYBOX) == PORTSF_INSKYBOX) // Do not recurse into portals we already recursed into
portal = nullptr;
@ -305,7 +307,7 @@ void RenderPolyPlane::Render(const TriMatrix &worldToClip, const Vec4f &clipPlan
swrenderer::CameraLight *cameraLight = swrenderer::CameraLight::Instance();
PolyDrawArgs args;
args.uniforms.globvis = (float)swrenderer::LightVisibility::Instance()->SlopePlaneGlobVis() * 48.0f;
args.uniforms.globvis = (float)swrenderer::LightVisibility::Instance()->SlopePlaneGlobVis(foggy) * 48.0f;
args.uniforms.light = (uint32_t)(frontsector->lightlevel / 255.0f * 256.0f);
if (cameraLight->FixedLightLevel() >= 0 || cameraLight->FixedColormap())
args.uniforms.light = 256;

View file

@ -223,9 +223,9 @@ void RenderPolyPlayerSprites::RenderSprite(DPSprite *sprite, AActor *owner, floa
bool foggy = false;
int actualextralight = foggy ? 0 : extralight << 4;
int spriteshade = LIGHT2SHADE(owner->Sector->lightlevel + actualextralight);
int spriteshade = swrenderer::LIGHT2SHADE(owner->Sector->lightlevel + actualextralight, foggy);
double minz = double((2048 * 4) / double(1 << 20));
ColormapNum = GETPALOOKUP(swrenderer::LightVisibility::Instance()->SpriteGlobVis() / minz, spriteshade);
ColormapNum = GETPALOOKUP(swrenderer::LightVisibility::Instance()->SpriteGlobVis(foggy) / minz, spriteshade);
if (sprite->GetID() < PSP_TARGETCENTER)
{

View file

@ -228,6 +228,7 @@ void RenderPolyScene::RenderLine(subsector_t *sub, seg_t *line, sector_t *fronts
void RenderPolyScene::RenderPortals(int portalDepth)
{
bool foggy = false;
if (portalDepth < r_portal_recursions)
{
for (auto &portal : SectorPortals)
@ -241,7 +242,7 @@ void RenderPolyScene::RenderPortals(int portalDepth)
PolyDrawArgs args;
args.objectToClip = &WorldToClip;
args.mode = TriangleDrawMode::Fan;
args.uniforms.globvis = (float)swrenderer::LightVisibility::Instance()->WallGlobVis();
args.uniforms.globvis = (float)swrenderer::LightVisibility::Instance()->WallGlobVis(foggy);
args.uniforms.color = 0;
args.uniforms.light = 256;
args.uniforms.flags = TriUniforms::fixed_light;

View file

@ -139,7 +139,7 @@ void RenderPolySprite::Render(const TriMatrix &worldToClip, const Vec4f &clipPla
swrenderer::CameraLight *cameraLight = swrenderer::CameraLight::Instance();
PolyDrawArgs args;
args.uniforms.globvis = (float)swrenderer::LightVisibility::Instance()->SpriteGlobVis();
args.uniforms.globvis = (float)swrenderer::LightVisibility::Instance()->SpriteGlobVis(foggy);
args.uniforms.flags = 0;
if (fullbrightSprite || cameraLight->FixedLightLevel() >= 0 || cameraLight->FixedColormap())
{

View file

@ -198,6 +198,7 @@ void RenderPolyWall::SetCoords(const DVector2 &v1, const DVector2 &v2, double ce
void RenderPolyWall::Render(const TriMatrix &worldToClip, const Vec4f &clipPlane, PolyCull &cull)
{
bool foggy = false;
FTexture *tex = GetTexture();
if (!tex && !Polyportal)
return;
@ -247,7 +248,7 @@ void RenderPolyWall::Render(const TriMatrix &worldToClip, const Vec4f &clipPlane
}
PolyDrawArgs args;
args.uniforms.globvis = (float)swrenderer::LightVisibility::Instance()->WallGlobVis();
args.uniforms.globvis = (float)swrenderer::LightVisibility::Instance()->WallGlobVis(foggy);
args.uniforms.light = (uint32_t)(GetLightLevel() / 255.0f * 256.0f);
args.uniforms.flags = 0;
args.uniforms.subsectorDepth = SubsectorDepth;

View file

@ -101,7 +101,7 @@ void RenderPolyWallSprite::Render(const TriMatrix &worldToClip, const Vec4f &cli
swrenderer::CameraLight *cameraLight = swrenderer::CameraLight::Instance();
PolyDrawArgs args;
args.uniforms.globvis = (float)swrenderer::LightVisibility::Instance()->WallGlobVis();
args.uniforms.globvis = (float)swrenderer::LightVisibility::Instance()->WallGlobVis(foggy);
if (fullbrightSprite || cameraLight->FixedLightLevel() >= 0 || cameraLight->FixedColormap())
{
args.uniforms.light = 256;

View file

@ -496,7 +496,7 @@ namespace swrenderer
}
else
{
draw_segment->shade = LIGHT2SHADE(mLineSegment->sidedef->GetLightLevel(foggy, mLineSegment->frontsector->lightlevel) + R_ActualExtraLight(foggy));
draw_segment->shade = LIGHT2SHADE(mLineSegment->sidedef->GetLightLevel(foggy, mLineSegment->frontsector->lightlevel) + R_ActualExtraLight(foggy), foggy);
}
if (draw_segment->bFogBoundary || draw_segment->maskedtexturecol != nullptr)
@ -781,8 +781,8 @@ namespace swrenderer
CameraLight *cameraLight = CameraLight::Instance();
if (cameraLight->FixedColormap() == nullptr && cameraLight->FixedLightLevel() < 0)
{
wallshade = LIGHT2SHADE(mLineSegment->sidedef->GetLightLevel(foggy, mFrontSector->lightlevel) + R_ActualExtraLight(foggy));
double GlobVis = LightVisibility::Instance()->WallGlobVis();
wallshade = LIGHT2SHADE(mLineSegment->sidedef->GetLightLevel(foggy, mFrontSector->lightlevel) + R_ActualExtraLight(foggy), foggy);
double GlobVis = LightVisibility::Instance()->WallGlobVis(foggy);
rw_lightleft = float(GlobVis / WallC.sz1);
rw_lightstep = float((GlobVis / WallC.sz2 - rw_lightleft) / (WallC.sx2 - WallC.sx1));
}

View file

@ -401,7 +401,7 @@ namespace swrenderer
lightlist_t *lit = &frontsector->e->XFloor.lightlist[i];
basecolormap = lit->extra_colormap;
wallshade = LIGHT2SHADE(curline->sidedef->GetLightLevel(foggy, *lit->p_lightlevel, lit->lightsource != NULL) + R_ActualExtraLight(foggy));
wallshade = LIGHT2SHADE(curline->sidedef->GetLightLevel(foggy, *lit->p_lightlevel, lit->lightsource != NULL) + R_ActualExtraLight(foggy), foggy);
}
ProcessNormalWall(up, dwal, texturemid, swal, lwal);

View file

@ -26,6 +26,7 @@
#include "cmdlib.h"
#include "d_net.h"
#include "g_level.h"
#include "g_levellocals.h"
#include "swrenderer/scene/r_opaque_pass.h"
#include "r_flatplane.h"
#include "swrenderer/scene/r_3dfloors.h"
@ -115,7 +116,11 @@ namespace swrenderer
planeheight = fabs(pl->height.Zat0() - ViewPos.Z);
basecolormap = colormap;
GlobVis = LightVisibility::Instance()->FlatPlaneGlobVis() / planeheight;
// [RH] set foggy flag
bool foggy = (level.fadeto || basecolormap->Fade || (level.flags & LEVEL_HASFADETABLE));
GlobVis = LightVisibility::Instance()->FlatPlaneGlobVis(foggy) / planeheight;
CameraLight *cameraLight = CameraLight::Instance();
if (cameraLight->FixedLightLevel() >= 0)
@ -131,7 +136,7 @@ namespace swrenderer
else
{
plane_shade = true;
planeshade = LIGHT2SHADE(pl->lightlevel);
planeshade = LIGHT2SHADE(pl->lightlevel, foggy);
}
drawerargs.SetStyle(masked, additive, alpha);

View file

@ -26,6 +26,7 @@
#include "cmdlib.h"
#include "d_net.h"
#include "g_level.h"
#include "g_levellocals.h"
#include "swrenderer/scene/r_opaque_pass.h"
#include "r_slopeplane.h"
#include "swrenderer/scene/r_3dfloors.h"
@ -152,12 +153,15 @@ namespace swrenderer
plane_sz[0] = -plane_sz[0];
}
planelightfloat = (LightVisibility::Instance()->SlopePlaneGlobVis() * lxscale * lyscale) / (fabs(pl->height.ZatPoint(ViewPos) - ViewPos.Z)) / 65536.f;
// [RH] set foggy flag
basecolormap = colormap;
bool foggy = level.fadeto || basecolormap->Fade || (level.flags & LEVEL_HASFADETABLE);;
planelightfloat = (LightVisibility::Instance()->SlopePlaneGlobVis(foggy) * lxscale * lyscale) / (fabs(pl->height.ZatPoint(ViewPos) - ViewPos.Z)) / 65536.f;
if (pl->height.fC() > 0)
planelightfloat = -planelightfloat;
basecolormap = colormap;
CameraLight *cameraLight = CameraLight::Instance();
if (cameraLight->FixedLightLevel() >= 0)
@ -174,7 +178,7 @@ namespace swrenderer
{
drawerargs.SetLight(basecolormap, 0, 0);
plane_shade = true;
planeshade = LIGHT2SHADE(pl->lightlevel);
planeshade = LIGHT2SHADE(pl->lightlevel, foggy);
}
// Hack in support for 1 x Z and Z x 1 texture sizes

View file

@ -198,7 +198,7 @@ void SWCanvas::FillSimplePoly(DCanvas *canvas, FTexture *tex, FVector2 *points,
FDynamicColormap *colormap, PalEntry flatcolor, int lightlevel, int bottomclip)
{
// Use an equation similar to player sprites to determine shade
fixed_t shade = LIGHT2SHADE(lightlevel) - 12 * FRACUNIT;
fixed_t shade = LIGHT2SHADE(lightlevel, true) - 12 * FRACUNIT;
float topy, boty, leftx, rightx;
int toppt, botpt, pt1, pt2;
int i;

View file

@ -32,12 +32,20 @@
#include "d_player.h"
#include "swrenderer/scene/r_light.h"
#include "swrenderer/viewport/r_viewport.h"
#include "gl/data/gl_data.h"
CVAR(Bool, r_shadercolormaps, true, CVAR_ARCHIVE)
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor)
namespace swrenderer
{
fixed_t LIGHT2SHADE(int l, bool foggy)
{
return (!foggy && (glset.nolightfade) ?
((MAX(255 - l, 0) * NUMCOLORMAPS) << (FRACBITS - 8)) :
((NUMCOLORMAPS*2*FRACUNIT)-(((l)+12)*(FRACUNIT*NUMCOLORMAPS/128))));
}
CameraLight *CameraLight::Instance()
{
static CameraLight instance;
@ -146,10 +154,12 @@ namespace swrenderer
TiltVisibility = float(vis * FocalTangent * (16.f * 320.f) / viewwidth);
// Disable diminishing light (To do: make a cvar control this)
WallVisibility = 0.0;
FloorVisibility = 0.0;
TiltVisibility = 0.0f;
NoLightFade = glset.nolightfade;
// Disable diminishing light
// WallVisibility = 0.0;
// FloorVisibility = 0.0;
// TiltVisibility = 0.0f;
}
// Controls how quickly light ramps across a 1/z range. Set this, and it

View file

@ -29,13 +29,18 @@
// The size of a single colormap, in bits
#define COLORMAPSHIFT 8
// Convert a light level into an unbounded colormap index (shade). Result is
// fixed point. Why the +12? I wish I knew, but experimentation indicates it
// is necessary in order to best reproduce Doom's original lighting.
// Convert a light level into an unbounded colormap index (shade). Result is
// fixed point. Why the +12? I wish I knew, but experimentation indicates it
// is necessary in order to best reproduce Doom's original lighting.
//#define LIGHT2SHADE(l) ((NUMCOLORMAPS*2*FRACUNIT)-(((l)+12)*(FRACUNIT*NUMCOLORMAPS/128)))
// Disable diminishing light (To do: merge with LIGHT2SHADE and let a cvar control it, maybe by converting this to a function, like R_ActualExtraLight)
#define LIGHT2SHADE(lightlev) ((MAX(255 - lightlev, 0) * NUMCOLORMAPS) << (FRACBITS - 8))
// Disable diminishing light (To do: merge with LIGHT2SHADE and let a cvar control it, maybe by converting this to a function, like R_ActualExtraLight)
//#define LIGHT2SHADE(lightlev) ((MAX(255 - lightlev, 0) * NUMCOLORMAPS) << (FRACBITS - 8))
// combined!
//#define LIGHT2SHADE(l) ((glset.nolightfade)? \
// ((MAX(255 - l, 0) * NUMCOLORMAPS) << (FRACBITS - 8)) : \
// ((NUMCOLORMAPS*2*FRACUNIT)-(((l)+12)*(FRACUNIT*NUMCOLORMAPS/128))))
// MAXLIGHTSCALE from original DOOM, divided by 2.
#define MAXLIGHTVIS (24.0)
@ -57,6 +62,8 @@ struct FSWColormap;
namespace swrenderer
{
fixed_t LIGHT2SHADE(int lightlevel, bool foggy);
class CameraLight
{
public:
@ -83,17 +90,17 @@ namespace swrenderer
void SetVisibility(double visibility);
double GetVisibility() const { return CurrentVisibility; }
double WallGlobVis() const { return WallVisibility; }
double SpriteGlobVis() const { return WallVisibility; }
double ParticleGlobVis() const { return WallVisibility * 0.5; }
double FlatPlaneGlobVis() const { return FloorVisibility; }
double SlopePlaneGlobVis() const { return TiltVisibility; }
double WallGlobVis(bool foggy) const { return (NoLightFade && !foggy) ? 0.0f : WallVisibility; }
double SpriteGlobVis(bool foggy) const { return (NoLightFade && !foggy) ? 0.0f : WallVisibility; }
double ParticleGlobVis(bool foggy) const { return (NoLightFade && !foggy) ? 0.0f : (WallVisibility * 0.5); }
double FlatPlaneGlobVis(bool foggy) const { return (NoLightFade && !foggy) ? 0.0f : FloorVisibility; }
double SlopePlaneGlobVis(bool foggy) const { return (NoLightFade && !foggy) ? 0.0f : TiltVisibility; }
// The vis value to pass into the GETPALOOKUP or LIGHTSCALE macros
double WallVis(double screenZ) const { return WallGlobVis() / screenZ; }
double SpriteVis(double screenZ) const { return SpriteGlobVis() / screenZ; }
double ParticleVis(double screenZ) const { return ParticleGlobVis() / screenZ; }
double FlatPlaneVis(int screenY, double planeZ) const { return FlatPlaneGlobVis() / fabs(planeZ - ViewPos.Z) * fabs(RenderViewport::Instance()->CenterY - screenY); }
double WallVis(double screenZ, bool foggy) const { return WallGlobVis(foggy) / screenZ; }
double SpriteVis(double screenZ, bool foggy) const { return SpriteGlobVis(foggy) / screenZ; }
double ParticleVis(double screenZ, bool foggy) const { return ParticleGlobVis(foggy) / screenZ; }
double FlatPlaneVis(int screenY, double planeZ, bool foggy) const { return FlatPlaneGlobVis(foggy) / fabs(planeZ - ViewPos.Z) * fabs(RenderViewport::Instance()->CenterY - screenY); }
private:
double BaseVisibility = 0.0;
@ -101,6 +108,8 @@ namespace swrenderer
double FloorVisibility = 0.0;
float TiltVisibility = 0.0f;
bool NoLightFade = false;
double CurrentVisibility = 8.f;
double MaxVisForWall = 0.0;
double MaxVisForFloor = 0.0;

View file

@ -717,7 +717,7 @@ namespace swrenderer
// [RH] Add particles
if ((unsigned int)(sub - subsectors) < (unsigned int)numsubsectors)
{ // Only do it for the main BSP.
int shade = LIGHT2SHADE((floorlightlevel + ceilinglightlevel) / 2 + R_ActualExtraLight(foggy));
int shade = LIGHT2SHADE((floorlightlevel + ceilinglightlevel) / 2 + R_ActualExtraLight(foggy), foggy);
for (WORD i = ParticlesInSubsec[(unsigned int)(sub - subsectors)]; i != NO_PARTICLE; i = Particles[i].snext)
{
RenderParticle::Project(Thread, Particles + i, subsectors[sub - subsectors].sector, shade, FakeSide, foggy);
@ -834,7 +834,7 @@ namespace swrenderer
//sec->validcount = validcount;
SeenSpriteSectors.insert(sec);
int spriteshade = LIGHT2SHADE(lightlevel + R_ActualExtraLight(foggy));
int spriteshade = LIGHT2SHADE(lightlevel + R_ActualExtraLight(foggy), foggy);
// Handle all things in sector.
for (auto p = sec->touching_renderthings; p != nullptr; p = p->m_snext)
@ -886,7 +886,7 @@ namespace swrenderer
if (sec->sectornum != thing->Sector->sectornum) // compare sectornums to account for R_FakeFlat copies.
{
int lightlevel = thing->Sector->GetTexture(sector_t::ceiling) == skyflatnum ? thing->Sector->GetCeilingLight() : thing->Sector->GetFloorLight();
thingShade = LIGHT2SHADE(lightlevel + R_ActualExtraLight(foggy));
thingShade = LIGHT2SHADE(lightlevel + R_ActualExtraLight(foggy), foggy);
thingColormap = thing->Sector->ColorMap;
}

View file

@ -204,7 +204,7 @@ namespace swrenderer
vis->floorclip = 0;
vis->foggy = foggy;
vis->Light.SetColormap(tiz * LightVisibility::Instance()->ParticleGlobVis(), shade, map, particle->bright != 0, false, false);
vis->Light.SetColormap(tiz * LightVisibility::Instance()->ParticleGlobVis(foggy), shade, map, particle->bright != 0, false, false);
thread->SpriteList->Push(vis);
}

View file

@ -131,7 +131,7 @@ namespace swrenderer
// get light level
lightnum = ((floorlight + ceilinglight) >> 1) + R_ActualExtraLight(foggy);
int spriteshade = LIGHT2SHADE(lightnum) - 24 * FRACUNIT;
int spriteshade = LIGHT2SHADE(lightnum, foggy) - 24 * FRACUNIT;
if (camera->player != NULL)
{

View file

@ -280,7 +280,7 @@ namespace swrenderer
vis->dynlightcolor = 0;
}
vis->Light.SetColormap(LightVisibility::Instance()->SpriteGlobVis() / MAX(tz, MINZ), spriteshade, basecolormap, fullbright, invertcolormap, fadeToBlack);
vis->Light.SetColormap(LightVisibility::Instance()->SpriteGlobVis(foggy) / MAX(tz, MINZ), spriteshade, basecolormap, fullbright, invertcolormap, fadeToBlack);
thread->SpriteList->Push(vis);
}

View file

@ -138,9 +138,9 @@ namespace swrenderer
bool isFullBright = !foggy && (renderflags & RF_FULLBRIGHT);
bool fadeToBlack = spr->RenderStyle == LegacyRenderStyles[STYLE_Add] && mybasecolormap->Fade != 0;
int spriteshade = LIGHT2SHADE(sec->lightlevel + R_ActualExtraLight(spr->foggy));
int spriteshade = LIGHT2SHADE(sec->lightlevel + R_ActualExtraLight(spr->foggy), foggy);
Light.SetColormap(LightVisibility::Instance()->SpriteGlobVis() / MAX(MINZ, (double)spr->depth), spriteshade, mybasecolormap, isFullBright, invertcolormap, fadeToBlack);
Light.SetColormap(LightVisibility::Instance()->SpriteGlobVis(foggy) / MAX(MINZ, (double)spr->depth), spriteshade, mybasecolormap, isFullBright, invertcolormap, fadeToBlack);
}
}

View file

@ -178,7 +178,7 @@ namespace swrenderer
bool fullbright = !vis->foggy && ((renderflags & RF_FULLBRIGHT) || (thing->flags5 & MF5_BRIGHT));
bool fadeToBlack = (vis->RenderStyle.Flags & STYLEF_FadeToBlack) != 0;
vis->Light.SetColormap(LightVisibility::Instance()->SpriteGlobVis() / MAX(tz, MINZ), spriteshade, basecolormap, fullbright, invertcolormap, fadeToBlack);
vis->Light.SetColormap(LightVisibility::Instance()->SpriteGlobVis(foggy) / MAX(tz, MINZ), spriteshade, basecolormap, fullbright, invertcolormap, fadeToBlack);
thread->SpriteList->Push(vis, true);
}

View file

@ -133,7 +133,7 @@ namespace swrenderer
vis->wallc = wallc;
vis->foggy = foggy;
vis->Light.SetColormap(LightVisibility::Instance()->SpriteGlobVis() / MAX(tz, MINZ), spriteshade, basecolormap, false, false, false);
vis->Light.SetColormap(LightVisibility::Instance()->SpriteGlobVis(foggy) / MAX(tz, MINZ), spriteshade, basecolormap, false, false, false);
thread->SpriteList->Push(vis);
}
@ -182,8 +182,8 @@ namespace swrenderer
SpriteDrawerArgs drawerargs;
int shade = LIGHT2SHADE(spr->sector->lightlevel + R_ActualExtraLight(spr->foggy));
double GlobVis = LightVisibility::Instance()->WallGlobVis();
int shade = LIGHT2SHADE(spr->sector->lightlevel + R_ActualExtraLight(spr->foggy), spr->foggy);
double GlobVis = LightVisibility::Instance()->WallGlobVis(foggy);
float lightleft = float(GlobVis / spr->wallc.sz1);
float lightstep = float((GlobVis / spr->wallc.sz2 - lightleft) / (spr->wallc.sx2 - spr->wallc.sx1));
float light = lightleft + (x1 - spr->wallc.sx1) * lightstep;

View file

@ -3130,7 +3130,7 @@ void D3DFB::FillSimplePoly(FTexture *texture, FVector2 *points, int npoints,
DAngle rotation, FDynamicColormap *colormap, PalEntry flatcolor, int lightlevel, int bottomclip)
{
// Use an equation similar to player sprites to determine shade
double fadelevel = clamp((LIGHT2SHADE(lightlevel)/65536. - 12) / NUMCOLORMAPS, 0.0, 1.0);
double fadelevel = clamp((swrenderer::LIGHT2SHADE(lightlevel, true)/65536. - 12) / NUMCOLORMAPS, 0.0, 1.0);
BufferedTris *quad;
FBVERTEX *verts;