Minor optimization for shadows, and make translucent objects have shadows matching their alpha.

This commit is contained in:
Ragnvald Maartmann-Moe IV 2002-06-14 04:14:52 +00:00
parent 942bf55c06
commit 463ac44d9f

View file

@ -619,25 +619,26 @@ R_DrawAliasModel (entity_t *e, qboolean cull)
} }
} }
if (modelalpha < 1.0)
qfglDepthMask (GL_TRUE);
qfglPopMatrix (); qfglPopMatrix ();
// FIXME: Translucent objects should cast colored shadows
// torches, grenades, and lightning bolts do not have shadows // torches, grenades, and lightning bolts do not have shadows
if (r_shadows->int_val && clmodel->shadow_alpha) { if (r_shadows->int_val && clmodel->shadow_alpha) {
qfglPushMatrix (); qfglPushMatrix ();
R_RotateForEntity (e); R_RotateForEntity (e);
qfglDisable (GL_TEXTURE_2D); qfglDisable (GL_TEXTURE_2D);
color_black[3] = (clmodel->shadow_alpha + 1) / 2; qfglDepthMask (GL_FALSE);
color_black[3] = modelalpha * ((clmodel->shadow_alpha + 1) / 2);
qfglColor4ubv (color_black); qfglColor4ubv (color_black);
GL_DrawAliasShadow (paliashdr, vo); GL_DrawAliasShadow (paliashdr, vo);
qfglDepthMask (GL_TRUE);
qfglEnable (GL_TEXTURE_2D); qfglEnable (GL_TEXTURE_2D);
qfglPopMatrix (); qfglPopMatrix ();
} } else if (modelalpha < 1.0)
qfglDepthMask (GL_TRUE);
Cache_Release (&e->model->cache); Cache_Release (&e->model->cache);
} }