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; }
public override void onObjectAdded(I2DObject obj) { if (!MaterialSortedObjects.ContainsKey(obj.Material.GetType())) { MaterialSortedObjects[obj.Material.GetType()] = new List <I2DObject>(); } MaterialSortedObjects[obj.Material.GetType()].Add(obj); }