public void UpdateZones( PCZone defaultZone, ulong frameCount )
{
//update the zones this light affects
PCZone homeZone;
affectedZonesList.Clear();
affectsVisibleZone = false;
PCZSceneNode sn = (PCZSceneNode)( this.ParentSceneNode );
if ( null != sn )
{
// start with the zone the light is in
homeZone = sn.HomeZone;
if ( null != homeZone )
{
affectedZonesList.Add( homeZone );
if ( homeZone.LastVisibleFrame == frameCount )
{
affectsVisibleZone = true;
}
}
else
{
// error - scene node has no homezone!
// just say it affects the default zone and leave it at that.
affectedZonesList.Add( defaultZone );
if ( defaultZone.LastVisibleFrame == frameCount )
{
affectsVisibleZone = true;
}
return;
}
}
else
{
// ERROR! not connected to a scene node,
// just say it affects the default zone and leave it at that.
affectedZonesList.Add( defaultZone );
if ( defaultZone.LastVisibleFrame == frameCount )
{
affectsVisibleZone = true;
}
return;
}
// now check visibility of each portal in the home zone. If visible to
// the light then add the target zone of the portal to the list of
// affected zones and recurse into the target zone
PCZFrustum portalFrustum = new PCZFrustum();
Vector3 v = DerivedPosition;
portalFrustum.SetOrigin( v );
homeZone.CheckLightAgainstPortals( this, frameCount, portalFrustum, null );
}
//-----------------------------------------------------------------------