public virtual void PopulateLightList( Vector3 position, float radius, LightList destList )
{
// Really basic trawl of the lights, then sort
// Subclasses could do something smarter
destList.Clear();
float squaredRadius = radius * radius;
MovableObjectCollection lightList = this.GetMovableObjectCollection( LightFactory.TypeName );
// loop through the scene lights an add ones in range
foreach ( Light light in lightList.Values )
{
if ( light.IsVisible )
{
if ( light.Type == LightType.Directional )
{
// no distance
light.tempSquaredDist = 0.0f;
destList.Add( light );
}
else
{
light.tempSquaredDist = ( light.DerivedPosition - position ).LengthSquared;
light.tempSquaredDist -= squaredRadius;
// only add in-range lights
float range = light.AttenuationRange;
if ( light.tempSquaredDist <= ( range * range ) )
{
destList.Add( light );
}
}
} // if
} // for
// Sort Destination light list.
// TODO: Not needed yet since the current LightList is a sorted list under the hood already
//destList.Sort();
}