- removed the subsector light lists as a preparation step to move over the light traversal code to use sections instead of subsectors.

This commit is contained in:
Christoph Oelckers 2018-11-05 22:35:24 +01:00
parent 375dd7e28f
commit 9ddca3c3a9
9 changed files with 12 additions and 58 deletions

View file

@ -574,7 +574,7 @@ void ADynamicLight::CollectWithinRadius(const DVector3 &opos, subsector_t *subSe
{
subSec = collected_ss[i].sub;
touching_subsectors = AddLightNode(&subSec->lighthead, subSec, this, touching_subsectors);
//touching_subsectors = AddLightNode(&subSec->lighthead, subSec, this, touching_subsectors);
if (subSec->sector->validcount != ::validcount)
{
touching_sector = AddLightNode(&subSec->render_sector->lighthead, subSec->sector, this, touching_sector);
@ -682,12 +682,6 @@ void ADynamicLight::LinkLight()
{
node->lightsource = NULL;
node = node->nextTarget;
}
node = touching_subsectors;
while (node)
{
node->lightsource = NULL;
node = node->nextTarget;
}
node = touching_sector;
while (node)
@ -719,17 +713,6 @@ void ADynamicLight::LinkLight()
node = node->nextTarget;
}
node = touching_subsectors;
while (node)
{
if (node->lightsource == NULL)
{
node = DeleteLightNode(node);
}
else
node = node->nextTarget;
}
node = touching_sector;
while (node)
{
@ -763,7 +746,6 @@ void ADynamicLight::UnlinkLight ()
}
}
while (touching_sides) touching_sides = DeleteLightNode(touching_sides);
while (touching_subsectors) touching_subsectors = DeleteLightNode(touching_subsectors);
while (touching_sector) touching_sector = DeleteLightNode(touching_sector);
shadowmapped = false;
}
@ -918,7 +900,7 @@ void AActor::RecreateAllAttachedLights()
CCMD(listlights)
{
int walls, sectors, subsecs;
int walls, sectors;
int allwalls=0, allsectors=0, allsubsecs = 0;
int i=0, shadowcount = 0;
ADynamicLight * dl;
@ -928,7 +910,6 @@ CCMD(listlights)
{
walls=0;
sectors=0;
subsecs = 0;
Printf("%s at (%f, %f, %f), color = 0x%02x%02x%02x, radius = %f %s %s",
dl->target? dl->target->GetClass()->TypeName.GetChars() : dl->GetClass()->TypeName.GetChars(),
dl->X(), dl->Y(), dl->Z(), dl->args[LIGHT_RED],
@ -954,14 +935,6 @@ CCMD(listlights)
node = node->nextTarget;
}
node=dl->touching_subsectors;
while (node)
{
allsubsecs++;
subsecs++;
node = node->nextTarget;
}
node = dl->touching_sector;
@ -971,27 +944,10 @@ CCMD(listlights)
sectors++;
node = node->nextTarget;
}
Printf("- %d walls, %d subsectors, %d sectors\n", walls, subsecs, sectors);
Printf("- %d walls, %d sectors\n", walls, sectors);
}
Printf("%i dynamic lights, %d shadowmapped, %d walls, %d subsectors, %d sectors\n\n\n", i, shadowcount, allwalls, allsubsecs, allsectors);
}
CCMD(listsublights)
{
for(auto &sub : level.subsectors)
{
int lights = 0;
FLightNode * node = sub.lighthead;
while (node != NULL)
{
lights++;
node = node->nextLight;
}
Printf(PRINT_LOG, "Subsector %d - %d lights\n", sub.Index(), lights);
}
Printf("%i dynamic lights, %d shadowmapped, %d walls, %d sectors\n\n\n", i, shadowcount, allwalls, allsectors);
}

View file

@ -206,7 +206,6 @@ public:
bool IsSpot() { return !!(lightflags & LF_SPOT); }
FState *targetState;
FLightNode * touching_sides;
FLightNode * touching_subsectors;
FLightNode * touching_sector;
private:

View file

@ -54,7 +54,7 @@ int HWDrawInfo::SetupLightsForOtherPlane(subsector_t * sub, FDynLightData &light
if (level.HasDynamicLights && !isFullbrightScene())
{
Plane p;
FLightNode * node = sub->lighthead;
FLightNode * node = sub->sector->lighthead;
lightdata.Clear();
while (node)

View file

@ -131,11 +131,11 @@ void HWDrawInfo::GetDynSpriteLight(AActor *thing, particle_t *particle, float *o
{
if (thing != NULL)
{
GetDynSpriteLight(thing, (float)thing->X(), (float)thing->Y(), (float)thing->Center(), thing->subsector->lighthead, thing->Sector->PortalGroup, out);
GetDynSpriteLight(thing, (float)thing->X(), (float)thing->Y(), (float)thing->Center(), thing->Sector->lighthead, thing->Sector->PortalGroup, out);
}
else if (particle != NULL)
{
GetDynSpriteLight(NULL, (float)particle->Pos.X, (float)particle->Pos.Y, (float)particle->Pos.Z, particle->subsector->lighthead, particle->subsector->sector->PortalGroup, out);
GetDynSpriteLight(NULL, (float)particle->Pos.X, (float)particle->Pos.Y, (float)particle->Pos.Z, particle->subsector->sector->lighthead, particle->subsector->sector->PortalGroup, out);
}
}
@ -160,7 +160,7 @@ void hw_GetDynModelLight(AActor *self, FDynLightData &modellightdata)
BSPWalkCircle(x, y, radiusSquared, [&](subsector_t *subsector) // Iterate through all subsectors potentially touched by actor
{
FLightNode * node = subsector->lighthead;
FLightNode * node = subsector->sector->lighthead;
while (node) // check all lights touching a subsector
{
ADynamicLight *light = node->lightsource;

View file

@ -302,7 +302,7 @@ void GLWall::SetupLights(HWDrawInfo *di, FDynLightData &lightdata)
else if (sub)
{
// Polobject segs cannot be checked per sidedef so use the subsector instead.
node = sub->lighthead;
node = sub->sector->lighthead;
}
else node = NULL;

View file

@ -70,7 +70,7 @@ void PolyModelRenderer::AddLights(AActor *actor)
BSPWalkCircle(x, y, radiusSquared, [&](subsector_t *subsector) // Iterate through all subsectors potentially touched by actor
{
FLightNode * node = subsector->lighthead;
FLightNode * node = subsector->sector->lighthead;
while (node) // check all lights touching a subsector
{
ADynamicLight *light = node->lightsource;

View file

@ -275,7 +275,7 @@ void RenderPolyPlane::SetDynLights(PolyRenderThread *thread, PolyDrawArgs &args,
return;
}
FLightNode *light_list = sub->lighthead;
FLightNode *light_list = sub->sector->lighthead;
auto cameraLight = PolyCameraLight::Instance();
if ((cameraLight->FixedLightLevel() >= 0) || (cameraLight->FixedColormap() != nullptr))

View file

@ -1460,7 +1460,6 @@ struct subsector_t
uint16_t sectorindex;
// subsector related GL data
FLightNode * lighthead; // Light nodes (blended and additive)
int validcount;
short mapsection;
char hacked; // 1: is part of a render hack

View file

@ -111,7 +111,7 @@ namespace swrenderer
BSPWalkCircle(x, y, radiusSquared, [&](subsector_t *subsector) // Iterate through all subsectors potentially touched by actor
{
FLightNode * node = subsector->lighthead;
FLightNode * node = subsector->sector->lighthead;
while (node) // check all lights touching a subsector
{
ADynamicLight *light = node->lightsource;