fix skybox/skydom map vis issues. I hope this works on all drivers.

This commit is contained in:
Bill Currie 2001-10-03 02:51:30 +00:00
parent c3735506c7
commit 95d3600452
6 changed files with 138 additions and 95 deletions

2
TODO
View file

@ -11,7 +11,7 @@ I GL is still way too slow
I Client side QuakeC. I Client side QuakeC.
I mingw cross compiling I mingw cross compiling
I merge nq and qw code bases I merge nq and qw code bases
W fix skybox/dome vis problems (workable solution found, needs new renderer) X fix skybox/dome vis problems (workable solution found, needs new renderer)
o ogg support o ogg support
o It's possible to stick on some obtuse-angled corners qwsv 2.3x didn't o It's possible to stick on some obtuse-angled corners qwsv 2.3x didn't
o better server control of certain cvars o better server control of certain cvars

View file

@ -1607,7 +1607,7 @@ AC_MSG_RESULT([
QuakeForge has been configured successfully. QuakeForge has been configured successfully.
Build type:$BUILD_TYPE Build type:$BUILD_TYPE
Server support: $SV_TARGETS Server support:$SV_TARGETS
Client support:$CL_TARGETS Client support:$CL_TARGETS
Sound support:$SOUND_TYPES Sound support:$SOUND_TYPES
CD Audio system:$CDTYPE CD Audio system:$CDTYPE

View file

@ -87,7 +87,7 @@ QFGL_DONT_NEED (void, glColor4ui, (GLuint red, GLuint green, GLuint blue, GLuint
QFGL_DONT_NEED (void, glColor4uiv, (const GLuint * v)); QFGL_DONT_NEED (void, glColor4uiv, (const GLuint * v));
QFGL_DONT_NEED (void, glColor4us, (GLushort red, GLushort green, GLushort blue, GLushort alpha)); QFGL_DONT_NEED (void, glColor4us, (GLushort red, GLushort green, GLushort blue, GLushort alpha));
QFGL_DONT_NEED (void, glColor4usv, (const GLushort * v)); QFGL_DONT_NEED (void, glColor4usv, (const GLushort * v));
QFGL_DONT_NEED (void, glColorMask, (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)); QFGL_NEED (void, glColorMask, (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha));
QFGL_DONT_NEED (void, glColorMaterial, (GLenum face, GLenum mode)); QFGL_DONT_NEED (void, glColorMaterial, (GLenum face, GLenum mode));
QFGL_NEED (void, glColorPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid * ptr)); QFGL_NEED (void, glColorPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid * ptr));
QFGL_DONT_NEED (void, glColorSubTable, (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid * data)); QFGL_DONT_NEED (void, glColorSubTable, (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid * data));

View file

@ -657,9 +657,6 @@ R_DrawBrushModel (entity_t *e)
memset (lightmap_polys, 0, sizeof (lightmap_polys)); memset (lightmap_polys, 0, sizeof (lightmap_polys));
memset (fullbright_polys, 0, sizeof (fullbright_polys)); memset (fullbright_polys, 0, sizeof (fullbright_polys));
if (gl_sky_clip->int_val) {
sky_chain = 0;
}
VectorSubtract (r_refdef.vieworg, e->origin, modelorg); VectorSubtract (r_refdef.vieworg, e->origin, modelorg);
if (rotated) { if (rotated) {
@ -724,8 +721,8 @@ R_DrawBrushModel (entity_t *e)
if (gl_fb_bmodels->int_val) if (gl_fb_bmodels->int_val)
R_RenderFullbrights (); R_RenderFullbrights ();
if (gl_sky_clip->int_val) //if (gl_sky_clip->int_val)
R_DrawSkyChain (sky_chain); // R_DrawSkyChain (sky_chain);
qfglPopMatrix (); qfglPopMatrix ();
} }
@ -815,15 +812,16 @@ R_DrawWorld (void)
memset (lightmap_polys, 0, sizeof (lightmap_polys)); memset (lightmap_polys, 0, sizeof (lightmap_polys));
memset (fullbright_polys, 0, sizeof (fullbright_polys)); memset (fullbright_polys, 0, sizeof (fullbright_polys));
if (gl_sky_clip->int_val) {
sky_chain = 0; sky_chain = 0;
} else { if (!gl_sky_clip->int_val) {
// Be sure to clear the skybox --KB
R_DrawSky (); R_DrawSky ();
} }
R_RecursiveWorldNode (r_worldentity.model->nodes); R_RecursiveWorldNode (r_worldentity.model->nodes);
R_DrawSkyChain (sky_chain);
DrawTextureChains (); DrawTextureChains ();
if (!gl_mtex_active) if (!gl_mtex_active)
@ -831,9 +829,6 @@ R_DrawWorld (void)
if (gl_fb_bmodels->int_val) if (gl_fb_bmodels->int_val)
R_RenderFullbrights (); R_RenderFullbrights ();
if (gl_sky_clip->int_val)
R_DrawSkyChain (sky_chain);
} }
void void

