First very early and boring WIP of the new MT (multithreaded) branch.
It's mainly a proof of concept, nothing interesting to see.
It renders (albeit with no animations, textures, or anything worth looking at) 40 peasants, 40 militia, 40 footmen, and 40 knights.
It doesn't actually fetch animation data yet, but it does update the nodes, hence making it proof of concept, since that's the most expensive part of the viewer.
It uses N/2 workers, where N is the number of cores on the client's CPU (assuming your browser is updated and the number of cores can be read, otherwise there is always 1 worker).
Note that instances can't be split between workers, only models.
For example, in the above test, if you had 4 logical cores = 2 workers, all of the peasants would update in the first worker, all of the milita in the second worker, all of the footmen in the first one, and all of the knights in the second one.
Generally speaking it seems to run at 60FPS (even in Firefox!) with far less effort than the normal branch.
It does keep spiking, but that's actually because of the garbage collector, since I keep allocating objects.
After simple allocation optimizations (which I did also in the normal viewer multiple times in the past), it would be stable 60FPS.
There are a couple of logical issues, mostly related to data sharing, since data in web workers can't be accessed directly in the main thread, and vice versa.