public List <int> CollectTester(ITester tester) { ReturnTriangles.Clear(); if (tester.Overlaps(ref Bounds, 0)) { TraverseNode(0, ref Bounds, tester); } return(ReturnTriangles); }
public void TraverseNode(int ix, ref AABB bounds, ITester tester) { #if DEBUG nodesTested.Add(bounds); #endif #if VALIDATE GetNodeTris(ix, ref bounds, tester); #else GetNodeTris(ix, tester); #endif float expand = Nodes[ix].Expansion; Vector3 c = bounds.Lo + (bounds.Hi - bounds.Lo) * 0.5f; AABB aabb; aabb.Lo = bounds.Lo; aabb.Hi = c; if (Nodes[ix].Child000 != 0 && tester.Overlaps(ref aabb, expand)) { TraverseNode(Nodes[ix].Child000, ref aabb, tester); } aabb.Lo.Z = c.Z; aabb.Hi.Z = bounds.Hi.Z; if (Nodes[ix].Child001 != 0 && tester.Overlaps(ref aabb, expand)) { TraverseNode(Nodes[ix].Child001, ref aabb, tester); } aabb.Lo.Z = bounds.Lo.Z; aabb.Hi.Z = c.Z; aabb.Lo.Y = c.Y; aabb.Hi.Y = bounds.Hi.Y; if (Nodes[ix].Child010 != 0 && tester.Overlaps(ref aabb, expand)) { TraverseNode(Nodes[ix].Child010, ref aabb, tester); } aabb.Lo.Z = c.Z; aabb.Hi.Z = bounds.Hi.Z; if (Nodes[ix].Child011 != 0 && tester.Overlaps(ref aabb, expand)) { TraverseNode(Nodes[ix].Child011, ref aabb, tester); } aabb.Lo.Z = bounds.Lo.Z; aabb.Hi.Z = c.Z; aabb.Lo.Y = bounds.Lo.Y; aabb.Hi.Y = c.Y; aabb.Lo.X = c.X; aabb.Hi.X = bounds.Hi.X; if (Nodes[ix].Child100 != 0 && tester.Overlaps(ref aabb, expand)) { TraverseNode(Nodes[ix].Child100, ref aabb, tester); } aabb.Lo.Z = c.Z; aabb.Hi.Z = bounds.Hi.Z; if (Nodes[ix].Child101 != 0 && tester.Overlaps(ref aabb, expand)) { TraverseNode(Nodes[ix].Child101, ref aabb, tester); } aabb.Lo.Z = bounds.Lo.Z; aabb.Hi.Z = c.Z; aabb.Lo.Y = c.Y; aabb.Hi.Y = bounds.Hi.Y; if (Nodes[ix].Child110 != 0 && tester.Overlaps(ref aabb, expand)) { TraverseNode(Nodes[ix].Child110, ref aabb, tester); } aabb.Lo.Z = c.Z; aabb.Hi.Z = bounds.Hi.Z; if (Nodes[ix].Child111 != 0 && tester.Overlaps(ref aabb, expand)) { TraverseNode(Nodes[ix].Child111, ref aabb, tester); } }
public List<int> CollectTester(ITester tester) { ReturnTriangles.Clear(); if (tester.Overlaps(ref Bounds, 0)) { TraverseNode(0, ref Bounds, tester); } return ReturnTriangles; }