tree now builds again. Note: this includes some of my sky work, but so long as

gl_sky_clip is not set, it's not working won't affect you :)
This commit is contained in:
Bill Currie 2000-10-29 22:02:29 +00:00
parent 09dbb0670d
commit 4057988e1f
7 changed files with 80 additions and 28 deletions

View File

@ -118,6 +118,7 @@ cvar_t *gl_particles;
cvar_t *r_skyname;
cvar_t *gl_skymultipass;
cvar_t *gl_sky_clip;
cvar_t *gl_fb_models;
cvar_t *gl_fb_bmodels;

View File

@ -247,8 +247,9 @@ void R_Init_Cvars (void)
r_skyname = Cvar_Get("r_skyname", "none", CVAR_NONE,
"name of the current skybox");
gl_skymultipass = Cvar_Get("gl_skymultipass", "1", CVAR_NONE,
"controls wether the skydome is single or double pass");
"controls whether the skydome is single or double pass");
gl_sky_clip = Cvar_Get ("gl_sky_clip", "0", CVAR_NONE,
"controls whether sky is drawn first (0) or later (1)");
}
/*

View File

@ -65,7 +65,7 @@ int lightmap_textures;
unsigned int blocklights[18*18*3];
cvar_t *gl_colorlights;
cvar_t *gl_colorlights;
#define BLOCK_WIDTH 128
#define BLOCK_HEIGHT 128
@ -91,6 +91,7 @@ int allocated[MAX_LIGHTMAPS][BLOCK_WIDTH];
byte *lightmaps[MAX_LIGHTMAPS];
msurface_t *waterchain = NULL;
msurface_t *sky_chain;
extern qboolean lighthalf;
@ -699,8 +700,7 @@ void DrawTextureChains (void)
glDisable(GL_BLEND);
for (i=0 ; i<cl.worldmodel->numtextures ; i++)
{
for (i=0 ; i<cl.worldmodel->numtextures ; i++) {
if (!cl.worldmodel->textures[i])
continue;
for (s = cl.worldmodel->textures[i]->texturechain;s;s = s->texturechain)
@ -753,10 +753,12 @@ void 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)
{
if (rotated) {
vec3_t temp;
vec3_t forward, right, up;
@ -798,10 +800,12 @@ void R_DrawBrushModel (entity_t *e)
//
// draw texture
//
for (i=0 ; i<clmodel->nummodelsurfaces ; i++, psurf++)
{
if (psurf->flags & SURF_DRAWSKY)
for (i=0 ; i<clmodel->nummodelsurfaces ; i++, psurf++) {
if (psurf->flags & SURF_DRAWSKY) {
psurf->texturechain = sky_chain;
sky_chain = psurf;
return;
}
// find which side of the node we are on
pplane = psurf->plane;
@ -827,6 +831,9 @@ void R_DrawBrushModel (entity_t *e)
if (gl_fb_bmodels->int_val)
R_RenderFullbrights ();
if (gl_sky_clip->int_val)
R_DrawSkyChain (sky_chain);
glPopMatrix ();
}
@ -927,8 +934,11 @@ void R_RecursiveWorldNode (mnode_t *node)
if ((dot < 0) ^ !!(surf->flags & SURF_PLANEBACK))
continue; // wrong side
if (surf->flags & SURF_DRAWSKY)
if (surf->flags & SURF_DRAWSKY) {
surf->texturechain = sky_chain;
sky_chain = surf;
continue;
}
if (surf->flags & SURF_DRAWTURB)
{
@ -976,8 +986,12 @@ void R_DrawWorld (void)
memset (lightmap_polys, 0, sizeof(lightmap_polys));
memset (fullbright_polys, 0, sizeof(fullbright_polys));
// Be sure to clear the skybox --KB
R_DrawSky ();
if (gl_sky_clip->int_val) {
sky_chain = 0;
} else {
// Be sure to clear the skybox --KB
R_DrawSky ();
}
R_RecursiveWorldNode (cl.worldmodel->nodes);
@ -988,6 +1002,9 @@ void R_DrawWorld (void)
if (gl_fb_bmodels->int_val)
R_RenderFullbrights ();
if (gl_sky_clip->int_val)
R_DrawSkyChain (sky_chain);
}

View File

@ -53,19 +53,13 @@ msurface_t *warpface;
/*
=================================================================
Quake 2 environment sky
=================================================================
Quake 2 environment sky
*/
#define SKY_TEX 2000
/*
==================
R_LoadSkys
==================
R_LoadSkys
*/
char *suf[6] = { "rt", "bk", "lf", "ft", "up", "dn" };
void
@ -274,6 +268,41 @@ R_DrawSky (void)
R_DrawSkyDome ();
}
void
R_DrawSkyBoxPoly (glpoly_t *poly)
{
vec3_t verts[32];
int i;
if (poly->numverts>=32) {
Con_Printf ("too many verts!");
abort();
}
for (i=0; i< poly->numverts; i++) {
VectorSubtract (poly->verts[i], r_refdef.vieworg, verts[i]);
}
}
void
R_DrawSkyDomePoly (glpoly_t *poly)
{
}
void
R_DrawSkyChain (msurface_t *sky_chain)
{
if (skyloaded) {
while (sky_chain) {
R_DrawSkyBoxPoly (sky_chain->polys);
sky_chain = sky_chain->texturechain;
}
} else {
while (sky_chain) {
R_DrawSkyDomePoly (sky_chain->polys);
sky_chain = sky_chain->texturechain;
}
}
}
//===============================================================

View File

@ -29,17 +29,19 @@
$Id$
*/
#include "qtypes.h"
#include "quakedef.h"
#include "keys.h"
#include "client.h"
#include "sys.h"
#include "cl_input.h"
#include "cmd.h"
#include "console.h"
#include "cvar.h"
#include "cmd.h"
#include "qargs.h"
#include "input.h"
#include "joystick.h"
#include "keys.h"
#include "qargs.h"
#include "qtypes.h"
#include "quakedef.h"
#include "sys.h"
#include "view.h"
#include <stdio.h>
#include <stdlib.h>

View File

@ -48,6 +48,8 @@
#include <strings.h>
#endif
cvar_t *r_skyname;
void SV_Error (char *error, ...);
void FindEdictFieldOffsets();
@ -829,7 +831,6 @@ char *ED_ParseEdict (char *data, edict_t *ent)
qboolean anglehack;
qboolean init;
char keyname[256];
cvar_t *r_skyname;
init = false;

View File

@ -130,6 +130,7 @@ QFile *sv_fraglogfile;
void SV_AcceptClient (netadr_t adr, int userid, char *userinfo);
void Master_Shutdown (void);
void PR_Init_Cvars (void);
//============================================================================