diff --git a/include/QF/mathlib.h b/include/QF/mathlib.h index e761e4215..692a7a3bf 100644 --- a/include/QF/mathlib.h +++ b/include/QF/mathlib.h @@ -54,6 +54,13 @@ extern vec3_t vec3_origin; #define VectorIsZero(a) ((a)[0] == 0 && (a)[1] == 0 && (a)[2] == 0) #define VectorZero(a) ((a)[2] = (a)[1] = (a)[0] = 0); +#define VectorBlend(v1,v2,b,v) \ + { \ + (v)[0] = (v1)[0] * (1 - (b)) + (v2)[0] * (b); \ + (v)[1] = (v1)[1] * (1 - (b)) + (v2)[1] * (b); \ + (v)[2] = (v1)[2] * (1 - (b)) + (v2)[2] * (b); \ + } + /* * VectorDistance, the distance between two points. * Yes, this is the same as sqrt(VectorSubtract then DotProduct), diff --git a/libs/video/renderer/gl/gl_mod_alias.c b/libs/video/renderer/gl/gl_mod_alias.c index 8db4878d3..a76c08180 100644 --- a/libs/video/renderer/gl/gl_mod_alias.c +++ b/libs/video/renderer/gl/gl_mod_alias.c @@ -322,7 +322,7 @@ GL_GetAliasFrameVerts (int frame, aliashdr_t *paliashdr, entity_t *e) if (gl_lerp_anim->int_val) { trivertx_t *verts1, *verts2; - float blend, lerp; + float blend; e->frame_interval = interval; @@ -342,7 +342,6 @@ GL_GetAliasFrameVerts (int frame, aliashdr_t *paliashdr, entity_t *e) // wierd things start happening if blend passes 1 if (r_paused || blend > 1) blend = 1; - lerp = 1 - blend; verts1 = verts + e->pose1 * count; verts2 = verts + e->pose2 * count; @@ -354,11 +353,9 @@ GL_GetAliasFrameVerts (int frame, aliashdr_t *paliashdr, entity_t *e) } else { for (i = 0, vo_v = vo->verts; i < count; i++, vo_v++, verts1++, verts2++) { - vo_v->vert[0] = verts1->v[0] * lerp + verts2->v[0] * blend; - vo_v->vert[1] = verts1->v[1] * lerp + verts2->v[1] * blend; - vo_v->vert[2] = verts1->v[2] * lerp + verts2->v[2] * blend; + VectorBlend (verts1->v, verts2->v, blend, vo_v->vert); vo_v->lightdot = - shadedots[verts1->lightnormalindex] * lerp + shadedots[verts1->lightnormalindex] * (1 - blend) + shadedots[verts2->lightnormalindex] * blend; } lastposenum0 = e->pose1; @@ -479,9 +476,7 @@ R_DrawAliasModel (entity_t *e, qboolean cull) VectorNormalize (shadevector); } - shadecolor[0] = e->colormod[0] * 2.0 * shadelight; - shadecolor[1] = e->colormod[1] * 2.0 * shadelight; - shadecolor[2] = e->colormod[2] * 2.0 * shadelight; + VectorScale (e->colormod, 2.0 * shadelight, shadecolor); modelalpha = e->alpha; // locate the proper data diff --git a/libs/video/renderer/gl/gl_mod_sprite.c b/libs/video/renderer/gl/gl_mod_sprite.c index c8c3668cb..0a7b30ffe 100644 --- a/libs/video/renderer/gl/gl_mod_sprite.c +++ b/libs/video/renderer/gl/gl_mod_sprite.c @@ -30,39 +30,15 @@ static const char rcsid[] = #ifdef HAVE_CONFIG_H # include "config.h" #endif -#ifdef HAVE_STRING_H -# include -#endif -#ifdef HAVE_STRINGS_H -# include -#endif -#include -#include -#include - -#include "QF/console.h" -#include "QF/cvar.h" -#include "QF/locs.h" -#include "QF/mathlib.h" -#include "QF/qargs.h" -#include "QF/render.h" -#include "QF/skin.h" -#include "QF/sound.h" -#include "QF/sys.h" -#include "QF/vid.h" #include "QF/GL/defines.h" #include "QF/GL/funcs.h" -#include "QF/GL/qf_rlight.h" -#include "QF/GL/qf_rsurf.h" -#include "QF/GL/qf_screen.h" -#include "QF/GL/qf_vid.h" -#include "compat.h" -#include "r_cvar.h" -#include "r_dynamic.h" -#include "r_local.h" -#include "view.h" +#include "QF/console.h" +#include "QF/model.h" +#include "QF/render.h" + +#include "r_shared.h" static mspriteframe_t * R_GetSpriteFrame (entity_t *currententity) diff --git a/libs/video/renderer/gl/gl_sky.c b/libs/video/renderer/gl/gl_sky.c index 93f2375be..f8ff2fd15 100644 --- a/libs/video/renderer/gl/gl_sky.c +++ b/libs/video/renderer/gl/gl_sky.c @@ -112,8 +112,6 @@ inline void R_SkyBoxPolyVec (vec5_t v) { // avoid interpolation seams -// s = s * (254.0/256.0) + (1.0/256.0); -// t = t * (254.0/256.0) + (1.0/256.0); qfglTexCoord2fv (v); qfglVertex3f (r_refdef.vieworg[0] + v[2], r_refdef.vieworg[1] + v[3], r_refdef.vieworg[2] + v[4]); @@ -173,7 +171,6 @@ R_DrawSkyBox (void) qfglDisable (GL_DEPTH_TEST); qfglDepthMask (GL_FALSE); -// qfglDepthRange (gldepthmax, gldepthmax); for (i = 0; i < 6; i++) { qfglBindTexture (GL_TEXTURE_2D, SKY_TEX + i); qfglBegin (GL_QUADS); @@ -184,7 +181,6 @@ R_DrawSkyBox (void) qfglDepthMask (GL_TRUE); qfglEnable (GL_DEPTH_TEST); -// qfglDepthRange (gldepthmin, gldepthmax); } vec3_t domescale; @@ -240,7 +236,6 @@ R_DrawSkyDome (void) qfglDisable (GL_DEPTH_TEST); qfglDepthMask (GL_FALSE); -// qfglDepthRange (gldepthmax, gldepthmax); qfglDisable (GL_BLEND); @@ -267,7 +262,6 @@ R_DrawSkyDome (void) qfglDepthMask (GL_TRUE); qfglEnable (GL_DEPTH_TEST); -// qfglDepthRange (gldepthmin, gldepthmax); } inline void diff --git a/libs/video/renderer/gl/gl_sky_clip.c b/libs/video/renderer/gl/gl_sky_clip.c index 7be55e785..ccc3dfb16 100644 --- a/libs/video/renderer/gl/gl_sky_clip.c +++ b/libs/video/renderer/gl/gl_sky_clip.c @@ -714,7 +714,6 @@ draw_skybox_sky_polys (msurface_t *sky_chain) { msurface_t *sc = sky_chain; -// qfglDepthRange (gldepthmax, gldepthmax); qfglDepthMask (GL_FALSE); qfglDisable (GL_DEPTH_TEST); while (sc) { @@ -728,7 +727,6 @@ draw_skybox_sky_polys (msurface_t *sky_chain) } qfglEnable (GL_DEPTH_TEST); qfglDepthMask (GL_TRUE); -// qfglDepthRange (gldepthmin, gldepthmax); } static void