public static BSPTree Read(DatReader datReader, BSPType treeType) { BSPTree obj = new BSPTree(); obj.RootNode = BSPNode.Read(datReader, treeType); return(obj); }
public static BSPPortal ReadPortal(DatReader datReader, BSPType treeType) { BSPPortal obj = new BSPPortal(); obj.Type = 0x504F5254; // PORT obj.SplittingPlane = Plane.Read(datReader); obj.PosNode = BSPNode.Read(datReader, treeType); obj.NegNode = BSPNode.Read(datReader, treeType); if (treeType == BSPType.Drawing) { obj.Sphere = CSphere.Read(datReader); uint numPolys = datReader.ReadUInt32(); uint numPortals = datReader.ReadUInt32(); for (uint i = 0; i < numPolys; i++) { obj.InPolys.Add(datReader.ReadUInt16()); } for (uint i = 0; i < numPortals; i++) { obj.InPortals.Add(PortalPoly.Read(datReader)); } } return(obj); }
} = new List <ushort>(); // List of PolygonIds public static BSPNode Read(DatReader datReader, BSPType treeType) { BSPNode obj = new BSPNode(); obj.Type = datReader.ReadUInt32(); switch (obj.Type) { case PORT: return(BSPPortal.ReadPortal(datReader, treeType)); case LEAF: return(BSPLeaf.ReadLeaf(datReader, treeType)); } obj.SplittingPlane = Plane.Read(datReader); switch (obj.Type) { case BPnn: case BPIn: obj.PosNode = BSPNode.Read(datReader, treeType); break; case BpIN: case BpnN: obj.NegNode = BSPNode.Read(datReader, treeType); break; case BPIN: case BPnN: obj.PosNode = BSPNode.Read(datReader, treeType); obj.NegNode = BSPNode.Read(datReader, treeType); break; } if (treeType == BSPType.Cell) { return(obj); } obj.Sphere = CSphere.Read(datReader); if (treeType == BSPType.Physics) { return(obj); } uint numPolys = datReader.ReadUInt32(); for (uint i = 0; i < numPolys; i++) { obj.InPolys.Add(datReader.ReadUInt16()); } return(obj); }