Remove unused variables from the old 4 column drawers

This commit is contained in:
Magnus Norddahl 2017-01-29 10:25:32 +01:00
parent 7c7d6e99e9
commit 162f469630
7 changed files with 70 additions and 97 deletions

View file

@ -565,14 +565,12 @@ namespace swrenderer
_dest_y = args.DestY(); _dest_y = args.DestY();
_count = args.dc_count; _count = args.dc_count;
_pitch = dc_pitch; _pitch = dc_pitch;
for (int col = 0; col < 4; col++) _source = args.dc_wall_source;
{ _source2 = args.dc_wall_source2;
_source[col] = args.dc_wall_source[col]; _sourceheight[0] = args.dc_wall_sourceheight[0];
_source2[col] = args.dc_wall_source2[col]; _sourceheight[1] = args.dc_wall_sourceheight[1];
_sourceheight[col] = args.dc_wall_sourceheight[col]; _iscale = args.dc_wall_iscale;
_iscale[col] = args.dc_wall_iscale[col]; _texturefrac = args.dc_wall_texturefrac;
_texturefrac[col] = args.dc_wall_texturefrac[col];
}
} }
void DrawSingleSky1PalCommand::Execute(DrawerThread *thread) void DrawSingleSky1PalCommand::Execute(DrawerThread *thread)
@ -580,11 +578,11 @@ namespace swrenderer
uint8_t *dest = _dest; uint8_t *dest = _dest;
int count = _count; int count = _count;
int pitch = _pitch; int pitch = _pitch;
const uint8_t *source0 = _source[0]; const uint8_t *source0 = _source;
int textureheight0 = _sourceheight[0]; int textureheight0 = _sourceheight[0];
int32_t frac = _texturefrac[0]; int32_t frac = _texturefrac;
int32_t fracstep = _iscale[0]; int32_t fracstep = _iscale;
// Find bands for top solid color, top fade, center textured, bottom fade, bottom solid color: // Find bands for top solid color, top fade, center textured, bottom fade, bottom solid color:
int start_fade = 2; // How fast it should fade out int start_fade = 2; // How fast it should fade out
@ -711,13 +709,13 @@ namespace swrenderer
uint8_t *dest = _dest; uint8_t *dest = _dest;
int count = _count; int count = _count;
int pitch = _pitch; int pitch = _pitch;
const uint8_t *source0 = _source[0]; const uint8_t *source0 = _source;
const uint8_t *source1 = _source2[0]; const uint8_t *source1 = _source2;
int textureheight0 = _sourceheight[0]; int textureheight0 = _sourceheight[0];
uint32_t maxtextureheight1 = _sourceheight[1] - 1; uint32_t maxtextureheight1 = _sourceheight[1] - 1;
int32_t frac = _texturefrac[0]; int32_t frac = _texturefrac;
int32_t fracstep = _iscale[0]; int32_t fracstep = _iscale;
// Find bands for top solid color, top fade, center textured, bottom fade, bottom solid color: // Find bands for top solid color, top fade, center textured, bottom fade, bottom solid color:
int start_fade = 2; // How fast it should fade out int start_fade = 2; // How fast it should fade out

View file

@ -56,11 +56,11 @@ namespace swrenderer
int _dest_y; int _dest_y;
int _count; int _count;
int _pitch; int _pitch;
const uint8_t *_source[4]; const uint8_t *_source;
const uint8_t *_source2[4]; const uint8_t *_source2;
int _sourceheight[4]; int _sourceheight[2];
uint32_t _iscale[4]; uint32_t _iscale;
uint32_t _texturefrac[4]; uint32_t _texturefrac;
}; };
class DrawSingleSky1PalCommand : public PalSkyCommand { public: using PalSkyCommand::PalSkyCommand; void Execute(DrawerThread *thread) override; }; class DrawSingleSky1PalCommand : public PalSkyCommand { public: using PalSkyCommand::PalSkyCommand; void Execute(DrawerThread *thread) override; };

View file

@ -304,13 +304,10 @@ namespace swrenderer
args.dest_y = drawerargs.DestY(); args.dest_y = drawerargs.DestY();
args.count = drawerargs.dc_count; args.count = drawerargs.dc_count;
args.pitch = dc_pitch; args.pitch = dc_pitch;
for (int i = 0; i < 4; i++) args.texturefrac[0] = drawerargs.dc_wall_texturefrac;
{ args.iscale[0] = drawerargs.dc_wall_iscale;
args.texturefrac[i] = drawerargs.dc_wall_texturefrac[i]; args.source0[0] = (const uint32_t *)drawerargs.dc_wall_source;
args.iscale[i] = drawerargs.dc_wall_iscale[i]; args.source1[0] = (const uint32_t *)drawerargs.dc_wall_source2;
args.source0[i] = (const uint32_t *)drawerargs.dc_wall_source[i];
args.source1[i] = (const uint32_t *)drawerargs.dc_wall_source2[i];
}
args.textureheight0 = drawerargs.dc_wall_sourceheight[0]; args.textureheight0 = drawerargs.dc_wall_sourceheight[0];
args.textureheight1 = drawerargs.dc_wall_sourceheight[1]; args.textureheight1 = drawerargs.dc_wall_sourceheight[1];
args.top_color = solid_top; args.top_color = solid_top;

