Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor|WallSpec: Moved WallSpec to new source files; cleanup
- Loading branch information
1 parent
0e49ce9
commit 22b0e4f
Showing
5 changed files
with
162 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include "render/wallspec.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
/** @file render/wallspec.h Wall Geometry Specification. | ||
* | ||
* @authors Copyright © 2013 Daniel Swanson <danij@dengine.net> | ||
* | ||
* @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 DENG_RENDER_WALLSPEC | ||
#define DENG_RENDER_WALLSPEC | ||
|
||
#include <QFlags> | ||
|
||
#include "Line" | ||
|
||
namespace de { | ||
|
||
/** | ||
* Wall geometry specification. The members are public for convenient access. | ||
*/ | ||
class WallSpec | ||
{ | ||
public: | ||
enum Flag | ||
{ | ||
/// Force the geometry to be opaque, irrespective of material opacity. | ||
ForceOpaque = 0x01, | ||
|
||
/** | ||
* Clip the geometry if the neighbor plane surface relevant for the | ||
* specified section (i.e., the floor if @c Side::Bottom or ceiling | ||
* if @c Side::Top) has a sky-masked material bound to it. | ||
*/ | ||
SkyClip = 0x02, | ||
|
||
/// Do not generate geometry for dynamic lights. | ||
NoDynLights = 0x04, | ||
|
||
/// Do not generate geometry for dynamic (mobj) shadows. | ||
NoDynShadows = 0x08, | ||
|
||
/// Do not generate geometry for faked radiosity. | ||
NoFakeRadio = 0x10, | ||
|
||
/// Do not apply angle based light level deltas. | ||
NoLightDeltas = 0x20, | ||
|
||
/// Do not smooth edge normals. | ||
NoEdgeNormalSmoothing = 0x40, | ||
|
||
DefaultFlags = ForceOpaque | SkyClip | ||
}; | ||
Q_DECLARE_FLAGS(Flags, Flag) | ||
|
||
/// Specification flags. | ||
Flags flags; | ||
|
||
/// Wall section identifier. | ||
int section; | ||
|
||
/** | ||
* Construct a default wall geometry specification for the specifed @a section. | ||
*/ | ||
WallSpec(int section, Flags flags = DefaultFlags) : flags(flags), section(section) | ||
{} | ||
|
||
/** | ||
* Construct a wall geometry specification appropriate for the specified | ||
* @a side and @a section of a map Line considering the current map renderer | ||
* configuration. | ||
*/ | ||
static WallSpec fromMapSide(Line::Side const &side, int section); | ||
}; | ||
|
||
Q_DECLARE_OPERATORS_FOR_FLAGS(WallSpec::Flags) | ||
|
||
} // namespace de | ||
|
||
#endif // DENG_RENDER_WALLSPEC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/** @file render/wallspec.cpp Wall Geometry Specification. | ||
* | ||
* @authors Copyright © 2013 Daniel Swanson <danij@dengine.net> | ||
* | ||
* @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> | ||
*/ | ||
|
||
#include "render/rend_main.h" | ||
|
||
#include "render/walledge.h" | ||
|
||
using namespace de; | ||
|
||
/** | ||
* Should angle based light level deltas be applied? | ||
*/ | ||
static bool useWallSectionLightLevelDeltas(Line::Side const &side, int section) | ||
{ | ||
// Disabled? | ||
if(rendLightWallAngle <= 0) | ||
return false; | ||
|
||
// Never if the surface's material was chosen as a HOM fix (lighting must | ||
// be consistent with that applied to the relative back sector plane). | ||
if(side.hasSector() && side.back().hasSector() && side.surface(section).hasFixMaterial()) | ||
return false; | ||
|
||
return true; | ||
} | ||
|
||
WallSpec WallSpec::fromMapSide(Line::Side const &side, int section) // static | ||
{ | ||
WallSpec spec(section); | ||
|
||
if(side.line().definesPolyobj() || (section == Line::Side::Middle && !side.considerOneSided())) | ||
spec.flags &= ~WallSpec::ForceOpaque; | ||
|
||
// Suppress the sky clipping in debug mode. | ||
if(devRendSkyMode) | ||
spec.flags &= ~WallSpec::SkyClip; | ||
|
||
if(side.line().definesPolyobj()) | ||
spec.flags |= WallSpec::NoFakeRadio; | ||
|
||
bool useLightLevelDeltas = useWallSectionLightLevelDeltas(side, section); | ||
if(!useLightLevelDeltas) | ||
spec.flags |= WallSpec::NoLightDeltas; | ||
|
||
// We can skip normal smoothing if light level delta smoothing won't be done. | ||
if(!useLightLevelDeltas || !rendLightWallAngleSmooth) | ||
spec.flags |= WallSpec::NoEdgeNormalSmoothing; | ||
|
||
return spec; | ||
} |