|
Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
|
The worker pool Box2D solves across on a device. More...
#include <box2d/types.h>#include <atomic>#include <condition_variable>#include <cstdint>#include <deque>#include <mutex>#include <thread>#include <vector>

Go to the source code of this file.
Classes | |
| class | esengine::physics::TaskPool |
Namespaces | |
| namespace | esengine |
| namespace | esengine::physics |
The worker pool Box2D solves across on a device.
Box2D partitions a step into tasks and asks a host-supplied pool to run them; given none it solves on the calling thread, which is what the web build does and must keep doing (a wasm side module has no threads to hand it). A device has cores sitting idle, so the same module builds this pool there instead. The simulation is unchanged either way: Box2D is deterministic under multithreading, and two threads give the same result as eight.
Two properties of Box2D's solver dictate the shape:
Definition in file PhysicsTaskPool.hpp.