Beispiel #1
0
        private bool LoopVisible()
        {
            if (!FezMath.IsOrthographic(this.CameraManager.Viewpoint))
            {
                return(true);
            }
            Vector3         vector3_1   = FezMath.Abs(FezMath.RightVector(this.CameraManager.Viewpoint));
            BoundingFrustum frustum     = this.CameraManager.Frustum;
            BoundingBox     boundingBox = new BoundingBox()
            {
                Min =
                {
                    X = -frustum.Left.D * frustum.Left.DotNormal(vector3_1),
                    Y = -frustum.Bottom.D * frustum.Bottom.Normal.Y
                },
                Max =
                {
                    X = -frustum.Right.D * frustum.Right.DotNormal(vector3_1),
                    Y = -frustum.Top.D * frustum.Top.Normal.Y
                }
            };
            Vector3   vector3_2 = FezMath.Min(boundingBox.Min, boundingBox.Max);
            Vector3   vector3_3 = FezMath.Max(boundingBox.Min, boundingBox.Max);
            Rectangle rectangle = new Rectangle()
            {
                X      = (int)Math.Floor((double)vector3_2.X),
                Y      = (int)Math.Floor((double)vector3_2.Y),
                Width  = (int)Math.Ceiling((double)vector3_3.X - (double)vector3_2.X),
                Height = (int)Math.Ceiling((double)vector3_3.Y - (double)vector3_2.Y)
            };

            if (rectangle.Y >= 0)
            {
                return((double)(rectangle.Y + rectangle.Height) >= (double)this.LevelManager.Size.Y);
            }
            else
            {
                return(true);
            }
        }