mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
- removed all legacy fog code.
This commit is contained in:
parent
2ef89abe08
commit
cd7bbe35a8
16 changed files with 32 additions and 171 deletions
|
@ -1408,9 +1408,6 @@ int32_t engineLoadBoardV5V6(const char *filename, char fromwhere, vec3_t *dapos,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void renderDisableFog(void);
|
|
||||||
void renderEnableFog(void);
|
|
||||||
|
|
||||||
static vec2_t const zerovec = { 0, 0 };
|
static vec2_t const zerovec = { 0, 0 };
|
||||||
|
|
||||||
#ifdef LUNATIC
|
#ifdef LUNATIC
|
||||||
|
|
|
@ -18,7 +18,7 @@ extern float glox1, gloy1;
|
||||||
extern double gxyaspect;
|
extern double gxyaspect;
|
||||||
extern float grhalfxdown10x;
|
extern float grhalfxdown10x;
|
||||||
extern float gcosang, gsinang, gcosang2, gsinang2;
|
extern float gcosang, gsinang, gcosang2, gsinang2;
|
||||||
extern float gchang, gshang, gctang, gstang, gvisibility;
|
extern float gchang, gshang, gctang, gstang;
|
||||||
extern float gvrcorrection;
|
extern float gvrcorrection;
|
||||||
|
|
||||||
struct glfiltermodes {
|
struct glfiltermodes {
|
||||||
|
|
|
@ -249,7 +249,6 @@ int32_t FindDistance3D(int32_t x, int32_t y, int32_t z)
|
||||||
// Clear OSD background
|
// Clear OSD background
|
||||||
void COMMON_doclearbackground(int numcols, int height)
|
void COMMON_doclearbackground(int numcols, int height)
|
||||||
{
|
{
|
||||||
GLInterface.SetFogEnabled(false);
|
|
||||||
GLInterface.UseColorOnly(true);
|
GLInterface.UseColorOnly(true);
|
||||||
|
|
||||||
polymostSet2dView();
|
polymostSet2dView();
|
||||||
|
@ -278,7 +277,6 @@ void COMMON_doclearbackground(int numcols, int height)
|
||||||
GLInterface.Draw(DT_TRIANGLE_STRIP, vert.first+4, 4);
|
GLInterface.Draw(DT_TRIANGLE_STRIP, vert.first+4, 4);
|
||||||
|
|
||||||
GLInterface.UseColorOnly(false);
|
GLInterface.UseColorOnly(false);
|
||||||
GLInterface.SetFogEnabled(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void COMMON_clearbackground(int numcols, int numrows)
|
void COMMON_clearbackground(int numcols, int numrows)
|
||||||
|
|
|
@ -132,15 +132,6 @@ extern int16_t bunchp2[MAXWALLSB];
|
||||||
extern int16_t numscans, numbunches;
|
extern int16_t numscans, numbunches;
|
||||||
extern int32_t rxi[8], ryi[8];
|
extern int32_t rxi[8], ryi[8];
|
||||||
|
|
||||||
#ifdef USE_OPENGL
|
|
||||||
|
|
||||||
// For GL_EXP2 fog:
|
|
||||||
#define FOGSCALE 0.0000768f
|
|
||||||
|
|
||||||
void calc_and_apply_fog(int32_t shade, int32_t vis, int32_t pal);
|
|
||||||
void calc_and_apply_fog_factor(int32_t shade, int32_t vis, int32_t pal, float factor);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern void get_wallspr_points(uspriteptr_t spr, int32_t *x1, int32_t *x2,
|
extern void get_wallspr_points(uspriteptr_t spr, int32_t *x1, int32_t *x2,
|
||||||
int32_t *y1, int32_t *y2);
|
int32_t *y1, int32_t *y2);
|
||||||
extern void get_floorspr_points(uspriteptr_t spr, int32_t px, int32_t py,
|
extern void get_floorspr_points(uspriteptr_t spr, int32_t px, int32_t py,
|
||||||
|
|
|
@ -59,7 +59,6 @@ void fullscreen_tint_gl(uint8_t r, uint8_t g, uint8_t b, uint8_t f)
|
||||||
|
|
||||||
GLInterface.EnableDepthTest(false);
|
GLInterface.EnableDepthTest(false);
|
||||||
GLInterface.EnableAlphaTest(false);
|
GLInterface.EnableAlphaTest(false);
|
||||||
GLInterface.SetFogEnabled(false);
|
|
||||||
|
|
||||||
GLInterface.SetBlendFunc(STYLEALPHA_Src, STYLEALPHA_InvSrc);
|
GLInterface.SetBlendFunc(STYLEALPHA_Src, STYLEALPHA_InvSrc);
|
||||||
GLInterface.EnableBlend(true);
|
GLInterface.EnableBlend(true);
|
||||||
|
@ -94,7 +93,6 @@ void fullscreen_tint_gl_blood(void)
|
||||||
|
|
||||||
GLInterface.EnableDepthTest(false);
|
GLInterface.EnableDepthTest(false);
|
||||||
GLInterface.EnableAlphaTest(false);
|
GLInterface.EnableAlphaTest(false);
|
||||||
GLInterface.SetFogEnabled(false);
|
|
||||||
|
|
||||||
GLInterface.SetBlendFunc(STYLEALPHA_One, STYLEALPHA_One);
|
GLInterface.SetBlendFunc(STYLEALPHA_One, STYLEALPHA_One);
|
||||||
GLInterface.EnableBlend(true);
|
GLInterface.EnableBlend(true);
|
||||||
|
|
|
@ -66,7 +66,7 @@ static float ghorizcorrect;
|
||||||
double gxyaspect;
|
double gxyaspect;
|
||||||
float gyxscale, ghalfx, grhalfxdown10, grhalfxdown10x, ghalfy;
|
float gyxscale, ghalfx, grhalfxdown10, grhalfxdown10x, ghalfy;
|
||||||
float gcosang, gsinang, gcosang2, gsinang2;
|
float gcosang, gsinang, gcosang2, gsinang2;
|
||||||
float gchang, gshang, gctang, gstang, gvisibility;
|
float gchang, gshang, gctang, gstang;
|
||||||
float gtang = 0.f;
|
float gtang = 0.f;
|
||||||
float gvrcorrection = 1.f;
|
float gvrcorrection = 1.f;
|
||||||
|
|
||||||
|
@ -298,63 +298,6 @@ void polymost_glinit()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////// VISIBILITY FOG ROUTINES //////////
|
|
||||||
|
|
||||||
// For GL_LINEAR fog:
|
|
||||||
#define GL_FOG_MAX 1.0e37f
|
|
||||||
|
|
||||||
void calc_and_apply_fog(int32_t shade, int32_t vis, int32_t pal)
|
|
||||||
{
|
|
||||||
if (nofog) return;
|
|
||||||
|
|
||||||
fogresult = 0.f;
|
|
||||||
fogcol = fogtable[pal];
|
|
||||||
|
|
||||||
if (((uint8_t)(vis + 16)) > 0 && globalvisibility > 0)
|
|
||||||
{
|
|
||||||
constexpr GLfloat glfogconstant = 262144.f;
|
|
||||||
GLfloat fogrange = (frealmaxshade * glfogconstant) / (((uint8_t)(vis + 16)) * globalvisibility);
|
|
||||||
|
|
||||||
fogresult = 0.f - (((min(shade, 0) - 0.5f) / frealmaxshade) * fogrange); // min() = subtract shades from fog
|
|
||||||
fogresult2 = fogrange - (((shade - 0.5f) / frealmaxshade) * fogrange);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fogresult = 0.f;
|
|
||||||
fogresult2 = -GL_FOG_MAX; // hide fog behind the camera
|
|
||||||
}
|
|
||||||
|
|
||||||
GLInterface.SetFogLinear((float*)&fogcol, fogresult, fogresult2);
|
|
||||||
}
|
|
||||||
|
|
||||||
void calc_and_apply_fog_factor(int32_t shade, int32_t vis, int32_t pal, float factor)
|
|
||||||
{
|
|
||||||
if (nofog) return;
|
|
||||||
|
|
||||||
fogcol = fogtable[pal];
|
|
||||||
|
|
||||||
if (((uint8_t)(vis + 16)) > 0 && ((((uint8_t)(vis + 16)) / 8.f) + shade) > 0)
|
|
||||||
{
|
|
||||||
GLfloat normalizedshade = (shade - 0.5f) / frealmaxshade;
|
|
||||||
GLfloat fogrange = (((uint8_t)(vis + 16)) / (8.f * frealmaxshade)) + normalizedshade;
|
|
||||||
|
|
||||||
// subtract shades from fog
|
|
||||||
if (normalizedshade > 0.f && normalizedshade < 1.f)
|
|
||||||
fogrange = (fogrange - normalizedshade) / (1.f - normalizedshade);
|
|
||||||
|
|
||||||
fogresult = -(GL_FOG_MAX * fogrange);
|
|
||||||
fogresult2 = GL_FOG_MAX - (GL_FOG_MAX * fogrange);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fogresult = 0.f;
|
|
||||||
fogresult2 = -GL_FOG_MAX; // hide fog behind the camera
|
|
||||||
}
|
|
||||||
|
|
||||||
GLInterface.SetFogLinear((float*)& fogcol, fogresult, fogresult2);
|
|
||||||
}
|
|
||||||
////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
static float get_projhack_ratio(void)
|
static float get_projhack_ratio(void)
|
||||||
{
|
{
|
||||||
|
@ -425,8 +368,6 @@ static void resizeglcheck(void)
|
||||||
GLInterface.SetMatrix(Matrix_Projection, &m[0][0]);
|
GLInterface.SetMatrix(Matrix_Projection, &m[0][0]);
|
||||||
VSMatrix identity(0);
|
VSMatrix identity(0);
|
||||||
GLInterface.SetMatrix(Matrix_ModelView, &identity);
|
GLInterface.SetMatrix(Matrix_ModelView, &identity);
|
||||||
|
|
||||||
if (!nofog) GLInterface.SetFogEnabled(true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1913,8 +1854,6 @@ 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(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)
|
||||||
{
|
{
|
||||||
if (globalposz > getflorzofslope(sectnum, globalposx, globalposy))
|
if (globalposz > getflorzofslope(sectnum, globalposx, globalposy))
|
||||||
|
@ -2382,8 +2321,6 @@ static void polymost_drawalls(int32_t const bunch)
|
||||||
}
|
}
|
||||||
else if ((nextsectnum < 0) || (!(sector[nextsectnum].floorstat&1)))
|
else if ((nextsectnum < 0) || (!(sector[nextsectnum].floorstat&1)))
|
||||||
{
|
{
|
||||||
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)
|
||||||
globvis2 = mulscale4(globvis2, (uint8_t)(sec->visibility + 16));
|
globvis2 = mulscale4(globvis2, (uint8_t)(sec->visibility + 16));
|
||||||
|
@ -2593,8 +2530,6 @@ static void polymost_drawalls(int32_t const bunch)
|
||||||
|
|
||||||
skyclamphack = 0;
|
skyclamphack = 0;
|
||||||
skyzbufferhack = 0;
|
skyzbufferhack = 0;
|
||||||
if (!nofog)
|
|
||||||
GLInterface.SetFogEnabled(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ceiling
|
// Ceiling
|
||||||
|
@ -2644,8 +2579,6 @@ static void polymost_drawalls(int32_t const bunch)
|
||||||
}
|
}
|
||||||
else if ((nextsectnum < 0) || (!(sector[nextsectnum].ceilingstat&1)))
|
else if ((nextsectnum < 0) || (!(sector[nextsectnum].ceilingstat&1)))
|
||||||
{
|
{
|
||||||
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)
|
||||||
globvis2 = mulscale4(globvis2, (uint8_t)(sec->visibility + 16));
|
globvis2 = mulscale4(globvis2, (uint8_t)(sec->visibility + 16));
|
||||||
|
@ -2855,8 +2788,6 @@ static void polymost_drawalls(int32_t const bunch)
|
||||||
|
|
||||||
skyclamphack = 0;
|
skyclamphack = 0;
|
||||||
skyzbufferhack = 0;
|
skyzbufferhack = 0;
|
||||||
if (!nofog)
|
|
||||||
GLInterface.SetFogEnabled(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef YAX_ENABLE
|
#ifdef YAX_ENABLE
|
||||||
|
@ -2960,8 +2891,6 @@ 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(fogshade(wal->shade, wal->pal), sec->visibility, get_floor_fogpal(sec));
|
|
||||||
|
|
||||||
pow2xsplit = 1;
|
pow2xsplit = 1;
|
||||||
#ifdef YAX_ENABLE
|
#ifdef YAX_ENABLE
|
||||||
if (should_clip_cfwall(x1,cy1,x0,cy0))
|
if (should_clip_cfwall(x1,cy1,x0,cy0))
|
||||||
|
@ -3004,8 +2933,6 @@ 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(fogshade(nwal->shade, nwal->pal), sec->visibility, get_floor_fogpal(sec));
|
|
||||||
|
|
||||||
pow2xsplit = 1;
|
pow2xsplit = 1;
|
||||||
#ifdef YAX_ENABLE
|
#ifdef YAX_ENABLE
|
||||||
if (should_clip_cfwall(x0,fy0,x1,fy1))
|
if (should_clip_cfwall(x0,fy0,x1,fy1))
|
||||||
|
@ -3060,8 +2987,6 @@ 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(fogshade(wal->shade, wal->pal), sec->visibility, get_floor_fogpal(sec));
|
|
||||||
|
|
||||||
pow2xsplit = 1;
|
pow2xsplit = 1;
|
||||||
|
|
||||||
#ifdef YAX_ENABLE
|
#ifdef YAX_ENABLE
|
||||||
|
@ -3407,8 +3332,6 @@ void polymost_drawrooms()
|
||||||
ghoriz = fix16_to_float(qglobalhoriz);
|
ghoriz = fix16_to_float(qglobalhoriz);
|
||||||
ghorizcorrect = fix16_to_float((100-polymostcenterhoriz)*divscale16(xdimenscale, viewingrange));
|
ghorizcorrect = fix16_to_float((100-polymostcenterhoriz)*divscale16(xdimenscale, viewingrange));
|
||||||
|
|
||||||
gvisibility = ((float)globalvisibility)*FOGSCALE;
|
|
||||||
|
|
||||||
GLInterface.SetShadeInterpolate(r_shadeinterpolate);
|
GLInterface.SetShadeInterpolate(r_shadeinterpolate);
|
||||||
|
|
||||||
//global cos/sin height angle
|
//global cos/sin height angle
|
||||||
|
@ -3745,8 +3668,6 @@ static void polymost_drawmaskwallinternal(int32_t wallIndex)
|
||||||
drawpoly_alpha = 0.f;
|
drawpoly_alpha = 0.f;
|
||||||
drawpoly_blend = blend;
|
drawpoly_blend = blend;
|
||||||
|
|
||||||
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,
|
||||||
((float)(cz[2] - globalposz)) * ryp1 + ghoriz,
|
((float)(cz[2] - globalposz)) * ryp1 + ghoriz,
|
||||||
|
@ -3875,7 +3796,6 @@ void polymost_prepareMirror(int32_t dax, int32_t day, int32_t daz, fix16_t daang
|
||||||
grhalfxdown10 = 1.f/(ghalfx*1024.f);
|
grhalfxdown10 = 1.f/(ghalfx*1024.f);
|
||||||
ghoriz = fix16_to_float(qglobalhoriz);
|
ghoriz = fix16_to_float(qglobalhoriz);
|
||||||
ghorizcorrect = fix16_to_float((100-polymostcenterhoriz)*divscale16(xdimenscale, viewingrange));
|
ghorizcorrect = fix16_to_float((100-polymostcenterhoriz)*divscale16(xdimenscale, viewingrange));
|
||||||
gvisibility = ((float)globalvisibility)*FOGSCALE;
|
|
||||||
resizeglcheck();
|
resizeglcheck();
|
||||||
if (r_yshearing)
|
if (r_yshearing)
|
||||||
{
|
{
|
||||||
|
@ -4055,8 +3975,6 @@ void polymost_drawsprite(int32_t snum)
|
||||||
|
|
||||||
sec = (usectorptr_t)§or[tspr->sectnum];
|
sec = (usectorptr_t)§or[tspr->sectnum];
|
||||||
|
|
||||||
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))
|
||||||
{
|
{
|
||||||
if (usemodels && tile2model[Ptile2tile(tspr->picnum, tspr->pal)].modelid >= 0 &&
|
if (usemodels && tile2model[Ptile2tile(tspr->picnum, tspr->pal)].modelid >= 0 &&
|
||||||
|
@ -4799,13 +4717,9 @@ void polymost_dorotatespritemodel(int32_t sx, int32_t sy, int32_t z, int16_t a,
|
||||||
spriteext[tspr.owner].alpha = daalpha * (1.0f / 255.0f);
|
spriteext[tspr.owner].alpha = daalpha * (1.0f / 255.0f);
|
||||||
tspr.blend = dablend;
|
tspr.blend = dablend;
|
||||||
|
|
||||||
GLInterface.SetFogEnabled(false);
|
|
||||||
|
|
||||||
if (videoGetRenderMode() == REND_POLYMOST)
|
if (videoGetRenderMode() == REND_POLYMOST)
|
||||||
polymost_mddraw(&tspr);
|
polymost_mddraw(&tspr);
|
||||||
|
|
||||||
if (!nofog) GLInterface.SetFogEnabled(true);
|
|
||||||
|
|
||||||
gvrcorrection = ogvrcorrection;
|
gvrcorrection = ogvrcorrection;
|
||||||
viewingrange = oldviewingrange;
|
viewingrange = oldviewingrange;
|
||||||
fviewingrange = oldfviewingrange;
|
fviewingrange = oldfviewingrange;
|
||||||
|
@ -5039,9 +4953,7 @@ void polymost_dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16
|
||||||
xtex.v = yv2*(1.0/65536.0);
|
xtex.v = yv2*(1.0/65536.0);
|
||||||
ytex.v = yv*(1.0/65536.0);
|
ytex.v = yv*(1.0/65536.0);
|
||||||
|
|
||||||
GLInterface.SetFogEnabled(false);
|
|
||||||
pow2xsplit = 0; polymost_drawpoly(fpxy,n,method, tilesiz[globalpicnum]);
|
pow2xsplit = 0; polymost_drawpoly(fpxy,n,method, tilesiz[globalpicnum]);
|
||||||
if (!nofog) GLInterface.SetFogEnabled(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GLInterface.EnableAlphaTest(false);
|
GLInterface.EnableAlphaTest(false);
|
||||||
|
@ -5331,17 +5243,6 @@ static int32_t gen_font_glyph_tex(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// These are used by the automap drawers
|
|
||||||
void renderDisableFog(void)
|
|
||||||
{
|
|
||||||
GLInterface.SetFogEnabled(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void renderEnableFog(void)
|
|
||||||
{
|
|
||||||
if (!nofog) GLInterface.SetFogEnabled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t polymost_printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, const char *name, char fontsize)
|
int32_t polymost_printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, const char *name, char fontsize)
|
||||||
{
|
{
|
||||||
int const arbackcol = (unsigned)backcol < 256 ? backcol : 0;
|
int const arbackcol = (unsigned)backcol < 256 ? backcol : 0;
|
||||||
|
@ -5368,7 +5269,6 @@ int32_t polymost_printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t ba
|
||||||
GLInterface.EnableAlphaTest(false);
|
GLInterface.EnableAlphaTest(false);
|
||||||
GLInterface.SetDepthMask(false);
|
GLInterface.SetDepthMask(false);
|
||||||
|
|
||||||
GLInterface.SetFogEnabled(false);
|
|
||||||
// We want to have readable text in wireframe mode, too:
|
// We want to have readable text in wireframe mode, too:
|
||||||
GLInterface.SetWireframe(false);
|
GLInterface.SetWireframe(false);
|
||||||
lastglpolygonmode = 0;
|
lastglpolygonmode = 0;
|
||||||
|
@ -5457,8 +5357,6 @@ int32_t polymost_printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t ba
|
||||||
|
|
||||||
GLInterface.SetDepthMask(true);
|
GLInterface.SetDepthMask(true);
|
||||||
|
|
||||||
if (!nofog) GLInterface.SetFogEnabled(true);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -328,8 +328,6 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16
|
||||||
xvect2 = mulscale16(xvect, yxaspect);
|
xvect2 = mulscale16(xvect, yxaspect);
|
||||||
yvect2 = mulscale16(yvect, yxaspect);
|
yvect2 = mulscale16(yvect, yxaspect);
|
||||||
|
|
||||||
renderDisableFog();
|
|
||||||
|
|
||||||
//Draw red lines
|
//Draw red lines
|
||||||
for (i=numsectors-1; i>=0; i--)
|
for (i=numsectors-1; i>=0; i--)
|
||||||
{
|
{
|
||||||
|
@ -368,8 +366,6 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
renderEnableFog();
|
|
||||||
|
|
||||||
//Draw sprites
|
//Draw sprites
|
||||||
k = g_player[screenpeek].ps->i;
|
k = g_player[screenpeek].ps->i;
|
||||||
if (!FURY) for (i=numsectors-1; i>=0; i--)
|
if (!FURY) for (i=numsectors-1; i>=0; i--)
|
||||||
|
@ -515,8 +511,6 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
renderDisableFog();
|
|
||||||
|
|
||||||
//Draw white lines
|
//Draw white lines
|
||||||
for (i=numsectors-1; i>=0; i--)
|
for (i=numsectors-1; i>=0; i--)
|
||||||
{
|
{
|
||||||
|
@ -557,8 +551,6 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
renderEnableFog();
|
|
||||||
|
|
||||||
videoSetCorrectedAspect();
|
videoSetCorrectedAspect();
|
||||||
|
|
||||||
for (TRAVERSE_CONNECT(p))
|
for (TRAVERSE_CONNECT(p))
|
||||||
|
|
|
@ -139,6 +139,26 @@ unsigned PaletteManager::FindPalswap(const uint8_t* paldata)
|
||||||
pd.lookup = paldata;
|
pd.lookup = paldata;
|
||||||
pd.crc32 = crc32;
|
pd.crc32 = crc32;
|
||||||
pd.swaptexture = nullptr;
|
pd.swaptexture = nullptr;
|
||||||
|
|
||||||
|
// Find what index maps to black (or the darkest available color)
|
||||||
|
int found = -1;
|
||||||
|
PalEntry foundColor = 0xffffffff;
|
||||||
|
for (int i = 0; i < 255; i++)
|
||||||
|
{
|
||||||
|
int map = paldata[i];
|
||||||
|
PalEntry color = palettes[0].colors[map];
|
||||||
|
if (color.Luminance() < foundColor.Luminance())
|
||||||
|
{
|
||||||
|
foundColor = color;
|
||||||
|
found = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Determine the fade color. We pick what black, or the darkest color, maps to in the lowest shade level.
|
||||||
|
int map = paldata[(numshades - 2) * 256 + found]; // do not look in the latest shade level because it doesn't always contain useful data for this.
|
||||||
|
pd.fadeColor = palettes[0].colors[map];
|
||||||
|
if (pd.fadeColor.Luminance() < 10) pd.fadeColor = 0; // Account for the inability to check the last fade level by using a higher threshold for determining black fog.
|
||||||
|
|
||||||
return palswaps.Push(pd);
|
return palswaps.Push(pd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,6 +271,7 @@ void PaletteManager::BindPalswap(int index)
|
||||||
palswaps[uindex].swaptexture = p;
|
palswaps[uindex].swaptexture = p;
|
||||||
}
|
}
|
||||||
inst->BindTexture(1, palswaps[uindex].swaptexture);
|
inst->BindTexture(1, palswaps[uindex].swaptexture);
|
||||||
|
inst->SetFadeColor(palswaps[index].fadeColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@ struct PolymostRenderState
|
||||||
float Shade;
|
float Shade;
|
||||||
float NumShades = 64.f;
|
float NumShades = 64.f;
|
||||||
float VisFactor = 128.f;
|
float VisFactor = 128.f;
|
||||||
float FogEnabled = 1.f;
|
|
||||||
float UseColorOnly;
|
float UseColorOnly;
|
||||||
float UsePalette = 1.f;
|
float UsePalette = 1.f;
|
||||||
float UseDetailMapping;
|
float UseDetailMapping;
|
||||||
|
@ -18,7 +17,6 @@ struct PolymostRenderState
|
||||||
float NPOTEmulationXOffset;
|
float NPOTEmulationXOffset;
|
||||||
float Brightness = 1.f;
|
float Brightness = 1.f;
|
||||||
float ShadeInterpolate = 1.f;
|
float ShadeInterpolate = 1.f;
|
||||||
float Fog[4];
|
|
||||||
float FogColor[4];
|
float FogColor[4];
|
||||||
|
|
||||||
void Apply(PolymostShader *shader);
|
void Apply(PolymostShader *shader);
|
||||||
|
|
|
@ -139,7 +139,6 @@ bool PolymostShader::Load(const char * name, const char * vert_prog, const char
|
||||||
Shade.Init(hShader, "u_shade");
|
Shade.Init(hShader, "u_shade");
|
||||||
NumShades.Init(hShader, "u_numShades");
|
NumShades.Init(hShader, "u_numShades");
|
||||||
VisFactor.Init(hShader, "u_visFactor");
|
VisFactor.Init(hShader, "u_visFactor");
|
||||||
FogEnabled.Init(hShader, "u_fogEnabled");
|
|
||||||
UseColorOnly.Init(hShader, "u_useColorOnly");
|
UseColorOnly.Init(hShader, "u_useColorOnly");
|
||||||
UsePalette.Init(hShader, "u_usePalette");
|
UsePalette.Init(hShader, "u_usePalette");
|
||||||
UseDetailMapping.Init(hShader, "u_useDetailMapping");
|
UseDetailMapping.Init(hShader, "u_useDetailMapping");
|
||||||
|
@ -149,7 +148,6 @@ bool PolymostShader::Load(const char * name, const char * vert_prog, const char
|
||||||
NPOTEmulationXOffset.Init(hShader, "u_npotEmulationXOffset");
|
NPOTEmulationXOffset.Init(hShader, "u_npotEmulationXOffset");
|
||||||
Brightness.Init(hShader, "u_brightness");
|
Brightness.Init(hShader, "u_brightness");
|
||||||
ShadeInterpolate.Init(hShader, "u_shadeInterpolate");
|
ShadeInterpolate.Init(hShader, "u_shadeInterpolate");
|
||||||
Fog.Init(hShader, "u_fog");
|
|
||||||
FogColor.Init(hShader, "u_fogColor");
|
FogColor.Init(hShader, "u_fogColor");
|
||||||
|
|
||||||
RotMatrix.Init(hShader, "u_rotMatrix");
|
RotMatrix.Init(hShader, "u_rotMatrix");
|
||||||
|
|
|
@ -39,7 +39,6 @@ public:
|
||||||
FBufferedUniform1f Shade;
|
FBufferedUniform1f Shade;
|
||||||
FBufferedUniform1f NumShades;
|
FBufferedUniform1f NumShades;
|
||||||
FBufferedUniform1f VisFactor;
|
FBufferedUniform1f VisFactor;
|
||||||
FBufferedUniform1f FogEnabled;
|
|
||||||
FBufferedUniform1f UseColorOnly;
|
FBufferedUniform1f UseColorOnly;
|
||||||
FBufferedUniform1f UsePalette;
|
FBufferedUniform1f UsePalette;
|
||||||
FBufferedUniform1f UseDetailMapping;
|
FBufferedUniform1f UseDetailMapping;
|
||||||
|
@ -48,7 +47,6 @@ public:
|
||||||
FBufferedUniform1f NPOTEmulationFactor;
|
FBufferedUniform1f NPOTEmulationFactor;
|
||||||
FBufferedUniform1f NPOTEmulationXOffset;
|
FBufferedUniform1f NPOTEmulationXOffset;
|
||||||
FBufferedUniform1f Brightness;
|
FBufferedUniform1f Brightness;
|
||||||
FBufferedUniform4f Fog;
|
|
||||||
FBufferedUniform4f FogColor;
|
FBufferedUniform4f FogColor;
|
||||||
FBufferedUniform1f ShadeInterpolate;
|
FBufferedUniform1f ShadeInterpolate;
|
||||||
|
|
||||||
|
|
|
@ -385,12 +385,11 @@ void GLInstance::SetDepthFunc(int func)
|
||||||
glDepthFunc(f[func]);
|
glDepthFunc(f[func]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLInstance::SetFogLinear(float* color, float start, float end)
|
void GLInstance::SetFadeColor(PalEntry color)
|
||||||
{
|
{
|
||||||
renderState.Fog[0] = end;
|
renderState.FogColor[0] = color.r * (1 / 255.f);
|
||||||
renderState.Fog[1] = 1.f / (end - start);
|
renderState.FogColor[1] = color.g * (1 / 255.f);
|
||||||
renderState.Fog[2] = 0.f;
|
renderState.FogColor[2] = color.b * (1 / 255.f);
|
||||||
memcpy(renderState.FogColor, color, 4 * sizeof(float));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void GLInstance::SetColorMask(bool on)
|
void GLInstance::SetColorMask(bool on)
|
||||||
|
@ -493,7 +492,6 @@ void PolymostRenderState::Apply(PolymostShader* shader)
|
||||||
shader->Shade.Set(Shade);
|
shader->Shade.Set(Shade);
|
||||||
shader->NumShades.Set(NumShades);
|
shader->NumShades.Set(NumShades);
|
||||||
shader->VisFactor.Set(VisFactor);
|
shader->VisFactor.Set(VisFactor);
|
||||||
shader->FogEnabled.Set(FogEnabled);
|
|
||||||
shader->UseColorOnly.Set(UseColorOnly);
|
shader->UseColorOnly.Set(UseColorOnly);
|
||||||
shader->UsePalette.Set(UsePalette);
|
shader->UsePalette.Set(UsePalette);
|
||||||
shader->UseDetailMapping.Set(UseDetailMapping);
|
shader->UseDetailMapping.Set(UseDetailMapping);
|
||||||
|
@ -503,7 +501,6 @@ void PolymostRenderState::Apply(PolymostShader* shader)
|
||||||
shader->NPOTEmulationXOffset.Set(NPOTEmulationXOffset);
|
shader->NPOTEmulationXOffset.Set(NPOTEmulationXOffset);
|
||||||
shader->ShadeInterpolate.Set(ShadeInterpolate);
|
shader->ShadeInterpolate.Set(ShadeInterpolate);
|
||||||
shader->Brightness.Set(Brightness);
|
shader->Brightness.Set(Brightness);
|
||||||
shader->Fog.Set(Fog);
|
|
||||||
shader->FogColor.Set(FogColor);
|
shader->FogColor.Set(FogColor);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,6 @@ struct PaletteData
|
||||||
{
|
{
|
||||||
int32_t crc32;
|
int32_t crc32;
|
||||||
PalEntry colors[256];
|
PalEntry colors[256];
|
||||||
float shades[512]; // two values (addshade and mulshade for each palswap.)
|
|
||||||
bool shadesdone;
|
bool shadesdone;
|
||||||
int whiteindex, blackindex;
|
int whiteindex, blackindex;
|
||||||
FHardwareTexture* paltexture;
|
FHardwareTexture* paltexture;
|
||||||
|
@ -37,6 +36,7 @@ struct PalswapData
|
||||||
int32_t crc32;
|
int32_t crc32;
|
||||||
const uint8_t *lookup; // points to the original data. This is static so no need to copy
|
const uint8_t *lookup; // points to the original data. This is static so no need to copy
|
||||||
FHardwareTexture* swaptexture;
|
FHardwareTexture* swaptexture;
|
||||||
|
PalEntry fadeColor;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
|
@ -278,7 +278,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetDepthFunc(int func);
|
void SetDepthFunc(int func);
|
||||||
void SetFogLinear(float* color, float start, float end);
|
void SetFadeColor(PalEntry color);
|
||||||
void SetColorMask(bool on);
|
void SetColorMask(bool on);
|
||||||
void SetDepthMask(bool on);
|
void SetDepthMask(bool on);
|
||||||
void SetBlendFunc(int src, int dst);
|
void SetBlendFunc(int src, int dst);
|
||||||
|
@ -331,11 +331,6 @@ public:
|
||||||
renderState.VisFactor = visibility * fviewingrange * (1.f / (64.f * 65536.f));
|
renderState.VisFactor = visibility * fviewingrange * (1.f / (64.f * 65536.f));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetFogEnabled(bool fogEnabled)
|
|
||||||
{
|
|
||||||
renderState.FogEnabled = fogEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UseColorOnly(bool useColorOnly)
|
void UseColorOnly(bool useColorOnly)
|
||||||
{
|
{
|
||||||
renderState.UseColorOnly = useColorOnly;
|
renderState.UseColorOnly = useColorOnly;
|
||||||
|
|
|
@ -318,8 +318,6 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16
|
||||||
xvect2 = mulscale16(xvect, yxaspect);
|
xvect2 = mulscale16(xvect, yxaspect);
|
||||||
yvect2 = mulscale16(yvect, yxaspect);
|
yvect2 = mulscale16(yvect, yxaspect);
|
||||||
|
|
||||||
renderDisableFog();
|
|
||||||
|
|
||||||
//Draw red lines
|
//Draw red lines
|
||||||
for (i=numsectors-1; i>=0; i--)
|
for (i=numsectors-1; i>=0; i--)
|
||||||
{
|
{
|
||||||
|
@ -362,8 +360,6 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
renderEnableFog();
|
|
||||||
|
|
||||||
//Draw sprites
|
//Draw sprites
|
||||||
k = g_player[screenpeek].ps->i;
|
k = g_player[screenpeek].ps->i;
|
||||||
for (i=numsectors-1; i>=0; i--)
|
for (i=numsectors-1; i>=0; i--)
|
||||||
|
@ -509,8 +505,6 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
renderDisableFog();
|
|
||||||
|
|
||||||
//Draw white lines
|
//Draw white lines
|
||||||
for (i=numsectors-1; i>=0; i--)
|
for (i=numsectors-1; i>=0; i--)
|
||||||
{
|
{
|
||||||
|
@ -551,8 +545,6 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
renderEnableFog();
|
|
||||||
|
|
||||||
videoSetCorrectedAspect();
|
videoSetCorrectedAspect();
|
||||||
|
|
||||||
for (TRAVERSE_CONNECT(p))
|
for (TRAVERSE_CONNECT(p))
|
||||||
|
|
|
@ -310,7 +310,7 @@ playanm(short anim_num)
|
||||||
|
|
||||||
videoClearViewableArea(0L);
|
videoClearViewableArea(0L);
|
||||||
|
|
||||||
paletteSetColorTable(0, ANIMvesapal);
|
paletteSetColorTable(0, ANIMvesapal, true);
|
||||||
videoSetPalette(gs.Brightness,0,2);
|
videoSetPalette(gs.Brightness,0,2);
|
||||||
if (ANIMnum == 1)
|
if (ANIMnum == 1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,7 +24,6 @@ uniform float u_npotEmulationFactor;
|
||||||
uniform float u_npotEmulationXOffset;
|
uniform float u_npotEmulationXOffset;
|
||||||
uniform float u_shadeInterpolate;
|
uniform float u_shadeInterpolate;
|
||||||
uniform float u_brightness;
|
uniform float u_brightness;
|
||||||
uniform vec4 u_fog;
|
|
||||||
uniform vec4 u_fogColor;
|
uniform vec4 u_fogColor;
|
||||||
|
|
||||||
uniform float u_useDetailMapping;
|
uniform float u_useDetailMapping;
|
||||||
|
@ -189,17 +188,6 @@ void main()
|
||||||
if (fullbright == 0.0) color.rgb *= v_color.rgb;
|
if (fullbright == 0.0) color.rgb *= v_color.rgb;
|
||||||
color.a *= v_color.a;
|
color.a *= v_color.a;
|
||||||
color.rgb *= detailColor.rgb;
|
color.rgb *= detailColor.rgb;
|
||||||
|
|
||||||
if (u_fogEnabled != 0.0 && u_usePalette == 0.0)// the following would make sense if 'fullbright' could ever be true in non-paletted rendering: && (fullbright != 0.0 || u_fogColor.rgb != vec3(0.0) ))
|
|
||||||
{
|
|
||||||
float fogFactor;
|
|
||||||
|
|
||||||
if (u_fog.z == 0) fogFactor = (u_fog.x-v_fogCoord)*u_fog.y; // linear fog
|
|
||||||
else fogFactor = exp2 (u_fog.z * v_fogCoord); // exponential fog
|
|
||||||
|
|
||||||
fogFactor = clamp(fogFactor, 0.0, 1.0);
|
|
||||||
color.rgb = mix(u_fogColor.rgb, color.rgb, fogFactor);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue