- handle the software renderer's GetColorTable function

The real question here should be: Why does this need to get called in over 40 differenrt locations…?
This commit is contained in:
Christoph Oelckers 2019-01-29 03:15:42 +01:00
commit 7d3cd53c7e
10 changed files with 54 additions and 33 deletions

View file

@ -256,8 +256,8 @@ void PolyModelRenderer::SetTransform()
void PolyModelRenderer::DrawArrays(int start, int count)
{
PolyDrawArgs args;
args.SetLight(GetColorTable(sector->Colormap, sector->SpecialColors[sector_t::sprites], true), lightlevel, visibility, fullbrightSprite);
args.SetLights(Lights, NumLights);
auto nc = !!(sector->Level->flags3 & LEVEL3_NOCOLOREDSPRITELIGHTING);
args.SetLight(GetSpriteColorTable(sector->Colormap, sector->SpecialColors[sector_t::sprites], nc), lightlevel, visibility, fullbrightSprite); args.SetLights(Lights, NumLights);
args.SetStencilTestValue(StencilValue);
args.SetClipPlane(0, PolyClipPlane());
args.SetStyle(RenderStyle, RenderAlpha, fillcolor, Translation, SkinTexture, fullbrightSprite);
@ -270,8 +270,8 @@ void PolyModelRenderer::DrawArrays(int start, int count)
void PolyModelRenderer::DrawElements(int numIndices, size_t offset)
{
PolyDrawArgs args;
args.SetLight(GetColorTable(sector->Colormap, sector->SpecialColors[sector_t::sprites], true), lightlevel, visibility, fullbrightSprite);
args.SetLights(Lights, NumLights);
auto nc = !!(sector->Level->flags3 & LEVEL3_NOCOLOREDSPRITELIGHTING);
args.SetLight(GetSpriteColorTable(sector->Colormap, sector->SpecialColors[sector_t::sprites], nc), lightlevel, visibility, fullbrightSprite); args.SetLights(Lights, NumLights);
args.SetStencilTestValue(StencilValue);
args.SetClipPlane(0, PolyClipPlane());
args.SetStyle(RenderStyle, RenderAlpha, fillcolor, Translation, SkinTexture, fullbrightSprite);

View file

@ -66,6 +66,8 @@ void RenderPolyPlayerSprites::Render(PolyRenderThread *thread)
FDynamicColormap *basecolormap;
PolyCameraLight *cameraLight = PolyCameraLight::Instance();
bool nc = !!(viewpoint.camera->Level->flags3 & LEVEL3_NOCOLOREDSPRITELIGHTING);
if (cameraLight->FixedLightLevel() < 0 && viewpoint.sector->e && viewpoint.sector->e->XFloor.lightlist.Size())
{
for (i = viewpoint.sector->e->XFloor.lightlist.Size() - 1; i >= 0; i--)
@ -79,9 +81,9 @@ void RenderPolyPlayerSprites::Render(PolyRenderThread *thread)
break;
sec = rover->model;
if (rover->flags & FF_FADEWALLS)
basecolormap = GetColorTable(sec->Colormap, sec->SpecialColors[sector_t::sprites], true);
basecolormap = GetSpriteColorTable(sec->Colormap, sec->SpecialColors[sector_t::sprites], nc);
else
basecolormap = GetColorTable(viewpoint.sector->e->XFloor.lightlist[i].extra_colormap, sec->SpecialColors[sector_t::sprites], true);
basecolormap = GetSpriteColorTable(viewpoint.sector->e->XFloor.lightlist[i].extra_colormap, sec->SpecialColors[sector_t::sprites], nc);
}
break;
}
@ -89,7 +91,7 @@ void RenderPolyPlayerSprites::Render(PolyRenderThread *thread)
if (!sec)
{
sec = viewpoint.sector;
basecolormap = GetColorTable(sec->Colormap, sec->SpecialColors[sector_t::sprites], true);
basecolormap = GetSpriteColorTable(sec->Colormap, sec->SpecialColors[sector_t::sprites], nc);
}
floorlight = ceilinglight = sec->lightlevel;
}
@ -102,7 +104,7 @@ void RenderPolyPlayerSprites::Render(PolyRenderThread *thread)
ceilinglight = fakeflat.CeilingLightLevel;
// [RH] set basecolormap
basecolormap = GetColorTable(sec->Colormap, sec->SpecialColors[sector_t::sprites], true);
basecolormap = GetSpriteColorTable(sec->Colormap, sec->SpecialColors[sector_t::sprites], nc);
}
// [RH] set foggy flag

View file

@ -158,8 +158,8 @@ void RenderPolySprite::Render(PolyRenderThread *thread, AActor *thing, subsector
PolyDrawArgs args;
SetDynlight(thing, args);
args.SetLight(GetColorTable(sub->sector->Colormap, sub->sector->SpecialColors[sector_t::sprites], true), lightlevel, PolyRenderer::Instance()->Light.SpriteGlobVis(foggy), fullbrightSprite);
args.SetStencilTestValue(stencilValue);
auto nc = !!(thing->Level->flags3 & LEVEL3_NOCOLOREDSPRITELIGHTING);
args.SetLight(GetSpriteColorTable(sub->sector->Colormap, sub->sector->SpecialColors[sector_t::sprites], nc), lightlevel, PolyRenderer::Instance()->Light.SpriteGlobVis(foggy), fullbrightSprite); args.SetStencilTestValue(stencilValue);
if ((thing->renderflags & RF_ZDOOMTRANS) && r_UseVanillaTransparency)
args.SetStyle(LegacyRenderStyles[STYLE_Normal], 1.0f, thing->fillcolor, thing->Translation, tex, fullbrightSprite);
else

View file

@ -101,8 +101,8 @@ void RenderPolyWallSprite::Render(PolyRenderThread *thread, AActor *thing, subse
int lightlevel = fullbrightSprite ? 255 : thing->Sector->lightlevel + actualextralight;
PolyDrawArgs args;
args.SetLight(GetColorTable(sub->sector->Colormap, sub->sector->SpecialColors[sector_t::sprites], true), lightlevel, PolyRenderer::Instance()->Light.WallGlobVis(foggy), fullbrightSprite);
args.SetStencilTestValue(stencilValue);
auto nc = !!(sub->sector->Level->flags3 & LEVEL3_NOCOLOREDSPRITELIGHTING);
args.SetLight(GetSpriteColorTable(sub->sector->Colormap, sub->sector->SpecialColors[sector_t::sprites], nc), lightlevel, PolyRenderer::Instance()->Light.WallGlobVis(foggy), fullbrightSprite); args.SetStencilTestValue(stencilValue);
args.SetTexture(tex, thing->RenderStyle);
args.SetDepthTest(true);
args.SetWriteDepth(false);