Skip to content

Commit

Permalink
Fixed|Renderer: TNT MAP02 transparent window grill
Browse files Browse the repository at this point in the history
Don't clip a non-opaque wall.
  • Loading branch information
skyjake committed Dec 12, 2019
1 parent ca6a409 commit a6949a7
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 21 deletions.
45 changes: 25 additions & 20 deletions doomsday/apps/client/src/render/rend_main.cpp
Expand Up @@ -735,6 +735,15 @@ ClientMaterial *Rend_ChooseMapSurfaceMaterial(Surface const &surface)
const Line::Side &side = surface.parent().as<Line::Side>();
if (side.hasSector())
{
if (auto *midAnim = side.middle().materialAnimator())
{
DENG2_ASSERT(&surface != &side.middle());
if (!midAnim->isOpaque())
{
return &midAnim->material();
}
}

// Use the ceiling for missing top section, and floor for missing bottom section.
if (&surface == &side.bottom())
{
Expand Down Expand Up @@ -3278,6 +3287,15 @@ static bool coveredOpenRange(HEdge &hedge, coord_t middleBottomZ, coord_t middle
{
LineSide const &front = hedge.mapElementAs<LineSideSegment>().lineSide();

// TNT map02 window grille: transparent masked wall
if (auto *anim = front.middle().materialAnimator())
{
if (!anim->isOpaque())
{
return false;
}
}

if (front.considerOneSided())
{
return wroteOpaqueMiddle;
Expand Down Expand Up @@ -3315,7 +3333,7 @@ static bool coveredOpenRange(HEdge &hedge, coord_t middleBottomZ, coord_t middle
if (wroteOpaqueMiddle && middleCoversOpening)
return true;

if ( (bceil <= ffloor && (front.top ().hasMaterial() || front.middle().hasMaterial()))
if ( (bceil <= ffloor && (front.top ().hasMaterial() || front.middle().hasMaterial()))
|| (bfloor >= fceil && (front.bottom().hasMaterial() || front.middle().hasMaterial())))
{
Surface const &ffloorSurface = subsec.visFloor ().surface();
Expand Down Expand Up @@ -3397,7 +3415,8 @@ static void writeAllWalls(HEdge &hedge)
}
}
}
ClientApp::renderSystem().angleClipper().addRangeFromViewRelPoints(hedge.origin(), hedge.twin().origin());
ClientApp::renderSystem().angleClipper()
.addRangeFromViewRelPoints(hedge.origin(), hedge.twin().origin());
}
}

Expand Down Expand Up @@ -3532,25 +3551,11 @@ static void occludeSubspace(bool frontFacing)
auto const &backSubsec = backSubspace.subsector().as<world::ClientSubsector>();

// Determine the opening between plane heights at this edge.
ddouble openBottom;
if (backSubsec.visFloor().heightSmoothed() > subsec.visFloor().heightSmoothed())
{
openBottom = backSubsec.visFloor().heightSmoothed();
}
else
{
openBottom = subsec.visFloor().heightSmoothed();
}
ddouble openBottom = de::max(backSubsec.visFloor().heightSmoothed(),
subsec .visFloor().heightSmoothed());

ddouble openTop;
if (backSubsec.visCeiling().heightSmoothed() < subsec.visCeiling().heightSmoothed())
{
openTop = backSubsec.visCeiling().heightSmoothed();
}
else
{
openTop = subsec.visCeiling().heightSmoothed();
}
ddouble openTop = de::min(backSubsec.visCeiling().heightSmoothed(),
subsec .visCeiling().heightSmoothed());

// Choose start and end vertexes so that it's facing forward.
Vertex const &from = frontFacing ? hedge->vertex() : hedge->twin().vertex();
Expand Down
11 changes: 10 additions & 1 deletion doomsday/apps/client/src/render/wallspec.cpp
Expand Up @@ -19,12 +19,12 @@

#include "de_base.h"

#include "MaterialAnimator"
#include "Sector"
#include "Surface"
#include "world/p_players.h" // viewPlayer

#include "render/rend_main.h"

#include "render/walledge.h"

using namespace de;
Expand Down Expand Up @@ -62,6 +62,15 @@ WallSpec WallSpec::fromMapSide(LineSide const &side, dint section) // static
spec.flags |= WallSpec::NoEdgeDivisions;
}

// TNT MAP02 window grille: transparent masked wall
if (auto *midMan = side.middle().materialAnimator())
{
if (section != LineSide::Middle && !midMan->isOpaque())
{
spec.flags &= ~WallSpec::ForceOpaque;
}
}

if (isTwoSidedMiddle)
{
if (viewPlayer &&
Expand Down

0 comments on commit a6949a7

Please sign in to comment.