Make spanfunc private and local to SpanDrawerArgs

This commit is contained in:
Magnus Norddahl 2017-01-30 05:26:57 +01:00
parent 81a20213a7
commit 36a23d60b8
4 changed files with 19 additions and 5 deletions

View file

@ -65,6 +65,10 @@ namespace swrenderer
basecolfunc = &SWPixelFormatDrawers::DrawColumn; basecolfunc = &SWPixelFormatDrawers::DrawColumn;
fuzzcolfunc = &SWPixelFormatDrawers::DrawFuzzColumn; fuzzcolfunc = &SWPixelFormatDrawers::DrawFuzzColumn;
transcolfunc = &SWPixelFormatDrawers::DrawTranslatedColumn; transcolfunc = &SWPixelFormatDrawers::DrawTranslatedColumn;
}
SpanDrawerArgs::SpanDrawerArgs()
{
spanfunc = &SWPixelFormatDrawers::DrawSpan; spanfunc = &SWPixelFormatDrawers::DrawSpan;
} }
@ -617,7 +621,7 @@ namespace swrenderer
return nullptr; return nullptr;
} }
void DrawerArgs::SetSpanStyle(bool masked, bool additive, fixed_t alpha) void SpanDrawerArgs::SetSpanStyle(bool masked, bool additive, fixed_t alpha)
{ {
if (masked) if (masked)
{ {
@ -673,6 +677,11 @@ namespace swrenderer
} }
} }
void SpanDrawerArgs::DrawSpan()
{
(Drawers()->*spanfunc)(*this);
}
void SpanDrawerArgs::DrawTiltedSpan(int y, int x1, int x2, const FVector3 &plane_sz, const FVector3 &plane_su, const FVector3 &plane_sv, bool plane_shade, int planeshade, float planelightfloat, fixed_t pviewx, fixed_t pviewy, FDynamicColormap *basecolormap) void SpanDrawerArgs::DrawTiltedSpan(int y, int x1, int x2, const FVector3 &plane_sz, const FVector3 &plane_su, const FVector3 &plane_sv, bool plane_shade, int planeshade, float planelightfloat, fixed_t pviewx, fixed_t pviewy, FDynamicColormap *basecolormap)
{ {
Drawers()->DrawTiltedSpan(*this, y, x1, x2, plane_sz, plane_su, plane_sv, plane_shade, planeshade, planelightfloat, pviewx, pviewy, basecolormap); Drawers()->DrawTiltedSpan(*this, y, x1, x2, plane_sz, plane_su, plane_sv, plane_shade, planeshade, planelightfloat, pviewx, pviewy, basecolormap);

View file

@ -46,7 +46,6 @@ namespace swrenderer
bool SetPatchStyle(FRenderStyle style, fixed_t alpha, int translation, uint32_t color, FDynamicColormap *&basecolormap, fixed_t shadedlightshade = 0); bool SetPatchStyle(FRenderStyle style, fixed_t alpha, int translation, uint32_t color, FDynamicColormap *&basecolormap, fixed_t shadedlightshade = 0);
bool SetPatchStyle(FRenderStyle style, float alpha, int translation, uint32_t color, FDynamicColormap *&basecolormap, fixed_t shadedlightshade = 0); bool SetPatchStyle(FRenderStyle style, float alpha, int translation, uint32_t color, FDynamicColormap *&basecolormap, fixed_t shadedlightshade = 0);
void SetSpanStyle(bool masked, bool additive, fixed_t alpha);
void SetColorMapLight(FSWColormap *base_colormap, float light, int shade); void SetColorMapLight(FSWColormap *base_colormap, float light, int shade);
void SetTranslationMap(lighttable_t *translation); void SetTranslationMap(lighttable_t *translation);
@ -63,7 +62,6 @@ namespace swrenderer
ColumnDrawerFunc basecolfunc; ColumnDrawerFunc basecolfunc;
ColumnDrawerFunc fuzzcolfunc; ColumnDrawerFunc fuzzcolfunc;
ColumnDrawerFunc transcolfunc; ColumnDrawerFunc transcolfunc;
SpanDrawerFunc spanfunc;
uint32_t *dc_srcblend; uint32_t *dc_srcblend;
uint32_t *dc_destblend; uint32_t *dc_destblend;
@ -144,8 +142,12 @@ namespace swrenderer
class SpanDrawerArgs : public DrawerArgs class SpanDrawerArgs : public DrawerArgs
{ {
public: public:
SpanDrawerArgs();
void SetSpanStyle(bool masked, bool additive, fixed_t alpha);
void SetSpanTexture(FTexture *tex); void SetSpanTexture(FTexture *tex);
void DrawSpan();
void DrawTiltedSpan(int y, int x1, int x2, const FVector3 &plane_sz, const FVector3 &plane_su, const FVector3 &plane_sv, bool plane_shade, int planeshade, float planelightfloat, fixed_t pviewx, fixed_t pviewy, FDynamicColormap *basecolormap); void DrawTiltedSpan(int y, int x1, int x2, const FVector3 &plane_sz, const FVector3 &plane_su, const FVector3 &plane_sv, bool plane_shade, int planeshade, float planelightfloat, fixed_t pviewx, fixed_t pviewy, FDynamicColormap *basecolormap);
void DrawColoredSpan(int y, int x1, int x2); void DrawColoredSpan(int y, int x1, int x2);
void DrawFogBoundaryLine(int y, int x1, int x2); void DrawFogBoundaryLine(int y, int x1, int x2);
@ -170,6 +172,9 @@ namespace swrenderer
FVector3 dc_viewpos_step; FVector3 dc_viewpos_step;
TriLight *dc_lights = nullptr; TriLight *dc_lights = nullptr;
int dc_num_lights = 0; int dc_num_lights = 0;
private:
SpanDrawerFunc spanfunc;
}; };
class ColumnDrawerArgs : public DrawerArgs class ColumnDrawerArgs : public DrawerArgs

View file

@ -254,7 +254,7 @@ namespace swrenderer
drawerargs.ds_x1 = x1; drawerargs.ds_x1 = x1;
drawerargs.ds_x2 = x2; drawerargs.ds_x2 = x2;
(drawerargs.Drawers()->*drawerargs.spanfunc)(drawerargs); drawerargs.DrawSpan();
} }
void RenderFlatPlane::StepColumn() void RenderFlatPlane::StepColumn()

View file

@ -1491,7 +1491,7 @@ void DCanvas::FillSimplePoly(FTexture *tex, FVector2 *points, int npoints,
drawerargs.ds_xfrac = xs_RoundToInt(tex.X * scalex); drawerargs.ds_xfrac = xs_RoundToInt(tex.X * scalex);
drawerargs.ds_yfrac = xs_RoundToInt(tex.Y * scaley); drawerargs.ds_yfrac = xs_RoundToInt(tex.Y * scaley);
(drawerargs.Drawers()->*drawerargs.spanfunc)(drawerargs); drawerargs.DrawSpan();
#endif #endif
} }
x += xinc; x += xinc;