mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 07:11:39 +00:00
In non-lookup OpenGL modes, make sector[].filler (rename pending) override fogpal.
That is, if that member has a nonzero value, that one is taken for the color of the GL fog instead of (most of the time) sector[].floorpal. "Sky sectors", that is, skyboxes or simply parallaxed floors/ceilings are *not* handled. git-svn-id: https://svn.eduke32.com/eduke32@4415 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
6458c0ba34
commit
bd0febb846
3 changed files with 27 additions and 12 deletions
|
@ -77,6 +77,17 @@ static inline float getshadefactor(int32_t shade)
|
|||
return ((float)(numshades-clamped_shade))/(float)numshades;
|
||||
}
|
||||
|
||||
#define POLYMOST_CHOOSE_FOG_PAL(filler, pal) \
|
||||
((filler) ? (filler) : (pal))
|
||||
static inline int32_t get_floor_fogpal(const sectortype *sec)
|
||||
{
|
||||
return POLYMOST_CHOOSE_FOG_PAL(sec->filler, sec->floorpal);
|
||||
}
|
||||
static inline int32_t get_ceiling_fogpal(const sectortype *sec)
|
||||
{
|
||||
return POLYMOST_CHOOSE_FOG_PAL(sec->filler, sec->ceilingpal);
|
||||
}
|
||||
|
||||
typedef struct pthtyp_t
|
||||
{
|
||||
struct pthtyp_t *next;
|
||||
|
|
|
@ -1377,7 +1377,7 @@ void polymer_drawmaskwall(int32_t damaskwallcnt)
|
|||
w->mask.material.diffusemodulation[2] = ((GLubyte *)(&maskwall[damaskwallcnt]))[1];
|
||||
w->mask.material.diffusemodulation[3] = 0xFF;
|
||||
} else {
|
||||
calc_and_apply_fog(wal->picnum, wal->shade, sec->visibility, sec->floorpal);
|
||||
calc_and_apply_fog(wal->picnum, wal->shade, sec->visibility, get_floor_fogpal(sec));
|
||||
}
|
||||
|
||||
polymer_drawplane(&w->mask);
|
||||
|
@ -1409,7 +1409,7 @@ void polymer_drawsprite(int32_t snum)
|
|||
DO_TILE_ANIM(tspr->picnum, tspr->owner+32768);
|
||||
|
||||
calc_and_apply_fog(tspr->picnum, tspr->shade, sector[tspr->sectnum].visibility,
|
||||
sector[tspr->sectnum].floorpal);
|
||||
get_floor_fogpal(§or[tspr->sectnum]));
|
||||
|
||||
if (usemodels && tile2model[Ptile2tile(tspr->picnum,tspr->pal)].modelid >= 0 &&
|
||||
tile2model[Ptile2tile(tspr->picnum,tspr->pal)].framenum >= 0 &&
|
||||
|
@ -2721,7 +2721,7 @@ static void polymer_drawsector(int16_t sectnum, int32_t domasks)
|
|||
s->floor.material.diffusemodulation[2] = ((GLubyte *)(§num))[1];
|
||||
s->floor.material.diffusemodulation[3] = 0xFF;
|
||||
} else {
|
||||
calc_and_apply_fog(sec->floorpicnum, sec->floorshade, sec->visibility, sec->floorpal);
|
||||
calc_and_apply_fog(sec->floorpicnum, sec->floorshade, sec->visibility, get_floor_fogpal(sec));
|
||||
}
|
||||
|
||||
polymer_drawplane(&s->floor);
|
||||
|
@ -2756,7 +2756,7 @@ static void polymer_drawsector(int16_t sectnum, int32_t domasks)
|
|||
s->ceil.material.diffusemodulation[2] = ((GLubyte *)(§num))[1];
|
||||
s->ceil.material.diffusemodulation[3] = 0xFF;
|
||||
} else {
|
||||
calc_and_apply_fog(sec->ceilingpicnum, sec->ceilingshade, sec->visibility, sec->ceilingpal);
|
||||
calc_and_apply_fog(sec->ceilingpicnum, sec->ceilingshade, sec->visibility, get_ceiling_fogpal(sec));
|
||||
}
|
||||
|
||||
polymer_drawplane(&s->ceil);
|
||||
|
@ -3276,7 +3276,7 @@ static void polymer_drawwall(int16_t sectnum, int16_t wallnum)
|
|||
(sector[wal->nextsector].ceilingstat & 1))
|
||||
parallaxedceiling = 1;
|
||||
|
||||
calc_and_apply_fog(wal->picnum, wal->shade, sec->visibility, sec->floorpal);
|
||||
calc_and_apply_fog(wal->picnum, wal->shade, sec->visibility, get_floor_fogpal(sec));
|
||||
|
||||
if ((w->underover & 1) && (!parallaxedfloor || (searchit == 2)))
|
||||
{
|
||||
|
|
|
@ -2115,7 +2115,7 @@ void polymost_scansector(int32_t sectnum);
|
|||
// on which one is processed right now
|
||||
static int32_t global_cf_z;
|
||||
static float global_cf_xpanning, global_cf_ypanning, global_cf_heinum;
|
||||
static int32_t global_cf_shade, global_cf_pal;
|
||||
static int32_t global_cf_shade, global_cf_pal, global_cf_fogpal;
|
||||
static int32_t (*global_getzofslope_func)(int16_t, int32_t, int32_t);
|
||||
|
||||
static void polymost_internal_nonparallaxed(double nx0, double ny0, double nx1, double ny1, double ryp0, double ryp1,
|
||||
|
@ -2238,7 +2238,8 @@ static void polymost_internal_nonparallaxed(double nx0, double ny0, double nx1,
|
|||
if (globalposz <= getceilzofslope(sectnum,globalposx,globalposy)) domostpolymethod = -1; //Back-face culling
|
||||
}
|
||||
|
||||
calc_and_apply_fog(globalpicnum, global_cf_shade, sec->visibility, global_cf_pal);
|
||||
calc_and_apply_fog(globalpicnum, global_cf_shade, sec->visibility,
|
||||
POLYMOST_CHOOSE_FOG_PAL(global_cf_fogpal, global_cf_pal));
|
||||
|
||||
pow2xsplit = 0;
|
||||
alpha = 0.f;
|
||||
|
@ -2366,6 +2367,7 @@ static void polymost_drawalls(int32_t bunch)
|
|||
|
||||
dapskyoff = getpsky(globalpicnum, NULL, &dapskybits);
|
||||
|
||||
global_cf_fogpal = sec->filler;
|
||||
global_cf_shade = sec->floorshade, global_cf_pal = sec->floorpal; global_cf_z = sec->floorz; // REFACT
|
||||
global_cf_xpanning = sec->floorxpanning; global_cf_ypanning = sec->floorypanning, global_cf_heinum = sec->floorheinum;
|
||||
global_getzofslope_func = &getflorzofslope;
|
||||
|
@ -2633,6 +2635,7 @@ static void polymost_drawalls(int32_t bunch)
|
|||
|
||||
dapskyoff = getpsky(globalpicnum, NULL, &dapskybits);
|
||||
|
||||
global_cf_fogpal = sec->filler;
|
||||
global_cf_shade = sec->ceilingshade, global_cf_pal = sec->ceilingpal; global_cf_z = sec->ceilingz; // REFACT
|
||||
global_cf_xpanning = sec->ceilingxpanning; global_cf_ypanning = sec->ceilingypanning, global_cf_heinum = sec->ceilingheinum;
|
||||
global_getzofslope_func = &getceilzofslope;
|
||||
|
@ -2966,7 +2969,7 @@ static void polymost_drawalls(int32_t bunch)
|
|||
}
|
||||
if (wal->cstat&256) { gvx = -gvx; gvy = -gvy; gvo = -gvo; } //yflip
|
||||
|
||||
calc_and_apply_fog(wal->picnum, wal->shade, sec->visibility, sec->floorpal);
|
||||
calc_and_apply_fog(wal->picnum, wal->shade, sec->visibility, get_floor_fogpal(sec));
|
||||
|
||||
pow2xsplit = 1; domost(x1,ocy1,x0,ocy0);
|
||||
if (wal->cstat&8) { gux = ogux; guy = oguy; guo = oguo; }
|
||||
|
@ -3001,7 +3004,7 @@ static void polymost_drawalls(int32_t bunch)
|
|||
}
|
||||
if (nwal->cstat&256) { gvx = -gvx; gvy = -gvy; gvo = -gvo; } //yflip
|
||||
|
||||
calc_and_apply_fog(nwal->picnum, nwal->shade, sec->visibility, sec->floorpal);
|
||||
calc_and_apply_fog(nwal->picnum, nwal->shade, sec->visibility, get_floor_fogpal(sec));
|
||||
|
||||
pow2xsplit = 1; domost(x0,ofy0,x1,ofy1);
|
||||
if (wal->cstat&(2+8)) { guo = oguo; gux = ogux; guy = oguy; }
|
||||
|
@ -3032,7 +3035,7 @@ static void polymost_drawalls(int32_t bunch)
|
|||
}
|
||||
if (wal->cstat&256) { gvx = -gvx; gvy = -gvy; gvo = -gvo; } //yflip
|
||||
|
||||
calc_and_apply_fog(wal->picnum, wal->shade, sec->visibility, sec->floorpal);
|
||||
calc_and_apply_fog(wal->picnum, wal->shade, sec->visibility, get_floor_fogpal(sec));
|
||||
|
||||
pow2xsplit = 1; domost(x0,-10000,x1,-10000);
|
||||
}
|
||||
|
@ -3586,7 +3589,7 @@ void polymost_drawmaskwall(int32_t damaskwallcnt)
|
|||
method = 1; pow2xsplit = 1;
|
||||
if (wal->cstat&128) { if (!(wal->cstat&512)) method = 2; else method = 3; }
|
||||
|
||||
calc_and_apply_fog(wal->picnum, wal->shade, sec->visibility, sec->floorpal);
|
||||
calc_and_apply_fog(wal->picnum, wal->shade, sec->visibility, get_floor_fogpal(sec));
|
||||
|
||||
for (i=0; i<2; i++)
|
||||
{
|
||||
|
@ -3698,7 +3701,8 @@ void polymost_drawsprite(int32_t snum)
|
|||
alpha = spriteext[spritenum].alpha;
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
calc_and_apply_fog(tspr->picnum, globalshade, sector[tspr->sectnum].visibility, sector[tspr->sectnum].floorpal);
|
||||
calc_and_apply_fog(tspr->picnum, globalshade, sector[tspr->sectnum].visibility,
|
||||
get_floor_fogpal(§or[tspr->sectnum]));
|
||||
|
||||
while (getrendermode() >= REND_POLYMOST && !(spriteext[spritenum].flags&SPREXT_NOTMD))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue