BSPsortLib(OLD)

Published 2021-12-06
I highly recommend you not to use this library. I made a new one which is far better.

This is a binary space partitioning library for sorting. The real-time BSP allows for triangle intersection and ideal rendering of triangles.

Some features include: Backface culling, Z-clipping, BSP(includes recursion, triangle splitting and sorting)

Unfortunately, it is not very adaptable(at least not compared to QuaternionsLib) and you might have trouble implementing it, depending on your 3D engine framework. With some modifications, you can use this library as a separate engine(as its own sprite in the project) which is given a global list, "#Triangles," and outputs a sorted list(global) of the triangles.

It currently only supports triangles. It is also pretty slow(I think). I suspect much of the lag is from "item # of () in []" blocks.

I used a very cheap fix to avoid cutting triangles into zero-area triangles. Idk how else to do it oop.

This library is derived and adapted from Gamma Engine for use in the new 3D Wars engine. No scripts were actually taken from GG.