public CellStruct(DatLoader.Entity.CellStruct cellStruct) { Polygons = new Dictionary <ushort, Polygon>(); foreach (var poly in cellStruct.Polygons) { Polygons.Add(poly.Key, PolygonCache.Get(poly.Value, cellStruct.VertexArray)); } Portals = new List <Polygon>(); foreach (var portal in cellStruct.Portals) { Portals.Add(Polygons[portal]); } PhysicsPolygons = new Dictionary <ushort, Polygon>(); foreach (var poly in cellStruct.PhysicsPolygons) { PhysicsPolygons.Add(poly.Key, PolygonCache.Get(poly.Value, cellStruct.VertexArray)); } if (cellStruct.CellBSP != null) { CellBSP = BSPCache.Get(cellStruct.CellBSP, cellStruct.PhysicsPolygons, cellStruct.VertexArray); } if (cellStruct.DrawingBSP != null) { DrawingBSP = BSPCache.Get(cellStruct.DrawingBSP, cellStruct.Polygons, cellStruct.VertexArray); } if (cellStruct.PhysicsBSP != null) { PhysicsBSP = BSPCache.Get(cellStruct.PhysicsBSP, cellStruct.PhysicsPolygons, cellStruct.VertexArray); } }
public CellStruct(DatLoader.Entity.CellStruct cellStruct) { NumPortals = cellStruct.Portals.Count; NumPolygons = cellStruct.Polygons.Count; NumPhysicsPolygons = cellStruct.PhysicsPolygons.Count; Polygons = new Dictionary <ushort, Polygon>(); foreach (var poly in cellStruct.Polygons) { Polygons.Add(poly.Key, new Polygon(poly.Value, cellStruct.VertexArray)); } Portals = new List <Polygon>(); foreach (var portal in cellStruct.Portals) { Portals.Add(Polygons[portal]); } PhysicsPolygons = new Dictionary <ushort, Polygon>(); foreach (var poly in cellStruct.PhysicsPolygons) // todo: link to regular polys { PhysicsPolygons.Add(poly.Key, new Polygon(poly.Value, cellStruct.VertexArray)); } if (cellStruct.CellBSP != null) { CellBSP = new BSPTree(cellStruct.CellBSP, cellStruct.PhysicsPolygons, cellStruct.VertexArray); // physics or drawing? } if (cellStruct.DrawingBSP != null) { DrawingBSP = new BSPTree(cellStruct.DrawingBSP, cellStruct.Polygons, cellStruct.VertexArray); } if (cellStruct.PhysicsBSP != null) { PhysicsBSP = new BSPTree(cellStruct.PhysicsBSP, cellStruct.PhysicsPolygons, cellStruct.VertexArray); } }