2006-08-29 01:58:59 +00:00
|
|
|
// blah
|
2006-08-31 01:56:43 +00:00
|
|
|
|
|
|
|
#include "polymer.h"
|
2006-08-29 01:58:59 +00:00
|
|
|
|
|
|
|
_prsector* prsectors[MAXSECTORS];
|
|
|
|
|
2006-08-30 23:32:39 +00:00
|
|
|
float polymostprojmatrix[16];
|
|
|
|
float polymostmodelmatrix[16];
|
|
|
|
|
|
|
|
// tesselation variables
|
|
|
|
GLUtesselator* prtess;
|
|
|
|
int tempverticescount;
|
2006-09-17 20:16:20 +00:00
|
|
|
GLdouble tempvertice[3];
|
2006-08-30 23:32:39 +00:00
|
|
|
|
|
|
|
// Polymer cvars
|
2006-08-31 01:56:43 +00:00
|
|
|
char pr_verbosity = 1; // 0: silent, 1: errors and one-times, 2: multiple-times, 3: flood
|
|
|
|
char pr_wireframe = 0;
|
2006-08-30 23:32:39 +00:00
|
|
|
|
|
|
|
int polymer_init(void)
|
2006-08-29 01:58:59 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2006-08-30 23:32:39 +00:00
|
|
|
if (pr_verbosity >= 1) OSD_Printf("Initalizing Polymer subsystem...\n");
|
2006-08-29 01:58:59 +00:00
|
|
|
|
|
|
|
i = 0;
|
|
|
|
while (i < MAXSECTORS)
|
|
|
|
{
|
|
|
|
prsectors[i] = NULL;
|
|
|
|
i++;
|
|
|
|
}
|
2006-08-30 23:32:39 +00:00
|
|
|
|
|
|
|
prtess = gluNewTess();
|
|
|
|
if (prtess == 0)
|
|
|
|
{
|
|
|
|
if (pr_verbosity >= 1) OSD_Printf("PR : Tesselator initialization failed.\n");
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pr_verbosity >= 1) OSD_Printf("PR : Initialization complete.\n");
|
|
|
|
return (1);
|
2006-08-29 01:58:59 +00:00
|
|
|
}
|
2006-04-23 06:44:19 +00:00
|
|
|
|
2006-08-30 23:32:39 +00:00
|
|
|
void polymer_glinit(void)
|
2006-04-23 06:44:19 +00:00
|
|
|
{
|
2006-08-30 23:32:39 +00:00
|
|
|
GLfloat params[4];
|
|
|
|
|
|
|
|
bglGetFloatv(GL_PROJECTION_MATRIX, polymostprojmatrix);
|
|
|
|
bglGetFloatv(GL_MODELVIEW_MATRIX, polymostmodelmatrix);
|
2006-04-23 06:44:19 +00:00
|
|
|
bglClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
2006-08-29 01:58:59 +00:00
|
|
|
bglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
2006-04-23 06:44:19 +00:00
|
|
|
bglViewport(0, 0, 1024, 768);
|
2006-08-30 23:32:39 +00:00
|
|
|
|
|
|
|
// texturing
|
2006-09-17 20:16:20 +00:00
|
|
|
bglDisable(GL_TEXTURE_2D);
|
2006-08-30 23:32:39 +00:00
|
|
|
//bglEnable(GL_TEXTURE_GEN_S);
|
|
|
|
//bglEnable(GL_TEXTURE_GEN_T);
|
|
|
|
params[0] = GL_OBJECT_LINEAR;
|
|
|
|
bglTexGenfv(GL_S, GL_TEXTURE_GEN_MODE, params);
|
|
|
|
bglTexGenfv(GL_T, GL_TEXTURE_GEN_MODE, params);
|
|
|
|
params[0] = 1.0 / 10000.0;
|
|
|
|
params[1] = 1.0 / 10000.0;
|
|
|
|
params[2] = 1.0 / 10000.0;
|
|
|
|
params[3] = 1.0 / 10000.0;
|
|
|
|
bglTexGenfv(GL_S, GL_OBJECT_PLANE, params);
|
|
|
|
bglTexGenfv(GL_T, GL_OBJECT_PLANE, params);
|
|
|
|
|
2006-08-29 01:58:59 +00:00
|
|
|
bglDisable(GL_FOG);
|
2006-04-23 06:44:19 +00:00
|
|
|
bglEnable(GL_DEPTH_TEST);
|
2006-08-30 23:32:39 +00:00
|
|
|
if (pr_wireframe)
|
|
|
|
bglPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
|
|
|
else
|
|
|
|
bglPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
|
|
|
|
2006-04-23 06:44:19 +00:00
|
|
|
bglMatrixMode(GL_PROJECTION);
|
|
|
|
bglLoadIdentity();
|
2006-08-30 23:32:39 +00:00
|
|
|
bglFrustum(-1.0f, 1.0f, -0.75f, 0.75, 1.0f, 1000000.0f);
|
2006-04-23 06:44:19 +00:00
|
|
|
bglMatrixMode(GL_MODELVIEW);
|
|
|
|
bglLoadIdentity();
|
|
|
|
}
|
2006-08-31 01:56:43 +00:00
|
|
|
|
|
|
|
int polymer_updategeometry(short sectnum)
|
|
|
|
{
|
|
|
|
_prsector* s;
|
2006-08-30 23:32:39 +00:00
|
|
|
sectortype *sec;
|
2006-08-31 01:56:43 +00:00
|
|
|
walltype *wal;
|
|
|
|
int i, ret;
|
2006-09-17 20:16:20 +00:00
|
|
|
long ceilz, florz;
|
2006-08-31 01:56:43 +00:00
|
|
|
|
|
|
|
s = prsectors[sectnum];
|
|
|
|
sec = §or[sectnum];
|
|
|
|
wal = &wall[sec->wallptr];
|
|
|
|
|
|
|
|
if (s == NULL)
|
|
|
|
{
|
|
|
|
if (pr_verbosity >= 1) OSD_Printf("PR : Can't update uninitialized sector %i.\n", sectnum);
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
while (i < s->wallcount)
|
|
|
|
{
|
2006-09-27 02:23:27 +00:00
|
|
|
s->verts[(i*3)+2] = s->floorbuffer[(i*5)+2] = s->ceilbuffer[(i*5)+2] = -wal->x;
|
|
|
|
s->verts[i*3] = s->floorbuffer[i*5] = s->ceilbuffer[i*5] = wal->y;
|
2006-09-17 20:16:20 +00:00
|
|
|
getzsofslope(sectnum, wal->x, wal->y, &ceilz, &florz);
|
2006-09-27 02:23:27 +00:00
|
|
|
s->verts[(i*3)+1] = 0;
|
|
|
|
s->floorbuffer[(i*5)+1] = -florz;
|
|
|
|
s->ceilbuffer[(i*5)+1] = -ceilz;
|
2006-08-31 01:56:43 +00:00
|
|
|
|
|
|
|
i++;
|
|
|
|
wal = &wall[sec->wallptr + i];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pr_verbosity >= 3) OSD_Printf("PR : Updated sector %i.\n", sectnum);
|
|
|
|
|
2006-09-27 02:23:27 +00:00
|
|
|
return (ret = 0);
|
2006-08-31 01:56:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// This callback is called by the tesselator when it detects an intersection between contours (HELLO ROTATING SPOTLIGHT IN E1L1).
|
2006-09-17 20:16:20 +00:00
|
|
|
void PR_CALLBACK polymer_tesscombine(GLdouble v[3], GLdouble *data[4], GLfloat weight[4], GLdouble **out)
|
2006-08-31 01:56:43 +00:00
|
|
|
{
|
2006-09-17 20:16:20 +00:00
|
|
|
GLdouble* ptr;
|
2006-08-31 01:56:43 +00:00
|
|
|
|
2006-09-17 20:16:20 +00:00
|
|
|
//tempverticescount++;
|
|
|
|
//tempvertices = realloc(tempvertices, tempverticescount * sizeof(GLdouble) * 3);
|
|
|
|
tempvertice[0] = v[0];
|
|
|
|
tempvertice[1] = v[1];
|
|
|
|
tempvertice[2] = v[2];
|
2006-08-31 01:56:43 +00:00
|
|
|
|
2006-09-17 20:16:20 +00:00
|
|
|
ptr = tempvertice;
|
2006-09-27 02:23:27 +00:00
|
|
|
*out = tempvertice;
|
2006-08-31 01:56:43 +00:00
|
|
|
|
|
|
|
if (pr_verbosity >= 2) OSD_Printf("PR : Created additional geometry for sector tesselation.\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
// This callback is called by the tesselator whenever it raises an error.
|
2006-09-17 20:16:20 +00:00
|
|
|
void PR_CALLBACK polymer_tesserror(GLenum error)
|
2006-08-31 01:56:43 +00:00
|
|
|
{
|
|
|
|
if (pr_verbosity >= 1) OSD_Printf("PR : Tesselation error number %i reported : %s.\n", error, gluErrorString(errno));
|
|
|
|
}
|
|
|
|
|
2006-09-27 02:23:27 +00:00
|
|
|
// Passing an edgeflag callback forces the tesselator to output a triangle list
|
|
|
|
void PR_CALLBACK polymer_tessedgeflag(GLboolean flag)
|
|
|
|
{
|
|
|
|
flag = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
void PR_CALLBACK polymer_tessvertex(void* vertex, void* sector)
|
|
|
|
{
|
|
|
|
_prsector* s;
|
|
|
|
|
|
|
|
s = (_prsector*)sector;
|
|
|
|
|
|
|
|
s->indices[s->curindice] = (GLushort)vertex;
|
|
|
|
s->curindice++;
|
|
|
|
}
|
|
|
|
|
2006-08-31 01:56:43 +00:00
|
|
|
// This function tesselates the floor/ceiling of a sector and stores the triangles in a display list.
|
|
|
|
int polymer_buildfloor(short sectnum)
|
|
|
|
{
|
|
|
|
_prsector* s;
|
2006-08-30 23:32:39 +00:00
|
|
|
sectortype *sec;
|
2006-08-31 01:56:43 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
if (pr_verbosity >= 2) OSD_Printf("PR : Tesselating floor of sector %i...\n", sectnum);
|
|
|
|
|
|
|
|
s = prsectors[sectnum];
|
|
|
|
sec = §or[sectnum];
|
|
|
|
|
|
|
|
if (s == NULL)
|
|
|
|
return (-1);
|
2006-08-30 23:32:39 +00:00
|
|
|
|
2006-09-27 02:23:27 +00:00
|
|
|
if (s->indices != NULL)
|
|
|
|
free(s->indices);
|
|
|
|
|
|
|
|
s->indices = calloc((sec->wallnum - 2) * 3, sizeof(GLushort));
|
|
|
|
s->curindice = 0;
|
2006-08-30 23:32:39 +00:00
|
|
|
|
|
|
|
gluTessCallback(prtess, GLU_TESS_BEGIN, bglBegin);
|
|
|
|
gluTessCallback(prtess, GLU_TESS_END, bglEnd);
|
2006-09-27 02:23:27 +00:00
|
|
|
gluTessCallback(prtess, GLU_TESS_VERTEX_DATA, polymer_tessvertex);
|
|
|
|
gluTessCallback(prtess, GLU_TESS_EDGE_FLAG, polymer_tessedgeflag);
|
|
|
|
//gluTessCallback(prtess, GLU_TESS_COMBINE, polymer_tesscombine);
|
2006-08-30 23:32:39 +00:00
|
|
|
gluTessCallback(prtess, GLU_TESS_ERROR, polymer_tesserror);
|
|
|
|
|
|
|
|
gluTessProperty(prtess, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_POSITIVE);
|
|
|
|
|
2006-09-27 02:23:27 +00:00
|
|
|
gluTessBeginPolygon(prtess, s);
|
2006-08-30 23:32:39 +00:00
|
|
|
gluTessBeginContour(prtess);
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
while (i < sec->wallnum)
|
|
|
|
{
|
2006-09-27 02:23:27 +00:00
|
|
|
gluTessVertex(prtess, s->verts + (3 * i), (void *)i);
|
|
|
|
if ((i != (sec->wallnum - 1)) && ((sec->wallptr + i) > wall[sec->wallptr + i].point2))
|
2006-08-30 23:32:39 +00:00
|
|
|
{
|
|
|
|
gluTessEndContour(prtess);
|
|
|
|
gluTessBeginContour(prtess);
|
|
|
|
}
|
2006-08-31 01:56:43 +00:00
|
|
|
i++;
|
2006-08-30 23:32:39 +00:00
|
|
|
}
|
|
|
|
gluTessEndContour(prtess);
|
|
|
|
gluTessEndPolygon(prtess);
|
|
|
|
|
2006-08-31 01:56:43 +00:00
|
|
|
if (pr_verbosity >= 2) OSD_Printf("PR : Tesselated floor of sector %i.\n", sectnum);
|
2006-08-30 23:32:39 +00:00
|
|
|
|
|
|
|
return (1);
|
2006-08-31 01:56:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int polymer_initsector(short sectnum)
|
|
|
|
{
|
2006-08-30 23:32:39 +00:00
|
|
|
sectortype *sec;
|
2006-08-31 01:56:43 +00:00
|
|
|
_prsector* s;
|
|
|
|
|
|
|
|
if (pr_verbosity >= 2) OSD_Printf("PR : Initalizing sector %i...\n", sectnum);
|
|
|
|
|
|
|
|
sec = §or[sectnum];
|
2006-09-27 02:23:27 +00:00
|
|
|
if (pr_verbosity >= 0) OSD_Printf("PR : Preparing to allocate sector %i...\n", sectnum);
|
2006-08-31 01:56:43 +00:00
|
|
|
s = malloc(sizeof(_prsector));
|
2006-09-27 02:23:27 +00:00
|
|
|
if (pr_verbosity >= 0) OSD_Printf("PR : Allocated sector %i...\n", sectnum);
|
2006-08-31 01:56:43 +00:00
|
|
|
if (s == NULL)
|
|
|
|
{
|
|
|
|
if (pr_verbosity >= 1) OSD_Printf("PR : Cannot initialize sector %i : malloc failed.\n", sectnum);
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
s->invalidate = 0;
|
|
|
|
s->wallcount = sec->wallnum;
|
2006-09-27 02:23:27 +00:00
|
|
|
|
|
|
|
s->verts = calloc(s->wallcount, sizeof(GLdouble) * 3);
|
|
|
|
s->floorbuffer = calloc(s->wallcount, sizeof(GLfloat) * 5);
|
|
|
|
s->ceilbuffer = calloc(s->wallcount, sizeof(GLfloat) * 5);
|
|
|
|
if ((s->verts == NULL) || (s->floorbuffer == NULL) || (s->ceilbuffer == NULL))
|
2006-08-31 01:56:43 +00:00
|
|
|
{
|
|
|
|
if (pr_verbosity >= 1) OSD_Printf("PR : Cannot initialize geometry of sector %i : malloc failed.\n", sectnum);
|
|
|
|
return (0);
|
|
|
|
}
|
2006-09-27 02:23:27 +00:00
|
|
|
|
|
|
|
s->indices = NULL;
|
2006-08-31 01:56:43 +00:00
|
|
|
|
|
|
|
prsectors[sectnum] = s;
|
|
|
|
|
|
|
|
if (pr_verbosity >= 2) OSD_Printf("PR : Initalized sector %i.\n", sectnum);
|
|
|
|
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
|
2006-08-29 01:58:59 +00:00
|
|
|
void polymer_drawsector(long daposx, long daposy, long daposz, short daang, long dahoriz, short sectnum)
|
2006-04-23 06:44:19 +00:00
|
|
|
{
|
2006-08-30 23:32:39 +00:00
|
|
|
sectortype *sec, *nextsec;
|
|
|
|
walltype *wal;
|
2006-08-31 01:56:43 +00:00
|
|
|
_prsector* s;
|
2006-08-29 01:58:59 +00:00
|
|
|
float ang;
|
2006-08-30 23:32:39 +00:00
|
|
|
double pos[3];
|
|
|
|
int i;
|
|
|
|
long zdiff;
|
|
|
|
pthtyp* pth;
|
|
|
|
|
|
|
|
if (pr_verbosity >= 3) OSD_Printf("PR : Drawing sector %i...\n", sectnum);
|
2006-04-24 19:04:22 +00:00
|
|
|
|
2006-08-30 23:32:39 +00:00
|
|
|
if (prsectors[sectnum] == NULL)
|
|
|
|
{
|
|
|
|
polymer_initsector(sectnum);
|
|
|
|
polymer_updategeometry(sectnum);
|
|
|
|
polymer_buildfloor(sectnum);
|
|
|
|
}
|
2006-09-27 02:23:27 +00:00
|
|
|
else if (prsectors[sectnum]->invalidate)
|
2006-08-30 23:32:39 +00:00
|
|
|
{
|
|
|
|
if (pr_verbosity >= 2) OSD_Printf("PR : Sector %i invalidated. Tesselating...\n", sectnum);
|
|
|
|
polymer_updategeometry(sectnum);
|
|
|
|
polymer_buildfloor(sectnum);
|
2006-09-27 02:23:27 +00:00
|
|
|
prsectors[sectnum]->invalidate = 0;
|
2006-08-30 23:32:39 +00:00
|
|
|
}
|
2006-08-29 01:58:59 +00:00
|
|
|
|
2006-08-30 23:32:39 +00:00
|
|
|
sec = §or[sectnum];
|
2006-08-31 01:56:43 +00:00
|
|
|
wal = &wall[sec->wallptr];
|
|
|
|
s = prsectors[sectnum];
|
2006-08-29 01:58:59 +00:00
|
|
|
|
|
|
|
ang = (float)(daang) / (2048.0f / 360.0f);
|
|
|
|
|
2006-08-30 23:32:39 +00:00
|
|
|
pos[0] = -daposy;
|
|
|
|
pos[1] = daposz;
|
|
|
|
pos[2] = daposx;
|
2006-08-29 01:58:59 +00:00
|
|
|
|
|
|
|
bglMatrixMode(GL_MODELVIEW);
|
|
|
|
bglLoadIdentity();
|
|
|
|
bglRotatef(ang, 0.0f, 1.0f, 0.0f);
|
2006-08-30 23:32:39 +00:00
|
|
|
bglScalef(1.0f, 1.0f / 16.0f, 1.0f);
|
|
|
|
bglTranslatef(pos[0], pos[1], pos[2]);
|
2006-08-29 01:58:59 +00:00
|
|
|
|
2006-08-30 23:32:39 +00:00
|
|
|
// floor
|
|
|
|
pth = gltexcache(sec->floorpicnum,sec->floorpal,0);
|
|
|
|
bglBindTexture(GL_TEXTURE_2D, pth ? pth->glpic : 0);
|
2006-08-29 01:58:59 +00:00
|
|
|
bglColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
2006-09-27 02:23:27 +00:00
|
|
|
bglEnableClientState(GL_VERTEX_ARRAY);
|
|
|
|
bglVertexPointer(3, GL_FLOAT, 5 * sizeof(GLfloat), s->floorbuffer);
|
|
|
|
bglDrawElements(GL_TRIANGLES, (sec->wallnum - 2) * 3, GL_UNSIGNED_SHORT, s->indices);
|
|
|
|
bglDisableClientState(GL_VERTEX_ARRAY);
|
2006-08-29 01:58:59 +00:00
|
|
|
|
2006-08-30 23:32:39 +00:00
|
|
|
// ceiling
|
|
|
|
pth = gltexcache(sec->ceilingpicnum,sec->ceilingpal,0);
|
|
|
|
bglBindTexture(GL_TEXTURE_2D, pth ? pth->glpic : 0);
|
|
|
|
bglColor4f(1.0f, 0.0f, 0.0f, 1.0f);
|
|
|
|
|
2006-09-27 02:23:27 +00:00
|
|
|
/*// walls
|
2006-08-31 01:56:43 +00:00
|
|
|
i = 0;
|
|
|
|
while (i < sec->wallnum)
|
|
|
|
{
|
|
|
|
if (wal->nextsector == -1)
|
|
|
|
{ // limit of the map
|
2006-08-30 23:32:39 +00:00
|
|
|
pth = gltexcache(wal->picnum,wal->pal,0);
|
|
|
|
bglBindTexture(GL_TEXTURE_2D, pth ? pth->glpic : 0);
|
|
|
|
bglColor4f(0.0f, 1.0f, 0.0f, 1.0f);
|
2006-08-31 01:56:43 +00:00
|
|
|
bglBegin(GL_QUADS);
|
|
|
|
bglVertex3d(s->verts[i].v[0], s->verts[i].v[1], s->verts[i].v[2]);
|
|
|
|
bglVertex3d(s->verts[wal->point2 - sec->wallptr].v[0], s->verts[wal->point2 - sec->wallptr].v[1], s->verts[wal->point2 - sec->wallptr].v[2]);
|
|
|
|
bglVertex3d(s->verts[wal->point2 - sec->wallptr].v[0], s->verts[wal->point2 - sec->wallptr].v[1] + (sec->floorz - sec->ceilingz), s->verts[wal->point2 - sec->wallptr].v[2]);
|
|
|
|
bglVertex3d(s->verts[i].v[0], s->verts[i].v[1] + (sec->floorz - sec->ceilingz), s->verts[i].v[2]);
|
|
|
|
bglEnd();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nextsec = §or[wal->nextsector];
|
|
|
|
zdiff = sec->floorz - nextsec->floorz;
|
|
|
|
if (zdiff > 0)
|
|
|
|
{ // floor polymerization
|
2006-08-30 23:32:39 +00:00
|
|
|
pth = gltexcache(wal->picnum,wal->pal,0);
|
|
|
|
bglBindTexture(GL_TEXTURE_2D, pth ? pth->glpic : 0);
|
|
|
|
bglColor4f(0.0f, 0.0f, 1.0f, 1.0f);
|
2006-08-31 01:56:43 +00:00
|
|
|
bglBegin(GL_QUADS);
|
|
|
|
bglVertex3d(s->verts[i].v[0], s->verts[i].v[1], s->verts[i].v[2]);
|
|
|
|
bglVertex3d(s->verts[wal->point2 - sec->wallptr].v[0], s->verts[wal->point2 - sec->wallptr].v[1], s->verts[wal->point2 - sec->wallptr].v[2]);
|
|
|
|
bglVertex3d(s->verts[wal->point2 - sec->wallptr].v[0], s->verts[wal->point2 - sec->wallptr].v[1] + zdiff, s->verts[wal->point2 - sec->wallptr].v[2]);
|
|
|
|
bglVertex3d(s->verts[i].v[0], s->verts[i].v[1] + zdiff, s->verts[i].v[2]);
|
|
|
|
bglEnd();
|
|
|
|
}
|
|
|
|
zdiff = sec->ceilingz - nextsec->ceilingz;
|
|
|
|
if (zdiff > 0)
|
|
|
|
{ // ceiling polymerization
|
2006-08-30 23:32:39 +00:00
|
|
|
pth = gltexcache(wal->picnum,wal->pal,0);
|
|
|
|
bglBindTexture(GL_TEXTURE_2D, pth ? pth->glpic : 0);
|
|
|
|
bglColor4f(1.0f, 0.0f, 1.0f, 1.0f);
|
2006-08-31 01:56:43 +00:00
|
|
|
bglBegin(GL_QUADS);
|
|
|
|
bglVertex3d(s->verts[i].v[0], s->verts[i].v[1] + (sec->floorz - sec->ceilingz), s->verts[i].v[2]);
|
|
|
|
bglVertex3d(s->verts[wal->point2 - sec->wallptr].v[0], s->verts[wal->point2 - sec->wallptr].v[1] + (sec->floorz - sec->ceilingz), s->verts[wal->point2 - sec->wallptr].v[2]);
|
|
|
|
bglVertex3d(s->verts[wal->point2 - sec->wallptr].v[0], s->verts[wal->point2 - sec->wallptr].v[1] + zdiff + (sec->floorz - sec->ceilingz), s->verts[wal->point2 - sec->wallptr].v[2]);
|
|
|
|
bglVertex3d(s->verts[i].v[0], s->verts[i].v[1] + zdiff + (sec->floorz - sec->ceilingz), s->verts[i].v[2]);
|
|
|
|
bglEnd();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
i++;
|
|
|
|
wal = &wall[sec->wallptr + i];
|
2006-09-27 02:23:27 +00:00
|
|
|
}*/
|
2006-08-30 23:32:39 +00:00
|
|
|
|
2006-08-31 01:56:43 +00:00
|
|
|
if (pr_verbosity >= 3) OSD_Printf("PR : Finished drawing sector %i...\n", sectnum);
|
2006-04-23 06:44:19 +00:00
|
|
|
}
|
|
|
|
|
2006-08-29 01:58:59 +00:00
|
|
|
void polymer_drawrooms(long daposx, long daposy, long daposz, short daang, long dahoriz, short dacursectnum)
|
2006-04-23 06:44:19 +00:00
|
|
|
{
|
2006-08-29 01:58:59 +00:00
|
|
|
int i;
|
2006-08-30 23:32:39 +00:00
|
|
|
|
2006-08-31 01:56:43 +00:00
|
|
|
if (pr_verbosity >= 3) OSD_Printf("PR : Drawing rooms...\n");
|
2006-08-29 01:58:59 +00:00
|
|
|
|
2006-04-23 06:44:19 +00:00
|
|
|
polymer_glinit();
|
2006-08-30 23:32:39 +00:00
|
|
|
|
2006-08-29 01:58:59 +00:00
|
|
|
i = 0;
|
|
|
|
while (i < numsectors)
|
|
|
|
{
|
|
|
|
polymer_drawsector(daposx, daposy, daposz, daang, dahoriz, i);
|
|
|
|
i++;
|
|
|
|
}
|
2006-08-30 23:32:39 +00:00
|
|
|
|
|
|
|
bglMatrixMode(GL_PROJECTION);
|
|
|
|
bglLoadMatrixf(polymostprojmatrix);
|
|
|
|
bglMatrixMode(GL_MODELVIEW);
|
|
|
|
bglLoadMatrixf(polymostmodelmatrix);
|
|
|
|
|
2006-08-31 01:56:43 +00:00
|
|
|
if (pr_verbosity >= 3) OSD_Printf("PR : Rooms drawn.\n");
|
2006-04-23 06:44:19 +00:00
|
|
|
}
|