mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
* taniwha mutters about end-runs (sorry, Grievre)
This commit is contained in:
parent
24e5b1b543
commit
1c0735d0c9
4 changed files with 32 additions and 57 deletions
|
@ -43,7 +43,6 @@ extern struct cvar_s *gl_tessellate;
|
|||
extern struct cvar_s *gl_texsort;
|
||||
extern struct cvar_s *gl_textures_bgra;
|
||||
extern struct cvar_s *gl_triplebuffer;
|
||||
extern struct cvar_s *gl_viewmodel_hack;
|
||||
|
||||
extern struct cvar_s *r_aliasstats;
|
||||
extern struct cvar_s *r_aliastransadj;
|
||||
|
|
|
@ -65,11 +65,10 @@ static __attribute__ ((unused)) const char rcsid[] =
|
|||
#include "r_dynamic.h"
|
||||
#include "r_local.h"
|
||||
#include "view.h"
|
||||
#include "varrays.h"
|
||||
|
||||
typedef struct {
|
||||
vec3_t normal;
|
||||
vec3_t vert;
|
||||
vec3_t vert;
|
||||
vec3_t normal;
|
||||
} blended_vert_t;
|
||||
|
||||
typedef struct {
|
||||
|
@ -101,11 +100,13 @@ GL_DrawAliasFrameTri (vert_order_t *vo)
|
|||
|
||||
qfglBegin (GL_TRIANGLES);
|
||||
do {
|
||||
// texture coordinates come from the draw list
|
||||
qfglTexCoord2fv (tex_coord->st);
|
||||
tex_coord++;
|
||||
|
||||
// normals and vertices come from the frame list
|
||||
qfglNormal3fv (verts->normal);
|
||||
qfglVertex3fv (verts->vert);
|
||||
|
||||
tex_coord++;
|
||||
verts++;
|
||||
} while (count--);
|
||||
qfglEnd ();
|
||||
|
@ -536,30 +537,19 @@ R_DrawAliasModel (entity_t *e)
|
|||
|
||||
for (l = r_dlights, lnum = 0; lnum < r_maxdlights; lnum++, l++) {
|
||||
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);
|
||||
|
||||
if ((d = DotProduct (dist, dist)) >
|
||||
((l->radius + radius) * (l->radius + radius))) {
|
||||
continue; // Out of range
|
||||
}
|
||||
VectorSubtract (l->origin, e->origin, dist);
|
||||
if ((d = DotProduct (dist, dist)) >
|
||||
((l->radius + radius) * (l->radius + radius))) {
|
||||
continue; // Out of range
|
||||
}
|
||||
|
||||
if (d < 512) { // Argh, more hax
|
||||
VectorMultAdd (emission, 2.0, l->color, emission);
|
||||
if (d < (radius * radius * 0.25)) { // Inside the model
|
||||
VectorMultAdd (emission, 1.5, l->color, emission);
|
||||
continue;
|
||||
}
|
||||
if (used_lights >= gl_max_lights) { // too many, use emission
|
||||
VectorMultAdd (emission, 2.0 * (1 - (d / (l->radius * l->radius))),
|
||||
l->color, emission);
|
||||
VectorMultAdd (emission,
|
||||
1.5 * (1 - (d / (l->radius * l->radius))),
|
||||
l->color, emission);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -574,20 +564,19 @@ R_DrawAliasModel (entity_t *e)
|
|||
qfglLightfv (gl_light, GL_AMBIENT, color);
|
||||
qfglLightfv (gl_light, GL_DIFFUSE, color);
|
||||
qfglLightfv (gl_light, GL_SPECULAR, color);
|
||||
qfglLightf (gl_light, GL_QUADRATIC_ATTENUATION, 2 / (l->radius * l->radius));
|
||||
qfglLightf (gl_light, GL_CONSTANT_ATTENUATION, 100 / l->radius);
|
||||
qfglLightf (gl_light, GL_QUADRATIC_ATTENUATION,
|
||||
5.0 / (l->radius * l->radius));
|
||||
used_lights++;
|
||||
}
|
||||
}
|
||||
|
||||
VectorAdd (ambientcolor, emission, emission);
|
||||
d = max (emission[0], max (emission[1], emission[2]));
|
||||
if (d > 1.3) {
|
||||
VectorScale (emission, 1.3 / d, emission);
|
||||
} else if ((d = model->min_light - d) > 0) {
|
||||
emission[0] += d;
|
||||
emission[1] += d;
|
||||
emission[2] += d;
|
||||
if (d > 1.0) {
|
||||
VectorScale (emission, 1.0 / d, emission);
|
||||
} else if (d < model->min_light && !used_lights) {
|
||||
ambientcolor[2] = ambientcolor[1] =
|
||||
ambientcolor[0] = model->min_light;
|
||||
}
|
||||
|
||||
qfglMaterialfv (GL_FRONT, GL_EMISSION, emission);
|
||||
|
@ -712,9 +701,8 @@ R_DrawAliasModel (entity_t *e)
|
|||
|
||||
if (!tess)
|
||||
qfglDisable (GL_NORMALIZE);
|
||||
|
||||
qfglDisable (GL_TEXTURE_2D);
|
||||
qfglDisable (GL_LIGHTING);
|
||||
qfglDisable (GL_TEXTURE_2D);
|
||||
qfglDepthMask (GL_FALSE);
|
||||
|
||||
if (modelalpha < 1.0) {
|
||||
|
|
|
@ -333,16 +333,11 @@ R_DrawViewModel (void)
|
|||
|| !currententity->model)
|
||||
return;
|
||||
|
||||
|
||||
switch (gl_viewmodel_hack->int_val) {
|
||||
case 1: // sometimes buggy
|
||||
qfglDepthRange (gldepthmin, gldepthmin + 0.3 * (gldepthmax - gldepthmin));
|
||||
break;
|
||||
case 2: // sometimes slow
|
||||
qfglClear (GL_DEPTH_BUFFER_BIT);
|
||||
break;
|
||||
}
|
||||
|
||||
// hack the depth range to prevent view model from poking into walls
|
||||
qfglDepthRange (gldepthmin, gldepthmin + 0.3 * (gldepthmax - gldepthmin));
|
||||
qfglEnable (GL_CULL_FACE);
|
||||
qfglEnable (GL_LIGHTING);
|
||||
qfglEnable (GL_NORMALIZE);
|
||||
if (gl_affinemodels->int_val)
|
||||
qfglHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
|
||||
if (gl_mtex_active_tmus >= 2) {
|
||||
|
@ -529,6 +524,7 @@ R_SetupGL (void)
|
|||
qfglGetFloatv (GL_MODELVIEW_MATRIX, r_world_matrix);
|
||||
|
||||
// set drawing parms
|
||||
// qfglEnable (GL_CULL_FACE);
|
||||
qfglDisable (GL_ALPHA_TEST);
|
||||
qfglAlphaFunc (GL_GREATER, 0.5);
|
||||
qfglEnable (GL_DEPTH_TEST);
|
||||
|
@ -662,10 +658,10 @@ R_RenderView_ (void)
|
|||
|
||||
// render normal view
|
||||
R_RenderScene ();
|
||||
R_DrawViewModel ();
|
||||
R_DrawWaterSurfaces ();
|
||||
R_DrawParticles ();
|
||||
R_DrawViewModel ();
|
||||
|
||||
|
||||
// render mirror view
|
||||
R_Mirror ();
|
||||
|
||||
|
|
|
@ -119,7 +119,6 @@ cvar_t *gl_multitexture;
|
|||
cvar_t *gl_tessellate;
|
||||
cvar_t *gl_textures_bgra;
|
||||
cvar_t *gl_vaelements_max;
|
||||
cvar_t *gl_viewmodel_hack;
|
||||
cvar_t *gl_screenshot_byte_swap;
|
||||
cvar_t *vid_mode;
|
||||
cvar_t *vid_use8bit;
|
||||
|
@ -276,13 +275,6 @@ GL_Common_Init_Cvars (void)
|
|||
"Limit the vertex array size for buggy "
|
||||
"drivers. 0 (default) uses driver provided "
|
||||
"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
|
||||
|
@ -453,7 +445,7 @@ CheckLights (void)
|
|||
|
||||
for (i = 0; i < gl_max_lights; 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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue