mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-29 15:32:57 +00:00
Create CameraLight class
This commit is contained in:
parent
4bbf1ba11c
commit
ed05a2edd3
27 changed files with 133 additions and 96 deletions
|
@ -1409,7 +1409,7 @@ void OpenGLSWFrameBuffer::Draw3DPart(bool copy3d)
|
||||||
uint32_t color0, color1;
|
uint32_t color0, color1;
|
||||||
if (Accel2D)
|
if (Accel2D)
|
||||||
{
|
{
|
||||||
auto &map = swrenderer::realfixedcolormap;
|
auto &map = swrenderer::CameraLight::Instance()->realfixedcolormap;
|
||||||
if (map == nullptr)
|
if (map == nullptr)
|
||||||
{
|
{
|
||||||
color0 = 0;
|
color0 = 0;
|
||||||
|
|
|
@ -69,10 +69,11 @@ void PolyRenderer::RenderView(player_t *player)
|
||||||
RenderActorView(player->mo, false);
|
RenderActorView(player->mo, false);
|
||||||
|
|
||||||
// Apply special colormap if the target cannot do it
|
// Apply special colormap if the target cannot do it
|
||||||
if (realfixedcolormap && r_swtruecolor && !(r_shadercolormaps && screen->Accel2D))
|
CameraLight *cameraLight = CameraLight::Instance();
|
||||||
|
if (cameraLight->realfixedcolormap && r_swtruecolor && !(r_shadercolormaps && screen->Accel2D))
|
||||||
{
|
{
|
||||||
R_BeginDrawerCommands();
|
R_BeginDrawerCommands();
|
||||||
DrawerCommandQueue::QueueCommand<ApplySpecialColormapRGBACommand>(realfixedcolormap, screen);
|
DrawerCommandQueue::QueueCommand<ApplySpecialColormapRGBACommand>(cameraLight->realfixedcolormap, screen);
|
||||||
R_EndDrawerCommands();
|
R_EndDrawerCommands();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +120,7 @@ void PolyRenderer::RenderActorView(AActor *actor, bool dontmaplines)
|
||||||
P_FindParticleSubsectors();
|
P_FindParticleSubsectors();
|
||||||
PO_LinkToSubsectors();
|
PO_LinkToSubsectors();
|
||||||
R_SetupFrame(actor);
|
R_SetupFrame(actor);
|
||||||
swrenderer::R_SetupColormap(actor);
|
swrenderer::CameraLight::Instance()->SetCamera(actor);
|
||||||
swrenderer::RenderViewport::Instance()->SetupFreelook();
|
swrenderer::RenderViewport::Instance()->SetupFreelook();
|
||||||
|
|
||||||
ActorRenderFlags savedflags = camera->renderflags;
|
ActorRenderFlags savedflags = camera->renderflags;
|
||||||
|
|
|
@ -133,12 +133,14 @@ void RenderPolyDecal::Render(const TriMatrix &worldToClip, const Vec4f &clipPlan
|
||||||
|
|
||||||
bool fullbrightSprite = (decal->RenderFlags & RF_FULLBRIGHT) == RF_FULLBRIGHT;
|
bool fullbrightSprite = (decal->RenderFlags & RF_FULLBRIGHT) == RF_FULLBRIGHT;
|
||||||
|
|
||||||
|
swrenderer::CameraLight *cameraLight = swrenderer::CameraLight::Instance();
|
||||||
|
|
||||||
PolyDrawArgs args;
|
PolyDrawArgs args;
|
||||||
args.uniforms.flags = 0;
|
args.uniforms.flags = 0;
|
||||||
args.SetColormap(front->ColorMap);
|
args.SetColormap(front->ColorMap);
|
||||||
args.SetTexture(tex, decal->Translation, true);
|
args.SetTexture(tex, decal->Translation, true);
|
||||||
args.uniforms.globvis = (float)swrenderer::LightVisibility::Instance()->WallGlobVis();
|
args.uniforms.globvis = (float)swrenderer::LightVisibility::Instance()->WallGlobVis();
|
||||||
if (fullbrightSprite || swrenderer::fixedlightlev >= 0 || swrenderer::fixedcolormap)
|
if (fullbrightSprite || cameraLight->fixedlightlev >= 0 || cameraLight->fixedcolormap)
|
||||||
{
|
{
|
||||||
args.uniforms.light = 256;
|
args.uniforms.light = 256;
|
||||||
args.uniforms.flags |= TriUniforms::fixed_light;
|
args.uniforms.flags |= TriUniforms::fixed_light;
|
||||||
|
|
|
@ -70,12 +70,13 @@ void RenderPolyParticle::Render(const TriMatrix &worldToClip, const Vec4f &clipP
|
||||||
|
|
||||||
// int color = (particle->color >> 24) & 0xff; // pal index, I think
|
// int color = (particle->color >> 24) & 0xff; // pal index, I think
|
||||||
bool fullbrightSprite = particle->bright != 0;
|
bool fullbrightSprite = particle->bright != 0;
|
||||||
|
swrenderer::CameraLight *cameraLight = swrenderer::CameraLight::Instance();
|
||||||
|
|
||||||
PolyDrawArgs args;
|
PolyDrawArgs args;
|
||||||
|
|
||||||
args.uniforms.globvis = (float)swrenderer::LightVisibility::Instance()->ParticleGlobVis();
|
args.uniforms.globvis = (float)swrenderer::LightVisibility::Instance()->ParticleGlobVis();
|
||||||
|
|
||||||
if (fullbrightSprite || swrenderer::fixedlightlev >= 0 || swrenderer::fixedcolormap)
|
if (fullbrightSprite || cameraLight->fixedlightlev >= 0 || cameraLight->fixedcolormap)
|
||||||
{
|
{
|
||||||
args.uniforms.light = 256;
|
args.uniforms.light = 256;
|
||||||
args.uniforms.flags = TriUniforms::fixed_light;
|
args.uniforms.flags = TriUniforms::fixed_light;
|
||||||
|
|
|
@ -96,8 +96,10 @@ void RenderPolyPlane::Render3DFloor(const TriMatrix &worldToClip, const Vec4f &c
|
||||||
if (tex->UseType == FTexture::TEX_Null)
|
if (tex->UseType == FTexture::TEX_Null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
swrenderer::CameraLight *cameraLight = swrenderer::CameraLight::Instance();
|
||||||
|
|
||||||
int lightlevel = 255;
|
int lightlevel = 255;
|
||||||
if (swrenderer::fixedlightlev < 0 && sub->sector->e->XFloor.lightlist.Size())
|
if (cameraLight->fixedlightlev < 0 && sub->sector->e->XFloor.lightlist.Size())
|
||||||
{
|
{
|
||||||
lightlist_t *light = P_GetPlaneLight(sub->sector, &sub->sector->ceilingplane, false);
|
lightlist_t *light = P_GetPlaneLight(sub->sector, &sub->sector->ceilingplane, false);
|
||||||
//basecolormap = light->extra_colormap;
|
//basecolormap = light->extra_colormap;
|
||||||
|
@ -109,7 +111,7 @@ void RenderPolyPlane::Render3DFloor(const TriMatrix &worldToClip, const Vec4f &c
|
||||||
PolyDrawArgs args;
|
PolyDrawArgs args;
|
||||||
args.uniforms.globvis = (float)swrenderer::LightVisibility::Instance()->SlopePlaneGlobVis() * 48.0f;
|
args.uniforms.globvis = (float)swrenderer::LightVisibility::Instance()->SlopePlaneGlobVis() * 48.0f;
|
||||||
args.uniforms.light = (uint32_t)(lightlevel / 255.0f * 256.0f);
|
args.uniforms.light = (uint32_t)(lightlevel / 255.0f * 256.0f);
|
||||||
if (swrenderer::fixedlightlev >= 0 || swrenderer::fixedcolormap)
|
if (cameraLight->fixedlightlev >= 0 || cameraLight->fixedcolormap)
|
||||||
args.uniforms.light = 256;
|
args.uniforms.light = 256;
|
||||||
args.uniforms.flags = 0;
|
args.uniforms.flags = 0;
|
||||||
args.uniforms.subsectorDepth = subsectorDepth;
|
args.uniforms.subsectorDepth = subsectorDepth;
|
||||||
|
@ -300,10 +302,12 @@ void RenderPolyPlane::Render(const TriMatrix &worldToClip, const Vec4f &clipPlan
|
||||||
|
|
||||||
UVTransform transform(ceiling ? frontsector->planes[sector_t::ceiling].xform : frontsector->planes[sector_t::floor].xform, tex);
|
UVTransform transform(ceiling ? frontsector->planes[sector_t::ceiling].xform : frontsector->planes[sector_t::floor].xform, tex);
|
||||||
|
|
||||||
|
swrenderer::CameraLight *cameraLight = swrenderer::CameraLight::Instance();
|
||||||
|
|
||||||
PolyDrawArgs args;
|
PolyDrawArgs args;
|
||||||
args.uniforms.globvis = (float)swrenderer::LightVisibility::Instance()->SlopePlaneGlobVis() * 48.0f;
|
args.uniforms.globvis = (float)swrenderer::LightVisibility::Instance()->SlopePlaneGlobVis() * 48.0f;
|
||||||
args.uniforms.light = (uint32_t)(frontsector->lightlevel / 255.0f * 256.0f);
|
args.uniforms.light = (uint32_t)(frontsector->lightlevel / 255.0f * 256.0f);
|
||||||
if (swrenderer::fixedlightlev >= 0 || swrenderer::fixedcolormap)
|
if (cameraLight->fixedlightlev >= 0 || cameraLight->fixedcolormap)
|
||||||
args.uniforms.light = 256;
|
args.uniforms.light = 256;
|
||||||
args.uniforms.flags = 0;
|
args.uniforms.flags = 0;
|
||||||
args.uniforms.subsectorDepth = isSky ? RenderPolyScene::SkySubsectorDepth : subsectorDepth;
|
args.uniforms.subsectorDepth = isSky ? RenderPolyScene::SkySubsectorDepth : subsectorDepth;
|
||||||
|
|
|
@ -326,14 +326,15 @@ void RenderPolyPlayerSprites::RenderSprite(DPSprite *sprite, AActor *owner, floa
|
||||||
}
|
}
|
||||||
// If the main colormap has fixed lights, and this sprite is being drawn with that
|
// If the main colormap has fixed lights, and this sprite is being drawn with that
|
||||||
// colormap, disable acceleration so that the lights can remain fixed.
|
// colormap, disable acceleration so that the lights can remain fixed.
|
||||||
if (!noaccel && swrenderer::realfixedcolormap == nullptr &&
|
swrenderer::CameraLight *cameraLight = swrenderer::CameraLight::Instance();
|
||||||
|
if (!noaccel && cameraLight->realfixedcolormap == nullptr &&
|
||||||
NormalLightHasFixedLights && mybasecolormap == &NormalLight &&
|
NormalLightHasFixedLights && mybasecolormap == &NormalLight &&
|
||||||
tex->UseBasePalette())
|
tex->UseBasePalette())
|
||||||
{
|
{
|
||||||
noaccel = true;
|
noaccel = true;
|
||||||
}
|
}
|
||||||
// [SP] If emulating GZDoom fullbright, disable acceleration
|
// [SP] If emulating GZDoom fullbright, disable acceleration
|
||||||
if (r_fullbrightignoresectorcolor && swrenderer::fixedlightlev >= 0)
|
if (r_fullbrightignoresectorcolor && cameraLight->fixedlightlev >= 0)
|
||||||
mybasecolormap = &FullNormalLight;
|
mybasecolormap = &FullNormalLight;
|
||||||
if (r_fullbrightignoresectorcolor && !foggy && sprite->GetState()->GetFullbright())
|
if (r_fullbrightignoresectorcolor && !foggy && sprite->GetState()->GetFullbright())
|
||||||
mybasecolormap = &FullNormalLight;
|
mybasecolormap = &FullNormalLight;
|
||||||
|
|
|
@ -136,11 +136,12 @@ void RenderPolySprite::Render(const TriMatrix &worldToClip, const Vec4f &clipPla
|
||||||
}
|
}
|
||||||
|
|
||||||
bool fullbrightSprite = ((thing->renderflags & RF_FULLBRIGHT) || (thing->flags5 & MF5_BRIGHT));
|
bool fullbrightSprite = ((thing->renderflags & RF_FULLBRIGHT) || (thing->flags5 & MF5_BRIGHT));
|
||||||
|
swrenderer::CameraLight *cameraLight = swrenderer::CameraLight::Instance();
|
||||||
|
|
||||||
PolyDrawArgs args;
|
PolyDrawArgs args;
|
||||||
args.uniforms.globvis = (float)swrenderer::LightVisibility::Instance()->SpriteGlobVis();
|
args.uniforms.globvis = (float)swrenderer::LightVisibility::Instance()->SpriteGlobVis();
|
||||||
args.uniforms.flags = 0;
|
args.uniforms.flags = 0;
|
||||||
if (fullbrightSprite || swrenderer::fixedlightlev >= 0 || swrenderer::fixedcolormap)
|
if (fullbrightSprite || cameraLight->fixedlightlev >= 0 || cameraLight->fixedcolormap)
|
||||||
{
|
{
|
||||||
args.uniforms.light = 256;
|
args.uniforms.light = 256;
|
||||||
args.uniforms.flags |= TriUniforms::fixed_light;
|
args.uniforms.flags |= TriUniforms::fixed_light;
|
||||||
|
|
|
@ -352,7 +352,8 @@ FTexture *RenderPolyWall::GetTexture()
|
||||||
|
|
||||||
int RenderPolyWall::GetLightLevel()
|
int RenderPolyWall::GetLightLevel()
|
||||||
{
|
{
|
||||||
if (swrenderer::fixedlightlev >= 0 || swrenderer::fixedcolormap)
|
swrenderer::CameraLight *cameraLight = swrenderer::CameraLight::Instance();
|
||||||
|
if (cameraLight->fixedlightlev >= 0 || cameraLight->fixedcolormap)
|
||||||
{
|
{
|
||||||
return 255;
|
return 255;
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,10 +98,11 @@ void RenderPolyWallSprite::Render(const TriMatrix &worldToClip, const Vec4f &cli
|
||||||
}
|
}
|
||||||
|
|
||||||
bool fullbrightSprite = ((thing->renderflags & RF_FULLBRIGHT) || (thing->flags5 & MF5_BRIGHT));
|
bool fullbrightSprite = ((thing->renderflags & RF_FULLBRIGHT) || (thing->flags5 & MF5_BRIGHT));
|
||||||
|
swrenderer::CameraLight *cameraLight = swrenderer::CameraLight::Instance();
|
||||||
|
|
||||||
PolyDrawArgs args;
|
PolyDrawArgs args;
|
||||||
args.uniforms.globvis = (float)swrenderer::LightVisibility::Instance()->WallGlobVis();
|
args.uniforms.globvis = (float)swrenderer::LightVisibility::Instance()->WallGlobVis();
|
||||||
if (fullbrightSprite || swrenderer::fixedlightlev >= 0 || swrenderer::fixedcolormap)
|
if (fullbrightSprite || cameraLight->fixedlightlev >= 0 || cameraLight->fixedcolormap)
|
||||||
{
|
{
|
||||||
args.uniforms.light = 256;
|
args.uniforms.light = 256;
|
||||||
args.uniforms.flags = TriUniforms::fixed_light;
|
args.uniforms.flags = TriUniforms::fixed_light;
|
||||||
|
|
|
@ -456,11 +456,12 @@ namespace swrenderer
|
||||||
return false;
|
return false;
|
||||||
colfunc = &SWPixelFormatDrawers::DrawShadedColumn;
|
colfunc = &SWPixelFormatDrawers::DrawShadedColumn;
|
||||||
drawer_needs_pal_input = true;
|
drawer_needs_pal_input = true;
|
||||||
dc_color = fixedcolormap ? fixedcolormap->Maps[APART(color)] : basecolormap->Maps[APART(color)];
|
CameraLight *cameraLight = CameraLight::Instance();
|
||||||
|
dc_color = cameraLight->fixedcolormap ? cameraLight->fixedcolormap->Maps[APART(color)] : basecolormap->Maps[APART(color)];
|
||||||
basecolormap = &ShadeFakeColormap[16 - alpha];
|
basecolormap = &ShadeFakeColormap[16 - alpha];
|
||||||
if (fixedlightlev >= 0 && fixedcolormap == NULL)
|
if (cameraLight->fixedlightlev >= 0 && cameraLight->fixedcolormap == NULL)
|
||||||
{
|
{
|
||||||
R_SetColorMapLight(basecolormap, 0, FIXEDLIGHT2SHADE(fixedlightlev));
|
R_SetColorMapLight(basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -901,7 +901,8 @@ namespace swrenderer
|
||||||
|
|
||||||
walltexcoords.Project(sidedef->TexelLength * lwallscale, WallC.sx1, WallC.sx2, WallT);
|
walltexcoords.Project(sidedef->TexelLength * lwallscale, WallC.sx1, WallC.sx2, WallT);
|
||||||
|
|
||||||
if (fixedcolormap == NULL && fixedlightlev < 0)
|
CameraLight *cameraLight = CameraLight::Instance();
|
||||||
|
if (cameraLight->fixedcolormap == nullptr && cameraLight->fixedlightlev < 0)
|
||||||
{
|
{
|
||||||
wallshade = LIGHT2SHADE(curline->sidedef->GetLightLevel(foggy, frontsector->lightlevel) + R_ActualExtraLight(foggy));
|
wallshade = LIGHT2SHADE(curline->sidedef->GetLightLevel(foggy, frontsector->lightlevel) + R_ActualExtraLight(foggy));
|
||||||
double GlobVis = LightVisibility::Instance()->WallGlobVis();
|
double GlobVis = LightVisibility::Instance()->WallGlobVis();
|
||||||
|
@ -918,7 +919,7 @@ namespace swrenderer
|
||||||
|
|
||||||
bool SWRenderLine::IsFogBoundary(sector_t *front, sector_t *back) const
|
bool SWRenderLine::IsFogBoundary(sector_t *front, sector_t *back) const
|
||||||
{
|
{
|
||||||
return r_fogboundary && fixedcolormap == NULL && front->ColorMap->Fade &&
|
return r_fogboundary && CameraLight::Instance()->fixedcolormap == nullptr && front->ColorMap->Fade &&
|
||||||
front->ColorMap->Fade != back->ColorMap->Fade &&
|
front->ColorMap->Fade != back->ColorMap->Fade &&
|
||||||
(front->GetTexture(sector_t::ceiling) != skyflatnum || back->GetTexture(sector_t::ceiling) != skyflatnum);
|
(front->GetTexture(sector_t::ceiling) != skyflatnum || back->GetTexture(sector_t::ceiling) != skyflatnum);
|
||||||
}
|
}
|
||||||
|
@ -932,10 +933,11 @@ namespace swrenderer
|
||||||
double yscale;
|
double yscale;
|
||||||
fixed_t xoffset = rw_offset;
|
fixed_t xoffset = rw_offset;
|
||||||
|
|
||||||
if (fixedlightlev >= 0)
|
CameraLight *cameraLight = CameraLight::Instance();
|
||||||
R_SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(fixedlightlev));
|
if (cameraLight->fixedlightlev >= 0)
|
||||||
else if (fixedcolormap != NULL)
|
R_SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
|
||||||
R_SetColorMapLight(fixedcolormap, 0, 0);
|
else if (cameraLight->fixedcolormap != nullptr)
|
||||||
|
R_SetColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
||||||
|
|
||||||
// clip wall to the floor and ceiling
|
// clip wall to the floor and ceiling
|
||||||
auto ceilingclip = RenderOpaquePass::Instance()->ceilingclip;
|
auto ceilingclip = RenderOpaquePass::Instance()->ceilingclip;
|
||||||
|
|
|
@ -97,7 +97,8 @@ namespace swrenderer
|
||||||
|
|
||||||
Clip3DFloors *clip3d = Clip3DFloors::Instance();
|
Clip3DFloors *clip3d = Clip3DFloors::Instance();
|
||||||
|
|
||||||
if (fixedlightlev < 0)
|
CameraLight *cameraLight = CameraLight::Instance();
|
||||||
|
if (cameraLight->fixedlightlev < 0)
|
||||||
{
|
{
|
||||||
if (!(clip3d->fake3D & FAKE3D_CLIPTOP))
|
if (!(clip3d->fake3D & FAKE3D_CLIPTOP))
|
||||||
{
|
{
|
||||||
|
@ -139,10 +140,10 @@ namespace swrenderer
|
||||||
spryscale = ds->iscale + ds->iscalestep * (x1 - ds->x1);
|
spryscale = ds->iscale + ds->iscalestep * (x1 - ds->x1);
|
||||||
rw_scalestep = ds->iscalestep;
|
rw_scalestep = ds->iscalestep;
|
||||||
|
|
||||||
if (fixedlightlev >= 0)
|
if (cameraLight->fixedlightlev >= 0)
|
||||||
R_SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(fixedlightlev));
|
R_SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
|
||||||
else if (fixedcolormap != nullptr)
|
else if (cameraLight->fixedcolormap != nullptr)
|
||||||
R_SetColorMapLight(fixedcolormap, 0, 0);
|
R_SetColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
||||||
|
|
||||||
// find positioning
|
// find positioning
|
||||||
texheight = tex->GetScaledHeightDouble();
|
texheight = tex->GetScaledHeightDouble();
|
||||||
|
@ -269,7 +270,7 @@ namespace swrenderer
|
||||||
{
|
{
|
||||||
for (int x = x1; x < x2; ++x)
|
for (int x = x1; x < x2; ++x)
|
||||||
{
|
{
|
||||||
if (fixedcolormap == nullptr && fixedlightlev < 0)
|
if (cameraLight->fixedcolormap == nullptr && cameraLight->fixedlightlev < 0)
|
||||||
{
|
{
|
||||||
R_SetColorMapLight(basecolormap, rw_light, wallshade);
|
R_SetColorMapLight(basecolormap, rw_light, wallshade);
|
||||||
}
|
}
|
||||||
|
@ -440,10 +441,11 @@ namespace swrenderer
|
||||||
texturemid += rowoffset;
|
texturemid += rowoffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fixedlightlev >= 0)
|
CameraLight *cameraLight = CameraLight::Instance();
|
||||||
R_SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(fixedlightlev));
|
if (cameraLight->fixedlightlev >= 0)
|
||||||
else if (fixedcolormap != nullptr)
|
R_SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
|
||||||
R_SetColorMapLight(fixedcolormap, 0, 0);
|
else if (cameraLight->fixedcolormap != nullptr)
|
||||||
|
R_SetColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
||||||
|
|
||||||
WallC.sz1 = ds->sz1;
|
WallC.sz1 = ds->sz1;
|
||||||
WallC.sz2 = ds->sz2;
|
WallC.sz2 = ds->sz2;
|
||||||
|
@ -665,7 +667,8 @@ namespace swrenderer
|
||||||
// correct colors now
|
// correct colors now
|
||||||
FDynamicColormap *basecolormap = frontsector->ColorMap;
|
FDynamicColormap *basecolormap = frontsector->ColorMap;
|
||||||
wallshade = ds->shade;
|
wallshade = ds->shade;
|
||||||
if (fixedlightlev < 0)
|
CameraLight *cameraLight = CameraLight::Instance();
|
||||||
|
if (cameraLight->fixedlightlev < 0)
|
||||||
{
|
{
|
||||||
if ((ds->bFakeBoundary & 3) == 2)
|
if ((ds->bFakeBoundary & 3) == 2)
|
||||||
{
|
{
|
||||||
|
@ -839,7 +842,8 @@ namespace swrenderer
|
||||||
// correct colors now
|
// correct colors now
|
||||||
FDynamicColormap *basecolormap = frontsector->ColorMap;
|
FDynamicColormap *basecolormap = frontsector->ColorMap;
|
||||||
wallshade = ds->shade;
|
wallshade = ds->shade;
|
||||||
if (fixedlightlev < 0)
|
CameraLight *cameraLight = CameraLight::Instance();
|
||||||
|
if (cameraLight->fixedlightlev < 0)
|
||||||
{
|
{
|
||||||
if ((ds->bFakeBoundary & 3) == 2)
|
if ((ds->bFakeBoundary & 3) == 2)
|
||||||
{
|
{
|
||||||
|
|
|
@ -326,7 +326,8 @@ namespace swrenderer
|
||||||
|
|
||||||
dc_wall_fracbits = r_swtruecolor ? FRACBITS : fracbits;
|
dc_wall_fracbits = r_swtruecolor ? FRACBITS : fracbits;
|
||||||
|
|
||||||
bool fixed = (fixedcolormap != NULL || fixedlightlev >= 0);
|
CameraLight *cameraLight = CameraLight::Instance();
|
||||||
|
bool fixed = (cameraLight->fixedcolormap != NULL || cameraLight->fixedlightlev >= 0);
|
||||||
if (fixed)
|
if (fixed)
|
||||||
{
|
{
|
||||||
dc_wall_colormap[0] = dc_colormap;
|
dc_wall_colormap[0] = dc_colormap;
|
||||||
|
@ -339,8 +340,8 @@ namespace swrenderer
|
||||||
dc_wall_light[3] = 0;
|
dc_wall_light[3] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fixedcolormap)
|
if (cameraLight->fixedcolormap)
|
||||||
R_SetColorMapLight(fixedcolormap, 0, 0);
|
R_SetColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
||||||
else
|
else
|
||||||
R_SetColorMapLight(basecolormap, 0, 0);
|
R_SetColorMapLight(basecolormap, 0, 0);
|
||||||
|
|
||||||
|
@ -455,7 +456,8 @@ namespace swrenderer
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (fixedcolormap != NULL || fixedlightlev >= 0 || !(frontsector->e && frontsector->e->XFloor.lightlist.Size()))
|
CameraLight *cameraLight = CameraLight::Instance();
|
||||||
|
if (cameraLight->fixedcolormap != NULL || cameraLight->fixedlightlev >= 0 || !(frontsector->e && frontsector->e->XFloor.lightlist.Size()))
|
||||||
{
|
{
|
||||||
ProcessNormalWall(uwal, dwal, texturemid, swal, lwal);
|
ProcessNormalWall(uwal, dwal, texturemid, swal, lwal);
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,14 +108,15 @@ namespace swrenderer
|
||||||
basecolormap = colormap;
|
basecolormap = colormap;
|
||||||
GlobVis = LightVisibility::Instance()->FlatPlaneGlobVis() / planeheight;
|
GlobVis = LightVisibility::Instance()->FlatPlaneGlobVis() / planeheight;
|
||||||
ds_light = 0;
|
ds_light = 0;
|
||||||
if (fixedlightlev >= 0)
|
CameraLight *cameraLight = CameraLight::Instance();
|
||||||
|
if (cameraLight->fixedlightlev >= 0)
|
||||||
{
|
{
|
||||||
R_SetDSColorMapLight(basecolormap, 0, FIXEDLIGHT2SHADE(fixedlightlev));
|
R_SetDSColorMapLight(basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
|
||||||
plane_shade = false;
|
plane_shade = false;
|
||||||
}
|
}
|
||||||
else if (fixedcolormap)
|
else if (cameraLight->fixedcolormap)
|
||||||
{
|
{
|
||||||
R_SetDSColorMapLight(fixedcolormap, 0, 0);
|
R_SetDSColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
||||||
plane_shade = false;
|
plane_shade = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -148,21 +148,22 @@ namespace swrenderer
|
||||||
}
|
}
|
||||||
|
|
||||||
bool fakefixed = false;
|
bool fakefixed = false;
|
||||||
if (fixedcolormap)
|
CameraLight *cameraLight = CameraLight::Instance();
|
||||||
|
if (cameraLight->fixedcolormap)
|
||||||
{
|
{
|
||||||
R_SetColorMapLight(fixedcolormap, 0, 0);
|
R_SetColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fakefixed = true;
|
fakefixed = true;
|
||||||
fixedcolormap = &NormalLight;
|
cameraLight->fixedcolormap = &NormalLight;
|
||||||
R_SetColorMapLight(fixedcolormap, 0, 0);
|
R_SetColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawSky(pl);
|
DrawSky(pl);
|
||||||
|
|
||||||
if (fakefixed)
|
if (fakefixed)
|
||||||
fixedcolormap = NULL;
|
cameraLight->fixedcolormap = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderSkyPlane::DrawSkyColumnStripe(int start_x, int y1, int y2, int columns, double scale, double texturemid, double yrepeat)
|
void RenderSkyPlane::DrawSkyColumnStripe(int start_x, int y1, int y2, int columns, double scale, double texturemid, double yrepeat)
|
||||||
|
|
|
@ -150,14 +150,15 @@ namespace swrenderer
|
||||||
|
|
||||||
basecolormap = colormap;
|
basecolormap = colormap;
|
||||||
|
|
||||||
if (fixedlightlev >= 0)
|
CameraLight *cameraLight = CameraLight::Instance();
|
||||||
|
if (cameraLight->fixedlightlev >= 0)
|
||||||
{
|
{
|
||||||
R_SetDSColorMapLight(basecolormap, 0, FIXEDLIGHT2SHADE(fixedlightlev));
|
R_SetDSColorMapLight(basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
|
||||||
plane_shade = false;
|
plane_shade = false;
|
||||||
}
|
}
|
||||||
else if (fixedcolormap)
|
else if (cameraLight->fixedcolormap)
|
||||||
{
|
{
|
||||||
R_SetDSColorMapLight(fixedcolormap, 0, 0);
|
R_SetDSColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
||||||
plane_shade = false;
|
plane_shade = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -254,8 +254,7 @@ void FSoftwareRenderer::RenderTextureView (FCanvasTexture *tex, AActor *viewpoin
|
||||||
|
|
||||||
// curse Doom's overuse of global variables in the renderer.
|
// curse Doom's overuse of global variables in the renderer.
|
||||||
// These get clobbered by rendering to a camera texture but they need to be preserved so the final rendering can be done with the correct palette.
|
// These get clobbered by rendering to a camera texture but they need to be preserved so the final rendering can be done with the correct palette.
|
||||||
FSWColormap *savecolormap = fixedcolormap;
|
CameraLight savedCameraLight = *CameraLight::Instance();
|
||||||
FSpecialColormap *savecm = realfixedcolormap;
|
|
||||||
|
|
||||||
DAngle savedfov = FieldOfView;
|
DAngle savedfov = FieldOfView;
|
||||||
R_SetFOV ((double)fov);
|
R_SetFOV ((double)fov);
|
||||||
|
@ -315,8 +314,7 @@ void FSoftwareRenderer::RenderTextureView (FCanvasTexture *tex, AActor *viewpoin
|
||||||
|
|
||||||
tex->SetUpdated();
|
tex->SetUpdated();
|
||||||
|
|
||||||
fixedcolormap = savecolormap;
|
*CameraLight::Instance() = savedCameraLight;
|
||||||
realfixedcolormap = savecm;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sector_t *FSoftwareRenderer::FakeFlat(sector_t *sec, sector_t *tempsec, int *floorlightlevel, int *ceilinglightlevel)
|
sector_t *FSoftwareRenderer::FakeFlat(sector_t *sec, sector_t *tempsec, int *floorlightlevel, int *ceilinglightlevel)
|
||||||
|
|
|
@ -38,21 +38,23 @@ EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor)
|
||||||
|
|
||||||
namespace swrenderer
|
namespace swrenderer
|
||||||
{
|
{
|
||||||
int fixedlightlev;
|
CameraLight *CameraLight::Instance()
|
||||||
FSWColormap *fixedcolormap;
|
{
|
||||||
FSpecialColormap *realfixedcolormap;
|
static CameraLight instance;
|
||||||
|
return &instance;
|
||||||
|
}
|
||||||
|
|
||||||
void R_SetupColormap(AActor *actor)
|
void CameraLight::SetCamera(AActor *actor)
|
||||||
{
|
{
|
||||||
player_t *player = actor->player;
|
player_t *player = actor->player;
|
||||||
if (camera && camera->player != 0)
|
if (camera && camera->player != nullptr)
|
||||||
player = camera->player;
|
player = camera->player;
|
||||||
|
|
||||||
realfixedcolormap = NULL;
|
realfixedcolormap = nullptr;
|
||||||
fixedcolormap = NULL;
|
fixedcolormap = nullptr;
|
||||||
fixedlightlev = -1;
|
fixedlightlev = -1;
|
||||||
|
|
||||||
if (player != NULL && camera == player->mo)
|
if (player != nullptr && camera == player->mo)
|
||||||
{
|
{
|
||||||
if (player->fixedcolormap >= 0 && player->fixedcolormap < (int)SpecialColormaps.Size())
|
if (player->fixedcolormap >= 0 && player->fixedcolormap < (int)SpecialColormaps.Size())
|
||||||
{
|
{
|
||||||
|
@ -80,7 +82,7 @@ namespace swrenderer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// [RH] Inverse light for shooting the Sigil
|
// [RH] Inverse light for shooting the Sigil
|
||||||
if (fixedcolormap == NULL && extralight == INT_MIN)
|
if (fixedcolormap == nullptr && extralight == INT_MIN)
|
||||||
{
|
{
|
||||||
fixedcolormap = &SpecialColormaps[INVERSECOLORMAP];
|
fixedcolormap = &SpecialColormaps[INVERSECOLORMAP];
|
||||||
extralight = 0;
|
extralight = 0;
|
||||||
|
@ -184,15 +186,16 @@ namespace swrenderer
|
||||||
basecolormap = GetSpecialLights(basecolormap->Color, basecolormap->Fade.InverseColor(), basecolormap->Desaturate);
|
basecolormap = GetSpecialLights(basecolormap->Color, basecolormap->Fade.InverseColor(), basecolormap->Desaturate);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fixedcolormap)
|
CameraLight *cameraLight = CameraLight::Instance();
|
||||||
|
if (cameraLight->fixedcolormap)
|
||||||
{
|
{
|
||||||
BaseColormap = fixedcolormap;
|
BaseColormap = cameraLight->fixedcolormap;
|
||||||
ColormapNum = 0;
|
ColormapNum = 0;
|
||||||
}
|
}
|
||||||
else if (fixedlightlev >= 0)
|
else if (cameraLight->fixedlightlev >= 0)
|
||||||
{
|
{
|
||||||
BaseColormap = (r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap;
|
BaseColormap = (r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap;
|
||||||
ColormapNum = fixedlightlev >> COLORMAPSHIFT;
|
ColormapNum = cameraLight->fixedlightlev >> COLORMAPSHIFT;
|
||||||
}
|
}
|
||||||
else if (fullbright)
|
else if (fullbright)
|
||||||
{
|
{
|
||||||
|
|
|
@ -54,11 +54,17 @@ struct FSWColormap;
|
||||||
|
|
||||||
namespace swrenderer
|
namespace swrenderer
|
||||||
{
|
{
|
||||||
extern int fixedlightlev;
|
class CameraLight
|
||||||
extern FSWColormap *fixedcolormap;
|
{
|
||||||
extern FSpecialColormap *realfixedcolormap;
|
public:
|
||||||
|
static CameraLight *Instance();
|
||||||
|
|
||||||
void R_SetupColormap(AActor *actor);
|
int fixedlightlev = 0;
|
||||||
|
FSWColormap *fixedcolormap = nullptr;
|
||||||
|
FSpecialColormap *realfixedcolormap = nullptr;
|
||||||
|
|
||||||
|
void SetCamera(AActor *actor);
|
||||||
|
};
|
||||||
|
|
||||||
class LightVisibility
|
class LightVisibility
|
||||||
{
|
{
|
||||||
|
|
|
@ -479,8 +479,9 @@ namespace swrenderer
|
||||||
bool foggy = level.fadeto || frontsector->ColorMap->Fade || (level.flags & LEVEL_HASFADETABLE);
|
bool foggy = level.fadeto || frontsector->ColorMap->Fade || (level.flags & LEVEL_HASFADETABLE);
|
||||||
|
|
||||||
// kg3D - fake lights
|
// kg3D - fake lights
|
||||||
|
CameraLight *cameraLight = CameraLight::Instance();
|
||||||
FDynamicColormap *basecolormap;
|
FDynamicColormap *basecolormap;
|
||||||
if (fixedlightlev < 0 && frontsector->e && frontsector->e->XFloor.lightlist.Size())
|
if (cameraLight->fixedlightlev < 0 && frontsector->e && frontsector->e->XFloor.lightlist.Size())
|
||||||
{
|
{
|
||||||
light = P_GetPlaneLight(frontsector, &frontsector->ceilingplane, false);
|
light = P_GetPlaneLight(frontsector, &frontsector->ceilingplane, false);
|
||||||
basecolormap = light->extra_colormap;
|
basecolormap = light->extra_colormap;
|
||||||
|
@ -493,7 +494,7 @@ namespace swrenderer
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
basecolormap = (r_fullbrightignoresectorcolor && fixedlightlev >= 0) ? &FullNormalLight : frontsector->ColorMap;
|
basecolormap = (r_fullbrightignoresectorcolor && cameraLight->fixedlightlev >= 0) ? &FullNormalLight : frontsector->ColorMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
portal = frontsector->ValidatePortal(sector_t::ceiling);
|
portal = frontsector->ValidatePortal(sector_t::ceiling);
|
||||||
|
@ -518,7 +519,7 @@ namespace swrenderer
|
||||||
if (ceilingplane)
|
if (ceilingplane)
|
||||||
ceilingplane->AddLights(frontsector->lighthead);
|
ceilingplane->AddLights(frontsector->lighthead);
|
||||||
|
|
||||||
if (fixedlightlev < 0 && frontsector->e && frontsector->e->XFloor.lightlist.Size())
|
if (cameraLight->fixedlightlev < 0 && frontsector->e && frontsector->e->XFloor.lightlist.Size())
|
||||||
{
|
{
|
||||||
light = P_GetPlaneLight(frontsector, &frontsector->floorplane, false);
|
light = P_GetPlaneLight(frontsector, &frontsector->floorplane, false);
|
||||||
basecolormap = light->extra_colormap;
|
basecolormap = light->extra_colormap;
|
||||||
|
@ -531,7 +532,7 @@ namespace swrenderer
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
basecolormap = (r_fullbrightignoresectorcolor && fixedlightlev >= 0) ? &FullNormalLight : frontsector->ColorMap;
|
basecolormap = (r_fullbrightignoresectorcolor && cameraLight->fixedlightlev >= 0) ? &FullNormalLight : frontsector->ColorMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
// killough 3/7/98: Add (x,y) offsets to flats, add deep water check
|
// killough 3/7/98: Add (x,y) offsets to flats, add deep water check
|
||||||
|
@ -603,7 +604,7 @@ namespace swrenderer
|
||||||
else position = sector_t::floor;
|
else position = sector_t::floor;
|
||||||
frontsector = &tempsec;
|
frontsector = &tempsec;
|
||||||
|
|
||||||
if (fixedlightlev < 0 && sub->sector->e->XFloor.lightlist.Size())
|
if (cameraLight->fixedlightlev < 0 && sub->sector->e->XFloor.lightlist.Size())
|
||||||
{
|
{
|
||||||
light = P_GetPlaneLight(sub->sector, &frontsector->floorplane, false);
|
light = P_GetPlaneLight(sub->sector, &frontsector->floorplane, false);
|
||||||
basecolormap = light->extra_colormap;
|
basecolormap = light->extra_colormap;
|
||||||
|
@ -668,7 +669,7 @@ namespace swrenderer
|
||||||
frontsector = &tempsec;
|
frontsector = &tempsec;
|
||||||
|
|
||||||
tempsec.ceilingplane.ChangeHeight(-1 / 65536.);
|
tempsec.ceilingplane.ChangeHeight(-1 / 65536.);
|
||||||
if (fixedlightlev < 0 && sub->sector->e->XFloor.lightlist.Size())
|
if (cameraLight->fixedlightlev < 0 && sub->sector->e->XFloor.lightlist.Size())
|
||||||
{
|
{
|
||||||
light = P_GetPlaneLight(sub->sector, &frontsector->ceilingplane, false);
|
light = P_GetPlaneLight(sub->sector, &frontsector->ceilingplane, false);
|
||||||
basecolormap = light->extra_colormap;
|
basecolormap = light->extra_colormap;
|
||||||
|
|
|
@ -103,9 +103,9 @@ namespace swrenderer
|
||||||
RenderActorView(player->mo);
|
RenderActorView(player->mo);
|
||||||
|
|
||||||
// Apply special colormap if the target cannot do it
|
// Apply special colormap if the target cannot do it
|
||||||
if (realfixedcolormap && r_swtruecolor && !(r_shadercolormaps && screen->Accel2D))
|
if (CameraLight::Instance()->realfixedcolormap && r_swtruecolor && !(r_shadercolormaps && screen->Accel2D))
|
||||||
{
|
{
|
||||||
DrawerCommandQueue::QueueCommand<ApplySpecialColormapRGBACommand>(realfixedcolormap, screen);
|
DrawerCommandQueue::QueueCommand<ApplySpecialColormapRGBACommand>(CameraLight::Instance()->realfixedcolormap, screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
R_EndDrawerCommands();
|
R_EndDrawerCommands();
|
||||||
|
@ -125,7 +125,7 @@ namespace swrenderer
|
||||||
clip3d->ResetClip(); // reset clips (floor/ceiling)
|
clip3d->ResetClip(); // reset clips (floor/ceiling)
|
||||||
|
|
||||||
R_SetupFrame(actor);
|
R_SetupFrame(actor);
|
||||||
R_SetupColormap(actor);
|
CameraLight::Instance()->SetCamera(actor);
|
||||||
RenderViewport::Instance()->SetupFreelook();
|
RenderViewport::Instance()->SetupFreelook();
|
||||||
|
|
||||||
RenderPortal::Instance()->CopyStackedViewParameters();
|
RenderPortal::Instance()->CopyStackedViewParameters();
|
||||||
|
@ -193,7 +193,7 @@ namespace swrenderer
|
||||||
// copy to the screen does not use a special colormap shader.
|
// copy to the screen does not use a special colormap shader.
|
||||||
if (!r_shadercolormaps && !r_swtruecolor)
|
if (!r_shadercolormaps && !r_swtruecolor)
|
||||||
{
|
{
|
||||||
realfixedcolormap = NULL;
|
CameraLight::Instance()->realfixedcolormap = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -253,10 +253,11 @@ namespace swrenderer
|
||||||
}
|
}
|
||||||
|
|
||||||
light = lightleft + (x1 - savecoord.sx1) * lightstep;
|
light = lightleft + (x1 - savecoord.sx1) * lightstep;
|
||||||
if (fixedlightlev >= 0)
|
CameraLight *cameraLight = CameraLight::Instance();
|
||||||
R_SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : usecolormap, 0, FIXEDLIGHT2SHADE(fixedlightlev));
|
if (cameraLight->fixedlightlev >= 0)
|
||||||
else if (fixedcolormap != NULL)
|
R_SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : usecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
|
||||||
R_SetColorMapLight(fixedcolormap, 0, 0);
|
else if (cameraLight->fixedcolormap != NULL)
|
||||||
|
R_SetColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
||||||
else if (!foggy && (decal->RenderFlags & RF_FULLBRIGHT))
|
else if (!foggy && (decal->RenderFlags & RF_FULLBRIGHT))
|
||||||
R_SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : usecolormap, 0, 0);
|
R_SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : usecolormap, 0, 0);
|
||||||
else
|
else
|
||||||
|
|
|
@ -90,7 +90,8 @@ namespace swrenderer
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FDynamicColormap *basecolormap;
|
FDynamicColormap *basecolormap;
|
||||||
if (fixedlightlev < 0 && viewsector->e && viewsector->e->XFloor.lightlist.Size())
|
CameraLight *cameraLight = CameraLight::Instance();
|
||||||
|
if (cameraLight->fixedlightlev < 0 && viewsector->e && viewsector->e->XFloor.lightlist.Size())
|
||||||
{
|
{
|
||||||
for (i = viewsector->e->XFloor.lightlist.Size() - 1; i >= 0; i--)
|
for (i = viewsector->e->XFloor.lightlist.Size() - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
|
@ -480,7 +481,8 @@ namespace swrenderer
|
||||||
}
|
}
|
||||||
// If the main colormap has fixed lights, and this sprite is being drawn with that
|
// If the main colormap has fixed lights, and this sprite is being drawn with that
|
||||||
// colormap, disable acceleration so that the lights can remain fixed.
|
// colormap, disable acceleration so that the lights can remain fixed.
|
||||||
if (!noaccel && realfixedcolormap == nullptr &&
|
CameraLight *cameraLight = CameraLight::Instance();
|
||||||
|
if (!noaccel && cameraLight->realfixedcolormap == nullptr &&
|
||||||
NormalLightHasFixedLights && vis.Light.BaseColormap == &NormalLight &&
|
NormalLightHasFixedLights && vis.Light.BaseColormap == &NormalLight &&
|
||||||
vis.pic->UseBasePalette())
|
vis.pic->UseBasePalette())
|
||||||
{
|
{
|
||||||
|
|
|
@ -86,7 +86,8 @@ namespace swrenderer
|
||||||
if ((clip3d->fake3D & FAKE3D_CLIPTOP) && spr->gzb >= clip3d->sclipTop) return;
|
if ((clip3d->fake3D & FAKE3D_CLIPTOP) && spr->gzb >= clip3d->sclipTop) return;
|
||||||
|
|
||||||
// kg3D - correct colors now
|
// kg3D - correct colors now
|
||||||
if (!fixedcolormap && fixedlightlev < 0 && spr->sector->e && spr->sector->e->XFloor.lightlist.Size())
|
CameraLight *cameraLight = CameraLight::Instance();
|
||||||
|
if (!cameraLight->fixedcolormap && cameraLight->fixedlightlev < 0 && spr->sector->e && spr->sector->e->XFloor.lightlist.Size())
|
||||||
{
|
{
|
||||||
if (!(clip3d->fake3D & FAKE3D_CLIPTOP))
|
if (!(clip3d->fake3D & FAKE3D_CLIPTOP))
|
||||||
{
|
{
|
||||||
|
|
|
@ -184,10 +184,11 @@ namespace swrenderer
|
||||||
float lightleft = float(GlobVis / spr->wallc.sz1);
|
float lightleft = float(GlobVis / spr->wallc.sz1);
|
||||||
float lightstep = float((GlobVis / spr->wallc.sz2 - lightleft) / (spr->wallc.sx2 - spr->wallc.sx1));
|
float lightstep = float((GlobVis / spr->wallc.sz2 - lightleft) / (spr->wallc.sx2 - spr->wallc.sx1));
|
||||||
float light = lightleft + (x1 - spr->wallc.sx1) * lightstep;
|
float light = lightleft + (x1 - spr->wallc.sx1) * lightstep;
|
||||||
if (fixedlightlev >= 0)
|
CameraLight *cameraLight = CameraLight::Instance();
|
||||||
R_SetColorMapLight(usecolormap, 0, FIXEDLIGHT2SHADE(fixedlightlev));
|
if (cameraLight->fixedlightlev >= 0)
|
||||||
else if (fixedcolormap != NULL)
|
R_SetColorMapLight(usecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
|
||||||
R_SetColorMapLight(fixedcolormap, 0, 0);
|
else if (cameraLight->fixedcolormap != NULL)
|
||||||
|
R_SetColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
||||||
else if (!spr->foggy && (spr->renderflags & RF_FULLBRIGHT))
|
else if (!spr->foggy && (spr->renderflags & RF_FULLBRIGHT))
|
||||||
R_SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : usecolormap, 0, 0);
|
R_SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : usecolormap, 0, 0);
|
||||||
else
|
else
|
||||||
|
|
|
@ -197,7 +197,7 @@ void DCanvas::DrawTextureParms(FTexture *img, DrawParms &parms)
|
||||||
R_SetTranslationMap(identitymap);
|
R_SetTranslationMap(identitymap);
|
||||||
}
|
}
|
||||||
|
|
||||||
fixedcolormap = dc_fcolormap;
|
CameraLight::Instance()->fixedcolormap = dc_fcolormap;
|
||||||
bool visible;
|
bool visible;
|
||||||
FDynamicColormap *basecolormap = nullptr;
|
FDynamicColormap *basecolormap = nullptr;
|
||||||
if (r_swtruecolor)
|
if (r_swtruecolor)
|
||||||
|
|
|
@ -1405,7 +1405,7 @@ void D3DFB::Draw3DPart(bool copy3d)
|
||||||
D3DCOLOR color0, color1;
|
D3DCOLOR color0, color1;
|
||||||
if (Accel2D)
|
if (Accel2D)
|
||||||
{
|
{
|
||||||
auto &map = swrenderer::realfixedcolormap;
|
auto &map = swrenderer::CameraLight::Instance()->realfixedcolormap;
|
||||||
if (map == NULL)
|
if (map == NULL)
|
||||||
{
|
{
|
||||||
color0 = 0;
|
color0 = 0;
|
||||||
|
|
Loading…
Reference in a new issue