Today I didn't start to work on physics again because I noted that the sorting in the batch class has a major impact on the performance. Thus I tried to implement a few solution in order to avoid the sorting:
1) keep a sorted list, and insert and remove objects from there
2) keep a normal list, but sort it only if something is modified
In the end I didn't implement either of them, because it is very difficult and overcomplicated to track when an object is to be drawn or not. All of these factors are to be considered:
-Model creation, submodel creation, model modification, submodel modification, add model to game object, add submodel to model, activate object, deactivate object, destructors, etc etc etc
So in the end I just added a property to the batch class to disable the sorting. This will be up to the user. If I find a better solution I'll try to implement it, but for now I'll stick with that.
I tested it and I managed to improve a lot the particles emitter by disabling the useless sorting.
Nessun commento:
Posta un commento