Axiom.SceneManagers.Bsp.TextureLight.AffectsFaceGroup C# (CSharp) Method

AffectsFaceGroup() public method

public AffectsFaceGroup ( Axiom.Graphics.StaticFaceGroup faceGroup, ManualCullingMode cullMode ) : bool
faceGroup Axiom.Graphics.StaticFaceGroup
cullMode ManualCullingMode
return bool
		public bool AffectsFaceGroup( StaticFaceGroup faceGroup, ManualCullingMode cullMode )
		{
			bool affects = false;
			float lightDist = 0, angle;

			if ( this.Type == LightType.Directional )
			{
				angle = faceGroup.plane.Normal.Dot( this.DerivedDirection );

				if ( cullMode != ManualCullingMode.None )
				{
					if ( ( ( angle < 0 ) && ( cullMode == ManualCullingMode.Front ) ) ||
						( ( angle > 0 ) && ( cullMode == ManualCullingMode.Back ) ) )
						return false;
				}
			}
			else
			{
				lightDist = faceGroup.plane.GetDistance( this.DerivedPosition );

				if ( cullMode != ManualCullingMode.None )
				{
					if ( ( ( lightDist < 0 ) && ( cullMode == ManualCullingMode.Back ) ) ||
						( ( lightDist > 0 ) && ( cullMode == ManualCullingMode.Front ) ) )
						return false;
				}
			}

			switch ( this.Type )
			{
				case LightType.Directional:
					affects = true;
					break;

				case LightType.Point:
					if ( Utility.Abs( lightDist ) < range )
						affects = true;
					break;

				case LightType.Spotlight:
					if ( Utility.Abs( lightDist ) < range )
					{
						angle = faceGroup.plane.Normal.Dot( this.DerivedDirection );
						if ( ( ( lightDist < 0 && angle > 0 ) || ( lightDist > 0 && angle < 0 ) ) &&
							Utility.Abs( angle ) >= Utility.Cos( this.spotOuter * 0.5f ) )
							affects = true;
					}
					break;
			}

			return affects;
		}