Broken depth peeling.

git-svn-id: https://svn.eduke32.com/eduke32@439 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
Plagman 2006-12-31 06:32:04 +00:00
parent f74c413b68
commit 08e4113086
8 changed files with 306 additions and 25 deletions

View file

@ -94,6 +94,8 @@ extern void (APIENTRY * bglGenTextures)( GLsizei n, GLuint *textures ); // 1.1
extern void (APIENTRY * bglDeleteTextures)( GLsizei n, const GLuint *textures); // 1.1 extern void (APIENTRY * bglDeleteTextures)( GLsizei n, const GLuint *textures); // 1.1
extern void (APIENTRY * bglBindTexture)( GLenum target, GLuint texture ); // 1.1 extern void (APIENTRY * bglBindTexture)( GLenum target, GLuint texture ); // 1.1
extern void (APIENTRY * bglTexImage2D)( GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ); extern void (APIENTRY * bglTexImage2D)( GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels );
extern void (APIENTRY * bglCopyTexImage2D)( GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border );
extern void (APIENTRY * bglCopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
extern void (APIENTRY * bglTexSubImage2D)( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ); // 1.1 extern void (APIENTRY * bglTexSubImage2D)( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ); // 1.1
extern void (APIENTRY * bglTexParameterf)( GLenum target, GLenum pname, GLfloat param ); extern void (APIENTRY * bglTexParameterf)( GLenum target, GLenum pname, GLfloat param );
extern void (APIENTRY * bglTexParameteri)( GLenum target, GLenum pname, GLint param ); extern void (APIENTRY * bglTexParameteri)( GLenum target, GLenum pname, GLint param );
@ -111,6 +113,7 @@ extern void (APIENTRY * bglFogfv)( GLenum pname, const GLfloat *params );
extern void (APIENTRY * bglNewList)(GLuint list, GLenum mode); extern void (APIENTRY * bglNewList)(GLuint list, GLenum mode);
extern void (APIENTRY * bglEndList)(void); extern void (APIENTRY * bglEndList)(void);
extern void (APIENTRY * bglCallList)(GLuint list); extern void (APIENTRY * bglCallList)(GLuint list);
extern void (APIENTRY * bglDeleteLists)(GLuint list, GLsizei range);
// Vertex Arrays // Vertex Arrays
extern void (APIENTRY * bglEnableClientState)(GLenum cap); extern void (APIENTRY * bglEnableClientState)(GLenum cap);
@ -125,6 +128,14 @@ extern void (APIENTRY * bglClearStencil)(GLint s);
extern void (APIENTRY * bglStencilOp)(GLenum fail, GLenum zfail, GLenum zpass); extern void (APIENTRY * bglStencilOp)(GLenum fail, GLenum zfail, GLenum zpass);
extern void (APIENTRY * bglStencilFunc)(GLenum func, GLint ref, GLuint mask); extern void (APIENTRY * bglStencilFunc)(GLenum func, GLint ref, GLuint mask);
// GPU Programs
extern void (APIENTRY * bglGenProgramsARB)(GLsizei, GLuint *);
extern void (APIENTRY * bglBindProgramARB)(GLenum, GLuint);
extern void (APIENTRY * bglProgramStringARB)(GLenum, GLenum, GLsizei, const GLvoid *);
// Multitexturing
extern void (APIENTRY * bglActiveTextureARB)(GLenum texture);
#ifdef RENDERTYPEWIN #ifdef RENDERTYPEWIN
// Windows // Windows
extern HGLRC (WINAPI * bwglCreateContext)(HDC); extern HGLRC (WINAPI * bwglCreateContext)(HDC);

View file

@ -3153,7 +3153,7 @@ static void drawsprite(long snum)
if (rendmode == 3) { if (rendmode == 3) {
polymost_drawsprite(snum); polymost_drawsprite(snum);
#ifdef USE_OPENGL #ifdef USE_OPENGL
bglDepthMask(1); //bglDepthMask(1);
#endif #endif
return; return;
} }
@ -5951,6 +5951,21 @@ int sameside(_equation* eq, _point2d* p1, _point2d* p2)
return (0); return (0);
} }
void drawpeel(int peel)
{
bglBindTexture(GL_TEXTURE_RECTANGLE_NV, peels[peel]);
bglBegin(GL_QUADS);
bglTexCoord2f(0.0f, 0.0f);
bglVertex2f(-1.0f, -1.0f);
bglTexCoord2f(xdim, 0.0f);
bglVertex2f(1.0f, -1.0f);
bglTexCoord2f(xdim, ydim);
bglVertex2f(1.0f, 1.0f);
bglTexCoord2f(0.0f, ydim);
bglVertex2f(-1.0f, 1.0f);
bglEnd();
}
// //
// drawmasks // drawmasks
// //
@ -5987,6 +6002,8 @@ killsprite:
spritesy[i] = yp; spritesy[i] = yp;
} }
if (!usegoodalpha)
{
gap = 1; while (gap < spritesortcnt) gap = (gap<<1)+1; gap = 1; while (gap < spritesortcnt) gap = (gap<<1)+1;
for (gap>>=1;gap>0;gap>>=1) //Sort sprite list for (gap>>=1;gap>0;gap>>=1) //Sort sprite list
for (i=0;i<spritesortcnt-gap;i++) for (i=0;i<spritesortcnt-gap;i++)
@ -6040,7 +6057,13 @@ killsprite:
} }
i = j; i = j;
} }
}
if (usegoodalpha)
{
bglNewList(1, GL_COMPILE);
peelcompiling = 1;
}
begindrawing(); //{{{ begindrawing(); //{{{
/*for(i=spritesortcnt-1;i>=0;i--) /*for(i=spritesortcnt-1;i>=0;i--)
@ -6061,7 +6084,8 @@ killsprite:
}*/ }*/
#if 0 if (!usegoodalpha)
{
{ // Removing previous sorting code { // Removing previous sorting code
#ifdef POLYMOST #ifdef POLYMOST
//Hack to make it draw all opaque quads first. This should reduce the chances of //Hack to make it draw all opaque quads first. This should reduce the chances of
@ -6147,7 +6171,9 @@ killsprite:
while (spritesortcnt > 0) drawsprite(--spritesortcnt); while (spritesortcnt > 0) drawsprite(--spritesortcnt);
while (maskwallcnt > 0) drawmaskwall(--maskwallcnt); while (maskwallcnt > 0) drawmaskwall(--maskwallcnt);
} }
#else }
else
{
// PLAG : The heart of good transparency -> sorted rendering on all layers. // PLAG : The heart of good transparency -> sorted rendering on all layers.
// that's why this code interleaves the drawing of all possible transparent entities // that's why this code interleaves the drawing of all possible transparent entities
// bubblesort is used, shouldn't cause any problems cpu-wise since the lists are small // bubblesort is used, shouldn't cause any problems cpu-wise since the lists are small
@ -6252,7 +6278,7 @@ killsprite:
free(indexes); free(indexes);
free(depths);*/ free(depths);*/
pos.x = globalposx; /*pos.x = globalposx;
pos.y = globalposy; pos.y = globalposy;
//OSD_Printf("EIN OBSERVER POSITION : x=%i y=%i\n", pos.x, pos.y); //OSD_Printf("EIN OBSERVER POSITION : x=%i y=%i\n", pos.x, pos.y);
@ -6307,13 +6333,103 @@ killsprite:
spritesortcnt--; spritesortcnt--;
if (tspriteptr[spritesortcnt] != NULL) if (tspriteptr[spritesortcnt] != NULL)
drawsprite(spritesortcnt); drawsprite(spritesortcnt);
} }*/
#endif /* goodalpha */
while (spritesortcnt > 0) drawsprite(--spritesortcnt);
while (maskwallcnt > 0) drawmaskwall(--maskwallcnt);
} /* goodalpha */
indrawroomsandmasks = 0; indrawroomsandmasks = 0;
enddrawing(); //}}} enddrawing(); //}}}
} if (usegoodalpha)
{
bglEndList();
peelcompiling = 0;
bglDisable(GL_BLEND);
bglEnable(GL_ALPHA_TEST);
bglAlphaFunc(GL_GREATER, 0.0f);
i = 0;
while (i < numpeels)
{
if (i > 0)
{
bglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
bglEnable(GL_FRAGMENT_PROGRAM_ARB);
bglActiveTextureARB(GL_TEXTURE1_ARB);
bglEnable(GL_TEXTURE_RECTANGLE_NV);
bglBindTexture(GL_TEXTURE_RECTANGLE_NV, ztexture);
bglActiveTextureARB(GL_TEXTURE0_ARB);
}
bglCallList(1);
if (i > 0)
{
bglActiveTextureARB(GL_TEXTURE1_ARB);
bglDisable(GL_TEXTURE_RECTANGLE_NV);
bglActiveTextureARB(GL_TEXTURE0_ARB);
bglDisable(GL_FRAGMENT_PROGRAM_ARB);
}
// save output to a peel
bglBindTexture(GL_TEXTURE_RECTANGLE_NV, peels[i]);
bglCopyTexSubImage2D(GL_TEXTURE_RECTANGLE_NV, 0, 0, 0, 0, 0, xdim, ydim);
if (i < (numpeels - 1))
{
// save depth buffer
bglBindTexture(GL_TEXTURE_RECTANGLE_NV, ztexture);
bglCopyTexSubImage2D(GL_TEXTURE_RECTANGLE_NV, 0, 0, 0, 0, 0, xdim, ydim);
}
i++;
}
bglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
bglEnable(GL_BLEND);
bglDisable(GL_ALPHA_TEST);
bglDisable(GL_DEPTH_TEST);
bglColor4f(1.0f, 1.0f, 1.0f, 1.0f);
// identity for screen aligned quads
bglMatrixMode(GL_PROJECTION);
bglPushMatrix();
bglLoadIdentity();
bglMatrixMode(GL_MODELVIEW);
bglPushMatrix();
bglLoadIdentity();
bglEnable(GL_TEXTURE_RECTANGLE_NV);
if (curpeel == -1)
{
i = numpeels - 1;
while (i >= 0)
drawpeel(i--);
}
else
drawpeel(curpeel);
bglDisable(GL_TEXTURE_RECTANGLE_NV);
bglEnable(GL_TEXTURE_2D);
// restore the polymost projection
bglMatrixMode(GL_PROJECTION);
bglPopMatrix();
bglMatrixMode(GL_MODELVIEW);
bglPopMatrix();
bglEnable(GL_DEPTH_TEST);
bglDeleteLists(1, 1);
}
}
// //
// drawmapview // drawmapview

