From 36a5247181e1625a66764a4653b2cdd21eccbb26 Mon Sep 17 00:00:00 2001 From: mittorn Date: Wed, 27 Mar 2019 21:16:33 +0700 Subject: [PATCH] ref_soft: bmodel dlights (ignore transform) --- r_main.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/r_main.c b/r_main.c index d1941682..d58186c2 100644 --- a/r_main.c +++ b/r_main.c @@ -1334,6 +1334,7 @@ void R_DrawBEntitiesOnList (void) for( i = 0; i < tr.draw_list->num_solid_entities && !RI.onlyClientDraw; i++ ) { + int k; RI.currententity = tr.draw_list->solid_entities[i]; RI.currentmodel = RI.currententity->model; if (!RI.currentmodel) @@ -1388,6 +1389,22 @@ void R_DrawBEntitiesOnList (void) } }*/ + // calculate dynamic lighting for bmodel + for( k = 0; k < MAX_DLIGHTS; k++ ) + { + dlight_t *l = gEngfuncs.GetDynamicLight( k ); + + if( l->die < gpGlobals->time || !l->radius ) + continue; + + /*VectorCopy( l->origin, oldorigin ); // save lightorigin + Matrix4x4_VectorITransform( RI.objectMatrix, l->origin, origin_l ); + VectorCopy( origin_l, l->origin ); // move light in bmodel space + R_MarkLights( l, 1<nodes + clmodel->hulls[0].firstclipnode ); + VectorCopy( oldorigin, l->origin ); // restore lightorigin*/ + R_MarkLights( l, 1<nodes + RI.currentmodel->hulls[0].firstclipnode ); + } + // RI.currentmodel = tr.draw_list->solid_entities[i]->model; // RI.currententity = tr.draw_list->solid_entities[i]; RI.currententity->topnode = topnode;