mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 07:12:02 +00:00
Make LightVisibility thread local
This commit is contained in:
parent
438b983ab1
commit
00f6ed45a2
28 changed files with 45 additions and 48 deletions
|
@ -66,7 +66,7 @@ void PolyRenderer::RenderView(player_t *player)
|
|||
int stHeight = gST_Y;
|
||||
float trueratio;
|
||||
ActiveRatio(width, height, &trueratio);
|
||||
viewport->SetViewport(width, height, trueratio);
|
||||
viewport->SetViewport(&Thread, width, height, trueratio);
|
||||
|
||||
RenderActorView(player->mo, false);
|
||||
|
||||
|
@ -89,7 +89,7 @@ void PolyRenderer::RenderViewToCanvas(AActor *actor, DCanvas *canvas, int x, int
|
|||
viewwidth = width;
|
||||
viewport->RenderTarget = canvas;
|
||||
R_SetWindow(viewport->viewpoint, viewport->viewwindow, 12, width, height, height, true);
|
||||
viewport->SetViewport(width, height, viewport->viewwindow.WidescreenRatio);
|
||||
viewport->SetViewport(&Thread, width, height, viewport->viewwindow.WidescreenRatio);
|
||||
viewwindowx = x;
|
||||
viewwindowy = y;
|
||||
viewactive = true;
|
||||
|
@ -105,7 +105,7 @@ void PolyRenderer::RenderViewToCanvas(AActor *actor, DCanvas *canvas, int x, int
|
|||
R_ExecuteSetViewSize(viewport->viewpoint, viewport->viewwindow);
|
||||
float trueratio;
|
||||
ActiveRatio(width, height, &trueratio);
|
||||
viewport->SetViewport(width, height, viewport->viewwindow.WidescreenRatio);
|
||||
viewport->SetViewport(&Thread, width, height, viewport->viewwindow.WidescreenRatio);
|
||||
viewactive = savedviewactive;
|
||||
}
|
||||
|
||||
|
|
|
@ -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(foggy);
|
||||
args.uniforms.globvis = (float)PolyRenderer::Instance()->Thread.Light->WallGlobVis(foggy);
|
||||
if (fullbrightSprite || cameraLight->FixedLightLevel() >= 0 || cameraLight->FixedColormap())
|
||||
{
|
||||
args.uniforms.light = 256;
|
||||
|
|
|
@ -76,7 +76,7 @@ void RenderPolyParticle::Render(const TriMatrix &worldToClip, const Vec4f &clipP
|
|||
|
||||
PolyDrawArgs args;
|
||||
|
||||
args.uniforms.globvis = (float)swrenderer::LightVisibility::Instance()->ParticleGlobVis(foggy);
|
||||
args.uniforms.globvis = (float)PolyRenderer::Instance()->Thread.Light->ParticleGlobVis(foggy);
|
||||
|
||||
if (fullbrightSprite || cameraLight->FixedLightLevel() >= 0 || cameraLight->FixedColormap())
|
||||
{
|
||||
|
|
|
@ -112,7 +112,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(foggy) * 48.0f;
|
||||
args.uniforms.globvis = (float)PolyRenderer::Instance()->Thread.Light->SlopePlaneGlobVis(foggy) * 48.0f;
|
||||
args.uniforms.light = (uint32_t)(lightlevel / 255.0f * 256.0f);
|
||||
if (cameraLight->FixedLightLevel() >= 0 || cameraLight->FixedColormap())
|
||||
args.uniforms.light = 256;
|
||||
|
@ -310,7 +310,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(foggy) * 48.0f;
|
||||
args.uniforms.globvis = (float)PolyRenderer::Instance()->Thread.Light->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;
|
||||
|
|
|
@ -228,7 +228,7 @@ void RenderPolyPlayerSprites::RenderSprite(DPSprite *sprite, AActor *owner, floa
|
|||
int actualextralight = foggy ? 0 : viewpoint.extralight << 4;
|
||||
int spriteshade = swrenderer::LightVisibility::LightLevelToShade(owner->Sector->lightlevel + actualextralight, foggy);
|
||||
double minz = double((2048 * 4) / double(1 << 20));
|
||||
ColormapNum = GETPALOOKUP(swrenderer::LightVisibility::Instance()->SpriteGlobVis(foggy) / minz, spriteshade);
|
||||
ColormapNum = GETPALOOKUP(PolyRenderer::Instance()->Thread.Light->SpriteGlobVis(foggy) / minz, spriteshade);
|
||||
|
||||
if (sprite->GetID() < PSP_TARGETCENTER)
|
||||
{
|
||||
|
|
|
@ -93,7 +93,7 @@ void PolyDrawSectorPortal::SaveGlobals()
|
|||
savedextralight = viewpoint.extralight;
|
||||
savedpos = viewpoint.Pos;
|
||||
savedangles = viewpoint.Angles;
|
||||
savedvisibility = swrenderer::LightVisibility::Instance()->GetVisibility();
|
||||
savedvisibility = PolyRenderer::Instance()->Thread.Light->GetVisibility();
|
||||
savedcamera = viewpoint.camera;
|
||||
savedsector = viewpoint.sector;
|
||||
|
||||
|
@ -102,7 +102,7 @@ void PolyDrawSectorPortal::SaveGlobals()
|
|||
// Don't let gun flashes brighten the sky box
|
||||
AActor *sky = Portal->mSkybox;
|
||||
viewpoint.extralight = 0;
|
||||
swrenderer::LightVisibility::Instance()->SetVisibility(PolyRenderer::Instance()->Thread.Viewport.get(), sky->args[0] * 0.25f);
|
||||
PolyRenderer::Instance()->Thread.Light->SetVisibility(PolyRenderer::Instance()->Thread.Viewport.get(), sky->args[0] * 0.25f);
|
||||
viewpoint.Pos = sky->InterpolatedPosition(viewpoint.TicFrac);
|
||||
viewpoint.Angles.Yaw = savedangles.Yaw + (sky->PrevAngles.Yaw + deltaangle(sky->PrevAngles.Yaw, sky->Angles.Yaw) * viewpoint.TicFrac);
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ void PolyDrawSectorPortal::RestoreGlobals()
|
|||
viewpoint.camera = savedcamera;
|
||||
viewpoint.sector = savedsector;
|
||||
viewpoint.Pos = savedpos;
|
||||
swrenderer::LightVisibility::Instance()->SetVisibility(PolyRenderer::Instance()->Thread.Viewport.get(), savedvisibility);
|
||||
PolyRenderer::Instance()->Thread.Light->SetVisibility(PolyRenderer::Instance()->Thread.Viewport.get(), savedvisibility);
|
||||
viewpoint.extralight = savedextralight;
|
||||
viewpoint.Angles = savedangles;
|
||||
R_SetViewAngle(viewpoint, viewwindow);
|
||||
|
|
|
@ -244,7 +244,7 @@ void RenderPolyScene::RenderPortals(int portalDepth)
|
|||
PolyDrawArgs args;
|
||||
args.objectToClip = &WorldToClip;
|
||||
args.mode = TriangleDrawMode::Fan;
|
||||
args.uniforms.globvis = (float)swrenderer::LightVisibility::Instance()->WallGlobVis(foggy);
|
||||
args.uniforms.globvis = (float)PolyRenderer::Instance()->Thread.Light->WallGlobVis(foggy);
|
||||
args.uniforms.color = 0;
|
||||
args.uniforms.light = 256;
|
||||
args.uniforms.flags = TriUniforms::fixed_light;
|
||||
|
|
|
@ -57,7 +57,7 @@ void PolySkyDome::Render(const TriMatrix &worldToClip)
|
|||
int rc = mRows + 1;
|
||||
|
||||
PolyDrawArgs args;
|
||||
args.uniforms.globvis = (float)swrenderer::LightVisibility::Instance()->WallGlobVis(foggy);
|
||||
args.uniforms.globvis = (float)PolyRenderer::Instance()->Thread.Light->WallGlobVis(foggy);
|
||||
args.uniforms.light = 256;
|
||||
args.uniforms.flags = 0;
|
||||
args.uniforms.subsectorDepth = RenderPolyScene::SkySubsectorDepth;
|
||||
|
|
|
@ -141,7 +141,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(foggy);
|
||||
args.uniforms.globvis = (float)PolyRenderer::Instance()->Thread.Light->SpriteGlobVis(foggy);
|
||||
args.uniforms.flags = 0;
|
||||
if (fullbrightSprite || cameraLight->FixedLightLevel() >= 0 || cameraLight->FixedColormap())
|
||||
{
|
||||
|
|
|
@ -249,7 +249,7 @@ void RenderPolyWall::Render(const TriMatrix &worldToClip, const Vec4f &clipPlane
|
|||
}
|
||||
|
||||
PolyDrawArgs args;
|
||||
args.uniforms.globvis = (float)swrenderer::LightVisibility::Instance()->WallGlobVis(foggy);
|
||||
args.uniforms.globvis = (float)PolyRenderer::Instance()->Thread.Light->WallGlobVis(foggy);
|
||||
args.uniforms.light = (uint32_t)(GetLightLevel() / 255.0f * 256.0f);
|
||||
args.uniforms.flags = 0;
|
||||
args.uniforms.subsectorDepth = SubsectorDepth;
|
||||
|
|
|
@ -102,7 +102,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(foggy);
|
||||
args.uniforms.globvis = (float)PolyRenderer::Instance()->Thread.Light->WallGlobVis(foggy);
|
||||
if (fullbrightSprite || cameraLight->FixedLightLevel() >= 0 || cameraLight->FixedColormap())
|
||||
{
|
||||
args.uniforms.light = 256;
|
||||
|
|
|
@ -782,7 +782,7 @@ namespace swrenderer
|
|||
if (cameraLight->FixedColormap() == nullptr && cameraLight->FixedLightLevel() < 0)
|
||||
{
|
||||
wallshade = LightVisibility::LightLevelToShade(mLineSegment->sidedef->GetLightLevel(foggy, mFrontSector->lightlevel) + LightVisibility::ActualExtraLight(foggy, Thread->Viewport.get()), foggy);
|
||||
double GlobVis = LightVisibility::Instance()->WallGlobVis(foggy);
|
||||
double GlobVis = Thread->Light->WallGlobVis(foggy);
|
||||
rw_lightleft = float(GlobVis / WallC.sz1);
|
||||
rw_lightstep = float((GlobVis / WallC.sz2 - rw_lightleft) / (WallC.sx2 - WallC.sx1));
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ namespace swrenderer
|
|||
// [RH] set foggy flag
|
||||
bool foggy = (level.fadeto || basecolormap->Fade || (level.flags & LEVEL_HASFADETABLE));
|
||||
|
||||
GlobVis = LightVisibility::Instance()->FlatPlaneGlobVis(foggy) / planeheight;
|
||||
GlobVis = Thread->Light->FlatPlaneGlobVis(foggy) / planeheight;
|
||||
|
||||
CameraLight *cameraLight = CameraLight::Instance();
|
||||
if (cameraLight->FixedLightLevel() >= 0)
|
||||
|
|
|
@ -157,7 +157,7 @@ namespace swrenderer
|
|||
basecolormap = colormap;
|
||||
bool foggy = level.fadeto || basecolormap->Fade || (level.flags & LEVEL_HASFADETABLE);;
|
||||
|
||||
planelightfloat = (LightVisibility::Instance()->SlopePlaneGlobVis(foggy) * lxscale * lyscale) / (fabs(pl->height.ZatPoint(Thread->Viewport->viewpoint.Pos) - Thread->Viewport->viewpoint.Pos.Z)) / 65536.f;
|
||||
planelightfloat = (Thread->Light->SlopePlaneGlobVis(foggy) * lxscale * lyscale) / (fabs(pl->height.ZatPoint(Thread->Viewport->viewpoint.Pos) - Thread->Viewport->viewpoint.Pos.Z)) / 65536.f;
|
||||
|
||||
if (pl->height.fC() > 0)
|
||||
planelightfloat = -planelightfloat;
|
||||
|
|
|
@ -62,6 +62,7 @@ namespace swrenderer
|
|||
MainThread = mainThread;
|
||||
FrameMemory = std::make_unique<RenderMemory>();
|
||||
Viewport = std::make_unique<RenderViewport>();
|
||||
Light = std::make_unique<LightVisibility>();
|
||||
DrawQueue = std::make_shared<DrawerCommandQueue>(this);
|
||||
OpaquePass = std::make_unique<RenderOpaquePass>(this);
|
||||
TranslucentPass = std::make_unique<RenderTranslucentPass>(this);
|
||||
|
|
|
@ -43,6 +43,7 @@ namespace swrenderer
|
|||
class RenderClipSegment;
|
||||
class RenderMemory;
|
||||
class RenderViewport;
|
||||
class LightVisibility;
|
||||
class SWPixelFormatDrawers;
|
||||
class SWTruecolorDrawers;
|
||||
class SWPalDrawers;
|
||||
|
@ -69,6 +70,7 @@ namespace swrenderer
|
|||
std::unique_ptr<DrawSegmentList> DrawSegments;
|
||||
std::unique_ptr<RenderClipSegment> ClipSegments;
|
||||
std::unique_ptr<RenderViewport> Viewport;
|
||||
std::unique_ptr<LightVisibility> Light;
|
||||
DrawerCommandQueuePtr DrawQueue;
|
||||
|
||||
std::thread thread;
|
||||
|
|
|
@ -370,10 +370,10 @@ void FSoftwareRenderer::CleanLevelData()
|
|||
|
||||
double FSoftwareRenderer::GetVisibility()
|
||||
{
|
||||
return LightVisibility::Instance()->GetVisibility();
|
||||
return mScene.MainThread()->Light->GetVisibility();
|
||||
}
|
||||
|
||||
void FSoftwareRenderer::SetVisibility(double vis)
|
||||
{
|
||||
LightVisibility::Instance()->SetVisibility(mScene.MainThread()->Viewport.get(), vis);
|
||||
mScene.MainThread()->Light->SetVisibility(mScene.MainThread()->Viewport.get(), vis);
|
||||
}
|
||||
|
|
|
@ -93,12 +93,6 @@ namespace swrenderer
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
LightVisibility *LightVisibility::Instance()
|
||||
{
|
||||
static LightVisibility instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
// Changes how rapidly things get dark with distance
|
||||
void LightVisibility::SetVisibility(RenderViewport *viewport, double vis)
|
||||
{
|
||||
|
|
|
@ -69,8 +69,6 @@ namespace swrenderer
|
|||
class LightVisibility
|
||||
{
|
||||
public:
|
||||
static LightVisibility *Instance();
|
||||
|
||||
void SetVisibility(RenderViewport *viewport, double visibility);
|
||||
double GetVisibility() const { return CurrentVisibility; }
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ namespace swrenderer
|
|||
int savedextralight = Thread->Viewport->viewpoint.extralight;
|
||||
DVector3 savedpos = Thread->Viewport->viewpoint.Pos;
|
||||
DRotator savedangles = Thread->Viewport->viewpoint.Angles;
|
||||
double savedvisibility = LightVisibility::Instance()->GetVisibility();
|
||||
double savedvisibility = Thread->Light->GetVisibility();
|
||||
AActor *savedcamera = Thread->Viewport->viewpoint.camera;
|
||||
sector_t *savedsector = Thread->Viewport->viewpoint.sector;
|
||||
|
||||
|
@ -126,7 +126,7 @@ namespace swrenderer
|
|||
// Don't let gun flashes brighten the sky box
|
||||
AActor *sky = port->mSkybox;
|
||||
Thread->Viewport->viewpoint.extralight = 0;
|
||||
LightVisibility::Instance()->SetVisibility(Thread->Viewport.get(), sky->args[0] * 0.25f);
|
||||
Thread->Light->SetVisibility(Thread->Viewport.get(), sky->args[0] * 0.25f);
|
||||
|
||||
Thread->Viewport->viewpoint.Pos = sky->InterpolatedPosition(Thread->Viewport->viewpoint.TicFrac);
|
||||
Thread->Viewport->viewpoint.Angles.Yaw = savedangles.Yaw + (sky->PrevAngles.Yaw + deltaangle(sky->PrevAngles.Yaw, sky->Angles.Yaw) * Thread->Viewport->viewpoint.TicFrac);
|
||||
|
@ -139,7 +139,7 @@ namespace swrenderer
|
|||
case PORTS_PORTAL:
|
||||
case PORTS_LINKEDPORTAL:
|
||||
Thread->Viewport->viewpoint.extralight = pl->extralight;
|
||||
LightVisibility::Instance()->SetVisibility(Thread->Viewport.get(), pl->visibility);
|
||||
Thread->Light->SetVisibility(Thread->Viewport.get(), pl->visibility);
|
||||
Thread->Viewport->viewpoint.Pos.X = pl->viewpos.X + port->mDisplacement.X;
|
||||
Thread->Viewport->viewpoint.Pos.Y = pl->viewpos.Y + port->mDisplacement.Y;
|
||||
Thread->Viewport->viewpoint.Pos.Z = pl->viewpos.Z;
|
||||
|
@ -245,7 +245,7 @@ namespace swrenderer
|
|||
Thread->Viewport->viewpoint.camera = savedcamera;
|
||||
Thread->Viewport->viewpoint.sector = savedsector;
|
||||
Thread->Viewport->viewpoint.Pos = savedpos;
|
||||
LightVisibility::Instance()->SetVisibility(Thread->Viewport.get(), savedvisibility);
|
||||
Thread->Light->SetVisibility(Thread->Viewport.get(), savedvisibility);
|
||||
Thread->Viewport->viewpoint.extralight = savedextralight;
|
||||
Thread->Viewport->viewpoint.Angles = savedangles;
|
||||
R_SetViewAngle(Thread->Viewport->viewpoint, Thread->Viewport->viewwindow);
|
||||
|
@ -517,7 +517,7 @@ namespace swrenderer
|
|||
stacked_viewpos = Thread->Viewport->viewpoint.Pos;
|
||||
stacked_angle = Thread->Viewport->viewpoint.Angles;
|
||||
stacked_extralight = Thread->Viewport->viewpoint.extralight;
|
||||
stacked_visibility = LightVisibility::Instance()->GetVisibility();
|
||||
stacked_visibility = Thread->Light->GetVisibility();
|
||||
}
|
||||
|
||||
void RenderPortal::SetMainPortal()
|
||||
|
|
|
@ -83,7 +83,7 @@ namespace swrenderer
|
|||
int height = SCREENHEIGHT;
|
||||
float trueratio;
|
||||
ActiveRatio(width, height, &trueratio);
|
||||
viewport->SetViewport(width, height, trueratio);
|
||||
viewport->SetViewport(MainThread(), width, height, trueratio);
|
||||
|
||||
if (r_clearbuffer != 0)
|
||||
{
|
||||
|
@ -185,6 +185,7 @@ namespace swrenderer
|
|||
for (int i = 0; i < numThreads; i++)
|
||||
{
|
||||
*Threads[i]->Viewport = *MainThread()->Viewport;
|
||||
*Threads[i]->Light = *MainThread()->Light;
|
||||
Threads[i]->X1 = viewwidth * i / numThreads;
|
||||
Threads[i]->X2 = viewwidth * (i + 1) / numThreads;
|
||||
}
|
||||
|
@ -333,7 +334,7 @@ namespace swrenderer
|
|||
viewwindowx = x;
|
||||
viewwindowy = y;
|
||||
viewactive = true;
|
||||
viewport->SetViewport(width, height, MainThread()->Viewport->viewwindow.WidescreenRatio);
|
||||
viewport->SetViewport(MainThread(), width, height, MainThread()->Viewport->viewwindow.WidescreenRatio);
|
||||
|
||||
RenderActorView(actor, dontmaplines);
|
||||
|
||||
|
@ -343,7 +344,7 @@ namespace swrenderer
|
|||
float trueratio;
|
||||
ActiveRatio(width, height, &trueratio);
|
||||
screen->Lock(true);
|
||||
viewport->SetViewport(width, height, trueratio);
|
||||
viewport->SetViewport(MainThread(), width, height, trueratio);
|
||||
screen->Unlock();
|
||||
|
||||
viewactive = savedviewactive;
|
||||
|
@ -358,7 +359,7 @@ namespace swrenderer
|
|||
float trueratio;
|
||||
ActiveRatio(width, height, &trueratio);
|
||||
screen->Lock(true);
|
||||
viewport->SetViewport(SCREENWIDTH, SCREENHEIGHT, trueratio);
|
||||
viewport->SetViewport(MainThread(), SCREENWIDTH, SCREENHEIGHT, trueratio);
|
||||
screen->Unlock();
|
||||
}
|
||||
|
||||
|
|
|
@ -204,7 +204,7 @@ namespace swrenderer
|
|||
vis->floorclip = 0;
|
||||
vis->foggy = foggy;
|
||||
|
||||
vis->Light.SetColormap(tiz * LightVisibility::Instance()->ParticleGlobVis(foggy), shade, map, particle->bright != 0, false, false);
|
||||
vis->Light.SetColormap(tiz * thread->Light->ParticleGlobVis(foggy), shade, map, particle->bright != 0, false, false);
|
||||
|
||||
thread->SpriteList->Push(vis);
|
||||
}
|
||||
|
|
|
@ -280,7 +280,7 @@ namespace swrenderer
|
|||
vis->dynlightcolor = 0;
|
||||
}
|
||||
|
||||
vis->Light.SetColormap(LightVisibility::Instance()->SpriteGlobVis(foggy) / MAX(tz, MINZ), spriteshade, basecolormap, fullbright, invertcolormap, fadeToBlack);
|
||||
vis->Light.SetColormap(thread->Light->SpriteGlobVis(foggy) / MAX(tz, MINZ), spriteshade, basecolormap, fullbright, invertcolormap, fadeToBlack);
|
||||
|
||||
thread->SpriteList->Push(vis);
|
||||
}
|
||||
|
|
|
@ -140,7 +140,7 @@ namespace swrenderer
|
|||
|
||||
int spriteshade = LightVisibility::LightLevelToShade(sec->lightlevel + LightVisibility::ActualExtraLight(spr->foggy, thread->Viewport.get()), foggy);
|
||||
|
||||
Light.SetColormap(LightVisibility::Instance()->SpriteGlobVis(foggy) / MAX(MINZ, (double)spr->depth), spriteshade, mybasecolormap, isFullBright, invertcolormap, fadeToBlack);
|
||||
Light.SetColormap(thread->Light->SpriteGlobVis(foggy) / MAX(MINZ, (double)spr->depth), spriteshade, mybasecolormap, isFullBright, invertcolormap, fadeToBlack);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -170,7 +170,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(foggy) / MAX(tz, MINZ), spriteshade, basecolormap, fullbright, invertcolormap, fadeToBlack);
|
||||
vis->Light.SetColormap(thread->Light->SpriteGlobVis(foggy) / MAX(tz, MINZ), spriteshade, basecolormap, fullbright, invertcolormap, fadeToBlack);
|
||||
|
||||
thread->SpriteList->Push(vis, true);
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ namespace swrenderer
|
|||
vis->wallc = wallc;
|
||||
vis->foggy = foggy;
|
||||
|
||||
vis->Light.SetColormap(LightVisibility::Instance()->SpriteGlobVis(foggy) / MAX(tz, MINZ), spriteshade, basecolormap, false, false, false);
|
||||
vis->Light.SetColormap(thread->Light->SpriteGlobVis(foggy) / MAX(tz, MINZ), spriteshade, basecolormap, false, false, false);
|
||||
|
||||
thread->SpriteList->Push(vis);
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ namespace swrenderer
|
|||
SpriteDrawerArgs drawerargs;
|
||||
|
||||
int shade = LightVisibility::LightLevelToShade(spr->sector->lightlevel + LightVisibility::ActualExtraLight(spr->foggy, thread->Viewport.get()), spr->foggy);
|
||||
double GlobVis = LightVisibility::Instance()->WallGlobVis(foggy);
|
||||
double GlobVis = thread->Light->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;
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace swrenderer
|
|||
{
|
||||
}
|
||||
|
||||
void RenderViewport::SetViewport(int fullWidth, int fullHeight, float trueratio)
|
||||
void RenderViewport::SetViewport(RenderThread *thread, int fullWidth, int fullHeight, float trueratio)
|
||||
{
|
||||
int virtheight, virtwidth, virtwidth2, virtheight2;
|
||||
|
||||
|
@ -101,8 +101,7 @@ namespace swrenderer
|
|||
InitTextureMapping();
|
||||
|
||||
// Reset r_*Visibility vars
|
||||
LightVisibility *visibility = LightVisibility::Instance();
|
||||
visibility->SetVisibility(this, visibility->GetVisibility());
|
||||
thread->Light->SetVisibility(this, thread->Light->GetVisibility());
|
||||
|
||||
SetupBuffer();
|
||||
}
|
||||
|
|
|
@ -19,13 +19,15 @@
|
|||
|
||||
namespace swrenderer
|
||||
{
|
||||
class RenderThread;
|
||||
|
||||
class RenderViewport
|
||||
{
|
||||
public:
|
||||
RenderViewport();
|
||||
~RenderViewport();
|
||||
|
||||
void SetViewport(int width, int height, float trueratio);
|
||||
void SetViewport(RenderThread *thread, int width, int height, float trueratio);
|
||||
void SetupFreelook();
|
||||
|
||||
DCanvas *RenderTarget = nullptr;
|
||||
|
|
Loading…
Reference in a new issue