Fix severe performance issues in large maps.
So... Remember that one decision I made about avoiding BlockThingsIterator as much as possible? Turns out that was a stupid idea. There ARE situations where it's better to iterate sector thinglists, yes, especially for things that are NOT part of the blockmap, but in other cases, the excess allocations of new iterators are a reasonable price to pay for the lower perf impact in extreme cases, such as maps that have a gazillion sectors with gazillions of things in them (I'm looking at you, UDMF mappers). As a compromise, at least, in situations where the thinglists are needed, I did add a sort of micro-optimization by implementing code to check if a bounding box is inside a sector (would be nice if this was part of GZDoom itself, tho).
This commit is contained in:
parent
318e9b526c
commit
e5e6ce619c
20 changed files with 441 additions and 277 deletions
|
|
@ -102,15 +102,21 @@ extend Class SWWMHandler
|
|||
if ( !swwm_debugview ) return;
|
||||
// prepare projection data, we're going to need this
|
||||
SWWMUtility.PrepareProjData(projdata,e.ViewPos,e.ViewAngle,e.ViewPitch,e.ViewRoll,players[consoleplayer].fov);
|
||||
foreach ( s:level.Sectors ) for ( Actor a=s.thinglist; a; a=a.snext )
|
||||
foreach ( s:level.Sectors )
|
||||
{
|
||||
if ( (a == players[consoleplayer].Camera) && !(players[consoleplayer].cheats&CF_CHASECAM) ) continue;
|
||||
if ( a.bINVISIBLE && !(a is 'DynamicLight') ) continue;
|
||||
if ( (a is 'Inventory') && Inventory(a).Owner ) continue;
|
||||
if ( (a is 'SWWMPickupFlash') && (a.CurState == a.FindState('Pickup')) ) continue;
|
||||
if ( (a is 'SWWMShadow') || (a is 'SWWMItemOverlay') || (a is 'HeadpatTracker') || (a is 'SWWMTeleportLine') || (a is 'SWWMTeleportDest') ) continue;
|
||||
if ( a.Distance3DSquared(e.Camera) > 1000000 ) continue;
|
||||
DrawActor(e,a);
|
||||
// don't check sectors that aren't within bounds, saves some time
|
||||
if ( !BoxInSectorBounds(s,players[consoleplayer].Camera.pos.xy,1000,players[consoleplayer].Camera.CurSector.PortalGroup) )
|
||||
continue;
|
||||
for ( Actor a=s.thinglist; a; a=a.snext )
|
||||
{
|
||||
if ( (a == players[consoleplayer].Camera) && !(players[consoleplayer].cheats&CF_CHASECAM) ) continue;
|
||||
if ( a.bINVISIBLE && !(a is 'DynamicLight') ) continue;
|
||||
if ( (a is 'Inventory') && Inventory(a).Owner ) continue;
|
||||
if ( (a is 'SWWMPickupFlash') && (a.CurState == a.FindState('Pickup')) ) continue;
|
||||
if ( (a is 'SWWMShadow') || (a is 'SWWMItemOverlay') || (a is 'HeadpatTracker') || (a is 'SWWMTeleportLine') || (a is 'SWWMTeleportDest') ) continue;
|
||||
if ( a.Distance3DSquared(e.Camera) > 1000000 ) continue;
|
||||
DrawActor(e,a);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue