mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-15 00:51:24 +00:00
Removed dc_texturemid
This commit is contained in:
parent
bd8d2f501f
commit
9723078121
12 changed files with 90 additions and 95 deletions
|
@ -56,8 +56,6 @@ CVAR(Bool, r_dynlights, 1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
|
||||||
|
|
||||||
namespace swrenderer
|
namespace swrenderer
|
||||||
{
|
{
|
||||||
double dc_texturemid;
|
|
||||||
|
|
||||||
int ylookup[MAXHEIGHT];
|
int ylookup[MAXHEIGHT];
|
||||||
uint8_t shadetables[NUMCOLORMAPS * 16 * 256];
|
uint8_t shadetables[NUMCOLORMAPS * 16 * 256];
|
||||||
FDynamicColormap ShadeFakeColormap[16];
|
FDynamicColormap ShadeFakeColormap[16];
|
||||||
|
|
|
@ -35,8 +35,6 @@ namespace swrenderer
|
||||||
bool simple_shade;
|
bool simple_shade;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern double dc_texturemid;
|
|
||||||
|
|
||||||
namespace drawerargs
|
namespace drawerargs
|
||||||
{
|
{
|
||||||
extern int dc_pitch;
|
extern int dc_pitch;
|
||||||
|
|
|
@ -1059,7 +1059,6 @@ namespace swrenderer
|
||||||
{ // one sided line
|
{ // one sided line
|
||||||
if (midtexture->UseType != FTexture::TEX_Null && viewactive)
|
if (midtexture->UseType != FTexture::TEX_Null && viewactive)
|
||||||
{
|
{
|
||||||
dc_texturemid = rw_midtexturemid;
|
|
||||||
rw_pic = midtexture;
|
rw_pic = midtexture;
|
||||||
xscale = rw_pic->Scale.X * rw_midtexturescalex;
|
xscale = rw_pic->Scale.X * rw_midtexturescalex;
|
||||||
yscale = rw_pic->Scale.Y * rw_midtexturescaley;
|
yscale = rw_pic->Scale.Y * rw_midtexturescaley;
|
||||||
|
@ -1080,7 +1079,7 @@ namespace swrenderer
|
||||||
{
|
{
|
||||||
rw_offset = -rw_offset;
|
rw_offset = -rw_offset;
|
||||||
}
|
}
|
||||||
R_DrawWallSegment(frontsector, curline, WallC, rw_pic, x1, x2, walltop, wallbottom, swall, lwall, yscale, MAX(rw_frontcz1, rw_frontcz2), MIN(rw_frontfz1, rw_frontfz2), false, wallshade, rw_offset, rw_light, rw_lightstep, light_list, foggy, basecolormap);
|
R_DrawWallSegment(frontsector, curline, WallC, rw_pic, x1, x2, walltop, wallbottom, rw_midtexturemid, swall, lwall, yscale, MAX(rw_frontcz1, rw_frontcz2), MIN(rw_frontfz1, rw_frontfz2), false, wallshade, rw_offset, rw_light, rw_lightstep, light_list, foggy, basecolormap);
|
||||||
}
|
}
|
||||||
fillshort(ceilingclip + x1, x2 - x1, viewheight);
|
fillshort(ceilingclip + x1, x2 - x1, viewheight);
|
||||||
fillshort(floorclip + x1, x2 - x1, 0xffff);
|
fillshort(floorclip + x1, x2 - x1, 0xffff);
|
||||||
|
@ -1095,7 +1094,6 @@ namespace swrenderer
|
||||||
}
|
}
|
||||||
if (viewactive)
|
if (viewactive)
|
||||||
{
|
{
|
||||||
dc_texturemid = rw_toptexturemid;
|
|
||||||
rw_pic = toptexture;
|
rw_pic = toptexture;
|
||||||
xscale = rw_pic->Scale.X * rw_toptexturescalex;
|
xscale = rw_pic->Scale.X * rw_toptexturescalex;
|
||||||
yscale = rw_pic->Scale.Y * rw_toptexturescaley;
|
yscale = rw_pic->Scale.Y * rw_toptexturescaley;
|
||||||
|
@ -1116,7 +1114,7 @@ namespace swrenderer
|
||||||
{
|
{
|
||||||
rw_offset = -rw_offset;
|
rw_offset = -rw_offset;
|
||||||
}
|
}
|
||||||
R_DrawWallSegment(frontsector, curline, WallC, rw_pic, x1, x2, walltop, wallupper, swall, lwall, yscale, MAX(rw_frontcz1, rw_frontcz2), MIN(rw_backcz1, rw_backcz2), false, wallshade, rw_offset, rw_light, rw_lightstep, light_list, foggy, basecolormap);
|
R_DrawWallSegment(frontsector, curline, WallC, rw_pic, x1, x2, walltop, wallupper, rw_toptexturemid, swall, lwall, yscale, MAX(rw_frontcz1, rw_frontcz2), MIN(rw_backcz1, rw_backcz2), false, wallshade, rw_offset, rw_light, rw_lightstep, light_list, foggy, basecolormap);
|
||||||
}
|
}
|
||||||
memcpy(ceilingclip + x1, wallupper + x1, (x2 - x1) * sizeof(short));
|
memcpy(ceilingclip + x1, wallupper + x1, (x2 - x1) * sizeof(short));
|
||||||
}
|
}
|
||||||
|
@ -1134,7 +1132,6 @@ namespace swrenderer
|
||||||
}
|
}
|
||||||
if (viewactive)
|
if (viewactive)
|
||||||
{
|
{
|
||||||
dc_texturemid = rw_bottomtexturemid;
|
|
||||||
rw_pic = bottomtexture;
|
rw_pic = bottomtexture;
|
||||||
xscale = rw_pic->Scale.X * rw_bottomtexturescalex;
|
xscale = rw_pic->Scale.X * rw_bottomtexturescalex;
|
||||||
yscale = rw_pic->Scale.Y * rw_bottomtexturescaley;
|
yscale = rw_pic->Scale.Y * rw_bottomtexturescaley;
|
||||||
|
@ -1155,7 +1152,7 @@ namespace swrenderer
|
||||||
{
|
{
|
||||||
rw_offset = -rw_offset;
|
rw_offset = -rw_offset;
|
||||||
}
|
}
|
||||||
R_DrawWallSegment(frontsector, curline, WallC, rw_pic, x1, x2, walllower, wallbottom, swall, lwall, yscale, MAX(rw_backfz1, rw_backfz2), MIN(rw_frontfz1, rw_frontfz2), false, wallshade, rw_offset, rw_light, rw_lightstep, light_list, foggy, basecolormap);
|
R_DrawWallSegment(frontsector, curline, WallC, rw_pic, x1, x2, walllower, wallbottom, rw_bottomtexturemid, swall, lwall, yscale, MAX(rw_backfz1, rw_backfz2), MIN(rw_frontfz1, rw_frontfz2), false, wallshade, rw_offset, rw_light, rw_lightstep, light_list, foggy, basecolormap);
|
||||||
}
|
}
|
||||||
memcpy(floorclip + x1, walllower + x1, (x2 - x1) * sizeof(short));
|
memcpy(floorclip + x1, walllower + x1, (x2 - x1) * sizeof(short));
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ namespace swrenderer
|
||||||
return tex->GetColumn(col, nullptr);
|
return tex->GetColumn(col, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
WallSampler::WallSampler(int y1, float swal, double yrepeat, fixed_t xoffset, double xmagnitude, FTexture *texture, const BYTE*(*getcol)(FTexture *texture, int x))
|
WallSampler::WallSampler(int y1, double texturemid, float swal, double yrepeat, fixed_t xoffset, double xmagnitude, FTexture *texture, const BYTE*(*getcol)(FTexture *texture, int x))
|
||||||
{
|
{
|
||||||
xoffset += FLOAT2FIXED(xmagnitude * 0.5);
|
xoffset += FLOAT2FIXED(xmagnitude * 0.5);
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ namespace swrenderer
|
||||||
// Find start uv in [0-base_height[ range.
|
// Find start uv in [0-base_height[ range.
|
||||||
// Not using xs_ToFixed because it rounds the result and we need something that always rounds down to stay within the range.
|
// Not using xs_ToFixed because it rounds the result and we need something that always rounds down to stay within the range.
|
||||||
double uv_stepd = swal * yrepeat;
|
double uv_stepd = swal * yrepeat;
|
||||||
double v = (dc_texturemid + uv_stepd * (y1 - CenterY + 0.5)) / height;
|
double v = (texturemid + uv_stepd * (y1 - CenterY + 0.5)) / height;
|
||||||
v = v - floor(v);
|
v = v - floor(v);
|
||||||
v *= height;
|
v *= height;
|
||||||
v *= (1 << uv_fracbits);
|
v *= (1 << uv_fracbits);
|
||||||
|
@ -117,7 +117,7 @@ namespace swrenderer
|
||||||
{
|
{
|
||||||
// Normalize to 0-1 range:
|
// Normalize to 0-1 range:
|
||||||
double uv_stepd = swal * yrepeat;
|
double uv_stepd = swal * yrepeat;
|
||||||
double v = (dc_texturemid + uv_stepd * (y1 - CenterY + 0.5)) / texture->GetHeight();
|
double v = (texturemid + uv_stepd * (y1 - CenterY + 0.5)) / texture->GetHeight();
|
||||||
v = v - floor(v);
|
v = v - floor(v);
|
||||||
double v_step = uv_stepd / texture->GetHeight();
|
double v_step = uv_stepd / texture->GetHeight();
|
||||||
|
|
||||||
|
@ -337,7 +337,7 @@ namespace swrenderer
|
||||||
|
|
||||||
static void ProcessWallWorker(
|
static void ProcessWallWorker(
|
||||||
const FWallCoords &WallC,
|
const FWallCoords &WallC,
|
||||||
int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, int wallshade, fixed_t xoffset, float light, float lightstep, FDynamicColormap *basecolormap,
|
int x1, int x2, short *uwal, short *dwal, double texturemid, float *swal, fixed_t *lwal, double yrepeat, int wallshade, fixed_t xoffset, float light, float lightstep, FDynamicColormap *basecolormap,
|
||||||
FLightNode *light_list,
|
FLightNode *light_list,
|
||||||
const BYTE *(*getcol)(FTexture *tex, int x), DrawerFunc drawcolumn)
|
const BYTE *(*getcol)(FTexture *tex, int x), DrawerFunc drawcolumn)
|
||||||
{
|
{
|
||||||
|
@ -350,7 +350,7 @@ namespace swrenderer
|
||||||
{ // Hack for one pixel tall textures
|
{ // Hack for one pixel tall textures
|
||||||
fracbits = 0;
|
fracbits = 0;
|
||||||
yrepeat = 0;
|
yrepeat = 0;
|
||||||
dc_texturemid = 0;
|
texturemid = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
dc_wall_fracbits = r_swtruecolor ? FRACBITS : fracbits;
|
dc_wall_fracbits = r_swtruecolor ? FRACBITS : fracbits;
|
||||||
|
@ -394,45 +394,45 @@ namespace swrenderer
|
||||||
|
|
||||||
if (x + 1 < x2) xmagnitude = fabs(FIXED2DBL(lwal[x + 1]) - FIXED2DBL(lwal[x]));
|
if (x + 1 < x2) xmagnitude = fabs(FIXED2DBL(lwal[x + 1]) - FIXED2DBL(lwal[x]));
|
||||||
|
|
||||||
WallSampler sampler(y1, swal[x], yrepeat, lwal[x] + xoffset, xmagnitude, rw_pic, getcol);
|
WallSampler sampler(y1, texturemid, swal[x], yrepeat, lwal[x] + xoffset, xmagnitude, rw_pic, getcol);
|
||||||
Draw1Column(WallC, x, y1, y2, sampler, light_list, drawcolumn);
|
Draw1Column(WallC, x, y1, y2, sampler, light_list, drawcolumn);
|
||||||
}
|
}
|
||||||
|
|
||||||
NetUpdate();
|
NetUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ProcessNormalWall(const FWallCoords &WallC, int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, int wallshade, fixed_t xoffset, float light, float lightstep, FDynamicColormap *basecolormap, FLightNode *light_list, const BYTE *(*getcol)(FTexture *tex, int x) = R_GetColumn)
|
static void ProcessNormalWall(const FWallCoords &WallC, int x1, int x2, short *uwal, short *dwal, double texturemid, float *swal, fixed_t *lwal, double yrepeat, int wallshade, fixed_t xoffset, float light, float lightstep, FDynamicColormap *basecolormap, FLightNode *light_list, const BYTE *(*getcol)(FTexture *tex, int x) = R_GetColumn)
|
||||||
{
|
{
|
||||||
ProcessWallWorker(WallC, x1, x2, uwal, dwal, swal, lwal, yrepeat, wallshade, xoffset, light, lightstep, basecolormap, light_list, getcol, &SWPixelFormatDrawers::DrawWallColumn);
|
ProcessWallWorker(WallC, x1, x2, uwal, dwal, texturemid, swal, lwal, yrepeat, wallshade, xoffset, light, lightstep, basecolormap, light_list, getcol, &SWPixelFormatDrawers::DrawWallColumn);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ProcessMaskedWall(const FWallCoords &WallC, int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, int wallshade, fixed_t xoffset, float light, float lightstep, FDynamicColormap *basecolormap, FLightNode *light_list, const BYTE *(*getcol)(FTexture *tex, int x) = R_GetColumn)
|
static void ProcessMaskedWall(const FWallCoords &WallC, int x1, int x2, short *uwal, short *dwal, double texturemid, float *swal, fixed_t *lwal, double yrepeat, int wallshade, fixed_t xoffset, float light, float lightstep, FDynamicColormap *basecolormap, FLightNode *light_list, const BYTE *(*getcol)(FTexture *tex, int x) = R_GetColumn)
|
||||||
{
|
{
|
||||||
if (!rw_pic->bMasked) // Textures that aren't masked can use the faster ProcessNormalWall.
|
if (!rw_pic->bMasked) // Textures that aren't masked can use the faster ProcessNormalWall.
|
||||||
{
|
{
|
||||||
ProcessNormalWall(WallC, x1, x2, uwal, dwal, swal, lwal, yrepeat, wallshade, xoffset, light, lightstep, basecolormap, light_list, getcol);
|
ProcessNormalWall(WallC, x1, x2, uwal, dwal, texturemid, swal, lwal, yrepeat, wallshade, xoffset, light, lightstep, basecolormap, light_list, getcol);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ProcessWallWorker(WallC, x1, x2, uwal, dwal, swal, lwal, yrepeat, wallshade, xoffset, light, lightstep, basecolormap, light_list, getcol, &SWPixelFormatDrawers::DrawWallMaskedColumn);
|
ProcessWallWorker(WallC, x1, x2, uwal, dwal, texturemid, swal, lwal, yrepeat, wallshade, xoffset, light, lightstep, basecolormap, light_list, getcol, &SWPixelFormatDrawers::DrawWallMaskedColumn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ProcessTranslucentWall(const FWallCoords &WallC, int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, int wallshade, fixed_t xoffset, float light, float lightstep, FDynamicColormap *basecolormap, FLightNode *light_list, const BYTE *(*getcol)(FTexture *tex, int x) = R_GetColumn)
|
static void ProcessTranslucentWall(const FWallCoords &WallC, int x1, int x2, short *uwal, short *dwal, double texturemid, float *swal, fixed_t *lwal, double yrepeat, int wallshade, fixed_t xoffset, float light, float lightstep, FDynamicColormap *basecolormap, FLightNode *light_list, const BYTE *(*getcol)(FTexture *tex, int x) = R_GetColumn)
|
||||||
{
|
{
|
||||||
DrawerFunc drawcol1 = R_GetTransMaskDrawer();
|
DrawerFunc drawcol1 = R_GetTransMaskDrawer();
|
||||||
if (drawcol1 == nullptr)
|
if (drawcol1 == nullptr)
|
||||||
{
|
{
|
||||||
// The current translucency is unsupported, so draw with regular ProcessMaskedWall instead.
|
// The current translucency is unsupported, so draw with regular ProcessMaskedWall instead.
|
||||||
ProcessMaskedWall(WallC, x1, x2, uwal, dwal, swal, lwal, yrepeat, wallshade, xoffset, light, lightstep, basecolormap, light_list, getcol);
|
ProcessMaskedWall(WallC, x1, x2, uwal, dwal, texturemid, swal, lwal, yrepeat, wallshade, xoffset, light, lightstep, basecolormap, light_list, getcol);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ProcessWallWorker(WallC, x1, x2, uwal, dwal, swal, lwal, yrepeat, wallshade, xoffset, light, lightstep, basecolormap, light_list, getcol, drawcol1);
|
ProcessWallWorker(WallC, x1, x2, uwal, dwal, texturemid, swal, lwal, yrepeat, wallshade, xoffset, light, lightstep, basecolormap, light_list, getcol, drawcol1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ProcessStripedWall(sector_t *frontsector, seg_t *curline, const FWallCoords &WallC, int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, int wallshade, fixed_t xoffset, float light, float lightstep, bool foggy, FDynamicColormap *basecolormap, FLightNode *light_list)
|
static void ProcessStripedWall(sector_t *frontsector, seg_t *curline, const FWallCoords &WallC, int x1, int x2, short *uwal, short *dwal, double texturemid, float *swal, fixed_t *lwal, double yrepeat, int wallshade, fixed_t xoffset, float light, float lightstep, bool foggy, FDynamicColormap *basecolormap, FLightNode *light_list)
|
||||||
{
|
{
|
||||||
short most1[MAXWIDTH], most2[MAXWIDTH], most3[MAXWIDTH];
|
short most1[MAXWIDTH], most2[MAXWIDTH], most3[MAXWIDTH];
|
||||||
short *up, *down;
|
short *up, *down;
|
||||||
|
@ -455,7 +455,7 @@ namespace swrenderer
|
||||||
{
|
{
|
||||||
down[j] = clamp(most3[j], up[j], dwal[j]);
|
down[j] = clamp(most3[j], up[j], dwal[j]);
|
||||||
}
|
}
|
||||||
ProcessNormalWall(WallC, x1, x2, up, down, swal, lwal, yrepeat, wallshade, xoffset, light, lightstep, basecolormap, light_list);
|
ProcessNormalWall(WallC, x1, x2, up, down, texturemid, swal, lwal, yrepeat, wallshade, xoffset, light, lightstep, basecolormap, light_list);
|
||||||
up = down;
|
up = down;
|
||||||
down = (down == most1) ? most2 : most1;
|
down = (down == most1) ? most2 : most1;
|
||||||
}
|
}
|
||||||
|
@ -465,31 +465,31 @@ namespace swrenderer
|
||||||
wallshade = LIGHT2SHADE(curline->sidedef->GetLightLevel(foggy, *lit->p_lightlevel, lit->lightsource != NULL) + R_ActualExtraLight(foggy));
|
wallshade = LIGHT2SHADE(curline->sidedef->GetLightLevel(foggy, *lit->p_lightlevel, lit->lightsource != NULL) + R_ActualExtraLight(foggy));
|
||||||
}
|
}
|
||||||
|
|
||||||
ProcessNormalWall(WallC, x1, x2, up, dwal, swal, lwal, yrepeat, wallshade, xoffset, light, lightstep, basecolormap, light_list);
|
ProcessNormalWall(WallC, x1, x2, up, dwal, texturemid, swal, lwal, yrepeat, wallshade, xoffset, light, lightstep, basecolormap, light_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ProcessWall(sector_t *frontsector, seg_t *curline, const FWallCoords &WallC, int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, int wallshade, fixed_t xoffset, float light, float lightstep, bool mask, bool foggy, FDynamicColormap *basecolormap, FLightNode *light_list)
|
static void ProcessWall(sector_t *frontsector, seg_t *curline, const FWallCoords &WallC, int x1, int x2, short *uwal, short *dwal, double texturemid, float *swal, fixed_t *lwal, double yrepeat, int wallshade, fixed_t xoffset, float light, float lightstep, bool mask, bool foggy, FDynamicColormap *basecolormap, FLightNode *light_list)
|
||||||
{
|
{
|
||||||
if (mask)
|
if (mask)
|
||||||
{
|
{
|
||||||
if (colfunc == basecolfunc)
|
if (colfunc == basecolfunc)
|
||||||
{
|
{
|
||||||
ProcessMaskedWall(WallC, x1, x2, uwal, dwal, swal, lwal, yrepeat, wallshade, xoffset, light, lightstep, basecolormap, light_list);
|
ProcessMaskedWall(WallC, x1, x2, uwal, dwal, texturemid, swal, lwal, yrepeat, wallshade, xoffset, light, lightstep, basecolormap, light_list);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ProcessTranslucentWall(WallC, x1, x2, uwal, dwal, swal, lwal, yrepeat, wallshade, xoffset, light, lightstep, basecolormap, light_list);
|
ProcessTranslucentWall(WallC, x1, x2, uwal, dwal, texturemid, swal, lwal, yrepeat, wallshade, xoffset, light, lightstep, basecolormap, light_list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (fixedcolormap != NULL || fixedlightlev >= 0 || !(frontsector->e && frontsector->e->XFloor.lightlist.Size()))
|
if (fixedcolormap != NULL || fixedlightlev >= 0 || !(frontsector->e && frontsector->e->XFloor.lightlist.Size()))
|
||||||
{
|
{
|
||||||
ProcessNormalWall(WallC, x1, x2, uwal, dwal, swal, lwal, yrepeat, wallshade, xoffset, light, lightstep, basecolormap, light_list);
|
ProcessNormalWall(WallC, x1, x2, uwal, dwal, texturemid, swal, lwal, yrepeat, wallshade, xoffset, light, lightstep, basecolormap, light_list);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ProcessStripedWall(frontsector, curline, WallC, x1, x2, uwal, dwal, swal, lwal, yrepeat, wallshade, xoffset, light, lightstep, foggy, basecolormap, light_list);
|
ProcessStripedWall(frontsector, curline, WallC, x1, x2, uwal, dwal, texturemid, swal, lwal, yrepeat, wallshade, xoffset, light, lightstep, foggy, basecolormap, light_list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -505,7 +505,7 @@ namespace swrenderer
|
||||||
//
|
//
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
static void ProcessWallNP2(sector_t *frontsector, seg_t *curline, const FWallCoords &WallC, int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, double top, double bot, int wallshade, fixed_t xoffset, float light, float lightstep, bool mask, bool foggy, FDynamicColormap *basecolormap, FLightNode *light_list)
|
static void ProcessWallNP2(sector_t *frontsector, seg_t *curline, const FWallCoords &WallC, int x1, int x2, short *uwal, short *dwal, double texturemid, float *swal, fixed_t *lwal, double yrepeat, double top, double bot, int wallshade, fixed_t xoffset, float light, float lightstep, bool mask, bool foggy, FDynamicColormap *basecolormap, FLightNode *light_list)
|
||||||
{
|
{
|
||||||
short most1[MAXWIDTH], most2[MAXWIDTH], most3[MAXWIDTH];
|
short most1[MAXWIDTH], most2[MAXWIDTH], most3[MAXWIDTH];
|
||||||
short *up, *down;
|
short *up, *down;
|
||||||
|
@ -515,14 +515,14 @@ namespace swrenderer
|
||||||
|
|
||||||
if (yrepeat >= 0)
|
if (yrepeat >= 0)
|
||||||
{ // normal orientation: draw strips from top to bottom
|
{ // normal orientation: draw strips from top to bottom
|
||||||
partition = top - fmod(top - dc_texturemid / yrepeat - ViewPos.Z, scaledtexheight);
|
partition = top - fmod(top - texturemid / yrepeat - ViewPos.Z, scaledtexheight);
|
||||||
if (partition == top)
|
if (partition == top)
|
||||||
{
|
{
|
||||||
partition -= scaledtexheight;
|
partition -= scaledtexheight;
|
||||||
}
|
}
|
||||||
up = uwal;
|
up = uwal;
|
||||||
down = most1;
|
down = most1;
|
||||||
dc_texturemid = (partition - ViewPos.Z) * yrepeat + texheight;
|
texturemid = (partition - ViewPos.Z) * yrepeat + texheight;
|
||||||
while (partition > bot)
|
while (partition > bot)
|
||||||
{
|
{
|
||||||
int j = R_CreateWallSegmentY(most3, partition - ViewPos.Z, &WallC);
|
int j = R_CreateWallSegmentY(most3, partition - ViewPos.Z, &WallC);
|
||||||
|
@ -532,21 +532,21 @@ namespace swrenderer
|
||||||
{
|
{
|
||||||
down[j] = clamp(most3[j], up[j], dwal[j]);
|
down[j] = clamp(most3[j], up[j], dwal[j]);
|
||||||
}
|
}
|
||||||
ProcessWall(frontsector, curline, WallC, x1, x2, up, down, swal, lwal, yrepeat, wallshade, xoffset, light, lightstep, mask, foggy, basecolormap, light_list);
|
ProcessWall(frontsector, curline, WallC, x1, x2, up, down, texturemid, swal, lwal, yrepeat, wallshade, xoffset, light, lightstep, mask, foggy, basecolormap, light_list);
|
||||||
up = down;
|
up = down;
|
||||||
down = (down == most1) ? most2 : most1;
|
down = (down == most1) ? most2 : most1;
|
||||||
}
|
}
|
||||||
partition -= scaledtexheight;
|
partition -= scaledtexheight;
|
||||||
dc_texturemid -= texheight;
|
texturemid -= texheight;
|
||||||
}
|
}
|
||||||
ProcessWall(frontsector, curline, WallC, x1, x2, up, dwal, swal, lwal, yrepeat, wallshade, xoffset, light, lightstep, mask, foggy, basecolormap, light_list);
|
ProcessWall(frontsector, curline, WallC, x1, x2, up, dwal, texturemid, swal, lwal, yrepeat, wallshade, xoffset, light, lightstep, mask, foggy, basecolormap, light_list);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // upside down: draw strips from bottom to top
|
{ // upside down: draw strips from bottom to top
|
||||||
partition = bot - fmod(bot - dc_texturemid / yrepeat - ViewPos.Z, scaledtexheight);
|
partition = bot - fmod(bot - texturemid / yrepeat - ViewPos.Z, scaledtexheight);
|
||||||
up = most1;
|
up = most1;
|
||||||
down = dwal;
|
down = dwal;
|
||||||
dc_texturemid = (partition - ViewPos.Z) * yrepeat + texheight;
|
texturemid = (partition - ViewPos.Z) * yrepeat + texheight;
|
||||||
while (partition < top)
|
while (partition < top)
|
||||||
{
|
{
|
||||||
int j = R_CreateWallSegmentY(most3, partition - ViewPos.Z, &WallC);
|
int j = R_CreateWallSegmentY(most3, partition - ViewPos.Z, &WallC);
|
||||||
|
@ -556,18 +556,18 @@ namespace swrenderer
|
||||||
{
|
{
|
||||||
up[j] = clamp(most3[j], uwal[j], down[j]);
|
up[j] = clamp(most3[j], uwal[j], down[j]);
|
||||||
}
|
}
|
||||||
ProcessWall(frontsector, curline, WallC, x1, x2, up, down, swal, lwal, yrepeat, wallshade, xoffset, light, lightstep, mask, foggy, basecolormap, light_list);
|
ProcessWall(frontsector, curline, WallC, x1, x2, up, down, texturemid, swal, lwal, yrepeat, wallshade, xoffset, light, lightstep, mask, foggy, basecolormap, light_list);
|
||||||
down = up;
|
down = up;
|
||||||
up = (up == most1) ? most2 : most1;
|
up = (up == most1) ? most2 : most1;
|
||||||
}
|
}
|
||||||
partition -= scaledtexheight;
|
partition -= scaledtexheight;
|
||||||
dc_texturemid -= texheight;
|
texturemid -= texheight;
|
||||||
}
|
}
|
||||||
ProcessWall(frontsector, curline, WallC, x1, x2, uwal, down, swal, lwal, yrepeat, wallshade, xoffset, light, lightstep, mask, foggy, basecolormap, light_list);
|
ProcessWall(frontsector, curline, WallC, x1, x2, uwal, down, texturemid, swal, lwal, yrepeat, wallshade, xoffset, light, lightstep, mask, foggy, basecolormap, light_list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_DrawDrawSeg(sector_t *frontsector, seg_t *curline, const FWallCoords &WallC, FTexture *pic, drawseg_t *ds, int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, int wallshade, fixed_t xoffset, float light, float lightstep, bool foggy, FDynamicColormap *basecolormap)
|
void R_DrawDrawSeg(sector_t *frontsector, seg_t *curline, const FWallCoords &WallC, FTexture *pic, drawseg_t *ds, int x1, int x2, short *uwal, short *dwal, double texturemid, float *swal, fixed_t *lwal, double yrepeat, int wallshade, fixed_t xoffset, float light, float lightstep, bool foggy, FDynamicColormap *basecolormap)
|
||||||
{
|
{
|
||||||
rw_pic = pic;
|
rw_pic = pic;
|
||||||
if (rw_pic->GetHeight() != 1 << rw_pic->HeightBits)
|
if (rw_pic->GetHeight() != 1 << rw_pic->HeightBits)
|
||||||
|
@ -587,32 +587,32 @@ namespace swrenderer
|
||||||
{
|
{
|
||||||
bot = MAX(bot, clip3d->sclipBottom);
|
bot = MAX(bot, clip3d->sclipBottom);
|
||||||
}
|
}
|
||||||
ProcessWallNP2(frontsector, curline, WallC, x1, x2, uwal, dwal, swal, lwal, yrepeat, top, bot, wallshade, xoffset, light, lightstep, true, foggy, basecolormap, nullptr);
|
ProcessWallNP2(frontsector, curline, WallC, x1, x2, uwal, dwal, texturemid, swal, lwal, yrepeat, top, bot, wallshade, xoffset, light, lightstep, true, foggy, basecolormap, nullptr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ProcessWall(frontsector, curline, WallC, x1, x2, uwal, dwal, swal, lwal, yrepeat, wallshade, xoffset, light, lightstep, true, foggy, basecolormap, nullptr);
|
ProcessWall(frontsector, curline, WallC, x1, x2, uwal, dwal, texturemid, swal, lwal, yrepeat, wallshade, xoffset, light, lightstep, true, foggy, basecolormap, nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void R_DrawWallSegment(sector_t *frontsector, seg_t *curline, const FWallCoords &WallC, FTexture *pic, int x1, int x2, short *walltop, short *wallbottom, float *swall, fixed_t *lwall, double yscale, double top, double bottom, bool mask, int wallshade, fixed_t xoffset, float light, float lightstep, FLightNode *light_list, bool foggy, FDynamicColormap *basecolormap)
|
void R_DrawWallSegment(sector_t *frontsector, seg_t *curline, const FWallCoords &WallC, FTexture *pic, int x1, int x2, short *walltop, short *wallbottom, double texturemid, float *swall, fixed_t *lwall, double yscale, double top, double bottom, bool mask, int wallshade, fixed_t xoffset, float light, float lightstep, FLightNode *light_list, bool foggy, FDynamicColormap *basecolormap)
|
||||||
{
|
{
|
||||||
rw_pic = pic;
|
rw_pic = pic;
|
||||||
if (rw_pic->GetHeight() != 1 << rw_pic->HeightBits)
|
if (rw_pic->GetHeight() != 1 << rw_pic->HeightBits)
|
||||||
{
|
{
|
||||||
ProcessWallNP2(frontsector, curline, WallC, x1, x2, walltop, wallbottom, swall, lwall, yscale, top, bottom, wallshade, xoffset, light, lightstep, false, foggy, basecolormap, light_list);
|
ProcessWallNP2(frontsector, curline, WallC, x1, x2, walltop, wallbottom, texturemid, swall, lwall, yscale, top, bottom, wallshade, xoffset, light, lightstep, false, foggy, basecolormap, light_list);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ProcessWall(frontsector, curline, WallC, x1, x2, walltop, wallbottom, swall, lwall, yscale, wallshade, xoffset, light, lightstep, false, foggy, basecolormap, light_list);
|
ProcessWall(frontsector, curline, WallC, x1, x2, walltop, wallbottom, texturemid, swall, lwall, yscale, wallshade, xoffset, light, lightstep, false, foggy, basecolormap, light_list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_DrawSkySegment(FTexture *pic, int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, int wallshade, fixed_t xoffset, float light, float lightstep, FDynamicColormap *basecolormap, const uint8_t *(*getcol)(FTexture *tex, int x))
|
void R_DrawSkySegment(FTexture *pic, int x1, int x2, short *uwal, short *dwal, double texturemid, float *swal, fixed_t *lwal, double yrepeat, int wallshade, fixed_t xoffset, float light, float lightstep, FDynamicColormap *basecolormap, const uint8_t *(*getcol)(FTexture *tex, int x))
|
||||||
{
|
{
|
||||||
rw_pic = pic;
|
rw_pic = pic;
|
||||||
FWallCoords wallC; // Not used. To do: don't use r_walldraw to draw the sky!!
|
FWallCoords wallC; // Not used. To do: don't use r_walldraw to draw the sky!!
|
||||||
ProcessNormalWall(wallC, x1, x2, uwal, dwal, swal, lwal, yrepeat, wallshade, xoffset, light, lightstep, basecolormap, nullptr, getcol);
|
ProcessNormalWall(wallC, x1, x2, uwal, dwal, texturemid, swal, lwal, yrepeat, wallshade, xoffset, light, lightstep, basecolormap, nullptr, getcol);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace swrenderer
|
||||||
struct WallSampler
|
struct WallSampler
|
||||||
{
|
{
|
||||||
WallSampler() { }
|
WallSampler() { }
|
||||||
WallSampler(int y1, float swal, double yrepeat, fixed_t xoffset, double xmagnitude, FTexture *texture, const BYTE*(*getcol)(FTexture *texture, int x));
|
WallSampler(int y1, double texturemid, float swal, double yrepeat, fixed_t xoffset, double xmagnitude, FTexture *texture, const BYTE*(*getcol)(FTexture *texture, int x));
|
||||||
|
|
||||||
uint32_t uv_pos;
|
uint32_t uv_pos;
|
||||||
uint32_t uv_step;
|
uint32_t uv_step;
|
||||||
|
@ -37,7 +37,7 @@ namespace swrenderer
|
||||||
uint32_t height;
|
uint32_t height;
|
||||||
};
|
};
|
||||||
|
|
||||||
void R_DrawWallSegment(sector_t *frontsector, seg_t *curline, const FWallCoords &WallC, FTexture *rw_pic, int x1, int x2, short *walltop, short *wallbottom, float *swall, fixed_t *lwall, double yscale, double top, double bottom, bool mask, int wallshade, fixed_t xoffset, float light, float lightstep, FLightNode *light_list, bool foggy, FDynamicColormap *basecolormap);
|
void R_DrawWallSegment(sector_t *frontsector, seg_t *curline, const FWallCoords &WallC, FTexture *rw_pic, int x1, int x2, short *walltop, short *wallbottom, double texturemid, float *swall, fixed_t *lwall, double yscale, double top, double bottom, bool mask, int wallshade, fixed_t xoffset, float light, float lightstep, FLightNode *light_list, bool foggy, FDynamicColormap *basecolormap);
|
||||||
void R_DrawSkySegment(FTexture *rw_pic, int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, int wallshade, fixed_t xoffset, float light, float lightstep, FDynamicColormap *basecolormap, const uint8_t *(*getcol)(FTexture *tex, int col));
|
void R_DrawSkySegment(FTexture *rw_pic, int x1, int x2, short *uwal, short *dwal, double texturemid, float *swal, fixed_t *lwal, double yrepeat, int wallshade, fixed_t xoffset, float light, float lightstep, FDynamicColormap *basecolormap, const uint8_t *(*getcol)(FTexture *tex, int col));
|
||||||
void R_DrawDrawSeg(sector_t *frontsector, seg_t *curline, const FWallCoords &WallC, FTexture *rw_pic, drawseg_t *ds, int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, int wallshade, fixed_t xoffset, float light, float lightstep, bool foggy, FDynamicColormap *basecolormap);
|
void R_DrawDrawSeg(sector_t *frontsector, seg_t *curline, const FWallCoords &WallC, FTexture *rw_pic, drawseg_t *ds, int x1, int x2, short *uwal, short *dwal, double texturemid, float *swal, fixed_t *lwal, double yrepeat, int wallshade, fixed_t xoffset, float light, float lightstep, bool foggy, FDynamicColormap *basecolormap);
|
||||||
}
|
}
|
||||||
|
|
|
@ -436,7 +436,7 @@ namespace swrenderer
|
||||||
}
|
}
|
||||||
|
|
||||||
frontyScale = frontskytex->Scale.Y;
|
frontyScale = frontskytex->Scale.Y;
|
||||||
dc_texturemid = skymid * frontyScale;
|
double texturemid = skymid * frontyScale;
|
||||||
|
|
||||||
if (1 << frontskytex->HeightBits == frontskytex->GetHeight())
|
if (1 << frontskytex->HeightBits == frontskytex->GetHeight())
|
||||||
{ // The texture tiles nicely
|
{ // The texture tiles nicely
|
||||||
|
@ -445,7 +445,7 @@ namespace swrenderer
|
||||||
lastskycol[x] = 0xffffffff;
|
lastskycol[x] = 0xffffffff;
|
||||||
lastskycol_bgra[x] = 0xffffffff;
|
lastskycol_bgra[x] = 0xffffffff;
|
||||||
}
|
}
|
||||||
R_DrawSkySegment(frontskytex, pl->left, pl->right, (short *)pl->top, (short *)pl->bottom, swall, lwall,
|
R_DrawSkySegment(frontskytex, pl->left, pl->right, (short *)pl->top, (short *)pl->bottom, texturemid, swall, lwall,
|
||||||
frontyScale, 0, 0, 0.0f, 0.0f, nullptr, backskytex == nullptr ? RenderSkyPlane::GetOneSkyColumn : RenderSkyPlane::GetTwoSkyColumns);
|
frontyScale, 0, 0, 0.0f, 0.0f, nullptr, backskytex == nullptr ? RenderSkyPlane::GetOneSkyColumn : RenderSkyPlane::GetTwoSkyColumns);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -469,7 +469,7 @@ namespace swrenderer
|
||||||
if (topfrac < 0) topfrac += frontskytex->GetHeight();
|
if (topfrac < 0) topfrac += frontskytex->GetHeight();
|
||||||
yl = 0;
|
yl = 0;
|
||||||
yh = short((frontskytex->GetHeight() - topfrac) * frontyScale);
|
yh = short((frontskytex->GetHeight() - topfrac) * frontyScale);
|
||||||
dc_texturemid = topfrac - iscale * (1 - CenterY);
|
double texturemid = topfrac - iscale * (1 - CenterY);
|
||||||
|
|
||||||
while (yl < viewheight)
|
while (yl < viewheight)
|
||||||
{
|
{
|
||||||
|
@ -483,10 +483,10 @@ namespace swrenderer
|
||||||
lastskycol[x] = 0xffffffff;
|
lastskycol[x] = 0xffffffff;
|
||||||
lastskycol_bgra[x] = 0xffffffff;
|
lastskycol_bgra[x] = 0xffffffff;
|
||||||
}
|
}
|
||||||
R_DrawSkySegment(frontskytex, pl->left, pl->right, top, bot, swall, lwall, frontskytex->Scale.Y, 0, 0, 0.0f, 0.0f, nullptr, backskytex == nullptr ? RenderSkyPlane::GetOneSkyColumn : RenderSkyPlane::GetTwoSkyColumns);
|
R_DrawSkySegment(frontskytex, pl->left, pl->right, top, bot, texturemid, swall, lwall, frontskytex->Scale.Y, 0, 0, 0.0f, 0.0f, nullptr, backskytex == nullptr ? RenderSkyPlane::GetOneSkyColumn : RenderSkyPlane::GetTwoSkyColumns);
|
||||||
yl = yh;
|
yl = yh;
|
||||||
yh += drawheight;
|
yh += drawheight;
|
||||||
dc_texturemid = iscale * (centery - yl - 1);
|
texturemid = iscale * (centery - yl - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -232,13 +232,15 @@ namespace swrenderer
|
||||||
{
|
{
|
||||||
texheight = texheight / texheightscale;
|
texheight = texheight / texheightscale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double texturemid;
|
||||||
if (curline->linedef->flags & ML_DONTPEGBOTTOM)
|
if (curline->linedef->flags & ML_DONTPEGBOTTOM)
|
||||||
{
|
{
|
||||||
dc_texturemid = MAX(frontsector->GetPlaneTexZ(sector_t::floor), backsector->GetPlaneTexZ(sector_t::floor)) + texheight;
|
texturemid = MAX(frontsector->GetPlaneTexZ(sector_t::floor), backsector->GetPlaneTexZ(sector_t::floor)) + texheight;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dc_texturemid = MIN(frontsector->GetPlaneTexZ(sector_t::ceiling), backsector->GetPlaneTexZ(sector_t::ceiling));
|
texturemid = MIN(frontsector->GetPlaneTexZ(sector_t::ceiling), backsector->GetPlaneTexZ(sector_t::ceiling));
|
||||||
}
|
}
|
||||||
|
|
||||||
rowoffset = curline->sidedef->GetTextureYOffset(side_t::mid);
|
rowoffset = curline->sidedef->GetTextureYOffset(side_t::mid);
|
||||||
|
@ -257,21 +259,21 @@ namespace swrenderer
|
||||||
{
|
{
|
||||||
// rowoffset is added before the multiply so that the masked texture will
|
// rowoffset is added before the multiply so that the masked texture will
|
||||||
// still be positioned in world units rather than texels.
|
// still be positioned in world units rather than texels.
|
||||||
dc_texturemid += rowoffset - ViewPos.Z;
|
texturemid += rowoffset - ViewPos.Z;
|
||||||
textop = dc_texturemid;
|
textop = texturemid;
|
||||||
dc_texturemid *= MaskedScaleY;
|
texturemid *= MaskedScaleY;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// rowoffset is added outside the multiply so that it positions the texture
|
// rowoffset is added outside the multiply so that it positions the texture
|
||||||
// by texels instead of world units.
|
// by texels instead of world units.
|
||||||
textop = dc_texturemid + rowoffset / MaskedScaleY - ViewPos.Z;
|
textop = texturemid + rowoffset / MaskedScaleY - ViewPos.Z;
|
||||||
dc_texturemid = (dc_texturemid - ViewPos.Z) * MaskedScaleY + rowoffset;
|
texturemid = (texturemid - ViewPos.Z) * MaskedScaleY + rowoffset;
|
||||||
}
|
}
|
||||||
if (sprflipvert)
|
if (sprflipvert)
|
||||||
{
|
{
|
||||||
MaskedScaleY = -MaskedScaleY;
|
MaskedScaleY = -MaskedScaleY;
|
||||||
dc_texturemid -= tex->GetHeight() << FRACBITS;
|
texturemid -= tex->GetHeight() << FRACBITS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// [RH] Don't bother drawing segs that are completely offscreen
|
// [RH] Don't bother drawing segs that are completely offscreen
|
||||||
|
@ -356,9 +358,9 @@ namespace swrenderer
|
||||||
fixed_t iscale = xs_Fix<16>::ToFix(MaskedSWall[x] * MaskedScaleY);
|
fixed_t iscale = xs_Fix<16>::ToFix(MaskedSWall[x] * MaskedScaleY);
|
||||||
double sprtopscreen;
|
double sprtopscreen;
|
||||||
if (sprflipvert)
|
if (sprflipvert)
|
||||||
sprtopscreen = CenterY + dc_texturemid * spryscale;
|
sprtopscreen = CenterY + texturemid * spryscale;
|
||||||
else
|
else
|
||||||
sprtopscreen = CenterY - dc_texturemid * spryscale;
|
sprtopscreen = CenterY - texturemid * spryscale;
|
||||||
|
|
||||||
R_DrawMaskedColumn(x, iscale, tex, maskedtexturecol[x], spryscale, sprtopscreen, sprflipvert, mfloorclip, mceilingclip);
|
R_DrawMaskedColumn(x, iscale, tex, maskedtexturecol[x], spryscale, sprtopscreen, sprflipvert, mfloorclip, mceilingclip);
|
||||||
|
|
||||||
|
@ -373,13 +375,13 @@ namespace swrenderer
|
||||||
{
|
{
|
||||||
// rowoffset is added before the multiply so that the masked texture will
|
// rowoffset is added before the multiply so that the masked texture will
|
||||||
// still be positioned in world units rather than texels.
|
// still be positioned in world units rather than texels.
|
||||||
dc_texturemid = (dc_texturemid - ViewPos.Z + rowoffset) * MaskedScaleY;
|
texturemid = (texturemid - ViewPos.Z + rowoffset) * MaskedScaleY;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// rowoffset is added outside the multiply so that it positions the texture
|
// rowoffset is added outside the multiply so that it positions the texture
|
||||||
// by texels instead of world units.
|
// by texels instead of world units.
|
||||||
dc_texturemid = (dc_texturemid - ViewPos.Z) * MaskedScaleY + rowoffset;
|
texturemid = (texturemid - ViewPos.Z) * MaskedScaleY + rowoffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
WallC.sz1 = ds->sz1;
|
WallC.sz1 = ds->sz1;
|
||||||
|
@ -421,7 +423,7 @@ namespace swrenderer
|
||||||
|
|
||||||
rw_offset = 0;
|
rw_offset = 0;
|
||||||
rw_pic = tex;
|
rw_pic = tex;
|
||||||
R_DrawDrawSeg(frontsector, curline, WallC, rw_pic, ds, x1, x2, mceilingclip, mfloorclip, MaskedSWall, maskedtexturecol, ds->yscale, wallshade, rw_offset, rw_light, rw_lightstep, ds->foggy, basecolormap);
|
R_DrawDrawSeg(frontsector, curline, WallC, rw_pic, ds, x1, x2, mceilingclip, mfloorclip, texturemid, MaskedSWall, maskedtexturecol, ds->yscale, wallshade, rw_offset, rw_light, rw_lightstep, ds->foggy, basecolormap);
|
||||||
}
|
}
|
||||||
|
|
||||||
clearfog:
|
clearfog:
|
||||||
|
@ -498,20 +500,20 @@ namespace swrenderer
|
||||||
{
|
{
|
||||||
rowoffset += rw_pic->GetHeight();
|
rowoffset += rw_pic->GetHeight();
|
||||||
}
|
}
|
||||||
dc_texturemid = (planez - ViewPos.Z) * yscale;
|
double texturemid = (planez - ViewPos.Z) * yscale;
|
||||||
if (rw_pic->bWorldPanning)
|
if (rw_pic->bWorldPanning)
|
||||||
{
|
{
|
||||||
// rowoffset is added before the multiply so that the masked texture will
|
// rowoffset is added before the multiply so that the masked texture will
|
||||||
// still be positioned in world units rather than texels.
|
// still be positioned in world units rather than texels.
|
||||||
|
|
||||||
dc_texturemid = dc_texturemid + rowoffset * yscale;
|
texturemid = texturemid + rowoffset * yscale;
|
||||||
rw_offset = xs_RoundToInt(rw_offset * xscale);
|
rw_offset = xs_RoundToInt(rw_offset * xscale);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// rowoffset is added outside the multiply so that it positions the texture
|
// rowoffset is added outside the multiply so that it positions the texture
|
||||||
// by texels instead of world units.
|
// by texels instead of world units.
|
||||||
dc_texturemid += rowoffset;
|
texturemid += rowoffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fixedlightlev >= 0)
|
if (fixedlightlev >= 0)
|
||||||
|
@ -545,7 +547,7 @@ namespace swrenderer
|
||||||
}
|
}
|
||||||
|
|
||||||
PrepLWall(lwall, curline->sidedef->TexelLength*xscale, ds->sx1, ds->sx2, WallT);
|
PrepLWall(lwall, curline->sidedef->TexelLength*xscale, ds->sx1, ds->sx2, WallT);
|
||||||
R_DrawDrawSeg(frontsector, curline, WallC, rw_pic, ds, x1, x2, wallupper, walllower, MaskedSWall, lwall, yscale, wallshade, rw_offset, rw_light, rw_lightstep, ds->foggy, basecolormap);
|
R_DrawDrawSeg(frontsector, curline, WallC, rw_pic, ds, x1, x2, wallupper, walllower, texturemid, MaskedSWall, lwall, yscale, wallshade, rw_offset, rw_light, rw_lightstep, ds->foggy, basecolormap);
|
||||||
}
|
}
|
||||||
|
|
||||||
// kg3D - walls of fake floors
|
// kg3D - walls of fake floors
|
||||||
|
|
|
@ -214,7 +214,7 @@ namespace swrenderer
|
||||||
}
|
}
|
||||||
|
|
||||||
yscale = decal->ScaleY;
|
yscale = decal->ScaleY;
|
||||||
dc_texturemid = WallSpriteTile->TopOffset + (zpos - ViewPos.Z) / yscale;
|
double texturemid = WallSpriteTile->TopOffset + (zpos - ViewPos.Z) / yscale;
|
||||||
|
|
||||||
// Clip sprite to drawseg
|
// Clip sprite to drawseg
|
||||||
x1 = MAX<int>(clipper->x1, x1);
|
x1 = MAX<int>(clipper->x1, x1);
|
||||||
|
@ -265,7 +265,7 @@ namespace swrenderer
|
||||||
{
|
{
|
||||||
sprflipvert = true;
|
sprflipvert = true;
|
||||||
yscale = -yscale;
|
yscale = -yscale;
|
||||||
dc_texturemid -= WallSpriteTile->GetHeight();
|
texturemid -= WallSpriteTile->GetHeight();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -293,7 +293,7 @@ namespace swrenderer
|
||||||
{ // calculate lighting
|
{ // calculate lighting
|
||||||
R_SetColorMapLight(usecolormap, light, wallshade);
|
R_SetColorMapLight(usecolormap, light, wallshade);
|
||||||
}
|
}
|
||||||
DrawColumn(x, WallSpriteTile, maskedScaleY, sprflipvert, mfloorclip, mceilingclip);
|
DrawColumn(x, WallSpriteTile, texturemid, maskedScaleY, sprflipvert, mfloorclip, mceilingclip);
|
||||||
light += lightstep;
|
light += lightstep;
|
||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
|
@ -312,15 +312,15 @@ namespace swrenderer
|
||||||
WallC = savecoord;
|
WallC = savecoord;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderDecal::DrawColumn(int x, FTexture *WallSpriteTile, float maskedScaleY, bool sprflipvert, const short *mfloorclip, const short *mceilingclip)
|
void RenderDecal::DrawColumn(int x, FTexture *WallSpriteTile, double texturemid, float maskedScaleY, bool sprflipvert, const short *mfloorclip, const short *mceilingclip)
|
||||||
{
|
{
|
||||||
float iscale = swall[x] * maskedScaleY;
|
float iscale = swall[x] * maskedScaleY;
|
||||||
double spryscale = 1 / iscale;
|
double spryscale = 1 / iscale;
|
||||||
double sprtopscreen;
|
double sprtopscreen;
|
||||||
if (sprflipvert)
|
if (sprflipvert)
|
||||||
sprtopscreen = CenterY + dc_texturemid * spryscale;
|
sprtopscreen = CenterY + texturemid * spryscale;
|
||||||
else
|
else
|
||||||
sprtopscreen = CenterY - dc_texturemid * spryscale;
|
sprtopscreen = CenterY - texturemid * spryscale;
|
||||||
|
|
||||||
R_DrawMaskedColumn(x, FLOAT2FIXED(iscale), WallSpriteTile, lwall[x], spryscale, sprtopscreen, sprflipvert, mfloorclip, mceilingclip);
|
R_DrawMaskedColumn(x, FLOAT2FIXED(iscale), WallSpriteTile, lwall[x], spryscale, sprtopscreen, sprflipvert, mfloorclip, mceilingclip);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,6 @@ namespace swrenderer
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void Render(side_t *wall, DBaseDecal *first, drawseg_t *clipper, int wallshade, float lightleft, float lightstep, seg_t *curline, FWallCoords wallC, bool foggy, FDynamicColormap *basecolormap, int pass);
|
static void Render(side_t *wall, DBaseDecal *first, drawseg_t *clipper, int wallshade, float lightleft, float lightstep, seg_t *curline, FWallCoords wallC, bool foggy, FDynamicColormap *basecolormap, int pass);
|
||||||
static void DrawColumn(int x, FTexture *WallSpriteTile, float maskedScaleY, bool sprflipvert, const short *mfloorclip, const short *mceilingclip);
|
static void DrawColumn(int x, FTexture *WallSpriteTile, double texturemid, float maskedScaleY, bool sprflipvert, const short *mfloorclip, const short *mceilingclip);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -314,20 +314,20 @@ namespace swrenderer
|
||||||
fixed_t iscale = FLOAT2FIXED(1 / vis->yscale);
|
fixed_t iscale = FLOAT2FIXED(1 / vis->yscale);
|
||||||
frac = vis->startfrac;
|
frac = vis->startfrac;
|
||||||
xiscale = vis->xiscale;
|
xiscale = vis->xiscale;
|
||||||
dc_texturemid = vis->texturemid;
|
double texturemid = vis->texturemid;
|
||||||
|
|
||||||
if (vis->renderflags & RF_YFLIP)
|
if (vis->renderflags & RF_YFLIP)
|
||||||
{
|
{
|
||||||
sprflipvert = true;
|
sprflipvert = true;
|
||||||
spryscale = -spryscale;
|
spryscale = -spryscale;
|
||||||
iscale = -iscale;
|
iscale = -iscale;
|
||||||
dc_texturemid -= vis->pic->GetHeight();
|
texturemid -= vis->pic->GetHeight();
|
||||||
sprtopscreen = CenterY + dc_texturemid * spryscale;
|
sprtopscreen = CenterY + texturemid * spryscale;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprflipvert = false;
|
sprflipvert = false;
|
||||||
sprtopscreen = CenterY - dc_texturemid * spryscale;
|
sprtopscreen = CenterY - texturemid * spryscale;
|
||||||
}
|
}
|
||||||
|
|
||||||
int x = vis->x1;
|
int x = vis->x1;
|
||||||
|
|
|
@ -153,7 +153,7 @@ namespace swrenderer
|
||||||
WallT.InitFromWallCoords(&spr->wallc);
|
WallT.InitFromWallCoords(&spr->wallc);
|
||||||
PrepWall(swall, lwall, spr->pic->GetWidth() << FRACBITS, x1, x2, WallT);
|
PrepWall(swall, lwall, spr->pic->GetWidth() << FRACBITS, x1, x2, WallT);
|
||||||
iyscale = 1 / spr->yscale;
|
iyscale = 1 / spr->yscale;
|
||||||
dc_texturemid = (spr->gzt - ViewPos.Z) * iyscale;
|
double texturemid = (spr->gzt - ViewPos.Z) * iyscale;
|
||||||
if (spr->renderflags & RF_XFLIP)
|
if (spr->renderflags & RF_XFLIP)
|
||||||
{
|
{
|
||||||
int right = (spr->pic->GetWidth() << FRACBITS) - 1;
|
int right = (spr->pic->GetWidth() << FRACBITS) - 1;
|
||||||
|
@ -195,7 +195,7 @@ namespace swrenderer
|
||||||
{
|
{
|
||||||
sprflipvert = true;
|
sprflipvert = true;
|
||||||
iyscale = -iyscale;
|
iyscale = -iyscale;
|
||||||
dc_texturemid -= spr->pic->GetHeight();
|
texturemid -= spr->pic->GetHeight();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -229,22 +229,22 @@ namespace swrenderer
|
||||||
R_SetColorMapLight(usecolormap, light, shade);
|
R_SetColorMapLight(usecolormap, light, shade);
|
||||||
}
|
}
|
||||||
if (!RenderTranslucentPass::ClipSpriteColumnWithPortals(x, spr))
|
if (!RenderTranslucentPass::ClipSpriteColumnWithPortals(x, spr))
|
||||||
DrawColumn(x, WallSpriteTile, maskedScaleY, sprflipvert, mfloorclip, mceilingclip);
|
DrawColumn(x, WallSpriteTile, texturemid, maskedScaleY, sprflipvert, mfloorclip, mceilingclip);
|
||||||
light += lightstep;
|
light += lightstep;
|
||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderWallSprite::DrawColumn(int x, FTexture *WallSpriteTile, float maskedScaleY, bool sprflipvert, const short *mfloorclip, const short *mceilingclip)
|
void RenderWallSprite::DrawColumn(int x, FTexture *WallSpriteTile, double texturemid, float maskedScaleY, bool sprflipvert, const short *mfloorclip, const short *mceilingclip)
|
||||||
{
|
{
|
||||||
float iscale = swall[x] * maskedScaleY;
|
float iscale = swall[x] * maskedScaleY;
|
||||||
double spryscale = 1 / iscale;
|
double spryscale = 1 / iscale;
|
||||||
double sprtopscreen;
|
double sprtopscreen;
|
||||||
if (sprflipvert)
|
if (sprflipvert)
|
||||||
sprtopscreen = CenterY + dc_texturemid * spryscale;
|
sprtopscreen = CenterY + texturemid * spryscale;
|
||||||
else
|
else
|
||||||
sprtopscreen = CenterY - dc_texturemid * spryscale;
|
sprtopscreen = CenterY - texturemid * spryscale;
|
||||||
|
|
||||||
R_DrawMaskedColumn(x, FLOAT2FIXED(iscale), WallSpriteTile, lwall[x], spryscale, sprtopscreen, sprflipvert, mfloorclip, mceilingclip);
|
R_DrawMaskedColumn(x, FLOAT2FIXED(iscale), WallSpriteTile, lwall[x], spryscale, sprtopscreen, sprflipvert, mfloorclip, mceilingclip);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,6 @@ namespace swrenderer
|
||||||
static void Render(vissprite_t *spr, const short *mfloorclip, const short *mceilingclip);
|
static void Render(vissprite_t *spr, const short *mfloorclip, const short *mceilingclip);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void DrawColumn(int x, FTexture *WallSpriteTile, float maskedScaleY, bool sprflipvert, const short *mfloorclip, const short *mceilingclip);
|
static void DrawColumn(int x, FTexture *WallSpriteTile, double texturemid, float maskedScaleY, bool sprflipvert, const short *mfloorclip, const short *mceilingclip);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue