public bool OnQueryResult( MovableObject sceneObject )
{
if ( sceneObject.CastShadows && sceneObject.IsVisible
&& sceneManager.SpecialCaseRenderQueueList.IsRenderQueueToBeProcessed( sceneObject.RenderQueueGroup ) )
{
if ( this.farDistSquared > 0 )
{
// Check object is within the shadow far distance
Vector3 toObj = sceneObject.ParentNode.DerivedPosition - this.camera.DerivedPosition;
float radius = sceneObject.GetWorldBoundingSphere().Radius;
float dist = toObj.LengthSquared;
if ( dist - ( radius * radius ) > this.farDistSquared )
{
// skip, beyond max range
return true;
}
}
// If the object is in the frustum, we can always see the shadow
if ( this.camera.IsObjectVisible( sceneObject.GetWorldBoundingBox() ) )
{
this.casterList.Add( sceneObject );
return true;
}
// Otherwise, object can only be casting a shadow into our view if
// the light is outside the frustum (or it's a directional light,
// which are always outside), and the object is intersecting
// on of the volumes formed between the edges of the frustum and the
// light
if ( !this.isLightInFrustum || this.light.Type == LightType.Directional )
{
// Iterate over volumes
for ( int i = 0; i < this.lightClipVolumeList.Count; i++ )
{
PlaneBoundedVolume pbv = (PlaneBoundedVolume)this.lightClipVolumeList[ i ];
if ( pbv.Intersects( sceneObject.GetWorldBoundingBox() ) )
{
this.casterList.Add( sceneObject );
return true;
}
}
}
}
return true;
}