Add PhysWorld2D::UseSpatialHash

This commit is contained in:
Jérôme Leclercq 2018-02-09 17:25:11 +01:00
parent 17849226e4
commit bb7c97ed9a
3 changed files with 8 additions and 0 deletions

View File

@ -64,6 +64,7 @@ Nazara Engine:
- ⚠️ LuaInstance no longer load all lua libraries on construction, this is done in the new LoadLibraries method which allows you to excludes some libraries
- Clock::Restart now returns the elapsed microseconds since construction or last Restart call
- Add PhysWorld2D::[Get|Set]IterationCount to control how many iterations chipmunk will perform per step.
- Add PhysWorld2D::UseSpatialHash to use spatial hashing instead of bounding box trees, which may speedup simulation in some cases.
Nazara Development Kit:
- Added ImageWidget (#139)

View File

@ -75,6 +75,8 @@ namespace Nz
void Step(float timestep);
void UseSpatialHash(float cellSize, std::size_t entityCount);
PhysWorld2D& operator=(const PhysWorld2D&) = delete;
PhysWorld2D& operator=(PhysWorld2D&&) = delete; ///TODO

View File

@ -322,6 +322,11 @@ namespace Nz
}
}
void PhysWorld2D::UseSpatialHash(float cellSize, std::size_t entityCount)
{
cpSpaceUseSpatialHash(m_handle, cpFloat(cellSize), int(entityCount));
}
void PhysWorld2D::InitCallbacks(cpCollisionHandler* handler, const Callback& callbacks)
{
auto it = m_callbacks.emplace(handler, std::make_unique<Callback>(callbacks)).first;