mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-17 01:11:45 +00:00
Implement gl shadows for pure triangle alias models.
I finally found the cause of Despair's gl shadows non-rendering+segfault... the shadow code expected triangle fans and strips but was getting simple triangles. Oops.
This commit is contained in:
parent
9d1e6920d8
commit
fbc0ad59df
1 changed files with 41 additions and 1 deletions
|
@ -182,6 +182,43 @@ GL_DrawAliasFrameMulti (vert_order_t *vo)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
GL_DrawAliasShadowTri
|
||||
|
||||
Standard shadow drawing (triangles version)
|
||||
*/
|
||||
static void
|
||||
GL_DrawAliasShadowTri (const aliashdr_t *paliashdr, const vert_order_t *vo)
|
||||
{
|
||||
int count = vo->count;;
|
||||
const blended_vert_t *verts = vo->verts;
|
||||
float height, lheight;
|
||||
vec3_t point;
|
||||
const vec_t *scale = paliashdr->mdl.scale;
|
||||
const vec_t *scale_origin = paliashdr->mdl.scale_origin;
|
||||
|
||||
lheight = currententity->origin[2] - lightspot[2];
|
||||
height = -lheight + 1.0;
|
||||
|
||||
qfglBegin (GL_TRIANGLES);
|
||||
|
||||
do {
|
||||
// normals and vertices come from the frame list
|
||||
point[0] = verts->vert[0] * scale[0] + scale_origin[0];
|
||||
point[1] = verts->vert[1] * scale[1] + scale_origin[1];
|
||||
point[2] = verts->vert[2] * scale[2] + scale_origin[2] + lheight;
|
||||
|
||||
point[0] -= shadevector[0] * point[2];
|
||||
point[1] -= shadevector[1] * point[2];
|
||||
point[2] = height;
|
||||
qfglVertex3fv (point);
|
||||
|
||||
verts++;
|
||||
} while (--count);
|
||||
|
||||
qfglEnd ();
|
||||
}
|
||||
|
||||
/*
|
||||
GL_DrawAliasShadow
|
||||
|
||||
|
@ -658,7 +695,10 @@ gl_R_DrawAliasModel (entity_t *e)
|
|||
color_black[3] = model->shadow_alpha;
|
||||
qfglColor4ubv (color_black);
|
||||
}
|
||||
GL_DrawAliasShadow (paliashdr, vo);
|
||||
if (vo->tex_coord)
|
||||
GL_DrawAliasShadowTri (paliashdr, vo);
|
||||
else
|
||||
GL_DrawAliasShadow (paliashdr, vo);
|
||||
|
||||
qfglDepthMask (GL_TRUE);
|
||||
qfglEnable (GL_TEXTURE_2D);
|
||||
|
|
Loading…
Reference in a new issue