public void UpdateZones(PCZone defaultZone, ulong frameCount) { //update the zones this light affects PCZone homeZone; this.affectedZonesList.Clear(); this.affectsVisibleZone = false; var sn = (PCZSceneNode)(ParentSceneNode); if (null != sn) { // start with the zone the light is in homeZone = sn.HomeZone; if (null != homeZone) { this.affectedZonesList.Add(homeZone); if (homeZone.LastVisibleFrame == frameCount) { this.affectsVisibleZone = true; } } else { // error - scene node has no homezone! // just say it affects the default zone and leave it at that. this.affectedZonesList.Add(defaultZone); if (defaultZone.LastVisibleFrame == frameCount) { this.affectsVisibleZone = true; } return; } } else { // ERROR! not connected to a scene node, // just say it affects the default zone and leave it at that. this.affectedZonesList.Add(defaultZone); if (defaultZone.LastVisibleFrame == frameCount) { this.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 var portalFrustum = new PCZFrustum(); Vector3 v = GetDerivedPosition(); portalFrustum.SetOrigin(v); homeZone.CheckLightAgainstPortals(this, frameCount, portalFrustum, null); }
public void UpdateZones( PCZone defaultZone, ulong frameCount ) { //update the zones this light affects PCZone homeZone; this.affectedZonesList.Clear(); this.affectsVisibleZone = false; var sn = (PCZSceneNode)( ParentSceneNode ); if ( null != sn ) { // start with the zone the light is in homeZone = sn.HomeZone; if ( null != homeZone ) { this.affectedZonesList.Add( homeZone ); if ( homeZone.LastVisibleFrame == frameCount ) { this.affectsVisibleZone = true; } } else { // error - scene node has no homezone! // just say it affects the default zone and leave it at that. this.affectedZonesList.Add( defaultZone ); if ( defaultZone.LastVisibleFrame == frameCount ) { this.affectsVisibleZone = true; } return; } } else { // ERROR! not connected to a scene node, // just say it affects the default zone and leave it at that. this.affectedZonesList.Add( defaultZone ); if ( defaultZone.LastVisibleFrame == frameCount ) { this.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 var portalFrustum = new PCZFrustum(); Vector3 v = GetDerivedPosition(); portalFrustum.SetOrigin( v ); homeZone.CheckLightAgainstPortals( this, frameCount, portalFrustum, null ); }