In an export plugin that I'm writing, I want to implement face slicing and sorting, based on a BSP tree. If I use the e3d mesh format, building a tree-like structure is easy enough:
However, I'd prefer to process the WEDS instead, because its splitting tools are free and produce valid meshes that have good normals and import well. My problem is that I can't branch the recursion with a WEDS and have to essentially iterate over it. What would you suggest I use to make the BSP tree? Should it even be a tree in this case, or would I be better off using a proplist or something to store the branching?
Code:
bsp([H|T]) ->
{Front,Back} = split(H, T),
{H,{bsp(Back),bsp(Front)}};
bsp([]) ->
nil.