Skip to content

Commit

Permalink
clearing manifolds, no PCM caching
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrilgramblicka committed Sep 28, 2016
1 parent 39590d5 commit 8a603b3
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions src/otbullet/discrete_dynamics_world.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,13 @@ namespace ot {
{
continue;
}


if (rb->getActivationState() == ISLAND_SLEEPING) {
continue;
}

btPersistentManifold * manifold;
if (rb->getTerrainManifoldHandle() == 0xffffffff) {
if (rb->getTerrainManifoldHandle() == UINT32_MAX) {
manifold = getDispatcher()->getNewManifold(obj, _planet_body);
btPersistentManifold ** manifold_h_ptr = _manifolds.add();
*manifold_h_ptr = manifold;
Expand All @@ -165,18 +168,12 @@ namespace ot {
else {
manifold = *_manifolds.get_item(rb->getTerrainManifoldHandle());
}

if (rb->getActivationState() == ISLAND_SLEEPING) {
continue;
}


btCollisionObjectWrapper planet_wrapper(0, _planet_body->getCollisionShape(), _planet_body, btTransform::getIdentity(), -1, -1);
btCollisionObjectWrapper collider_wrapper(0, obj->getCollisionShape(), obj, obj->getWorldTransform(), -1, -1);
btManifoldResult res(&collider_wrapper, &planet_wrapper);


int cached_points = manifold->getNumContacts();

if (obj->getCollisionShape()->getShapeType() == COMPOUND_SHAPE_PROXYTYPE) {
btCompoundShape * cs = reinterpret_cast<btCompoundShape *>(obj->getCollisionShape());
new (_compound_processing_stack.add_uninit(1)) compound_processing_entry(cs, obj->getWorldTransform());
Expand All @@ -198,8 +195,11 @@ namespace ot {

}


res.setPersistentManifold(manifold);

manifold->clearManifold();

for (uints j = 0; j < _cow_internal.size(); j++) {

btCollisionObjectWrapper internal_obj_wrapper(_cow_internal[j]._parent,
Expand Down Expand Up @@ -251,7 +251,7 @@ namespace ot {

_rad = (float)rad;

min = (max - min) / 2.0;
min = (max - min) * 0.5;
_lod_dim = (float)min[min.minAxis()];
common_data->prepare_bt_convex_collision(&res, &internal_obj_wrapper);
}
Expand Down Expand Up @@ -296,15 +296,11 @@ namespace ot {
common_data->process_collision_points();
}

int num_contacts = manifold->getNumContacts();

res.refreshContactPoints();

if (manifold->getNumContacts() == 0) {
getDispatcher()->releaseManifold(manifold);
_manifolds.get_item(rb->getTerrainManifoldHandle());
_manifolds.del(_manifolds.get_item(rb->getTerrainManifoldHandle()));
rb->setTerrainManifoldHandle(0xffffffff);
rb->setTerrainManifoldHandle(UINT32_MAX);
}
}

Expand All @@ -316,7 +312,7 @@ namespace ot {
for (uints i = 0; i < tree_batches_cache.size(); i++) {
bt::tree_batch * tb = tree_batches_cache[i];

if (tb->last_frame_used == 0xffffffff) {
if (tb->last_frame_used == UINT32_MAX) {
build_tb_collision_info(tb);
}

Expand Down

0 comments on commit 8a603b3

Please sign in to comment.