mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-12-03 08:52:59 +00:00
Create ClipSegmentTopBottom function
This commit is contained in:
parent
8d25a6d8d4
commit
b5c5bd9a1c
2 changed files with 26 additions and 19 deletions
|
@ -309,8 +309,6 @@ namespace swrenderer
|
||||||
|
|
||||||
side_t *sidedef = mLineSegment->sidedef;
|
side_t *sidedef = mLineSegment->sidedef;
|
||||||
|
|
||||||
rw_light = rw_lightleft + rw_lightstep * (start - WallC.sx1);
|
|
||||||
|
|
||||||
RenderPortal *renderportal = Thread->Portal.get();
|
RenderPortal *renderportal = Thread->Portal.get();
|
||||||
|
|
||||||
DrawSegment *draw_segment = Thread->FrameMemory->NewObject<DrawSegment>();
|
DrawSegment *draw_segment = Thread->FrameMemory->NewObject<DrawSegment>();
|
||||||
|
@ -485,7 +483,7 @@ namespace swrenderer
|
||||||
draw_segment->iscalestep = 0;
|
draw_segment->iscalestep = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
draw_segment->light = rw_light;
|
draw_segment->light = rw_lightleft + rw_lightstep * (start - WallC.sx1);
|
||||||
draw_segment->lightstep = rw_lightstep;
|
draw_segment->lightstep = rw_lightstep;
|
||||||
|
|
||||||
// Masked mMiddlePart.Textures should get the light level from the sector they reference,
|
// Masked mMiddlePart.Textures should get the light level from the sector they reference,
|
||||||
|
@ -519,6 +517,7 @@ namespace swrenderer
|
||||||
mFloorPlane = Thread->PlaneList->GetRange(mFloorPlane, start, stop);
|
mFloorPlane = Thread->PlaneList->GetRange(mFloorPlane, start, stop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ClipSegmentTopBottom(start, stop);
|
||||||
RenderWallSegmentTextures(start, stop);
|
RenderWallSegmentTextures(start, stop);
|
||||||
|
|
||||||
if (clip3d->fake3D & FAKE3D_FAKEMASK)
|
if (clip3d->fake3D & FAKE3D_FAKEMASK)
|
||||||
|
@ -958,6 +957,24 @@ namespace swrenderer
|
||||||
front->ColorMap->Fade != back->ColorMap->Fade &&
|
front->ColorMap->Fade != back->ColorMap->Fade &&
|
||||||
(front->GetTexture(sector_t::ceiling) != skyflatnum || back->GetTexture(sector_t::ceiling) != skyflatnum);
|
(front->GetTexture(sector_t::ceiling) != skyflatnum || back->GetTexture(sector_t::ceiling) != skyflatnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SWRenderLine::ClipSegmentTopBottom(int x1, int x2)
|
||||||
|
{
|
||||||
|
// clip wall to the floor and ceiling
|
||||||
|
auto ceilingclip = Thread->OpaquePass->ceilingclip;
|
||||||
|
auto floorclip = Thread->OpaquePass->floorclip;
|
||||||
|
for (int x = x1; x < x2; ++x)
|
||||||
|
{
|
||||||
|
if (walltop.ScreenY[x] < ceilingclip[x])
|
||||||
|
{
|
||||||
|
walltop.ScreenY[x] = ceilingclip[x];
|
||||||
|
}
|
||||||
|
if (wallbottom.ScreenY[x] > floorclip[x])
|
||||||
|
{
|
||||||
|
wallbottom.ScreenY[x] = floorclip[x];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Draws zero, one, or two textures for walls.
|
// Draws zero, one, or two textures for walls.
|
||||||
// Can draw or mark the starting pixel of floor and ceiling textures.
|
// Can draw or mark the starting pixel of floor and ceiling textures.
|
||||||
|
@ -966,6 +983,9 @@ namespace swrenderer
|
||||||
int x;
|
int x;
|
||||||
double xscale;
|
double xscale;
|
||||||
double yscale;
|
double yscale;
|
||||||
|
|
||||||
|
auto ceilingclip = Thread->OpaquePass->ceilingclip;
|
||||||
|
auto floorclip = Thread->OpaquePass->floorclip;
|
||||||
|
|
||||||
WallDrawerArgs drawerargs;
|
WallDrawerArgs drawerargs;
|
||||||
|
|
||||||
|
@ -977,21 +997,8 @@ namespace swrenderer
|
||||||
else if (cameraLight->FixedColormap() != nullptr)
|
else if (cameraLight->FixedColormap() != nullptr)
|
||||||
drawerargs.SetLight(cameraLight->FixedColormap(), 0, 0);
|
drawerargs.SetLight(cameraLight->FixedColormap(), 0, 0);
|
||||||
|
|
||||||
// clip wall to the floor and ceiling
|
float rw_light = rw_lightleft + rw_lightstep * (x1 - WallC.sx1);
|
||||||
auto ceilingclip = Thread->OpaquePass->ceilingclip;
|
|
||||||
auto floorclip = Thread->OpaquePass->floorclip;
|
|
||||||
for (x = x1; x < x2; ++x)
|
|
||||||
{
|
|
||||||
if (walltop.ScreenY[x] < ceilingclip[x])
|
|
||||||
{
|
|
||||||
walltop.ScreenY[x] = ceilingclip[x];
|
|
||||||
}
|
|
||||||
if (wallbottom.ScreenY[x] > floorclip[x])
|
|
||||||
{
|
|
||||||
wallbottom.ScreenY[x] = floorclip[x];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Clip3DFloors *clip3d = Thread->Clip3D.get();
|
Clip3DFloors *clip3d = Thread->Clip3D.get();
|
||||||
|
|
||||||
// mark ceiling areas
|
// mark ceiling areas
|
||||||
|
|
|
@ -69,6 +69,7 @@ namespace swrenderer
|
||||||
private:
|
private:
|
||||||
bool RenderWallSegment(int x1, int x2) override;
|
bool RenderWallSegment(int x1, int x2) override;
|
||||||
void SetWallVariables(bool needlights);
|
void SetWallVariables(bool needlights);
|
||||||
|
void ClipSegmentTopBottom(int x1, int x2);
|
||||||
void RenderWallSegmentTextures(int x1, int x2);
|
void RenderWallSegmentTextures(int x1, int x2);
|
||||||
|
|
||||||
bool IsFogBoundary(sector_t *front, sector_t *back) const;
|
bool IsFogBoundary(sector_t *front, sector_t *back) const;
|
||||||
|
@ -113,7 +114,6 @@ namespace swrenderer
|
||||||
bool rw_prepped;
|
bool rw_prepped;
|
||||||
|
|
||||||
int wallshade;
|
int wallshade;
|
||||||
float rw_light;
|
|
||||||
float rw_lightstep;
|
float rw_lightstep;
|
||||||
float rw_lightleft;
|
float rw_lightleft;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue