public bool box_intersects_cell_bsp_inner(BSPNode node, List <Vector3> corners) { foreach (var corner in corners) { if (node.SplittingPlane.GetSide(corner) != Side.Behind) { return(false); } } return(true); }
public List <BSPPortal> PurgePortals() { var portals = new List <BSPPortal>(); if (PosNode != null) { portals.AddRange(PosNode.PurgePortals()); PosNode = null; } if (NegNode != null) { portals.AddRange(NegNode.PurgePortals()); NegNode = null; } return(portals); }
public BSPNode(DatLoader.Entity.BSPNode node, Dictionary <ushort, DatLoader.Entity.Polygon> polys, DatLoader.Entity.CVertexArray vertexArray) { if (node.Sphere != null) { Sphere = new Sphere(node.Sphere); } if (node.SplittingPlane != null) { SplittingPlane = node.SplittingPlane.ToNumerics(); } Type = (BSPTreeType)node.Type; //Typename if (node.InPolys != null) { NumPolys = node.InPolys.Count; PolyIDs = node.InPolys; Polygons = new List <Polygon>(); foreach (var poly in node.InPolys) { Polygons.Add(new Polygon(polys[poly], vertexArray)); } } if (node.PosNode != null) { if (!(node.PosNode is DatLoader.Entity.BSPLeaf)) { PosNode = new BSPNode(node.PosNode, polys, vertexArray); } else // portal? { PosNode = new BSPLeaf((DatLoader.Entity.BSPLeaf)node.PosNode, polys, vertexArray); } } if (node.NegNode != null) { if (!(node.NegNode is DatLoader.Entity.BSPLeaf)) { NegNode = new BSPNode(node.NegNode, polys, vertexArray); } else // portal? { NegNode = new BSPLeaf((DatLoader.Entity.BSPLeaf)node.NegNode, polys, vertexArray); } } }
public BSPTree(DatLoader.Entity.BSPTree bsp, Dictionary <ushort, DatLoader.Entity.Polygon> polys, DatLoader.Entity.CVertexArray vertexArray) { RootNode = new BSPNode(bsp.RootNode, polys, vertexArray); }
public BSPTree(BSPNode rootNode) { RootNode = rootNode; }