mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-02-04 12:50:57 +00:00
Face sprites placeholders.
git-svn-id: https://svn.eduke32.com/eduke32@666 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
c5d5cdc879
commit
e9ec2f5f70
4 changed files with 169 additions and 45 deletions
|
@ -38,6 +38,8 @@ extern int pr_showportals;
|
||||||
extern int pr_verbosity;
|
extern int pr_verbosity;
|
||||||
extern int pr_wireframe;
|
extern int pr_wireframe;
|
||||||
|
|
||||||
|
extern int glerror;
|
||||||
|
|
||||||
// DATA
|
// DATA
|
||||||
typedef struct s_prsector {
|
typedef struct s_prsector {
|
||||||
// geometry
|
// geometry
|
||||||
|
@ -87,6 +89,7 @@ int polymer_init(void);
|
||||||
void polymer_glinit(void);
|
void polymer_glinit(void);
|
||||||
void polymer_loadboard(void);
|
void polymer_loadboard(void);
|
||||||
void polymer_drawrooms(int daposx, int daposy, int daposz, short daang, int dahoriz, short dacursectnum);
|
void polymer_drawrooms(int daposx, int daposy, int daposz, short daang, int dahoriz, short dacursectnum);
|
||||||
|
void polymer_drawmasks(void);
|
||||||
void polymer_rotatesprite(int sx, int sy, int z, short a, short picnum, signed char dashade, char dapalnum, char dastat, int cx1, int cy1, int cx2, int cy2);
|
void polymer_rotatesprite(int sx, int sy, int z, short a, short picnum, signed char dashade, char dapalnum, char dastat, int cx1, int cy1, int cx2, int cy2);
|
||||||
void polymer_drawmaskwall(int damaskwallcnt);
|
void polymer_drawmaskwall(int damaskwallcnt);
|
||||||
void polymer_drawsprite(int snum);
|
void polymer_drawsprite(int snum);
|
||||||
|
|
|
@ -3184,7 +3184,6 @@ static void drawsprite(int snum)
|
||||||
# endif
|
# endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (rendmode == 4) { polymer_drawsprite(snum); return; }
|
|
||||||
#endif
|
#endif
|
||||||
//============================================================================= //POLYMOST ENDS
|
//============================================================================= //POLYMOST ENDS
|
||||||
|
|
||||||
|
@ -6096,6 +6095,14 @@ void drawmasks(void)
|
||||||
_equation maskeq, p1eq, p2eq;
|
_equation maskeq, p1eq, p2eq;
|
||||||
_point2d dot, dot2, middle, pos, spr;
|
_point2d dot, dot2, middle, pos, spr;
|
||||||
|
|
||||||
|
#ifdef USE_OPENGL
|
||||||
|
if (rendmode == 4)
|
||||||
|
{
|
||||||
|
polymer_drawmasks();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
for (i=spritesortcnt-1;i>=0;i--) tspriteptr[i] = &tsprite[i];
|
for (i=spritesortcnt-1;i>=0;i--) tspriteptr[i] = &tsprite[i];
|
||||||
for (i=spritesortcnt-1;i>=0;i--)
|
for (i=spritesortcnt-1;i>=0;i--)
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,6 +9,8 @@ int pr_showportals = 0;
|
||||||
int pr_verbosity = 1; // 0: silent, 1: errors and one-times, 2: multiple-times, 3: flood
|
int pr_verbosity = 1; // 0: silent, 1: errors and one-times, 2: multiple-times, 3: flood
|
||||||
int pr_wireframe = 0;
|
int pr_wireframe = 0;
|
||||||
|
|
||||||
|
int glerror;
|
||||||
|
|
||||||
// DATA
|
// DATA
|
||||||
_prsector *prsectors[MAXSECTORS];
|
_prsector *prsectors[MAXSECTORS];
|
||||||
_prwall *prwalls[MAXWALLS];
|
_prwall *prwalls[MAXWALLS];
|
||||||
|
@ -16,7 +18,7 @@ _prwall *prwalls[MAXWALLS];
|
||||||
GLfloat skybox[16];
|
GLfloat skybox[16];
|
||||||
|
|
||||||
// CONTROL
|
// CONTROL
|
||||||
float pos[3];
|
float pos[3], spos[3];
|
||||||
|
|
||||||
float frustum[5 * 4];
|
float frustum[5 * 4];
|
||||||
|
|
||||||
|
@ -152,10 +154,12 @@ void polymer_loadboard(void)
|
||||||
|
|
||||||
void polymer_drawrooms(int daposx, int daposy, int daposz, short daang, int dahoriz, short dacursectnum)
|
void polymer_drawrooms(int daposx, int daposy, int daposz, short daang, int dahoriz, short dacursectnum)
|
||||||
{
|
{
|
||||||
|
short cursectnum;
|
||||||
int i, j;
|
int i, j;
|
||||||
float ang, horizang, tiltang;
|
float ang, horizang, tiltang;
|
||||||
sectortype *sec, *nextsec;
|
sectortype *sec, *nextsec;
|
||||||
walltype *wal, *nextwal;
|
walltype *wal, *nextwal;
|
||||||
|
spritetype *spr;
|
||||||
GLint result;
|
GLint result;
|
||||||
|
|
||||||
if (pr_verbosity >= 3) OSD_Printf("PR : Drawing rooms...\n");
|
if (pr_verbosity >= 3) OSD_Printf("PR : Drawing rooms...\n");
|
||||||
|
@ -240,13 +244,11 @@ void polymer_drawrooms(int daposx, int daposy, int daposz, short
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// stupid waste of performance - the position doesn't match the sector number when running from a sector to another
|
cursectnum = dacursectnum;
|
||||||
updatesector(daposx, daposy, &dacursectnum);
|
updatesector(daposx, daposy, &cursectnum);
|
||||||
|
|
||||||
if (dacursectnum == -1)
|
if (cursectnum >= 0)
|
||||||
{
|
dacursectnum = cursectnum;
|
||||||
front = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// GO
|
// GO
|
||||||
front = 0;
|
front = 0;
|
||||||
|
@ -258,6 +260,19 @@ void polymer_drawrooms(int daposx, int daposy, int daposz, short
|
||||||
sec = §or[dacursectnum];
|
sec = §or[dacursectnum];
|
||||||
wal = &wall[sec->wallptr];
|
wal = &wall[sec->wallptr];
|
||||||
|
|
||||||
|
// scan sprites
|
||||||
|
for (j = headspritesect[dacursectnum];j >=0;j = nextspritesect[j])
|
||||||
|
{
|
||||||
|
spr = &sprite[j];
|
||||||
|
if ((((spr->cstat&0x8000) == 0) || (showinvisibility)) &&
|
||||||
|
(spr->xrepeat > 0) && (spr->yrepeat > 0) &&
|
||||||
|
(spritesortcnt < MAXSPRITESONSCREEN))
|
||||||
|
{
|
||||||
|
copybufbyte(spr,&tsprite[spritesortcnt],sizeof(spritetype));
|
||||||
|
tsprite[spritesortcnt++].owner = j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < sec->wallnum)
|
while (i < sec->wallnum)
|
||||||
{
|
{
|
||||||
|
@ -293,6 +308,7 @@ void polymer_drawrooms(int daposx, int daposy, int daposz, short
|
||||||
}
|
}
|
||||||
polymer_drawsector(sectorqueue[front]);
|
polymer_drawsector(sectorqueue[front]);
|
||||||
|
|
||||||
|
// scan sectors
|
||||||
sec = §or[sectorqueue[front]];
|
sec = §or[sectorqueue[front]];
|
||||||
wal = &wall[sec->wallptr];
|
wal = &wall[sec->wallptr];
|
||||||
|
|
||||||
|
@ -311,7 +327,6 @@ void polymer_drawrooms(int daposx, int daposy, int daposz, short
|
||||||
|
|
||||||
if (pr_occlusionculling)
|
if (pr_occlusionculling)
|
||||||
{
|
{
|
||||||
|
|
||||||
nextsec = §or[wal->nextsector];
|
nextsec = §or[wal->nextsector];
|
||||||
nextwal = &wall[nextsec->wallptr];
|
nextwal = &wall[nextsec->wallptr];
|
||||||
|
|
||||||
|
@ -348,7 +363,6 @@ void polymer_drawrooms(int daposx, int daposy, int daposz, short
|
||||||
|
|
||||||
bglEnable(GL_FOG);
|
bglEnable(GL_FOG);
|
||||||
bglEnable(GL_TEXTURE_2D);
|
bglEnable(GL_TEXTURE_2D);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -356,13 +370,33 @@ void polymer_drawrooms(int daposx, int daposy, int daposz, short
|
||||||
wal = &wall[sec->wallptr + i];
|
wal = &wall[sec->wallptr + i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// scan sprites
|
||||||
|
for (j = headspritesect[sectorqueue[front]];j >=0;j = nextspritesect[j])
|
||||||
|
{
|
||||||
|
spr = &sprite[j];
|
||||||
|
if ((((spr->cstat&0x8000) == 0) || (showinvisibility)) &&
|
||||||
|
(spr->xrepeat > 0) && (spr->yrepeat > 0) &&
|
||||||
|
(spritesortcnt < MAXSPRITESONSCREEN))
|
||||||
|
{
|
||||||
|
copybufbyte(spr,&tsprite[spritesortcnt],sizeof(spritetype));
|
||||||
|
tsprite[spritesortcnt++].owner = j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
front++;
|
front++;
|
||||||
}
|
}
|
||||||
//polymer_drawroom(dacursectnum);
|
|
||||||
|
|
||||||
if (pr_verbosity >= 3) OSD_Printf("PR : Rooms drawn.\n");
|
if (pr_verbosity >= 3) OSD_Printf("PR : Rooms drawn.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void polymer_drawmasks(void)
|
||||||
|
{
|
||||||
|
while (spritesortcnt)
|
||||||
|
{
|
||||||
|
polymer_drawsprite(--spritesortcnt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void polymer_rotatesprite(int sx, int sy, int z, short a, short picnum, signed char dashade, char dapalnum, char dastat, int cx1, int cy1, int cx2, int cy2)
|
void polymer_rotatesprite(int sx, int sy, int z, short a, short picnum, signed char dashade, char dapalnum, char dastat, int cx1, int cy1, int cx2, int cy2)
|
||||||
{
|
{
|
||||||
UNREFERENCED_PARAMETER(sx);
|
UNREFERENCED_PARAMETER(sx);
|
||||||
|
@ -386,7 +420,88 @@ void polymer_drawmaskwall(int damaskwallcnt)
|
||||||
|
|
||||||
void polymer_drawsprite(int snum)
|
void polymer_drawsprite(int snum)
|
||||||
{
|
{
|
||||||
OSD_Printf("PR : Sprite %i...\n", snum);
|
int i, j, curpicnum, glpic, xsize, ysize;
|
||||||
|
spritetype *tspr;
|
||||||
|
pthtyp* pth;
|
||||||
|
float color[3], xratio;
|
||||||
|
|
||||||
|
if (pr_verbosity >= 3) OSD_Printf("PR : Sprite %i...\n", snum);
|
||||||
|
|
||||||
|
tspr = &tsprite[snum];
|
||||||
|
|
||||||
|
curpicnum = tspr->picnum;
|
||||||
|
if (picanm[curpicnum]&192) curpicnum += animateoffs(curpicnum,tspr->owner+32768);
|
||||||
|
|
||||||
|
pth = gltexcache(curpicnum, tspr->pal, 0);
|
||||||
|
|
||||||
|
color[0] = color[1] = color[2] = ((float)(numpalookups-min(max(tspr->shade,0),numpalookups)))/((float)numpalookups);
|
||||||
|
|
||||||
|
if (pth && (pth->flags & 2) && (pth->palnum != tspr->pal))
|
||||||
|
{
|
||||||
|
color[0] *= (float)hictinting[tspr->pal].r / 255.0;
|
||||||
|
color[1] *= (float)hictinting[tspr->pal].g / 255.0;
|
||||||
|
color[2] *= (float)hictinting[tspr->pal].b / 255.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
glpic = (pth) ? pth->glpic : 0;
|
||||||
|
|
||||||
|
if (((tspr->cstat>>4) & 3) == 0)
|
||||||
|
{
|
||||||
|
xratio = (float)(tspr->xrepeat) / 160.0f;
|
||||||
|
xsize = (tilesizx[curpicnum] * 32 * xratio) / 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
xsize = tspr->xrepeat * tilesizx[curpicnum] / 8;
|
||||||
|
|
||||||
|
ysize = tspr->yrepeat * tilesizy[curpicnum] * 4;
|
||||||
|
|
||||||
|
spos[0] = tspr->y;
|
||||||
|
spos[1] = -tspr->z;
|
||||||
|
spos[2] = -tspr->x;
|
||||||
|
|
||||||
|
bglMatrixMode(GL_MODELVIEW);
|
||||||
|
bglPushMatrix();
|
||||||
|
|
||||||
|
bglTranslatef(spos[0], spos[1], spos[2]);
|
||||||
|
bglGetDoublev(GL_MODELVIEW_MATRIX, modelviewmatrix);
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
while (i < 3)
|
||||||
|
{
|
||||||
|
j = 0;
|
||||||
|
while (j < 3)
|
||||||
|
{
|
||||||
|
if (i == j)
|
||||||
|
modelviewmatrix[(i * 4) + j] = 1.0;
|
||||||
|
else
|
||||||
|
modelviewmatrix[(i * 4) + j] = 0.0;
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
bglLoadMatrixd(modelviewmatrix);
|
||||||
|
bglScalef(1.0f / 1000.0f, 1.0f / 16000.0f, 1.0f / 1000.0f);
|
||||||
|
|
||||||
|
bglEnable(GL_ALPHA_TEST);
|
||||||
|
bglBindTexture(GL_TEXTURE_2D, glpic);
|
||||||
|
bglColor4f(color[0], color[1], color[2], 1.0f);
|
||||||
|
|
||||||
|
bglBegin(GL_QUADS);
|
||||||
|
bglTexCoord2f(0.0f, 1.0f);
|
||||||
|
bglVertex3f(-xsize,0,0);
|
||||||
|
bglTexCoord2f(1.0f, 1.0f);
|
||||||
|
bglVertex3f(xsize,0,0);
|
||||||
|
bglTexCoord2f(1.0f, 0.0f);
|
||||||
|
bglVertex3f(xsize,ysize,0);
|
||||||
|
bglTexCoord2f(0.0f, 0.0f);
|
||||||
|
bglVertex3f(-xsize,ysize,0);
|
||||||
|
bglEnd();
|
||||||
|
|
||||||
|
bglDisable(GL_ALPHA_TEST);
|
||||||
|
|
||||||
|
|
||||||
|
bglPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
// SECTORS
|
// SECTORS
|
||||||
|
@ -584,7 +699,6 @@ int polymer_updatesector(short sectnum)
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PR_CALLBACK polymer_tesscombine(GLdouble v[3], GLdouble *data[4], GLfloat weight[4], GLdouble **out)
|
void PR_CALLBACK polymer_tesscombine(GLdouble v[3], GLdouble *data[4], GLfloat weight[4], GLdouble **out)
|
||||||
{
|
{
|
||||||
// This callback is called by the tesselator when it detects an intersection between contours (HELLO ROTATING SPOTLIGHT IN E1L1).
|
// This callback is called by the tesselator when it detects an intersection between contours (HELLO ROTATING SPOTLIGHT IN E1L1).
|
||||||
|
@ -603,14 +717,12 @@ void PR_CALLBACK polymer_tesscombine(GLdouble v[3], GLdouble *data[4], GLfloa
|
||||||
if (pr_verbosity >= 2) OSD_Printf("PR : Created additional geometry for sector tesselation.\n");
|
if (pr_verbosity >= 2) OSD_Printf("PR : Created additional geometry for sector tesselation.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PR_CALLBACK polymer_tesserror(GLenum error)
|
void PR_CALLBACK polymer_tesserror(GLenum error)
|
||||||
{
|
{
|
||||||
// This callback is called by the tesselator whenever it raises an error.
|
// This callback is called by the tesselator whenever it raises an error.
|
||||||
if (pr_verbosity >= 1) OSD_Printf("PR : Tesselation error number %i reported : %s.\n", error, bgluErrorString(errno));
|
if (pr_verbosity >= 1) OSD_Printf("PR : Tesselation error number %i reported : %s.\n", error, bgluErrorString(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PR_CALLBACK polymer_tessedgeflag(GLenum error)
|
void PR_CALLBACK polymer_tessedgeflag(GLenum error)
|
||||||
{
|
{
|
||||||
// Passing an edgeflag callback forces the tesselator to output a triangle list
|
// Passing an edgeflag callback forces the tesselator to output a triangle list
|
||||||
|
@ -1115,6 +1227,7 @@ void polymer_extractfrustum(GLdouble* modelview, GLdouble* projec
|
||||||
bglMultMatrixd(modelview);
|
bglMultMatrixd(modelview);
|
||||||
bglGetDoublev(GL_TEXTURE_MATRIX, matrix);
|
bglGetDoublev(GL_TEXTURE_MATRIX, matrix);
|
||||||
bglLoadIdentity();
|
bglLoadIdentity();
|
||||||
|
bglMatrixMode(GL_MODELVIEW);
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < 4)
|
while (i < 4)
|
||||||
|
|
|
@ -2156,6 +2156,7 @@ void drawpoly(double *dpx, double *dpy, int n, int method)
|
||||||
|
|
||||||
while (texunits >= GL_TEXTURE0_ARB)
|
while (texunits >= GL_TEXTURE0_ARB)
|
||||||
{
|
{
|
||||||
|
bglActiveTextureARB(texunits);
|
||||||
bglMatrixMode(GL_TEXTURE);
|
bglMatrixMode(GL_TEXTURE);
|
||||||
bglLoadIdentity();
|
bglLoadIdentity();
|
||||||
bglMatrixMode(GL_MODELVIEW);
|
bglMatrixMode(GL_MODELVIEW);
|
||||||
|
@ -2164,7 +2165,7 @@ void drawpoly(double *dpx, double *dpy, int n, int method)
|
||||||
bglTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, 1.0f);
|
bglTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, 1.0f);
|
||||||
bglDisable(GL_TEXTURE_2D);
|
bglDisable(GL_TEXTURE_2D);
|
||||||
}
|
}
|
||||||
bglActiveTextureARB(--texunits);
|
texunits--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (srepeat)
|
if (srepeat)
|
||||||
|
|
Loading…
Reference in a new issue