View file

@ -86,11 +86,11 @@ namespace swrenderer
class SkyDrawerArgs : public DrawerArgs class SkyDrawerArgs : public DrawerArgs
{ {
public: public:
const uint8_t *dc_wall_source[4]; const uint8_t *dc_wall_source;
const uint8_t *dc_wall_source2[4]; const uint8_t *dc_wall_source2;
uint32_t dc_wall_sourceheight[4]; uint32_t dc_wall_sourceheight[2];
uint32_t dc_wall_texturefrac[4]; uint32_t dc_wall_texturefrac;
uint32_t dc_wall_iscale[4]; uint32_t dc_wall_iscale;
int dc_count; int dc_count;
void SetDest(int x, int y); void SetDest(int x, int y);
@ -124,14 +124,6 @@ namespace swrenderer
const uint8_t *dc_source2; const uint8_t *dc_source2;
int dc_count; int dc_count;
uint32_t dc_wall_texturefrac[4];
uint32_t dc_wall_iscale[4];
uint8_t *dc_wall_colormap[4];
fixed_t dc_wall_light[4];
const uint8_t *dc_wall_source[4];
const uint8_t *dc_wall_source2[4];
uint32_t dc_wall_texturefracx[4];
uint32_t dc_wall_sourceheight[4];
int dc_wall_fracbits; int dc_wall_fracbits;
FVector3 dc_normal; FVector3 dc_normal;

View file

@ -324,17 +324,6 @@ namespace swrenderer
CameraLight *cameraLight = CameraLight::Instance(); CameraLight *cameraLight = CameraLight::Instance();
bool fixed = (cameraLight->fixedcolormap != NULL || cameraLight->fixedlightlev >= 0); bool fixed = (cameraLight->fixedcolormap != NULL || cameraLight->fixedlightlev >= 0);
if (fixed)
{
drawerargs.dc_wall_colormap[0] = drawerargs.dc_colormap;
drawerargs.dc_wall_colormap[1] = drawerargs.dc_colormap;
drawerargs.dc_wall_colormap[2] = drawerargs.dc_colormap;
drawerargs.dc_wall_colormap[3] = drawerargs.dc_colormap;
drawerargs.dc_wall_light[0] = 0;
drawerargs.dc_wall_light[1] = 0;
drawerargs.dc_wall_light[2] = 0;
drawerargs.dc_wall_light[3] = 0;
}
if (cameraLight->fixedcolormap) if (cameraLight->fixedcolormap)
drawerargs.SetColorMapLight(cameraLight->fixedcolormap, 0, 0); drawerargs.SetColorMapLight(cameraLight->fixedcolormap, 0, 0);

View file

@ -166,53 +166,50 @@ namespace swrenderer
cameraLight->fixedcolormap = nullptr; cameraLight->fixedcolormap = nullptr;
} }
void RenderSkyPlane::DrawSkyColumnStripe(int start_x, int y1, int y2, int columns, double scale, double texturemid, double yrepeat) void RenderSkyPlane::DrawSkyColumnStripe(int start_x, int y1, int y2, double scale, double texturemid, double yrepeat)
{ {
RenderPortal *renderportal = RenderPortal::Instance(); RenderPortal *renderportal = RenderPortal::Instance();
uint32_t height = frontskytex->GetHeight(); uint32_t height = frontskytex->GetHeight();
for (int i = 0; i < columns; i++) double uv_stepd = skyiscale * yrepeat;
double v = (texturemid + uv_stepd * (y1 - CenterY + 0.5)) / height;
double v_step = uv_stepd / height;
uint32_t uv_pos = (uint32_t)(v * 0x01000000);
uint32_t uv_step = (uint32_t)(v_step * 0x01000000);
int x = start_x;
if (renderportal->MirrorFlags & RF_XFLIP)
x = (viewwidth - x);
uint32_t ang, angle1, angle2;
if (r_linearsky)
{ {
double uv_stepd = skyiscale * yrepeat; angle_t xangle = (angle_t)((0.5 - x / (double)viewwidth) * FocalTangent * ANGLE_90);
double v = (texturemid + uv_stepd * (y1 - CenterY + 0.5)) / height; ang = (skyangle + xangle) ^ skyflip;
double v_step = uv_stepd / height;
uint32_t uv_pos = (uint32_t)(v * 0x01000000);
uint32_t uv_step = (uint32_t)(v_step * 0x01000000);
int x = start_x + i;
if (renderportal->MirrorFlags & RF_XFLIP)
x = (viewwidth - x);
uint32_t ang, angle1, angle2;
if (r_linearsky)
{
angle_t xangle = (angle_t)((0.5 - x / (double)viewwidth) * FocalTangent * ANGLE_90);
ang = (skyangle + xangle) ^ skyflip;
}
else
{
ang = (skyangle + xtoviewangle[x]) ^ skyflip;
}
angle1 = (uint32_t)((UMulScale16(ang, frontcyl) + frontpos) >> FRACBITS);
angle2 = (uint32_t)((UMulScale16(ang, backcyl) + backpos) >> FRACBITS);
if (r_swtruecolor)
{
drawerargs.dc_wall_source[i] = (const uint8_t *)frontskytex->GetColumnBgra(angle1, nullptr);
drawerargs.dc_wall_source2[i] = backskytex ? (const uint8_t *)backskytex->GetColumnBgra(angle2, nullptr) : nullptr;
}
else
{
drawerargs.dc_wall_source[i] = (const uint8_t *)frontskytex->GetColumn(angle1, nullptr);
drawerargs.dc_wall_source2[i] = backskytex ? (const uint8_t *)backskytex->GetColumn(angle2, nullptr) : nullptr;
}
drawerargs.dc_wall_iscale[i] = uv_step;
drawerargs.dc_wall_texturefrac[i] = uv_pos;
} }
else
{
ang = (skyangle + xtoviewangle[x]) ^ skyflip;
}
angle1 = (uint32_t)((UMulScale16(ang, frontcyl) + frontpos) >> FRACBITS);
angle2 = (uint32_t)((UMulScale16(ang, backcyl) + backpos) >> FRACBITS);
if (r_swtruecolor)
{
drawerargs.dc_wall_source = (const uint8_t *)frontskytex->GetColumnBgra(angle1, nullptr);
drawerargs.dc_wall_source2 = backskytex ? (const uint8_t *)backskytex->GetColumnBgra(angle2, nullptr) : nullptr;
}
else
{
drawerargs.dc_wall_source = (const uint8_t *)frontskytex->GetColumn(angle1, nullptr);
drawerargs.dc_wall_source2 = backskytex ? (const uint8_t *)backskytex->GetColumn(angle2, nullptr) : nullptr;
}
drawerargs.dc_wall_iscale = uv_step;
drawerargs.dc_wall_texturefrac = uv_pos;
drawerargs.dc_wall_sourceheight[0] = height; drawerargs.dc_wall_sourceheight[0] = height;
drawerargs.dc_wall_sourceheight[1] = backskytex ? backskytex->GetHeight() : height; drawerargs.dc_wall_sourceheight[1] = backskytex ? backskytex->GetHeight() : height;
@ -231,12 +228,12 @@ namespace swrenderer
drawerargs.DrawDoubleSkyColumn(solid_top, solid_bottom, fadeSky); drawerargs.DrawDoubleSkyColumn(solid_top, solid_bottom, fadeSky);
} }
void RenderSkyPlane::DrawSkyColumn(int start_x, int y1, int y2, int columns) void RenderSkyPlane::DrawSkyColumn(int start_x, int y1, int y2)
{ {
if (1 << frontskytex->HeightBits == frontskytex->GetHeight()) if (1 << frontskytex->HeightBits == frontskytex->GetHeight())
{ {
double texturemid = skymid * frontskytex->Scale.Y + frontskytex->GetHeight(); double texturemid = skymid * frontskytex->Scale.Y + frontskytex->GetHeight();
DrawSkyColumnStripe(start_x, y1, y2, columns, frontskytex->Scale.Y, texturemid, frontskytex->Scale.Y); DrawSkyColumnStripe(start_x, y1, y2, frontskytex->Scale.Y, texturemid, frontskytex->Scale.Y);
} }
else else
{ {
@ -247,7 +244,7 @@ namespace swrenderer
double topfrac = fmod(skymid + iscale * (1 - CenterY), frontskytex->GetHeight()); double topfrac = fmod(skymid + iscale * (1 - CenterY), frontskytex->GetHeight());
if (topfrac < 0) topfrac += frontskytex->GetHeight(); if (topfrac < 0) topfrac += frontskytex->GetHeight();
double texturemid = topfrac - iscale * (1 - CenterY); double texturemid = topfrac - iscale * (1 - CenterY);
DrawSkyColumnStripe(start_x, y1, y2, columns, scale, texturemid, yrepeat); DrawSkyColumnStripe(start_x, y1, y2, scale, texturemid, yrepeat);
} }
} }
@ -265,7 +262,7 @@ namespace swrenderer
if (y2 <= y1) if (y2 <= y1)
continue; continue;
DrawSkyColumn(x, y1, y2, 1); DrawSkyColumn(x, y1, y2);
} }
} }
} }

View file

@ -25,8 +25,8 @@ namespace swrenderer
private: private:
void DrawSky(VisiblePlane *pl); void DrawSky(VisiblePlane *pl);
void DrawSkyColumnStripe(int start_x, int y1, int y2, int columns, double scale, double texturemid, double yrepeat); void DrawSkyColumnStripe(int start_x, int y1, int y2, double scale, double texturemid, double yrepeat);
void DrawSkyColumn(int start_x, int y1, int y2, int columns); void DrawSkyColumn(int start_x, int y1, int y2);
FTexture *frontskytex = nullptr; FTexture *frontskytex = nullptr;
FTexture *backskytex = nullptr; FTexture *backskytex = nullptr;