From 32d58b3839bb8c034a6be8479bd4adb0322a9115 Mon Sep 17 00:00:00 2001 From: plagman Date: Thu, 27 Jan 2011 07:57:52 +0000 Subject: [PATCH] Change highpal maps to 6-bit and add corresponding scale and bias to bypass linear interpolation around the borders. git-svn-id: https://svn.eduke32.com/eduke32@1783 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/include/polymer.h | 4 +++- polymer/eduke32/build/src/polymer.c | 14 +++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/polymer/eduke32/build/include/polymer.h b/polymer/eduke32/build/include/polymer.h index ae35d58fe..7e000e4df 100644 --- a/polymer/eduke32/build/include/polymer.h +++ b/polymer/eduke32/build/include/polymer.h @@ -157,7 +157,9 @@ typedef struct s_prrograminfo { } _prprograminfo; #define PR_INFO_LOG_BUFFER_SIZE 8192 -#define PR_HIGHPALOOKUP_BIT_DEPTH 7 + +// Think about changing highPal[Scale|Bias] in the program bit if you change this +#define PR_HIGHPALOOKUP_BIT_DEPTH 6 #define PR_HIGHPALOOKUP_DIM (1 << PR_HIGHPALOOKUP_BIT_DEPTH) #define PR_HIGHPALOOKUP_DATA_SIZE (4 * PR_HIGHPALOOKUP_DIM * \ PR_HIGHPALOOKUP_DIM * \ diff --git a/polymer/eduke32/build/src/polymer.c b/polymer/eduke32/build/src/polymer.c index d1234716d..e7fb12498 100644 --- a/polymer/eduke32/build/src/polymer.c +++ b/polymer/eduke32/build/src/polymer.c @@ -319,9 +319,12 @@ _prprogrambit prprogrambits[PR_BIT_COUNT] = { "uniform sampler3D highPalookupMap;\n" "\n", // frag_prog + " float highPalScale = 0.9921875; // for 6 bits\n" + " float highPalBias = 0.00390625;\n" + "\n" " if (isLightingPass == 0)\n" - " result.rgb = texture3D(highPalookupMap, result.rgb).rgb;\n" - " diffuseTexel.rgb = texture3D(highPalookupMap, diffuseTexel.rgb).rgb;\n" + " result.rgb = texture3D(highPalookupMap, result.rgb * highPalScale + highPalBias).rgb;\n" + " diffuseTexel.rgb = texture3D(highPalookupMap, diffuseTexel.rgb * highPalScale + highPalBias).rgb;\n" "\n", }, { @@ -3988,6 +3991,10 @@ static void polymer_drawmdsprite(spritetype *tspr) foundpalskin = 1; } + // If we have a global palette tint, the palskin won't do us any good + if (curbasepal) + foundpalskin = 0; + if (!foundpalskin && usinghighpal) { // We don't have a specific skin defined for this palette // Use the base skin instead and plug in our highpalookup map @@ -4181,7 +4188,8 @@ static void polymer_getbuildmaterial(_prmaterial* material, int16_t tile // PR_BIT_HIGHPALOOKUP_MAP if (pr_highpalookups && prhighpalookups[curbasepal][pal].map && - hicfindsubst(tilenum, 0, 0) && (hicfindsubst(tilenum, pal, 0)->palnum != pal)) + hicfindsubst(tilenum, 0, 0) && + (curbasepal || (hicfindsubst(tilenum, pal, 0)->palnum != pal))) { material->highpalookupmap = prhighpalookups[curbasepal][pal].map; pal = 0;