In non-lookup GL modes, if fog is due to fogpal, make fog params indep. of shade.

git-svn-id: https://svn.eduke32.com/eduke32@4460 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2014-05-01 22:02:21 +00:00
parent 521176d865
commit 1c5da19874
3 changed files with 25 additions and 12 deletions

View file

@ -87,6 +87,12 @@ static inline int32_t get_ceiling_fogpal(const sectortype *sec)
{ {
return POLYMOST_CHOOSE_FOG_PAL(sec->fogpal, sec->ceilingpal); return POLYMOST_CHOOSE_FOG_PAL(sec->fogpal, sec->ceilingpal);
} }
static inline int32_t fogpal_shade(const sectortype *sec, int32_t shade)
{
// When fogging is due to sector[].fogpal, don't make the fog parameters
// depend on the shade of the object.
return sec->fogpal ? 0 : shade;
}
typedef struct pthtyp_t typedef struct pthtyp_t
{ {

View file

@ -1377,7 +1377,7 @@ void polymer_drawmaskwall(int32_t damaskwallcnt)
w->mask.material.diffusemodulation[2] = ((GLubyte *)(&maskwall[damaskwallcnt]))[1]; w->mask.material.diffusemodulation[2] = ((GLubyte *)(&maskwall[damaskwallcnt]))[1];
w->mask.material.diffusemodulation[3] = 0xFF; w->mask.material.diffusemodulation[3] = 0xFF;
} else { } else {
calc_and_apply_fog(wal->picnum, wal->shade, sec->visibility, get_floor_fogpal(sec)); calc_and_apply_fog(wal->picnum, fogpal_shade(sec, wal->shade), sec->visibility, get_floor_fogpal(sec));
} }
polymer_drawplane(&w->mask); polymer_drawplane(&w->mask);
@ -1394,6 +1394,7 @@ void polymer_drawsprite(int32_t snum)
_prsprite *s; _prsprite *s;
spritetype *const tspr = tspriteptr[snum]; spritetype *const tspr = tspriteptr[snum];
const sectortype *sec;
if (pr_verbosity >= 3) OSD_Printf("PR : Sprite %i...\n", snum); if (pr_verbosity >= 3) OSD_Printf("PR : Sprite %i...\n", snum);
@ -1408,7 +1409,8 @@ void polymer_drawsprite(int32_t snum)
DO_TILE_ANIM(tspr->picnum, tspr->owner+32768); DO_TILE_ANIM(tspr->picnum, tspr->owner+32768);
calc_and_apply_fog(tspr->picnum, tspr->shade, sector[tspr->sectnum].visibility, sec = &sector[tspr->sectnum];
calc_and_apply_fog(tspr->picnum, fogpal_shade(sec, tspr->shade), sec->visibility,
get_floor_fogpal(&sector[tspr->sectnum])); get_floor_fogpal(&sector[tspr->sectnum]));
if (usemodels && tile2model[Ptile2tile(tspr->picnum,tspr->pal)].modelid >= 0 && if (usemodels && tile2model[Ptile2tile(tspr->picnum,tspr->pal)].modelid >= 0 &&
@ -2721,7 +2723,8 @@ static void polymer_drawsector(int16_t sectnum, int32_t domasks)
s->floor.material.diffusemodulation[2] = ((GLubyte *)(&sectnum))[1]; s->floor.material.diffusemodulation[2] = ((GLubyte *)(&sectnum))[1];
s->floor.material.diffusemodulation[3] = 0xFF; s->floor.material.diffusemodulation[3] = 0xFF;
} else { } else {
calc_and_apply_fog(sec->floorpicnum, sec->floorshade, sec->visibility, get_floor_fogpal(sec)); calc_and_apply_fog(sec->floorpicnum, fogpal_shade(sec, sec->floorshade),
sec->visibility, get_floor_fogpal(sec));
} }
polymer_drawplane(&s->floor); polymer_drawplane(&s->floor);
@ -2756,7 +2759,8 @@ static void polymer_drawsector(int16_t sectnum, int32_t domasks)
s->ceil.material.diffusemodulation[2] = ((GLubyte *)(&sectnum))[1]; s->ceil.material.diffusemodulation[2] = ((GLubyte *)(&sectnum))[1];
s->ceil.material.diffusemodulation[3] = 0xFF; s->ceil.material.diffusemodulation[3] = 0xFF;
} else { } else {
calc_and_apply_fog(sec->ceilingpicnum, sec->ceilingshade, sec->visibility, get_ceiling_fogpal(sec)); calc_and_apply_fog(sec->ceilingpicnum, fogpal_shade(sec, sec->ceilingshade),
sec->visibility, get_ceiling_fogpal(sec));
} }
polymer_drawplane(&s->ceil); polymer_drawplane(&s->ceil);
@ -3276,7 +3280,7 @@ static void polymer_drawwall(int16_t sectnum, int16_t wallnum)
(sector[wal->nextsector].ceilingstat & 1)) (sector[wal->nextsector].ceilingstat & 1))
parallaxedceiling = 1; parallaxedceiling = 1;
calc_and_apply_fog(wal->picnum, wal->shade, sec->visibility, get_floor_fogpal(sec)); calc_and_apply_fog(wal->picnum, fogpal_shade(sec, wal->shade), sec->visibility, get_floor_fogpal(sec));
if ((w->underover & 1) && (!parallaxedfloor || (searchit == 2))) if ((w->underover & 1) && (!parallaxedfloor || (searchit == 2)))
{ {

View file

@ -2251,7 +2251,7 @@ static void polymost_internal_nonparallaxed(double nx0, double ny0, double nx1,
if (globalposz <= getceilzofslope(sectnum,globalposx,globalposy)) domostpolymethod = -1; //Back-face culling if (globalposz <= getceilzofslope(sectnum,globalposx,globalposy)) domostpolymethod = -1; //Back-face culling
} }
calc_and_apply_fog(globalpicnum, global_cf_shade, sec->visibility, calc_and_apply_fog(globalpicnum, fogpal_shade(sec, global_cf_shade), sec->visibility,
POLYMOST_CHOOSE_FOG_PAL(global_cf_fogpal, global_cf_pal)); POLYMOST_CHOOSE_FOG_PAL(global_cf_fogpal, global_cf_pal));
pow2xsplit = 0; pow2xsplit = 0;
@ -2982,7 +2982,7 @@ static void polymost_drawalls(int32_t bunch)
} }
if (wal->cstat&256) { gvx = -gvx; gvy = -gvy; gvo = -gvo; } //yflip if (wal->cstat&256) { gvx = -gvx; gvy = -gvy; gvo = -gvo; } //yflip
calc_and_apply_fog(wal->picnum, wal->shade, sec->visibility, get_floor_fogpal(sec)); calc_and_apply_fog(wal->picnum, fogpal_shade(sec, wal->shade), sec->visibility, get_floor_fogpal(sec));
pow2xsplit = 1; domost(x1,ocy1,x0,ocy0); pow2xsplit = 1; domost(x1,ocy1,x0,ocy0);
if (wal->cstat&8) { gux = ogux; guy = oguy; guo = oguo; } if (wal->cstat&8) { gux = ogux; guy = oguy; guo = oguo; }
@ -3017,7 +3017,7 @@ static void polymost_drawalls(int32_t bunch)
} }
if (nwal->cstat&256) { gvx = -gvx; gvy = -gvy; gvo = -gvo; } //yflip if (nwal->cstat&256) { gvx = -gvx; gvy = -gvy; gvo = -gvo; } //yflip
calc_and_apply_fog(nwal->picnum, nwal->shade, sec->visibility, get_floor_fogpal(sec)); calc_and_apply_fog(nwal->picnum, fogpal_shade(sec, nwal->shade), sec->visibility, get_floor_fogpal(sec));
pow2xsplit = 1; domost(x0,ofy0,x1,ofy1); pow2xsplit = 1; domost(x0,ofy0,x1,ofy1);
if (wal->cstat&(2+8)) { guo = oguo; gux = ogux; guy = oguy; } if (wal->cstat&(2+8)) { guo = oguo; gux = ogux; guy = oguy; }
@ -3048,7 +3048,7 @@ static void polymost_drawalls(int32_t bunch)
} }
if (wal->cstat&256) { gvx = -gvx; gvy = -gvy; gvo = -gvo; } //yflip if (wal->cstat&256) { gvx = -gvx; gvy = -gvy; gvo = -gvo; } //yflip
calc_and_apply_fog(wal->picnum, wal->shade, sec->visibility, get_floor_fogpal(sec)); calc_and_apply_fog(wal->picnum, fogpal_shade(sec, wal->shade), sec->visibility, get_floor_fogpal(sec));
pow2xsplit = 1; domost(x0,-10000,x1,-10000); pow2xsplit = 1; domost(x0,-10000,x1,-10000);
} }
@ -3604,7 +3604,7 @@ void polymost_drawmaskwall(int32_t damaskwallcnt)
method = 1; pow2xsplit = 1; method = 1; pow2xsplit = 1;
if (wal->cstat&128) { if (!(wal->cstat&512)) method = 2; else method = 3; } if (wal->cstat&128) { if (!(wal->cstat&512)) method = 2; else method = 3; }
calc_and_apply_fog(wal->picnum, wal->shade, sec->visibility, get_floor_fogpal(sec)); calc_and_apply_fog(wal->picnum, fogpal_shade(sec, wal->shade), sec->visibility, get_floor_fogpal(sec));
for (i=0; i<2; i++) for (i=0; i<2; i++)
{ {
@ -3687,6 +3687,8 @@ void polymost_drawsprite(int32_t snum)
int32_t tsizx, tsizy; int32_t tsizx, tsizy;
spritetype *const tspr = tspriteptr[snum]; spritetype *const tspr = tspriteptr[snum];
const sectortype *sec;
if (bad_tspr(tspr)) if (bad_tspr(tspr))
return; return;
@ -3716,8 +3718,9 @@ void polymost_drawsprite(int32_t snum)
alpha = spriteext[spritenum].alpha; alpha = spriteext[spritenum].alpha;
#ifdef USE_OPENGL #ifdef USE_OPENGL
calc_and_apply_fog(tspr->picnum, globalshade, sector[tspr->sectnum].visibility, sec = &sector[tspr->sectnum];
get_floor_fogpal(&sector[tspr->sectnum])); calc_and_apply_fog(tspr->picnum, fogpal_shade(sec, globalshade),
sec->visibility, get_floor_fogpal(sec));
while (getrendermode() >= REND_POLYMOST && !(spriteext[spritenum].flags&SPREXT_NOTMD)) while (getrendermode() >= REND_POLYMOST && !(spriteext[spritenum].flags&SPREXT_NOTMD))
{ {