2
0
mirror of https://github.com/FWGS/xash3d-fwgs synced 2024-12-03 23:51:14 +01:00

ref_soft: Transform dlights for entitites

This commit is contained in:
mittorn 2019-04-04 02:00:24 +07:00
parent 4bbcd5daef
commit ebd1da2730
3 changed files with 23 additions and 10 deletions

View File

@ -1115,12 +1115,19 @@ void D_SolidSurf (surf_t *s)
R_RotateBmodel (); // FIXME: don't mess with the frustum,
// make entity passed in
// setup dlight transform
if( s->msurf && s->msurf->dlightframe == tr.framecount )
{
Matrix4x4_CreateFromEntity( RI.objectMatrix, RI.currententity->angles, RI.currententity->origin, 1 );
tr.modelviewIdentity = false;
}
}
else
{
if( alphaspans )
return;
RI.currententity = gEngfuncs.GetEntityByIndex(0); //r_worldentity;
tr.modelviewIdentity = true;
}
pface = s->msurf;

View File

@ -1196,16 +1196,18 @@ void R_DrawBEntitiesOnList (void)
for( k = 0; k < MAX_DLIGHTS; k++ )
{
dlight_t *l = gEngfuncs.GetDynamicLight( k );
vec3_t origin_l, oldorigin;
if( l->die < gpGlobals->time || !l->radius )
continue;
/*VectorCopy( l->origin, oldorigin ); // save lightorigin
VectorCopy( l->origin, oldorigin ); // save lightorigin
Matrix4x4_CreateFromEntity( RI.objectMatrix, RI.currententity->angles, RI.currententity->origin, 1 );
Matrix4x4_VectorITransform( RI.objectMatrix, l->origin, origin_l );
VectorCopy( origin_l, l->origin ); // move light in bmodel space
R_MarkLights( l, 1<<k, clmodel->nodes + clmodel->hulls[0].firstclipnode );
VectorCopy( oldorigin, l->origin ); // restore lightorigin*/
R_MarkLights( l, 1<<k, RI.currentmodel->nodes + RI.currentmodel->hulls[0].firstclipnode );
VectorCopy( oldorigin, l->origin ); // restore lightorigin*/
//R_MarkLights( l, 1<<k, RI.currentmodel->nodes + RI.currentmodel->hulls[0].firstclipnode );
}
// RI.currentmodel = tr.draw_list->solid_entities[i]->model;
@ -1350,16 +1352,19 @@ void R_DrawBrushModel(cl_entity_t *pent)
for( k = 0; k < MAX_DLIGHTS; k++ )
{
dlight_t *l = gEngfuncs.GetDynamicLight( k );
vec3_t origin_l, oldorigin;
if( l->die < gpGlobals->time || !l->radius )
continue;
/*VectorCopy( l->origin, oldorigin ); // save lightorigin
VectorCopy( l->origin, oldorigin ); // save lightorigin
Matrix4x4_CreateFromEntity( RI.objectMatrix, RI.currententity->angles, RI.currententity->origin, 1 );
Matrix4x4_VectorITransform( RI.objectMatrix, l->origin, origin_l );
tr.modelviewIdentity = false;
VectorCopy( origin_l, l->origin ); // move light in bmodel space
R_MarkLights( l, 1<<k, clmodel->nodes + clmodel->hulls[0].firstclipnode );
VectorCopy( oldorigin, l->origin ); // restore lightorigin*/
R_MarkLights( l, 1<<k, RI.currentmodel->nodes + RI.currentmodel->hulls[0].firstclipnode );
VectorCopy( oldorigin, l->origin ); // restore lightorigin*/
//R_MarkLights( l, 1<<k, RI.currentmodel->nodes + RI.currentmodel->hulls[0].firstclipnode );
}
// RI.currentmodel = tr.draw_list->solid_entities[i]->model;
@ -1598,6 +1603,7 @@ void R_RenderScene( void )
R_SetupProjectionMatrix( RI.projectionMatrix );
Matrix4x4_Concat( RI.worldviewProjectionMatrix, RI.projectionMatrix, RI.worldviewMatrix );
tr.modelviewIdentity = true;
// R_SetupGL( true );
//R_Clear( ~0 );

View File

@ -105,10 +105,10 @@ void R_AddDynamicLights( msurface_t *surf )
dl = gEngfuncs.GetDynamicLight( lnum );
// transform light origin to local bmodel space
//if( !tr.modelviewIdentity )
//Matrix4x4_VectorITransform( RI.objectMatrix, dl->origin, origin_l );
//else
VectorCopy( dl->origin, origin_l );
if( !tr.modelviewIdentity )
Matrix4x4_VectorITransform( RI.objectMatrix, dl->origin, origin_l );
else
VectorCopy( dl->origin, origin_l );
rad = dl->radius;
dist = PlaneDiff( origin_l, surf->plane );