Replace hightile grayscale method (usually combined with tints to produce

replacements for the first handful of palette lookups) w8th superior
"luma" method. DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@4889 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2015-01-11 04:51:41 +00:00
parent 9ab6ab7139
commit 16b617114c
3 changed files with 10 additions and 10 deletions

View file

@ -90,6 +90,10 @@ enum
HICEFFECTMASK = (1|2|4|8),
};
#define GRAYSCALE_COEFF_RED 0.3
#define GRAYSCALE_COEFF_GREEN 0.59
#define GRAYSCALE_COEFF_BLUE 0.11
#ifdef __cplusplus
}
#endif

View file

@ -622,20 +622,19 @@ static int32_t daskinloader(int32_t filh, intptr_t *fptr, int32_t *bpl, int32_t
if (effect & HICTINT_GRAYSCALE)
{
// greyscale
tcol.b = max(tcol.b, max(tcol.g, tcol.r));
tcol.g = tcol.r = tcol.b;
tcol.g = tcol.r = tcol.b = (uint8_t)((tcol.r * GRAYSCALE_COEFF_RED) + (tcol.g * GRAYSCALE_COEFF_GREEN) +
(tcol.b * GRAYSCALE_COEFF_BLUE));
}
if (effect & HICTINT_INVERT)
{
// invert
tcol.b = 255-tcol.b;
tcol.g = 255-tcol.g;
tcol.r = 255-tcol.r;
}
if (effect & HICTINT_COLORIZE)
{
// colorize
tcol.b = min((int32_t)(tcol.b)*b/64,255);
tcol.g = min((int32_t)(tcol.g)*g/64,255);
tcol.r = min((int32_t)(tcol.r)*r/64,255);

View file

@ -1203,14 +1203,12 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp
if (effect & HICTINT_GRAYSCALE)
{
// greyscale
tcol.b = max(tcol.b, max(tcol.g, tcol.r));
tcol.g = tcol.r = tcol.b;
tcol.g = tcol.r = tcol.b = (uint8_t) ((tcol.r * GRAYSCALE_COEFF_RED) + (tcol.g * GRAYSCALE_COEFF_GREEN) +
(tcol.b * GRAYSCALE_COEFF_BLUE));
}
if (effect & HICTINT_INVERT)
{
// invert
tcol.b = 255-tcol.b;
tcol.g = 255-tcol.g;
tcol.r = 255-tcol.r;
@ -1218,7 +1216,6 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp
if (effect & HICTINT_COLORIZE)
{
// colorize
tcol.b = min((int32_t)((tcol.b)*r)/64,255);
tcol.g = min((int32_t)((tcol.g)*g)/64,255);
tcol.r = min((int32_t)((tcol.r)*b)/64,255);