|
tile2d
|
Allows collisions between different bodies to occur. More...
#include <world.hpp>
Classes | |
| struct | BodyElement |
| struct | Cache |
| struct | SpatialIndex |
Public Types | |
| using | TileMapT = TileMap<TileData> |
| using | TileBodyT = TileBody<TileData> |
| using | BodyList = LinkedListHeader<BodyElement, FreeList<BodyElement, uint32_t>, uint32_t> |
Public Member Functions | |
| World (size_t threadCount) | |
| Constructs a physics world. | |
| WorldBody * | createTileBody (TileMapT &tileMap) |
| Do not use. See createTileMap() | |
| WorldBody * | createBulletBody (Float radius, const vec2 &initialLinearVelocity) |
| NOT YET IMPLEMENTED. Creates a bullet body. | |
| void | destroyBody (WorldBody *body) |
| Destroys a body, must be a type of a bullet or a tile body. | |
| void | update (const Float dt, size_t steps) |
Updates the body by dt. | |
| Float | getExecutionTimeAvg () |
| Returns the average speed of update. The stats will reset after call. | |
| vec2 | gravity () const |
| Returns the gravity of the world. | |
| void | setGravity (const vec2 &gravity) |
| Set the gravity of the world. | |
| Grid< SpatialIndex > & | grid () |
| Returns a grid refence, may be used for queries or insertions. | |
Protected Member Functions | |
| template<class Func > | |
| void | executeOnBodies (Float timePerStep, Func &&func) |
| void | updateBodies (Float timePerStep, size_t start, size_t end) |
| void | batchQuery (Float timePerStep, size_t start, size_t end) |
| void | insertIntoTree (WorldBody *body) |
| void | eraseFromTree (WorldBody *body) |
Allows collisions between different bodies to occur.
Constructs a physics world.
| threadCount | The amount of threads to create to allow for additional speed up, may be 0. |
|
inline |
NOT YET IMPLEMENTED. Creates a bullet body.
| radius | The radius of the bullet |
| initialLinearVelocity | The initial linear velocity of the body |
Destroys a body, must be a type of a bullet or a tile body.
| body | The body to destroy |
|
inline |
Returns the average speed of update. The stats will reset after call.
|
inline |
Returns the gravity of the world.
|
inline |
Returns a grid refence, may be used for queries or insertions.
|
inline |
Set the gravity of the world.
| gravity | The new gravity |
|
inline |
Updates the body by dt.
| dt | The amount of time to simulate |
| steps | Essentialy, the quality of the simulation. Higher steps means higher quality but is slower to process. Recommended amount is 6 if its called 60 times a second |