Skip to content

Commit

Permalink
SectionEdge: Minor API improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed May 2, 2013
1 parent 4b65b57 commit ccad74c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions doomsday/client/include/map/hedge.h
Expand Up @@ -47,7 +47,7 @@ class SectionEdge
de::WallDivs wallDivs;

public:
SectionEdge(HEdge &hedge, int section, int right);
SectionEdge(HEdge &hedge, int edge, int section);

void prepare(coord_t bottom, coord_t top);

Expand Down Expand Up @@ -75,8 +75,8 @@ class SectionEdge
void addPlaneIntercepts(coord_t bottom, coord_t top);

HEdge *_hedge;
int _edge;
int _section;
int _right;

int _interceptCount;
de::WallDivs::Intercept *_firstIntercept;
Expand Down
16 changes: 8 additions & 8 deletions doomsday/client/src/map/hedge.cpp
Expand Up @@ -326,10 +326,10 @@ WallDivs::Intercepts const &WallDivs::intercepts() const
return _intercepts;
}

SectionEdge::SectionEdge(HEdge &hedge, int section, int right)
SectionEdge::SectionEdge(HEdge &hedge, int edge, int section)
: _hedge(&hedge),
_edge(edge),
_section(section),
_right(right),
_interceptCount(0),
_firstIntercept(0),
_lastIntercept(0)
Expand Down Expand Up @@ -369,12 +369,12 @@ int SectionEdge::section() const

Vector2d const &SectionEdge::origin() const
{
return _hedge->vertex(_right).origin();
return _hedge->vertex(_edge).origin();
}

coord_t SectionEdge::offset() const
{
return _hedge->lineOffset() + (_right? _hedge->length() : 0);
return _hedge->lineOffset() + (_edge? _hedge->length() : 0);
}

void SectionEdge::addPlaneIntercepts(coord_t bottom, coord_t top)
Expand All @@ -389,17 +389,17 @@ void SectionEdge::addPlaneIntercepts(coord_t bottom, coord_t top)
return;

// Only sections at line side edges can/should be split.
if(!((_hedge == side.leftHEdge() && !_right) ||
(_hedge == side.rightHEdge() && _right)))
if(!((_hedge == side.leftHEdge() && _edge == HEdge::From) ||
(_hedge == side.rightHEdge() && _edge == HEdge::To)))
return;

if(bottom >= top) return; // Obviously no division.

Sector const *frontSec = side.sectorPtr();

LineOwner::Direction direction(_right? LineOwner::Previous : LineOwner::Next);
LineOwner::Direction direction(_edge? LineOwner::Previous : LineOwner::Next);
// Retrieve the start owner node.
LineOwner *base = R_GetVtxLineOwner(&side.line().vertex(_right), &side.line());
LineOwner *base = R_GetVtxLineOwner(&side.line().vertex(_edge), &side.line());
LineOwner *own = base;
bool stopScan = false;
do
Expand Down
16 changes: 8 additions & 8 deletions doomsday/client/src/render/rend_main.cpp
Expand Up @@ -2001,8 +2001,8 @@ static bool writeWallSections2(HEdge &hedge, int sections)
if(!(sections & Line::Side::MiddleFlag)) return false;

int const section = Line::Side::Middle;
SectionEdge leftEdge(hedge, section, false /* left edge */);
SectionEdge rightEdge(hedge, section, true /* right edge */);
SectionEdge leftEdge(hedge, HEdge::From, section);
SectionEdge rightEdge(hedge, HEdge::To, section);
Vector2f materialOrigin;
bool opaque = false;

Expand Down Expand Up @@ -2055,8 +2055,8 @@ static bool writeWallSections2Twosided(HEdge &hedge, int sections)
if(sections & Line::Side::MiddleFlag)
{
int const section = Line::Side::Middle;
SectionEdge leftEdge(hedge, section, false /* left edge */);
SectionEdge rightEdge(hedge, section, true /* right edge */);
SectionEdge leftEdge(hedge, HEdge::From, section);
SectionEdge rightEdge(hedge, HEdge::To, section);
Vector2f materialOrigin;

if(prepareWallSectionEdges(leftEdge, rightEdge, materialOrigin))
Expand Down Expand Up @@ -2101,8 +2101,8 @@ static bool writeWallSections2Twosided(HEdge &hedge, int sections)
if(sections & Line::Side::TopFlag)
{
int const section = Line::Side::Top;
SectionEdge leftEdge(hedge, section, false /* left edge */);
SectionEdge rightEdge(hedge, section, true /* right edge */);
SectionEdge leftEdge(hedge, HEdge::From, section);
SectionEdge rightEdge(hedge, HEdge::To, section);
Vector2f materialOrigin;

if(prepareWallSectionEdges(leftEdge, rightEdge, materialOrigin))
Expand All @@ -2116,8 +2116,8 @@ static bool writeWallSections2Twosided(HEdge &hedge, int sections)
if(sections & Line::Side::BottomFlag)
{
int const section = Line::Side::Bottom;
SectionEdge leftEdge(hedge, section, false /* left edge */);
SectionEdge rightEdge(hedge, section, true /* right edge */);
SectionEdge leftEdge(hedge, HEdge::From, section);
SectionEdge rightEdge(hedge, HEdge::To, section);
Vector2f materialOrigin;

if(prepareWallSectionEdges(leftEdge, rightEdge, materialOrigin))
Expand Down

0 comments on commit ccad74c

Please sign in to comment.