From 3cfd2c0a8e0a59138f5972469d33c659672c36a9 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 30 Dec 2001 04:16:25 +0000 Subject: [PATCH] make GL_DrawAliasShadow use the data calculated by GL_GetAliasFraveVerts so shadows don't cost as much when lerping is enabled. --- libs/video/renderer/gl/gl_mod_alias.c | 95 +++------------------------ 1 file changed, 8 insertions(+), 87 deletions(-) diff --git a/libs/video/renderer/gl/gl_mod_alias.c b/libs/video/renderer/gl/gl_mod_alias.c index a76c08180..ec104f2da 100644 --- a/libs/video/renderer/gl/gl_mod_alias.c +++ b/libs/video/renderer/gl/gl_mod_alias.c @@ -150,20 +150,19 @@ GL_DrawAliasFrame (vert_order_t *vo, qboolean fb) Standard shadow drawing */ static void -GL_DrawAliasShadow (aliashdr_t *paliashdr, int posenum) +GL_DrawAliasShadow (aliashdr_t *paliashdr, vert_order_t *vo) { float height, lheight; int count; int *order; vec3_t point; - trivertx_t *verts; + blended_vert_t *verts; lheight = currententity->origin[2] - lightspot[2]; height = 0; - verts = (trivertx_t *) ((byte *) paliashdr + paliashdr->posedata); - verts += posenum * paliashdr->poseverts; - order = (int *) ((byte *) paliashdr + paliashdr->commands); + verts = vo->verts; + order = vo->order; height = -lheight + 1.0; @@ -183,13 +182,13 @@ GL_DrawAliasShadow (aliashdr_t *paliashdr, int posenum) // normals and vertexes come from the frame list point[0] = - verts->v[0] * paliashdr->mdl.scale[0] + + verts->vert[0] * paliashdr->mdl.scale[0] + paliashdr->mdl.scale_origin[0]; point[1] = - verts->v[1] * paliashdr->mdl.scale[1] + + verts->vert[1] * paliashdr->mdl.scale[1] + paliashdr->mdl.scale_origin[1]; point[2] = - verts->v[2] * paliashdr->mdl.scale[2] + + verts->vert[2] * paliashdr->mdl.scale[2] + paliashdr->mdl.scale_origin[2]; point[0] -= shadevector[0] * (point[2] + lheight); @@ -205,79 +204,6 @@ GL_DrawAliasShadow (aliashdr_t *paliashdr, int posenum) } } -/* - GL_DrawAliasBlendedShadow - - Interpolated shadow drawing -*/ -void -GL_DrawAliasBlendedShadow (aliashdr_t *paliashdr, int pose1, int pose2, - entity_t *e) -{ - float blend, height, lheight, lerp; - int count; - int *order; - trivertx_t *verts1, *verts2; - vec3_t point1, point2; - - blend = (r_realtime - e->frame_start_time) / e->frame_interval; - blend = min (blend, 1); - lerp = 1 - blend; - - lheight = e->origin[2] - lightspot[2]; - height = -lheight + 1.0; - - verts2 = verts1 = (trivertx_t *) ((byte *) paliashdr + - paliashdr->posedata); - - verts1 += pose1 * paliashdr->poseverts; - verts2 += pose2 * paliashdr->poseverts; - - order = (int *) ((byte *) paliashdr + paliashdr->commands); - - while ((count = *order++)) { - // get the vertex count and primitive type - if (count < 0) { - count = -count; - qfglBegin (GL_TRIANGLE_FAN); - } else { - qfglBegin (GL_TRIANGLE_STRIP); - } - - do { - order += 2; - - point1[0] = verts1->v[0] * paliashdr->mdl.scale[0] + - paliashdr->mdl.scale_origin[0]; - point1[1] = verts1->v[1] * paliashdr->mdl.scale[1] + - paliashdr->mdl.scale_origin[1]; - point1[2] = verts1->v[2] * paliashdr->mdl.scale[2] + - paliashdr->mdl.scale_origin[2]; - - point1[0] -= shadevector[0] * (point1[2] + lheight); - point1[1] -= shadevector[1] * (point1[2] + lheight); - - point2[0] = verts2->v[0] * paliashdr->mdl.scale[0] + - paliashdr->mdl.scale_origin[0]; - point2[1] = verts2->v[1] * paliashdr->mdl.scale[1] + - paliashdr->mdl.scale_origin[1]; - point2[2] = verts2->v[2] * paliashdr->mdl.scale[2] + - paliashdr->mdl.scale_origin[2]; - - point2[0] -= shadevector[0] * (point2[2] + lheight); - point2[1] -= shadevector[1] * (point2[2] + lheight); - - qfglVertex3f ((point1[0] * lerp) + (point2[0] * blend), - (point1[1] * lerp) + (point2[1] * blend), - height); - - verts1++; - verts2++; - } while (--count); - qfglEnd (); - } -} - vert_order_t * GL_GetAliasFrameVerts (int frame, aliashdr_t *paliashdr, entity_t *e) { @@ -534,12 +460,7 @@ R_DrawAliasModel (entity_t *e, qboolean cull) color_black[3] = (clmodel->shadow_alpha + 1) / 2; qfglColor4ubv (color_black); - if (gl_lerp_anim->int_val) { - GL_DrawAliasBlendedShadow (paliashdr, lastposenum0, lastposenum, - e); - } else { - GL_DrawAliasShadow (paliashdr, lastposenum); - } + GL_DrawAliasShadow (paliashdr, vo); qfglEnable (GL_TEXTURE_2D); qfglPopMatrix ();