mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-17 22:50:51 +00:00
fix skybox/skydom map vis issues. I hope this works on all drivers.
This commit is contained in:
parent
c3735506c7
commit
95d3600452
6 changed files with 138 additions and 95 deletions
2
TODO
2
TODO
|
@ -11,7 +11,7 @@ I GL is still way too slow
|
|||
I Client side QuakeC.
|
||||
I mingw cross compiling
|
||||
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 It's possible to stick on some obtuse-angled corners qwsv 2.3x didn't
|
||||
o better server control of certain cvars
|
||||
|
|
|
@ -1607,7 +1607,7 @@ AC_MSG_RESULT([
|
|||
QuakeForge has been configured successfully.
|
||||
|
||||
Build type:$BUILD_TYPE
|
||||
Server support: $SV_TARGETS
|
||||
Server support:$SV_TARGETS
|
||||
Client support:$CL_TARGETS
|
||||
Sound support:$SOUND_TYPES
|
||||
CD Audio system:$CDTYPE
|
||||
|
|
|
@ -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, glColor4us, (GLushort red, GLushort green, GLushort blue, GLushort alpha));
|
||||
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_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));
|
||||
|
|
|
@ -657,9 +657,6 @@ R_DrawBrushModel (entity_t *e)
|
|||
|
||||
memset (lightmap_polys, 0, sizeof (lightmap_polys));
|
||||
memset (fullbright_polys, 0, sizeof (fullbright_polys));
|
||||
if (gl_sky_clip->int_val) {
|
||||
sky_chain = 0;
|
||||
}
|
||||
|
||||
VectorSubtract (r_refdef.vieworg, e->origin, modelorg);
|
||||
if (rotated) {
|
||||
|
@ -724,8 +721,8 @@ R_DrawBrushModel (entity_t *e)
|
|||
if (gl_fb_bmodels->int_val)
|
||||
R_RenderFullbrights ();
|
||||
|
||||
if (gl_sky_clip->int_val)
|
||||
R_DrawSkyChain (sky_chain);
|
||||
//if (gl_sky_clip->int_val)
|
||||
// R_DrawSkyChain (sky_chain);
|
||||
|
||||
qfglPopMatrix ();
|
||||
}
|
||||
|
@ -815,15 +812,16 @@ R_DrawWorld (void)
|
|||
|
||||
memset (lightmap_polys, 0, sizeof (lightmap_polys));
|
||||
memset (fullbright_polys, 0, sizeof (fullbright_polys));
|
||||
if (gl_sky_clip->int_val) {
|
||||
sky_chain = 0;
|
||||
} else {
|
||||
// Be sure to clear the skybox --KB
|
||||
|
||||
sky_chain = 0;
|
||||
if (!gl_sky_clip->int_val) {
|
||||
R_DrawSky ();
|
||||
}
|
||||
|
||||
R_RecursiveWorldNode (r_worldentity.model->nodes);
|
||||
|
||||
R_DrawSkyChain (sky_chain);
|
||||
|
||||
DrawTextureChains ();
|
||||
|
||||
if (!gl_mtex_active)
|
||||
|
@ -831,9 +829,6 @@ R_DrawWorld (void)
|
|||
|
||||
if (gl_fb_bmodels->int_val)
|
||||
R_RenderFullbrights ();
|
||||
|
||||
if (gl_sky_clip->int_val)
|
||||
R_DrawSkyChain (sky_chain);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -168,7 +168,8 @@ R_DrawSkyBox (void)
|
|||
int i, j;
|
||||
|
||||
qfglDisable (GL_DEPTH_TEST);
|
||||
qfglDepthRange (gldepthmax, gldepthmax);
|
||||
qfglDepthMask (GL_FALSE);
|
||||
//qfglDepthRange (gldepthmax, gldepthmax);
|
||||
for (i = 0; i < 6; i++) {
|
||||
qfglBindTexture (GL_TEXTURE_2D, SKY_TEX + i);
|
||||
qfglBegin (GL_QUADS);
|
||||
|
@ -177,8 +178,9 @@ R_DrawSkyBox (void)
|
|||
qfglEnd ();
|
||||
}
|
||||
|
||||
qfglDepthMask (GL_TRUE);
|
||||
qfglEnable (GL_DEPTH_TEST);
|
||||
qfglDepthRange (gldepthmin, gldepthmax);
|
||||
//qfglDepthRange (gldepthmin, gldepthmax);
|
||||
}
|
||||
|
||||
vec3_t domescale;
|
||||
|
@ -233,7 +235,8 @@ R_DrawSkyDome (void)
|
|||
float speedscale; // for top sky and bottom sky
|
||||
|
||||
qfglDisable (GL_DEPTH_TEST);
|
||||
qfglDepthRange (gldepthmax, gldepthmax);
|
||||
qfglDepthMask (GL_FALSE);
|
||||
//qfglDepthRange (gldepthmax, gldepthmax);
|
||||
|
||||
qfglDisable (GL_BLEND);
|
||||
|
||||
|
@ -258,8 +261,9 @@ R_DrawSkyDome (void)
|
|||
R_DrawSkyLayer (speedscale);
|
||||
}
|
||||
|
||||
qfglDepthMask (GL_TRUE);
|
||||
qfglEnable (GL_DEPTH_TEST);
|
||||
qfglDepthRange (gldepthmin, gldepthmax);
|
||||
//qfglDepthRange (gldepthmin, gldepthmax);
|
||||
}
|
||||
|
||||
inline void
|
||||
|
|
|
@ -658,18 +658,6 @@ R_DrawSkyBoxPoly (glpoly_t *poly)
|
|||
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
|
||||
EmitSkyPolys (float speedscale, msurface_t *fa)
|
||||
{
|
||||
|
@ -702,85 +690,141 @@ EmitSkyPolys (float speedscale, msurface_t *fa)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
R_DrawSkyChain (msurface_t *sky_chain)
|
||||
static inline void
|
||||
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;
|
||||
|
||||
if (gl_sky_clip->int_val > 2) {
|
||||
qfglDisable (GL_BLEND);
|
||||
qfglDisable (GL_TEXTURE_2D);
|
||||
qfglColor3ubv (color_black);
|
||||
while (sc) {
|
||||
glpoly_t *p = sc->polys;
|
||||
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;
|
||||
while (p) {
|
||||
draw_poly (p);
|
||||
p = p->next;
|
||||
}
|
||||
qfglEnable (GL_TEXTURE_2D);
|
||||
qfglEnable (GL_BLEND);
|
||||
qfglColor3ubv (color_white);
|
||||
return;
|
||||
sc = sc->texturechain;
|
||||
}
|
||||
qfglEnable (GL_TEXTURE_2D);
|
||||
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) {
|
||||
qfglDepthRange (gldepthmax, gldepthmax);
|
||||
while (sc) {
|
||||
glpoly_t *p = sc->polys;
|
||||
if (gl_skymultipass->int_val) {
|
||||
sc = sky_chain;
|
||||
|
||||
while (p) {
|
||||
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 = r_realtime * 16;
|
||||
speedscale -= (int)speedscale & ~127 ;
|
||||
|
||||
qfglBindTexture (GL_TEXTURE_2D, solidskytexture);
|
||||
qfglBindTexture (GL_TEXTURE_2D, alphaskytexture);
|
||||
while (sc) {
|
||||
EmitSkyPolys (speedscale, sc);
|
||||
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
|
||||
// seems to work, but this is the wrong place to do it.
|
||||
color_white[3] = 0;
|
||||
|
|
Loading…
Reference in a new issue