Skip to content

Commit

Permalink
BSP Builder|Cleanup: Added a private Instance to Partitioner
Browse files Browse the repository at this point in the history
Also moved the definition of PartitionCost into bsp/partitioncost.h
  • Loading branch information
danij-deng committed Apr 8, 2012
1 parent 32d3c74 commit 3f93bd6
Show file tree
Hide file tree
Showing 4 changed files with 1,990 additions and 2,011 deletions.
1 change: 1 addition & 0 deletions doomsday/engine/engine.pro
Expand Up @@ -146,6 +146,7 @@ DENG_HEADERS += \
portable/include/map/bsp/hedgeintercept.h \
portable/include/map/bsp/hplane.h \
portable/include/map/bsp/linedefinfo.h \
portable/include/map/bsp/partitioncost.h \
portable/include/map/bsp/partitioner.h \
portable/include/map/bsp/superblockmap.h \
portable/include/bspleaf.h \
Expand Down
85 changes: 85 additions & 0 deletions doomsday/engine/portable/include/map/bsp/partitioncost.h
@@ -0,0 +1,85 @@
/**
* @file partitioncost.h
* BSP builder partition cost evaluation. @ingroup bsp
*
* Based on glBSP 2.24 (in turn, based on BSP 2.3), which is hosted on
* SourceForge: http://sourceforge.net/projects/glbsp/
*
* @authors Copyright © 2007-2012 Daniel Swanson <danij@dengine.net>
* @authors Copyright © 2000-2007 Andrew Apted <ajapted@gmail.com>
* @authors Copyright © 1998-2000 Colin Reed <cph@moria.org.uk>
* @authors Copyright © 1998-2000 Lee Killough <killough@rsn.hp.com>
*
* @par License
* GPL: http://www.gnu.org/licenses/gpl.html
*
* <small>This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. This program is distributed in the hope that it
* will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details. You should have received a copy of the GNU
* General Public License along with this program; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA</small>
*/

#ifndef LIBDENG_BSP_PARTITIONCOST
#define LIBDENG_BSP_PARTITIONCOST

namespace de {
namespace bsp {

struct PartitionCost
{
int total;
int splits;
int iffy;
int nearMiss;
int realRight;
int realLeft;
int miniRight;
int miniLeft;

PartitionCost::PartitionCost() :
total(0), splits(0), iffy(0), nearMiss(0), realRight(0),
realLeft(0), miniRight(0), miniLeft(0)
{}

PartitionCost& operator += (const PartitionCost& other)
{
total += other.total;
splits += other.splits;
iffy += other.iffy;
nearMiss += other.nearMiss;
realLeft += other.realLeft;
realRight += other.realRight;
miniLeft += other.miniLeft;
miniRight += other.miniRight;
return *this;
}

PartitionCost& operator = (const PartitionCost& other)
{
total = other.total;
splits = other.splits;
iffy = other.iffy;
nearMiss = other.nearMiss;
realLeft = other.realLeft;
realRight = other.realRight;
miniLeft = other.miniLeft;
miniRight = other.miniRight;
return *this;
}

bool operator < (const PartitionCost& rhs) const
{
return total < rhs.total;
}
};

} // namespace bsp
} // namespace de

#endif /// LIBDENG_BSP_PARTITIONCOST

0 comments on commit 3f93bd6

Please sign in to comment.