Skip to content

Commit

Permalink
BspLeaf: Removed obsolete and unused 'clockwiseSegments' list from Bs…
Browse files Browse the repository at this point in the history
…pLeaf
  • Loading branch information
danij-deng committed Aug 8, 2013
1 parent 22ccbf5 commit 2081fec
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 64 deletions.
8 changes: 0 additions & 8 deletions doomsday/client/include/world/bspleaf.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,6 @@ class BspLeaf : public de::MapElement
*/
void assignExtraMesh(de::Mesh &mesh);

/**
* Provides a clockwise ordered list of all the line segments which comprise
* the convex face geometry (a polygon) assigned to the BSP leaf.
*
* @see allSegments(), setPoly()
*/
Segments const &clockwiseSegments() const;

/**
* Provides a list of all the line segments from the convex face geometry
* and any @em extra meshes assigned to the BSP leaf.
Expand Down
77 changes: 21 additions & 56 deletions doomsday/client/src/world/bspleaf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,6 @@ DENG2_PIMPL(BspLeaf)
/// Additional meshes assigned to the BSP leaf (owned).
Meshes extraMeshes;

/// Clockwise ordering of the line segments from the primary polygon.
Segments clockwiseSegments;

/// Set to @c true when the clockwise segment list needs updating.
bool needUpdateClockwiseSegments;

/// All line segments in the BSP leaf from all polygons.
Segments allSegments;

Expand Down Expand Up @@ -117,7 +111,6 @@ DENG2_PIMPL(BspLeaf)
Instance(Public *i, Sector *sector = 0)
: Base(i),
poly(0),
needUpdateClockwiseSegments(false),
needUpdateAllSegments(false),
sector(sector),
#ifdef __CLIENT__
Expand All @@ -133,27 +126,42 @@ DENG2_PIMPL(BspLeaf)
qDeleteAll(extraMeshes);
}

void updateClockwiseSegments()
void updateAllSegments()
{
needUpdateClockwiseSegments = false;
needUpdateAllSegments = false;

clockwiseSegments.clear();
allSegments.clear();

if(!poly) return;

int numSegments = poly->hedgeCount();
foreach(Mesh *mesh, extraMeshes)
{
numSegments += mesh->hedgeCount();
}

// Populate the list.
#ifdef DENG2_QT_4_7_OR_NEWER
clockwiseSegments.reserve(poly->hedgeCount());
allSegments.reserve(numSegments);
#endif

HEdge *hedge = poly->hedge();
do
{
if(MapElement *elem = hedge->mapElement())
{
clockwiseSegments.append(elem->as<Segment>());
allSegments.append(elem->as<Segment>());
}
} while((hedge = &hedge->next()) != poly->hedge());

foreach(Mesh *mesh, extraMeshes)
foreach(HEdge *hedge, mesh->hedges())
{
if(MapElement *elem = hedge->mapElement())
{
allSegments.append(elem->as<Segment>());
}
}

#ifdef DENG_DEBUG
// See if we received a partial geometry...
{
Expand Down Expand Up @@ -181,39 +189,6 @@ DENG2_PIMPL(BspLeaf)
#endif
}

void updateAllSegments()
{
needUpdateAllSegments = false;

if(needUpdateClockwiseSegments)
{
updateClockwiseSegments();
}

allSegments.clear();

int numSegments = clockwiseSegments.count();
foreach(Mesh *mesh, extraMeshes)
{
numSegments += mesh->hedgeCount();
}
#ifdef DENG2_QT_4_7_OR_NEWER
allSegments.reserve(numSegments);
#endif

// Populate the segment list.
allSegments.append(clockwiseSegments);

foreach(Mesh *mesh, extraMeshes)
foreach(HEdge *hedge, mesh->hedges())
{
if(MapElement *elem = hedge->mapElement())
{
allSegments.append(elem->as<Segment>());
}
}
}

#ifdef __CLIENT__

/**
Expand Down Expand Up @@ -413,7 +388,6 @@ void BspLeaf::setPoly(Face *newPoly)
d->poly = newPoly;

// We'll need to update segment lists.
d->needUpdateClockwiseSegments = true;
d->needUpdateAllSegments = true;

if(newPoly)
Expand Down Expand Up @@ -453,15 +427,6 @@ void BspLeaf::assignExtraMesh(Mesh &newMesh)
}
}

BspLeaf::Segments const &BspLeaf::clockwiseSegments() const
{
if(d->needUpdateClockwiseSegments)
{
d->updateClockwiseSegments();
}
return d->clockwiseSegments;
}

BspLeaf::Segments const &BspLeaf::allSegments() const
{
if(d->needUpdateAllSegments)
Expand Down

0 comments on commit 2081fec

Please sign in to comment.