Killed remnants of renderLight precalculated shadowvolume models

This commit is contained in:
Robert Beckebans 2024-05-13 23:11:02 +02:00
parent 985d73697a
commit 729013311d
7 changed files with 11 additions and 47 deletions

View file

@ -290,7 +290,8 @@ void idLight::Save( idSaveGame* savefile ) const
{
savefile->WriteRenderLight( renderLight );
savefile->WriteBool( renderLight.prelightModel != NULL );
// RB keep it for savegame compatibility but we have no support for dmap generated shadow models
savefile->WriteBool( false );
savefile->WriteVec3( localLightOrigin );
savefile->WriteMat3( localLightAxis );
@ -326,21 +327,6 @@ void idLight::Restore( idRestoreGame* savefile )
savefile->ReadRenderLight( renderLight );
savefile->ReadBool( hadPrelightModel );
renderLight.prelightModel = renderModelManager->CheckModel( va( "_prelight_%s", name.c_str() ) );
if( ( renderLight.prelightModel == NULL ) && hadPrelightModel )
{
assert( 0 );
if( developer.GetBool() )
{
// we really want to know if this happens
gameLocal.Error( "idLight::Restore: prelightModel '_prelight_%s' not found", name.c_str() );
}
else
{
// but let it slide after release
gameLocal.Warning( "idLight::Restore: prelightModel '_prelight_%s' not found", name.c_str() );
}
}
savefile->ReadVec3( localLightOrigin );
savefile->ReadMat3( localLightAxis );
@ -415,17 +401,6 @@ void idLight::Spawn()
lightDefHandle = -1; // no static version yet
// see if an optimized shadow volume exists
// the renderer will ignore this value after a light has been moved,
// but there may still be a chance to get it wrong if the game moves
// a light before the first present, and doesn't clear the prelight
renderLight.prelightModel = 0;
if( name[ 0 ] )
{
// this will return 0 if not found
renderLight.prelightModel = renderModelManager->CheckModel( va( "_prelight_%s", name.c_str() ) );
}
spawnArgs.GetBool( "start_off", "0", start_off );
if( start_off )
{
@ -803,7 +778,6 @@ void idLight::BecomeBroken( idEntity* activator )
if( common->IsServer() )
{
ServerSendEvent( EVENT_BECOMEBROKEN, NULL, true );
if( spawnArgs.GetString( "def_damage", "", &damageDefName ) )
@ -811,7 +785,6 @@ void idLight::BecomeBroken( idEntity* activator )
idVec3 origin = renderEntity.origin + renderEntity.bounds.GetCenter() * renderEntity.axis;
gameLocal.RadiusDamage( origin, activator, activator, this, this, damageDefName );
}
}
ActivateTargets( activator );
@ -871,7 +844,6 @@ idLight::PresentModelDefChange
*/
void idLight::PresentModelDefChange()
{
if( !renderEntity.hModel || IsHidden() )
{
return;
@ -1366,7 +1338,6 @@ idLight::WriteToSnapshot
*/
void idLight::WriteToSnapshot( idBitMsg& msg ) const
{
GetPhysics()->WriteToSnapshot( msg );
WriteBindToSnapshot( msg );

View file

@ -71,6 +71,7 @@ ID_INLINE void rvmLightStyleState_t::Reset()
// jmarshall end
//class idStaticEntity;
class idLight : public idEntity
{
@ -174,6 +175,9 @@ private:
int fadeEnd;
bool soundWasPlaying;
// RB: pointing to static model because this light entity was split into 2 entities by convertMapToValve220
//idEntityPtr<idStaticEntity> staticModel;
private:
void PresentLightDefChange();
void PresentModelDefChange();

View file

@ -1627,10 +1627,6 @@ void idRestoreGame::ReadRenderLight( renderLight_t& renderLight )
ReadVec3( renderLight.start );
ReadVec3( renderLight.end );
// only idLight has a prelightModel and it's always based on the entityname, so we'll restore it there
// ReadModel( renderLight.prelightModel );
renderLight.prelightModel = NULL;
ReadInt( renderLight.lightId );
ReadMaterial( renderLight.shader );

View file

@ -3157,7 +3157,6 @@ bool idMapFile::ConvertToValve220Format()
lightEnt->epairs.Delete( "light_rotation" );
lightEnt->epairs.Delete( "light_angles" );
lightEnt->epairs.Delete( "angles" );
lightEnt->epairs.Delete( "angle" );
lightEnt->epairs.Delete( "model" );
@ -3177,6 +3176,8 @@ bool idMapFile::ConvertToValve220Format()
ent->epairs.Set( "name", uniqueName );
ent->epairs.Set( "model", uniqueName );
// TODO replace this with other key that links idLight to func_static entity for syncing color/broken model
lightEnt->epairs.Set( "model", uniqueName );
ent->epairs.SetInt( "_tb_group", tbGroupID );

View file

@ -497,7 +497,7 @@ void idRenderWorldLocal::UpdateLightDef( qhandle_t lightHandle, const renderLigh
rlight->parallel == light->parms.parallel && rlight->pointLight == light->parms.pointLight &&
rlight->right == light->parms.right && rlight->start == light->parms.start &&
rlight->target == light->parms.target && rlight->up == light->parms.up &&
rlight->shader == light->lightShader && rlight->prelightModel == light->parms.prelightModel )
rlight->shader == light->lightShader )
{
justUpdate = true;
}
@ -528,11 +528,6 @@ void idRenderWorldLocal::UpdateLightDef( qhandle_t lightHandle, const renderLigh
light->parms.noShadows = true;
}
if( light->lightHasMoved )
{
light->parms.prelightModel = NULL;
}
if( !justUpdate )
{
R_CreateLightRefs( light );

View file

@ -203,11 +203,6 @@ typedef struct renderLight_s
idVec3 start;
idVec3 end;
// Dmap will generate an optimized shadow volume named _prelight_<lightName>
// for the light against all the _area* models in the map. The renderer will
// ignore this value if the light has been moved after initial creation
idRenderModel* prelightModel;
// muzzle flash lights will not cast shadows from player and weapon world models
int lightId;

View file

@ -713,11 +713,13 @@ void R_CreateLightRefs( idRenderLightLocal* light )
// we can limit the area references to those visible through the portals from the light center.
// We can't do this in the normal case, because shadows are cast from back facing triangles, which
// may be in areas not directly visible to the light projection center.
/*
if( light->parms.prelightModel != NULL && r_useLightPortalFlow.GetBool() && light->lightShader->LightCastsShadows() )
{
light->world->FlowLightThroughPortals( light );
}
else
*/
{
// push the light frustum down the BSP tree into areas
light->world->PushFrustumIntoTree( NULL, light, light->inverseBaseLightProject, bounds_zeroOneCube );