mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 14:20:59 +00:00
make GL_DrawAliasShadow use the data calculated by GL_GetAliasFraveVerts so
shadows don't cost as much when lerping is enabled.
This commit is contained in:
parent
d570f0905f
commit
3cfd2c0a8e
1 changed files with 8 additions and 87 deletions
|
@ -150,20 +150,19 @@ GL_DrawAliasFrame (vert_order_t *vo, qboolean fb)
|
||||||
Standard shadow drawing
|
Standard shadow drawing
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
GL_DrawAliasShadow (aliashdr_t *paliashdr, int posenum)
|
GL_DrawAliasShadow (aliashdr_t *paliashdr, vert_order_t *vo)
|
||||||
{
|
{
|
||||||
float height, lheight;
|
float height, lheight;
|
||||||
int count;
|
int count;
|
||||||
int *order;
|
int *order;
|
||||||
vec3_t point;
|
vec3_t point;
|
||||||
trivertx_t *verts;
|
blended_vert_t *verts;
|
||||||
|
|
||||||
lheight = currententity->origin[2] - lightspot[2];
|
lheight = currententity->origin[2] - lightspot[2];
|
||||||
|
|
||||||
height = 0;
|
height = 0;
|
||||||
verts = (trivertx_t *) ((byte *) paliashdr + paliashdr->posedata);
|
verts = vo->verts;
|
||||||
verts += posenum * paliashdr->poseverts;
|
order = vo->order;
|
||||||
order = (int *) ((byte *) paliashdr + paliashdr->commands);
|
|
||||||
|
|
||||||
height = -lheight + 1.0;
|
height = -lheight + 1.0;
|
||||||
|
|
||||||
|
@ -183,13 +182,13 @@ GL_DrawAliasShadow (aliashdr_t *paliashdr, int posenum)
|
||||||
|
|
||||||
// normals and vertexes come from the frame list
|
// normals and vertexes come from the frame list
|
||||||
point[0] =
|
point[0] =
|
||||||
verts->v[0] * paliashdr->mdl.scale[0] +
|
verts->vert[0] * paliashdr->mdl.scale[0] +
|
||||||
paliashdr->mdl.scale_origin[0];
|
paliashdr->mdl.scale_origin[0];
|
||||||
point[1] =
|
point[1] =
|
||||||
verts->v[1] * paliashdr->mdl.scale[1] +
|
verts->vert[1] * paliashdr->mdl.scale[1] +
|
||||||
paliashdr->mdl.scale_origin[1];
|
paliashdr->mdl.scale_origin[1];
|
||||||
point[2] =
|
point[2] =
|
||||||
verts->v[2] * paliashdr->mdl.scale[2] +
|
verts->vert[2] * paliashdr->mdl.scale[2] +
|
||||||
paliashdr->mdl.scale_origin[2];
|
paliashdr->mdl.scale_origin[2];
|
||||||
|
|
||||||
point[0] -= shadevector[0] * (point[2] + lheight);
|
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 *
|
vert_order_t *
|
||||||
GL_GetAliasFrameVerts (int frame, aliashdr_t *paliashdr, entity_t *e)
|
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;
|
color_black[3] = (clmodel->shadow_alpha + 1) / 2;
|
||||||
qfglColor4ubv (color_black);
|
qfglColor4ubv (color_black);
|
||||||
|
|
||||||
if (gl_lerp_anim->int_val) {
|
GL_DrawAliasShadow (paliashdr, vo);
|
||||||
GL_DrawAliasBlendedShadow (paliashdr, lastposenum0, lastposenum,
|
|
||||||
e);
|
|
||||||
} else {
|
|
||||||
GL_DrawAliasShadow (paliashdr, lastposenum);
|
|
||||||
}
|
|
||||||
|
|
||||||
qfglEnable (GL_TEXTURE_2D);
|
qfglEnable (GL_TEXTURE_2D);
|
||||||
qfglPopMatrix ();
|
qfglPopMatrix ();
|
||||||
|
|
Loading…
Reference in a new issue