public override void NotifyCurrentCamera( Camera cam )
{
// Determine active lod
Vector3 diff = cam.DerivedPosition - center;
// Distance from the edge of the bounding sphere
camDistanceSquared = diff.LengthSquared - boundingRadius * boundingRadius;
// Clamp to 0
camDistanceSquared = Utility.Max( 0.0f, camDistanceSquared );
float maxDist = parent.SquaredRenderingDistance;
if ( parent.RenderingDistance > 0 && camDistanceSquared > maxDist && cam.UseRenderingDistance )
{
beyondFarDistance = true;
}
else
{
beyondFarDistance = false;
currentLod = (ushort)( lodValues.Count - 1 );
for ( ushort i = 0; i < lodValues.Count; ++i )
{
if ( (float)lodValues[ i ] > camDistanceSquared )
{
currentLod = (ushort)( i - 1 );
break;
}
}
}
}