Skip to content

Commit

Permalink
BspBuilder: Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed Mar 18, 2013
1 parent 4326527 commit d5aa73f
Show file tree
Hide file tree
Showing 11 changed files with 300 additions and 278 deletions.
10 changes: 6 additions & 4 deletions doomsday/client/include/map/bsp/bsptreenode.h
@@ -1,6 +1,4 @@
/**
* @file bsptreenode.h
* BSP Builder BspTreeNode. @ingroup bsp
/** @file bsptreenode.h BSP Builder BspTreeNode.
*
* @authors Copyright © 2013 Daniel Swanson <danij@dengine.net>
*
Expand All @@ -25,7 +23,11 @@
#include <de/BinaryTree>
#include "MapElement"

/// Nodes in BspBuilder's internal tree are modelled with this type.
/**
* Nodes in BspBuilder's internal tree are modelled with this type.
*
* @ingroup bsp
*/
typedef de::BinaryTree<de::MapElement *> BspTreeNode;

#endif // LIBDENG_BSPBUILDER_BSPTREENODE
10 changes: 5 additions & 5 deletions doomsday/client/include/map/bsp/hedgeinfo.h
@@ -1,9 +1,7 @@
/**
* @file hedgeinfo.h
* BSP Builder half-edge info. @ingroup bsp
/** @file hedgeinfo.h BSP Builder half-edge info.
*
* Based on glBSP 2.24 (in turn, based on BSP 2.3), which is hosted on
* SourceForge: http://sourceforge.net/projects/glbsp/
* Originally based on glBSP 2.24 (in turn, based on BSP 2.3)
* @see http://sourceforge.net/projects/glbsp/
*
* @authors Copyright © 2007-2013 Daniel Swanson <danij@dengine.net>
* @authors Copyright © 2000-2007 Andrew Apted <ajapted@gmail.com>
Expand Down Expand Up @@ -40,6 +38,8 @@ class SuperBlock;
/**
* Plain old data (POD) structure storing additional information about a
* half-edge produced by BspBuilder.
*
* @ingroup bsp
*/
struct HEdgeInfo
{
Expand Down
18 changes: 9 additions & 9 deletions doomsday/client/include/map/bsp/hedgeintercept.h
@@ -1,9 +1,7 @@
/**
* @file hedgeintercept.h
* BSP Builder half-edge intercept info. @ingroup bsp
/** @file hedgeintercept.h BSP Builder half-edge intercept info.
*
* Based on glBSP 2.24 (in turn, based on BSP 2.3), which is hosted on
* SourceForge: http://sourceforge.net/projects/glbsp/
* Originally based on glBSP 2.24 (in turn, based on BSP 2.3)
* @see http://sourceforge.net/projects/glbsp/
*
* @authors Copyright © 2007-2013 Daniel Swanson <danij@dengine.net>
* @authors Copyright © 2000-2007 Andrew Apted <ajapted@gmail.com>
Expand Down Expand Up @@ -42,22 +40,24 @@ namespace bsp {
* can be found here (or at there will be upon insertion.)).
*
* There is always a corresponding HPlaneIntercept in the owning HPlane.
*
* @ingroup bsp
*/
struct HEdgeIntercept
{
// Vertex in question.
Vertex* vertex;
Vertex *vertex;

// True if this intersection was on a self-referencing linedef.
bool selfRef;

// Sector on each side of the vertex (along the partition),
// or NULL when that direction isn't OPEN.
Sector* before;
Sector* after;
Sector *before;
Sector *after;

DENG_DEBUG_ONLY(
static void DebugPrint(const HEdgeIntercept& inst)
static void DebugPrint(HEdgeIntercept const &inst)
{
LOG_INFO("Vertex #%i [x:%f, y:%f] beforeSector: #%d afterSector: #%d %s")
<< inst.vertex->_buildData.index
Expand Down
60 changes: 37 additions & 23 deletions doomsday/client/include/map/bsp/hedgetip.h
@@ -1,9 +1,7 @@
/**
* @file hedgetip.h
* BSP builder half-edge tip. @ingroup bsp
/** @file hedgetip.h BSP builder half-edge tip.
*
* Based on glBSP 2.24 (in turn, based on BSP 2.3), which is hosted on
* SourceForge: http://sourceforge.net/projects/glbsp/
* Originally based on glBSP 2.24 (in turn, based on BSP 2.3)
* @see http://sourceforge.net/projects/glbsp/
*
* @authors Copyright © 2007-2013 Daniel Swanson <danij@dengine.net>
* @authors Copyright © 2000-2007 Andrew Apted <ajapted@gmail.com>
Expand Down Expand Up @@ -32,10 +30,15 @@
#include "map/p_mapdata.h"

namespace de {

class HEdge;

namespace bsp {

/**
* A "hedgetip" is where a half-edge meets a vertex.
*
* @ingroup bsp
*/
class HEdgeTip
{
Expand All @@ -47,49 +50,60 @@ class HEdgeTip
};

public:
explicit HEdgeTip(coord_t angle = 0, HEdge* front = 0, HEdge* back = 0)
: angle_(angle), front_(front), back_(back)
explicit HEdgeTip(coord_t angle = 0, HEdge *front = 0, HEdge *back = 0)
: _angle(angle), _front(front), _back(back)
{}

inline coord_t angle() const { return angle_; }
inline HEdgeTip& setAngle(coord_t newAngle) {
angle_ = newAngle;
inline coord_t angle() const { return _angle; }

inline HEdgeTip &setAngle(coord_t newAngle)
{
_angle = newAngle;
return *this;
}

inline HEdge& front() const { return *front_; }
inline HEdge& back() const { return *back_; }
inline HEdge& side(Side sid) const {
inline HEdge &front() const { return *_front; }

inline HEdge &back() const { return *_back; }

inline HEdge &side(Side sid) const
{
return sid == Front? front() : back();
}

inline bool hasFront() const { return !!front_; }
inline bool hasBack() const { return !!back_; }
inline bool hasSide(Side sid) const {
inline bool hasFront() const { return _front != 0; }

inline bool hasBack() const { return _back != 0; }

inline bool hasSide(Side sid) const
{
return sid == Front? hasFront() : hasBack();
}

inline HEdgeTip& setFront(HEdge* hedge) {
front_ = hedge;
inline HEdgeTip &setFront(HEdge *hedge)
{
_front = hedge;
return *this;
}

inline HEdgeTip& setBack(HEdge* hedge) {
back_ = hedge;
inline HEdgeTip &setBack(HEdge *hedge)
{
_back = hedge;
return *this;
}

inline HEdgeTip& setSide(Side sid, HEdge* hedge) {
inline HEdgeTip &setSide(Side sid, HEdge *hedge)
{
return sid == Front? setFront(hedge) : setBack(hedge);
}

private:
/// Angle that line makes at vertex (degrees; 0 is E, 90 is N).
coord_t angle_;
coord_t _angle;

/// Half-edge on each side of the tip. Front is the side of increasing
/// angles, back is the side of decreasing angles. Either can be @c NULL
HEdge* front_, *back_;
HEdge *_front, *_back;
};

} // namespace bsp
Expand Down
4 changes: 2 additions & 2 deletions doomsday/client/include/map/bsp/hplane.h
@@ -1,7 +1,7 @@
/** @file hplane.h BSP Builder half-plane and plane intersection list.
*
* Based on glBSP 2.24 (in turn, based on BSP 2.3), which is hosted on
* SourceForge: http://sourceforge.net/projects/glbsp/
* Originally based on glBSP 2.24 (in turn, based on BSP 2.3)
* @see http://sourceforge.net/projects/glbsp/
*
* @authors Copyright © 2007-2013 Daniel Swanson <danij@dengine.net>
* @authors Copyright © 2000-2007 Andrew Apted <ajapted@gmail.com>
Expand Down
28 changes: 14 additions & 14 deletions doomsday/client/include/map/bsp/linedefinfo.h
@@ -1,9 +1,7 @@
/**
* @file linedefinfo.h
* BSP Builder LineDef info. @ingroup bsp
/** @file linedefinfo.h BSP Builder Line info.
*
* Based on glBSP 2.24 (in turn, based on BSP 2.3), which is hosted on
* SourceForge: http://sourceforge.net/projects/glbsp/
* Originally based on glBSP 2.24 (in turn, based on BSP 2.3)
* @see http://sourceforge.net/projects/glbsp/
*
* @authors Copyright © 2007-2013 Daniel Swanson <danij@dengine.net>
* @authors Copyright © 2000-2007 Andrew Apted <ajapted@gmail.com>
Expand All @@ -25,8 +23,8 @@
* 02110-1301 USA</small>
*/

#ifndef LIBDENG_BSP_LINEDEFINFO
#define LIBDENG_BSP_LINEDEFINFO
#ifndef LIBDENG_BSP_LINEINFO
#define LIBDENG_BSP_LINEINFO

#include "map/gamemap.h"
#include "map/bsp/partitioner.h"
Expand All @@ -38,9 +36,11 @@ namespace bsp {

/**
* Plain old data (POD) structure used to record additional information and
* precalculated values for a LineDef in the current map.
* precalculated values for a line in the current map.
*
* @ingroup bsp
*/
struct LineDefInfo
struct LineInfo
{
/// @todo Refactor me away.
enum Flag
Expand All @@ -62,16 +62,16 @@ struct LineDefInfo
/// If the line is used for a window effect, this is the sector on the back side.
Sector *windowEffect;

explicit LineDefInfo(LineDef *line_, coord_t distEpsilon = 0.0001)
explicit LineInfo(LineDef *line_, coord_t distEpsilon = 0.0001)
: line(line_), flags(0), validCount(0), windowEffect(0)
{
DENG2_ASSERT(line_);
Vertex const &from = line->from();
Vertex const &to = line->to();

// Check for zero-length line.
if((fabs(from.origin()[VX] - to.origin()[VX]) < distEpsilon) &&
(fabs(from.origin()[VY] - to.origin()[VY]) < distEpsilon))
if((de::abs(from.origin()[VX] - to.origin()[VX]) < distEpsilon) &&
(de::abs(from.origin()[VY] - to.origin()[VY]) < distEpsilon))
flags |= ZeroLength;

if(line->hasBackSideDef() && line->hasFrontSideDef())
Expand All @@ -84,9 +84,9 @@ struct LineDefInfo
}
};

Q_DECLARE_OPERATORS_FOR_FLAGS(LineDefInfo::Flags)
Q_DECLARE_OPERATORS_FOR_FLAGS(LineInfo::Flags)

} // namespace bsp
} // namespace de

#endif // LIBDENG_BSPBUILDER_LINEDEFINFO
#endif // LIBDENG_BSPBUILDER_LINEINFO
11 changes: 6 additions & 5 deletions doomsday/client/include/map/bsp/partitioncost.h
@@ -1,9 +1,7 @@
/**
* @file partitioncost.h
* BSP builder partition cost evaluation. @ingroup bsp
/** @file partitioncost.h BSP builder partition cost evaluation.
*
* Based on glBSP 2.24 (in turn, based on BSP 2.3), which is hosted on
* SourceForge: http://sourceforge.net/projects/glbsp/
* Originally based on glBSP 2.24 (in turn, based on BSP 2.3)
* @see http://sourceforge.net/projects/glbsp/
*
* @authors Copyright © 2007-2013 Daniel Swanson <danij@dengine.net>
* @authors Copyright © 2000-2007 Andrew Apted <ajapted@gmail.com>
Expand Down Expand Up @@ -34,6 +32,9 @@
namespace de {
namespace bsp {

/**
* @ingroup bsp
*/
struct PartitionCost
{
enum Side
Expand Down
2 changes: 1 addition & 1 deletion doomsday/client/include/map/bsp/partitioner.h
Expand Up @@ -136,7 +136,7 @@ class Partitioner

private:
struct Instance;
Instance* d;
Instance *d;
};

} // namespace bsp
Expand Down

0 comments on commit d5aa73f

Please sign in to comment.