- renamed r_blendmode to r_blendmethod

- did another drawer
This commit is contained in:
Rachael Alexanderson 2016-12-24 10:15:02 -05:00
parent 4e100fc9a1
commit 80482e98a3
2 changed files with 43 additions and 20 deletions

View file

@ -43,8 +43,8 @@
#include "v_video.h" #include "v_video.h"
#include "r_draw_pal.h" #include "r_draw_pal.h"
// [SP] r_blendmode - false = rgb555 matching (ZDoom classic), true = rgb666 (refactored) // [SP] r_blendmethod - false = rgb555 matching (ZDoom classic), true = rgb666 (refactored)
CVAR(Bool, r_blendmode, false, CVAR_GLOBALCONFIG | CVAR_ARCHIVE) CVAR(Bool, r_blendmethod, false, CVAR_GLOBALCONFIG | CVAR_ARCHIVE)
/* /*
[RH] This translucency algorithm is based on DOSDoom 0.65's, but uses [RH] This translucency algorithm is based on DOSDoom 0.65's, but uses
@ -309,7 +309,7 @@ namespace swrenderer
fracstep *= thread->num_cores; fracstep *= thread->num_cores;
pitch *= thread->num_cores; pitch *= thread->num_cores;
if (!r_blendmode) if (!r_blendmethod)
{ {
do do
{ {
@ -370,7 +370,7 @@ namespace swrenderer
} }
pitch *= thread->num_cores; pitch *= thread->num_cores;
if (!r_blendmode) if (!r_blendmethod)
{ {
do do
{ {
@ -433,7 +433,7 @@ namespace swrenderer
fracstep *= thread->num_cores; fracstep *= thread->num_cores;
pitch *= thread->num_cores; pitch *= thread->num_cores;
if (!r_blendmode) if (!r_blendmethod)
{ {
do do
{ {
@ -539,7 +539,7 @@ namespace swrenderer
fracstep *= thread->num_cores; fracstep *= thread->num_cores;
pitch *= thread->num_cores; pitch *= thread->num_cores;
if (!r_blendmode) if (!r_blendmethod)
{ {
do do
{ {
@ -603,7 +603,7 @@ namespace swrenderer
} }
pitch *= thread->num_cores; pitch *= thread->num_cores;
if (!r_blendmode) if (!r_blendmethod)
{ {
do do
{ {
@ -667,19 +667,42 @@ namespace swrenderer
fracstep *= thread->num_cores; fracstep *= thread->num_cores;
pitch *= thread->num_cores; pitch *= thread->num_cores;
do if (!r_blendmethod)
{ {
uint8_t pix = source[frac >> bits]; do
if (pix != 0)
{ {
int r = clamp(GPalette.BaseColors[colormap[pix]].r - GPalette.BaseColors[*dest].r, 0, 255); uint8_t pix = source[frac >> bits];
int g = clamp(GPalette.BaseColors[colormap[pix]].g - GPalette.BaseColors[*dest].g, 0, 255); if (pix != 0)
int b = clamp(GPalette.BaseColors[colormap[pix]].b - GPalette.BaseColors[*dest].b, 0, 255); {
*dest = RGB256k.RGB[r>>2][g>>2][b>>2]; uint32_t a = (bg2rgb[*dest] | 0x40100400) - fg2rgb[colormap[pix]];
} uint32_t b = a;
frac += fracstep;
dest += pitch; b &= 0x40100400;
} while (--count); b = b - (b >> 5);
a &= b;
a |= 0x01f07c1f;
*dest = RGB32k.All[a & (a >> 15)];
}
frac += fracstep;
dest += pitch;
} while (--count);
}
else
{
do
{
uint8_t pix = source[frac >> bits];
if (pix != 0)
{
int r = clamp(GPalette.BaseColors[colormap[pix]].r - GPalette.BaseColors[*dest].r, 0, 255);
int g = clamp(GPalette.BaseColors[colormap[pix]].g - GPalette.BaseColors[*dest].g, 0, 255);
int b = clamp(GPalette.BaseColors[colormap[pix]].b - GPalette.BaseColors[*dest].b, 0, 255);
*dest = RGB256k.RGB[r>>2][g>>2][b>>2];
}
frac += fracstep;
dest += pitch;
} while (--count);
}
} }
void DrawWallRevSubClamp4PalCommand::Execute(DrawerThread *thread) void DrawWallRevSubClamp4PalCommand::Execute(DrawerThread *thread)

View file

@ -66,7 +66,7 @@
#include "menu/menu.h" #include "menu/menu.h"
#include "r_data/voxels.h" #include "r_data/voxels.h"
EXTERN_CVAR(Bool, r_blendmode) EXTERN_CVAR(Bool, r_blendmethod)
int active_con_scale(); int active_con_scale();
@ -392,7 +392,7 @@ void DCanvas::Dim (PalEntry color, float damount, int x1, int y1, int w, int h)
int dimmedcolor_g = color.g * alpha; int dimmedcolor_g = color.g * alpha;
int dimmedcolor_b = color.b * alpha; int dimmedcolor_b = color.b * alpha;
if (!r_blendmode) if (!r_blendmethod)
{ {
for (y = h; y != 0; y--) for (y = h; y != 0; y--)
{ {