Skip to content

Commit

Permalink
Renderer|Client: Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed Jul 3, 2015
1 parent 0f0c400 commit ebec1ea
Show file tree
Hide file tree
Showing 7 changed files with 334 additions and 329 deletions.
34 changes: 19 additions & 15 deletions doomsday/apps/client/include/render/walledge.h
@@ -1,6 +1,6 @@
/** @file render/walledge.h Wall Edge Geometry.
/** @file walledge.h Wall Edge Geometry.
*
* @authors Copyright © 2011-2013 Daniel Swanson <danij@dengine.net>
* @authors Copyright © 2011-2015 Daniel Swanson <danij@dengine.net>
*
* @par License
* GPL: http://www.gnu.org/licenses/gpl.html
Expand All @@ -17,8 +17,8 @@
* 02110-1301 USA</small>
*/

#ifndef DENG_RENDER_WALLEDGE
#define DENG_RENDER_WALLEDGE
#ifndef RENDER_WALLEDGE
#define RENDER_WALLEDGE

#include <QList>

Expand All @@ -41,8 +41,8 @@ namespace de {
class HEdge;

/**
* Helper/utility class intended to simplify the process of generating
* sections of wall geometry from a map Line segment.
* Helper/utility class intended to simplify the process of generating sections of wall
* geometry from a map Line segment.
*
* @ingroup world
*/
Expand All @@ -58,11 +58,11 @@ class WallEdge : public WorldEdge
class Event : public WorldEdge::Event, public IHPlane::IIntercept
{
public:
Event(WallEdge &owner, double distance = 0);
Event(WallEdge &owner, ddouble distance = 0);

bool operator < (Event const &other) const;

double distance() const;
ddouble distance() const;

Vector3d origin() const;

Expand All @@ -78,7 +78,7 @@ class WallEdge : public WorldEdge
*
* @param hedge Assumed to have a mapped LineSideSegment with sections.
*/
WallEdge(WallSpec const &spec, HEdge &hedge, int edge);
WallEdge(WallSpec const &spec, HEdge &hedge, dint edge);

inline Event const &operator [] (EventIndex index) const {
return at(index);
Expand All @@ -93,9 +93,13 @@ class WallEdge : public WorldEdge

WallSpec const &spec() const;

LineSide &mapLineSide() const;
inline LineSide &lineSide() const {
return lineSideSegment().lineSide();
}

coord_t lineSideOffset() const;

coord_t mapLineSideOffset() const;
LineSideSegment &lineSideSegment() const;

/// Implement IEdge.
bool isValid() const;
Expand All @@ -106,14 +110,14 @@ class WallEdge : public WorldEdge
/// Implement IEdge.
Event const &last() const;

int divisionCount() const;
dint divisionCount() const;

EventIndex firstDivision() const;

EventIndex lastDivision() const;

inline Event const &bottom() const { return first(); }
inline Event const &top() const { return last(); }
inline Event const &top () const { return last(); }

Events const &events() const;

Expand All @@ -123,6 +127,6 @@ class WallEdge : public WorldEdge
DENG2_PRIVATE(d)
};

} // namespace de
} // namespace de

#endif // DENG_RENDER_WALLEDGE
#endif // RENDER_WALLEDGE
19 changes: 10 additions & 9 deletions doomsday/apps/client/include/world/maputil.h
@@ -1,7 +1,7 @@
/** @file maputil.h World map utilities.
*
* @authors Copyright © 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright © 2006-2013 Daniel Swanson <danij@dengine.net>
* @authors Copyright © 2006-2015 Daniel Swanson <danij@dengine.net>
*
* @par License
* GPL: http://www.gnu.org/licenses/gpl.html
Expand All @@ -18,9 +18,10 @@
*/

#ifdef __CLIENT__
#ifndef DENG_WORLD_MAPUTIL_H
#define DENG_WORLD_MAPUTIL_H
#ifndef WORLD_MAPUTIL_H
#define WORLD_MAPUTIL_H

#include <de/libcore.h>
#include <de/binangle.h>
#include "Line"

Expand All @@ -41,11 +42,11 @@ bool R_SideBackClosed(LineSide const &side, bool ignoreOpacity = true);
* A neighbour is a line that shares a vertex with 'line', and faces the
* specified sector.
*/
Line *R_FindLineNeighbor(Sector const *sector, Line const *line,
LineOwner const *own, bool antiClockwise, binangle_t *diff = 0);
Line *R_FindLineNeighbor(Line const &line, LineOwner const &own, de::ClockDirection direction,
Sector const *sector, binangle_t *diff = nullptr);

Line *R_FindSolidLineNeighbor(Sector const *sector, Line const *line,
LineOwner const *own, bool antiClockwise, binangle_t *diff = 0);
Line *R_FindSolidLineNeighbor(Line const &line, LineOwner const &own, de::ClockDirection direction,
Sector const *sector, binangle_t *diff = nullptr);

