mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-28 15:02:01 +00:00
- delay converting sprite lightlevels to a shade until we hit ColormapLight
This commit is contained in:
parent
66b5e6e2ee
commit
2ce91ea62f
22 changed files with 57 additions and 55 deletions
|
@ -54,12 +54,13 @@
|
|||
|
||||
namespace swrenderer
|
||||
{
|
||||
void RenderFogBoundary::Render(RenderThread *thread, int x1, int x2, const short *uclip, const short *dclip, int wallshade, float lightleft, float lightstep, FDynamicColormap *basecolormap)
|
||||
void RenderFogBoundary::Render(RenderThread *thread, int x1, int x2, const short *uclip, const short *dclip, int lightlevel, bool foggy, float lightleft, float lightstep, FDynamicColormap *basecolormap)
|
||||
{
|
||||
// This is essentially the same as R_MapVisPlane but with an extra step
|
||||
// to create new horizontal spans whenever the light changes enough that
|
||||
// we need to use a new colormap.
|
||||
|
||||
int wallshade = LightVisibility::LightLevelToShade(lightlevel, foggy, thread->Viewport.get());
|
||||
float light = lightleft + lightstep*(x2 - x1 - 1);
|
||||
int x = x2 - 1;
|
||||
int t2 = uclip[x];
|
||||
|
@ -73,7 +74,7 @@ namespace swrenderer
|
|||
fillshort(spanend + t2, b2 - t2, x);
|
||||
}
|
||||
|
||||
drawerargs.SetLight(basecolormap, (float)light, wallshade);
|
||||
drawerargs.SetLight(basecolormap, (float)light, lightlevel, foggy, thread->Viewport.get());
|
||||
|
||||
uint8_t *fake_dc_colormap = basecolormap->Maps + (GETPALOOKUP(light, wallshade) << COLORMAPSHIFT);
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace swrenderer
|
|||
class RenderFogBoundary
|
||||
{
|
||||
public:
|
||||
void Render(RenderThread *thread, int x1, int x2, const short *uclip, const short *dclip, int wallshade, float lightleft, float lightstep, FDynamicColormap *basecolormap);
|
||||
void Render(RenderThread *thread, int x1, int x2, const short *uclip, const short *dclip, int lightlevel, bool foggy, float lightleft, float lightstep, FDynamicColormap *basecolormap);
|
||||
|
||||
private:
|
||||
void RenderSection(RenderThread *thread, int y, int y2, int x1);
|
||||
|
|
|
@ -129,7 +129,7 @@ namespace swrenderer
|
|||
const short *mceilingclip = ds->sprtopclip - ds->x1;
|
||||
|
||||
RenderFogBoundary renderfog;
|
||||
renderfog.Render(Thread, x1, x2, mceilingclip, mfloorclip, LightVisibility::LightLevelToShade(lightlevel, ds->foggy, Thread->Viewport.get()), rw_light, rw_lightstep, basecolormap);
|
||||
renderfog.Render(Thread, x1, x2, mceilingclip, mfloorclip, lightlevel, ds->foggy, rw_light, rw_lightstep, basecolormap);
|
||||
|
||||
if (ds->maskedtexturecol == nullptr)
|
||||
renderwall = false;
|
||||
|
|
|
@ -153,7 +153,7 @@ namespace swrenderer
|
|||
else
|
||||
{
|
||||
plane_shade = true;
|
||||
planeshade = LightVisibility::LightLevelToShade(pl->lightlevel, foggy, viewport);
|
||||
lightlevel = pl->lightlevel;
|
||||
}
|
||||
|
||||
drawerargs.SetStyle(masked, additive, alpha);
|
||||
|
@ -200,7 +200,7 @@ namespace swrenderer
|
|||
if (plane_shade)
|
||||
{
|
||||
// Determine lighting based on the span's distance from the viewer.
|
||||
drawerargs.SetLight(basecolormap, (float)Thread->Light->FlatPlaneVis(y, planeheight, foggy, viewport), planeshade);
|
||||
drawerargs.SetLight(basecolormap, (float)Thread->Light->FlatPlaneVis(y, planeheight, foggy, viewport), lightlevel, foggy, viewport);
|
||||
}
|
||||
|
||||
if (r_dynlights)
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace swrenderer
|
|||
int minx;
|
||||
double planeheight;
|
||||
bool plane_shade;
|
||||
int planeshade;
|
||||
int lightlevel;
|
||||
bool foggy;
|
||||
FDynamicColormap *basecolormap;
|
||||
double pviewx, pviewy;
|
||||
|
|
|
@ -174,7 +174,7 @@ namespace swrenderer
|
|||
|
||||
// [RH] set foggy flag
|
||||
basecolormap = colormap;
|
||||
bool foggy = level.fadeto || basecolormap->Fade || (level.flags & LEVEL_HASFADETABLE);;
|
||||
foggy = level.fadeto || basecolormap->Fade || (level.flags & LEVEL_HASFADETABLE);;
|
||||
|
||||
planelightfloat = (Thread->Light->SlopePlaneGlobVis(foggy) * lxscale * lyscale) / (fabs(pl->height.ZatPoint(Thread->Viewport->viewpoint.Pos) - Thread->Viewport->viewpoint.Pos.Z)) / 65536.f;
|
||||
|
||||
|
@ -197,7 +197,7 @@ namespace swrenderer
|
|||
{
|
||||
drawerargs.SetLight(basecolormap, 0, 0);
|
||||
plane_shade = true;
|
||||
planeshade = LightVisibility::LightLevelToShade(pl->lightlevel, foggy, viewport);
|
||||
lightlevel = pl->lightlevel;
|
||||
}
|
||||
|
||||
// Hack in support for 1 x Z and Z x 1 texture sizes
|
||||
|
@ -215,7 +215,7 @@ namespace swrenderer
|
|||
|
||||
void RenderSlopePlane::RenderLine(int y, int x1, int x2)
|
||||
{
|
||||
drawerargs.DrawTiltedSpan(Thread, y, x1, x2, plane_sz, plane_su, plane_sv, plane_shade, planeshade, planelightfloat, pviewx, pviewy, basecolormap);
|
||||
drawerargs.DrawTiltedSpan(Thread, y, x1, x2, plane_sz, plane_su, plane_sv, plane_shade, lightlevel, foggy, planelightfloat, pviewx, pviewy, basecolormap);
|
||||
|
||||
if (r_modelscene)
|
||||
{
|
||||
|
|
|
@ -43,7 +43,8 @@ namespace swrenderer
|
|||
FVector3 plane_sz, plane_su, plane_sv;
|
||||
float planelightfloat;
|
||||
bool plane_shade;
|
||||
int planeshade;
|
||||
int lightlevel;
|
||||
bool foggy;
|
||||
fixed_t pviewx, pviewy;
|
||||
fixed_t xscale, yscale;
|
||||
FDynamicColormap *basecolormap;
|
||||
|
|
|
@ -160,7 +160,7 @@ namespace swrenderer
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void ColormapLight::SetColormap(double visibility, int shade, FDynamicColormap *basecolormap, bool fullbright, bool invertColormap, bool fadeToBlack)
|
||||
void ColormapLight::SetColormap(RenderThread *thread, double z, int lightlevel, bool foggy, FDynamicColormap *basecolormap, bool fullbright, bool invertColormap, bool fadeToBlack, bool psprite, bool particle)
|
||||
{
|
||||
if (fadeToBlack)
|
||||
{
|
||||
|
@ -181,16 +181,16 @@ namespace swrenderer
|
|||
}
|
||||
|
||||
CameraLight *cameraLight = CameraLight::Instance();
|
||||
if (cameraLight->FixedColormap())
|
||||
{
|
||||
BaseColormap = cameraLight->FixedColormap();
|
||||
ColormapNum = 0;
|
||||
}
|
||||
else if (cameraLight->FixedLightLevel() >= 0)
|
||||
if (cameraLight->FixedLightLevel() >= 0)
|
||||
{
|
||||
BaseColormap = (r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap;
|
||||
ColormapNum = cameraLight->FixedLightLevel() >> COLORMAPSHIFT;
|
||||
}
|
||||
else if (cameraLight->FixedColormap())
|
||||
{
|
||||
BaseColormap = cameraLight->FixedColormap();
|
||||
ColormapNum = 0;
|
||||
}
|
||||
else if (fullbright)
|
||||
{
|
||||
BaseColormap = (r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap;
|
||||
|
@ -198,6 +198,14 @@ namespace swrenderer
|
|||
}
|
||||
else
|
||||
{
|
||||
double visibility = thread->Light->SpriteVis(z, foggy);
|
||||
if (particle)
|
||||
visibility *= 0.5;
|
||||
|
||||
int shade = LightVisibility::LightLevelToShade(lightlevel, foggy, thread->Viewport.get());
|
||||
if (psprite)
|
||||
shade -= 24 * FRACUNIT;
|
||||
|
||||
BaseColormap = basecolormap;
|
||||
ColormapNum = GETPALOOKUP(visibility, shade);
|
||||
}
|
||||
|
|
|
@ -83,7 +83,6 @@ namespace swrenderer
|
|||
// The vis value to pass into the GETPALOOKUP or LIGHTSCALE macros
|
||||
double WallVis(double screenZ, bool foggy) const { return WallGlobVis(foggy) / screenZ; }
|
||||
double SpriteVis(double screenZ, bool foggy) const { return SpriteGlobVis(foggy) / MAX(screenZ, MINZ); }
|
||||
double ParticleVis(double screenZ, bool foggy) const { return ParticleGlobVis(foggy) / screenZ; }
|
||||
double FlatPlaneVis(int screenY, double planeheight, bool foggy, RenderViewport *viewport) const { return FlatPlaneGlobVis(foggy) / planeheight * fabs(viewport->CenterY - screenY); }
|
||||
|
||||
double SlopePlaneGlobVis(bool foggy) const { return (NoLightFade && !foggy) ? 0.0f : TiltVisibility; }
|
||||
|
@ -95,7 +94,6 @@ namespace swrenderer
|
|||
private:
|
||||
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; }
|
||||
|
||||
static fixed_t LightLevelToShadeImpl(int lightlevel, bool foggy);
|
||||
|
@ -118,6 +116,6 @@ namespace swrenderer
|
|||
int ColormapNum = 0;
|
||||
FSWColormap *BaseColormap = nullptr;
|
||||
|
||||
void SetColormap(double visibility, int shade, FDynamicColormap *basecolormap, bool fullbright, bool invertColormap, bool fadeToBlack);
|
||||
void SetColormap(RenderThread *thread, double z, int lightlevel, bool foggy, FDynamicColormap *basecolormap, bool fullbright, bool invertColormap, bool fadeToBlack, bool psprite, bool particle);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -613,10 +613,10 @@ namespace swrenderer
|
|||
// [RH] Add particles
|
||||
if ((unsigned int)(sub->Index()) < level.subsectors.Size())
|
||||
{ // Only do it for the main BSP.
|
||||
int shade = LightVisibility::LightLevelToShade((floorlightlevel + ceilinglightlevel) / 2, foggy, Thread->Viewport.get());
|
||||
int lightlevel = (floorlightlevel + ceilinglightlevel) / 2;
|
||||
for (int i = ParticlesInSubsec[sub->Index()]; i != NO_PARTICLE; i = Particles[i].snext)
|
||||
{
|
||||
RenderParticle::Project(Thread, &Particles[i], sub->sector, shade, FakeSide, foggy);
|
||||
RenderParticle::Project(Thread, &Particles[i], sub->sector, lightlevel, FakeSide, foggy);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -891,8 +891,6 @@ namespace swrenderer
|
|||
//sec->validcount = validcount;
|
||||
SeenSpriteSectors.insert(sec);
|
||||
|
||||
int spriteshade = LightVisibility::LightLevelToShade(lightlevel, foggy, Thread->Viewport.get());
|
||||
|
||||
// Handle all things in sector.
|
||||
for (auto p = sec->touching_renderthings; p != nullptr; p = p->m_snext)
|
||||
{
|
||||
|
@ -947,25 +945,24 @@ namespace swrenderer
|
|||
else if (GetThingSprite(thing, sprite))
|
||||
{
|
||||
FDynamicColormap *thingColormap = basecolormap;
|
||||
int thingShade = spriteshade;
|
||||
int thinglightlevel = lightlevel;
|
||||
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 = LightVisibility::LightLevelToShade(lightlevel, foggy, Thread->Viewport.get());
|
||||
thinglightlevel = thing->Sector->GetTexture(sector_t::ceiling) == skyflatnum ? thing->Sector->GetCeilingLight() : thing->Sector->GetFloorLight();
|
||||
thingColormap = GetColorTable(thing->Sector->Colormap, thing->Sector->SpecialColors[sector_t::sprites], true);
|
||||
}
|
||||
|
||||
if ((sprite.renderflags & RF_SPRITETYPEMASK) == RF_WALLSPRITE)
|
||||
{
|
||||
RenderWallSprite::Project(Thread, thing, sprite.pos, sprite.tex, sprite.spriteScale, sprite.renderflags, thingShade, foggy, thingColormap);
|
||||
RenderWallSprite::Project(Thread, thing, sprite.pos, sprite.tex, sprite.spriteScale, sprite.renderflags, thinglightlevel, foggy, thingColormap);
|
||||
}
|
||||
else if (sprite.voxel)
|
||||
{
|
||||
RenderVoxel::Project(Thread, thing, sprite.pos, sprite.voxel, sprite.spriteScale, sprite.renderflags, fakeside, fakefloor, fakeceiling, sec, thingShade, foggy, thingColormap);
|
||||
RenderVoxel::Project(Thread, thing, sprite.pos, sprite.voxel, sprite.spriteScale, sprite.renderflags, fakeside, fakefloor, fakeceiling, sec, thinglightlevel, foggy, thingColormap);
|
||||
}
|
||||
else
|
||||
{
|
||||
RenderSprite::Project(Thread, thing, sprite.pos, sprite.tex, sprite.spriteScale, sprite.renderflags, fakeside, fakefloor, fakeceiling, sec, thingShade, foggy, thingColormap);
|
||||
RenderSprite::Project(Thread, thing, sprite.pos, sprite.tex, sprite.spriteScale, sprite.renderflags, fakeside, fakefloor, fakeceiling, sec, thinglightlevel, foggy, thingColormap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor);
|
|||
|
||||
namespace swrenderer
|
||||
{
|
||||
void RenderParticle::Project(RenderThread *thread, particle_t *particle, const sector_t *sector, int shade, WaterFakeSide fakeside, bool foggy)
|
||||
void RenderParticle::Project(RenderThread *thread, particle_t *particle, const sector_t *sector, int lightlevel, WaterFakeSide fakeside, bool foggy)
|
||||
{
|
||||
double tr_x, tr_y;
|
||||
double tx, ty;
|
||||
|
@ -220,7 +220,7 @@ namespace swrenderer
|
|||
vis->floorclip = 0;
|
||||
vis->foggy = foggy;
|
||||
|
||||
vis->Light.SetColormap(thread->Light->ParticleVis(tz, foggy), shade, map, particle->bright != 0, false, false);
|
||||
vis->Light.SetColormap(thread, tz, lightlevel, foggy, map, particle->bright != 0, false, false, false, true);
|
||||
|
||||
thread->SpriteList->Push(vis);
|
||||
}
|
||||
|
|
|
@ -137,7 +137,7 @@ namespace swrenderer
|
|||
bool foggy = (level.fadeto || basecolormap->Fade || (level.flags & LEVEL_HASFADETABLE));
|
||||
|
||||
// get light level
|
||||
int spriteshade = LightVisibility::LightLevelToShade((floorlight + ceilinglight) >> 1, foggy, Thread->Viewport.get()) - 24 * FRACUNIT;
|
||||
int lightlevel = (floorlight + ceilinglight) >> 1;
|
||||
|
||||
if (Thread->Viewport->viewpoint.camera->player != NULL)
|
||||
{
|
||||
|
@ -182,7 +182,7 @@ namespace swrenderer
|
|||
|
||||
if ((psp->GetID() != PSP_TARGETCENTER || CrosshairImage == nullptr) && psp->GetCaller() != nullptr)
|
||||
{
|
||||
RenderSprite(psp, viewport->viewpoint.camera, bobx, boby, wx, wy, viewport->viewpoint.TicFrac, spriteshade, basecolormap, foggy);
|
||||
RenderSprite(psp, viewport->viewpoint.camera, bobx, boby, wx, wy, viewport->viewpoint.TicFrac, lightlevel, basecolormap, foggy);
|
||||
}
|
||||
|
||||
psp = psp->GetNext();
|
||||
|
@ -192,7 +192,7 @@ namespace swrenderer
|
|||
}
|
||||
}
|
||||
|
||||
void RenderPlayerSprites::RenderSprite(DPSprite *pspr, AActor *owner, float bobx, float boby, double wx, double wy, double ticfrac, int spriteshade, FDynamicColormap *basecolormap, bool foggy)
|
||||
void RenderPlayerSprites::RenderSprite(DPSprite *pspr, AActor *owner, float bobx, float boby, double wx, double wy, double ticfrac, int lightlevel, FDynamicColormap *basecolormap, bool foggy)
|
||||
{
|
||||
double tx;
|
||||
int x1;
|
||||
|
@ -350,7 +350,7 @@ namespace swrenderer
|
|||
bool fullbright = !foggy && (psprState == nullptr ? false : psprState->GetFullbright());
|
||||
bool fadeToBlack = (vis.RenderStyle.Flags & STYLEF_FadeToBlack) != 0;
|
||||
|
||||
vis.Light.SetColormap(0, spriteshade, basecolormap, fullbright, invertcolormap, fadeToBlack);
|
||||
vis.Light.SetColormap(Thread, MINZ, lightlevel, foggy, basecolormap, fullbright, invertcolormap, fadeToBlack, true, false);
|
||||
|
||||
colormap_to_use = (FDynamicColormap*)vis.Light.BaseColormap;
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ namespace swrenderer
|
|||
RenderThread *Thread = nullptr;
|
||||
|
||||
private:
|
||||
void RenderSprite(DPSprite *pspr, AActor *owner, float bobx, float boby, double wx, double wy, double ticfrac, int spriteshade, FDynamicColormap *basecolormap, bool foggy);
|
||||
void RenderSprite(DPSprite *pspr, AActor *owner, float bobx, float boby, double wx, double wy, double ticfrac, int lightlevel, FDynamicColormap *basecolormap, bool foggy);
|
||||
|
||||
enum { BASEXCENTER = 160 };
|
||||
enum { BASEYCENTER = 100 };
|
||||
|
|
|
@ -72,7 +72,7 @@ EXTERN_CVAR(Bool, gl_light_sprites)
|
|||
|
||||
namespace swrenderer
|
||||
{
|
||||
void RenderSprite::Project(RenderThread *thread, AActor *thing, const DVector3 &pos, FTexture *ttex, const DVector2 &spriteScale, int renderflags, WaterFakeSide fakeside, F3DFloor *fakefloor, F3DFloor *fakeceiling, sector_t *current_sector, int spriteshade, bool foggy, FDynamicColormap *basecolormap)
|
||||
void RenderSprite::Project(RenderThread *thread, AActor *thing, const DVector3 &pos, FTexture *ttex, const DVector2 &spriteScale, int renderflags, WaterFakeSide fakeside, F3DFloor *fakefloor, F3DFloor *fakeceiling, sector_t *current_sector, int lightlevel, bool foggy, FDynamicColormap *basecolormap)
|
||||
{
|
||||
FSoftwareTexture *tex = ttex->GetSoftwareTexture();
|
||||
// transform the origin point
|
||||
|
@ -300,7 +300,7 @@ namespace swrenderer
|
|||
vis->dynlightcolor = 0;
|
||||
}
|
||||
|
||||
vis->Light.SetColormap(thread->Light->SpriteVis(tz, foggy), spriteshade, basecolormap, fullbright, invertcolormap, fadeToBlack);
|
||||
vis->Light.SetColormap(thread, tz, lightlevel, foggy, basecolormap, fullbright, invertcolormap, fadeToBlack, false, false);
|
||||
|
||||
thread->SpriteList->Push(vis);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace swrenderer
|
|||
class RenderSprite : public VisibleSprite
|
||||
{
|
||||
public:
|
||||
static void Project(RenderThread *thread, 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);
|
||||
static void Project(RenderThread *thread, AActor *thing, const DVector3 &pos, FTexture *tex, const DVector2 &spriteScale, int renderflags, WaterFakeSide fakeside, F3DFloor *fakefloor, F3DFloor *fakeceiling, sector_t *current_sector, int lightlevel, bool foggy, FDynamicColormap *basecolormap);
|
||||
|
||||
protected:
|
||||
void Render(RenderThread *thread, short *cliptop, short *clipbottom, int minZ, int maxZ, Fake3DTranslucent clip3DFloor) override;
|
||||
|
|
|
@ -163,9 +163,7 @@ namespace swrenderer
|
|||
bool isFullBright = !foggy && (renderflags & RF_FULLBRIGHT);
|
||||
bool fadeToBlack = spr->RenderStyle == LegacyRenderStyles[STYLE_Add] && mybasecolormap->Fade != 0;
|
||||
|
||||
int spriteshade = LightVisibility::LightLevelToShade(sec->lightlevel, foggy, thread->Viewport.get());
|
||||
|
||||
Light.SetColormap(thread->Light->SpriteVis(spr->depth, foggy), spriteshade, mybasecolormap, isFullBright, invertcolormap, fadeToBlack);
|
||||
Light.SetColormap(thread, spr->depth, sec->lightlevel, foggy, mybasecolormap, isFullBright, invertcolormap, fadeToBlack, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor)
|
|||
|
||||
namespace swrenderer
|
||||
{
|
||||
void RenderVoxel::Project(RenderThread *thread, 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)
|
||||
void RenderVoxel::Project(RenderThread *thread, AActor *thing, DVector3 pos, FVoxelDef *voxel, const DVector2 &spriteScale, int renderflags, WaterFakeSide fakeside, F3DFloor *fakefloor, F3DFloor *fakeceiling, sector_t *current_sector, int lightlevel, bool foggy, FDynamicColormap *basecolormap)
|
||||
{
|
||||
// transform the origin point
|
||||
double tr_x = pos.X - thread->Viewport->viewpoint.Pos.X;
|
||||
|
@ -188,7 +188,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(thread->Light->SpriteVis(tz, foggy), spriteshade, basecolormap, fullbright, invertcolormap, fadeToBlack);
|
||||
vis->Light.SetColormap(thread, tz, lightlevel, foggy, basecolormap, fullbright, invertcolormap, fadeToBlack, false, false);
|
||||
|
||||
// Fake a voxel drawing to find its extents..
|
||||
SpriteDrawerArgs drawerargs;
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace swrenderer
|
|||
class RenderVoxel : public VisibleSprite
|
||||
{
|
||||
public:
|
||||
static void Project(RenderThread *thread, 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);
|
||||
static void Project(RenderThread *thread, AActor *thing, DVector3 pos, FVoxelDef *voxel, const DVector2 &spriteScale, int renderflags, WaterFakeSide fakeside, F3DFloor *fakefloor, F3DFloor *fakeceiling, sector_t *current_sector, int lightlevel, bool foggy, FDynamicColormap *basecolormap);
|
||||
|
||||
static void Deinit();
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor);
|
|||
|
||||
namespace swrenderer
|
||||
{
|
||||
void RenderWallSprite::Project(RenderThread *thread, AActor *thing, const DVector3 &pos, FTexture *ppic, const DVector2 &scale, int renderflags, int spriteshade, bool foggy, FDynamicColormap *basecolormap)
|
||||
void RenderWallSprite::Project(RenderThread *thread, AActor *thing, const DVector3 &pos, FTexture *ppic, const DVector2 &scale, int renderflags, int lightlevel, bool foggy, FDynamicColormap *basecolormap)
|
||||
{
|
||||
FSoftwareTexture *pic = ppic->GetSoftwareTexture();
|
||||
FWallCoords wallc;
|
||||
|
@ -141,7 +141,7 @@ namespace swrenderer
|
|||
vis->wallc = wallc;
|
||||
vis->foggy = foggy;
|
||||
|
||||
vis->Light.SetColormap(thread->Light->SpriteVis(tz, foggy), spriteshade, basecolormap, false, false, false);
|
||||
vis->Light.SetColormap(thread, tz, lightlevel, foggy, basecolormap, false, false, false, false, false);
|
||||
|
||||
thread->SpriteList->Push(vis);
|
||||
}
|
||||
|
@ -190,7 +190,6 @@ namespace swrenderer
|
|||
|
||||
SpriteDrawerArgs drawerargs;
|
||||
|
||||
int shade = LightVisibility::LightLevelToShade(spr->sector->lightlevel, spr->foggy, thread->Viewport.get());
|
||||
float lightleft = float(thread->Light->WallVis(spr->wallc.sz1, foggy));
|
||||
float lightstep = float((thread->Light->WallVis(spr->wallc.sz2, foggy) - lightleft) / (spr->wallc.sx2 - spr->wallc.sx1));
|
||||
float light = lightleft + (x1 - spr->wallc.sx1) * lightstep;
|
||||
|
@ -244,7 +243,7 @@ namespace swrenderer
|
|||
{
|
||||
if (calclighting)
|
||||
{ // calculate lighting
|
||||
drawerargs.SetLight(usecolormap, light, shade);
|
||||
drawerargs.SetLight(usecolormap, light, spr->sector->lightlevel, spr->foggy, thread->Viewport.get());
|
||||
}
|
||||
if (!translucentPass->ClipSpriteColumnWithPortals(x, spr))
|
||||
DrawColumn(thread, drawerargs, x, WallSpriteTile, walltexcoords, texturemid, maskedScaleY, sprflipvert, mfloorclip, mceilingclip, spr->RenderStyle);
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace swrenderer
|
|||
class RenderWallSprite : public VisibleSprite
|
||||
{
|
||||
public:
|
||||
static void Project(RenderThread *thread, AActor *thing, const DVector3 &pos, FTexture *pic, const DVector2 &scale, int renderflags, int spriteshade, bool foggy, FDynamicColormap *basecolormap);
|
||||
static void Project(RenderThread *thread, AActor *thing, const DVector3 &pos, FTexture *pic, const DVector2 &scale, int renderflags, int lightlevel, bool foggy, FDynamicColormap *basecolormap);
|
||||
|
||||
protected:
|
||||
bool IsWallSprite() const override { return true; }
|
||||
|
|
|
@ -117,12 +117,12 @@ namespace swrenderer
|
|||
(thread->Drawers(ds_viewport)->*spanfunc)(*this);
|
||||
}
|
||||
|
||||
void SpanDrawerArgs::DrawTiltedSpan(RenderThread *thread, int y, int x1, int x2, const FVector3 &plane_sz, const FVector3 &plane_su, const FVector3 &plane_sv, bool plane_shade, int planeshade, float planelightfloat, fixed_t pviewx, fixed_t pviewy, FDynamicColormap *basecolormap)
|
||||
void SpanDrawerArgs::DrawTiltedSpan(RenderThread *thread, int y, int x1, int x2, const FVector3 &plane_sz, const FVector3 &plane_su, const FVector3 &plane_sv, bool plane_shade, int lightlevel, bool foggy, float planelightfloat, fixed_t pviewx, fixed_t pviewy, FDynamicColormap *basecolormap)
|
||||
{
|
||||
SetDestY(thread->Viewport.get(), y);
|
||||
SetDestX1(x1);
|
||||
SetDestX2(x2);
|
||||
thread->Drawers(ds_viewport)->DrawTiltedSpan(*this, plane_sz, plane_su, plane_sv, plane_shade, planeshade, planelightfloat, pviewx, pviewy, basecolormap);
|
||||
thread->Drawers(ds_viewport)->DrawTiltedSpan(*this, plane_sz, plane_su, plane_sv, plane_shade, LightVisibility::LightLevelToShade(lightlevel, foggy, thread->Viewport.get()), planelightfloat, pviewx, pviewy, basecolormap);
|
||||
}
|
||||
|
||||
void SpanDrawerArgs::DrawFogBoundaryLine(RenderThread *thread, int y, int x1, int x2)
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace swrenderer
|
|||
|
||||
void DrawDepthSpan(RenderThread *thread, float idepth1, float idepth2);
|
||||
void DrawSpan(RenderThread *thread);
|
||||
void DrawTiltedSpan(RenderThread *thread, int y, int x1, int x2, const FVector3 &plane_sz, const FVector3 &plane_su, const FVector3 &plane_sv, bool plane_shade, int planeshade, float planelightfloat, fixed_t pviewx, fixed_t pviewy, FDynamicColormap *basecolormap);
|
||||
void DrawTiltedSpan(RenderThread *thread, int y, int x1, int x2, const FVector3 &plane_sz, const FVector3 &plane_su, const FVector3 &plane_sv, bool plane_shade, int lightlevel, bool foggy, float planelightfloat, fixed_t pviewx, fixed_t pviewy, FDynamicColormap *basecolormap);
|
||||
void DrawColoredSpan(RenderThread *thread, int y, int x1, int x2);
|
||||
void DrawFogBoundaryLine(RenderThread *thread, int y, int x1, int x2);
|
||||
|
||||
|
|
Loading…
Reference in a new issue