I also fixed a lingering bug with the level editor that was causing some issues on large levels with > 250k triangles.
Basically, to speed up sorting triangles, I am embedding the material id into the upper bits of the 32-bit triangle id, making only 20 bits available for the id itself. Since I was using a simple sequential id allocation scheme, I was running into wrap around issues on very large levels, b/c ids were never re-used on purpose.
I needed a way to fix this that wouldn't require rebuilding any levels, and would allow at least 1 million triangles in a level at once.
What I ended up doing was keeping the same id scheme, but re-using ids. Rather than keeping a list of all available ids, I just have a bit stored for each id, to say if its used or not. I track the last known partly open 32-bit word, and when I need a new id, I scan through it for an available bit. If I can't find one, I scan through all dword flags sequentially, skipping all that == 0xffffffff. Once I either wrap around to the start ( > 1 M triangles ), or find an open bit, I use that ID for the new tri, and save this one as the last known open dword.
Deleting a tri causes its id bit to be cleared. The bit flags take up 128k and ensure that no more triangles can share ids at once.
Just now I added .OBJ importing to the level editor. Up to now there was no way to load a mesh with multiple materials in it, other than importing an existing level section, so I added obj support to handle this case.
Here is a shot of a bridge .obj with 2 materials attached.