mercoledì 2 dicembre 2015

Day 89: Indexed meshes

Until now I used to load meshes into a single vertex buffer object. This is bad for performances, because more data need to be sent to the gpu, while an indexed mesh allow to use a single vertex multiple times.

Another big advantage of indexed meshes is the fact that they are easier to read and manually modify, allowing procedural mesh generation.

So today I refactored everything mesh-related, starting from the loading of the mesh, which now produces a vertex array and an index array.

Then I modified all the batches, both 2D and 3D to use the new indexed mesh. Now everything is working and maybe I gained a little fps in all of this, but the real win is the possibility to easily access the mesh data.

Tomorrow I'll try to write a mesh_builder class to procedurally generate meshes. 

Nessun commento:

Posta un commento