PT: TODO: the userData is actually a PxAggregate pointer. Maybe we could expose/use that.
| 1313 | |
| 1314 | // PT: TODO: the userData is actually a PxAggregate pointer. Maybe we could expose/use that. |
| 1315 | AggregateHandle AABBManager::createAggregate(BoundsIndex index, Bp::FilterGroup::Enum group, void* userData, const bool selfCollisions) |
| 1316 | { |
| 1317 | // PX_ASSERT(checkID(index)); |
| 1318 | |
| 1319 | Aggregate* aggregate = PX_NEW(Aggregate)(index, selfCollisions); |
| 1320 | |
| 1321 | AggregateHandle handle; |
| 1322 | if(mFirstFreeAggregate==PX_INVALID_U32) |
| 1323 | { |
| 1324 | handle = mAggregates.size(); |
| 1325 | mAggregates.pushBack(aggregate); |
| 1326 | } |
| 1327 | else |
| 1328 | { |
| 1329 | handle = mFirstFreeAggregate; |
| 1330 | mFirstFreeAggregate = PxU32(reinterpret_cast<size_t>(mAggregates[mFirstFreeAggregate])); |
| 1331 | mAggregates[handle] = aggregate; |
| 1332 | } |
| 1333 | |
| 1334 | #ifdef BP_USE_AGGREGATE_GROUP_TAIL |
| 1335 | /* #ifdef BP_FILTERING_USES_TYPE_IN_GROUP |
| 1336 | PxU32 id = index; |
| 1337 | id<<=2; |
| 1338 | id|=FilterType::AGGREGATE; |
| 1339 | initEntry(index, 0.0f, Bp::FilterGroup::Enum(id), userData); |
| 1340 | #endif*/ |
| 1341 | initEntry(index, 0.0f, getAggregateGroup(), userData); |
| 1342 | PX_UNUSED(group); |
| 1343 | #else |
| 1344 | initEntry(index, 0.0f, group, userData); |
| 1345 | #endif |
| 1346 | |
| 1347 | mVolumeData[index].setAggregate(handle); |
| 1348 | |
| 1349 | mBoundsArray.setBounds(PxBounds3::empty(), index); // PT: no need to set mPersistentStateChanged since "setBounds" already does something similar |
| 1350 | |
| 1351 | mNbAggregates++; |
| 1352 | |
| 1353 | // PT: we don't add empty aggregates to mAddedHandleMap yet, since they make the BP crash. |
| 1354 | return handle; |
| 1355 | } |
| 1356 | |
| 1357 | bool AABBManager::destroyAggregate(BoundsIndex& index_, Bp::FilterGroup::Enum& group_, AggregateHandle aggregateHandle) |
| 1358 | { |