diff --git a/common/gl_rmain.c b/common/gl_rmain.c index 302ddf8..875fc3b 100644 --- a/common/gl_rmain.c +++ b/common/gl_rmain.c @@ -1080,7 +1080,12 @@ R_RenderView ( void ) { glFogi (GL_FOG_MODE, GL_EXP2); glFogfv (GL_FOG_COLOR, colors); glFogf (GL_FOG_DENSITY, (GLfloat) r_fog->value); - glEnable(GL_FOG); +// glFogi (GL_FOG_MODE, GL_LINEAR); +// glFogfv (GL_FOG_COLOR, colors); +// glFogf (GL_FOG_START, 300.0); +// glFogf (GL_FOG_END, 1500.0); +// glFogf (GL_FOG_DENSITY, 0.2); + glEnable (GL_FOG); R_RenderScene (); R_DrawViewModel (); diff --git a/common/gl_rmisc.c b/common/gl_rmisc.c index f8eaf48..7b7ef91 100644 --- a/common/gl_rmisc.c +++ b/common/gl_rmisc.c @@ -601,9 +601,7 @@ void R_NewMap (void) skytexturenum = i; cl.worldmodel->textures[i]->texturechain = NULL; } -#ifdef QUAKE2 R_LoadSkys (); -#endif } diff --git a/common/gl_rsurf.c b/common/gl_rsurf.c index 114cf7d..9b7d46e 100644 --- a/common/gl_rsurf.c +++ b/common/gl_rsurf.c @@ -1,4 +1,5 @@ /* +gl_rsurf.c - surrface-related refresh code Copyright (C) 1996-1997 Id Software, Inc. Copyright (C) 1999,2000 contributors of the QuakeForge project Please see the file "AUTHORS" for a list of contributors @@ -19,12 +20,11 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// r_surf.c: surrface-related refresh code -#include "qtypes.h" -#include "quakedef.h" -#include "glquake.h" -#include "mathlib.h" +#include +#include +#include +#include #include int skytexturenum; @@ -1321,9 +1321,7 @@ void R_DrawWorld (void) glColor3f (1,1,1); memset (lightmap_polys, 0, sizeof(lightmap_polys)); -#ifdef QUAKE2 R_ClearSkyBox (); -#endif R_RecursiveWorldNode (cl.worldmodel->nodes); @@ -1331,9 +1329,7 @@ void R_DrawWorld (void) R_BlendLightmaps (); -#ifdef QUAKE2 R_DrawSkyBox (); -#endif } @@ -1638,10 +1634,8 @@ void GL_BuildLightmaps (void) GL_CreateSurfaceLightmap (m->surfaces + i); if ( m->surfaces[i].flags & SURF_DRAWTURB ) continue; -#ifndef QUAKE2 if ( m->surfaces[i].flags & SURF_DRAWSKY ) continue; -#endif BuildSurfaceDisplayList (m->surfaces + i); } } diff --git a/common/gl_warp.c b/common/gl_warp.c index d340260..6a848ed 100644 --- a/common/gl_warp.c +++ b/common/gl_warp.c @@ -27,11 +27,12 @@ Boston, MA 02111-1307, USA */ -#include "qtypes.h" -#include "quakedef.h" -#include "glquake.h" -#include "mathlib.h" +#include +#include +#include +#include #include +#include extern model_t *loadmodel; @@ -295,6 +296,7 @@ EmitBothSkyLayers ( msurface_t *fa ) { glDisable (GL_BLEND); } +#if 0 /* R_DrawSkyChain */ @@ -303,55 +305,19 @@ R_DrawSkyChain ( msurface_t *s ) { msurface_t *fa; - GL_DisableMultitexture(); - - // used when gl_texsort is on - GL_Bind(solidskytexture); - speedscale = realtime*8; - speedscale -= (int)speedscale & ~127 ; - - for (fa=s ; fa ; fa=fa->texturechain) - EmitSkyPolys (fa); - - glEnable (GL_BLEND); - GL_Bind (alphaskytexture); - speedscale = realtime*16; - speedscale -= (int)speedscale & ~127 ; - - for (fa=s ; fa ; fa=fa->texturechain) - EmitSkyPolys (fa); - - glDisable (GL_BLEND); } +#endif /* Quake 2 sky rendering ("skyboxes") */ -#ifdef QUAKE2 - #define SKY_TEX 2000 /* PCX Loading */ -typedef struct { - char manufacturer; - char version; - char encoding; - char bits_per_pixel; - unsigned short xmin,ymin,xmax,ymax; - unsigned short hres,vres; - unsigned char palette[48]; - char reserved; - char color_planes; - unsigned short bytes_per_line; - unsigned short palette_type; - char filler[58]; - unsigned data; // unbounded -} pcx_t; - byte *pcx_rgb; /* @@ -460,8 +426,9 @@ void LoadTGA (QFile *fin) { int columns, rows, numPixels; - byte *pixbuf; + byte *pixbuf; int row, column; + unsigned char red = 0, green = 0, blue = 0, alphabyte = 0; targa_header.id_length = Qgetc(fin); targa_header.colormap_type = Qgetc(fin); @@ -498,7 +465,6 @@ LoadTGA (QFile *fin) { for(row=rows-1; row>=0; row--) { pixbuf = targa_rgba + row*columns*4; for(column=0; column=0; row--) { pixbuf = targa_rgba + row*columns*4; for(column=0; columnstring, suf[i]); COM_FOpenFile (name, &f); if (!f) { Con_Printf ("Couldn't load %s\n", name); @@ -851,19 +820,44 @@ R_DrawSkyChain (msurface_t *s) { vec3_t verts[MAX_CLIP_VERTS]; glpoly_t *p; - c_sky = 0; - GL_Bind(solidskytexture); + if (1) + { + c_sky = 0; + GL_Bind(solidskytexture); - // calculate vertex values for sky box + // calculate vertex values for sky box - for (fa=s ; fa ; fa=fa->texturechain) { - for (p=fa->polys ; p ; p=p->next) { - for (i=0 ; inumverts ; i++) { - VectorSubtract (p->verts[i], r_origin, verts[i]); + for (fa=s ; fa ; fa=fa->texturechain) { + for (p=fa->polys ; p ; p=p->next) { + for (i=0 ; inumverts ; i++) { + VectorSubtract (p->verts[i], r_origin, verts[i]); + } + ClipSkyPolygon (p->numverts, verts[0], 0); } - ClipSkyPolygon (p->numverts, verts[0], 0); } } + else + { + GL_DisableMultitexture(); + + // used when gl_texsort is on + GL_Bind(solidskytexture); + speedscale = realtime*8; + speedscale -= (int)speedscale & ~127 ; + + for (fa=s ; fa ; fa=fa->texturechain) + EmitSkyPolys (fa); + + glEnable (GL_BLEND); + GL_Bind (alphaskytexture); + speedscale = realtime*16; + speedscale -= (int)speedscale & ~127 ; + + for (fa=s ; fa ; fa=fa->texturechain) + EmitSkyPolys (fa); + + glDisable (GL_BLEND); + } } /* @@ -923,9 +917,9 @@ int skytexorder[6] = {0,2,1,3,4,5}; void R_DrawSkyBox (void) { - int i, j, k; - vec3_t v; - float s, t; + int i; //, j, k; +// vec3_t v; +// float s, t; #if 0 glEnable (GL_BLEND); @@ -961,7 +955,6 @@ R_DrawSkyBox (void) { #endif } -#endif // QUAKE2 /* R_InitSky diff --git a/common/glquake.h b/common/glquake.h index c02468d..f729572 100644 --- a/common/glquake.h +++ b/common/glquake.h @@ -239,6 +239,9 @@ void EmitBothSkyLayers (msurface_t *fa); void EmitWaterPolys (msurface_t *fa); void EmitSkyPolys (msurface_t *fa); void R_DrawSkyChain (msurface_t *s); +void R_LoadSkys (void); +void R_ClearSkyBox (void); +void R_DrawSkyBox (void); // // gl_draw.c