void buildSubspaceGeometries() { for(ConvexSubspaceProxy const &subspace : subspaces) { /// @todo Move BSP leaf construction here? BspLeaf &bspLeaf = *subspace.bspLeaf(); subspace.buildGeometry(bspLeaf, *mesh); // Account the new segments. /// @todo Refactor away. for(OrderedSegment const &oseg : subspace.segments()) { if(oseg.segment->hasHEdge()) { // There is now one more line segment. segmentCount += 1; } } } /* * Finalize the built geometry by adding a twin half-edge for any * which don't yet have one. */ for(ConvexSubspaceProxy const &convexSet : subspaces) for(OrderedSegment const &oseg : convexSet.segments()) { LineSegmentSide *seg = oseg.segment; if(seg->hasHEdge() && !seg->back().hasHEdge()) { HEdge *hedge = &seg->hedge(); DENG2_ASSERT(!hedge->hasTwin()); // Allocate the twin from the same mesh. hedge->setTwin(hedge->mesh().newHEdge(seg->back().from())); hedge->twin().setTwin(hedge); } } }