From 56c60d8fc4b8375e09c8923bfba76acff92571e6 Mon Sep 17 00:00:00 2001 From: danij Date: Tue, 9 Aug 2016 13:01:42 +0100 Subject: [PATCH] World|Client: Schedule missing material fixes in ClientSubsector ClientSubsector is the first to know about any changes to subspace geometry so scheduling of missing material fixes should be done here as those notifications are inherently "localized , or scoped" to a map space subregion (the extra info should mean updates can be targeted directly and incorporated into support for id Tech 1 mapping hacks). Previously, Sector handled this by simply observing it's planes and then attempting a fix for both sides of every Line which references the Sector. --- .../apps/client/src/client/clientsubsector.cpp | 16 ++++++++++++++++ doomsday/apps/client/src/world/base/sector.cpp | 14 -------------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/doomsday/apps/client/src/client/clientsubsector.cpp b/doomsday/apps/client/src/client/clientsubsector.cpp index 9f485b8ffe..fb32b3b07a 100644 --- a/doomsday/apps/client/src/client/clientsubsector.cpp +++ b/doomsday/apps/client/src/client/clientsubsector.cpp @@ -1179,6 +1179,19 @@ DENG2_PIMPL(ClientSubsector) } } + /** + * @todo Optimize: Target and process only the dependent surfaces -ds + */ + void fixSurfacesMissingMaterials() + { + self.sector().forAllSides([] (LineSide &side) + { + side.fixSurfacesMissingMaterials(); + side.back().fixSurfacesMissingMaterials(); + return LoopContinue; + }); + } + /// Observes Line FlagsChange void lineFlagsChanged(Line &line, dint oldFlags) { @@ -1233,6 +1246,9 @@ DENG2_PIMPL(ClientSubsector) // We may need to update one or both mapped planes. maybeInvalidateMapping(plane.indexInSector()); + // We may need to fix newly revealed missing materials. + fixSurfacesMissingMaterials(); + // We may need to project new decorations. markDependentSurfacesForRedecoration(plane); diff --git a/doomsday/apps/client/src/world/base/sector.cpp b/doomsday/apps/client/src/world/base/sector.cpp index 23dd1de63f..f80b9a2887 100644 --- a/doomsday/apps/client/src/world/base/sector.cpp +++ b/doomsday/apps/client/src/world/base/sector.cpp @@ -214,23 +214,9 @@ DENG2_PIMPL(Sector) updateSideEmitterOrigins(); } -#ifdef __CLIENT__ - void fixSurfacesMissingMaterials() - { - for (LineSide *side : sides) - { - side->fixSurfacesMissingMaterials(); - side->back().fixSurfacesMissingMaterials(); - } - } -#endif - void planeHeightChanged(Plane &) { updateAllSideEmitterOrigins(); -#ifdef __CLIENT__ - fixSurfacesMissingMaterials(); -#endif } DENG2_PIMPL_AUDIENCE(LightLevelChange)