#endif // DENG_WORLD_MAPUTIL_H
#endif // __CLIENT__
#endif // WORLD_MAPUTIL_H
#endif // __CLIENT__
20 changes: 10 additions & 10 deletions doomsday/apps/client/src/render/rend_fakeradio.cpp
Expand Up @@ -148,7 +148,7 @@ static Vector2d wallDimensions(WallEdge const &leftEdge, WallEdge const &rightEd
*/
static ddouble wallOffset(WallEdge const &leftEdge, WallEdge const &/*rightEdge*/)
{
return leftEdge.mapLineSideOffset();
return leftEdge.lineSideOffset();
}

/**
Expand All @@ -161,7 +161,7 @@ static ddouble wallOffset(WallEdge const &leftEdge, WallEdge const &/*rightEdge*
*/
static dfloat wallSideOpenness(WallEdge const &leftEdge, WallEdge const &/*rightEdge*/, bool rightSide)
{
return leftEdge.mapLineSide().radioCornerSide(rightSide).corner;
return leftEdge.lineSide().radioCornerSide(rightSide).corner;
}

/**
Expand All @@ -178,7 +178,7 @@ static bool wallReceivesShadow(WallEdge const &leftEdge, WallEdge const &rightEd
{
if(shadowSize <= 0) return false;

LineSide const &side = leftEdge.mapLineSide();
LineSide const &side = leftEdge.lineSide();
DENG2_ASSERT(side.leftHEdge());
SectorCluster const &cluster = side.leftHEdge()->face().mapElementAs<ConvexSubspace>().cluster();
Plane const &visFloor = cluster.visFloor ();
Expand All @@ -199,12 +199,12 @@ static bool wallReceivesShadow(WallEdge const &leftEdge, WallEdge const &rightEd
case LeftShadow:
return (visFloor.castsShadow() || visCeiling.castsShadow())
&& wallSideOpenness(leftEdge, rightEdge, false/*left side*/) > 0
&& leftEdge.mapLineSideOffset() < shadowSize;
&& leftEdge.lineSideOffset() < shadowSize;

case RightShadow:
return (visFloor.castsShadow() || visCeiling.castsShadow())
&& wallSideOpenness(leftEdge, rightEdge, true/*right side*/) > 0
&& leftEdge.mapLineSideOffset() + wallWidth(leftEdge, rightEdge) > side.line().length() - shadowSize;
&& leftEdge.lineSideOffset() + wallWidth(leftEdge, rightEdge) > side.line().length() - shadowSize;
}
DENG2_ASSERT(!"Unknown WallShadow");
return false;
Expand Down Expand Up @@ -245,7 +245,7 @@ struct ProjectedShadowData
static void setTopShadowParams(WallEdge const &leftEdge, WallEdge const &rightEdge, ddouble shadowSize,
ProjectedShadowData &projected)
{
LineSide /*const*/ &side = leftEdge.mapLineSide();
LineSide /*const*/ &side = leftEdge.lineSide();
DENG2_ASSERT(side.leftHEdge());
SectorCluster const &cluster = side.leftHEdge()->face().mapElementAs<ConvexSubspace>().cluster();
Plane const &visFloor = cluster.visFloor ();
Expand Down Expand Up @@ -401,7 +401,7 @@ static void setTopShadowParams(WallEdge const &leftEdge, WallEdge const &rightEd
static void setBottomShadowParams(WallEdge const &leftEdge, WallEdge const &rightEdge, ddouble shadowSize,
ProjectedShadowData &projected)
{
LineSide /*const*/ &side = leftEdge.mapLineSide();
LineSide /*const*/ &side = leftEdge.lineSide();
DENG2_ASSERT(side.leftHEdge());
SectorCluster const &cluster = side.leftHEdge()->face().mapElementAs<ConvexSubspace>().cluster();
Plane const &visFloor = cluster.visFloor ();
Expand Down Expand Up @@ -557,7 +557,7 @@ static void setBottomShadowParams(WallEdge const &leftEdge, WallEdge const &righ
static void setSideShadowParams(WallEdge const &leftEdge, WallEdge const &rightEdge, bool rightSide,
ddouble shadowSize, ProjectedShadowData &projected)
{
LineSide /*const*/ &side = leftEdge.mapLineSide();
LineSide /*const*/ &side = leftEdge.lineSide();
HEdge const *hedge = side.leftHEdge();
DENG2_ASSERT(hedge);
SectorCluster const &cluster = hedge->face().mapElementAs<ConvexSubspace>().cluster();
Expand Down Expand Up @@ -866,7 +866,7 @@ static void drawWallShadow(Vector3f const *posCoords, WallEdge const &leftEdge,
void Rend_DrawWallRadio(WallEdge const &leftEdge, WallEdge const &rightEdge, dfloat ambientLight)
{
// Disabled?
if(!::rendFakeRadio || ::levelFullBright)
if(!::rendFakeRadio || ::levelFullBright || leftEdge.spec().flags.testFlag(WallSpec::NoFakeRadio))
return;

// Skip if the surface is not lit with ambient light.
Expand All @@ -880,7 +880,7 @@ void Rend_DrawWallRadio(WallEdge const &leftEdge, WallEdge const &rightEdge, dfl
return;

// Ensure we have up-to-date information for generating shadow geometry.
leftEdge.mapLineSide().updateRadioForFrame(R_FrameCount());
leftEdge.lineSide().updateRadioForFrame(R_FrameCount());

Vector3f const posCoords[] = {
leftEdge .bottom().origin(),
Expand Down

0 comments on commit ebec1ea

Please sign in to comment.