Skip to content

Commit

Permalink
Renderer: Working on masked middle textures
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Dec 13, 2019
1 parent 1960f18 commit fac9f4f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
6 changes: 3 additions & 3 deletions doomsday/apps/client/src/render/rend_main.cpp
Expand Up @@ -757,7 +757,7 @@ ClientMaterial *Rend_ChooseMapSurfaceMaterial(Surface const &surface)
}
else if (&surface == &side.top())
{
return static_cast<ClientMaterial *>(side.sector().ceiling().surface().materialPtr());
static_cast<ClientMaterial *>(side.sector().ceiling().surface().materialPtr());
}
}
}
Expand Down Expand Up @@ -3118,8 +3118,8 @@ static void writeSubspaceSkyMaskStrips(SkyFixEdge::FixType fixType)
bool endStrip = false;
if (hedge->hasMapElement())
{
scanMaterialOffset += hedge->mapElementAs<LineSideSegment>().length()
* (direction == Anticlockwise? -1 : 1);
scanMaterialOffset += hedge->mapElementAs<LineSideSegment>().length() *
(direction == Anticlockwise ? -1 : 1);

// Prepare the edge geometry
SkyFixEdge skyEdge(*hedge, fixType, (direction == Anticlockwise)? Line::From : Line::To,
Expand Down
14 changes: 13 additions & 1 deletion doomsday/apps/client/src/render/skyfixedge.cpp
Expand Up @@ -28,6 +28,7 @@
#include "Plane"
#include "Sector"
#include "Surface"
#include "MaterialAnimator"

#include "render/rend_main.h"

Expand Down Expand Up @@ -124,6 +125,9 @@ DENG2_PIMPL(SkyFixEdge)
// Only edges with line segments need fixes.
if (!hedge->hasMapElement()) return false;

const auto &lineSeg = hedge->mapElementAs<LineSideSegment>();
const auto &lineSide = lineSeg.lineSide();

auto const *space = &hedge->face().mapElementAs<ConvexSubspace>();
auto const *backSpace = hedge->twin().hasFace() ? &hedge->twin().face().mapElementAs<ConvexSubspace>()
: nullptr;
Expand All @@ -135,6 +139,15 @@ DENG2_PIMPL(SkyFixEdge)
if (backSubsec && &backSubsec->sector() == &subsec->sector())
return false;

if (lineSide.middle().hasMaterial() &&
!lineSide.middle().materialAnimator()->isOpaque() &&
((!lower && !lineSide.top().hasMaterial()) ||
(lower && !lineSide.bottom().hasMaterial())))
{
// Icarus: force fields render hack
return false;
}

// Select the relative planes for the fix type.
dint relPlane = lower ? Sector::Floor : Sector::Ceiling;
Plane const *front = &subsec->visPlane(relPlane);
Expand All @@ -143,7 +156,6 @@ DENG2_PIMPL(SkyFixEdge)
if (!front->surface().hasSkyMaskedMaterial())
return false;

LineSide const &lineSide = hedge->mapElementAs<LineSideSegment>().lineSide();
bool const hasClosedBack = R_SideBackClosed(lineSide);

if (!devRendSkyMode)
Expand Down
6 changes: 5 additions & 1 deletion doomsday/apps/client/src/render/walledge.cpp
Expand Up @@ -29,7 +29,7 @@
#include "world/maputil.h"
#include "world/surface.h"
#include "client/clientsubsector.h"

#include "MaterialAnimator"
#include "render/rend_main.h" /// devRendSkyMode @todo remove me

#include "Face"
Expand Down Expand Up @@ -342,6 +342,10 @@ struct WallEdge::Impl : public IHPlane
LineSide const &lineSide = seg.lineSide();
Surface const &middle = lineSide.middle();

const bool isExtendedMasked = middle.hasMaterial() &&
!middle.materialAnimator()->isOpaque() &&
!lineSide.top().hasMaterial();

if (!line.isSelfReferencing() && ffloor == &subsec.sector().floor())
{
lo = de::max(bfloor->heightSmoothed(), ffloor->heightSmoothed());
Expand Down

0 comments on commit fac9f4f

Please sign in to comment.