Applied patch from Bill Currie to merge gl_rmain.c

This commit is contained in:
Zephaniah E. Hull 2000-01-01 06:26:03 +00:00
parent 1db842863d
commit 2d821cdda6
3 changed files with 84 additions and 1154 deletions

View file

@ -12,6 +12,7 @@ QW/Q1 tree merging:
Jeff Teunissen <deek@dusknet.dhis.net>
Zephaniah E. Hull <warp@whitestar.soark.net>
Marcus Sundberg <mackan@stacken.kth.se>
Bill Currie <bill@taniwha.org>
Autoconf support:
Loring Holden <lsh@cs.brown.edu>

View file

@ -84,7 +84,11 @@ cvar_t r_mirroralpha = {"r_mirroralpha","1"};
cvar_t r_wateralpha = {"r_wateralpha","1"};
cvar_t r_dynamic = {"r_dynamic","1"};
cvar_t r_novis = {"r_novis","0"};
#ifdef QUAKEWORLD
cvar_t r_netgraph = {"r_netgraph","0"};
#else
cvar_t r_fog = {"r_fog", "0"};
#endif
cvar_t gl_finish = {"gl_finish","0"};
cvar_t gl_clear = {"gl_clear","0"};
@ -96,12 +100,18 @@ cvar_t gl_polyblend = {"gl_polyblend","1"};
cvar_t gl_flashblend = {"gl_flashblend","1"};
cvar_t gl_playermip = {"gl_playermip","0"};
cvar_t gl_nocolors = {"gl_nocolors","0"};
cvar_t gl_keeptjunctions = {"gl_keeptjunctions","0"};
#ifdef QUAKEWORLD
cvar_t gl_keeptjunctions = {"gl_keeptjunctions","1"};
cvar_t gl_reporttjunctions = {"gl_reporttjunctions","0"};
#else
cvar_t gl_keeptjunctions = {"gl_keeptjunctions","0"};
cvar_t gl_doubleeyes = {"gl_doubleeys", "1"};
#endif
extern cvar_t gl_ztrick;
#ifdef QUAKEWORLD
extern cvar_t scr_fov;
#endif
/*
=================
R_CullBox
@ -126,6 +136,7 @@ void R_RotateForEntity (entity_t *e)
glRotatef (e->angles[1], 0, 0, 1);
glRotatef (-e->angles[0], 0, 1, 0);
//ZOID: fixed z angle
glRotatef (e->angles[2], 1, 0, 0);
}
@ -229,6 +240,11 @@ void R_DrawSpriteModel (entity_t *e)
glEnable (GL_ALPHA_TEST);
glBegin (GL_QUADS);
#ifdef QUAKEWORLD
glEnable (GL_ALPHA_TEST);
glBegin (GL_QUADS);
#endif
glTexCoord2f (0, 1);
VectorMA (e->origin, frame->down, up, point);
VectorMA (point, frame->left, right, point);
@ -491,14 +507,18 @@ void R_DrawAliasModel (entity_t *e)
shadelight = 192 - ambientlight;
// ZOID: never allow players to go totally black
#ifdef QUAKEWORLD
if (!strcmp(clmodel->name, "progs/player.mdl")) {
#else
i = currententity - cl_entities;
if (i >= 1 && i<=cl.maxclients /* && !strcmp (currententity->model->name, "progs/player.mdl") */)
#endif
if (ambientlight < 8)
ambientlight = shadelight = 8;
// HACK HACK HACK -- no fullbright colors, so make torches full light
if (!strcmp (clmodel->name, "progs/flame2.mdl")
} else if (!strcmp (clmodel->name, "progs/flame2.mdl")
|| !strcmp (clmodel->name, "progs/flame.mdl") )
// HACK HACK HACK -- no fullbright colors, so make torches full light
ambientlight = shadelight = 256;
shadedots = r_avertexnormal_dots[((int)(e->angles[1] * (SHADEDOT_QUANT / 360.0))) & (SHADEDOT_QUANT - 1)];
@ -526,9 +546,13 @@ void R_DrawAliasModel (entity_t *e)
glPushMatrix ();
R_RotateForEntity (e);
if (!strcmp (clmodel->name, "progs/eyes.mdl") && gl_doubleeyes.value) {
#ifdef QUAKEWORLD
if (!strcmp (clmodel->name, "progs/eyes.mdl") ) {
#else
if (!strcmp (clmodel->name, "progs/eyes.mdl" && gl_doubleeyes.value) ) {
#endif
glTranslatef (paliashdr->scale_origin[0], paliashdr->scale_origin[1], paliashdr->scale_origin[2] - (22 + 8));
// double size of eyes, since they are really hard to see in gl
// double size of eyes, since they are really hard to see in gl
glScalef (paliashdr->scale[0]*2, paliashdr->scale[1]*2, paliashdr->scale[2]*2);
} else {
glTranslatef (paliashdr->scale_origin[0], paliashdr->scale_origin[1], paliashdr->scale_origin[2]);
@ -540,12 +564,25 @@ void R_DrawAliasModel (entity_t *e)
// we can't dynamically colormap textures, so they are cached
// seperately for the players. Heads are just uncolored.
#ifdef QUAKEWORLD
if (currententity->scoreboard && !gl_nocolors.value)
{
i = currententity->scoreboard - cl.players;
if (!currententity->scoreboard->skin) {
Skin_Find(currententity->scoreboard);
R_TranslatePlayerSkin(i);
}
if (i >= 0 && i<MAX_CLIENTS)
GL_Bind(playertextures + i);
}
#else
if (currententity->colormap != vid.colormap && !gl_nocolors.value)
{
i = currententity - cl_entities;
if (i >= 1 && i<=cl.maxclients /* && !strcmp (currententity->model->name, "progs/player.mdl") */)
GL_Bind(playertextures - 1 + i);
}
#endif
if (gl_smoothmodels.value)
glShadeModel (GL_SMOOTH);
@ -597,7 +634,11 @@ void R_DrawEntitiesOnList (void)
// draw sprites seperately, because of alpha blending
for (i=0 ; i<cl_numvisedicts ; i++)
{
#ifdef QUAKEWORLD
currententity = &cl_visedicts[i];
#else
currententity = cl_visedicts[i];
#endif
switch (currententity->model->type)
{
@ -616,13 +657,20 @@ void R_DrawEntitiesOnList (void)
for (i=0 ; i<cl_numvisedicts ; i++)
{
#ifdef QUAKEWORLD
currententity = &cl_visedicts[i];
#else
currententity = cl_visedicts[i];
#endif
switch (currententity->model->type)
{
case mod_sprite:
R_DrawSpriteModel (currententity);
break;
default :
break;
}
}
}
@ -642,20 +690,29 @@ void R_DrawViewModel (void)
dlight_t *dl;
int ambientlight, shadelight;
#ifdef QUAKEWORLD
if (!r_drawviewmodel.value || !Cam_DrawViewModel())
return;
#else
if (!r_drawviewmodel.value)
return;
if (chase_active.value)
return;
#endif
if (envmap)
return;
if (!r_drawentities.value)
return;
#ifdef QUAKEWORLD
if (cl.stats[STAT_ITEMS] & IT_INVISIBILITY)
return;
#else
if (cl.items & IT_INVISIBILITY)
return;
#endif
if (cl.stats[STAT_HEALTH] <= 0)
return;
@ -798,8 +855,15 @@ R_SetupFrame
void R_SetupFrame (void)
{
// don't allow cheats in multiplayer
#ifdef QUAKEWORLD
r_fullbright.value = 0;
r_lightmap.value = 0;
if (!atoi(Info_ValueForKey(cl.serverinfo, "watervis")))
r_wateralpha.value = 1;
#else
if (cl.maxclients > 1)
Cvar_Set ("r_fullbright", "0");
#endif
R_AnimateLight ();
@ -884,6 +948,9 @@ void R_SetupGL (void)
glViewport (glx + x, gly + y2, w, h);
screenaspect = (float)r_refdef.vrect.width/r_refdef.vrect.height;
// yfov = 2*atan((float)r_refdef.vrect.height/r_refdef.vrect.width)*180/M_PI;
// yfov = (2.0 * tan (scr_fov.value/360*M_PI)) / screenaspect;
// yfov = 2*atan((float)r_refdef.vrect.height/r_refdef.vrect.width)*(scr_fov.value*2)/M_PI;
// MYgluPerspective (yfov, screenaspect, 4, 4096);
MYgluPerspective (r_refdef.fov_y, screenaspect, 4, 4096);
if (mirror)
@ -1010,6 +1077,7 @@ void R_Clear (void)
glDepthRange (gldepthmin, gldepthmax);
}
#ifndef QUAKEWORLD //!!! FIXME, Zoid, mirror is disabled for now
/*
=============
R_Mirror
@ -1076,6 +1144,7 @@ void R_Mirror (void)
glDisable (GL_BLEND);
glColor4f (1,1,1,1);
}
#endif
/*
================
@ -1087,9 +1156,10 @@ r_refdef must be set before the first call
void R_RenderView (void)
{
double time1 = 0, time2 = 0;
#ifndef QUAKEWORLD
// Fixme: the last argument should be a cvar... r_fog_gamma
GLfloat colors[4] = {(GLfloat) 0.0, (GLfloat) 0.0, (GLfloat) 1, (GLfloat) 0.15};
#endif
if (r_norefresh.value)
return;
@ -1113,6 +1183,8 @@ void R_RenderView (void)
R_Clear ();
// render normal view
#ifndef QUAKEWORLD
// XXX
/***** Experimental silly looking fog ******
****** Use r_fullbright if you enable ******
@ -1136,18 +1208,19 @@ if(r_fog.value) {
glFogf (GL_FOG_DENSITY, .0005);
glEnable(GL_FOG);
}
#endif
R_RenderScene ();
R_DrawViewModel ();
R_DrawWaterSurfaces ();
#ifndef QUAKEWORLD
// More fog right here :)
glDisable(GL_FOG);
// End of all fog code...
// render mirror view
R_Mirror ();
#endif
R_PolyBlend ();
if (r_speeds.value)

File diff suppressed because it is too large Load diff