ArrayList findVisibleFaces(ArrayList visibleLeafs) { // May be a face will be fall into two or more BSP // leaf, to avoid add visible the same face more than // once, use a flag array to do that if (visibleLeafs == null) { throw new ArgumentException(); } bool[] alreadyVisibleFaces = new bool[_faces.Length]; ArrayList visibleFaces = new ArrayList(); foreach (int i in visibleLeafs) { BSPTreeLeaf lf = _leafs[i]; for (int j = lf.leafface; j < lf.leafface + lf.n_leaffaces; j++) { int faceIndex = _leaffaces[j]; if (!alreadyVisibleFaces[faceIndex]) { alreadyVisibleFaces[faceIndex] = true; visibleFaces.Add(faceIndex); } } } return(visibleFaces); }
ArrayList findVisibleFaces(ArrayList visibleLeafs) { if (visibleLeafs == null) { throw new ArgumentException(); } bool[] alreadyVisibleFaces = new bool[_faces.Length]; ArrayList visibleFaces = new ArrayList(); foreach (int i in visibleLeafs) { BSPTreeLeaf lf = _leafs[i]; for (int j = lf.leafface; j < lf.leafface + lf.n_leaffaces; j++) { int faceIndex = _leaffaces[j]; if (!alreadyVisibleFaces[faceIndex]) { alreadyVisibleFaces[faceIndex] = true; visibleFaces.Add(faceIndex); } } } return(visibleFaces); }