mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-26 03:30:46 +00:00
Don't bother with fog calculations for things without hightile replacements
git-svn-id: https://svn.eduke32.com/eduke32@7424 1a8010ca-5511-0410-912e-c29ae57300e0 # Conflicts: # source/build/src/polymer.cpp
This commit is contained in:
parent
bafc3b45a2
commit
8a6ce26b57
2 changed files with 26 additions and 23 deletions
|
@ -254,8 +254,8 @@ extern int32_t rxi[8], ryi[8];
|
||||||
// For GL_EXP2 fog:
|
// For GL_EXP2 fog:
|
||||||
#define FOGSCALE 0.0000768f
|
#define FOGSCALE 0.0000768f
|
||||||
|
|
||||||
void calc_and_apply_fog(int32_t tile, int32_t shade, int32_t vis, int32_t pal);
|
void calc_and_apply_fog(int32_t shade, int32_t vis, int32_t pal);
|
||||||
void calc_and_apply_fog_factor(int32_t tile, int32_t shade, int32_t vis, int32_t pal, float factor);
|
void calc_and_apply_fog_factor(int32_t shade, int32_t vis, int32_t pal, float factor);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern void get_wallspr_points(uspritetype const * spr, int32_t *x1, int32_t *x2,
|
extern void get_wallspr_points(uspritetype const * spr, int32_t *x1, int32_t *x2,
|
||||||
|
|
|
@ -1099,14 +1099,8 @@ static void fogcalc_old(int32_t shade, int32_t vis)
|
||||||
#define FULLVIS_BEGIN 2.9e30f
|
#define FULLVIS_BEGIN 2.9e30f
|
||||||
#define FULLVIS_END 3.0e30f
|
#define FULLVIS_END 3.0e30f
|
||||||
|
|
||||||
static inline void fogcalc(int32_t tile, int32_t shade, int32_t vis, int32_t pal)
|
static inline void fogcalc(int32_t shade, int32_t vis, int32_t pal)
|
||||||
{
|
{
|
||||||
if (shade > 0 && videoGetRenderMode() == REND_POLYMOST &&
|
|
||||||
!(globalflags & GLOBAL_NO_GL_TILESHADES) &&
|
|
||||||
(!usehightile || !hicfindsubst(tile, pal, hictinting[pal].f & HICTINT_ALWAYSUSEART)) &&
|
|
||||||
(!usemodels || md_tilehasmodel(tile, pal) < 0))
|
|
||||||
shade >>= 1;
|
|
||||||
|
|
||||||
fogcol = fogtable[pal];
|
fogcol = fogtable[pal];
|
||||||
|
|
||||||
if (r_usenewshading < 2)
|
if (r_usenewshading < 2)
|
||||||
|
@ -1117,7 +1111,7 @@ static inline void fogcalc(int32_t tile, int32_t shade, int32_t vis, int32_t pal
|
||||||
|
|
||||||
float combvis = (float) globalvisibility * (uint8_t) (vis+16);
|
float combvis = (float) globalvisibility * (uint8_t) (vis+16);
|
||||||
|
|
||||||
if (combvis == 0)
|
if (combvis == 0.f)
|
||||||
{
|
{
|
||||||
if (r_usenewshading == 2 && shade > 0)
|
if (r_usenewshading == 2 && shade > 0)
|
||||||
{
|
{
|
||||||
|
@ -1168,7 +1162,7 @@ void polymost2_calc_fog(int32_t shade, int32_t vis, int32_t pal)
|
||||||
fogresult2 = -GL_FOG_MAX; // hide fog behind the camera
|
fogresult2 = -GL_FOG_MAX; // hide fog behind the camera
|
||||||
}
|
}
|
||||||
|
|
||||||
void calc_and_apply_fog(int32_t tile, int32_t shade, int32_t vis, int32_t pal)
|
void calc_and_apply_fog(int32_t shade, int32_t vis, int32_t pal)
|
||||||
{
|
{
|
||||||
if (nofog) return;
|
if (nofog) return;
|
||||||
|
|
||||||
|
@ -1197,7 +1191,7 @@ void calc_and_apply_fog(int32_t tile, int32_t shade, int32_t vis, int32_t pal)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fogcalc(tile, shade, vis, pal);
|
fogcalc(shade, vis, pal);
|
||||||
glFogfv(GL_FOG_COLOR, (GLfloat *)&fogcol);
|
glFogfv(GL_FOG_COLOR, (GLfloat *)&fogcol);
|
||||||
|
|
||||||
if (r_usenewshading < 2)
|
if (r_usenewshading < 2)
|
||||||
|
@ -1209,7 +1203,7 @@ void calc_and_apply_fog(int32_t tile, int32_t shade, int32_t vis, int32_t pal)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void calc_and_apply_fog_factor(int32_t tile, int32_t shade, int32_t vis, int32_t pal, float factor)
|
void calc_and_apply_fog_factor(int32_t shade, int32_t vis, int32_t pal, float factor)
|
||||||
{
|
{
|
||||||
if (nofog) return;
|
if (nofog) return;
|
||||||
|
|
||||||
|
@ -1244,7 +1238,7 @@ void calc_and_apply_fog_factor(int32_t tile, int32_t shade, int32_t vis, int32_t
|
||||||
|
|
||||||
// NOTE: for r_usenewshading >= 2, the fog beginning/ending distance results are
|
// NOTE: for r_usenewshading >= 2, the fog beginning/ending distance results are
|
||||||
// unused.
|
// unused.
|
||||||
fogcalc(tile, shade, vis, pal);
|
fogcalc(shade, vis, pal);
|
||||||
glFogfv(GL_FOG_COLOR, (GLfloat *)&fogcol);
|
glFogfv(GL_FOG_COLOR, (GLfloat *)&fogcol);
|
||||||
|
|
||||||
if (r_usenewshading < 2)
|
if (r_usenewshading < 2)
|
||||||
|
@ -3805,8 +3799,8 @@ static void polymost_internal_nonparallaxed(vec2f_t n0, vec2f_t n1, float ryp0,
|
||||||
drawpoly_alpha = 0.f;
|
drawpoly_alpha = 0.f;
|
||||||
drawpoly_blend = 0;
|
drawpoly_blend = 0;
|
||||||
|
|
||||||
calc_and_apply_fog(globalpicnum, fogshade(global_cf_shade, global_cf_pal), sec->visibility,
|
if ((usehightile && hicfindsubst(globalpicnum, globalpal, hictinting[globalpal].f & HICTINT_ALWAYSUSEART)))
|
||||||
POLYMOST_CHOOSE_FOG_PAL(global_cf_fogpal, global_cf_pal));
|
calc_and_apply_fog(fogshade(global_cf_shade, global_cf_pal), sec->visibility, POLYMOST_CHOOSE_FOG_PAL(global_cf_fogpal, global_cf_pal));
|
||||||
|
|
||||||
if (have_floor)
|
if (have_floor)
|
||||||
{
|
{
|
||||||
|
@ -4009,7 +4003,8 @@ static void polymost_drawalls(int32_t const bunch)
|
||||||
else if ((nextsectnum < 0) || (!(sector[nextsectnum].floorstat&1)))
|
else if ((nextsectnum < 0) || (!(sector[nextsectnum].floorstat&1)))
|
||||||
{
|
{
|
||||||
//Parallaxing sky... hacked for Ken's mountain texture
|
//Parallaxing sky... hacked for Ken's mountain texture
|
||||||
calc_and_apply_fog_factor(sec->floorpicnum, sec->floorshade, sec->visibility, sec->floorpal, 0.005f);
|
if ((usehightile && hicfindsubst(globalpicnum, globalpal, hictinting[globalpal].f & HICTINT_ALWAYSUSEART)))
|
||||||
|
calc_and_apply_fog_factor(sec->floorshade, sec->visibility, sec->floorpal, 0.005f);
|
||||||
|
|
||||||
globvis2 = globalpisibility;
|
globvis2 = globalpisibility;
|
||||||
if (sec->visibility != 0)
|
if (sec->visibility != 0)
|
||||||
|
@ -4334,7 +4329,8 @@ static void polymost_drawalls(int32_t const bunch)
|
||||||
else if ((nextsectnum < 0) || (!(sector[nextsectnum].ceilingstat&1)))
|
else if ((nextsectnum < 0) || (!(sector[nextsectnum].ceilingstat&1)))
|
||||||
{
|
{
|
||||||
//Parallaxing sky... hacked for Ken's mountain texture
|
//Parallaxing sky... hacked for Ken's mountain texture
|
||||||
calc_and_apply_fog_factor(sec->ceilingpicnum, sec->ceilingshade, sec->visibility, sec->ceilingpal, 0.005f);
|
if ((usehightile && hicfindsubst(globalpicnum, globalpal, hictinting[globalpal].f & HICTINT_ALWAYSUSEART)))
|
||||||
|
calc_and_apply_fog_factor(sec->ceilingshade, sec->visibility, sec->ceilingpal, 0.005f);
|
||||||
|
|
||||||
globvis2 = globalpisibility;
|
globvis2 = globalpisibility;
|
||||||
if (sec->visibility != 0)
|
if (sec->visibility != 0)
|
||||||
|
@ -4730,7 +4726,8 @@ static void polymost_drawalls(int32_t const bunch)
|
||||||
}
|
}
|
||||||
if (wal->cstat&256) { xtex.v = -xtex.v; ytex.v = -ytex.v; otex.v = -otex.v; } //yflip
|
if (wal->cstat&256) { xtex.v = -xtex.v; ytex.v = -ytex.v; otex.v = -otex.v; } //yflip
|
||||||
|
|
||||||
calc_and_apply_fog(wal->picnum, fogshade(wal->shade, wal->pal), sec->visibility, get_floor_fogpal(sec));
|
if ((usehightile && hicfindsubst(globalpicnum, globalpal, hictinting[globalpal].f & HICTINT_ALWAYSUSEART)))
|
||||||
|
calc_and_apply_fog(fogshade(wal->shade, wal->pal), sec->visibility, get_floor_fogpal(sec));
|
||||||
|
|
||||||
pow2xsplit = 1; polymost_domost(x1,ocy1,x0,ocy0,cy1,ocy1,cy0,ocy0);
|
pow2xsplit = 1; polymost_domost(x1,ocy1,x0,ocy0,cy1,ocy1,cy0,ocy0);
|
||||||
if (wal->cstat&8) { xtex.u = ogux; ytex.u = oguy; otex.u = oguo; }
|
if (wal->cstat&8) { xtex.u = ogux; ytex.u = oguy; otex.u = oguo; }
|
||||||
|
@ -4770,7 +4767,8 @@ static void polymost_drawalls(int32_t const bunch)
|
||||||
}
|
}
|
||||||
if (nwal->cstat&256) { xtex.v = -xtex.v; ytex.v = -ytex.v; otex.v = -otex.v; } //yflip
|
if (nwal->cstat&256) { xtex.v = -xtex.v; ytex.v = -ytex.v; otex.v = -otex.v; } //yflip
|
||||||
|
|
||||||
calc_and_apply_fog(nwal->picnum, fogshade(nwal->shade, nwal->pal), sec->visibility, get_floor_fogpal(sec));
|
if ((usehightile && hicfindsubst(globalpicnum, globalpal, hictinting[globalpal].f & HICTINT_ALWAYSUSEART)))
|
||||||
|
calc_and_apply_fog(fogshade(nwal->shade, nwal->pal), sec->visibility, get_floor_fogpal(sec));
|
||||||
|
|
||||||
pow2xsplit = 1; polymost_domost(x0,ofy0,x1,ofy1,ofy0,fy0,ofy1,fy1);
|
pow2xsplit = 1; polymost_domost(x0,ofy0,x1,ofy1,ofy0,fy0,ofy1,fy1);
|
||||||
if (wal->cstat&(2+8)) { otex.u = oguo; xtex.u = ogux; ytex.u = oguy; }
|
if (wal->cstat&(2+8)) { otex.u = oguo; xtex.u = ogux; ytex.u = oguy; }
|
||||||
|
@ -4822,7 +4820,9 @@ static void polymost_drawalls(int32_t const bunch)
|
||||||
}
|
}
|
||||||
if (wal->cstat&256) { xtex.v = -xtex.v; ytex.v = -ytex.v; otex.v = -otex.v; } //yflip
|
if (wal->cstat&256) { xtex.v = -xtex.v; ytex.v = -ytex.v; otex.v = -otex.v; } //yflip
|
||||||
|
|
||||||
calc_and_apply_fog(wal->picnum, fogshade(wal->shade, wal->pal), sec->visibility, get_floor_fogpal(sec));
|
if ((usehightile && hicfindsubst(globalpicnum, globalpal, hictinting[globalpal].f & HICTINT_ALWAYSUSEART)))
|
||||||
|
calc_and_apply_fog(fogshade(wal->shade, wal->pal), sec->visibility, get_floor_fogpal(sec));
|
||||||
|
|
||||||
pow2xsplit = 1; polymost_domost(x0, cy0, x1, cy1, cy0, fy0, cy1, fy1);
|
pow2xsplit = 1; polymost_domost(x0, cy0, x1, cy1, cy0, fy0, cy1, fy1);
|
||||||
} while (0);
|
} while (0);
|
||||||
}
|
}
|
||||||
|
@ -5403,7 +5403,8 @@ void polymost_drawmaskwall(int32_t damaskwallcnt)
|
||||||
drawpoly_alpha = 0.f;
|
drawpoly_alpha = 0.f;
|
||||||
drawpoly_blend = blend;
|
drawpoly_blend = blend;
|
||||||
|
|
||||||
calc_and_apply_fog(wal->picnum, fogshade(wal->shade, wal->pal), sec->visibility, get_floor_fogpal(sec));
|
if ((usehightile && hicfindsubst(globalpicnum, globalpal, hictinting[globalpal].f & HICTINT_ALWAYSUSEART)))
|
||||||
|
calc_and_apply_fog(fogshade(wal->shade, wal->pal), sec->visibility, get_floor_fogpal(sec));
|
||||||
|
|
||||||
float const csy[4] = { ((float)(cz[0] - globalposz)) * ryp0 + ghoriz,
|
float const csy[4] = { ((float)(cz[0] - globalposz)) * ryp0 + ghoriz,
|
||||||
((float)(cz[1] - globalposz)) * ryp0 + ghoriz,
|
((float)(cz[1] - globalposz)) * ryp0 + ghoriz,
|
||||||
|
@ -5632,7 +5633,9 @@ void polymost_drawsprite(int32_t snum)
|
||||||
|
|
||||||
sec = (usectortype *)§or[tspr->sectnum];
|
sec = (usectortype *)§or[tspr->sectnum];
|
||||||
|
|
||||||
calc_and_apply_fog(tspr->picnum, fogshade(globalshade, globalpal), sec->visibility, get_floor_fogpal(sec));
|
if ((usehightile && hicfindsubst(globalpicnum, globalpal, hictinting[globalpal].f & HICTINT_ALWAYSUSEART))
|
||||||
|
|| (usemodels && md_tilehasmodel(globalpicnum, globalpal) >= 0))
|
||||||
|
calc_and_apply_fog(fogshade(globalshade, globalpal), sec->visibility, get_floor_fogpal(sec));
|
||||||
|
|
||||||
while (!(spriteext[spritenum].flags & SPREXT_NOTMD))
|
while (!(spriteext[spritenum].flags & SPREXT_NOTMD))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue