mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 14:51:40 +00:00
Add missing segment clipping clamps for decals, sprites and wall sprites
This commit is contained in:
parent
9daec9dc46
commit
920b322d72
5 changed files with 17 additions and 15 deletions
|
@ -218,14 +218,6 @@ namespace swrenderer
|
|||
}
|
||||
}
|
||||
|
||||
// Clip sprite to drawseg
|
||||
x1 = MAX<int>(clipper->x1, x1);
|
||||
x2 = MIN<int>(clipper->x2, x2);
|
||||
if (x1 >= x2)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Prepare lighting
|
||||
ProjectedWallLight light;
|
||||
light.SetColormap(lightsector, curline);
|
||||
|
@ -250,7 +242,7 @@ namespace swrenderer
|
|||
if (visible)
|
||||
{
|
||||
thread->PrepareTexture(WallSpriteTile, decal->RenderStyle);
|
||||
drawerargs.DrawMasked(thread, zpos + WallSpriteTile->GetTopOffset(0) * decal->ScaleY, decal->ScaleY, decal->RenderFlags & RF_XFLIP, decal->RenderFlags & RF_YFLIP, WallC, light, WallSpriteTile, mfloorclip, mceilingclip, decal->RenderStyle);
|
||||
drawerargs.DrawMasked(thread, zpos + WallSpriteTile->GetTopOffset(0) * decal->ScaleY, decal->ScaleY, decal->RenderFlags & RF_XFLIP, decal->RenderFlags & RF_YFLIP, WallC, clipper->x1, clipper->x2, light, WallSpriteTile, mfloorclip, mceilingclip, decal->RenderStyle);
|
||||
}
|
||||
|
||||
// If this sprite is RF_CLIPFULL on a two-sided line, needrepeat will
|
||||
|
|
|
@ -274,7 +274,7 @@ namespace swrenderer
|
|||
mlight.SetSpriteLight();
|
||||
|
||||
drawerargs.SetBaseColormap(Light.BaseColormap);
|
||||
drawerargs.DrawMasked(thread, gzt - floorclip, SpriteScale, renderflags & RF_XFLIP, renderflags & RF_YFLIP, wallc, mlight, pic, portalfloorclip, mceilingclip, RenderStyle);
|
||||
drawerargs.DrawMasked(thread, gzt - floorclip, SpriteScale, renderflags & RF_XFLIP, renderflags & RF_YFLIP, wallc, x1, x2, mlight, pic, portalfloorclip, mceilingclip, RenderStyle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -199,6 +199,6 @@ namespace swrenderer
|
|||
}
|
||||
|
||||
drawerargs.SetBaseColormap(spr->Light.BaseColormap);
|
||||
drawerargs.DrawMasked(thread, spr->gzt, spr->yscale, spr->renderflags & RF_XFLIP, spr->renderflags & RF_YFLIP, spr->wallc, mlight, WallSpriteTile, floorclip, mceilingclip, spr->RenderStyle);
|
||||
drawerargs.DrawMasked(thread, spr->gzt, spr->yscale, spr->renderflags & RF_XFLIP, spr->renderflags & RF_YFLIP, spr->wallc, x1, x2, mlight, WallSpriteTile, floorclip, mceilingclip, spr->RenderStyle);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace swrenderer
|
|||
colfunc = &SWPixelFormatDrawers::DrawColumn;
|
||||
}
|
||||
|
||||
void SpriteDrawerArgs::DrawMasked(RenderThread* thread, double topZ, double scale, bool flipX, bool flipY, const FWallCoords& WallC, const ProjectedWallLight& light, FSoftwareTexture* tex, const short* mfloorclip, const short* mceilingclip, FRenderStyle style)
|
||||
void SpriteDrawerArgs::DrawMasked(RenderThread* thread, double topZ, double scale, bool flipX, bool flipY, const FWallCoords& WallC, int clipx1, int clipx2, const ProjectedWallLight& light, FSoftwareTexture* tex, const short* mfloorclip, const short* mceilingclip, FRenderStyle style)
|
||||
{
|
||||
auto viewport = thread->Viewport.get();
|
||||
auto cameraLight = CameraLight::Instance();
|
||||
|
@ -73,8 +73,10 @@ namespace swrenderer
|
|||
wpos += wstepX * 0.5f;
|
||||
upos += ustepX * 0.5f;
|
||||
|
||||
int x1 = WallC.sx1;
|
||||
int x2 = WallC.sx2;
|
||||
int x1 = MAX<int>(WallC.sx1, clipx1);
|
||||
int x2 = MIN<int>(WallC.sx2, clipx2);
|
||||
if (x1 >= x2)
|
||||
return;
|
||||
|
||||
float centerY = thread->Viewport->CenterY;
|
||||
topZ -= thread->Viewport->viewpoint.Pos.Z;
|
||||
|
@ -88,6 +90,14 @@ namespace swrenderer
|
|||
float lightpos = light.GetLightPos(x1);
|
||||
float lightstep = light.GetLightStep();
|
||||
|
||||
if (x1 > WallC.sx1)
|
||||
{
|
||||
int dx = x1 - WallC.sx1;
|
||||
upos += ustepX * dx;
|
||||
wpos += wstepX * dx;
|
||||
lightpos += lightstep * dx;
|
||||
}
|
||||
|
||||
dc_viewport = viewport;
|
||||
dc_textureheight = texheight;
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace swrenderer
|
|||
void SetSolidColor(int color) { dc_color = color; dc_color_bgra = GPalette.BaseColors[color]; }
|
||||
void SetDynamicLight(uint32_t color) { dynlightcolor = color; }
|
||||
|
||||
void DrawMasked(RenderThread* thread, double topZ, double scale, bool flipX, bool flipY, const FWallCoords& WallC, const ProjectedWallLight& light, FSoftwareTexture* texture, const short* mfloorclip, const short* mceilingclip, FRenderStyle style);
|
||||
void DrawMasked(RenderThread* thread, double topZ, double scale, bool flipX, bool flipY, const FWallCoords& WallC, int clipx1, int clipx2, const ProjectedWallLight& light, FSoftwareTexture* texture, const short* mfloorclip, const short* mceilingclip, FRenderStyle style);
|
||||
void DrawMasked2D(RenderThread *thread, double x0, double x1, double y0, double y1, FSoftwareTexture* texture, FRenderStyle style);
|
||||
void DrawVoxelBlocks(RenderThread *thread, const VoxelBlock *blocks, int blockcount);
|
||||
|
||||
|
|
Loading…
Reference in a new issue