Merge branch 'master' into modern

This commit is contained in:
Christoph Oelckers 2018-06-26 09:28:23 +02:00
commit 8ac864b007
7 changed files with 23 additions and 7 deletions

View file

@ -764,7 +764,7 @@ void D_Display ()
// //
// Check for the presence of dynamic lights at the start of the frame once. // Check for the presence of dynamic lights at the start of the frame once.
if (gl_lights) if ((gl_lights && vid_rendermode == 4) || (r_dynlights && vid_rendermode != 4))
{ {
TThinkerIterator<ADynamicLight> it(STAT_DLIGHT); TThinkerIterator<ADynamicLight> it(STAT_DLIGHT);
level.HasDynamicLights = !!it.Next(); level.HasDynamicLights = !!it.Next();

View file

@ -3,6 +3,7 @@
#include "actor.h" #include "actor.h"
#include "cycler.h" #include "cycler.h"
EXTERN_CVAR(Bool, r_dynlights)
EXTERN_CVAR(Bool, gl_lights) EXTERN_CVAR(Bool, gl_lights)
EXTERN_CVAR(Bool, gl_attachedlights) EXTERN_CVAR(Bool, gl_attachedlights)

View file

@ -151,6 +151,7 @@ public:
void SightCheck::P_SightOpening(SightOpening &open, const line_t *linedef, double x, double y) void SightCheck::P_SightOpening(SightOpening &open, const line_t *linedef, double x, double y)
{ {
open.portalflags = 0; open.portalflags = 0;
open.bottom = open.top = 0;
sector_t *front = linedef->frontsector; sector_t *front = linedef->frontsector;
sector_t *back = linedef->backsector; sector_t *back = linedef->backsector;
@ -159,8 +160,10 @@ void SightCheck::P_SightOpening(SightOpening &open, const line_t *linedef, doubl
// single sided line // single sided line
if (linedef->flags & ML_PORTALCONNECT) if (linedef->flags & ML_PORTALCONNECT)
{ {
if (!front->PortalBlocksSight(sector_t::ceiling)) open.portalflags |= SO_TOPFRONT; if (!front->PortalBlocksSight(sector_t::ceiling)) open.top = LINEOPEN_MAX, open.portalflags |= SO_TOPFRONT;
if (!front->PortalBlocksSight(sector_t::floor)) open.portalflags |= SO_BOTTOMFRONT; if (!front->PortalBlocksSight(sector_t::floor)) open.bottom = LINEOPEN_MIN, open.portalflags |= SO_BOTTOMFRONT;
if (open.top == 0) open.top = front->floorplane.ZatPoint(x, y);
if (open.bottom == 0) open.bottom = front->ceilingplane.ZatPoint(x, y);
} }
open.range = 0; open.range = 0;
@ -224,7 +227,7 @@ bool SightCheck::PTR_SightTraverse (intercept_t *in)
{ {
// This may not skip P_SightOpening, but only reduce the open range to 0. // This may not skip P_SightOpening, but only reduce the open range to 0.
open.range = 0; open.range = 0;
open.bottom = open.top; if (open.bottom != LINEOPEN_MIN) open.bottom = open.top;
} }
FLinePortal *lport = li->getPortal(); FLinePortal *lport = li->getPortal();

View file

@ -56,7 +56,7 @@ PolyModelRenderer::PolyModelRenderer(PolyRenderThread *thread, const Mat4f &worl
void PolyModelRenderer::AddLights(AActor *actor) void PolyModelRenderer::AddLights(AActor *actor)
{ {
if (gl_lights && actor) if (r_dynlights && actor)
{ {
auto &addedLights = Thread->AddedLightsArray; auto &addedLights = Thread->AddedLightsArray;

View file

@ -269,6 +269,12 @@ void RenderPolyPlane::SetLightLevel(PolyRenderThread *thread, PolyDrawArgs &args
void RenderPolyPlane::SetDynLights(PolyRenderThread *thread, PolyDrawArgs &args, subsector_t *sub, bool ceiling) void RenderPolyPlane::SetDynLights(PolyRenderThread *thread, PolyDrawArgs &args, subsector_t *sub, bool ceiling)
{ {
if (!r_dynlights)
{
args.SetLights(nullptr, 0);
return;
}
FLightNode *light_list = sub->lighthead; FLightNode *light_list = sub->lighthead;
auto cameraLight = PolyCameraLight::Instance(); auto cameraLight = PolyCameraLight::Instance();

View file

@ -374,6 +374,12 @@ void RenderPolyWall::Render(PolyRenderThread *thread)
void RenderPolyWall::SetDynLights(PolyRenderThread *thread, PolyDrawArgs &args) void RenderPolyWall::SetDynLights(PolyRenderThread *thread, PolyDrawArgs &args)
{ {
if (!r_dynlights)
{
args.SetLights(nullptr, 0);
return;
}
FLightNode *light_list = (LineSeg && LineSeg->sidedef) ? LineSeg->sidedef->lighthead : nullptr; FLightNode *light_list = (LineSeg && LineSeg->sidedef) ? LineSeg->sidedef->lighthead : nullptr;
auto cameraLight = PolyCameraLight::Instance(); auto cameraLight = PolyCameraLight::Instance();

View file

@ -98,7 +98,7 @@ namespace swrenderer
void SWModelRenderer::AddLights(AActor *actor) void SWModelRenderer::AddLights(AActor *actor)
{ {
if (gl_lights && actor) if (r_dynlights && actor)
{ {
auto &addedLights = Thread->AddedLightsArray; auto &addedLights = Thread->AddedLightsArray;