public virtual Vector4 GetAs4DVector()
{
Vector4 vec;
if ( this.type == LightType.Directional )
{
// negate direction as 'position'
vec = -(Vector4)this.DerivedDirection;
// infinite distance
vec.w = 0.0f;
}
else
{
vec = (Vector4)this.DerivedPosition;
vec.w = 1.0f;
}
return vec;
}
/// <summary> /// /// </summary> /// <param name="light"></param> /// <param name="extrusionDistance"></param> /// <returns></returns> public override AxisAlignedBox GetDarkCapBounds(Light light, float extrusionDistance) { // Extrude own light cap bounds // need a clone to avoid modifying the original bounding box worldDarkCapBounds = (AxisAlignedBox)GetLightCapBounds().Clone(); ExtrudeBounds(worldDarkCapBounds, light.GetAs4DVector(), extrusionDistance); return(worldDarkCapBounds); }