View file

@ -79,6 +79,8 @@ void (APIENTRY * bglGenTextures)( GLsizei n, GLuint *textures ); // 1.1
void (APIENTRY * bglDeleteTextures)( GLsizei n, const GLuint *textures); // 1.1 void (APIENTRY * bglDeleteTextures)( GLsizei n, const GLuint *textures); // 1.1
void (APIENTRY * bglBindTexture)( GLenum target, GLuint texture ); // 1.1 void (APIENTRY * bglBindTexture)( GLenum target, GLuint texture ); // 1.1
void (APIENTRY * bglTexImage2D)( GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ); void (APIENTRY * bglTexImage2D)( GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels );
void (APIENTRY * bglCopyTexImage2D)( GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border );
void (APIENTRY * bglCopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
void (APIENTRY * bglTexSubImage2D)( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ); // 1.1 void (APIENTRY * bglTexSubImage2D)( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ); // 1.1
void (APIENTRY * bglTexParameterf)( GLenum target, GLenum pname, GLfloat param ); void (APIENTRY * bglTexParameterf)( GLenum target, GLenum pname, GLfloat param );
void (APIENTRY * bglTexParameteri)( GLenum target, GLenum pname, GLint param ); void (APIENTRY * bglTexParameteri)( GLenum target, GLenum pname, GLint param );
@ -96,6 +98,7 @@ void (APIENTRY * bglFogfv)( GLenum pname, const GLfloat *params );
void (APIENTRY * bglNewList)(GLuint list, GLenum mode); void (APIENTRY * bglNewList)(GLuint list, GLenum mode);
void (APIENTRY * bglEndList)(void); void (APIENTRY * bglEndList)(void);
void (APIENTRY * bglCallList)(GLuint list); void (APIENTRY * bglCallList)(GLuint list);
void (APIENTRY * bglDeleteLists)(GLuint list, GLsizei range);
// Vertex Arrays // Vertex Arrays
void (APIENTRY * bglEnableClientState)(GLenum cap); void (APIENTRY * bglEnableClientState)(GLenum cap);
@ -110,6 +113,14 @@ void (APIENTRY * bglClearStencil)(GLint s);
void (APIENTRY * bglStencilOp)(GLenum fail, GLenum zfail, GLenum zpass); void (APIENTRY * bglStencilOp)(GLenum fail, GLenum zfail, GLenum zpass);
void (APIENTRY * bglStencilFunc)(GLenum func, GLint ref, GLuint mask); void (APIENTRY * bglStencilFunc)(GLenum func, GLint ref, GLuint mask);
// GPU Programs
void (APIENTRY * bglGenProgramsARB)(GLsizei, GLuint *);
void (APIENTRY * bglBindProgramARB)(GLenum, GLuint);
void (APIENTRY * bglProgramStringARB)(GLenum, GLenum, GLsizei, const GLvoid *);
// Multitexturing
void (APIENTRY * bglActiveTextureARB)(GLenum texture);
#ifdef RENDERTYPEWIN #ifdef RENDERTYPEWIN
// Windows // Windows
HGLRC (WINAPI * bwglCreateContext)(HDC); HGLRC (WINAPI * bwglCreateContext)(HDC);
@ -257,6 +268,8 @@ int loadgldriver(const char *driver)
bglDeleteTextures = GETPROC("glDeleteTextures"); bglDeleteTextures = GETPROC("glDeleteTextures");
bglBindTexture = GETPROC("glBindTexture"); bglBindTexture = GETPROC("glBindTexture");
bglTexImage2D = GETPROC("glTexImage2D"); bglTexImage2D = GETPROC("glTexImage2D");
bglCopyTexImage2D = GETPROC("glCopyTexImage2D");
bglCopyTexSubImage2D= GETPROC("glCopyTexSubImage2D");
bglTexSubImage2D = GETPROC("glTexSubImage2D"); bglTexSubImage2D = GETPROC("glTexSubImage2D");
bglTexParameterf = GETPROC("glTexParameterf"); bglTexParameterf = GETPROC("glTexParameterf");
bglTexParameteri = GETPROC("glTexParameteri"); bglTexParameteri = GETPROC("glTexParameteri");
@ -272,6 +285,7 @@ int loadgldriver(const char *driver)
bglNewList = GETPROC("glNewList"); bglNewList = GETPROC("glNewList");
bglEndList = GETPROC("glEndList"); bglEndList = GETPROC("glEndList");
bglCallList = GETPROC("glCallList"); bglCallList = GETPROC("glCallList");
bglDeleteLists = GETPROC("glDeleteLists");
// Vertex Arrays // Vertex Arrays
bglEnableClientState = GETPROC("glEnableClientState"); bglEnableClientState = GETPROC("glEnableClientState");
@ -302,6 +316,14 @@ int loadglextensions(void)
bglCompressedTexImage2DARB = GETPROCEXTSOFT("glCompressedTexImage2DARB"); bglCompressedTexImage2DARB = GETPROCEXTSOFT("glCompressedTexImage2DARB");
bglGetCompressedTexImageARB = GETPROCEXTSOFT("glGetCompressedTexImageARB"); bglGetCompressedTexImageARB = GETPROCEXTSOFT("glGetCompressedTexImageARB");
// GPU Programs
bglGenProgramsARB = GETPROCEXTSOFT("glGenProgramsARB");
bglBindProgramARB = GETPROCEXTSOFT("glBindProgramARB");
bglProgramStringARB = GETPROCEXTSOFT("glProgramStringARB");
// Multitexturing
bglActiveTextureARB = GETPROCEXTSOFT("glActiveTextureARB");
return err; return err;
} }
@ -382,6 +404,8 @@ int unloadgldriver(void)
bglDeleteTextures = NULL; bglDeleteTextures = NULL;
bglBindTexture = NULL; bglBindTexture = NULL;
bglTexImage2D = NULL; bglTexImage2D = NULL;
bglCopyTexImage2D = NULL;
bglCopyTexSubImage2D= NULL;
bglTexSubImage2D = NULL; bglTexSubImage2D = NULL;
bglTexParameterf = NULL; bglTexParameterf = NULL;
bglTexParameteri = NULL; bglTexParameteri = NULL;
@ -398,6 +422,7 @@ int unloadgldriver(void)
bglNewList = NULL; bglNewList = NULL;
bglEndList = NULL; bglEndList = NULL;
bglCallList = NULL; bglCallList = NULL;
bglDeleteLists = NULL;
// Vertex Arrays // Vertex Arrays
bglEnableClientState = NULL; bglEnableClientState = NULL;
@ -411,6 +436,14 @@ int unloadgldriver(void)
bglStencilOp = NULL; bglStencilOp = NULL;
bglStencilFunc = NULL; bglStencilFunc = NULL;
// GPU Programs
bglGenProgramsARB = NULL;
bglBindProgramARB = NULL;
bglProgramStringARB = NULL;
// Multitexturing
bglActiveTextureARB = NULL;
#ifdef RENDERTYPEWIN #ifdef RENDERTYPEWIN
bwglCreateContext = NULL; bwglCreateContext = NULL;
bwglDeleteContext = NULL; bwglDeleteContext = NULL;

