I've created a test geometry involving two boxes, one inside the other, with the outer box's normals pointing inwards.
The BSP generator can't handle it. That's not good.
The BSP generator has two big problems.
The first is with this concept of just duplicating partitioned triangle indices that I've been trying out.
We end up passing entire geometries down the tree where they are duplicated endlessly.
The second problem is that I have not implemented some way of marking a splitting plane as having been previously used, and so not a suitable candidate in subsequent selections.
There may be no alternative but to implement a full partitioning of the input geometry.
I was hoping to avoid this because the result is that we generate a LOT more triangles and new vertices.
However I see no way to avoid it.
If anyone wants to comment, now is a good time
Having gone most of the way to fully implementing a complete triangle splitting bsp tree generator, I found more fundamental bugs in the implementation - subsequently I discovered that the Triangle Index based scheme probably would have been ok had these bugs not been causing hell.
Oh well, I'll forge ahead.
I have repurposed the global list of planes in the tree container class to record the planes I've actually used as a splitting plane, and implemented a Triangle class which contains indices and the triangle's plane.
Various methods have been adjusted to take a Triangle*