Skip to content

Commit

Permalink
BSP Builder: Removed "migrant half-edge" notification
Browse files Browse the repository at this point in the history
These notifications are no longer logical as the algorithm for BSP
leaf sector selection has changed.
  • Loading branch information
danij-deng committed May 19, 2013
1 parent fcac7e4 commit 962cfd9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 72 deletions.
3 changes: 0 additions & 3 deletions doomsday/client/include/map/bsp/partitioner.h
Expand Up @@ -63,9 +63,6 @@ class Partitioner
DENG2_DEFINE_AUDIENCE(OneWayWindowFound,
void oneWayWindowFound(Line &line, Sector &backFacingSector))

DENG2_DEFINE_AUDIENCE(MigrantHEdgeBuilt,
void migrantHEdgeBuilt(HEdge &hedge, Sector &facingSector))

public:
Partitioner(GameMap const &map, int splitCostFactor = 7);

Expand Down
34 changes: 2 additions & 32 deletions doomsday/client/src/map/bsp/partitioner.cpp
Expand Up @@ -1813,22 +1813,6 @@ DENG2_PIMPL(Partitioner)
QString("BSP Leaf 0x%1 has no line-linked half-edge")
.arg(dintptr(leaf), 0, 16));

// Look for migrant half-edges in the wrong sector.
if(Sector *sector = findFirstSectorInBspLeaf(*leaf))
{
HEdge *hedgeIt = base;
do
{
HEdge &hedge = *hedgeIt;
LineSegment::Side const &lineSeg = lineSegment(hedge);
if(lineSeg.hasSector() && lineSeg.sectorPtr() != sector)
{
notifyMigrantHEdgeBuilt(hedge, *sector);
}

} while((hedgeIt = &hedgeIt->next()) != base);
}

/// @todo Polygon should encapsulate.
geom.updateAABox();
geom.updateCenter();
Expand All @@ -1850,8 +1834,8 @@ DENG2_PIMPL(Partitioner)

if(gaps > 0)
{
LOG_WARNING("Polygon geometry for BSP leaf [%p] (at %s) "
"in sector %i has %i gaps (%i half-edges).")
LOG_WARNING("Polygon geometry for BSP leaf [%p] (at %s) in sector %i "
"is not contiguous %i gaps/overlaps (%i half-edges).")
<< de::dintptr(leaf)
<< geom.center().asText()
<< leaf->sector().indexInArchive()
Expand Down Expand Up @@ -2092,20 +2076,6 @@ DENG2_PIMPL(Partitioner)
}
}

/**
* Notify interested parties that a migrant half-edge was built.
*
* @param hedge The migrant half-edge.
* @param facingSector Sector that the half-edge is facing.
*/
void notifyMigrantHEdgeBuilt(HEdge &migrant, Sector &facingSector)
{
DENG2_FOR_PUBLIC_AUDIENCE(MigrantHEdgeBuilt, i)
{
i->migrantHEdgeBuilt(migrant, facingSector);
}
}

bool sanityCheckHasRealHEdge(BspLeaf const &leaf) const
{
HEdge const *base = leaf.firstHEdge();
Expand Down
38 changes: 1 addition & 37 deletions doomsday/client/src/map/bspbuilder.cpp
Expand Up @@ -66,8 +66,7 @@ static int const maxWarningsPerType = 10;
* @todo Consolidate with the missing material reporting done elsewhere -ds
*/
class Reporter : DENG2_OBSERVES(Partitioner, UnclosedSectorFound),
DENG2_OBSERVES(Partitioner, OneWayWindowFound),
DENG2_OBSERVES(Partitioner, MigrantHEdgeBuilt)
DENG2_OBSERVES(Partitioner, OneWayWindowFound)
{
/// Record "unclosed sectors".
/// Sector => world point relatively near to the problem area.
Expand All @@ -77,10 +76,6 @@ class Reporter : DENG2_OBSERVES(Partitioner, UnclosedSectorFound),
/// Line => Sector the back side faces.
typedef std::map<Line *, Sector *> OneWayWindowMap;

/// Record "migrant half-edges".
/// HEdge => Sector the half-edge faces.
typedef std::map<HEdge *, Sector *> MigrantHEdgeMap;

public:

static inline int maxWarnings(int issueCount)
Expand All @@ -94,7 +89,6 @@ class Reporter : DENG2_OBSERVES(Partitioner, UnclosedSectorFound),

inline int unclosedSectorCount() const { return (int)_unclosedSectors.size(); }
inline int oneWayWindowCount() const { return (int)_oneWayWindows.size(); }
inline int migrantHEdgeCount() const { return (int)_migrantHEdges.size(); }

void writeLog()
{
Expand Down Expand Up @@ -123,28 +117,6 @@ class Reporter : DENG2_OBSERVES(Partitioner, UnclosedSectorFound),
if(numToLog < oneWayWindowCount())
LOG_INFO("(%d more like this)") << (oneWayWindowCount() - numToLog);
}

if(int numToLog = maxWarnings(migrantHEdgeCount()))
{
MigrantHEdgeMap::const_iterator it = _migrantHEdges.begin();
for(int i = 0; i < numToLog; ++i, ++it)
{
HEdge *hedge = it->first;
Sector *facingSector = it->second;

if(hedge->hasLineSide())
LOG_WARNING("Sector #%d has migrant half-edge facing #%d (line #%d).")
<< facingSector->indexInMap()
<< hedge->lineSide().sector().indexInMap()
<< hedge->line().indexInMap();
else
LOG_WARNING("Sector #%d has migrant partition line half-edge.")
<< facingSector->indexInMap();
}

if(numToLog < migrantHEdgeCount())
LOG_INFO("(%d more like this)") << (migrantHEdgeCount() - numToLog);
}
}

protected:
Expand All @@ -160,16 +132,9 @@ class Reporter : DENG2_OBSERVES(Partitioner, UnclosedSectorFound),
_oneWayWindows.insert(std::make_pair(&line, &backFacingSector));
}

// Observes Partitioner MigrantHEdgeBuilt.
void migrantHEdgeBuilt(HEdge &hedge, Sector &facingSector)
{
_migrantHEdges.insert(std::make_pair(&hedge, &facingSector));
}

private:
UnclosedSectorMap _unclosedSectors;
OneWayWindowMap _oneWayWindows;
MigrantHEdgeMap _migrantHEdges;
};

bool BspBuilder::buildBsp()
Expand All @@ -178,7 +143,6 @@ bool BspBuilder::buildBsp()

d->partitioner.audienceForUnclosedSectorFound += reporter;
d->partitioner.audienceForOneWayWindowFound += reporter;
d->partitioner.audienceForMigrantHEdgeBuilt += reporter;

bool builtOk = false;
try
Expand Down

0 comments on commit 962cfd9

Please sign in to comment.