Test cvars for shading stuff

git-svn-id: https://svn.eduke32.com/eduke32@213 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2006-07-06 18:23:06 +00:00
parent 621da0a840
commit 7a742f1646

View file

@ -75,10 +75,11 @@ long usemodels=1, usehightile=1;
float fogtable[] = { 0.275, 0.325, 0.375, 0.425, 0.475, 0.525, 0.575, 0.625, 0.675, 0.725, 0.775, 0.825, 0.875, 0.925, 0.975, 1.025, 1.075, 1.125, 1.175, 1.225, 1.275, 1.325, 1.375, 1.425, 1.475, 1.525, 1.575, 1.625, 1.675, 1.725, 1.775, 1.825 };
#define NEGFOGSUB 0.075
#define NEGFOGTABLESCALE 6.670
#define FOGTABLESCALE 1.900
#define SPRFOGTABLESCALE 1.700
float glnegfogsub = 0.075;
float glnegshadescale = 6.670;
float glshadescale = 1.900;
float glsprshadescale = 1.700;
#include <math.h> //<-important!
typedef struct { float x, cy[2], fy[2]; long n, p, tag, ctag, ftag; } vsptyp;
@ -2380,7 +2381,7 @@ static void polymost_drawalls (long bunch)
{
int i = klabs(sec->floorshade);
if(i > 30) i = 30;
bglFogf(GL_FOG_DENSITY,gvisibility/(sec->floorshade<0?(fogtable[i]-NEGFOGSUB)*NEGFOGTABLESCALE:1)*(sec->floorshade<0?1:fogtable[i]*FOGTABLESCALE)*((float)((unsigned char)(sec->visibility+16))));
bglFogf(GL_FOG_DENSITY,gvisibility/(sec->floorshade<0?(fogtable[i]-glnegfogsub)*glnegshadescale:1)*(sec->floorshade<0?1:fogtable[i]*glshadescale)*((float)((unsigned char)(sec->visibility+16))));
}
pow2xsplit = 0; domost(x0,fy0,x1,fy1); //flor
domostpolymethod = 0;
@ -2402,7 +2403,7 @@ static void polymost_drawalls (long bunch)
{
int i = klabs(sec->floorshade);
if(i > 30) i = 30;
bglFogf(GL_FOG_DENSITY,0.005*gvisibility/(sec->floorshade<0?(fogtable[i]-NEGFOGSUB)*NEGFOGTABLESCALE:1)*((float)((unsigned char)(sec->visibility+16))));
bglFogf(GL_FOG_DENSITY,0.005*gvisibility/(sec->floorshade<0?(fogtable[i]-glnegfogsub)*glnegshadescale:1)*((float)((unsigned char)(sec->visibility+16))));
}
//Use clamping for tiled sky textures
@ -2746,7 +2747,7 @@ static void polymost_drawalls (long bunch)
{
int i = klabs(sec->ceilingshade);
if(i > 30) i = 30;
bglFogf(GL_FOG_DENSITY,gvisibility/(sec->ceilingshade<0?(fogtable[i]-NEGFOGSUB)*NEGFOGTABLESCALE:1)*(sec->ceilingshade<0?1:fogtable[i]*FOGTABLESCALE)*((float)((unsigned char)(sec->visibility+16))));
bglFogf(GL_FOG_DENSITY,gvisibility/(sec->ceilingshade<0?(fogtable[i]-glnegfogsub)*glnegshadescale:1)*(sec->ceilingshade<0?1:fogtable[i]*glshadescale)*((float)((unsigned char)(sec->visibility+16))));
}
pow2xsplit = 0; domost(x1,cy1,x0,cy0); //ceil
domostpolymethod = 0;
@ -2767,7 +2768,7 @@ static void polymost_drawalls (long bunch)
{
int i = klabs(sec->ceilingshade);
if(i > 30) i = 30;
bglFogf(GL_FOG_DENSITY,0.005*gvisibility/(sec->ceilingshade<0?(fogtable[i]-NEGFOGSUB)*NEGFOGTABLESCALE:1)*((float)((unsigned char)(sec->visibility+16))));
bglFogf(GL_FOG_DENSITY,0.005*gvisibility/(sec->ceilingshade<0?(fogtable[i]-glnegfogsub)*glnegshadescale:1)*((float)((unsigned char)(sec->visibility+16))));
}
//Use clamping for tiled sky textures
@ -3084,7 +3085,7 @@ static void polymost_drawalls (long bunch)
{
int i = klabs(wal->shade);
if(i > 30) i = 30;
bglFogf(GL_FOG_DENSITY,gvisibility/(wal->shade<0?(fogtable[i]-NEGFOGSUB)*NEGFOGTABLESCALE:1)*(wal->shade<0?1:fogtable[i]*FOGTABLESCALE)*((float)((unsigned char)(sec->visibility+16))));
bglFogf(GL_FOG_DENSITY,gvisibility/(wal->shade<0?(fogtable[i]-glnegfogsub)*glnegshadescale:1)*(wal->shade<0?1:fogtable[i]*glshadescale)*((float)((unsigned char)(sec->visibility+16))));
}
pow2xsplit = 1; domost(x1,ocy1,x0,ocy0);
if (wal->cstat&8) { gux = ogux; guy = oguy; guo = oguo; }
@ -3125,7 +3126,7 @@ static void polymost_drawalls (long bunch)
{
int i = klabs(nwal->shade);
if(i > 30) i = 30;
bglFogf(GL_FOG_DENSITY,gvisibility/(nwal->shade<0?(fogtable[i]-NEGFOGSUB)*NEGFOGTABLESCALE:1)*(nwal->shade<0?1:fogtable[i]*FOGTABLESCALE)*((float)((unsigned char)(sec->visibility+16))));
bglFogf(GL_FOG_DENSITY,gvisibility/(nwal->shade<0?(fogtable[i]-glnegfogsub)*glnegshadescale:1)*(nwal->shade<0?1:fogtable[i]*glshadescale)*((float)((unsigned char)(sec->visibility+16))));
}
pow2xsplit = 1; domost(x0,ofy0,x1,ofy1);
if (wal->cstat&(2+8)) { guo = oguo; gux = ogux; guy = oguy; }
@ -3162,7 +3163,7 @@ static void polymost_drawalls (long bunch)
{
int i = klabs(wal->shade);
if(i > 30) i = 30;
bglFogf(GL_FOG_DENSITY,gvisibility/(wal->shade<0?(fogtable[i]-NEGFOGSUB)*NEGFOGTABLESCALE:1)*(wal->shade<0?1:fogtable[i]*FOGTABLESCALE)*((float)((unsigned char)(sec->visibility+16))));
bglFogf(GL_FOG_DENSITY,gvisibility/(wal->shade<0?(fogtable[i]-glnegfogsub)*glnegshadescale:1)*(wal->shade<0?1:fogtable[i]*glshadescale)*((float)((unsigned char)(sec->visibility+16))));
}
pow2xsplit = 1; domost(x0,-10000,x1,-10000);
}
@ -3620,7 +3621,7 @@ if (yp1 < SCISDIST) { t1 = (SCISDIST-oyp0)/(yp1-oyp0); xp1 = (xp1-oxp0)*t1+oxp0;
{
int i = klabs(wal->shade);
if(i > 30) i = 30;
bglFogf(GL_FOG_DENSITY,gvisibility/(wal->shade<0?(fogtable[i]-NEGFOGSUB)*NEGFOGTABLESCALE:1)*(wal->shade<0?1:fogtable[i]*FOGTABLESCALE)*((float)((unsigned char)(sec->visibility+16))));
bglFogf(GL_FOG_DENSITY,gvisibility/(wal->shade<0?(fogtable[i]-glnegfogsub)*glnegshadescale:1)*(wal->shade<0?1:fogtable[i]*glshadescale)*((float)((unsigned char)(sec->visibility+16))));
}
}
}
@ -3733,7 +3734,7 @@ if (tspr->cstat&2) { if (!(tspr->cstat&512)) method = 2+4; else method = 3+4; }
{
int i = klabs(globalshade);
if(i > 30) i = 30;
bglFogf(GL_FOG_DENSITY,gvisibility/(globalshade<0?(fogtable[i]-NEGFOGSUB)*NEGFOGTABLESCALE:1)*(globalshade<0?1:fogtable[i]*SPRFOGTABLESCALE)*((float)((unsigned char)(sector[tspr->sectnum].visibility+16))));
bglFogf(GL_FOG_DENSITY,gvisibility/(globalshade<0?(fogtable[i]-glnegfogsub)*glnegshadescale:1)*(globalshade<0?1:fogtable[i]*glsprshadescale)*((float)((unsigned char)(sector[tspr->sectnum].visibility+16))));
}
}
@ -4825,6 +4826,40 @@ static int osdcmd_polymostvars(const osdfuncparm_t *parm)
else glnvmultisamplehint = (val != 0);
return OSDCMD_OK;
}
else if (!Bstrcasecmp(parm->name, "r_shadescale")) {
if (showval) { OSD_Printf("r_shadescale is %g\n", glshadescale); }
else {
float val;
char value[256];
Bstrcpy(value,parm->parms[0]);
val = atof(value);
glshadescale = val;
}
return OSDCMD_OK;
}
else if (!Bstrcasecmp(parm->name, "r_sprshadescale")) {
if (showval) { OSD_Printf("r_sprshadescale is %g\n", glsprshadescale); }
else {
float val;
char value[256];
Bstrcpy(value,parm->parms[0]);
val = atof(value);
glsprshadescale = val;
}
return OSDCMD_OK;
}
else if (!Bstrcasecmp(parm->name, "r_negshadescale")) {
if (showval) { OSD_Printf("r_negshadescale is %g\n", glnegshadescale); }
else {
float val;
char value[256];
Bstrcpy(value,parm->parms[0]);
val = atof(value);
glnegshadescale = val;
}
return OSDCMD_OK;
}
#endif
return OSDCMD_SHOWHELP;
}
@ -4872,6 +4907,9 @@ void polymost_initosdfuncs(void)
OSD_RegisterFunction("glusetexcachecompression","usetexcachecompression: enable/disable compression of files in the OpenGL compressed texture cache",osdcmd_polymostvars);
OSD_RegisterFunction("glmultisample","glmultisample: sets the number of samples used for antialiasing (0 = off)",osdcmd_polymostvars);
OSD_RegisterFunction("glnvmultisamplehint","glnvmultisamplehint: enable/disable Nvidia multisampling hinting",osdcmd_polymostvars);
OSD_RegisterFunction("r_shadescale","r_shadescale: multiplier for lighting on shade >= 0 surfaces",osdcmd_polymostvars);
OSD_RegisterFunction("r_sprshadescale","r_sprshadescale: multiplier for sprite lighting",osdcmd_polymostvars);
OSD_RegisterFunction("r_negshadescale","r_negshadescale: multiplier for lighting on shade < 0 surfaces",osdcmd_polymostvars);
#endif
OSD_RegisterFunction("usemodels","usemodels: enable/disable model rendering in >8-bit mode",osdcmd_polymostvars);
OSD_RegisterFunction("usehightile","usehightile: enable/disable hightile texture rendering in >8-bit mode",osdcmd_polymostvars);