Model flipping, centering, floor-alignment, color, maphacks.

Next is CON model rotation.

git-svn-id: https://svn.eduke32.com/eduke32@774 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
plagman 2008-06-06 11:35:24 +00:00
parent 3ad3dfc9be
commit c29194cce9
4 changed files with 76 additions and 18 deletions

View file

@ -41,7 +41,6 @@ extern int pr_vbos;
extern int glerror; extern int glerror;
// DATA // DATA
typedef struct s_prplane { typedef struct s_prplane {
// geometry // geometry
@ -130,6 +129,8 @@ extern int globalposx, globalposy, globalposz, globalhoriz;
extern short globalang, globalcursectnum; extern short globalang, globalcursectnum;
extern int globalpal, cosglobalang, singlobalang; extern int globalpal, cosglobalang, singlobalang;
extern int cosviewingrangeglobalang, sinviewingrangeglobalang; extern int cosviewingrangeglobalang, sinviewingrangeglobalang;
extern float shadescale;
extern int globalnoeffect;
// CORE // CORE
static void polymer_displayrooms(short sectnum); static void polymer_displayrooms(short sectnum);

View file

@ -3195,11 +3195,9 @@ static void drawsprite(int snum)
{ {
bglEnable(GL_ALPHA_TEST); bglEnable(GL_ALPHA_TEST);
bglEnable(GL_BLEND); bglEnable(GL_BLEND);
bglEnable(GL_POLYGON_OFFSET_FILL);
polymer_drawsprite(snum); polymer_drawsprite(snum);
bglDisable(GL_POLYGON_OFFSET_FILL);
bglDisable(GL_BLEND); bglDisable(GL_BLEND);
bglDisable(GL_ALPHA_TEST); bglDisable(GL_ALPHA_TEST);
return; return;

View file

@ -367,9 +367,8 @@ void polymer_drawsprite(int snum)
pth = gltexcache(curpicnum, tspr->pal, 0); pth = gltexcache(curpicnum, tspr->pal, 0);
spriteplane.color[0] = spriteplane.color[0] = spriteplane.color[1] = spriteplane.color[2] =
spriteplane.color[1] = ((float)(numpalookups-min(max(tspr->shade*shadescale,0),numpalookups)))/((float)numpalookups);
spriteplane.color[2] = ((float)(numpalookups-min(max(tspr->shade,0),numpalookups)))/((float)numpalookups);
if (pth && (pth->flags & 2) && (pth->palnum != tspr->pal)) if (pth && (pth->flags & 2) && (pth->palnum != tspr->pal))
{ {
@ -496,8 +495,12 @@ void polymer_drawsprite(int snum)
if ((tspr->cstat & 64) && (((tspr->cstat>>4) & 3) == 1)) if ((tspr->cstat & 64) && (((tspr->cstat>>4) & 3) == 1))
bglEnable(GL_CULL_FACE); bglEnable(GL_CULL_FACE);
bglEnable(GL_POLYGON_OFFSET_FILL);
polymer_drawplane(-1, -3, &spriteplane, 0); polymer_drawplane(-1, -3, &spriteplane, 0);
bglDisable(GL_POLYGON_OFFSET_FILL);
if ((tspr->cstat & 64) && (((tspr->cstat>>4) & 3) == 1)) if ((tspr->cstat & 64) && (((tspr->cstat>>4) & 3) == 1))
bglDisable(GL_CULL_FACE); bglDisable(GL_CULL_FACE);
@ -1184,7 +1187,8 @@ attributes:
if (!waloff[curpicnum]) if (!waloff[curpicnum])
loadtile(curpicnum); loadtile(curpicnum);
curbuffer[0] = curbuffer[1] = curbuffer[2] = ((float)(numpalookups-min(max(curstat,0),numpalookups)))/((float)numpalookups); curbuffer[0] = curbuffer[1] = curbuffer[2] =
((float)(numpalookups-min(max(curstat*shadescale,0),numpalookups)))/((float)numpalookups);
curbuffer[3] = 1.0f; curbuffer[3] = 1.0f;
pth = gltexcache(curpicnum,curxpanning,0); pth = gltexcache(curpicnum,curxpanning,0);
@ -1527,7 +1531,7 @@ static void polymer_updatewall(short wallnum)
w->wall.fbglpic = 0; w->wall.fbglpic = 0;
w->wall.color[0] = w->wall.color[1] = w->wall.color[2] = w->wall.color[0] = w->wall.color[1] = w->wall.color[2] =
((float)(numpalookups-min(max(wal->shade,0),numpalookups)))/((float)numpalookups); ((float)(numpalookups-min(max(wal->shade*shadescale,0),numpalookups)))/((float)numpalookups);
w->wall.color[3] = 1.0f; w->wall.color[3] = 1.0f;
if (pth && (pth->flags & 2) && (pth->palnum != wal->pal)) if (pth && (pth->flags & 2) && (pth->palnum != wal->pal))
@ -1624,7 +1628,7 @@ static void polymer_updatewall(short wallnum)
w->wall.fbglpic = 0; w->wall.fbglpic = 0;
w->wall.color[0] = w->wall.color[1] = w->wall.color[2] = w->wall.color[0] = w->wall.color[1] = w->wall.color[2] =
((float)(numpalookups-min(max(curshade,0),numpalookups)))/((float)numpalookups); ((float)(numpalookups-min(max(curshade*shadescale,0),numpalookups)))/((float)numpalookups);
w->wall.color[3] = 1.0f; w->wall.color[3] = 1.0f;
if (pth && (pth->flags & 2) && (pth->palnum != curpal)) if (pth && (pth->flags & 2) && (pth->palnum != curpal))
@ -1714,7 +1718,7 @@ static void polymer_updatewall(short wallnum)
w->mask.glpic = pth ? pth->glpic : 0; w->mask.glpic = pth ? pth->glpic : 0;
w->mask.color[0] = w->mask.color[1] = w->mask.color[2] = w->mask.color[0] = w->mask.color[1] = w->mask.color[2] =
((float)(numpalookups-min(max(wal->shade,0),numpalookups)))/((float)numpalookups); ((float)(numpalookups-min(max(wal->shade*shadescale,0),numpalookups)))/((float)numpalookups);
w->mask.color[3] = 1.0f; w->mask.color[3] = 1.0f;
if (pth && (pth->flags & 2) && (pth->palnum != wal->pal)) if (pth && (pth->flags & 2) && (pth->palnum != wal->pal))
@ -1743,7 +1747,7 @@ static void polymer_updatewall(short wallnum)
w->over.fbglpic = 0; w->over.fbglpic = 0;
w->over.color[0] = w->over.color[1] = w->over.color[2] = w->over.color[0] = w->over.color[1] = w->over.color[2] =
((float)(numpalookups-min(max(wal->shade,0),numpalookups)))/((float)numpalookups); ((float)(numpalookups-min(max(wal->shade*shadescale,0),numpalookups)))/((float)numpalookups);
w->over.color[3] = 1.0f; w->over.color[3] = 1.0f;
if (pth && (pth->flags & 2) && (pth->palnum != wal->pal)) if (pth && (pth->flags & 2) && (pth->palnum != wal->pal))
@ -2154,6 +2158,7 @@ static void polymer_drawmdsprite(spritetype *tspr)
float spos[3]; float spos[3];
float ang; float ang;
float scale; float scale;
GLfloat color[4];
int surfi; int surfi;
md3xyzn_t *v0; md3xyzn_t *v0;
md3surf_t *s; md3surf_t *s;
@ -2168,20 +2173,73 @@ static void polymer_drawmdsprite(spritetype *tspr)
spos[0] = tspr->y; spos[0] = tspr->y;
spos[1] = -(float)(tspr->z) / 16.0f; spos[1] = -(float)(tspr->z) / 16.0f;
spos[2] = -tspr->x; spos[2] = -tspr->x;
ang = (float)((tspr->ang) & 2047) / (2048.0f / 360.0f); ang = (float)((tspr->ang+spriteext[tspr->owner].angoff) & 2047) / (2048.0f / 360.0f);
ang -= 90.0f;
if (((tspr->cstat>>4) & 3) == 2)
ang -= 90.0f;
bglMatrixMode(GL_MODELVIEW); bglMatrixMode(GL_MODELVIEW);
bglPushMatrix(); bglPushMatrix();
scale = (1.0/64.0); scale = (1.0/4.0);
scale *= m->scale; scale *= m->scale;
scale *= m->bscale; scale *= m->bscale;
scale *= 1024;
bglTranslatef(spos[0], spos[1], spos[2]); bglTranslatef(spos[0], spos[1], spos[2]);
bglRotatef(-ang, 0.0f, 1.0f, 0.0f); bglRotatef(-ang, 0.0f, 1.0f, 0.0f);
bglRotatef(-90.0f, 1.0f, 0.0f, 0.0f); if (((tspr->cstat>>4) & 3) == 2)
{
bglTranslatef(0.0f, 0.0, -(float)(tilesizy[tspr->picnum] * tspr->yrepeat) / 8.0f);
bglRotatef(90.0f, 0.0f, 0.0f, 1.0f); bglRotatef(90.0f, 0.0f, 0.0f, 1.0f);
bglScalef(scale * (float)(tspr->xrepeat) / 64.0, scale * (float)(tspr->xrepeat) / 64.0, scale * (float)(tspr->yrepeat) / 64.0); }
else
bglRotatef(-90.0f, 1.0f, 0.0f, 0.0f);
if ((tspr->cstat & 128) && (((tspr->cstat>>4) & 3) != 2))
bglTranslatef(0.0f, 0.0, -(float)(tilesizy[tspr->picnum] * tspr->yrepeat) / 8.0f);
if (tspr->cstat & 8)
{
bglTranslatef(0.0f, 0.0, (float)(tilesizy[tspr->picnum] * tspr->yrepeat) / 4.0f);
bglScalef(1.0f, 1.0f, -1.0f);
}
if (tspr->cstat & 4)
bglScalef(1.0f, -1.0f, 1.0f);
bglScalef(scale * tspr->xrepeat, scale * tspr->xrepeat, scale * tspr->yrepeat);
bglTranslatef(0.0f, 0.0, m->zadd * 64);
color[0] = color[1] = color[2] =
((float)(numpalookups-min(max((tspr->shade*shadescale)+m->shadeoff,0),numpalookups)))/((float)numpalookups);
if (!(hictinting[tspr->pal].f&4))
{
if (!(m->flags&1) || (!(tspr->owner >= MAXSPRITES) && sector[sprite[tspr->owner].sectnum].floorpal!=0))
{
color[0] *= (float)hictinting[globalpal].r / 255.0;
color[1] *= (float)hictinting[globalpal].g / 255.0;
color[2] *= (float)hictinting[globalpal].b / 255.0;
if (hictinting[MAXPALOOKUPS-1].r != 255 || hictinting[MAXPALOOKUPS-1].g != 255 || hictinting[MAXPALOOKUPS-1].b != 255)
{
color[0] *= (float)hictinting[MAXPALOOKUPS-1].r / 255.0;
color[1] *= (float)hictinting[MAXPALOOKUPS-1].g / 255.0;
color[2] *= (float)hictinting[MAXPALOOKUPS-1].b / 255.0;
}
}
else globalnoeffect=1;
}
if (tspr->cstat & 2)
{
if (!(tspr->cstat&512))
color[3] = 0.66;
else
color[3] = 0.33;
} else
color[3] = 1.0;
bglColor4f(color[0], color[1], color[2], color[3]);
for (surfi=0;surfi<m->head.numsurfs;surfi++) for (surfi=0;surfi<m->head.numsurfs;surfi++)
{ {
s = &m->head.surfs[surfi]; s = &m->head.surfs[surfi];
@ -2215,6 +2273,7 @@ static void polymer_drawmdsprite(spritetype *tspr)
} }
} }
bglPopMatrix(); bglPopMatrix();
globalnoeffect=0;
} }
static void polymer_loadmodelvbos(md3model* m) static void polymer_loadmodelvbos(md3model* m)

View file

@ -84,7 +84,7 @@ static double dxb1[MAXWALLSB], dxb2[MAXWALLSB];
#define FOGSCALE 0.0000640 #define FOGSCALE 0.0000640
#define PI 3.14159265358979323 #define PI 3.14159265358979323
static float shadescale = 1.050; float shadescale = 1.050;
static double gyxscale, gxyaspect, gviewxrange, ghalfx, grhalfxdown10, grhalfxdown10x, ghoriz; static double gyxscale, gxyaspect, gviewxrange, ghalfx, grhalfxdown10, grhalfxdown10x, ghoriz;
static double gcosang, gsinang, gcosang2, gsinang2; static double gcosang, gsinang, gcosang2, gsinang2;