From a7327acb80f7ca1426ca036eb3d77ecb66239898 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 17 Jul 2012 17:10:48 +0900 Subject: [PATCH] Set up shadevector for gl alias models. The setup had been lost at some stage, thus shadows were always directly under the entity. Unlike the original quake shadow code, the vector is correctly transformed into the entity's space. --- libs/video/renderer/gl/gl_mod_alias.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libs/video/renderer/gl/gl_mod_alias.c b/libs/video/renderer/gl/gl_mod_alias.c index fbab684ce..c74e1815c 100644 --- a/libs/video/renderer/gl/gl_mod_alias.c +++ b/libs/video/renderer/gl/gl_mod_alias.c @@ -678,6 +678,8 @@ gl_R_DrawAliasModel (entity_t *e) // torches, grenades, and lightning bolts do not have shadows if (r_shadows->int_val && model->shadow_alpha) { + mat4_t shadow_mat; + qfglPushMatrix (); gl_R_RotateForEntity (e); @@ -695,6 +697,12 @@ gl_R_DrawAliasModel (entity_t *e) color_black[3] = model->shadow_alpha; qfglColor4ubv (color_black); } + shadevector[0] = 1; + shadevector[1] = 0; + shadevector[2] = 1; + VectorNormalize (shadevector); + Mat4Transpose (e->transform, shadow_mat); + Mat4as3MultVec (shadow_mat, shadevector, shadevector); if (vo->tex_coord) GL_DrawAliasShadowTri (paliashdr, vo); else