mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-29 07:22:05 +00:00
Force all drawing to go through DrawerStyle
This commit is contained in:
parent
2f9453bc86
commit
4afac0f2cc
21 changed files with 145 additions and 96 deletions
|
@ -137,7 +137,7 @@ namespace swrenderer
|
||||||
SWTruecolorDrawers tc_drawers;
|
SWTruecolorDrawers tc_drawers;
|
||||||
}
|
}
|
||||||
|
|
||||||
SWPixelFormatDrawers *R_Drawers()
|
SWPixelFormatDrawers *DrawerStyle::Drawers() const
|
||||||
{
|
{
|
||||||
return active_drawers;
|
return active_drawers;
|
||||||
}
|
}
|
||||||
|
@ -235,7 +235,7 @@ namespace swrenderer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_SetColorMapLight(FSWColormap *base_colormap, float light, int shade)
|
void DrawerStyle::SetColorMapLight(FSWColormap *base_colormap, float light, int shade)
|
||||||
{
|
{
|
||||||
using namespace drawerargs;
|
using namespace drawerargs;
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ namespace swrenderer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_SetDSColorMapLight(FSWColormap *base_colormap, float light, int shade)
|
void DrawerStyle::SetDSColorMapLight(FSWColormap *base_colormap, float light, int shade)
|
||||||
{
|
{
|
||||||
using namespace drawerargs;
|
using namespace drawerargs;
|
||||||
|
|
||||||
|
@ -285,7 +285,7 @@ namespace swrenderer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_SetTranslationMap(lighttable_t *translation)
|
void DrawerStyle::SetTranslationMap(lighttable_t *translation)
|
||||||
{
|
{
|
||||||
using namespace drawerargs;
|
using namespace drawerargs;
|
||||||
|
|
||||||
|
@ -311,7 +311,7 @@ namespace swrenderer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_SetSpanTexture(FTexture *tex)
|
void DrawerStyle::SetSpanTexture(FTexture *tex)
|
||||||
{
|
{
|
||||||
using namespace drawerargs;
|
using namespace drawerargs;
|
||||||
|
|
||||||
|
@ -331,9 +331,9 @@ namespace swrenderer
|
||||||
ds_source_mipmapped = tex->Mipmapped() && tex->GetWidth() > 1 && tex->GetHeight() > 1;
|
ds_source_mipmapped = tex->Mipmapped() && tex->GetWidth() > 1 && tex->GetHeight() > 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_SetSpanColormap(FDynamicColormap *colormap, int shade)
|
void DrawerStyle::SetSpanColormap(FDynamicColormap *colormap, int shade)
|
||||||
{
|
{
|
||||||
R_SetDSColorMapLight(colormap, 0, shade);
|
SetDSColorMapLight(colormap, 0, shade);
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_UpdateFuzzPos()
|
void R_UpdateFuzzPos()
|
||||||
|
@ -419,7 +419,7 @@ namespace swrenderer
|
||||||
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));
|
||||||
|
|
||||||
(R_Drawers()->*colfunc)();
|
(Drawers()->*colfunc)();
|
||||||
}
|
}
|
||||||
span++;
|
span++;
|
||||||
}
|
}
|
||||||
|
@ -536,7 +536,7 @@ namespace swrenderer
|
||||||
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));
|
||||||
|
|
||||||
(R_Drawers()->*colfunc)();
|
(Drawers()->*colfunc)();
|
||||||
}
|
}
|
||||||
span++;
|
span++;
|
||||||
}
|
}
|
||||||
|
@ -750,11 +750,11 @@ namespace swrenderer
|
||||||
{
|
{
|
||||||
fixed_t shade = shadedlightshade;
|
fixed_t shade = shadedlightshade;
|
||||||
if (shade == 0) FIXEDLIGHT2SHADE(cameraLight->fixedlightlev);
|
if (shade == 0) FIXEDLIGHT2SHADE(cameraLight->fixedlightlev);
|
||||||
R_SetColorMapLight(basecolormap, 0, shade);
|
SetColorMapLight(basecolormap, 0, shade);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
R_SetColorMapLight(basecolormap, 0, shadedlightshade);
|
SetColorMapLight(basecolormap, 0, shadedlightshade);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -781,7 +781,7 @@ namespace swrenderer
|
||||||
// dc_srccolor is used by the R_Fill* routines. It is premultiplied
|
// dc_srccolor is used by the R_Fill* routines. It is premultiplied
|
||||||
// with the alpha.
|
// with the alpha.
|
||||||
dc_srccolor = ((((r*x) >> 4) << 20) | ((g*x) >> 4) | ((((b)*x) >> 4) << 10)) & 0x3feffbff;
|
dc_srccolor = ((((r*x) >> 4) << 20) | ((g*x) >> 4) | ((((b)*x) >> 4) << 10)) & 0x3feffbff;
|
||||||
R_SetColorMapLight(&identitycolormap, 0, 0);
|
SetColorMapLight(&identitycolormap, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!DrawerStyle::SetBlendFunc(style.BlendOp, fglevel, bglevel, style.Flags))
|
if (!DrawerStyle::SetBlendFunc(style.BlendOp, fglevel, bglevel, style.Flags))
|
||||||
|
|
|
@ -159,8 +159,6 @@ namespace swrenderer
|
||||||
|
|
||||||
typedef void(SWPixelFormatDrawers::*DrawerFunc)();
|
typedef void(SWPixelFormatDrawers::*DrawerFunc)();
|
||||||
|
|
||||||
SWPixelFormatDrawers *R_Drawers();
|
|
||||||
|
|
||||||
void R_InitColumnDrawers();
|
void R_InitColumnDrawers();
|
||||||
void R_InitShadeMaps();
|
void R_InitShadeMaps();
|
||||||
void R_InitFuzzTable(int fuzzoff);
|
void R_InitFuzzTable(int fuzzoff);
|
||||||
|
@ -168,14 +166,6 @@ namespace swrenderer
|
||||||
|
|
||||||
void R_UpdateFuzzPos();
|
void R_UpdateFuzzPos();
|
||||||
|
|
||||||
// Sets dc_colormap and dc_light to their appropriate values depending on the output format (pal vs true color)
|
|
||||||
void R_SetColorMapLight(FSWColormap *base_colormap, float light, int shade);
|
|
||||||
void R_SetDSColorMapLight(FSWColormap *base_colormap, float light, int shade);
|
|
||||||
void R_SetTranslationMap(lighttable_t *translation);
|
|
||||||
|
|
||||||
void R_SetSpanTexture(FTexture *tex);
|
|
||||||
void R_SetSpanColormap(FDynamicColormap *colormap, int shade);
|
|
||||||
|
|
||||||
class DrawerStyle
|
class DrawerStyle
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -194,6 +184,14 @@ namespace swrenderer
|
||||||
|
|
||||||
void DrawMaskedColumn(int x, fixed_t iscale, FTexture *texture, fixed_t column, double spryscale, double sprtopscreen, bool sprflipvert, const short *mfloorclip, const short *mceilingclip, bool unmasked = false);
|
void DrawMaskedColumn(int x, fixed_t iscale, FTexture *texture, fixed_t column, double spryscale, double sprtopscreen, bool sprflipvert, const short *mfloorclip, const short *mceilingclip, bool unmasked = false);
|
||||||
|
|
||||||
|
// Sets dc_colormap and dc_light to their appropriate values depending on the output format (pal vs true color)
|
||||||
|
void SetColorMapLight(FSWColormap *base_colormap, float light, int shade);
|
||||||
|
void SetDSColorMapLight(FSWColormap *base_colormap, float light, int shade);
|
||||||
|
void SetTranslationMap(lighttable_t *translation);
|
||||||
|
|
||||||
|
void SetSpanTexture(FTexture *tex);
|
||||||
|
void SetSpanColormap(FDynamicColormap *colormap, int shade);
|
||||||
|
|
||||||
DrawerFunc GetTransMaskDrawer();
|
DrawerFunc GetTransMaskDrawer();
|
||||||
|
|
||||||
DrawerFunc colfunc;
|
DrawerFunc colfunc;
|
||||||
|
@ -202,6 +200,38 @@ namespace swrenderer
|
||||||
DrawerFunc transcolfunc;
|
DrawerFunc transcolfunc;
|
||||||
DrawerFunc spanfunc;
|
DrawerFunc spanfunc;
|
||||||
|
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
Drawers()->DrawTiltedSpan(y, x1, x2, plane_sz, plane_su, plane_sv, plane_shade, planeshade, planelightfloat, pviewx, pviewy, basecolormap);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawFogBoundaryLine(int y, int x1, int x2)
|
||||||
|
{
|
||||||
|
Drawers()->DrawFogBoundaryLine(y, x1, x2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawColoredSpan(int y, int x1, int x2)
|
||||||
|
{
|
||||||
|
Drawers()->DrawColoredSpan(y, x1, x2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawSingleSkyColumn(uint32_t solid_top, uint32_t solid_bottom, bool fadeSky)
|
||||||
|
{
|
||||||
|
Drawers()->DrawSingleSkyColumn(solid_top, solid_bottom, fadeSky);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawDoubleSkyColumn(uint32_t solid_top, uint32_t solid_bottom, bool fadeSky)
|
||||||
|
{
|
||||||
|
Drawers()->DrawDoubleSkyColumn(solid_top, solid_bottom, fadeSky);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FillColumn()
|
||||||
|
{
|
||||||
|
Drawers()->FillColumn();
|
||||||
|
}
|
||||||
|
|
||||||
|
SWPixelFormatDrawers *Drawers() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void DrawMaskedColumnBgra(int x, fixed_t iscale, FTexture *tex, fixed_t column, double spryscale, double sprtopscreen, bool sprflipvert, const short *mfloorclip, const short *mceilingclip, bool unmasked);
|
void DrawMaskedColumnBgra(int x, fixed_t iscale, FTexture *tex, fixed_t column, double spryscale, double sprtopscreen, bool sprflipvert, const short *mfloorclip, const short *mceilingclip, bool unmasked);
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ namespace swrenderer
|
||||||
fillshort(spanend + t2, b2 - t2, x);
|
fillshort(spanend + t2, b2 - t2, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
R_SetColorMapLight(basecolormap, (float)light, wallshade);
|
drawerstyle.SetColorMapLight(basecolormap, (float)light, wallshade);
|
||||||
|
|
||||||
uint8_t *fake_dc_colormap = basecolormap->Maps + (GETPALOOKUP(light, wallshade) << COLORMAPSHIFT);
|
uint8_t *fake_dc_colormap = basecolormap->Maps + (GETPALOOKUP(light, wallshade) << COLORMAPSHIFT);
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ namespace swrenderer
|
||||||
fillshort(spanend + t2, b2 - t2, x);
|
fillshort(spanend + t2, b2 - t2, x);
|
||||||
}
|
}
|
||||||
rcolormap = lcolormap;
|
rcolormap = lcolormap;
|
||||||
R_SetColorMapLight(basecolormap, (float)light, wallshade);
|
drawerstyle.SetColorMapLight(basecolormap, (float)light, wallshade);
|
||||||
fake_dc_colormap = basecolormap->Maps + (GETPALOOKUP(light, wallshade) << COLORMAPSHIFT);
|
fake_dc_colormap = basecolormap->Maps + (GETPALOOKUP(light, wallshade) << COLORMAPSHIFT);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -102,13 +102,13 @@ namespace swrenderer
|
||||||
while (t2 < stop)
|
while (t2 < stop)
|
||||||
{
|
{
|
||||||
int y = t2++;
|
int y = t2++;
|
||||||
R_Drawers()->DrawFogBoundaryLine(y, xr, spanend[y]);
|
drawerstyle.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_Drawers()->DrawFogBoundaryLine(y, xr, spanend[y]);
|
drawerstyle.DrawFogBoundaryLine(y, xr, spanend[y]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -142,7 +142,7 @@ namespace swrenderer
|
||||||
{
|
{
|
||||||
for (; y < y2; ++y)
|
for (; y < y2; ++y)
|
||||||
{
|
{
|
||||||
R_Drawers()->DrawFogBoundaryLine(y, x1, spanend[y]);
|
drawerstyle.DrawFogBoundaryLine(y, x1, spanend[y]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "swrenderer/drawers/r_draw.h"
|
||||||
|
|
||||||
namespace swrenderer
|
namespace swrenderer
|
||||||
{
|
{
|
||||||
class RenderFogBoundary
|
class RenderFogBoundary
|
||||||
|
@ -24,5 +26,6 @@ namespace swrenderer
|
||||||
void RenderSection(int y, int y2, int x1);
|
void RenderSection(int y, int y2, int x1);
|
||||||
|
|
||||||
short spanend[MAXHEIGHT];
|
short spanend[MAXHEIGHT];
|
||||||
|
DrawerStyle drawerstyle;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -932,11 +932,13 @@ namespace swrenderer
|
||||||
double yscale;
|
double yscale;
|
||||||
fixed_t xoffset = rw_offset;
|
fixed_t xoffset = rw_offset;
|
||||||
|
|
||||||
|
DrawerStyle drawerstyle;
|
||||||
|
|
||||||
CameraLight *cameraLight = CameraLight::Instance();
|
CameraLight *cameraLight = CameraLight::Instance();
|
||||||
if (cameraLight->fixedlightlev >= 0)
|
if (cameraLight->fixedlightlev >= 0)
|
||||||
R_SetColorMapLight((!level.PreserveSectorColor()) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
|
drawerstyle.SetColorMapLight((!level.PreserveSectorColor()) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
|
||||||
else if (cameraLight->fixedcolormap != nullptr)
|
else if (cameraLight->fixedcolormap != nullptr)
|
||||||
R_SetColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
drawerstyle.SetColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
||||||
|
|
||||||
// clip wall to the floor and ceiling
|
// clip wall to the floor and ceiling
|
||||||
auto ceilingclip = RenderOpaquePass::Instance()->ceilingclip;
|
auto ceilingclip = RenderOpaquePass::Instance()->ceilingclip;
|
||||||
|
@ -1044,7 +1046,6 @@ namespace swrenderer
|
||||||
rw_offset = -rw_offset;
|
rw_offset = -rw_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawerStyle drawerstyle;
|
|
||||||
RenderWallPart renderWallpart;
|
RenderWallPart renderWallpart;
|
||||||
renderWallpart.Render(drawerstyle, frontsector, curline, WallC, rw_pic, x1, x2, walltop.ScreenY, wallbottom.ScreenY, rw_midtexturemid, walltexcoords.VStep, walltexcoords.UPos, yscale, MAX(rw_frontcz1, rw_frontcz2), MIN(rw_frontfz1, rw_frontfz2), false, wallshade, rw_offset, rw_light, rw_lightstep, light_list, foggy, basecolormap);
|
renderWallpart.Render(drawerstyle, frontsector, curline, WallC, rw_pic, x1, x2, walltop.ScreenY, wallbottom.ScreenY, rw_midtexturemid, walltexcoords.VStep, walltexcoords.UPos, yscale, MAX(rw_frontcz1, rw_frontcz2), MIN(rw_frontfz1, rw_frontfz2), false, wallshade, rw_offset, rw_light, rw_lightstep, light_list, foggy, basecolormap);
|
||||||
}
|
}
|
||||||
|
@ -1082,7 +1083,6 @@ namespace swrenderer
|
||||||
rw_offset = -rw_offset;
|
rw_offset = -rw_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawerStyle drawerstyle;
|
|
||||||
RenderWallPart renderWallpart;
|
RenderWallPart renderWallpart;
|
||||||
renderWallpart.Render(drawerstyle, frontsector, curline, WallC, rw_pic, x1, x2, walltop.ScreenY, wallupper.ScreenY, rw_toptexturemid, walltexcoords.VStep, walltexcoords.UPos, yscale, MAX(rw_frontcz1, rw_frontcz2), MIN(rw_backcz1, rw_backcz2), false, wallshade, rw_offset, rw_light, rw_lightstep, light_list, foggy, basecolormap);
|
renderWallpart.Render(drawerstyle, frontsector, curline, WallC, rw_pic, x1, x2, walltop.ScreenY, wallupper.ScreenY, rw_toptexturemid, walltexcoords.VStep, walltexcoords.UPos, yscale, MAX(rw_frontcz1, rw_frontcz2), MIN(rw_backcz1, rw_backcz2), false, wallshade, rw_offset, rw_light, rw_lightstep, light_list, foggy, basecolormap);
|
||||||
}
|
}
|
||||||
|
@ -1123,7 +1123,6 @@ namespace swrenderer
|
||||||
rw_offset = -rw_offset;
|
rw_offset = -rw_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawerStyle drawerstyle;
|
|
||||||
RenderWallPart renderWallpart;
|
RenderWallPart renderWallpart;
|
||||||
renderWallpart.Render(drawerstyle, frontsector, curline, WallC, rw_pic, x1, x2, walllower.ScreenY, wallbottom.ScreenY, rw_bottomtexturemid, walltexcoords.VStep, walltexcoords.UPos, yscale, MAX(rw_backfz1, rw_backfz2), MIN(rw_frontfz1, rw_frontfz2), false, wallshade, rw_offset, rw_light, rw_lightstep, light_list, foggy, basecolormap);
|
renderWallpart.Render(drawerstyle, frontsector, curline, WallC, rw_pic, x1, x2, walllower.ScreenY, wallbottom.ScreenY, rw_bottomtexturemid, walltexcoords.VStep, walltexcoords.UPos, yscale, MAX(rw_backfz1, rw_backfz2), MIN(rw_frontfz1, rw_frontfz2), false, wallshade, rw_offset, rw_light, rw_lightstep, light_list, foggy, basecolormap);
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,9 +141,9 @@ namespace swrenderer
|
||||||
rw_scalestep = ds->iscalestep;
|
rw_scalestep = ds->iscalestep;
|
||||||
|
|
||||||
if (cameraLight->fixedlightlev >= 0)
|
if (cameraLight->fixedlightlev >= 0)
|
||||||
R_SetColorMapLight((!level.PreserveSectorColor()) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
|
drawerstyle.SetColorMapLight((!level.PreserveSectorColor()) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
|
||||||
else if (cameraLight->fixedcolormap != nullptr)
|
else if (cameraLight->fixedcolormap != nullptr)
|
||||||
R_SetColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
drawerstyle.SetColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
||||||
|
|
||||||
// find positioning
|
// find positioning
|
||||||
texheight = tex->GetScaledHeightDouble();
|
texheight = tex->GetScaledHeightDouble();
|
||||||
|
@ -272,7 +272,7 @@ namespace swrenderer
|
||||||
{
|
{
|
||||||
if (cameraLight->fixedcolormap == nullptr && cameraLight->fixedlightlev < 0)
|
if (cameraLight->fixedcolormap == nullptr && cameraLight->fixedlightlev < 0)
|
||||||
{
|
{
|
||||||
R_SetColorMapLight(basecolormap, rw_light, wallshade);
|
drawerstyle.SetColorMapLight(basecolormap, rw_light, wallshade);
|
||||||
}
|
}
|
||||||
|
|
||||||
fixed_t iscale = xs_Fix<16>::ToFix(MaskedSWall[x] * MaskedScaleY);
|
fixed_t iscale = xs_Fix<16>::ToFix(MaskedSWall[x] * MaskedScaleY);
|
||||||
|
@ -444,9 +444,9 @@ namespace swrenderer
|
||||||
|
|
||||||
CameraLight *cameraLight = CameraLight::Instance();
|
CameraLight *cameraLight = CameraLight::Instance();
|
||||||
if (cameraLight->fixedlightlev >= 0)
|
if (cameraLight->fixedlightlev >= 0)
|
||||||
R_SetColorMapLight((!level.PreserveSectorColor()) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
|
drawerstyle.SetColorMapLight((!level.PreserveSectorColor()) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
|
||||||
else if (cameraLight->fixedcolormap != nullptr)
|
else if (cameraLight->fixedcolormap != nullptr)
|
||||||
R_SetColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
drawerstyle.SetColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
||||||
|
|
||||||
WallC.sz1 = ds->sz1;
|
WallC.sz1 = ds->sz1;
|
||||||
WallC.sz2 = ds->sz2;
|
WallC.sz2 = ds->sz2;
|
||||||
|
|
|
@ -250,7 +250,7 @@ namespace swrenderer
|
||||||
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;
|
||||||
(R_Drawers()->*draw1column)();
|
(drawerstyle.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;
|
||||||
|
@ -269,7 +269,7 @@ namespace swrenderer
|
||||||
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;
|
||||||
(R_Drawers()->*draw1column)();
|
(drawerstyle.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;
|
||||||
|
@ -295,7 +295,7 @@ namespace swrenderer
|
||||||
dc_count = count;
|
dc_count = count;
|
||||||
dc_iscale = sampler.uv_step;
|
dc_iscale = sampler.uv_step;
|
||||||
dc_texturefrac = uv_pos;
|
dc_texturefrac = uv_pos;
|
||||||
(R_Drawers()->*draw1column)();
|
(drawerstyle.Drawers()->*draw1column)();
|
||||||
|
|
||||||
left -= count;
|
left -= count;
|
||||||
uv_pos += sampler.uv_step * count;
|
uv_pos += sampler.uv_step * count;
|
||||||
|
@ -341,9 +341,9 @@ namespace swrenderer
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cameraLight->fixedcolormap)
|
if (cameraLight->fixedcolormap)
|
||||||
R_SetColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
drawerstyle.SetColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
||||||
else
|
else
|
||||||
R_SetColorMapLight(basecolormap, 0, 0);
|
drawerstyle.SetColorMapLight(basecolormap, 0, 0);
|
||||||
|
|
||||||
float dx = WallC.tright.X - WallC.tleft.X;
|
float dx = WallC.tright.X - WallC.tleft.X;
|
||||||
float dy = WallC.tright.Y - WallC.tleft.Y;
|
float dy = WallC.tright.Y - WallC.tleft.Y;
|
||||||
|
@ -362,7 +362,7 @@ namespace swrenderer
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!fixed)
|
if (!fixed)
|
||||||
R_SetColorMapLight(basecolormap, light, wallshade);
|
drawerstyle.SetColorMapLight(basecolormap, light, wallshade);
|
||||||
|
|
||||||
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]));
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
|
|
||||||
namespace swrenderer
|
namespace swrenderer
|
||||||
{
|
{
|
||||||
void RenderFlatPlane::Render(VisiblePlane *pl, double _xscale, double _yscale, fixed_t alpha, bool additive, bool masked, FDynamicColormap *colormap)
|
void RenderFlatPlane::Render(VisiblePlane *pl, double _xscale, double _yscale, fixed_t alpha, bool additive, bool masked, FDynamicColormap *colormap, FTexture *texture)
|
||||||
{
|
{
|
||||||
using namespace drawerargs;
|
using namespace drawerargs;
|
||||||
|
|
||||||
|
@ -53,6 +53,8 @@ namespace swrenderer
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
drawerstyle.SetSpanTexture(texture);
|
||||||
|
|
||||||
double planeang = (pl->xform.Angle + pl->xform.baseAngle).Radians();
|
double planeang = (pl->xform.Angle + pl->xform.baseAngle).Radians();
|
||||||
double xstep, ystep, leftxfrac, leftyfrac, rightxfrac, rightyfrac;
|
double xstep, ystep, leftxfrac, leftyfrac, rightxfrac, rightyfrac;
|
||||||
double x;
|
double x;
|
||||||
|
@ -111,12 +113,12 @@ namespace swrenderer
|
||||||
CameraLight *cameraLight = CameraLight::Instance();
|
CameraLight *cameraLight = CameraLight::Instance();
|
||||||
if (cameraLight->fixedlightlev >= 0)
|
if (cameraLight->fixedlightlev >= 0)
|
||||||
{
|
{
|
||||||
R_SetDSColorMapLight(basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
|
drawerstyle.SetDSColorMapLight(basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
|
||||||
plane_shade = false;
|
plane_shade = false;
|
||||||
}
|
}
|
||||||
else if (cameraLight->fixedcolormap)
|
else if (cameraLight->fixedcolormap)
|
||||||
{
|
{
|
||||||
R_SetDSColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
drawerstyle.SetDSColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
||||||
plane_shade = false;
|
plane_shade = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -184,7 +186,7 @@ namespace swrenderer
|
||||||
if (plane_shade)
|
if (plane_shade)
|
||||||
{
|
{
|
||||||
// Determine lighting based on the span's distance from the viewer.
|
// Determine lighting based on the span's distance from the viewer.
|
||||||
R_SetDSColorMapLight(basecolormap, (float)(GlobVis * fabs(CenterY - y)), planeshade);
|
drawerstyle.SetDSColorMapLight(basecolormap, (float)(GlobVis * fabs(CenterY - y)), planeshade);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r_dynlights)
|
if (r_dynlights)
|
||||||
|
@ -255,7 +257,7 @@ namespace swrenderer
|
||||||
ds_x1 = x1;
|
ds_x1 = x1;
|
||||||
ds_x2 = x2;
|
ds_x2 = x2;
|
||||||
|
|
||||||
(R_Drawers()->*drawerstyle.spanfunc)();
|
(drawerstyle.Drawers()->*drawerstyle.spanfunc)();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderFlatPlane::StepColumn()
|
void RenderFlatPlane::StepColumn()
|
||||||
|
@ -317,6 +319,6 @@ namespace swrenderer
|
||||||
|
|
||||||
void RenderColoredPlane::RenderLine(int y, int x1, int x2)
|
void RenderColoredPlane::RenderLine(int y, int x1, int x2)
|
||||||
{
|
{
|
||||||
R_Drawers()->DrawColoredSpan(y, x1, x2);
|
drawerstyle.DrawColoredSpan(y, x1, x2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace swrenderer
|
||||||
class RenderFlatPlane : PlaneRenderer
|
class RenderFlatPlane : PlaneRenderer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void Render(VisiblePlane *pl, double _xscale, double _yscale, fixed_t alpha, bool additive, bool masked, FDynamicColormap *basecolormap);
|
void Render(VisiblePlane *pl, double _xscale, double _yscale, fixed_t alpha, bool additive, bool masked, FDynamicColormap *basecolormap, FTexture *texture);
|
||||||
|
|
||||||
static void SetupSlope();
|
static void SetupSlope();
|
||||||
|
|
||||||
|
@ -54,5 +54,7 @@ namespace swrenderer
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void RenderLine(int y, int x1, int x2) override;
|
void RenderLine(int y, int x1, int x2) override;
|
||||||
|
|
||||||
|
DrawerStyle drawerstyle;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,13 +151,13 @@ namespace swrenderer
|
||||||
CameraLight *cameraLight = CameraLight::Instance();
|
CameraLight *cameraLight = CameraLight::Instance();
|
||||||
if (cameraLight->fixedcolormap)
|
if (cameraLight->fixedcolormap)
|
||||||
{
|
{
|
||||||
R_SetColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
drawerstyle.SetColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fakefixed = true;
|
fakefixed = true;
|
||||||
cameraLight->fixedcolormap = &NormalLight;
|
cameraLight->fixedcolormap = &NormalLight;
|
||||||
R_SetColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
drawerstyle.SetColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawSky(pl);
|
DrawSky(pl);
|
||||||
|
@ -228,9 +228,9 @@ namespace swrenderer
|
||||||
bool fadeSky = (r_skymode == 2 && !(level.flags & LEVEL_FORCETILEDSKY));
|
bool fadeSky = (r_skymode == 2 && !(level.flags & LEVEL_FORCETILEDSKY));
|
||||||
|
|
||||||
if (!backskytex)
|
if (!backskytex)
|
||||||
R_Drawers()->DrawSingleSkyColumn(solid_top, solid_bottom, fadeSky);
|
drawerstyle.DrawSingleSkyColumn(solid_top, solid_bottom, fadeSky);
|
||||||
else
|
else
|
||||||
R_Drawers()->DrawDoubleSkyColumn(solid_top, solid_bottom, fadeSky);
|
drawerstyle.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, int columns)
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "r_visibleplane.h"
|
#include "r_visibleplane.h"
|
||||||
|
#include "swrenderer/drawers/r_draw.h"
|
||||||
|
|
||||||
namespace swrenderer
|
namespace swrenderer
|
||||||
{
|
{
|
||||||
|
@ -36,5 +37,7 @@ namespace swrenderer
|
||||||
fixed_t backcyl = 0;
|
fixed_t backcyl = 0;
|
||||||
double skymid = 0.0;
|
double skymid = 0.0;
|
||||||
angle_t skyangle = 0;
|
angle_t skyangle = 0;
|
||||||
|
|
||||||
|
DrawerStyle drawerstyle;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
|
|
||||||
namespace swrenderer
|
namespace swrenderer
|
||||||
{
|
{
|
||||||
void RenderSlopePlane::Render(VisiblePlane *pl, double _xscale, double _yscale, fixed_t alpha, bool additive, bool masked, FDynamicColormap *colormap)
|
void RenderSlopePlane::Render(VisiblePlane *pl, double _xscale, double _yscale, fixed_t alpha, bool additive, bool masked, FDynamicColormap *colormap, FTexture *texture)
|
||||||
{
|
{
|
||||||
using namespace drawerargs;
|
using namespace drawerargs;
|
||||||
|
|
||||||
|
@ -72,6 +72,8 @@ namespace swrenderer
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
drawerstyle.SetSpanTexture(texture);
|
||||||
|
|
||||||
lxscale = _xscale * ifloatpow2[ds_xbits];
|
lxscale = _xscale * ifloatpow2[ds_xbits];
|
||||||
lyscale = _yscale * ifloatpow2[ds_ybits];
|
lyscale = _yscale * ifloatpow2[ds_ybits];
|
||||||
xscale = 64.f / lxscale;
|
xscale = 64.f / lxscale;
|
||||||
|
@ -153,17 +155,17 @@ namespace swrenderer
|
||||||
CameraLight *cameraLight = CameraLight::Instance();
|
CameraLight *cameraLight = CameraLight::Instance();
|
||||||
if (cameraLight->fixedlightlev >= 0)
|
if (cameraLight->fixedlightlev >= 0)
|
||||||
{
|
{
|
||||||
R_SetDSColorMapLight(basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
|
drawerstyle.SetDSColorMapLight(basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
|
||||||
plane_shade = false;
|
plane_shade = false;
|
||||||
}
|
}
|
||||||
else if (cameraLight->fixedcolormap)
|
else if (cameraLight->fixedcolormap)
|
||||||
{
|
{
|
||||||
R_SetDSColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
drawerstyle.SetDSColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
||||||
plane_shade = false;
|
plane_shade = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
R_SetDSColorMapLight(basecolormap, 0, 0);
|
drawerstyle.SetDSColorMapLight(basecolormap, 0, 0);
|
||||||
plane_shade = true;
|
plane_shade = true;
|
||||||
planeshade = LIGHT2SHADE(pl->lightlevel);
|
planeshade = LIGHT2SHADE(pl->lightlevel);
|
||||||
}
|
}
|
||||||
|
@ -183,6 +185,6 @@ namespace swrenderer
|
||||||
|
|
||||||
void RenderSlopePlane::RenderLine(int y, int x1, int x2)
|
void RenderSlopePlane::RenderLine(int y, int x1, int x2)
|
||||||
{
|
{
|
||||||
R_Drawers()->DrawTiltedSpan(y, x1, x2, plane_sz, plane_su, plane_sv, plane_shade, planeshade, planelightfloat, pviewx, pviewy, basecolormap);
|
drawerstyle.DrawTiltedSpan(y, x1, x2, plane_sz, plane_su, plane_sv, plane_shade, planeshade, planelightfloat, pviewx, pviewy, basecolormap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,13 +14,14 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "r_planerenderer.h"
|
#include "r_planerenderer.h"
|
||||||
|
#include "swrenderer/drawers/r_draw.h"
|
||||||
|
|
||||||
namespace swrenderer
|
namespace swrenderer
|
||||||
{
|
{
|
||||||
class RenderSlopePlane : PlaneRenderer
|
class RenderSlopePlane : PlaneRenderer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void Render(VisiblePlane *pl, double _xscale, double _yscale, fixed_t alpha, bool additive, bool masked, FDynamicColormap *basecolormap);
|
void Render(VisiblePlane *pl, double _xscale, double _yscale, fixed_t alpha, bool additive, bool masked, FDynamicColormap *basecolormap, FTexture *texture);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void RenderLine(int y, int x1, int x2) override;
|
void RenderLine(int y, int x1, int x2) override;
|
||||||
|
@ -32,5 +33,6 @@ namespace swrenderer
|
||||||
fixed_t pviewx, pviewy;
|
fixed_t pviewx, pviewy;
|
||||||
fixed_t xscale, yscale;
|
fixed_t xscale, yscale;
|
||||||
FDynamicColormap *basecolormap;
|
FDynamicColormap *basecolormap;
|
||||||
|
DrawerStyle drawerstyle;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,19 +114,18 @@ namespace swrenderer
|
||||||
{ // Don't waste time on a masked texture if it isn't really masked.
|
{ // Don't waste time on a masked texture if it isn't really masked.
|
||||||
masked = false;
|
masked = false;
|
||||||
}
|
}
|
||||||
R_SetSpanTexture(tex);
|
|
||||||
double xscale = xform.xScale * tex->Scale.X;
|
double xscale = xform.xScale * tex->Scale.X;
|
||||||
double yscale = xform.yScale * tex->Scale.Y;
|
double yscale = xform.yScale * tex->Scale.Y;
|
||||||
|
|
||||||
if (!height.isSlope() && !tilt)
|
if (!height.isSlope() && !tilt)
|
||||||
{
|
{
|
||||||
RenderFlatPlane renderer;
|
RenderFlatPlane renderer;
|
||||||
renderer.Render(this, xscale, yscale, alpha, additive, masked, colormap);
|
renderer.Render(this, xscale, yscale, alpha, additive, masked, colormap, tex);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RenderSlopePlane renderer;
|
RenderSlopePlane renderer;
|
||||||
renderer.Render(this, xscale, yscale, alpha, additive, masked, colormap);
|
renderer.Render(this, xscale, yscale, alpha, additive, masked, colormap, tex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
NetUpdate();
|
NetUpdate();
|
||||||
|
|
|
@ -252,15 +252,8 @@ namespace swrenderer
|
||||||
}
|
}
|
||||||
|
|
||||||
light = lightleft + (x1 - savecoord.sx1) * lightstep;
|
light = lightleft + (x1 - savecoord.sx1) * lightstep;
|
||||||
|
|
||||||
cameraLight = CameraLight::Instance();
|
cameraLight = CameraLight::Instance();
|
||||||
if (cameraLight->fixedlightlev >= 0)
|
|
||||||
R_SetColorMapLight((!level.PreserveSectorColor()) ? &FullNormalLight : usecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
|
|
||||||
else if (cameraLight->fixedcolormap != NULL)
|
|
||||||
R_SetColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
|
||||||
else if (!foggy && (decal->RenderFlags & RF_FULLBRIGHT))
|
|
||||||
R_SetColorMapLight((!level.PreserveSectorColor()) ? &FullNormalLight : usecolormap, 0, 0);
|
|
||||||
else
|
|
||||||
calclighting = true;
|
|
||||||
|
|
||||||
// Draw it
|
// Draw it
|
||||||
bool sprflipvert;
|
bool sprflipvert;
|
||||||
|
@ -281,6 +274,16 @@ namespace swrenderer
|
||||||
int x = x1;
|
int x = x1;
|
||||||
|
|
||||||
DrawerStyle drawerstyle;
|
DrawerStyle drawerstyle;
|
||||||
|
|
||||||
|
if (cameraLight->fixedlightlev >= 0)
|
||||||
|
drawerstyle.SetColorMapLight((!level.PreserveSectorColor()) ? &FullNormalLight : usecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
|
||||||
|
else if (cameraLight->fixedcolormap != NULL)
|
||||||
|
drawerstyle.SetColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
||||||
|
else if (!foggy && (decal->RenderFlags & RF_FULLBRIGHT))
|
||||||
|
drawerstyle.SetColorMapLight((!level.PreserveSectorColor()) ? &FullNormalLight : usecolormap, 0, 0);
|
||||||
|
else
|
||||||
|
calclighting = true;
|
||||||
|
|
||||||
bool visible = drawerstyle.SetPatchStyle(decal->RenderStyle, (float)decal->Alpha, decal->Translation, decal->AlphaColor, basecolormap);
|
bool visible = drawerstyle.SetPatchStyle(decal->RenderStyle, (float)decal->Alpha, decal->Translation, decal->AlphaColor, basecolormap);
|
||||||
|
|
||||||
// R_SetPatchStyle can modify basecolormap.
|
// R_SetPatchStyle can modify basecolormap.
|
||||||
|
@ -295,7 +298,7 @@ namespace swrenderer
|
||||||
{
|
{
|
||||||
if (calclighting)
|
if (calclighting)
|
||||||
{ // calculate lighting
|
{ // calculate lighting
|
||||||
R_SetColorMapLight(usecolormap, light, wallshade);
|
drawerstyle.SetColorMapLight(usecolormap, light, wallshade);
|
||||||
}
|
}
|
||||||
DrawColumn(drawerstyle, x, WallSpriteTile, walltexcoords, texturemid, maskedScaleY, sprflipvert, mfloorclip, mceilingclip);
|
DrawColumn(drawerstyle, x, WallSpriteTile, walltexcoords, texturemid, maskedScaleY, sprflipvert, mfloorclip, mceilingclip);
|
||||||
light += lightstep;
|
light += lightstep;
|
||||||
|
|
|
@ -586,11 +586,11 @@ namespace swrenderer
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
R_SetColorMapLight(Light.BaseColormap, 0, Light.ColormapNum << FRACBITS);
|
DrawerStyle drawerstyle;
|
||||||
|
drawerstyle.SetColorMapLight(Light.BaseColormap, 0, Light.ColormapNum << FRACBITS);
|
||||||
|
|
||||||
FDynamicColormap *basecolormap = static_cast<FDynamicColormap*>(Light.BaseColormap);
|
FDynamicColormap *basecolormap = static_cast<FDynamicColormap*>(Light.BaseColormap);
|
||||||
|
|
||||||
DrawerStyle drawerstyle;
|
|
||||||
bool visible = drawerstyle.SetPatchStyle(RenderStyle, Alpha, Translation, FillColor, basecolormap, Light.ColormapNum << FRACBITS);
|
bool visible = drawerstyle.SetPatchStyle(RenderStyle, Alpha, Translation, FillColor, basecolormap, Light.ColormapNum << FRACBITS);
|
||||||
if (!visible)
|
if (!visible)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -243,12 +243,11 @@ namespace swrenderer
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fixed_t centeryfrac = FLOAT2FIXED(CenterY);
|
DrawerStyle drawerstyle;
|
||||||
R_SetColorMapLight(vis->Light.BaseColormap, 0, vis->Light.ColormapNum << FRACBITS);
|
drawerstyle.SetColorMapLight(vis->Light.BaseColormap, 0, vis->Light.ColormapNum << FRACBITS);
|
||||||
|
|
||||||
FDynamicColormap *basecolormap = static_cast<FDynamicColormap*>(vis->Light.BaseColormap);
|
FDynamicColormap *basecolormap = static_cast<FDynamicColormap*>(vis->Light.BaseColormap);
|
||||||
|
|
||||||
DrawerStyle drawerstyle;
|
|
||||||
bool visible = drawerstyle.SetPatchStyle(vis->RenderStyle, vis->Alpha, vis->Translation, vis->FillColor, basecolormap, vis->Light.ColormapNum << FRACBITS);
|
bool visible = drawerstyle.SetPatchStyle(vis->RenderStyle, vis->Alpha, vis->Translation, vis->FillColor, basecolormap, vis->Light.ColormapNum << FRACBITS);
|
||||||
|
|
||||||
if (visible)
|
if (visible)
|
||||||
|
|
|
@ -184,9 +184,9 @@ namespace swrenderer
|
||||||
|
|
||||||
FDynamicColormap *basecolormap = static_cast<FDynamicColormap*>(sprite->Light.BaseColormap);
|
FDynamicColormap *basecolormap = static_cast<FDynamicColormap*>(sprite->Light.BaseColormap);
|
||||||
|
|
||||||
R_SetColorMapLight(sprite->Light.BaseColormap, 0, sprite->Light.ColormapNum << FRACBITS);
|
|
||||||
|
|
||||||
DrawerStyle drawerstyle;
|
DrawerStyle drawerstyle;
|
||||||
|
drawerstyle.SetColorMapLight(sprite->Light.BaseColormap, 0, sprite->Light.ColormapNum << FRACBITS);
|
||||||
|
|
||||||
bool visible = drawerstyle.SetPatchStyle(sprite->RenderStyle, sprite->Alpha, sprite->Translation, sprite->FillColor, basecolormap);
|
bool visible = drawerstyle.SetPatchStyle(sprite->RenderStyle, sprite->Alpha, sprite->Translation, sprite->FillColor, basecolormap);
|
||||||
if (!visible)
|
if (!visible)
|
||||||
return;
|
return;
|
||||||
|
@ -285,7 +285,7 @@ namespace swrenderer
|
||||||
voxel_pos.Y += dirY.X * x + dirY.Y * y;
|
voxel_pos.Y += dirY.X * x + dirY.Y * y;
|
||||||
voxel_pos.Z += dirZ * z;
|
voxel_pos.Z += dirZ * z;
|
||||||
|
|
||||||
FillBox(voxel_pos, sprite_xscale, sprite_yscale, color, cliptop, clipbottom, false, false);
|
FillBox(drawerstyle, voxel_pos, sprite_xscale, sprite_yscale, color, cliptop, clipbottom, false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -308,7 +308,7 @@ namespace swrenderer
|
||||||
return (kvxslab_t*)(((uint8_t*)slab) + 3 + slab->zleng);
|
return (kvxslab_t*)(((uint8_t*)slab) + 3 + slab->zleng);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderVoxel::FillBox(DVector3 origin, double extentX, double extentY, int color, short *cliptop, short *clipbottom, bool viewspace, bool pixelstretch)
|
void RenderVoxel::FillBox(DrawerStyle &drawerstyle, DVector3 origin, double extentX, double extentY, int color, short *cliptop, short *clipbottom, bool viewspace, bool pixelstretch)
|
||||||
{
|
{
|
||||||
double viewX, viewY, viewZ;
|
double viewX, viewY, viewZ;
|
||||||
if (viewspace)
|
if (viewspace)
|
||||||
|
@ -354,7 +354,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_Drawers()->FillColumn();
|
drawerstyle.FillColumn();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,8 @@ struct FVoxel;
|
||||||
|
|
||||||
namespace swrenderer
|
namespace swrenderer
|
||||||
{
|
{
|
||||||
|
class DrawerStyle;
|
||||||
|
|
||||||
// [RH] A c-buffer. Used for keeping track of offscreen voxel spans.
|
// [RH] A c-buffer. Used for keeping track of offscreen voxel spans.
|
||||||
struct FCoverageBuffer
|
struct FCoverageBuffer
|
||||||
{
|
{
|
||||||
|
@ -81,7 +83,7 @@ namespace swrenderer
|
||||||
|
|
||||||
enum { DVF_OFFSCREEN = 1, DVF_SPANSONLY = 2, DVF_MIRRORED = 4 };
|
enum { DVF_OFFSCREEN = 1, DVF_SPANSONLY = 2, DVF_MIRRORED = 4 };
|
||||||
|
|
||||||
static void FillBox(DVector3 origin, double extentX, double extentY, int color, short *cliptop, short *clipbottom, bool viewspace, bool pixelstretch);
|
static void FillBox(DrawerStyle &drawerstyle, DVector3 origin, double extentX, double extentY, int color, short *cliptop, short *clipbottom, bool viewspace, bool pixelstretch);
|
||||||
|
|
||||||
static kvxslab_t *GetSlabStart(const FVoxelMipLevel &mip, int x, int y);
|
static kvxslab_t *GetSlabStart(const FVoxelMipLevel &mip, int x, int y);
|
||||||
static kvxslab_t *GetSlabEnd(const FVoxelMipLevel &mip, int x, int y);
|
static kvxslab_t *GetSlabEnd(const FVoxelMipLevel &mip, int x, int y);
|
||||||
|
|
|
@ -178,6 +178,8 @@ namespace swrenderer
|
||||||
rereadcolormap = false;
|
rereadcolormap = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DrawerStyle drawerstyle;
|
||||||
|
|
||||||
int shade = LIGHT2SHADE(spr->sector->lightlevel + R_ActualExtraLight(spr->foggy));
|
int shade = LIGHT2SHADE(spr->sector->lightlevel + R_ActualExtraLight(spr->foggy));
|
||||||
double GlobVis = LightVisibility::Instance()->WallGlobVis();
|
double GlobVis = LightVisibility::Instance()->WallGlobVis();
|
||||||
float lightleft = float(GlobVis / spr->wallc.sz1);
|
float lightleft = float(GlobVis / spr->wallc.sz1);
|
||||||
|
@ -185,11 +187,11 @@ namespace swrenderer
|
||||||
float light = lightleft + (x1 - spr->wallc.sx1) * lightstep;
|
float light = lightleft + (x1 - spr->wallc.sx1) * lightstep;
|
||||||
CameraLight *cameraLight = CameraLight::Instance();
|
CameraLight *cameraLight = CameraLight::Instance();
|
||||||
if (cameraLight->fixedlightlev >= 0)
|
if (cameraLight->fixedlightlev >= 0)
|
||||||
R_SetColorMapLight(usecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
|
drawerstyle.SetColorMapLight(usecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev));
|
||||||
else if (cameraLight->fixedcolormap != NULL)
|
else if (cameraLight->fixedcolormap != NULL)
|
||||||
R_SetColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
drawerstyle.SetColorMapLight(cameraLight->fixedcolormap, 0, 0);
|
||||||
else if (!spr->foggy && (spr->renderflags & RF_FULLBRIGHT))
|
else if (!spr->foggy && (spr->renderflags & RF_FULLBRIGHT))
|
||||||
R_SetColorMapLight((!level.PreserveSectorColor()) ? &FullNormalLight : usecolormap, 0, 0);
|
drawerstyle.SetColorMapLight((!level.PreserveSectorColor()) ? &FullNormalLight : usecolormap, 0, 0);
|
||||||
else
|
else
|
||||||
calclighting = true;
|
calclighting = true;
|
||||||
|
|
||||||
|
@ -212,7 +214,6 @@ namespace swrenderer
|
||||||
|
|
||||||
FDynamicColormap *basecolormap = static_cast<FDynamicColormap*>(spr->Light.BaseColormap);
|
FDynamicColormap *basecolormap = static_cast<FDynamicColormap*>(spr->Light.BaseColormap);
|
||||||
|
|
||||||
DrawerStyle drawerstyle;
|
|
||||||
bool visible = drawerstyle.SetPatchStyle(spr->RenderStyle, spr->Alpha, spr->Translation, spr->FillColor, basecolormap);
|
bool visible = drawerstyle.SetPatchStyle(spr->RenderStyle, spr->Alpha, spr->Translation, spr->FillColor, basecolormap);
|
||||||
|
|
||||||
// R_SetPatchStyle can modify basecolormap.
|
// R_SetPatchStyle can modify basecolormap.
|
||||||
|
@ -233,7 +234,7 @@ namespace swrenderer
|
||||||
{
|
{
|
||||||
if (calclighting)
|
if (calclighting)
|
||||||
{ // calculate lighting
|
{ // calculate lighting
|
||||||
R_SetColorMapLight(usecolormap, light, shade);
|
drawerstyle.SetColorMapLight(usecolormap, light, shade);
|
||||||
}
|
}
|
||||||
if (!translucentPass->ClipSpriteColumnWithPortals(x, spr))
|
if (!translucentPass->ClipSpriteColumnWithPortals(x, spr))
|
||||||
DrawColumn(drawerstyle, x, WallSpriteTile, walltexcoords, texturemid, maskedScaleY, sprflipvert, mfloorclip, mceilingclip);
|
DrawColumn(drawerstyle, x, WallSpriteTile, walltexcoords, texturemid, maskedScaleY, sprflipvert, mfloorclip, mceilingclip);
|
||||||
|
|
|
@ -185,21 +185,22 @@ void DCanvas::DrawTextureParms(FTexture *img, DrawParms &parms)
|
||||||
translation = parms.remap->Remap;
|
translation = parms.remap->Remap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DrawerStyle drawerstyle;
|
||||||
|
|
||||||
if (translation != NULL)
|
if (translation != NULL)
|
||||||
{
|
{
|
||||||
R_SetTranslationMap((lighttable_t *)translation);
|
drawerstyle.SetTranslationMap((lighttable_t *)translation);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (r_swtruecolor)
|
if (r_swtruecolor)
|
||||||
R_SetTranslationMap(nullptr);
|
drawerstyle.SetTranslationMap(nullptr);
|
||||||
else
|
else
|
||||||
R_SetTranslationMap(identitymap);
|
drawerstyle.SetTranslationMap(identitymap);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool visible;
|
bool visible;
|
||||||
FDynamicColormap *basecolormap = nullptr;
|
FDynamicColormap *basecolormap = nullptr;
|
||||||
DrawerStyle drawerstyle;
|
|
||||||
if (r_swtruecolor)
|
if (r_swtruecolor)
|
||||||
visible = drawerstyle.SetPatchStyle(parms.style, parms.Alpha, -1, parms.fillcolor, basecolormap);
|
visible = drawerstyle.SetPatchStyle(parms.style, parms.Alpha, -1, parms.fillcolor, basecolormap);
|
||||||
else
|
else
|
||||||
|
@ -1388,11 +1389,12 @@ void DCanvas::FillSimplePoly(FTexture *tex, FVector2 *points, int npoints,
|
||||||
sinrot = sin(rotation.Radians());
|
sinrot = sin(rotation.Radians());
|
||||||
|
|
||||||
// Setup constant texture mapping parameters.
|
// Setup constant texture mapping parameters.
|
||||||
R_SetSpanTexture(tex);
|
DrawerStyle drawerstyle;
|
||||||
|
drawerstyle.SetSpanTexture(tex);
|
||||||
if (colormap)
|
if (colormap)
|
||||||
R_SetSpanColormap(colormap, clamp(shade >> FRACBITS, 0, NUMCOLORMAPS - 1));
|
drawerstyle.SetSpanColormap(colormap, clamp(shade >> FRACBITS, 0, NUMCOLORMAPS - 1));
|
||||||
else
|
else
|
||||||
R_SetSpanColormap(&identitycolormap, 0);
|
drawerstyle.SetSpanColormap(&identitycolormap, 0);
|
||||||
if (ds_xbits != 0)
|
if (ds_xbits != 0)
|
||||||
{
|
{
|
||||||
scalex = double(1u << (32 - ds_xbits)) / scalex;
|
scalex = double(1u << (32 - ds_xbits)) / scalex;
|
||||||
|
@ -1491,7 +1493,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_Drawers()->DrawSpan();
|
(drawerstyle.Drawers()->*drawerstyle.spanfunc)();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
x += xinc;
|
x += xinc;
|
||||||
|
|
Loading…
Reference in a new issue