View file

@ -168,7 +168,8 @@ R_DrawSkyBox (void)
int i, j; int i, j;
qfglDisable (GL_DEPTH_TEST); qfglDisable (GL_DEPTH_TEST);
qfglDepthRange (gldepthmax, gldepthmax); qfglDepthMask (GL_FALSE);
//qfglDepthRange (gldepthmax, gldepthmax);
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
qfglBindTexture (GL_TEXTURE_2D, SKY_TEX + i); qfglBindTexture (GL_TEXTURE_2D, SKY_TEX + i);
qfglBegin (GL_QUADS); qfglBegin (GL_QUADS);
@ -177,8 +178,9 @@ R_DrawSkyBox (void)
qfglEnd (); qfglEnd ();
} }
qfglDepthMask (GL_TRUE);
qfglEnable (GL_DEPTH_TEST); qfglEnable (GL_DEPTH_TEST);
qfglDepthRange (gldepthmin, gldepthmax); //qfglDepthRange (gldepthmin, gldepthmax);
} }
vec3_t domescale; vec3_t domescale;
@ -233,7 +235,8 @@ R_DrawSkyDome (void)
float speedscale; // for top sky and bottom sky float speedscale; // for top sky and bottom sky
qfglDisable (GL_DEPTH_TEST); qfglDisable (GL_DEPTH_TEST);
qfglDepthRange (gldepthmax, gldepthmax); qfglDepthMask (GL_FALSE);
//qfglDepthRange (gldepthmax, gldepthmax);
qfglDisable (GL_BLEND); qfglDisable (GL_BLEND);
@ -258,8 +261,9 @@ R_DrawSkyDome (void)
R_DrawSkyLayer (speedscale); R_DrawSkyLayer (speedscale);
} }
qfglDepthMask (GL_TRUE);
qfglEnable (GL_DEPTH_TEST); qfglEnable (GL_DEPTH_TEST);
qfglDepthRange (gldepthmin, gldepthmax); //qfglDepthRange (gldepthmin, gldepthmax);
} }
inline void inline void

View file