View file

@ -1489,7 +1489,7 @@ if (tspr->cstat&2) { if (!(tspr->cstat&512)) pc[3] = 0.66; else pc[3] = 0.33; }
bglBindTexture(GL_TEXTURE_2D, i); bglBindTexture(GL_TEXTURE_2D, i);
//PLAG: delayed polygon-level sorted rendering //PLAG: delayed polygon-level sorted rendering
if (m->usesalpha && !(tspr->cstat & 1024)) if (m->usesalpha && !(tspr->cstat & 1024) && !usegoodalpha)
{ {
indexes = malloc(sizeof(unsigned short) * s->numtris); indexes = malloc(sizeof(unsigned short) * s->numtris);
maxdepths = malloc(sizeof(float) * s->numtris); maxdepths = malloc(sizeof(float) * s->numtris);

View file

@ -127,6 +127,10 @@ static long lastglpolygonmode = 0; //FUK
long glpolygonmode = 0; // 0:GL_FILL,1:GL_LINE,2:GL_POINT //FUK long glpolygonmode = 0; // 0:GL_FILL,1:GL_LINE,2:GL_POINT //FUK
long glwidescreen = 0; long glwidescreen = 0;
long glprojectionhacks = 1; long glprojectionhacks = 1;
long usegoodalpha = 0;
long peelcompiling = 0;
long numpeels = 10;
long curpeel = -1;
static GLuint polymosttext = 0; static GLuint polymosttext = 0;
extern char nofog; extern char nofog;
@ -594,11 +598,28 @@ void polymost_glreset ()
glox1 = -1; glox1 = -1;
} }
GLuint ztexture;
GLuint *peels;
GLuint peelprogram;
// one-time initialisation of OpenGL for polymost // one-time initialisation of OpenGL for polymost
void polymost_glinit() void polymost_glinit()
{ {
GLfloat col[4]; GLfloat col[4];
int i;
char peelprogramstring[] =
"!!ARBfp1.0\n"
"TEMP texsample;\n"
"TEMP depthresult;\n"
"TEMP tempresult;\n"
"TEX texsample, fragment.texcoord[0], texture[0], 2D;\n"
"TEX depthresult, fragment.position, texture[1], RECT;\n"
"MUL tempresult, fragment.color, texsample;\n"
"MUL tempresult.a, tempresult.a, depthresult.a;\n"
"MOV result.color, tempresult;\n"
"END\n";
bglGetIntegerv(GL_ALPHA_BITS, &i);
#if 1 #if 1
if (!Bstrcmp(glinfo.vendor, "ATI Technologies Inc.")) if (!Bstrcmp(glinfo.vendor, "ATI Technologies Inc."))
{ {
@ -630,6 +651,43 @@ void polymost_glinit()
bglHint(GL_MULTISAMPLE_FILTER_HINT_NV, glnvmultisamplehint ? GL_NICEST:GL_FASTEST); bglHint(GL_MULTISAMPLE_FILTER_HINT_NV, glnvmultisamplehint ? GL_NICEST:GL_FASTEST);
bglEnable(GL_MULTISAMPLE_ARB); bglEnable(GL_MULTISAMPLE_ARB);
} }
//depth peeling init
if (usegoodalpha)
{
// create the secondary Z-buffer
bglGenTextures(1, &ztexture);
bglBindTexture(GL_TEXTURE_RECTANGLE_NV, ztexture);
bglCopyTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_DEPTH_COMPONENT, 0, 0, xdim, ydim, 0);
bglTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
bglTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
bglTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_S, GL_CLAMP);
bglTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_T, GL_CLAMP);
bglTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB);
bglTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_COMPARE_FUNC_ARB, GL_GREATER);
bglTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_DEPTH_TEXTURE_MODE_ARB, GL_ALPHA);
// create the various peeling layers
peels = malloc(numpeels * sizeof(GLuint));
bglGenTextures(numpeels, peels);
i = 0;
while (i < numpeels)
{
bglBindTexture(GL_TEXTURE_RECTANGLE_NV, peels[i]);
bglCopyTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_RGBA8, 0, 0, xdim, ydim, 0);
bglTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
bglTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
bglTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_S, GL_CLAMP);
bglTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_T, GL_CLAMP);
i++;
}
// create the peeling fragment program
bglGenProgramsARB(1, &peelprogram);
bglBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, peelprogram);
bglProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, strlen(peelprogramstring), peelprogramstring);
}
} }
void resizeglcheck () void resizeglcheck ()
@ -1499,14 +1557,16 @@ void drawpoly (double *dpx, double *dpy, long n, long method)
if ((!(method&3)) && (!fullbrightdrawingpass)) { if ((!(method&3)) && (!fullbrightdrawingpass)) {
bglDisable(GL_BLEND); bglDisable(GL_BLEND);
bglDisable(GL_ALPHA_TEST); if (!peelcompiling)
bglDisable(GL_ALPHA_TEST);
} else { } else {
float al = 0.0; // PLAG : default alphacut was 0.32 before goodalpha float al = 0.0; // PLAG : default alphacut was 0.32 before goodalpha
if (pth && pth->hicr && pth->hicr->alphacut >= 0.0) al = pth->hicr->alphacut; if (pth && pth->hicr && pth->hicr->alphacut >= 0.0) al = pth->hicr->alphacut;
if (alphahackarray[globalpicnum]) if (alphahackarray[globalpicnum])
al=alphahackarray[globalpicnum]; al=alphahackarray[globalpicnum];
if (!waloff[globalpicnum]) al = 0.0; // invalid textures ignore the alpha cutoff settings if (!waloff[globalpicnum]) al = 0.0; // invalid textures ignore the alpha cutoff settings
bglEnable(GL_BLEND); if (!peelcompiling)
bglEnable(GL_BLEND);
bglEnable(GL_ALPHA_TEST); bglEnable(GL_ALPHA_TEST);
bglAlphaFunc(GL_GREATER,al); bglAlphaFunc(GL_GREATER,al);
} }
@ -3899,9 +3959,9 @@ if (tspr->cstat&2) { if (!(tspr->cstat&512)) method = 2+4; else method = 3+4; }
} }
break; break;
} }
if (((tspr->cstat&2) || (gltexmayhavealpha(tspr->picnum,tspr->pal))) && ((tspr->cstat&48) != 0)) //if (((tspr->cstat&2) || (gltexmayhavealpha(tspr->picnum,tspr->pal))) && ((tspr->cstat&48) != 0))
if (((tspr->cstat&2) || (gltexmayhavealpha(tspr->picnum,tspr->pal))) && ((tspr->cstat&48) != 0)) // if (((tspr->cstat&2) || (gltexmayhavealpha(tspr->picnum,tspr->pal))) && ((tspr->cstat&48) != 0))
bglDepthMask(0); // bglDepthMask(0);
#endif #endif
switch ((globalorientation>>4)&3) switch ((globalorientation>>4)&3)
@ -4961,7 +5021,18 @@ static int osdcmd_polymostvars(const osdfuncparm_t *parm)
return OSDCMD_OK; return OSDCMD_OK;
} }
else if (!Bstrcasecmp(parm->name, "usegoodalpha")) { else if (!Bstrcasecmp(parm->name, "usegoodalpha")) {
OSD_Printf("usegoodalpha is obsolete\n"); if (showval) { OSD_Printf("usegoodalpha is %d\n", usegoodalpha); }
else usegoodalpha = (val != 0);
return OSDCMD_OK;
}
else if (!Bstrcasecmp(parm->name, "numpeels")) {
if (showval) { OSD_Printf("numpeels is %d\n", numpeels); }
else numpeels = val;
return OSDCMD_OK;
}
else if (!Bstrcasecmp(parm->name, "curpeel")) {
if (showval) { OSD_Printf("curpeel is %d\n", curpeel); }
else curpeel = val;
return OSDCMD_OK; return OSDCMD_OK;
} }
else if (!Bstrcasecmp(parm->name, "glpolygonmode")) { else if (!Bstrcasecmp(parm->name, "glpolygonmode")) {
@ -5040,6 +5111,8 @@ void polymost_initosdfuncs(void)
OSD_RegisterFunction("gltexturemaxsize","gltexturemaxsize: changes the maximum OpenGL texture size limit",osdcmd_polymostvars); OSD_RegisterFunction("gltexturemaxsize","gltexturemaxsize: changes the maximum OpenGL texture size limit",osdcmd_polymostvars);
OSD_RegisterFunction("gltexturemiplevel","gltexturemiplevel: changes the highest OpenGL mipmap level used",osdcmd_polymostvars); OSD_RegisterFunction("gltexturemiplevel","gltexturemiplevel: changes the highest OpenGL mipmap level used",osdcmd_polymostvars);
OSD_RegisterFunction("usegoodalpha","usegoodalpha: [OBSOLETE] enable/disable better looking OpenGL alpha hack",osdcmd_polymostvars); OSD_RegisterFunction("usegoodalpha","usegoodalpha: [OBSOLETE] enable/disable better looking OpenGL alpha hack",osdcmd_polymostvars);
OSD_RegisterFunction("numpeels","numpeels",osdcmd_polymostvars);
OSD_RegisterFunction("curpeel","curpeel: [OBSOLETE] enable/disable better looking OpenGL alpha hack",osdcmd_polymostvars);
OSD_RegisterFunction("glpolygonmode","glpolygonmode: debugging feature",osdcmd_polymostvars); //FUK OSD_RegisterFunction("glpolygonmode","glpolygonmode: debugging feature",osdcmd_polymostvars); //FUK
OSD_RegisterFunction("glusetexcache","glusetexcache: enable/disable OpenGL compressed texture cache",osdcmd_polymostvars); OSD_RegisterFunction("glusetexcache","glusetexcache: enable/disable OpenGL compressed texture cache",osdcmd_polymostvars);
OSD_RegisterFunction("glusetexcachecompression","usetexcachecompression: enable/disable compression of files in the OpenGL compressed texture cache",osdcmd_polymostvars); OSD_RegisterFunction("glusetexcachecompression","usetexcachecompression: enable/disable compression of files in the OpenGL compressed texture cache",osdcmd_polymostvars);

View file

@ -2764,7 +2764,7 @@ static int SetupOpenGL(int width, int height, int bitspp)
PFD_TYPE_RGBA, //Request An RGBA Format PFD_TYPE_RGBA, //Request An RGBA Format
0, //Select Our Color Depth 0, //Select Our Color Depth
0,0,0,0,0,0, //Color Bits Ignored 0,0,0,0,0,0, //Color Bits Ignored
0, //No Alpha Buffer 8, //No Alpha Buffer
0, //Shift Bit Ignored 0, //Shift Bit Ignored
0, //No Accumulation Buffer 0, //No Accumulation Buffer
0,0,0,0, //Accumulation Bits Ignored 0,0,0,0, //Accumulation Bits Ignored

View file

@ -5,14 +5,20 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "eduke32", "eduke32.vcproj",
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
HRD SD|Win32 = HRD SD|Win32 Classic Release|Win32 = Classic Release|Win32
vanilla|Win32 = vanilla|Win32 Classic|Win32 = Classic|Win32
HRP SD Release|Win32 = HRP SD Release|Win32
HRP SD|Win32 = HRP SD|Win32
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8E7A6179-0B72-4073-8A4C-E8682D481DAE}.HRD SD|Win32.ActiveCfg = HRD SD|Win32 {8E7A6179-0B72-4073-8A4C-E8682D481DAE}.Classic Release|Win32.ActiveCfg = Classic Release|Win32
{8E7A6179-0B72-4073-8A4C-E8682D481DAE}.HRD SD|Win32.Build.0 = HRD SD|Win32 {8E7A6179-0B72-4073-8A4C-E8682D481DAE}.Classic Release|Win32.Build.0 = Classic Release|Win32
{8E7A6179-0B72-4073-8A4C-E8682D481DAE}.vanilla|Win32.ActiveCfg = vanilla|Win32 {8E7A6179-0B72-4073-8A4C-E8682D481DAE}.Classic|Win32.ActiveCfg = Classic|Win32
{8E7A6179-0B72-4073-8A4C-E8682D481DAE}.vanilla|Win32.Build.0 = vanilla|Win32 {8E7A6179-0B72-4073-8A4C-E8682D481DAE}.Classic|Win32.Build.0 = Classic|Win32
{8E7A6179-0B72-4073-8A4C-E8682D481DAE}.HRP SD Release|Win32.ActiveCfg = HRP SD Release|Win32
{8E7A6179-0B72-4073-8A4C-E8682D481DAE}.HRP SD Release|Win32.Build.0 = HRP SD Release|Win32
{8E7A6179-0B72-4073-8A4C-E8682D481DAE}.HRP SD|Win32.ActiveCfg = HRP SD|Win32
{8E7A6179-0B72-4073-8A4C-E8682D481DAE}.HRP SD|Win32.Build.0 = HRP SD|Win32
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View file

@ -4,6 +4,7 @@
Version="8,00" Version="8,00"
Name="eduke32" Name="eduke32"
ProjectGUID="{8E7A6179-0B72-4073-8A4C-E8682D481DAE}" ProjectGUID="{8E7A6179-0B72-4073-8A4C-E8682D481DAE}"
RootNamespace="eduke32"
Keyword="MakeFileProj" Keyword="MakeFileProj"
> >
<Platforms> <Platforms>
@ -15,7 +16,7 @@
</ToolFiles> </ToolFiles>
<Configurations> <Configurations>
<Configuration <Configuration
Name="HRD SD|Win32" Name="HRP SD|Win32"
OutputDirectory="$(ConfigurationName)" OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)" IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="0" ConfigurationType="0"
@ -26,7 +27,7 @@
ReBuildCommandLine="nmake /f Makefile.msvc veryclean all DEBUG=1" ReBuildCommandLine="nmake /f Makefile.msvc veryclean all DEBUG=1"
CleanCommandLine="nmake /f Makefile.msvc veryclean" CleanCommandLine="nmake /f Makefile.msvc veryclean"
Output="eduke32.exe" Output="eduke32.exe"
PreprocessorDefinitions="WIN32;_DEBUG" PreprocessorDefinitions="WIN32;_DEBUG;SUPERBUILD;POLYMOST;USE_OPENGL;NOCOPYPROTECT;RENDERTYPEWIN"
IncludeSearchPath="" IncludeSearchPath=""
ForcedIncludes="" ForcedIncludes=""
AssemblySearchPath="" AssemblySearchPath=""
@ -35,7 +36,7 @@
/> />
</Configuration> </Configuration>
<Configuration <Configuration
Name="vanilla|Win32" Name="Classic|Win32"
OutputDirectory="$(ConfigurationName)" OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)" IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="0" ConfigurationType="0"
@ -47,7 +48,48 @@
ReBuildCommandLine="nmake /f Makefile.msvc veryclean all DEBUG=1" ReBuildCommandLine="nmake /f Makefile.msvc veryclean all DEBUG=1"
CleanCommandLine="nmake /f Makefile.msvc veryclean" CleanCommandLine="nmake /f Makefile.msvc veryclean"
Output="eduke32.exe" Output="eduke32.exe"
PreprocessorDefinitions="WIN32;_DEBUG" PreprocessorDefinitions="WIN32;_DEBUG;SUPERBUILD;POLYMOST;USE_OPENGL;NOCOPYPROTECT;RENDERTYPEWIN"
IncludeSearchPath=""
ForcedIncludes=""
AssemblySearchPath=""
ForcedUsingAssemblies=""
CompileAsManaged=""
/>
</Configuration>
<Configuration
Name="HRP SD Release|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="0"
>
<Tool
Name="VCNMakeTool"
BuildCommandLine="nmake /f Makefile.msvc"
ReBuildCommandLine="nmake /f Makefile.msvc veryclean all"
CleanCommandLine="nmake /f Makefile.msvc veryclean"
Output="eduke32.exe"
PreprocessorDefinitions="WIN32;_DEBUG;SUPERBUILD;POLYMOST;USE_OPENGL;NOCOPYPROTECT;RENDERTYPEWIN"
IncludeSearchPath=""
ForcedIncludes=""
AssemblySearchPath=""
ForcedUsingAssemblies=""
CompileAsManaged=""
/>
</Configuration>
<Configuration
Name="Classic Release|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="0"
BuildLogFile=""
>
<Tool
Name="VCNMakeTool"
BuildCommandLine="nmake /f Makefile.msvc"
ReBuildCommandLine="nmake /f Makefile.msvc veryclean all"
CleanCommandLine="nmake /f Makefile.msvc veryclean"
Output="eduke32.exe"
PreprocessorDefinitions="WIN32;_DEBUG;SUPERBUILD;POLYMOST;USE_OPENGL;NOCOPYPROTECT;RENDERTYPEWIN"
IncludeSearchPath="" IncludeSearchPath=""
ForcedIncludes="" ForcedIncludes=""
AssemblySearchPath="" AssemblySearchPath=""