void OnOpenStatic(object sender, EventArgs ea) { string fileName = sender as string; if (fileName == null) { return; } IArch sa = new StaticArch(); sa.ReadFromFile(fileName, mGD.GD, true); mMap = new Map(); int count = sa.GetPartCount(); for (int i = 0; i < count; i++) { Bounds bnd = new Bounds(); List <Vector3> pos; List <int> inds; sa.GetPartPositions(i, out pos, out inds); for (int j = 0; j < inds.Count; j += 3) { bnd.AddPointToBounds(pos[inds[j]]); bnd.AddPointToBounds(pos[inds[j + 1]]); bnd.AddPointToBounds(pos[inds[j + 2]]); } mMap.PrepareTriTree(bnd); mOutForm.Print("Convexizing part " + i + ": " + sa.GetPartName(i) + "\n"); List <Vector3> tri = new List <Vector3>(); for (int j = 0; j < inds.Count; j += 3) { tri.Add(pos[inds[j]]); tri.Add(pos[inds[j + 1]]); tri.Add(pos[inds[j + 2]]); mMap.AddBSPTriangle(tri); tri.Clear(); } mMap.AddBSPVolume(bnd); mMap.AccumulateVolumes(); } if (count <= 0) { mOutForm.Print(fileName + " didn't have anything usable.\n"); mMap = null; return; } BuildDebugDraw(Map.DebugDrawChoice.TriTree); int numDumped = mMap.DumpBSPVolumesToQuarkMap(FileUtil.StripExtension(fileName)); mOutForm.Print(fileName + " opened and " + numDumped + " brushes extracted.\n"); mMap = null; }