mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
Polymer cliplanes and FOV.
git-svn-id: https://svn.eduke32.com/eduke32@310 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
cbade0ca16
commit
9002a68e64
6 changed files with 176 additions and 118 deletions
|
@ -433,6 +433,16 @@ long setsprite(short spritenum, long newx, long newy, long newz);
|
||||||
|
|
||||||
long screencapture(char *filename, char inverseit);
|
long screencapture(char *filename, char inverseit);
|
||||||
|
|
||||||
|
// PLAG: line utility functions
|
||||||
|
typedef struct s_equation {
|
||||||
|
float a, b, c;
|
||||||
|
} _equation;
|
||||||
|
typedef struct s_point2d {
|
||||||
|
long x, y;
|
||||||
|
} _point2d;
|
||||||
|
_equation equation(long x1, long y1, long x2, long y2);
|
||||||
|
int sameside(_equation* eq, _point2d* p1, _point2d* p2);
|
||||||
|
|
||||||
#define STATUS2DSIZ 144
|
#define STATUS2DSIZ 144
|
||||||
void qsetmode640350(void);
|
void qsetmode640350(void);
|
||||||
void qsetmode640480(void);
|
void qsetmode640480(void);
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
# include "pragmas.h"
|
# include "pragmas.h"
|
||||||
|
|
||||||
// CVARS
|
// CVARS
|
||||||
|
extern unsigned int pr_fov;
|
||||||
extern char pr_verbosity;
|
extern char pr_verbosity;
|
||||||
extern char pr_wireframe;
|
extern char pr_wireframe;
|
||||||
|
|
||||||
|
@ -37,6 +38,7 @@ typedef struct s_prsector {
|
||||||
|
|
||||||
short wallcount;
|
short wallcount;
|
||||||
char invalidate;
|
char invalidate;
|
||||||
|
char drawingstate; // 0: fcuk, 1: in queue, 2: todraw, 3: drawn
|
||||||
} _prsector;
|
} _prsector;
|
||||||
|
|
||||||
typedef struct s_prwall {
|
typedef struct s_prwall {
|
||||||
|
@ -51,6 +53,12 @@ typedef struct s_prwall {
|
||||||
char invalidate;
|
char invalidate;
|
||||||
} _prwall;
|
} _prwall;
|
||||||
|
|
||||||
|
typedef struct s_cliplane {
|
||||||
|
_equation left, right, clip;
|
||||||
|
_point2d ref;
|
||||||
|
char clipsign;
|
||||||
|
} _cliplane;
|
||||||
|
|
||||||
extern _prsector* prsectors[MAXSECTORS];
|
extern _prsector* prsectors[MAXSECTORS];
|
||||||
extern _prwall* prwalls[MAXWALLS];
|
extern _prwall* prwalls[MAXWALLS];
|
||||||
|
|
||||||
|
@ -59,6 +67,9 @@ int polymer_init(void);
|
||||||
void polymer_glinit(void);
|
void polymer_glinit(void);
|
||||||
void polymer_loadboard(void);
|
void polymer_loadboard(void);
|
||||||
void polymer_drawrooms(long daposx, long daposy, long daposz, short daang, long dahoriz, short dacursectnum, int root);
|
void polymer_drawrooms(long daposx, long daposy, long daposz, short daang, long dahoriz, short dacursectnum, int root);
|
||||||
|
void polymer_rotatesprite(long sx, long sy, long z, short a, short picnum, signed char dashade, char dapalnum, char dastat, long cx1, long cy1, long cx2, long cy2);
|
||||||
|
void polymer_drawmaskwall(long damaskwallcnt);
|
||||||
|
void polymer_drawsprite(long snum);
|
||||||
// SECTOR MANAGEMENT
|
// SECTOR MANAGEMENT
|
||||||
int polymer_initsector(short sectnum);
|
int polymer_initsector(short sectnum);
|
||||||
int polymer_updatesector(short sectnum);
|
int polymer_updatesector(short sectnum);
|
||||||
|
@ -67,10 +78,12 @@ void PR_CALLBACK polymer_tesserror(GLenum error);
|
||||||
void PR_CALLBACK polymer_tessedgeflag(GLenum error);
|
void PR_CALLBACK polymer_tessedgeflag(GLenum error);
|
||||||
void PR_CALLBACK polymer_tessvertex(void* vertex, void* sector);
|
void PR_CALLBACK polymer_tessvertex(void* vertex, void* sector);
|
||||||
int polymer_buildfloor(short sectnum);
|
int polymer_buildfloor(short sectnum);
|
||||||
void polymer_drawsector(long daposx, long daposy, long daposz, short daang, long dahoriz, short sectnum, int root);
|
void polymer_drawsector(short sectnum);
|
||||||
// WALL MANAGEMENT
|
// WALL MANAGEMENT
|
||||||
int polymer_initwall(short wallnum);
|
int polymer_initwall(short wallnum);
|
||||||
void polymer_updatewall(short wallnum);
|
void polymer_updatewall(short wallnum);
|
||||||
void polymer_drawwall(short wallnum);
|
void polymer_drawwall(short wallnum);
|
||||||
|
// HSR
|
||||||
|
int wallincliplane(short wallnum, _cliplane* cliplane);
|
||||||
|
|
||||||
#endif // !_polymer_h_
|
#endif // !_polymer_h_
|
||||||
|
|
|
@ -3123,13 +3123,14 @@ static void drawsprite(long snum)
|
||||||
|
|
||||||
//============================================================================= //POLYMOST BEGINS
|
//============================================================================= //POLYMOST BEGINS
|
||||||
#ifdef POLYMOST
|
#ifdef POLYMOST
|
||||||
if (rendmode) {
|
if (rendmode == 3) {
|
||||||
polymost_drawsprite(snum);
|
polymost_drawsprite(snum);
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
bglDepthMask(1);
|
bglDepthMask(1);
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (rendmode == 4) { polymer_drawsprite(snum); return; }
|
||||||
#endif
|
#endif
|
||||||
//============================================================================= //POLYMOST ENDS
|
//============================================================================= //POLYMOST ENDS
|
||||||
|
|
||||||
|
@ -4045,7 +4046,8 @@ static void drawmaskwall(short damaskwallcnt)
|
||||||
|
|
||||||
//============================================================================= //POLYMOST BEGINS
|
//============================================================================= //POLYMOST BEGINS
|
||||||
#ifdef POLYMOST
|
#ifdef POLYMOST
|
||||||
if (rendmode) { polymost_drawmaskwall(damaskwallcnt); return; }
|
if (rendmode == 3) { polymost_drawmaskwall(damaskwallcnt); return; }
|
||||||
|
if (rendmode == 4) { polymer_drawmaskwall(damaskwallcnt); return; }
|
||||||
#endif
|
#endif
|
||||||
//============================================================================= //POLYMOST ENDS
|
//============================================================================= //POLYMOST ENDS
|
||||||
|
|
||||||
|
@ -4523,7 +4525,8 @@ static void dorotatesprite(long sx, long sy, long z, short a, short picnum, sign
|
||||||
|
|
||||||
//============================================================================= //POLYMOST BEGINS
|
//============================================================================= //POLYMOST BEGINS
|
||||||
#ifdef POLYMOST
|
#ifdef POLYMOST
|
||||||
if (rendmode) { polymost_dorotatesprite(sx,sy,z,a,picnum,dashade,dapalnum,dastat,cx1,cy1,cx2,cy2,uniqid); return; }
|
if (rendmode >= 3) { polymost_dorotatesprite(sx,sy,z,a,picnum,dashade,dapalnum,dastat,cx1,cy1,cx2,cy2,uniqid); return; }
|
||||||
|
if (rendmode == 4) { polymer_rotatesprite(sx,sy,z,a,picnum,dashade,dapalnum,dastat,cx1,cy1,cx2,cy2); return; }
|
||||||
#endif
|
#endif
|
||||||
//============================================================================= //POLYMOST ENDS
|
//============================================================================= //POLYMOST ENDS
|
||||||
|
|
||||||
|
@ -5788,14 +5791,6 @@ void drawrooms(long daposx, long daposy, long daposz,
|
||||||
}
|
}
|
||||||
|
|
||||||
// UTILITY TYPES AND FUNCTIONS FOR DRAWMASKS OCCLUSION TREE
|
// UTILITY TYPES AND FUNCTIONS FOR DRAWMASKS OCCLUSION TREE
|
||||||
typedef struct s_point2d {
|
|
||||||
long x, y;
|
|
||||||
} _point2d;
|
|
||||||
|
|
||||||
typedef struct s_equation {
|
|
||||||
float a, b, c;
|
|
||||||
} _equation;
|
|
||||||
|
|
||||||
typedef struct s_maskleaf {
|
typedef struct s_maskleaf {
|
||||||
long index;
|
long index;
|
||||||
_point2d p1, p2;
|
_point2d p1, p2;
|
||||||
|
@ -7403,10 +7398,12 @@ if (searchx < 0) { searchx = halfxdimen; searchy = (ydimen>>1); }
|
||||||
|
|
||||||
#if defined(POLYMOST) && defined(USE_OPENGL)
|
#if defined(POLYMOST) && defined(USE_OPENGL)
|
||||||
if (rendmode == 3)
|
if (rendmode == 3)
|
||||||
|
{
|
||||||
polymost_glinit();
|
polymost_glinit();
|
||||||
else if (rendmode == 4)
|
polymost_glreset();
|
||||||
|
}
|
||||||
|
if (rendmode == 4)
|
||||||
polymer_glinit();
|
polymer_glinit();
|
||||||
polymost_glreset();
|
|
||||||
#endif
|
#endif
|
||||||
qsetmode = 200;
|
qsetmode = 200;
|
||||||
return(0);
|
return(0);
|
||||||
|
|
|
@ -3,15 +3,15 @@
|
||||||
#include "polymer.h"
|
#include "polymer.h"
|
||||||
|
|
||||||
// CVARS
|
// CVARS
|
||||||
char pr_verbosity = 1; // 0: silent, 1: errors and one-times, 2: multiple-times, 3: flood
|
unsigned int pr_fov = 340; // 60 degrees, appears to be the classic setting.
|
||||||
char pr_wireframe = 0;
|
char pr_verbosity = 1; // 0: silent, 1: errors and one-times, 2: multiple-times, 3: flood
|
||||||
|
char pr_wireframe = 0;
|
||||||
|
|
||||||
// DATA
|
// DATA
|
||||||
_prsector *prsectors[MAXSECTORS];
|
_prsector *prsectors[MAXSECTORS];
|
||||||
_prwall *prwalls[MAXWALLS];
|
_prwall *prwalls[MAXWALLS];
|
||||||
|
|
||||||
float polymostprojmatrix[16];
|
_cliplane cliplane;
|
||||||
float polymostmodelmatrix[16];
|
|
||||||
|
|
||||||
GLUtesselator* prtess;
|
GLUtesselator* prtess;
|
||||||
int tempverticescount;
|
int tempverticescount;
|
||||||
|
@ -53,30 +53,15 @@ int polymer_init(void)
|
||||||
|
|
||||||
void polymer_glinit(void)
|
void polymer_glinit(void)
|
||||||
{
|
{
|
||||||
GLfloat params[4];
|
|
||||||
|
|
||||||
bglGetFloatv(GL_PROJECTION_MATRIX, polymostprojmatrix);
|
|
||||||
bglGetFloatv(GL_MODELVIEW_MATRIX, polymostmodelmatrix);
|
|
||||||
bglClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
bglClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||||
bglClearStencil(0);
|
bglClearStencil(0);
|
||||||
bglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
bglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||||
bglViewport(0, 0, 1024, 768);
|
bglViewport(0, 0, xdim, ydim);
|
||||||
|
|
||||||
// texturing
|
// texturing
|
||||||
bglEnable(GL_TEXTURE_2D);
|
bglEnable(GL_TEXTURE_2D);
|
||||||
bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
|
bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
|
||||||
bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);
|
bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);
|
||||||
/*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);*/
|
|
||||||
|
|
||||||
bglDisable(GL_FOG);
|
bglDisable(GL_FOG);
|
||||||
bglEnable(GL_DEPTH_TEST);
|
bglEnable(GL_DEPTH_TEST);
|
||||||
|
@ -87,7 +72,8 @@ void polymer_glinit(void)
|
||||||
|
|
||||||
bglMatrixMode(GL_PROJECTION);
|
bglMatrixMode(GL_PROJECTION);
|
||||||
bglLoadIdentity();
|
bglLoadIdentity();
|
||||||
bglFrustum(-1.0f, 1.0f, -0.75f, 0.75, 1.0f, 1000000.0f);
|
gluPerspective((float)(pr_fov) / (2048.0f / 360.0f), (float)xdim / (float)ydim, 1.0f, 1000000.0f);
|
||||||
|
|
||||||
bglMatrixMode(GL_MODELVIEW);
|
bglMatrixMode(GL_MODELVIEW);
|
||||||
bglLoadIdentity();
|
bglLoadIdentity();
|
||||||
|
|
||||||
|
@ -123,25 +109,120 @@ void polymer_loadboard(void)
|
||||||
}
|
}
|
||||||
void polymer_drawrooms(long daposx, long daposy, long daposz, short daang, long dahoriz, short dacursectnum, int root)
|
void polymer_drawrooms(long daposx, long daposy, long daposz, short daang, long dahoriz, short dacursectnum, int root)
|
||||||
{
|
{
|
||||||
int i;
|
int i, j;
|
||||||
|
float ang, horizang, tiltang;
|
||||||
|
double pos[3];
|
||||||
|
_point2d ref;
|
||||||
|
sectortype *sec;
|
||||||
|
walltype *wal;
|
||||||
|
short drawnsectors, fov;
|
||||||
|
|
||||||
if (pr_verbosity >= 3) OSD_Printf("PR : Drawing rooms...\n");
|
if (pr_verbosity >= 3) OSD_Printf("PR : Drawing rooms...\n");
|
||||||
|
|
||||||
|
OSD_Printf("PR : %d\n", dahoriz);
|
||||||
|
|
||||||
|
ang = (float)(daang) / (2048.0f / 360.0f);
|
||||||
|
horizang = (float)(100 - dahoriz) / (512.0f / 180.0f);
|
||||||
|
tiltang = (gtang * 90.0f);
|
||||||
|
fov = (pr_fov * (float)xdim / (float)ydim * 1) / 2;
|
||||||
|
|
||||||
|
// FOV cliplane
|
||||||
|
rotatepoint(daposx, daposy, daposx, daposy - 1000, daang, &ref.x, &ref.y);
|
||||||
|
cliplane.clip = equation(daposx, daposy, ref.x, ref.y);
|
||||||
|
rotatepoint(daposx, daposy, daposx, daposy - 1000, (daang + 512 - fov) & 2047, &ref.x, &ref.y);
|
||||||
|
cliplane.left = equation(daposx, daposy, ref.x, ref.y);
|
||||||
|
rotatepoint(daposx, daposy, daposx, daposy - 1000, (daang + 512 + fov) & 2047, &ref.x, &ref.y);
|
||||||
|
cliplane.right = equation(daposx, daposy, ref.x, ref.y);
|
||||||
|
rotatepoint(daposx, daposy, daposx, daposy - 1000, (daang + 512) & 2047, &ref.x, &ref.y);
|
||||||
|
cliplane.ref = ref;
|
||||||
|
cliplane.clipsign = 1;
|
||||||
|
|
||||||
|
pos[0] = -daposy;
|
||||||
|
pos[1] = daposz;
|
||||||
|
pos[2] = daposx;
|
||||||
|
|
||||||
|
bglMatrixMode(GL_MODELVIEW);
|
||||||
|
bglLoadIdentity();
|
||||||
|
|
||||||
|
bglRotatef(horizang, 1.0f, 0.0f, 0.0f);
|
||||||
|
bglRotatef(ang, 0.0f, 1.0f, 0.0f);
|
||||||
|
bglRotatef(tiltang, 0.0f, 0.0f, -1.0f);
|
||||||
|
|
||||||
|
bglScalef(1.0f, 1.0f / 16.0f, 1.0f);
|
||||||
|
bglTranslatef(pos[0], pos[1], pos[2]);
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < numsectors)
|
while (i < numsectors)
|
||||||
{
|
{
|
||||||
polymer_drawsector(daposx, daposy, daposz, daang, dahoriz, i, 0);
|
if (prsectors[i])
|
||||||
|
{
|
||||||
|
if (i == dacursectnum)
|
||||||
|
prsectors[i]->drawingstate = 2;
|
||||||
|
else
|
||||||
|
prsectors[i]->drawingstate = 0;
|
||||||
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
bglMatrixMode(GL_PROJECTION);
|
drawnsectors = 1;
|
||||||
bglLoadMatrixf(polymostprojmatrix);
|
while (drawnsectors > 0)
|
||||||
bglMatrixMode(GL_MODELVIEW);
|
{
|
||||||
bglLoadMatrixf(polymostmodelmatrix);
|
drawnsectors = 0;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
while (i < numsectors)
|
||||||
|
{
|
||||||
|
if (prsectors[i] && prsectors[i]->drawingstate == 2)
|
||||||
|
{
|
||||||
|
polymer_drawsector(i);
|
||||||
|
|
||||||
|
sec = §or[i];
|
||||||
|
wal = &wall[sec->wallptr];
|
||||||
|
|
||||||
|
j = 0;
|
||||||
|
while (j < sec->wallnum)
|
||||||
|
{
|
||||||
|
if (wallincliplane(sec->wallptr + j, &cliplane))
|
||||||
|
{
|
||||||
|
polymer_drawwall(sec->wallptr + j);
|
||||||
|
if ((wal->nextsector != -1) && (prsectors[wal->nextsector]->drawingstate == 0))
|
||||||
|
prsectors[wal->nextsector]->drawingstate = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
j++;
|
||||||
|
wal = &wall[sec->wallptr + j];
|
||||||
|
}
|
||||||
|
|
||||||
|
prsectors[i]->drawingstate = 3;
|
||||||
|
drawnsectors++;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
while (i < numsectors)
|
||||||
|
{
|
||||||
|
if (prsectors[i] && prsectors[i]->drawingstate == 1)
|
||||||
|
prsectors[i]->drawingstate = 2;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (pr_verbosity >= 3) OSD_Printf("PR : Rooms drawn.\n");
|
if (pr_verbosity >= 3) OSD_Printf("PR : Rooms drawn.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void polymer_rotatesprite(long sx, long sy, long z, short a, short picnum, signed char dashade, char dapalnum, char dastat, long cx1, long cy1, long cx2, long cy2)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void polymer_drawmaskwall(long damaskwallcnt)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void polymer_drawsprite(long snum)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
// SECTOR MANAGEMENT
|
// SECTOR MANAGEMENT
|
||||||
int polymer_initsector(short sectnum)
|
int polymer_initsector(short sectnum)
|
||||||
{
|
{
|
||||||
|
@ -414,13 +495,11 @@ int polymer_buildfloor(short sectnum)
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void polymer_drawsector(long daposx, long daposy, long daposz, short daang, long dahoriz, short sectnum, int root)
|
void polymer_drawsector(short sectnum)
|
||||||
{
|
{
|
||||||
sectortype *sec, *nextsec;
|
sectortype *sec, *nextsec;
|
||||||
walltype *wal;
|
walltype *wal;
|
||||||
_prsector* s;
|
_prsector* s;
|
||||||
float ang, horizang, tiltang;
|
|
||||||
double pos[3];
|
|
||||||
int i;
|
int i;
|
||||||
long zdiff;
|
long zdiff;
|
||||||
|
|
||||||
|
@ -436,7 +515,7 @@ void polymer_drawsector(long daposx, long daposy, long daposz, sh
|
||||||
polymer_updatesector(sectnum);
|
polymer_updatesector(sectnum);
|
||||||
polymer_buildfloor(sectnum);
|
polymer_buildfloor(sectnum);
|
||||||
}
|
}
|
||||||
else if (prsectors[sectnum]->invalidate || 0)
|
else if (prsectors[sectnum]->invalidate || 1)
|
||||||
{
|
{
|
||||||
if (pr_verbosity >= 2) OSD_Printf("PR : Sector %i invalidated. Tesselating...\n", sectnum);
|
if (pr_verbosity >= 2) OSD_Printf("PR : Sector %i invalidated. Tesselating...\n", sectnum);
|
||||||
polymer_updatesector(sectnum);
|
polymer_updatesector(sectnum);
|
||||||
|
@ -450,72 +529,14 @@ void polymer_drawsector(long daposx, long daposy, long daposz, sh
|
||||||
prsectors[sectnum]->invalidate = 0;
|
prsectors[sectnum]->invalidate = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ang = (float)(daang) / (2048.0f / 360.0f);
|
|
||||||
horizang = (float)(100 - dahoriz) / (256.0f / 90.0f);
|
|
||||||
tiltang = (gtang * 90.0f);
|
|
||||||
|
|
||||||
pos[0] = -daposy;
|
|
||||||
pos[1] = daposz;
|
|
||||||
pos[2] = daposx;
|
|
||||||
|
|
||||||
bglMatrixMode(GL_MODELVIEW);
|
|
||||||
bglLoadIdentity();
|
|
||||||
|
|
||||||
bglRotatef(horizang, 1.0f, 0.0f, 0.0f);
|
|
||||||
bglRotatef(ang, 0.0f, 1.0f, 0.0f);
|
|
||||||
bglRotatef(tiltang, 0.0f, 0.0f, -1.0f);
|
|
||||||
|
|
||||||
bglScalef(1.0f, 1.0f / 16.0f, 1.0f);
|
|
||||||
bglTranslatef(pos[0], pos[1], pos[2]);
|
|
||||||
|
|
||||||
bglEnable(GL_TEXTURE_2D);
|
|
||||||
|
|
||||||
// floor
|
// floor
|
||||||
if (!(sec->floorstat & 1))
|
if (!(sec->floorstat & 1))
|
||||||
{
|
{
|
||||||
if (root)
|
bglBindTexture(GL_TEXTURE_2D, s->floorglpic);
|
||||||
{
|
bglColor4f(s->floorcolor[0], s->floorcolor[1], s->floorcolor[2], s->floorcolor[3]);
|
||||||
bglDisable(GL_TEXTURE_2D);
|
bglVertexPointer(3, GL_FLOAT, 5 * sizeof(GLfloat), s->floorbuffer);
|
||||||
bglColorMask(0, 0, 0, 0);
|
bglTexCoordPointer(2, GL_FLOAT, 5 * sizeof(GLfloat), &s->floorbuffer[3]);
|
||||||
bglEnable(GL_STENCIL_TEST);
|
bglDrawElements(GL_TRIANGLES, s->indicescount, GL_UNSIGNED_SHORT, s->floorindices);
|
||||||
|
|
||||||
bglStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
|
|
||||||
bglStencilFunc(GL_ALWAYS, 1, 1);
|
|
||||||
|
|
||||||
bglVertexPointer(3, GL_FLOAT, 5 * sizeof(GLfloat), s->floorbuffer);
|
|
||||||
bglTexCoordPointer(2, GL_FLOAT, 5 * sizeof(GLfloat), &s->floorbuffer[3]);
|
|
||||||
bglDrawElements(GL_TRIANGLES, s->indicescount, GL_UNSIGNED_SHORT, s->floorindices);
|
|
||||||
|
|
||||||
bglStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
|
|
||||||
bglStencilFunc(GL_EQUAL, 1, 1);
|
|
||||||
bglColorMask(1, 1, 1, 1);
|
|
||||||
bglEnable(GL_TEXTURE_2D);
|
|
||||||
|
|
||||||
//bglDepthMask(0);
|
|
||||||
polymer_drawrooms(daposx, daposy, daposz - ((daposz - sec->floorz) * 2), daang, dahoriz, sectnum, 0);
|
|
||||||
//bglDepthMask(1);
|
|
||||||
|
|
||||||
bglDisable(GL_STENCIL_TEST);
|
|
||||||
bglEnable(GL_BLEND);
|
|
||||||
bglBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
|
|
||||||
|
|
||||||
bglBindTexture(GL_TEXTURE_2D, s->floorglpic);
|
|
||||||
bglColor4f(s->floorcolor[0], s->floorcolor[1], s->floorcolor[2], 0.5f);
|
|
||||||
bglVertexPointer(3, GL_FLOAT, 5 * sizeof(GLfloat), s->floorbuffer);
|
|
||||||
bglTexCoordPointer(2, GL_FLOAT, 5 * sizeof(GLfloat), &s->floorbuffer[3]);
|
|
||||||
bglDrawElements(GL_TRIANGLES, s->indicescount, GL_UNSIGNED_SHORT, s->floorindices);
|
|
||||||
|
|
||||||
bglDisable(GL_BLEND);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bglBindTexture(GL_TEXTURE_2D, s->floorglpic);
|
|
||||||
bglColor4f(s->floorcolor[0], s->floorcolor[1], s->floorcolor[2], s->floorcolor[3]);
|
|
||||||
bglVertexPointer(3, GL_FLOAT, 5 * sizeof(GLfloat), s->floorbuffer);
|
|
||||||
bglTexCoordPointer(2, GL_FLOAT, 5 * sizeof(GLfloat), &s->floorbuffer[3]);
|
|
||||||
bglDrawElements(GL_TRIANGLES, s->indicescount, GL_UNSIGNED_SHORT, s->floorindices);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ceiling
|
// ceiling
|
||||||
|
@ -528,16 +549,6 @@ void polymer_drawsector(long daposx, long daposy, long daposz, sh
|
||||||
bglDrawElements(GL_TRIANGLES, s->indicescount, GL_UNSIGNED_SHORT, s->ceilindices);
|
bglDrawElements(GL_TRIANGLES, s->indicescount, GL_UNSIGNED_SHORT, s->ceilindices);
|
||||||
}
|
}
|
||||||
|
|
||||||
// walls
|
|
||||||
i = 0;
|
|
||||||
while (i < sec->wallnum)
|
|
||||||
{
|
|
||||||
polymer_drawwall(sec->wallptr + i);
|
|
||||||
|
|
||||||
i++;
|
|
||||||
wal = &wall[sec->wallptr + i];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pr_verbosity >= 3) OSD_Printf("PR : Finished drawing sector %i...\n", sectnum);
|
if (pr_verbosity >= 3) OSD_Printf("PR : Finished drawing sector %i...\n", sectnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -771,3 +782,29 @@ void polymer_drawwall(short wallnum)
|
||||||
|
|
||||||
if (pr_verbosity >= 3) OSD_Printf("PR : Finished drawing wall %i...\n", wallnum);
|
if (pr_verbosity >= 3) OSD_Printf("PR : Finished drawing wall %i...\n", wallnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HSR
|
||||||
|
int wallincliplane(short wallnum, _cliplane* cliplane)
|
||||||
|
{
|
||||||
|
walltype *wal;
|
||||||
|
_point2d p1, p2;
|
||||||
|
|
||||||
|
wal = &wall[wallnum];
|
||||||
|
|
||||||
|
p1.x = wal->x;
|
||||||
|
p1.y = wal->y;
|
||||||
|
|
||||||
|
p2.x = wall[wal->point2].x;
|
||||||
|
p2.y = wall[wal->point2].y;
|
||||||
|
|
||||||
|
if ((sameside(&cliplane->clip, &cliplane->ref, &p1) != cliplane->clipsign) && (sameside(&cliplane->clip, &cliplane->ref, &p2) != cliplane->clipsign))
|
||||||
|
return (0);
|
||||||
|
|
||||||
|
/*if ((sameside(&cliplane->left, &cliplane->ref, &p1) == 0) && (sameside(&cliplane->left, &cliplane->ref, &p2) == 0))
|
||||||
|
return (0);
|
||||||
|
|
||||||
|
if ((sameside(&cliplane->right, &cliplane->ref, &p1) == 0) && (sameside(&cliplane->right, &cliplane->ref, &p2) == 0))
|
||||||
|
return (0);*/
|
||||||
|
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
|
|
|
@ -472,6 +472,7 @@ struct cvarmappings {
|
||||||
{ "r_anamorphic", "r_anamorphic: enable/disable widescreen mode", (void*)&glwidescreen, CVAR_BOOL, 0, 0, 1 },
|
{ "r_anamorphic", "r_anamorphic: enable/disable widescreen mode", (void*)&glwidescreen, CVAR_BOOL, 0, 0, 1 },
|
||||||
{ "r_projectionhack", "r_projectionhack: enable/disable projection hack", (void*)&glprojectionhacks, CVAR_BOOL, 0, 0, 1 },
|
{ "r_projectionhack", "r_projectionhack: enable/disable projection hack", (void*)&glprojectionhacks, CVAR_BOOL, 0, 0, 1 },
|
||||||
// polymer cvars
|
// polymer cvars
|
||||||
|
{ "pr_fov", "pr_fov: sets the field of vision in build angle", (void*)&pr_fov, CVAR_UNSIGNEDINT, 0, 0, 1024},
|
||||||
{ "pr_verbosity", "pr_verbosity: verbosity level of the polymer renderer", (void*)&pr_verbosity, CVAR_INT, 0, 0, 3 },
|
{ "pr_verbosity", "pr_verbosity: verbosity level of the polymer renderer", (void*)&pr_verbosity, CVAR_INT, 0, 0, 3 },
|
||||||
{ "pr_wireframe", "pr_wireframe: toggles wireframe mode", (void*)&pr_wireframe, CVAR_BOOL, 0, 0, 1 },
|
{ "pr_wireframe", "pr_wireframe: toggles wireframe mode", (void*)&pr_wireframe, CVAR_BOOL, 0, 0, 1 },
|
||||||
#endif
|
#endif
|
||||||
|
|
Binary file not shown.
Loading…
Reference in a new issue