def file control over shading harshness

git-svn-id: https://svn.eduke32.com/eduke32@224 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2006-07-20 01:50:56 +00:00
parent ece23acfc6
commit dd82035120
2 changed files with 75 additions and 15 deletions

View file

@ -61,7 +61,8 @@ enum {
T_SPRITECOL,T_2DCOL, T_SPRITECOL,T_2DCOL,
T_FOGPAL, T_FOGPAL,
T_LOADGRP, T_LOADGRP,
T_DUMMYTILE,T_DUMMYTILERANGE T_DUMMYTILE,T_DUMMYTILERANGE,
T_NEGSHADEOFFSET, T_NEGSHADESCALE, T_SHADESCALE, T_SPRSHADESCALE
}; };
typedef struct { char *text; int tokenid; } tokenlist; typedef struct { char *text; int tokenid; } tokenlist;
@ -107,6 +108,10 @@ static tokenlist basetokens[] =
{ "loadgrp", T_LOADGRP }, { "loadgrp", T_LOADGRP },
{ "dummytile", T_DUMMYTILE }, { "dummytile", T_DUMMYTILE },
{ "dummytilerange", T_DUMMYTILERANGE }, { "dummytilerange", T_DUMMYTILERANGE },
{ "glnegshadeoffset",T_NEGSHADEOFFSET },
{ "glnegshadescale", T_NEGSHADESCALE },
{ "glshadescale", T_SHADESCALE },
{ "glsprshadescale", T_SPRSHADESCALE },
}; };
static tokenlist modeltokens[] = { static tokenlist modeltokens[] = {
@ -306,6 +311,50 @@ static int defsparser(scriptfile *script)
hicsetpalettetint(pal,r,g,b,f); hicsetpalettetint(pal,r,g,b,f);
} }
break; break;
case T_NEGSHADEOFFSET:
{
double val;
extern float glnegshadeoffset;
if (scriptfile_getdouble(script,&val)) break;
#if defined(POLYMOST) && defined(USE_OPENGL)
glnegshadeoffset = val;
#endif
}
break;
case T_NEGSHADESCALE:
{
double val;
extern float glnegshadescale;
if (scriptfile_getdouble(script,&val)) break;
#if defined(POLYMOST) && defined(USE_OPENGL)
glnegshadescale = val;
#endif
}
break;
case T_SHADESCALE:
{
double val;
extern float glshadescale;
if (scriptfile_getdouble(script,&val)) break;
#if defined(POLYMOST) && defined(USE_OPENGL)
glshadescale = val;
#endif
}
break;
case T_SPRSHADESCALE:
{
double val;
extern float glsprshadescale;
if (scriptfile_getdouble(script,&val)) break;
#if defined(POLYMOST) && defined(USE_OPENGL)
glsprshadescale = val;
#endif
}
break;
case T_ALPHAHACK: case T_ALPHAHACK:
{ {
int tile; int tile;

View file

@ -69,13 +69,13 @@ static long animateoffs(short tilenum, short fakevar);
long rendmode = 0; long rendmode = 0;
long usemodels=1, usehightile=1; long usemodels=1, usehightile=1;
// float fogtable[] = { 0.165, 0.198, 0.231, 0.264, 0.297, 0.330, 0.363, 0.396, 0.429, 0.462, 0.495, 0.528, 0.561, 0.594, 0.627, 0.660, 0.693, 0.726, 0.759, 0.792, 0.825, 0.858, 0.891, 0.924, 0.957, 1.023, 1.056, 1.089, 1.122, 1.155, 1.188, 1.221 }; // float shadetable[] = { 0.165, 0.198, 0.231, 0.264, 0.297, 0.330, 0.363, 0.396, 0.429, 0.462, 0.495, 0.528, 0.561, 0.594, 0.627, 0.660, 0.693, 0.726, 0.759, 0.792, 0.825, 0.858, 0.891, 0.924, 0.957, 1.023, 1.056, 1.089, 1.122, 1.155, 1.188, 1.221 };
// float fogtable[] = { 0.175, 0.200, 0.225, 0.250, 0.275, 0.300, 0.325, 0.350, 0.375, 0.400, 0.425, 0.450, 0.475, 0.500, 0.525, 0.550, 0.575, 0.600, 0.625, 0.650, 0.675, 0.700, 0.725, 0.750, 0.775, 0.800, 0.825, 0.850, 0.875, 0.900, 0.925, 0.950 }; // float shadetable[] = { 0.175, 0.200, 0.225, 0.250, 0.275, 0.300, 0.325, 0.350, 0.375, 0.400, 0.425, 0.450, 0.475, 0.500, 0.525, 0.550, 0.575, 0.600, 0.625, 0.650, 0.675, 0.700, 0.725, 0.750, 0.775, 0.800, 0.825, 0.850, 0.875, 0.900, 0.925, 0.950 };
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 }; float shadetable[] = { 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 };
float glnegfogsub = 0.075; float glnegshadeoffset = 0.075;
float glnegshadescale = 8.300; float glnegshadescale = 8.300;
float glshadescale = 1.900; float glshadescale = 1.900;
@ -2381,7 +2381,7 @@ static void polymost_drawalls (long bunch)
{ {
int i = klabs(sec->floorshade); int i = klabs(sec->floorshade);
if(i > 30) i = 30; if(i > 30) i = 30;
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<240?sec->visibility+16:sec->visibility-240)))); bglFogf(GL_FOG_DENSITY,gvisibility/(sec->floorshade<0?(shadetable[i]-glnegshadeoffset)*glnegshadescale:1)*(sec->floorshade<0?1:shadetable[i]*glshadescale)*((float)((unsigned char)(sec->visibility<240?sec->visibility+16:sec->visibility-240))));
} }
pow2xsplit = 0; domost(x0,fy0,x1,fy1); //flor pow2xsplit = 0; domost(x0,fy0,x1,fy1); //flor
domostpolymethod = 0; domostpolymethod = 0;
@ -2403,7 +2403,7 @@ static void polymost_drawalls (long bunch)
{ {
int i = klabs(sec->floorshade); int i = klabs(sec->floorshade);
if(i > 30) i = 30; if(i > 30) i = 30;
bglFogf(GL_FOG_DENSITY,0.005*gvisibility/(sec->floorshade<0?(fogtable[i]-glnegfogsub)*glnegshadescale:1)*((float)((unsigned char)(sec->visibility<240?sec->visibility+16:sec->visibility-240)))); bglFogf(GL_FOG_DENSITY,0.005*gvisibility/(sec->floorshade<0?(shadetable[i]-glnegshadeoffset)*glnegshadescale:1)*((float)((unsigned char)(sec->visibility<240?sec->visibility+16:sec->visibility-240))));
} }
//Use clamping for tiled sky textures //Use clamping for tiled sky textures
@ -2747,7 +2747,7 @@ static void polymost_drawalls (long bunch)
{ {
int i = klabs(sec->ceilingshade); int i = klabs(sec->ceilingshade);
if(i > 30) i = 30; if(i > 30) i = 30;
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<240?sec->visibility+16:sec->visibility-240)))); bglFogf(GL_FOG_DENSITY,gvisibility/(sec->ceilingshade<0?(shadetable[i]-glnegshadeoffset)*glnegshadescale:1)*(sec->ceilingshade<0?1:shadetable[i]*glshadescale)*((float)((unsigned char)(sec->visibility<240?sec->visibility+16:sec->visibility-240))));
} }
pow2xsplit = 0; domost(x1,cy1,x0,cy0); //ceil pow2xsplit = 0; domost(x1,cy1,x0,cy0); //ceil
domostpolymethod = 0; domostpolymethod = 0;
@ -2768,7 +2768,7 @@ static void polymost_drawalls (long bunch)
{ {
int i = klabs(sec->ceilingshade); int i = klabs(sec->ceilingshade);
if(i > 30) i = 30; if(i > 30) i = 30;
bglFogf(GL_FOG_DENSITY,0.005*gvisibility/(sec->ceilingshade<0?(fogtable[i]-glnegfogsub)*glnegshadescale:1)*((float)((unsigned char)(sec->visibility<240?sec->visibility+16:sec->visibility-240)))); bglFogf(GL_FOG_DENSITY,0.005*gvisibility/(sec->ceilingshade<0?(shadetable[i]-glnegshadeoffset)*glnegshadescale:1)*((float)((unsigned char)(sec->visibility<240?sec->visibility+16:sec->visibility-240))));
} }
//Use clamping for tiled sky textures //Use clamping for tiled sky textures
@ -3085,7 +3085,7 @@ static void polymost_drawalls (long bunch)
{ {
int i = klabs(wal->shade); int i = klabs(wal->shade);
if(i > 30) i = 30; if(i > 30) i = 30;
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<240?sec->visibility+16:sec->visibility-240)))); bglFogf(GL_FOG_DENSITY,gvisibility/(wal->shade<0?(shadetable[i]-glnegshadeoffset)*glnegshadescale:1)*(wal->shade<0?1:shadetable[i]*glshadescale)*((float)((unsigned char)(sec->visibility<240?sec->visibility+16:sec->visibility-240))));
} }
pow2xsplit = 1; domost(x1,ocy1,x0,ocy0); pow2xsplit = 1; domost(x1,ocy1,x0,ocy0);
if (wal->cstat&8) { gux = ogux; guy = oguy; guo = oguo; } if (wal->cstat&8) { gux = ogux; guy = oguy; guo = oguo; }
@ -3126,7 +3126,7 @@ static void polymost_drawalls (long bunch)
{ {
int i = klabs(nwal->shade); int i = klabs(nwal->shade);
if(i > 30) i = 30; if(i > 30) i = 30;
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<240?sec->visibility+16:sec->visibility-240)))); bglFogf(GL_FOG_DENSITY,gvisibility/(nwal->shade<0?(shadetable[i]-glnegshadeoffset)*glnegshadescale:1)*(nwal->shade<0?1:shadetable[i]*glshadescale)*((float)((unsigned char)(sec->visibility<240?sec->visibility+16:sec->visibility-240))));
} }
pow2xsplit = 1; domost(x0,ofy0,x1,ofy1); pow2xsplit = 1; domost(x0,ofy0,x1,ofy1);
if (wal->cstat&(2+8)) { guo = oguo; gux = ogux; guy = oguy; } if (wal->cstat&(2+8)) { guo = oguo; gux = ogux; guy = oguy; }
@ -3163,7 +3163,7 @@ static void polymost_drawalls (long bunch)
{ {
int i = klabs(wal->shade); int i = klabs(wal->shade);
if(i > 30) i = 30; if(i > 30) i = 30;
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<240?sec->visibility+16:sec->visibility-240)))); bglFogf(GL_FOG_DENSITY,gvisibility/(wal->shade<0?(shadetable[i]-glnegshadeoffset)*glnegshadescale:1)*(wal->shade<0?1:shadetable[i]*glshadescale)*((float)((unsigned char)(sec->visibility<240?sec->visibility+16:sec->visibility-240))));
} }
pow2xsplit = 1; domost(x0,-10000,x1,-10000); pow2xsplit = 1; domost(x0,-10000,x1,-10000);
} }
@ -3621,7 +3621,7 @@ if (yp1 < SCISDIST) { t1 = (SCISDIST-oyp0)/(yp1-oyp0); xp1 = (xp1-oxp0)*t1+oxp0;
{ {
int i = klabs(wal->shade); int i = klabs(wal->shade);
if(i > 30) i = 30; if(i > 30) i = 30;
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<240?sec->visibility+16:sec->visibility-240)))); bglFogf(GL_FOG_DENSITY,gvisibility/(wal->shade<0?(shadetable[i]-glnegshadeoffset)*glnegshadescale:1)*(wal->shade<0?1:shadetable[i]*glshadescale)*((float)((unsigned char)(sec->visibility<240?sec->visibility+16:sec->visibility-240))));
} }
} }
} }
@ -3734,7 +3734,7 @@ if (tspr->cstat&2) { if (!(tspr->cstat&512)) method = 2+4; else method = 3+4; }
{ {
int i = klabs(globalshade); int i = klabs(globalshade);
if(i > 30) i = 30; if(i > 30) i = 30;
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<240?sector[tspr->sectnum].visibility+16:sector[tspr->sectnum].visibility-240)))); bglFogf(GL_FOG_DENSITY,gvisibility/(globalshade<0?(shadetable[i]-glnegshadeoffset)*glnegshadescale:1)*(globalshade<0?1:shadetable[i]*glsprshadescale)*((float)((unsigned char)(sector[tspr->sectnum].visibility<240?sector[tspr->sectnum].visibility+16:sector[tspr->sectnum].visibility-240))));
} }
} }
@ -4859,7 +4859,17 @@ static int osdcmd_polymostvars(const osdfuncparm_t *parm)
} }
return OSDCMD_OK; return OSDCMD_OK;
} }
else if (!Bstrcasecmp(parm->name, "r_negshadeoffset")) {
if (showval) { OSD_Printf("r_negshadeoffset is %g\n", glnegshadeoffset); }
else {
float val;
char value[256];
Bstrcpy(value,parm->parms[0]);
val = atof(value);
glnegshadeoffset = val;
}
return OSDCMD_OK;
}
#endif #endif
return OSDCMD_SHOWHELP; return OSDCMD_SHOWHELP;
} }
@ -4910,6 +4920,7 @@ void polymost_initosdfuncs(void)
OSD_RegisterFunction("r_shadescale","r_shadescale: multiplier for lighting on shade >= 0 surfaces",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_sprshadescale","r_sprshadescale: multiplier for sprite lighting",osdcmd_polymostvars);
OSD_RegisterFunction("r_negshadescale","r_negshadescale: multiplier for lighting on shade < 0 surfaces",osdcmd_polymostvars); OSD_RegisterFunction("r_negshadescale","r_negshadescale: multiplier for lighting on shade < 0 surfaces",osdcmd_polymostvars);
OSD_RegisterFunction("r_negshadeoffset","r_negshadeoffset: offset for lighting on shade < 0 surfaces",osdcmd_polymostvars);
#endif #endif
OSD_RegisterFunction("usemodels","usemodels: enable/disable model rendering in >8-bit mode",osdcmd_polymostvars); 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); OSD_RegisterFunction("usehightile","usehightile: enable/disable hightile texture rendering in >8-bit mode",osdcmd_polymostvars);