Deep water support

This commit is contained in:
Magnus Norddahl 2016-11-15 15:15:26 +01:00
parent 3b397183ac
commit ee15856786
2 changed files with 43 additions and 4 deletions

View File

@ -147,7 +147,7 @@ void RenderPolyScene::RenderLine(subsector_t *sub, seg_t *line, sector_t *fronts
// Cull wall if not visible // Cull wall if not visible
int sx1, sx2; int sx1, sx2;
bool hasSegmentRange = Cull.GetSegmentRangeForLine(line->v1->fX(), line->v1->fY(), line->v2->fX(), line->v2->fY(), sx1, sx2); bool hasSegmentRange = Cull.GetSegmentRangeForLine(line->v1->fX(), line->v1->fY(), line->v2->fX(), line->v2->fY(), sx1, sx2);
if (hasSegmentRange && Cull.IsSegmentCulled(sx1, sx2)) if (!hasSegmentRange || Cull.IsSegmentCulled(sx1, sx2))
return; return;
// Tell automap we saw this // Tell automap we saw this

View File

@ -31,9 +31,48 @@
void RenderPolyPlane::Render(const TriMatrix &worldToClip, subsector_t *sub, uint32_t subsectorDepth, bool ceiling, double skyHeight) void RenderPolyPlane::Render(const TriMatrix &worldToClip, subsector_t *sub, uint32_t subsectorDepth, bool ceiling, double skyHeight)
{ {
sector_t *frontsector = sub->sector; sector_t *fakesector = sub->sector->heightsec;
if (fakesector && (fakesector == sub->sector || (fakesector->MoreFlags & SECF_IGNOREHEIGHTSEC) == SECF_IGNOREHEIGHTSEC))
fakesector = nullptr;
bool fakeflooronly = fakesector && (fakesector->MoreFlags & SECF_FAKEFLOORONLY) != SECF_FAKEFLOORONLY;
FTextureID picnum;
bool ccw;
sector_t *frontsector;
if (ceiling && fakesector && ViewPos.Z < fakesector->floorplane.Zat0())
{
picnum = fakesector->GetTexture(sector_t::ceiling);
ccw = false;
ceiling = false;
frontsector = fakesector;
}
else if (!ceiling && fakesector && ViewPos.Z >= fakesector->floorplane.Zat0())
{
picnum = fakesector->GetTexture(sector_t::ceiling);
ccw = true;
frontsector = fakesector;
}
else if (ceiling && fakesector && ViewPos.Z > fakesector->ceilingplane.Zat0() && !fakeflooronly)
{
picnum = fakesector->GetTexture(sector_t::floor);
ccw = true;
frontsector = fakesector;
}
else if (!ceiling && fakesector && ViewPos.Z <= fakesector->ceilingplane.Zat0() && !fakeflooronly)
{
picnum = fakesector->GetTexture(sector_t::floor);
ccw = false;
ceiling = true;
frontsector = fakesector;
}
else
{
picnum = sub->sector->GetTexture(ceiling ? sector_t::ceiling : sector_t::floor);
ccw = true;
frontsector = sub->sector;
}
FTextureID picnum = frontsector->GetTexture(ceiling ? sector_t::ceiling : sector_t::floor);
FTexture *tex = TexMan(picnum); FTexture *tex = TexMan(picnum);
if (tex->UseType == FTexture::TEX_Null) if (tex->UseType == FTexture::TEX_Null)
return; return;
@ -76,7 +115,7 @@ void RenderPolyPlane::Render(const TriMatrix &worldToClip, subsector_t *sub, uin
args.vinput = vertices; args.vinput = vertices;
args.vcount = sub->numlines; args.vcount = sub->numlines;
args.mode = TriangleDrawMode::Fan; args.mode = TriangleDrawMode::Fan;
args.ccw = true; args.ccw = ccw;
args.clipleft = 0; args.clipleft = 0;
args.cliptop = 0; args.cliptop = 0;
args.clipright = viewwidth; args.clipright = viewwidth;