@ -658,18 +658,6 @@ R_DrawSkyBoxPoly (glpoly_t *poly)
render_box (&box); render_box (&box);
} }
void
R_DrawSkyDomePoly (glpoly_t *poly)
{
int i;
qfglBegin (GL_POLYGON);
for (i = 0; i < poly->numverts; i++) {
qfglVertex3fv (poly->verts[i]);
}
qfglEnd ();
}
void void
EmitSkyPolys (float speedscale, msurface_t *fa) EmitSkyPolys (float speedscale, msurface_t *fa)
{ {
@ -702,85 +690,141 @@ EmitSkyPolys (float speedscale, msurface_t *fa)
} }
} }
void static inline void
R_DrawSkyChain (msurface_t *sky_chain) draw_poly (glpoly_t *poly)
{
int i;
qfglBegin (GL_POLYGON);
for (i = 0; i < poly->numverts; i++) {
qfglVertex3fv (poly->verts[i]);
}
qfglEnd ();
}
static void
draw_black_sky_polys (msurface_t *sky_chain)
{ {
msurface_t *sc = sky_chain; msurface_t *sc = sky_chain;
if (gl_sky_clip->int_val > 2) { qfglDisable (GL_BLEND);
qfglDisable (GL_BLEND); qfglDisable (GL_TEXTURE_2D);
qfglDisable (GL_TEXTURE_2D); qfglColor3ubv (color_black);
qfglColor3ubv (color_black); while (sc) {
while (sc) { glpoly_t *p = sc->polys;
glpoly_t *p = sc->polys;
while (p) { while (p) {
R_DrawSkyDomePoly (p); draw_poly (p);
p = p->next; p = p->next;
}
sc = sc->texturechain;
} }
qfglEnable (GL_TEXTURE_2D); sc = sc->texturechain;
qfglEnable (GL_BLEND); }
qfglColor3ubv (color_white); qfglEnable (GL_TEXTURE_2D);
return; qfglEnable (GL_BLEND);
qfglColor3ubv (color_white);
}
static void
draw_skybox_sky_polys (msurface_t *sky_chain)
{
msurface_t *sc = sky_chain;
//qfglDepthRange (gldepthmax, gldepthmax);
qfglDepthMask (GL_FALSE);
qfglDisable (GL_DEPTH_TEST);
while (sc) {
glpoly_t *p = sc->polys;
while (p) {
R_DrawSkyBoxPoly (p);
p = p->next;
}
sc = sc->texturechain;
}
qfglEnable (GL_DEPTH_TEST);
qfglDepthMask (GL_TRUE);
//qfglDepthRange (gldepthmin, gldepthmax);
}
static void
draw_skydome_sky_polys (msurface_t *sky_chain)
{
// this function is not yet implemented so just draw black
draw_black_sky_polys (sky_chain);
}
static void
draw_id_sky_polys (msurface_t *sky_chain)
{
msurface_t *sc = sky_chain;
float speedscale;
speedscale = r_realtime * 8;
speedscale -= (int)speedscale & ~127 ;
qfglBindTexture (GL_TEXTURE_2D, solidskytexture);
while (sc) {
EmitSkyPolys (speedscale, sc);
sc = sc->texturechain;
} }
if (skyloaded) { if (gl_skymultipass->int_val) {
qfglDepthRange (gldepthmax, gldepthmax); sc = sky_chain;
while (sc) {
glpoly_t *p = sc->polys;
while (p) { speedscale = r_realtime * 16;
R_DrawSkyBoxPoly (p);
p = p->next;
}
sc = sc->texturechain;
}
qfglDepthRange (gldepthmin, gldepthmax);
} else if (gl_sky_clip->int_val == 2) {
float speedscale;
speedscale = r_realtime * 8;
speedscale -= (int)speedscale & ~127 ; speedscale -= (int)speedscale & ~127 ;
qfglBindTexture (GL_TEXTURE_2D, solidskytexture); qfglBindTexture (GL_TEXTURE_2D, alphaskytexture);
while (sc) { while (sc) {
EmitSkyPolys (speedscale, sc); EmitSkyPolys (speedscale, sc);
sc = sc->texturechain; sc = sc->texturechain;
} }
if (gl_skymultipass->int_val) {
sc = sky_chain;
speedscale = r_realtime * 16;
speedscale -= (int)speedscale & ~127 ;
qfglBindTexture (GL_TEXTURE_2D, alphaskytexture);
while (sc) {
EmitSkyPolys (speedscale, sc);
sc = sc->texturechain;
}
}
} else {
// this code is duplicated from above because skydome is not yet
// clipped
qfglDisable (GL_BLEND);
qfglDisable (GL_TEXTURE_2D);
qfglColor3ubv (color_black);
while (sc) {
glpoly_t *p = sc->polys;
while (p) {
R_DrawSkyDomePoly (p);
p = p->next;
}
sc = sc->texturechain;
}
qfglEnable (GL_TEXTURE_2D);
qfglEnable (GL_BLEND);
qfglColor3ubv (color_white);
} }
}
static void
draw_z_sky_polys (msurface_t *sky_chain)
{
msurface_t *sc = sky_chain;
qfglColorMask (GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
qfglDisable (GL_BLEND);
qfglDisable (GL_TEXTURE_2D);
qfglColor3ubv (color_black);
while (sc) {
glpoly_t *p = sc->polys;
while (p) {
draw_poly (p);
p = p->next;
}
sc = sc->texturechain;
}
qfglColor3ubv (color_white);
qfglEnable (GL_TEXTURE_2D);
qfglEnable (GL_BLEND);
qfglColorMask (GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
}
void
R_DrawSkyChain (msurface_t *sky_chain)
{
if (gl_sky_clip->int_val > 2) {
draw_black_sky_polys (sky_chain);
return;
}
if (skyloaded) {
if (gl_sky_clip->int_val) {
draw_skybox_sky_polys (sky_chain);
}
} else if (gl_sky_clip->int_val == 2) {
draw_id_sky_polys (sky_chain);
} else if (gl_sky_clip->int_val) {
draw_skydome_sky_polys (sky_chain);
return; // XXX not properly implemented
}
draw_z_sky_polys (sky_chain);
#if 0 #if 0
// seems to work, but this is the wrong place to do it. // seems to work, but this is the wrong place to do it.
color_white[3] = 0; color_white[3] = 0;