mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 15:22:16 +00:00
Move colfunc and friends to r_draw and change them to member function pointers
This commit is contained in:
parent
bad3a130cf
commit
f8010854c3
9 changed files with 73 additions and 122 deletions
|
@ -70,6 +70,12 @@ namespace swrenderer
|
||||||
int fuzzpos;
|
int fuzzpos;
|
||||||
int fuzzviewheight;
|
int fuzzviewheight;
|
||||||
|
|
||||||
|
DrawerFunc colfunc;
|
||||||
|
DrawerFunc basecolfunc;
|
||||||
|
DrawerFunc fuzzcolfunc;
|
||||||
|
DrawerFunc transcolfunc;
|
||||||
|
DrawerFunc spanfunc;
|
||||||
|
|
||||||
namespace drawerargs
|
namespace drawerargs
|
||||||
{
|
{
|
||||||
int dc_pitch;
|
int dc_pitch;
|
||||||
|
@ -154,10 +160,10 @@ namespace swrenderer
|
||||||
else
|
else
|
||||||
active_drawers = &pal_drawers;
|
active_drawers = &pal_drawers;
|
||||||
|
|
||||||
colfunc = basecolfunc = R_DrawColumn;
|
colfunc = basecolfunc = &SWPixelFormatDrawers::DrawColumn;
|
||||||
fuzzcolfunc = R_DrawFuzzColumn;
|
fuzzcolfunc = &SWPixelFormatDrawers::DrawFuzzColumn;
|
||||||
transcolfunc = R_DrawTranslatedColumn;
|
transcolfunc = &SWPixelFormatDrawers::DrawTranslatedColumn;
|
||||||
spanfunc = R_DrawSpan;
|
spanfunc = &SWPixelFormatDrawers::DrawSpan;
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_InitShadeMaps()
|
void R_InitShadeMaps()
|
||||||
|
@ -240,7 +246,7 @@ namespace swrenderer
|
||||||
{
|
{
|
||||||
if (flags & STYLEF_ColorIsFixed)
|
if (flags & STYLEF_ColorIsFixed)
|
||||||
{
|
{
|
||||||
colfunc = R_FillColumn;
|
colfunc = &SWPixelFormatDrawers::FillColumn;
|
||||||
}
|
}
|
||||||
else if (dc_translation == NULL)
|
else if (dc_translation == NULL)
|
||||||
{
|
{
|
||||||
|
@ -285,15 +291,15 @@ namespace swrenderer
|
||||||
{ // Colors won't overflow when added
|
{ // Colors won't overflow when added
|
||||||
if (flags & STYLEF_ColorIsFixed)
|
if (flags & STYLEF_ColorIsFixed)
|
||||||
{
|
{
|
||||||
colfunc = R_FillAddColumn;
|
colfunc = &SWPixelFormatDrawers::FillAddColumn;
|
||||||
}
|
}
|
||||||
else if (dc_translation == NULL)
|
else if (dc_translation == NULL)
|
||||||
{
|
{
|
||||||
colfunc = R_DrawAddColumn;
|
colfunc = &SWPixelFormatDrawers::DrawAddColumn;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
colfunc = R_DrawTlatedAddColumn;
|
colfunc = &SWPixelFormatDrawers::DrawTranslatedAddColumn;
|
||||||
drawer_needs_pal_input = true;
|
drawer_needs_pal_input = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -301,15 +307,15 @@ namespace swrenderer
|
||||||
{ // Colors might overflow when added
|
{ // Colors might overflow when added
|
||||||
if (flags & STYLEF_ColorIsFixed)
|
if (flags & STYLEF_ColorIsFixed)
|
||||||
{
|
{
|
||||||
colfunc = R_FillAddClampColumn;
|
colfunc = &SWPixelFormatDrawers::FillAddClampColumn;
|
||||||
}
|
}
|
||||||
else if (dc_translation == NULL)
|
else if (dc_translation == NULL)
|
||||||
{
|
{
|
||||||
colfunc = R_DrawAddClampColumn;
|
colfunc = &SWPixelFormatDrawers::DrawAddClampColumn;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
colfunc = R_DrawAddClampTranslatedColumn;
|
colfunc = &SWPixelFormatDrawers::DrawAddClampTranslatedColumn;
|
||||||
drawer_needs_pal_input = true;
|
drawer_needs_pal_input = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -318,15 +324,15 @@ namespace swrenderer
|
||||||
case STYLEOP_Sub:
|
case STYLEOP_Sub:
|
||||||
if (flags & STYLEF_ColorIsFixed)
|
if (flags & STYLEF_ColorIsFixed)
|
||||||
{
|
{
|
||||||
colfunc = R_FillSubClampColumn;
|
colfunc = &SWPixelFormatDrawers::FillSubClampColumn;
|
||||||
}
|
}
|
||||||
else if (dc_translation == NULL)
|
else if (dc_translation == NULL)
|
||||||
{
|
{
|
||||||
colfunc = R_DrawSubClampColumn;
|
colfunc = &SWPixelFormatDrawers::DrawSubClampColumn;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
colfunc = R_DrawSubClampTranslatedColumn;
|
colfunc = &SWPixelFormatDrawers::DrawSubClampTranslatedColumn;
|
||||||
drawer_needs_pal_input = true;
|
drawer_needs_pal_input = true;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -338,15 +344,15 @@ namespace swrenderer
|
||||||
}
|
}
|
||||||
if (flags & STYLEF_ColorIsFixed)
|
if (flags & STYLEF_ColorIsFixed)
|
||||||
{
|
{
|
||||||
colfunc = R_FillRevSubClampColumn;
|
colfunc = &SWPixelFormatDrawers::FillRevSubClampColumn;
|
||||||
}
|
}
|
||||||
else if (dc_translation == NULL)
|
else if (dc_translation == NULL)
|
||||||
{
|
{
|
||||||
colfunc = R_DrawRevSubClampColumn;
|
colfunc = &SWPixelFormatDrawers::DrawRevSubClampColumn;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
colfunc = R_DrawRevSubClampTranslatedColumn;
|
colfunc = &SWPixelFormatDrawers::DrawRevSubClampTranslatedColumn;
|
||||||
drawer_needs_pal_input = true;
|
drawer_needs_pal_input = true;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -433,7 +439,7 @@ namespace swrenderer
|
||||||
// Shaded drawer only gets 16 levels of alpha because it saves memory.
|
// Shaded drawer only gets 16 levels of alpha because it saves memory.
|
||||||
if ((alpha >>= 12) == 0)
|
if ((alpha >>= 12) == 0)
|
||||||
return false;
|
return false;
|
||||||
colfunc = R_DrawShadedColumn;
|
colfunc = &SWPixelFormatDrawers::DrawShadedColumn;
|
||||||
drawer_needs_pal_input = true;
|
drawer_needs_pal_input = true;
|
||||||
dc_color = fixedcolormap ? fixedcolormap->Maps[APART(color)] : basecolormap->Maps[APART(color)];
|
dc_color = fixedcolormap ? fixedcolormap->Maps[APART(color)] : basecolormap->Maps[APART(color)];
|
||||||
basecolormap = &ShadeFakeColormap[16 - alpha];
|
basecolormap = &ShadeFakeColormap[16 - alpha];
|
||||||
|
@ -507,29 +513,25 @@ namespace swrenderer
|
||||||
return tex->GetColumn(col, nullptr);
|
return tex->GetColumn(col, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool R_GetTransMaskDrawers(void(**drawColumn)())
|
DrawerFunc R_GetTransMaskDrawer()
|
||||||
{
|
{
|
||||||
if (colfunc == R_DrawAddColumn)
|
if (colfunc == &SWPixelFormatDrawers::DrawAddColumn)
|
||||||
{
|
{
|
||||||
*drawColumn = R_DrawWallAddColumn;
|
return &SWPixelFormatDrawers::DrawWallAddColumn;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
if (colfunc == R_DrawAddClampColumn)
|
if (colfunc == &SWPixelFormatDrawers::DrawAddClampColumn)
|
||||||
{
|
{
|
||||||
*drawColumn = R_DrawWallAddClampColumn;
|
return &SWPixelFormatDrawers::DrawWallAddClampColumn;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
if (colfunc == R_DrawSubClampColumn)
|
if (colfunc == &SWPixelFormatDrawers::DrawSubClampColumn)
|
||||||
{
|
{
|
||||||
*drawColumn = R_DrawWallSubClampColumn;
|
return &SWPixelFormatDrawers::DrawWallSubClampColumn;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
if (colfunc == R_DrawRevSubClampColumn)
|
if (colfunc == &SWPixelFormatDrawers::DrawRevSubClampColumn)
|
||||||
{
|
{
|
||||||
*drawColumn = R_DrawWallRevSubClampColumn;
|
return &SWPixelFormatDrawers::DrawWallRevSubClampColumn;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_SetColorMapLight(FSWColormap *base_colormap, float light, int shade)
|
void R_SetColorMapLight(FSWColormap *base_colormap, float light, int shade)
|
||||||
|
|
|
@ -164,6 +164,8 @@ namespace swrenderer
|
||||||
virtual void DrawFogBoundaryLine(int y, int x1, int x2) = 0;
|
virtual void DrawFogBoundaryLine(int y, int x1, int x2) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef void(SWPixelFormatDrawers::*DrawerFunc)();
|
||||||
|
|
||||||
SWPixelFormatDrawers *R_Drawers();
|
SWPixelFormatDrawers *R_Drawers();
|
||||||
|
|
||||||
void R_InitColumnDrawers();
|
void R_InitColumnDrawers();
|
||||||
|
@ -173,7 +175,7 @@ namespace swrenderer
|
||||||
bool R_SetPatchStyle(FRenderStyle style, fixed_t alpha, int translation, uint32_t color);
|
bool R_SetPatchStyle(FRenderStyle style, fixed_t alpha, int translation, uint32_t color);
|
||||||
bool R_SetPatchStyle(FRenderStyle style, float alpha, int translation, uint32_t color);
|
bool R_SetPatchStyle(FRenderStyle style, float alpha, int translation, uint32_t color);
|
||||||
void R_FinishSetPatchStyle(); // Call this after finished drawing the current thing, in case its style was STYLE_Shade
|
void R_FinishSetPatchStyle(); // Call this after finished drawing the current thing, in case its style was STYLE_Shade
|
||||||
bool R_GetTransMaskDrawers(void(**drawColumn)());
|
DrawerFunc R_GetTransMaskDrawer();
|
||||||
|
|
||||||
const uint8_t *R_GetColumn(FTexture *tex, int col);
|
const uint8_t *R_GetColumn(FTexture *tex, int col);
|
||||||
|
|
||||||
|
@ -187,42 +189,9 @@ namespace swrenderer
|
||||||
void R_SetSpanTexture(FTexture *tex);
|
void R_SetSpanTexture(FTexture *tex);
|
||||||
void R_SetSpanColormap(FDynamicColormap *colormap, int shade);
|
void R_SetSpanColormap(FDynamicColormap *colormap, int shade);
|
||||||
|
|
||||||
inline void R_DrawWallColumn() { R_Drawers()->DrawWallColumn(); }
|
extern DrawerFunc colfunc;
|
||||||
inline void R_DrawWallMaskedColumn() { R_Drawers()->DrawWallMaskedColumn(); }
|
extern DrawerFunc basecolfunc;
|
||||||
inline void R_DrawWallAddColumn() { R_Drawers()->DrawWallAddColumn(); }
|
extern DrawerFunc fuzzcolfunc;
|
||||||
inline void R_DrawWallAddClampColumn() { R_Drawers()->DrawWallAddClampColumn(); }
|
extern DrawerFunc transcolfunc;
|
||||||
inline void R_DrawWallSubClampColumn() { R_Drawers()->DrawWallSubClampColumn(); }
|
extern DrawerFunc spanfunc;
|
||||||
inline void R_DrawWallRevSubClampColumn() { R_Drawers()->DrawWallRevSubClampColumn(); }
|
|
||||||
inline void R_DrawSingleSkyColumn(uint32_t solid_top, uint32_t solid_bottom) { R_Drawers()->DrawSingleSkyColumn(solid_top, solid_bottom); }
|
|
||||||
inline void R_DrawDoubleSkyColumn(uint32_t solid_top, uint32_t solid_bottom) { R_Drawers()->DrawDoubleSkyColumn(solid_top, solid_bottom); }
|
|
||||||
inline void R_DrawColumn() { R_Drawers()->DrawColumn(); }
|
|
||||||
inline void R_FillColumn() { R_Drawers()->FillColumn(); }
|
|
||||||
inline void R_FillAddColumn() { R_Drawers()->FillAddColumn(); }
|
|
||||||
inline void R_FillAddClampColumn() { R_Drawers()->FillAddClampColumn(); }
|
|
||||||
inline void R_FillSubClampColumn() { R_Drawers()->FillSubClampColumn(); }
|
|
||||||
inline void R_FillRevSubClampColumn() { R_Drawers()->FillRevSubClampColumn(); }
|
|
||||||
inline void R_DrawFuzzColumn() { R_Drawers()->DrawFuzzColumn(); }
|
|
||||||
inline void R_DrawAddColumn() { R_Drawers()->DrawAddColumn(); }
|
|
||||||
inline void R_DrawTranslatedColumn() { R_Drawers()->DrawTranslatedColumn(); }
|
|
||||||
inline void R_DrawTlatedAddColumn() { R_Drawers()->DrawTranslatedAddColumn(); }
|
|
||||||
inline void R_DrawShadedColumn() { R_Drawers()->DrawShadedColumn(); }
|
|
||||||
inline void R_DrawAddClampColumn() { R_Drawers()->DrawAddClampColumn(); }
|
|
||||||
inline void R_DrawAddClampTranslatedColumn() { R_Drawers()->DrawAddClampTranslatedColumn(); }
|
|
||||||
inline void R_DrawSubClampColumn() { R_Drawers()->DrawSubClampColumn(); }
|
|
||||||
inline void R_DrawSubClampTranslatedColumn() { R_Drawers()->DrawSubClampTranslatedColumn(); }
|
|
||||||
inline void R_DrawRevSubClampColumn() { R_Drawers()->DrawRevSubClampColumn(); }
|
|
||||||
inline void R_DrawRevSubClampTranslatedColumn() { R_Drawers()->DrawRevSubClampTranslatedColumn(); }
|
|
||||||
inline void R_DrawSpan() { R_Drawers()->DrawSpan(); }
|
|
||||||
inline void R_DrawSpanMasked() { R_Drawers()->DrawSpanMasked(); }
|
|
||||||
inline void R_DrawSpanTranslucent() { R_Drawers()->DrawSpanTranslucent(); }
|
|
||||||
inline void R_DrawSpanMaskedTranslucent() { R_Drawers()->DrawSpanMaskedTranslucent(); }
|
|
||||||
inline void R_DrawSpanAddClamp() { R_Drawers()->DrawSpanAddClamp(); }
|
|
||||||
inline void R_DrawSpanMaskedAddClamp() { R_Drawers()->DrawSpanMaskedAddClamp(); }
|
|
||||||
inline void R_FillSpan() { R_Drawers()->FillSpan(); }
|
|
||||||
inline void R_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)
|
|
||||||
{
|
|
||||||
R_Drawers()->DrawTiltedSpan(y, x1, x2, plane_sz, plane_su, plane_sv, plane_shade, planeshade, planelightfloat, pviewx, pviewy);
|
|
||||||
}
|
|
||||||
inline void R_DrawColoredSpan(int y, int x1, int x2) { R_Drawers()->DrawColoredSpan(y, x1, x2); }
|
|
||||||
inline void R_DrawFogBoundaryLine(int y, int x1, int x2) { R_Drawers()->DrawFogBoundaryLine(y, x1, x2); }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,12 +163,6 @@ angle_t xtoviewangle[MAXWIDTH+1];
|
||||||
bool foggy; // [RH] ignore extralight and fullbright?
|
bool foggy; // [RH] ignore extralight and fullbright?
|
||||||
int r_actualextralight;
|
int r_actualextralight;
|
||||||
|
|
||||||
void (*colfunc) (void);
|
|
||||||
void (*basecolfunc) (void);
|
|
||||||
void (*fuzzcolfunc) (void);
|
|
||||||
void (*transcolfunc) (void);
|
|
||||||
void (*spanfunc) (void);
|
|
||||||
|
|
||||||
cycle_t WallCycles, PlaneCycles, MaskedCycles, WallScanCycles;
|
cycle_t WallCycles, PlaneCycles, MaskedCycles, WallScanCycles;
|
||||||
|
|
||||||
// PRIVATE DATA DEFINITIONS ------------------------------------------------
|
// PRIVATE DATA DEFINITIONS ------------------------------------------------
|
||||||
|
@ -848,13 +842,13 @@ void R_RenderActorView (AActor *actor, bool dontmaplines)
|
||||||
// [RH] Show off segs if r_drawflat is 1
|
// [RH] Show off segs if r_drawflat is 1
|
||||||
if (r_drawflat)
|
if (r_drawflat)
|
||||||
{
|
{
|
||||||
colfunc = R_FillColumn;
|
colfunc = &SWPixelFormatDrawers::FillColumn;
|
||||||
spanfunc = R_FillSpan;
|
spanfunc = &SWPixelFormatDrawers::FillSpan;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
colfunc = basecolfunc;
|
colfunc = basecolfunc;
|
||||||
spanfunc = R_DrawSpan;
|
spanfunc = &SWPixelFormatDrawers::DrawSpan;
|
||||||
}
|
}
|
||||||
|
|
||||||
WindowLeft = 0;
|
WindowLeft = 0;
|
||||||
|
|
|
@ -112,18 +112,6 @@ extern int fixedlightlev;
|
||||||
extern FSWColormap* fixedcolormap;
|
extern FSWColormap* fixedcolormap;
|
||||||
extern FSpecialColormap*realfixedcolormap;
|
extern FSpecialColormap*realfixedcolormap;
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// Function pointers to switch refresh/drawing functions.
|
|
||||||
// Used to select shadow mode etc.
|
|
||||||
//
|
|
||||||
extern void (*colfunc) (void);
|
|
||||||
extern void (*basecolfunc) (void);
|
|
||||||
extern void (*fuzzcolfunc) (void);
|
|
||||||
extern void (*transcolfunc) (void);
|
|
||||||
// No shadow effects on floors.
|
|
||||||
extern void (*spanfunc) (void);
|
|
||||||
|
|
||||||
void R_InitTextureMapping ();
|
void R_InitTextureMapping ();
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -318,7 +318,7 @@ void R_MapPlane (int y, int x1)
|
||||||
ds_x1 = x1;
|
ds_x1 = x1;
|
||||||
ds_x2 = x2;
|
ds_x2 = x2;
|
||||||
|
|
||||||
spanfunc ();
|
(R_Drawers()->*spanfunc)();
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -329,7 +329,7 @@ void R_MapPlane (int y, int x1)
|
||||||
|
|
||||||
void R_MapTiltedPlane (int y, int x1)
|
void R_MapTiltedPlane (int y, int x1)
|
||||||
{
|
{
|
||||||
R_DrawTiltedSpan(y, x1, spanend[y], plane_sz, plane_su, plane_sv, plane_shade, planeshade, planelightfloat, pviewx, pviewy);
|
R_Drawers()->DrawTiltedSpan(y, x1, spanend[y], plane_sz, plane_su, plane_sv, plane_shade, planeshade, planelightfloat, pviewx, pviewy);
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -340,14 +340,14 @@ void R_MapTiltedPlane (int y, int x1)
|
||||||
|
|
||||||
void R_MapColoredPlane(int y, int x1)
|
void R_MapColoredPlane(int y, int x1)
|
||||||
{
|
{
|
||||||
R_DrawColoredSpan(y, x1, spanend[y]);
|
R_Drawers()->DrawColoredSpan(y, x1, spanend[y]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_DrawFogBoundarySection(int y, int y2, int x1)
|
void R_DrawFogBoundarySection(int y, int y2, int x1)
|
||||||
{
|
{
|
||||||
for (; y < y2; ++y)
|
for (; y < y2; ++y)
|
||||||
{
|
{
|
||||||
R_DrawFogBoundaryLine(y, x1, spanend[y]);
|
R_Drawers()->DrawFogBoundaryLine(y, x1, spanend[y]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,13 +411,13 @@ void R_DrawFogBoundary(int x1, int x2, short *uclip, short *dclip)
|
||||||
while (t2 < stop)
|
while (t2 < stop)
|
||||||
{
|
{
|
||||||
int y = t2++;
|
int y = t2++;
|
||||||
R_DrawFogBoundaryLine(y, xr, spanend[y]);
|
R_Drawers()->DrawFogBoundaryLine(y, xr, spanend[y]);
|
||||||
}
|
}
|
||||||
stop = MAX(b1, t2);
|
stop = MAX(b1, t2);
|
||||||
while (b2 > stop)
|
while (b2 > stop)
|
||||||
{
|
{
|
||||||
int y = --b2;
|
int y = --b2;
|
||||||
R_DrawFogBoundaryLine(y, xr, spanend[y]);
|
R_Drawers()->DrawFogBoundaryLine(y, xr, spanend[y]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1038,9 +1038,9 @@ static void R_DrawSkyColumnStripe(int start_x, int y1, int y2, int columns, doub
|
||||||
uint32_t solid_bottom = frontskytex->GetSkyCapColor(true);
|
uint32_t solid_bottom = frontskytex->GetSkyCapColor(true);
|
||||||
|
|
||||||
if (!backskytex)
|
if (!backskytex)
|
||||||
R_DrawSingleSkyColumn(solid_top, solid_bottom);
|
R_Drawers()->DrawSingleSkyColumn(solid_top, solid_bottom);
|
||||||
else
|
else
|
||||||
R_DrawDoubleSkyColumn(solid_top, solid_bottom);
|
R_Drawers()->DrawDoubleSkyColumn(solid_top, solid_bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void R_DrawSkyColumn(int start_x, int y1, int y2, int columns)
|
static void R_DrawSkyColumn(int start_x, int y1, int y2, int columns)
|
||||||
|
@ -1745,7 +1745,7 @@ void R_DrawNormalPlane (visplane_t *pl, double _xscale, double _yscale, fixed_t
|
||||||
plane_shade = true;
|
plane_shade = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (spanfunc != R_FillSpan)
|
if (spanfunc != &SWPixelFormatDrawers::FillSpan)
|
||||||
{
|
{
|
||||||
if (masked)
|
if (masked)
|
||||||
{
|
{
|
||||||
|
@ -1753,7 +1753,7 @@ void R_DrawNormalPlane (visplane_t *pl, double _xscale, double _yscale, fixed_t
|
||||||
{
|
{
|
||||||
if (!additive)
|
if (!additive)
|
||||||
{
|
{
|
||||||
spanfunc = R_DrawSpanMaskedTranslucent;
|
spanfunc = &SWPixelFormatDrawers::DrawSpanMaskedTranslucent;
|
||||||
dc_srcblend = Col2RGB8[alpha>>10];
|
dc_srcblend = Col2RGB8[alpha>>10];
|
||||||
dc_destblend = Col2RGB8[(OPAQUE-alpha)>>10];
|
dc_destblend = Col2RGB8[(OPAQUE-alpha)>>10];
|
||||||
dc_srcalpha = alpha;
|
dc_srcalpha = alpha;
|
||||||
|
@ -1761,7 +1761,7 @@ void R_DrawNormalPlane (visplane_t *pl, double _xscale, double _yscale, fixed_t
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
spanfunc = R_DrawSpanMaskedAddClamp;
|
spanfunc = &SWPixelFormatDrawers::DrawSpanMaskedAddClamp;
|
||||||
dc_srcblend = Col2RGB8_LessPrecision[alpha>>10];
|
dc_srcblend = Col2RGB8_LessPrecision[alpha>>10];
|
||||||
dc_destblend = Col2RGB8_LessPrecision[FRACUNIT>>10];
|
dc_destblend = Col2RGB8_LessPrecision[FRACUNIT>>10];
|
||||||
dc_srcalpha = alpha;
|
dc_srcalpha = alpha;
|
||||||
|
@ -1770,7 +1770,7 @@ void R_DrawNormalPlane (visplane_t *pl, double _xscale, double _yscale, fixed_t
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
spanfunc = R_DrawSpanMasked;
|
spanfunc = &SWPixelFormatDrawers::DrawSpanMasked;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1779,7 +1779,7 @@ void R_DrawNormalPlane (visplane_t *pl, double _xscale, double _yscale, fixed_t
|
||||||
{
|
{
|
||||||
if (!additive)
|
if (!additive)
|
||||||
{
|
{
|
||||||
spanfunc = R_DrawSpanTranslucent;
|
spanfunc = &SWPixelFormatDrawers::DrawSpanTranslucent;
|
||||||
dc_srcblend = Col2RGB8[alpha>>10];
|
dc_srcblend = Col2RGB8[alpha>>10];
|
||||||
dc_destblend = Col2RGB8[(OPAQUE-alpha)>>10];
|
dc_destblend = Col2RGB8[(OPAQUE-alpha)>>10];
|
||||||
dc_srcalpha = alpha;
|
dc_srcalpha = alpha;
|
||||||
|
@ -1787,7 +1787,7 @@ void R_DrawNormalPlane (visplane_t *pl, double _xscale, double _yscale, fixed_t
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
spanfunc = R_DrawSpanAddClamp;
|
spanfunc = &SWPixelFormatDrawers::DrawSpanAddClamp;
|
||||||
dc_srcblend = Col2RGB8_LessPrecision[alpha>>10];
|
dc_srcblend = Col2RGB8_LessPrecision[alpha>>10];
|
||||||
dc_destblend = Col2RGB8_LessPrecision[FRACUNIT>>10];
|
dc_destblend = Col2RGB8_LessPrecision[FRACUNIT>>10];
|
||||||
dc_srcalpha = alpha;
|
dc_srcalpha = alpha;
|
||||||
|
@ -1796,7 +1796,7 @@ void R_DrawNormalPlane (visplane_t *pl, double _xscale, double _yscale, fixed_t
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
spanfunc = R_DrawSpan;
|
spanfunc = &SWPixelFormatDrawers::DrawSpan;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -368,7 +368,7 @@ void R_DrawMaskedColumnBgra(FTexture *tex, fixed_t col, bool unmasked)
|
||||||
double v = ((dc_yl + 0.5 - sprtopscreen) / spryscale) / tex->GetHeight();
|
double v = ((dc_yl + 0.5 - sprtopscreen) / spryscale) / tex->GetHeight();
|
||||||
dc_texturefrac = (uint32_t)(v * (1 << 30));
|
dc_texturefrac = (uint32_t)(v * (1 << 30));
|
||||||
|
|
||||||
colfunc();
|
(R_Drawers()->*colfunc)();
|
||||||
}
|
}
|
||||||
span++;
|
span++;
|
||||||
}
|
}
|
||||||
|
@ -443,7 +443,7 @@ void R_DrawMaskedColumn (FTexture *tex, fixed_t col, bool unmasked)
|
||||||
else if (dc_iscale < 0)
|
else if (dc_iscale < 0)
|
||||||
dc_count = MIN(dc_count, (dc_texturefrac - dc_iscale) / (-dc_iscale));
|
dc_count = MIN(dc_count, (dc_texturefrac - dc_iscale) / (-dc_iscale));
|
||||||
|
|
||||||
colfunc ();
|
(R_Drawers()->*colfunc)();
|
||||||
}
|
}
|
||||||
span++;
|
span++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -209,7 +209,7 @@ namespace swrenderer
|
||||||
dc_dest = dc_destorg + (dc_pitch * columnY1 + x) * pixelsize;
|
dc_dest = dc_destorg + (dc_pitch * columnY1 + x) * pixelsize;
|
||||||
dc_color = color;
|
dc_color = color;
|
||||||
dc_count = columnY2 - columnY1;
|
dc_count = columnY2 - columnY1;
|
||||||
R_FillColumn();
|
R_Drawers()->FillColumn();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,7 +188,7 @@ WallSampler::WallSampler(int y1, float swal, double yrepeat, fixed_t xoffset, do
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw a column with support for non-power-of-two ranges
|
// Draw a column with support for non-power-of-two ranges
|
||||||
static void Draw1Column(int x, int y1, int y2, WallSampler &sampler, void(*draw1column)())
|
static void Draw1Column(int x, int y1, int y2, WallSampler &sampler, DrawerFunc draw1column)
|
||||||
{
|
{
|
||||||
if (r_dynlights)
|
if (r_dynlights)
|
||||||
{
|
{
|
||||||
|
@ -265,7 +265,7 @@ static void Draw1Column(int x, int y1, int y2, WallSampler &sampler, void(*draw1
|
||||||
dc_iscale = sampler.uv_step;
|
dc_iscale = sampler.uv_step;
|
||||||
dc_texturefrac = sampler.uv_pos;
|
dc_texturefrac = sampler.uv_pos;
|
||||||
dc_textureheight = sampler.height;
|
dc_textureheight = sampler.height;
|
||||||
draw1column();
|
(R_Drawers()->*draw1column)();
|
||||||
|
|
||||||
uint64_t step64 = sampler.uv_step;
|
uint64_t step64 = sampler.uv_step;
|
||||||
uint64_t pos64 = sampler.uv_pos;
|
uint64_t pos64 = sampler.uv_pos;
|
||||||
|
@ -284,7 +284,7 @@ static void Draw1Column(int x, int y1, int y2, WallSampler &sampler, void(*draw1
|
||||||
dc_count = count;
|
dc_count = count;
|
||||||
dc_iscale = sampler.uv_step;
|
dc_iscale = sampler.uv_step;
|
||||||
dc_texturefrac = sampler.uv_pos;
|
dc_texturefrac = sampler.uv_pos;
|
||||||
draw1column();
|
(R_Drawers()->*draw1column)();
|
||||||
|
|
||||||
uint64_t step64 = sampler.uv_step;
|
uint64_t step64 = sampler.uv_step;
|
||||||
uint64_t pos64 = sampler.uv_pos;
|
uint64_t pos64 = sampler.uv_pos;
|
||||||
|
@ -310,7 +310,7 @@ static void Draw1Column(int x, int y1, int y2, WallSampler &sampler, void(*draw1
|
||||||
dc_count = count;
|
dc_count = count;
|
||||||
dc_iscale = sampler.uv_step;
|
dc_iscale = sampler.uv_step;
|
||||||
dc_texturefrac = uv_pos;
|
dc_texturefrac = uv_pos;
|
||||||
draw1column();
|
(R_Drawers()->*draw1column)();
|
||||||
|
|
||||||
left -= count;
|
left -= count;
|
||||||
uv_pos += sampler.uv_step * count;
|
uv_pos += sampler.uv_step * count;
|
||||||
|
@ -323,11 +323,9 @@ static void Draw1Column(int x, int y1, int y2, WallSampler &sampler, void(*draw1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef void(*DrawColumnFuncPtr)();
|
|
||||||
|
|
||||||
static void ProcessWallWorker(
|
static void ProcessWallWorker(
|
||||||
int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat,
|
int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat,
|
||||||
const BYTE *(*getcol)(FTexture *tex, int x), DrawColumnFuncPtr drawcolumn)
|
const BYTE *(*getcol)(FTexture *tex, int x), DrawerFunc drawcolumn)
|
||||||
{
|
{
|
||||||
if (rw_pic->UseType == FTexture::TEX_Null)
|
if (rw_pic->UseType == FTexture::TEX_Null)
|
||||||
return;
|
return;
|
||||||
|
@ -388,7 +386,7 @@ static void ProcessWallWorker(
|
||||||
|
|
||||||
static void ProcessNormalWall(int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, const BYTE *(*getcol)(FTexture *tex, int x) = R_GetColumn)
|
static void ProcessNormalWall(int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, const BYTE *(*getcol)(FTexture *tex, int x) = R_GetColumn)
|
||||||
{
|
{
|
||||||
ProcessWallWorker(x1, x2, uwal, dwal, swal, lwal, yrepeat, getcol, R_DrawWallColumn);
|
ProcessWallWorker(x1, x2, uwal, dwal, swal, lwal, yrepeat, getcol, &SWPixelFormatDrawers::DrawWallColumn);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ProcessMaskedWall(int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, const BYTE *(*getcol)(FTexture *tex, int x) = R_GetColumn)
|
static void ProcessMaskedWall(int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, const BYTE *(*getcol)(FTexture *tex, int x) = R_GetColumn)
|
||||||
|
@ -399,14 +397,14 @@ static void ProcessMaskedWall(int x1, int x2, short *uwal, short *dwal, float *s
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ProcessWallWorker(x1, x2, uwal, dwal, swal, lwal, yrepeat, getcol, R_DrawWallMaskedColumn);
|
ProcessWallWorker(x1, x2, uwal, dwal, swal, lwal, yrepeat, getcol, &SWPixelFormatDrawers::DrawWallMaskedColumn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ProcessTranslucentWall(int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, const BYTE *(*getcol)(FTexture *tex, int x) = R_GetColumn)
|
static void ProcessTranslucentWall(int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, const BYTE *(*getcol)(FTexture *tex, int x) = R_GetColumn)
|
||||||
{
|
{
|
||||||
void(*drawcol1)();
|
DrawerFunc drawcol1 = R_GetTransMaskDrawer();
|
||||||
if (!R_GetTransMaskDrawers(&drawcol1))
|
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(x1, x2, uwal, dwal, swal, lwal, yrepeat, getcol);
|
ProcessMaskedWall(x1, x2, uwal, dwal, swal, lwal, yrepeat, getcol);
|
||||||
|
|
|
@ -1481,7 +1481,7 @@ void DCanvas::FillSimplePoly(FTexture *tex, FVector2 *points, int npoints,
|
||||||
ds_xfrac = xs_RoundToInt(tex.X * scalex);
|
ds_xfrac = xs_RoundToInt(tex.X * scalex);
|
||||||
ds_yfrac = xs_RoundToInt(tex.Y * scaley);
|
ds_yfrac = xs_RoundToInt(tex.Y * scaley);
|
||||||
|
|
||||||
R_DrawSpan();
|
R_Drawers()->DrawSpan();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
x += xinc;
|
x += xinc;
|
||||||
|
|
Loading…
Reference in a new issue