From 8b8cb97b77014a9f3c5dea999f4d097a78205f06 Mon Sep 17 00:00:00 2001 From: terminx Date: Sun, 2 Jul 2006 20:43:26 +0000 Subject: [PATCH] git-svn-id: https://svn.eduke32.com/eduke32@203 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/build/src/polymost.c | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/polymer/build/src/polymost.c b/polymer/build/src/polymost.c index 577cd3256..88e1e29c2 100644 --- a/polymer/build/src/polymost.c +++ b/polymer/build/src/polymost.c @@ -69,6 +69,7 @@ static long animateoffs(short tilenum, short fakevar); long rendmode = 0; long usemodels=1, usehightile=1; +float foggymcfogfogger; #include //<-important! typedef struct { float x, cy[2], fy[2]; long n, p, tag, ctag, ftag; } vsptyp; @@ -82,7 +83,7 @@ static double dxb1[MAXWALLSB], dxb2[MAXWALLSB]; #define USEZBUFFER 1 //1:use zbuffer (slow, nice sprite rendering), 0:no zbuffer (fast, bad sprite rendering) #define LINTERPSIZ 4 //log2 of interpolation size. 4:pretty fast&acceptable quality, 0:best quality/slow! #define DEPTHDEBUG 0 //1:render distance instead of texture, for debugging only!, 0:default -#define FOGSCALE 0.0000768 +#define FOGSCALE 0.0000800 #define PI 3.14159265358979323 static double gyxscale, gxyaspect, gviewxrange, ghalfx, grhalfxdown10, grhalfxdown10x, ghoriz; @@ -2206,7 +2207,7 @@ static void polymost_drawalls (long bunch) col[2] = (float)palookupfog[sec->floorpal].b / 63.f; col[3] = 0; bglFogfv(GL_FOG_COLOR,col); - bglFogf(GL_FOG_DENSITY,gvisibility/(sec->floorshade<0?klabs(sec->floorshade):1)*((float)((unsigned char)(sec->visibility+16)))); + bglFogf(GL_FOG_DENSITY,(gvisibility*((float)((unsigned char)(sec->visibility+16))))/(sec->floorshade<0?klabs(sec->floorshade):1)); // bglFogf(GL_FOG_DENSITY,gvisibility*((float)((unsigned char)(sec->visibility+16)))); } @@ -3045,12 +3046,10 @@ static void polymost_drawalls (long bunch) if (wal->cstat&256) { gvx = -gvx; gvy = -gvy; gvo = -gvo; } //yflip { - float oldfogval; - - bglGetFloatv(GL_FOG_DENSITY,&oldfogval); - bglFogf(GL_FOG_DENSITY,gvisibility/(wal->shade<0?klabs(wal->shade):1)*((float)((unsigned char)(sec->visibility+16)))); + bglGetFloatv(GL_FOG_DENSITY,&foggymcfogfogger); + bglFogf(GL_FOG_DENSITY,(gvisibility*((float)((unsigned char)(sec->visibility+16))))/(wal->shade<0?klabs(wal->shade):1)); pow2xsplit = 1; domost(x1,ocy1,x0,ocy0); - bglFogf(GL_FOG_DENSITY,oldfogval); + bglFogf(GL_FOG_DENSITY,foggymcfogfogger); } if (wal->cstat&8) { gux = ogux; guy = oguy; guo = oguo; } @@ -3088,12 +3087,10 @@ static void polymost_drawalls (long bunch) if (nwal->cstat&256) { gvx = -gvx; gvy = -gvy; gvo = -gvo; } //yflip { - float oldfogval; - - bglGetFloatv(GL_FOG_DENSITY,&oldfogval); - bglFogf(GL_FOG_DENSITY,gvisibility/(nwal->shade<0?klabs(nwal->shade):1)*((float)((unsigned char)(sec->visibility+16)))); + bglGetFloatv(GL_FOG_DENSITY,&foggymcfogfogger); + bglFogf(GL_FOG_DENSITY,(gvisibility*((float)((unsigned char)(sec->visibility+16))))/(nwal->shade<0?klabs(nwal->shade):1)); pow2xsplit = 1; domost(x0,ofy0,x1,ofy1); - bglFogf(GL_FOG_DENSITY,oldfogval); + bglFogf(GL_FOG_DENSITY,foggymcfogfogger); } if (wal->cstat&(2+8)) { guo = oguo; gux = ogux; guy = oguy; } @@ -3127,12 +3124,10 @@ static void polymost_drawalls (long bunch) if (wal->cstat&256) { gvx = -gvx; gvy = -gvy; gvo = -gvo; } //yflip { - float oldfogval; - - bglGetFloatv(GL_FOG_DENSITY,&oldfogval); - bglFogf(GL_FOG_DENSITY,gvisibility/(wal->shade<0?klabs(wal->shade):1)*((float)((unsigned char)(sec->visibility+16)))); + bglGetFloatv(GL_FOG_DENSITY,&foggymcfogfogger); + bglFogf(GL_FOG_DENSITY,(gvisibility*((float)((unsigned char)(sec->visibility+16))))/(wal->shade<0?klabs(wal->shade):1)); pow2xsplit = 1; domost(x0,-10000,x1,-10000); - bglFogf(GL_FOG_DENSITY,oldfogval); + bglFogf(GL_FOG_DENSITY,foggymcfogfogger); } } @@ -3691,7 +3686,7 @@ if (tspr->cstat&2) { if (!(tspr->cstat&512)) method = 2+4; else method = 3+4; } col[2] = (float)palookupfog[sector[tspr->sectnum].floorpal].b / 63.f; col[3] = 0; bglFogfv(GL_FOG_COLOR,col); //default is 0,0,0,0 - bglFogf(GL_FOG_DENSITY,gvisibility/(globalshade<0?klabs(globalshade):1)*((float)((unsigned char)(sector[tspr->sectnum].visibility+16)))); + bglFogf(GL_FOG_DENSITY,(gvisibility*((float)((unsigned char)(sector[tspr->sectnum].visibility+16))))/(globalshade<0?klabs(globalshade):1)); } while (rendmode == 3 && !(spriteext[tspr->owner].flags&SPREXT_NOTMD)) {