- Added truecolor support to truecolor stencil drawers

This commit is contained in:
Rachael Alexanderson 2017-06-04 11:59:26 -04:00
parent a797db74da
commit 564e24be28
5 changed files with 12 additions and 4 deletions

View file

@ -194,7 +194,8 @@ namespace swrenderer
uint32_t srcalpha = args.SrcAlpha() >> (FRACBITS - 8); uint32_t srcalpha = args.SrcAlpha() >> (FRACBITS - 8);
uint32_t destalpha = args.DestAlpha() >> (FRACBITS - 8); uint32_t destalpha = args.DestAlpha() >> (FRACBITS - 8);
uint32_t srccolor = args.SrcColorBgra(); uint32_t srccolor = args.SrcColorBgra();
uint32_t color = LightBgra::shade_pal_index_simple(args.SolidColor(), light); uint32_t color = LightBgra::shade_bgra_simple(args.SolidColorBgra() && 0xffffff,
LightBgra::calc_light_multiplier(light));
for (int index = 0; index < count; index++) for (int index = 0; index < count; index++)
{ {

View file

@ -185,7 +185,8 @@ namespace swrenderer
uint32_t srcalpha = args.SrcAlpha() >> (FRACBITS - 8); uint32_t srcalpha = args.SrcAlpha() >> (FRACBITS - 8);
uint32_t destalpha = args.DestAlpha() >> (FRACBITS - 8); uint32_t destalpha = args.DestAlpha() >> (FRACBITS - 8);
uint32_t srccolor = args.SrcColorBgra(); uint32_t srccolor = args.SrcColorBgra();
uint32_t color = LightBgra::shade_pal_index_simple(args.SolidColor(), light); uint32_t color = LightBgra::shade_bgra_simple(args.SolidColorBgra(),
LightBgra::calc_light_multiplier(light));
int ssecount = count / 2; int ssecount = count / 2;
for (int index = 0; index < ssecount; index++) for (int index = 0; index < ssecount; index++)

View file

@ -105,7 +105,9 @@ void SWCanvas::DrawTexture(DCanvas *canvas, FTexture *img, DrawParms &parms)
drawerargs.SetTranslationMap(translation); drawerargs.SetTranslationMap(translation);
drawerargs.SetLight(basecolormap, 0.0f, shade); drawerargs.SetLight(basecolormap, 0.0f, shade);
uint32_t myfillcolor = (RGB256k.All[((parms.fillcolor & 0xfc0000) >> 6) | ((parms.fillcolor & 0xfc00) >> 4) | ((parms.fillcolor & 0xfc) >> 2)]) << 24; uint32_t myfillcolor = (RGB256k.All[((parms.fillcolor & 0xfc0000) >> 6) |
((parms.fillcolor & 0xfc00) >> 4) | ((parms.fillcolor & 0xfc) >> 2)]) << 24 |
(parms.fillcolor & 0xffffff);
bool visible = drawerargs.SetStyle(viewport, parms.style, parms.Alpha, -1, myfillcolor, basecolormap); bool visible = drawerargs.SetStyle(viewport, parms.style, parms.Alpha, -1, myfillcolor, basecolormap);
double x0 = parms.x - parms.left * parms.destwidth / parms.texwidth; double x0 = parms.x - parms.left * parms.destwidth / parms.texwidth;

View file

@ -440,6 +440,7 @@ namespace swrenderer
drawer_needs_pal_input = true; drawer_needs_pal_input = true;
CameraLight *cameraLight = CameraLight::Instance(); CameraLight *cameraLight = CameraLight::Instance();
dc_color = cameraLight->FixedColormap() ? cameraLight->FixedColormap()->Maps[APART(color)] : basecolormap->Maps[APART(color)]; dc_color = cameraLight->FixedColormap() ? cameraLight->FixedColormap()->Maps[APART(color)] : basecolormap->Maps[APART(color)];
dc_color_bgra = color;
basecolormap = &ShadeFakeColormap[16 - alpha]; basecolormap = &ShadeFakeColormap[16 - alpha];
if (cameraLight->FixedLightLevel() >= 0 && !cameraLight->FixedColormap()) if (cameraLight->FixedLightLevel() >= 0 && !cameraLight->FixedColormap())
{ {
@ -465,6 +466,7 @@ namespace swrenderer
uint32_t b = BPART(color); uint32_t b = BPART(color);
// dc_color is used by the rt_* routines. It is indexed into dc_srcblend. // dc_color is used by the rt_* routines. It is indexed into dc_srcblend.
dc_color = RGB256k.RGB[r >> 2][g >> 2][b >> 2]; dc_color = RGB256k.RGB[r >> 2][g >> 2][b >> 2];
dc_color_bgra = color;
if (style.Flags & STYLEF_InvertSource) if (style.Flags & STYLEF_InvertSource)
{ {
r = 255 - r; r = 255 - r;

View file

@ -19,7 +19,7 @@ namespace swrenderer
bool SetStyle(RenderViewport *viewport, FRenderStyle style, float alpha, int translation, uint32_t color, FDynamicColormap *&basecolormap, fixed_t shadedlightshade = 0); bool SetStyle(RenderViewport *viewport, FRenderStyle style, float alpha, int translation, uint32_t color, FDynamicColormap *&basecolormap, fixed_t shadedlightshade = 0);
void SetDest(RenderViewport *viewport, int x, int y); void SetDest(RenderViewport *viewport, int x, int y);
void SetCount(int count) { dc_count = count; } void SetCount(int count) { dc_count = count; }
void SetSolidColor(int color) { dc_color = color; } void SetSolidColor(int color) { dc_color = color; dc_color_bgra = GPalette.BaseColors[color]; }
void SetDynamicLight(uint32_t color) { dynlightcolor = color; } void SetDynamicLight(uint32_t color) { dynlightcolor = color; }
void DrawMaskedColumn(RenderThread *thread, 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(RenderThread *thread, 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);
@ -39,6 +39,7 @@ namespace swrenderer
fixed_t TextureVStep() const { return dc_iscale; } fixed_t TextureVStep() const { return dc_iscale; }
int SolidColor() const { return dc_color; } int SolidColor() const { return dc_color; }
uint32_t SolidColorBgra() const { return dc_color_bgra; }
uint32_t SrcColorIndex() const { return dc_srccolor; } uint32_t SrcColorIndex() const { return dc_srccolor; }
uint32_t SrcColorBgra() const { return dc_srccolor_bgra; } uint32_t SrcColorBgra() const { return dc_srccolor_bgra; }
@ -84,6 +85,7 @@ namespace swrenderer
int dc_yh = 0; int dc_yh = 0;
int dc_color = 0; int dc_color = 0;
uint32_t dc_color_bgra = 0;
uint32_t dc_srccolor = 0; uint32_t dc_srccolor = 0;
uint32_t dc_srccolor_bgra = 0; uint32_t dc_srccolor_bgra = 0;