venerdì 22 luglio 2016

Day 151: Building the hierarchy

Today I added a few functionalities to the BVH in order to create the hierarchy automatically.
Instead of creating it at the beginning of the game manually, the process is completely automatic. It is possible to insert a node and delete it. The tree will automatically insert the node in the best position (the one that minimizes the size of the parent bounding volume). When the node is deleted, it is removed from the BVH tree, and the bounding volumes are automatically updated.
I've not tested the class because it requires quite a lot of test code, so I'll take its good functioning for granted, and eventually fix bugs when I'll actually use it.

Right now the class works only with spheres, but being it a template class it is pretty easy to adapt it to boxes as well, maybe I'll do it in the future if the need arises.

Tomorrow I'll start to work on spatial partitioning.

Nessun commento:

Posta un commento