public override void DoPreFrameWork(Microsoft.Xna.Framework.BoundingFrustum frustum)
        {
            Vector3[] corners = frustum.GetCorners();

            float xx = corners[6].X - corners[2].X;
            float yy = corners[2].Y - corners[6].Y;

            float dx = (corners[2].Y * xx) / yy;

            int minx = (int)(corners[0].X - dx);
            int maxx = (int)(corners[2].X + dx);

            minx = (int)MathHelper.Clamp(minx / 32, 0, blocks.Length - 1);
            maxx = (int)MathHelper.Clamp(maxx / 32, 0, blocks.Length - 1);

            leftFrameBlock  = minx;
            rightFrameBlock = maxx;
        }
Example #2
0
 public void GetEntries(Microsoft.Xna.Framework.BoundingFrustum boundingShape, IList <BroadPhaseEntry> overlaps)
 {
     throw new NotSupportedException("The Grid2DSortAndSweep broad phase cannot accelerate frustum tests.  Consider using a broad phase which supports frustum tests or using a custom solution.");
 }
Example #3
0
 public bool Intersects(BoundingFrustum frustum)
 {
     return(frustum.Intersects(this));
 }
Example #4
0
 /// <summary>
 /// Creates the smallest <see cref="BoundingSphere"/> that can contain a specified <see cref="BoundingFrustum"/>.
 /// </summary>
 /// <param name="frustum">The frustum to create the sphere from.</param>
 /// <returns>The new <see cref="BoundingSphere"/>.</returns>
 public static BoundingSphere CreateFromFrustum(BoundingFrustum frustum)
 {
     return(CreateFromPoints(frustum.GetCorners()));
 }
Example #5
0
 public void DrawFrustum(Microsoft.Xna.Framework.BoundingFrustum frustum)
 {
 }
Example #6
0
File: Plane.cs Project: kiates/FNA
 public PlaneIntersectionType Intersects(BoundingFrustum frustum)
 {
     return(frustum.Intersects(this));
 }
 /// <summary>
 /// Test if a frustum is fully inside, outside, or just intersecting the sphere.
 /// </summary>
 /// <param name="frustum">The frustum for testing.</param>
 /// <param name="result">The containment type as an output parameter.</param>
 public void Contains(ref BoundingFrustum frustum, out ContainmentType result)
 {
     result = this.Contains(frustum);
 }
Example #8
0
 public override void StartFrame(ref Microsoft.Xna.Framework.Matrix view, ref Microsoft.Xna.Framework.Matrix projection, Microsoft.Xna.Framework.BoundingFrustum frustrum)
 {
 }
Example #9
0
 public float?Intersects(BoundingFrustum frustum)
 {
     throw new NotImplementedException();
 }
Example #10
0
        public override void StartFrame(ref Microsoft.Xna.Framework.Matrix view, ref Microsoft.Xna.Framework.Matrix projection, Microsoft.Xna.Framework.BoundingFrustum frustrum)
        {
            rend = 0;
            MaterialSortedObjects.Clear();

            Vector3[] corners = new Vector3[8];
            frustrum.GetCorners(corners);
            List <I2DPhysicObject> objs = world.PhysicWorld.TestAABB(new Vector2(corners[0].X, corners[0].Y), new Vector2(corners[2].X, corners[2].Y));

            foreach (var item in objs)
            {
                I2DObject obj = item.Owner;
                if (!MaterialSortedObjects.ContainsKey(obj.Material.GetType()))
                {
                    MaterialSortedObjects[obj.Material.GetType()] = new List <I2DObject>();
                }

                MaterialSortedObjects[obj.Material.GetType()].Add(obj);
                rend++;
            }

            foreach (var obj  in ghosts)
            {
                if (!MaterialSortedObjects.ContainsKey(obj.Material.GetType()))
                {
                    MaterialSortedObjects[obj.Material.GetType()] = new List <I2DObject>();
                }
                MaterialSortedObjects[obj.Material.GetType()].Add(obj);
            }
            rend += ghosts.Count;
        }
Example #11
0
 public static BoundingSphere CreateFromFrustum(BoundingFrustum frustum)
 {
     return(BoundingSphere.CreateFromPoints((IEnumerable <Vector3>)frustum.GetCorners()));
 }