Skip to content

Commit

Permalink
client: render: disabled purging dynamic lights that used for video p…
Browse files Browse the repository at this point in the history
…rojecting
  • Loading branch information
SNMetamorph committed Dec 14, 2024
1 parent 2781346 commit 376cdc4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions client/render/cl_dlight.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ GNU General Public License for more details.
#define DLF_ASPECT4X3 BIT( 5 )
#define DLF_FLIPTEXTURE BIT( 6 )
#define DLF_PARENTENTITY_NOSHADOW BIT( 7 )
#define DLF_MOVIE BIT( 8 )

class CDynLight
{
Expand Down
14 changes: 9 additions & 5 deletions client/render/gl_dlight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,19 @@ void CL_DecayLights( void )
float time = GET_CLIENT_TIME();
CDynLight *pl = tr.dlights;

for( int i = 0; i < MAX_DLIGHTS; i++, pl++ )
for (int i = 0; i < MAX_DLIGHTS; i++, pl++)
{
if( !pl->radius ) continue;
if (!pl->radius)
continue;

if (FBitSet(pl->flags, DLF_MOVIE))
continue; // don't clean up dlights that used for video projecting

pl->radius -= tr.frametime * pl->decay;
if( pl->radius < 0.0f ) pl->radius = 0.0f;
if (pl->radius < 0.0f) pl->radius = 0.0f;

if( pl->Expired( ))
memset( pl, 0, sizeof( *pl ));
if (pl->Expired())
memset(pl, 0, sizeof(*pl));
}
}

Expand Down
2 changes: 1 addition & 1 deletion client/render/gl_scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ static bool R_HandleLightEntity(cl_entity_t *ent)
if (dlight->spotlightTexture == tr.spotlightTexture[1])
return true; // invalid texture?

flags = DLF_ASPECT3X4; // fit to film01.avi aspect
flags = DLF_ASPECT3X4 | DLF_MOVIE; // fit to film01.avi aspect
type = LIGHT_SPOT;

if (!R_UpdateCinematicDynLight(entity.GetVideoFileIndex(), dlight))
Expand Down

0 comments on commit 376cdc4

Please sign in to comment.