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:
parent
4bbcd5daef
commit
ebd1da2730
7
r_edge.c
7
r_edge.c
@ -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;
|
||||
|
18
r_main.c
18
r_main.c
@ -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 );
|
||||
|
8
r_surf.c
8
r_surf.c
@ -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 );
|
||||
|
Loading…
Reference in New Issue
Block a user