* taniwha mutters about end-runs (sorry, Grievre)

This commit is contained in:
Bill Currie 2004-04-28 04:07:50 +00:00
parent 24e5b1b543
commit 1c0735d0c9
4 changed files with 32 additions and 57 deletions

View file

@ -43,7 +43,6 @@ extern struct cvar_s *gl_tessellate;
extern struct cvar_s *gl_texsort; extern struct cvar_s *gl_texsort;
extern struct cvar_s *gl_textures_bgra; extern struct cvar_s *gl_textures_bgra;
extern struct cvar_s *gl_triplebuffer; extern struct cvar_s *gl_triplebuffer;
extern struct cvar_s *gl_viewmodel_hack;
extern struct cvar_s *r_aliasstats; extern struct cvar_s *r_aliasstats;
extern struct cvar_s *r_aliastransadj; extern struct cvar_s *r_aliastransadj;

View file

@ -65,11 +65,10 @@ static __attribute__ ((unused)) const char rcsid[] =
#include "r_dynamic.h" #include "r_dynamic.h"
#include "r_local.h" #include "r_local.h"
#include "view.h" #include "view.h"
#include "varrays.h"
typedef struct { typedef struct {
vec3_t normal;
vec3_t vert; vec3_t vert;
vec3_t normal;
} blended_vert_t; } blended_vert_t;
typedef struct { typedef struct {
@ -101,11 +100,13 @@ GL_DrawAliasFrameTri (vert_order_t *vo)
qfglBegin (GL_TRIANGLES); qfglBegin (GL_TRIANGLES);
do { do {
// texture coordinates come from the draw list
qfglTexCoord2fv (tex_coord->st); qfglTexCoord2fv (tex_coord->st);
tex_coord++;
// normals and vertices come from the frame list
qfglNormal3fv (verts->normal); qfglNormal3fv (verts->normal);
qfglVertex3fv (verts->vert); qfglVertex3fv (verts->vert);
tex_coord++;
verts++; verts++;
} while (count--); } while (count--);
qfglEnd (); qfglEnd ();
@ -536,29 +537,18 @@ R_DrawAliasModel (entity_t *e)
for (l = r_dlights, lnum = 0; lnum < r_maxdlights; lnum++, l++) { for (l = r_dlights, lnum = 0; lnum < r_maxdlights; lnum++, l++) {
if (l->die >= r_realtime) { if (l->die >= r_realtime) {
// Argh, hax
if (e == r_view_model) {
VectorSubtract (l->origin, r_refdef.vieworg, dist);
if ((d = DotProduct (dist, dist)) >
((l->radius + 32) * (l->radius + 32))) {
continue;
}
} else {
VectorSubtract (l->origin, e->origin, dist); VectorSubtract (l->origin, e->origin, dist);
if ((d = DotProduct (dist, dist)) > if ((d = DotProduct (dist, dist)) >
((l->radius + radius) * (l->radius + radius))) { ((l->radius + radius) * (l->radius + radius))) {
continue; // Out of range continue; // Out of range
} }
} if (d < (radius * radius * 0.25)) { // Inside the model
VectorMultAdd (emission, 1.5, l->color, emission);
if (d < 512) { // Argh, more hax
VectorMultAdd (emission, 2.0, l->color, emission);
continue; continue;
} }
if (used_lights >= gl_max_lights) { // too many, use emission if (used_lights >= gl_max_lights) { // too many, use emission
VectorMultAdd (emission, 2.0 * (1 - (d / (l->radius * l->radius))), VectorMultAdd (emission,
1.5 * (1 - (d / (l->radius * l->radius))),
l->color, emission); l->color, emission);
continue; continue;
} }
@ -574,20 +564,19 @@ R_DrawAliasModel (entity_t *e)
qfglLightfv (gl_light, GL_AMBIENT, color); qfglLightfv (gl_light, GL_AMBIENT, color);
qfglLightfv (gl_light, GL_DIFFUSE, color); qfglLightfv (gl_light, GL_DIFFUSE, color);
qfglLightfv (gl_light, GL_SPECULAR, color); qfglLightfv (gl_light, GL_SPECULAR, color);
qfglLightf (gl_light, GL_QUADRATIC_ATTENUATION, 2 / (l->radius * l->radius)); qfglLightf (gl_light, GL_QUADRATIC_ATTENUATION,
qfglLightf (gl_light, GL_CONSTANT_ATTENUATION, 100 / l->radius); 5.0 / (l->radius * l->radius));
used_lights++; used_lights++;
} }
} }
VectorAdd (ambientcolor, emission, emission); VectorAdd (ambientcolor, emission, emission);
d = max (emission[0], max (emission[1], emission[2])); d = max (emission[0], max (emission[1], emission[2]));
if (d > 1.3) { if (d > 1.0) {
VectorScale (emission, 1.3 / d, emission); VectorScale (emission, 1.0 / d, emission);
} else if ((d = model->min_light - d) > 0) { } else if (d < model->min_light && !used_lights) {
emission[0] += d; ambientcolor[2] = ambientcolor[1] =
emission[1] += d; ambientcolor[0] = model->min_light;
emission[2] += d;
} }
qfglMaterialfv (GL_FRONT, GL_EMISSION, emission); qfglMaterialfv (GL_FRONT, GL_EMISSION, emission);
@ -712,9 +701,8 @@ R_DrawAliasModel (entity_t *e)
if (!tess) if (!tess)
qfglDisable (GL_NORMALIZE); qfglDisable (GL_NORMALIZE);
qfglDisable (GL_TEXTURE_2D);
qfglDisable (GL_LIGHTING); qfglDisable (GL_LIGHTING);
qfglDisable (GL_TEXTURE_2D);
qfglDepthMask (GL_FALSE); qfglDepthMask (GL_FALSE);
if (modelalpha < 1.0) { if (modelalpha < 1.0) {

View file

@ -333,16 +333,11 @@ R_DrawViewModel (void)
|| !currententity->model) || !currententity->model)
return; return;
// hack the depth range to prevent view model from poking into walls
switch (gl_viewmodel_hack->int_val) {
case 1: // sometimes buggy
qfglDepthRange (gldepthmin, gldepthmin + 0.3 * (gldepthmax - gldepthmin)); qfglDepthRange (gldepthmin, gldepthmin + 0.3 * (gldepthmax - gldepthmin));
break; qfglEnable (GL_CULL_FACE);
case 2: // sometimes slow qfglEnable (GL_LIGHTING);
qfglClear (GL_DEPTH_BUFFER_BIT); qfglEnable (GL_NORMALIZE);
break;
}
if (gl_affinemodels->int_val) if (gl_affinemodels->int_val)
qfglHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); qfglHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
if (gl_mtex_active_tmus >= 2) { if (gl_mtex_active_tmus >= 2) {
@ -529,6 +524,7 @@ R_SetupGL (void)
qfglGetFloatv (GL_MODELVIEW_MATRIX, r_world_matrix); qfglGetFloatv (GL_MODELVIEW_MATRIX, r_world_matrix);
// set drawing parms // set drawing parms
// qfglEnable (GL_CULL_FACE);
qfglDisable (GL_ALPHA_TEST); qfglDisable (GL_ALPHA_TEST);
qfglAlphaFunc (GL_GREATER, 0.5); qfglAlphaFunc (GL_GREATER, 0.5);
qfglEnable (GL_DEPTH_TEST); qfglEnable (GL_DEPTH_TEST);
@ -662,9 +658,9 @@ R_RenderView_ (void)
// render normal view // render normal view
R_RenderScene (); R_RenderScene ();
R_DrawViewModel ();
R_DrawWaterSurfaces (); R_DrawWaterSurfaces ();
R_DrawParticles (); R_DrawParticles ();
R_DrawViewModel ();
// render mirror view // render mirror view
R_Mirror (); R_Mirror ();

View file

@ -119,7 +119,6 @@ cvar_t *gl_multitexture;
cvar_t *gl_tessellate; cvar_t *gl_tessellate;
cvar_t *gl_textures_bgra; cvar_t *gl_textures_bgra;
cvar_t *gl_vaelements_max; cvar_t *gl_vaelements_max;
cvar_t *gl_viewmodel_hack;
cvar_t *gl_screenshot_byte_swap; cvar_t *gl_screenshot_byte_swap;
cvar_t *vid_mode; cvar_t *vid_mode;
cvar_t *vid_use8bit; cvar_t *vid_use8bit;
@ -276,13 +275,6 @@ GL_Common_Init_Cvars (void)
"Limit the vertex array size for buggy " "Limit the vertex array size for buggy "
"drivers. 0 (default) uses driver provided " "drivers. 0 (default) uses driver provided "
"limit, -1 disables use of vertex arrays."); "limit, -1 disables use of vertex arrays.");
gl_viewmodel_hack = Cvar_Get ("gl_viewmodel_hack", "1", CVAR_ARCHIVE, NULL,
"Depth buffer kludge to get weapon model to draw "
"on top. 0 - don't kludge, weapon pokes through "
"walls. 1 - fast method, some buggy drivers don't "
"like it. 2 - slow method, should work with all "
"drivers");
} }
static void static void
@ -453,7 +445,7 @@ CheckLights (void)
for (i = 0; i < gl_max_lights; i++) { for (i = 0; i < gl_max_lights; i++) {
qfglEnable (GL_LIGHT0 + i); qfglEnable (GL_LIGHT0 + i);
qfglLightf (GL_LIGHT0 + i, GL_CONSTANT_ATTENUATION, 0.5); qfglLightf (GL_LIGHT0 + i, GL_CONSTANT_ATTENUATION, 0.25);
qfglDisable (GL_LIGHT0 + i); qfglDisable (GL_LIGHT0 + i);
} }