More polymost shading stuff

git-svn-id: https://svn.eduke32.com/eduke32@206 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2006-07-04 00:46:24 +00:00
parent 55fd4337b8
commit a99b97689e
12 changed files with 160 additions and 159 deletions

View file

@ -35,7 +35,7 @@ FMODROOTWIN=c:/sdks/fmodapi374win/api
# build locations - OBJ gets overridden to the game-specific objects dir # build locations - OBJ gets overridden to the game-specific objects dir
OBJ?=obj.gnu/ OBJ?=obj.gnu/
SRC=src/ SRC=src/
GAME=game/ GAME=testgame/
RSRC=rsrc/ RSRC=rsrc/
INC=include/ INC=include/

View file

@ -83,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 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 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 DEPTHDEBUG 0 //1:render distance instead of texture, for debugging only!, 0:default
#define FOGSCALE 0.0000896 #define FOGSCALE 0.0000820
#define PI 3.14159265358979323 #define PI 3.14159265358979323
static double gyxscale, gxyaspect, gviewxrange, ghalfx, grhalfxdown10, grhalfxdown10x, ghoriz; static double gyxscale, gxyaspect, gviewxrange, ghalfx, grhalfxdown10, grhalfxdown10x, ghoriz;
@ -2208,7 +2208,7 @@ static void polymost_drawalls (long bunch)
col[2] = (float)palookupfog[sec->floorpal].b / 63.f; col[2] = (float)palookupfog[sec->floorpal].b / 63.f;
col[3] = 0; col[3] = 0;
bglFogfv(GL_FOG_COLOR,col); bglFogfv(GL_FOG_COLOR,col);
bglFogf(GL_FOG_DENSITY,(gvisibility*((float)((unsigned char)(sec->visibility+16))))/(sec->floorshade<0?klabs(sec->floorshade):1)-(sec->floorshade>0?2/sec->floorshade:0)); bglFogf(GL_FOG_DENSITY,gvisibility*((float)((unsigned char)(sec->visibility+16))));
// bglFogf(GL_FOG_DENSITY,gvisibility*((float)((unsigned char)(sec->visibility+16)))); // bglFogf(GL_FOG_DENSITY,gvisibility*((float)((unsigned char)(sec->visibility+16))));
} }
@ -2368,7 +2368,10 @@ static void polymost_drawalls (long bunch)
} }
domostpolymethod = (globalorientation>>7)&3; domostpolymethod = (globalorientation>>7)&3;
if (globalposz >= getflorzofslope(sectnum,globalposx,globalposy)) domostpolymethod = -1; //Back-face culling if (globalposz >= getflorzofslope(sectnum,globalposx,globalposy)) domostpolymethod = -1; //Back-face culling
bglGetFloatv(GL_FOG_DENSITY,&foggymcfogfogger);
bglFogf(GL_FOG_DENSITY,((gvisibility*((float)((unsigned char)(sec->visibility+16))))/(sec->floorshade<0?klabs(sec->floorshade):1))-(sec->floorshade>0?3/sec->floorshade:0)+(sec->floorshade==1?2.5:0)+(sec->floorshade==-1?-1:0));
pow2xsplit = 0; domost(x0,fy0,x1,fy1); //flor pow2xsplit = 0; domost(x0,fy0,x1,fy1); //flor
bglFogf(GL_FOG_DENSITY,foggymcfogfogger);
domostpolymethod = 0; domostpolymethod = 0;
} }
else if ((nextsectnum < 0) || (!(sector[nextsectnum].floorstat&1))) else if ((nextsectnum < 0) || (!(sector[nextsectnum].floorstat&1)))
@ -2721,7 +2724,10 @@ static void polymost_drawalls (long bunch)
} }
domostpolymethod = (globalorientation>>7)&3; domostpolymethod = (globalorientation>>7)&3;
if (globalposz <= getceilzofslope(sectnum,globalposx,globalposy)) domostpolymethod = -1; //Back-face culling if (globalposz <= getceilzofslope(sectnum,globalposx,globalposy)) domostpolymethod = -1; //Back-face culling
bglGetFloatv(GL_FOG_DENSITY,&foggymcfogfogger);
bglFogf(GL_FOG_DENSITY,((gvisibility*((float)((unsigned char)(sec->visibility+16))))/(sec->ceilingshade<0?klabs(sec->ceilingshade):1))-(sec->ceilingshade>0?3/sec->ceilingshade:0)+(sec->ceilingshade==1?2.5:0)+(sec->ceilingshade==-1?-1:0));
pow2xsplit = 0; domost(x1,cy1,x0,cy0); //ceil pow2xsplit = 0; domost(x1,cy1,x0,cy0); //ceil
bglFogf(GL_FOG_DENSITY,foggymcfogfogger);
domostpolymethod = 0; domostpolymethod = 0;
} }
else if ((nextsectnum < 0) || (!(sector[nextsectnum].ceilingstat&1))) else if ((nextsectnum < 0) || (!(sector[nextsectnum].ceilingstat&1)))
@ -3048,7 +3054,7 @@ static void polymost_drawalls (long bunch)
{ {
bglGetFloatv(GL_FOG_DENSITY,&foggymcfogfogger); bglGetFloatv(GL_FOG_DENSITY,&foggymcfogfogger);
bglFogf(GL_FOG_DENSITY,(gvisibility*((float)((unsigned char)(sec->visibility+16))))/(wal->shade<0?klabs(wal->shade):1)-(wal->shade>0?2/wal->shade:0)); bglFogf(GL_FOG_DENSITY,((gvisibility*((float)((unsigned char)(sec->visibility+16))))/(wal->shade<0?klabs(wal->shade):1))-(wal->shade>0?3/wal->shade:0)+(wal->shade==1?2.5:0)+(wal->shade==-1?-1:0));
pow2xsplit = 1; domost(x1,ocy1,x0,ocy0); pow2xsplit = 1; domost(x1,ocy1,x0,ocy0);
bglFogf(GL_FOG_DENSITY,foggymcfogfogger); bglFogf(GL_FOG_DENSITY,foggymcfogfogger);
} }
@ -3089,7 +3095,7 @@ static void polymost_drawalls (long bunch)
{ {
bglGetFloatv(GL_FOG_DENSITY,&foggymcfogfogger); bglGetFloatv(GL_FOG_DENSITY,&foggymcfogfogger);
bglFogf(GL_FOG_DENSITY,(gvisibility*((float)((unsigned char)(sec->visibility+16))))/(nwal->shade<0?klabs(nwal->shade):1)-(nwal->shade>0?2/nwal->shade:0)); bglFogf(GL_FOG_DENSITY,((gvisibility*((float)((unsigned char)(sec->visibility+16))))/(nwal->shade<0?klabs(nwal->shade):1))-(nwal->shade>0?3/nwal->shade:0)+(nwal->shade==1?2.5:0)+(nwal->shade==-1?-1:0));
pow2xsplit = 1; domost(x0,ofy0,x1,ofy1); pow2xsplit = 1; domost(x0,ofy0,x1,ofy1);
bglFogf(GL_FOG_DENSITY,foggymcfogfogger); bglFogf(GL_FOG_DENSITY,foggymcfogfogger);
} }
@ -3126,7 +3132,7 @@ static void polymost_drawalls (long bunch)
{ {
bglGetFloatv(GL_FOG_DENSITY,&foggymcfogfogger); bglGetFloatv(GL_FOG_DENSITY,&foggymcfogfogger);
bglFogf(GL_FOG_DENSITY,(gvisibility*((float)((unsigned char)(sec->visibility+16))))/(wal->shade<0?klabs(wal->shade):1)-(wal->shade>0?2/wal->shade:0)); bglFogf(GL_FOG_DENSITY,((gvisibility*((float)((unsigned char)(sec->visibility+16))))/(wal->shade<0?klabs(wal->shade):1))-(wal->shade>0?3/wal->shade:0)+(wal->shade==1?2.5:0)+(wal->shade==-1?-1:0));
pow2xsplit = 1; domost(x0,-10000,x1,-10000); pow2xsplit = 1; domost(x0,-10000,x1,-10000);
bglFogf(GL_FOG_DENSITY,foggymcfogfogger); bglFogf(GL_FOG_DENSITY,foggymcfogfogger);
} }
@ -3580,7 +3586,7 @@ if (yp1 < SCISDIST) { t1 = (SCISDIST-oyp0)/(yp1-oyp0); xp1 = (xp1-oxp0)*t1+oxp0;
col[2] = (float)palookupfog[sec->floorpal].b / 63.f; col[2] = (float)palookupfog[sec->floorpal].b / 63.f;
col[3] = 0; col[3] = 0;
bglFogfv(GL_FOG_COLOR,col); bglFogfv(GL_FOG_COLOR,col);
bglFogf(GL_FOG_DENSITY,gvisibility*((float)((unsigned char)(sec->visibility+16)))); bglFogf(GL_FOG_DENSITY,((gvisibility*((float)((unsigned char)(sec->visibility+16))))/(wal->shade<0?klabs(wal->shade):1))-(wal->shade>0?3/wal->shade:0)+(wal->shade==1?2.5:0)+(wal->shade==-1?-1:0));
} }
} }
#endif #endif
@ -3687,7 +3693,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[2] = (float)palookupfog[sector[tspr->sectnum].floorpal].b / 63.f;
col[3] = 0; col[3] = 0;
bglFogfv(GL_FOG_COLOR,col); //default is 0,0,0,0 bglFogfv(GL_FOG_COLOR,col); //default is 0,0,0,0
bglFogf(GL_FOG_DENSITY,(gvisibility*((float)((unsigned char)(sector[tspr->sectnum].visibility+16))))/(globalshade<0?klabs(globalshade):1)-(globalshade>0?2/globalshade:0)); bglFogf(GL_FOG_DENSITY,((gvisibility*0.65*((float)((unsigned char)(sector[tspr->sectnum].visibility+16))))/(globalshade<0?klabs(globalshade):1))-(globalshade>0?3/globalshade:0)+(globalshade==1?2.5:0)+(globalshade==-1?-1:0));
} }
while (rendmode == 3 && !(spriteext[tspr->owner].flags&SPREXT_NOTMD)) { while (rendmode == 3 && !(spriteext[tspr->owner].flags&SPREXT_NOTMD)) {

View file

@ -1831,45 +1831,6 @@ void Keys3d(void)
keystatus[KEYSC_L] = 0; keystatus[KEYSC_L] = 0;
} }
if ((keystatus[KEYSC_G] > 0)) // G
{
switch (searchstat)
{
case 0:
strcpy(tempbuf,"Wall picnum: ");
i = getnumber256(tempbuf,wall[searchwall].picnum,MAXTILES-1,0);
if(tilesizx[i] != 0)
wall[searchwall].picnum = i;
break;
case 1:
strcpy(tempbuf,"Sector ceiling picnum: ");
i = getnumber256(tempbuf,sector[searchsector].ceilingpicnum,MAXTILES-1,0);
if(tilesizx[i] != 0)
sector[searchsector].ceilingpicnum = i;
break;
case 2:
strcpy(tempbuf,"Sector floor picnum: ");
i = getnumber256(tempbuf,sector[searchsector].floorpicnum,MAXTILES-1,0);
if(tilesizx[i] != 0)
sector[searchsector].floorpicnum = i;
break;
case 3:
strcpy(tempbuf,"Sprite picnum: ");
i = getnumber256(tempbuf,sprite[searchwall].picnum,MAXTILES-1,0);
if(tilesizx[i] != 0)
sprite[searchwall].picnum = i;
break;
case 4:
strcpy(tempbuf,"Masked wall picnum: ");
i = getnumber256(tempbuf,wall[searchwall].overpicnum,MAXTILES-1,0);
if(tilesizx[i] != 0)
wall[searchwall].overpicnum = i;
break;
}
asksave = 1;
keystatus[KEYSC_G] = 0;
}
getzrange(posx,posy,posz,cursectnum,&hiz,&hihit,&loz,&lohit,128L,CLIPMASK0); getzrange(posx,posy,posz,cursectnum,&hiz,&hihit,&loz,&lohit,128L,CLIPMASK0);
if (keystatus[KEYSC_CAPS] > 0) if (keystatus[KEYSC_CAPS] > 0)
@ -1883,118 +1844,6 @@ void Keys3d(void)
keystatus[KEYSC_CAPS] = 0; keystatus[KEYSC_CAPS] = 0;
} }
if (keystatus[KEYSC_B] > 0) // B (clip Blocking xor) (3D)
{
if (searchstat == 3)
{
sprite[searchwall].cstat ^= 1;
// sprite[searchwall].cstat &= ~256;
// sprite[searchwall].cstat |= ((sprite[searchwall].cstat&1)<<8);
sprintf(getmessage,"Sprite (%d) blocking %s",searchwall,sprite[searchwall].cstat&1?"ON":"OFF");
message(getmessage);
asksave = 1;
}
else
{
wall[searchwall].cstat ^= 1;
// wall[searchwall].cstat &= ~64;
if ((wall[searchwall].nextwall >= 0) && ((keystatus[0x2a]|keystatus[0x36]) == 0))
{
wall[wall[searchwall].nextwall].cstat &= ~(1+64);
wall[wall[searchwall].nextwall].cstat |= (wall[searchwall].cstat&1);
}
sprintf(getmessage,"Wall (%d) blocking %s",searchwall,wall[searchwall].cstat&1?"ON":"OFF");
message(getmessage);
asksave = 1;
}
keystatus[KEYSC_B] = 0;
}
if (keystatus[KEYSC_T] > 0) // T (transluscence for sprites/masked walls)
{
if (searchstat == 1) //Set masked/transluscent ceilings/floors
{
i = (sector[searchsector].ceilingstat&(128+256));
sector[searchsector].ceilingstat &= ~(128+256);
switch(i)
{
case 0: sector[searchsector].ceilingstat |= 128; break;
case 128: sector[searchsector].ceilingstat |= 256; break;
case 256: sector[searchsector].ceilingstat |= 384; break;
case 384: sector[searchsector].ceilingstat |= 0; break;
}
asksave = 1;
}
if (searchstat == 2)
{
i = (sector[searchsector].floorstat&(128+256));
sector[searchsector].floorstat &= ~(128+256);
switch(i)
{
case 0: sector[searchsector].floorstat |= 128; break;
case 128: sector[searchsector].floorstat |= 256; break;
case 256: sector[searchsector].floorstat |= 384; break;
case 384: sector[searchsector].floorstat |= 0; break;
}
asksave = 1;
}
if ((keystatus[KEYSC_QUOTE]) > 0)
{
switch (searchstat)
{
case 0: case 4:
strcpy(buffer,"Wall lotag: ");
wall[searchwall].lotag = getnumber256(buffer,(long)wall[searchwall].lotag,65536L,0);
break;
case 1:
strcpy(buffer,"Sector lotag: ");
sector[searchsector].lotag = getnumber256(buffer,(long)sector[searchsector].lotag,65536L,0);
break;
case 2:
strcpy(buffer,"Sector lotag: ");
sector[searchsector].lotag = getnumber256(buffer,(long)sector[searchsector].lotag,65536L,0);
break;
case 3:
strcpy(buffer,"Sprite lotag: ");
sprite[searchwall].lotag = getnumber256(buffer,(long)sprite[searchwall].lotag,65536L,0);
break;
}
}
else
{
if (searchstat == 3)
{
if ((sprite[searchwall].cstat&2) == 0)
sprite[searchwall].cstat |= 2;
else if ((sprite[searchwall].cstat&512) == 0)
sprite[searchwall].cstat |= 512;
else
sprite[searchwall].cstat &= ~(2+512);
asksave = 1;
}
if (searchstat == 4)
{
if ((wall[searchwall].cstat&128) == 0)
wall[searchwall].cstat |= 128;
else if ((wall[searchwall].cstat&512) == 0)
wall[searchwall].cstat |= 512;
else
wall[searchwall].cstat &= ~(128+512);
if (wall[searchwall].nextwall >= 0)
{
wall[wall[searchwall].nextwall].cstat &= ~(128+512);
wall[wall[searchwall].nextwall].cstat |= (wall[searchwall].cstat&(128+512));
}
asksave = 1;
}
}
keystatus[KEYSC_T] = 0;
}
if (keystatus[KEYSC_M] > 0 && (keystatus[KEYSC_QUOTE]) > 0) // M if (keystatus[KEYSC_M] > 0 && (keystatus[KEYSC_QUOTE]) > 0) // M
{ {
switch (searchstat) switch (searchstat)
@ -3269,8 +3118,154 @@ void Keys3d(void)
keystatus[0x3b]=0; keystatus[0x3b]=0;
} }
if ((keystatus[KEYSC_G] > 0)) // G
{
switch (searchstat)
{
case 0:
strcpy(tempbuf,"Wall picnum: ");
i = getnumber256(tempbuf,wall[searchwall].picnum,MAXTILES-1,0);
if(tilesizx[i] != 0)
wall[searchwall].picnum = i;
break;
case 1:
strcpy(tempbuf,"Sector ceiling picnum: ");
i = getnumber256(tempbuf,sector[searchsector].ceilingpicnum,MAXTILES-1,0);
if(tilesizx[i] != 0)
sector[searchsector].ceilingpicnum = i;
break;
case 2:
strcpy(tempbuf,"Sector floor picnum: ");
i = getnumber256(tempbuf,sector[searchsector].floorpicnum,MAXTILES-1,0);
if(tilesizx[i] != 0)
sector[searchsector].floorpicnum = i;
break;
case 3:
strcpy(tempbuf,"Sprite picnum: ");
i = getnumber256(tempbuf,sprite[searchwall].picnum,MAXTILES-1,0);
if(tilesizx[i] != 0)
sprite[searchwall].picnum = i;
break;
case 4:
strcpy(tempbuf,"Masked wall picnum: ");
i = getnumber256(tempbuf,wall[searchwall].overpicnum,MAXTILES-1,0);
if(tilesizx[i] != 0)
wall[searchwall].overpicnum = i;
break;
}
asksave = 1;
keystatus[KEYSC_G] = 0;
}
if (keystatus[KEYSC_B] > 0) // B (clip Blocking xor) (3D)
{
if (searchstat == 3)
{
sprite[searchwall].cstat ^= 1;
// sprite[searchwall].cstat &= ~256;
// sprite[searchwall].cstat |= ((sprite[searchwall].cstat&1)<<8);
sprintf(getmessage,"Sprite (%d) blocking %s",searchwall,sprite[searchwall].cstat&1?"ON":"OFF");
message(getmessage);
asksave = 1;
}
else
{
wall[searchwall].cstat ^= 1;
// wall[searchwall].cstat &= ~64;
if ((wall[searchwall].nextwall >= 0) && ((keystatus[0x2a]|keystatus[0x36]) == 0))
{
wall[wall[searchwall].nextwall].cstat &= ~(1+64);
wall[wall[searchwall].nextwall].cstat |= (wall[searchwall].cstat&1);
}
sprintf(getmessage,"Wall (%d) blocking %s",searchwall,wall[searchwall].cstat&1?"ON":"OFF");
message(getmessage);
asksave = 1;
}
keystatus[KEYSC_B] = 0;
}
if (keystatus[KEYSC_T] > 0) // T (transluscence for sprites/masked walls)
{
if (searchstat == 1) //Set masked/transluscent ceilings/floors
{
i = (sector[searchsector].ceilingstat&(128+256));
sector[searchsector].ceilingstat &= ~(128+256);
switch(i)
{
case 0: sector[searchsector].ceilingstat |= 128; break;
case 128: sector[searchsector].ceilingstat |= 256; break;
case 256: sector[searchsector].ceilingstat |= 384; break;
case 384: sector[searchsector].ceilingstat |= 0; break;
}
asksave = 1;
}
if (searchstat == 2)
{
i = (sector[searchsector].floorstat&(128+256));
sector[searchsector].floorstat &= ~(128+256);
switch(i)
{
case 0: sector[searchsector].floorstat |= 128; break;
case 128: sector[searchsector].floorstat |= 256; break;
case 256: sector[searchsector].floorstat |= 384; break;
case 384: sector[searchsector].floorstat |= 0; break;
}
asksave = 1;
}
if ((keystatus[KEYSC_QUOTE]) > 0)
{
switch (searchstat)
{
case 0: case 4:
strcpy(buffer,"Wall lotag: ");
wall[searchwall].lotag = getnumber256(buffer,(long)wall[searchwall].lotag,65536L,0);
break;
case 1:
strcpy(buffer,"Sector lotag: ");
sector[searchsector].lotag = getnumber256(buffer,(long)sector[searchsector].lotag,65536L,0);
break;
case 2:
strcpy(buffer,"Sector lotag: ");
sector[searchsector].lotag = getnumber256(buffer,(long)sector[searchsector].lotag,65536L,0);
break;
case 3:
strcpy(buffer,"Sprite lotag: ");
sprite[searchwall].lotag = getnumber256(buffer,(long)sprite[searchwall].lotag,65536L,0);
break;
}
}
else
{
if (searchstat == 3)
{
if ((sprite[searchwall].cstat&2) == 0)
sprite[searchwall].cstat |= 2;
else if ((sprite[searchwall].cstat&512) == 0)
sprite[searchwall].cstat |= 512;
else
sprite[searchwall].cstat &= ~(2+512);
asksave = 1;
}
if (searchstat == 4)
{
if ((wall[searchwall].cstat&128) == 0)
wall[searchwall].cstat |= 128;
else if ((wall[searchwall].cstat&512) == 0)
wall[searchwall].cstat |= 512;
else
wall[searchwall].cstat &= ~(128+512);
if (wall[searchwall].nextwall >= 0)
{
wall[wall[searchwall].nextwall].cstat &= ~(128+512);
wall[wall[searchwall].nextwall].cstat |= (wall[searchwall].cstat&(128+512));
}
asksave = 1;
}
}
keystatus[KEYSC_T] = 0;
}
if(keystatus[KEYSC_QUOTE]==1 && keystatus[0x1c]==1) // ' ENTER if(keystatus[KEYSC_QUOTE]==1 && keystatus[0x1c]==1) // ' ENTER
{ {