wind,
The full source of azone is in cvs, the interesting file is:
http://eqemulator.cvs.sourceforge.ne....4&view=markup
Overall it is just a simple quadtree, ignoring the Z axis, the only hard part is doing triangle-cube intersection, but im sure you have code for that somewhere, or can port the C++. The on-disk format was meant to match to in-memory format on the reader side, so azone does a bit of extra work to get everything packed together correctly.
There are a few different criteria from stopping the quadtree split, mainly number of triangles remaining in the box, or the size of the box. I also added an information-gain style termination criteria such that if splitting the box does not actually split up the polygons further, then we stop, but I cant remember if this did any good or not. All in all, the stopping criteria are rather arbitrary, changing them around or adding more should not hurt anything.
let me know if you have any issues.