Skip to content

Commit

Permalink
World|Client: Schedule missing material fixes in ClientSubsector
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
danij-deng committed Aug 9, 2016
1 parent e03bfc5 commit 56c60d8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
16 changes: 16 additions & 0 deletions doomsday/apps/client/src/client/clientsubsector.cpp
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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);

Expand Down
14 changes: 0 additions & 14 deletions doomsday/apps/client/src/world/base/sector.cpp
Expand Up @@ -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)
Expand Down

0 comments on commit 56c60d8

Please sign in to comment.