]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - r_sprites.c
Refactored R_UpdateEntityLighting to CL_UpdateEntityShading, which sets fields like...
[xonotic/darkplaces.git] / r_sprites.c
index a45a3e73b5ddaefe8a3535b906903033b143c155..d72bee10f904fa42cf8179fd55e61fa491f6cb46 100644 (file)
@@ -392,9 +392,15 @@ static void R_Model_Sprite_Draw_TransparentCallback(const entity_render_t *ent,
                        frame = model->sprite.sprdata_frames + ent->frameblend[i].subframe;
                        texture = R_GetCurrentTexture(model->data_textures + ent->frameblend[i].subframe);
                
-                       // lit sprite by lightgrid if it is not fullbright, lit only ambient
+                       // sprites are fullbright by default, but if this one is not fullbright we
+                       // need to combine the lighting into ambient as sprite lighting is not
+                       // directional
                        if (!(texture->currentmaterialflags & MATERIALFLAG_FULLBRIGHT))
-                               VectorAdd(ent->modellight_ambient, ent->modellight_diffuse, rsurface.modellight_ambient); // sprites dont use lightdirection
+                       {
+                               VectorMAM(1.0f, texture->render_modellight_ambient, 0.25f, texture->render_modellight_diffuse, texture->render_modellight_ambient);
+                               VectorClear(texture->render_modellight_diffuse);
+                               VectorClear(texture->render_modellight_specular);
+                       }
 
                        // SPR_LABEL should not use depth test AT ALL
                        if(model->sprite.sprnum_type == SPR_LABEL || model->sprite.sprnum_type == SPR_LABEL_SCALE)