| 91 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 92 | |
| 93 | bool AABBPruner::addObjects(PrunerHandle* results, const PxBounds3* bounds, const PrunerPayload* payload, PxU32 count, bool hasPruningStructure) |
| 94 | { |
| 95 | PX_PROFILE_ZONE("SceneQuery.prunerAddObjects", mContextID); |
| 96 | |
| 97 | if(!count) |
| 98 | return true; |
| 99 | |
| 100 | // no need to do refitMarked for added objects since they are not in the tree |
| 101 | |
| 102 | // if we have provided pruning structure, we will merge it, the changes will be applied after the objects has been addded |
| 103 | if(!hasPruningStructure || !mAABBTree) |
| 104 | mUncommittedChanges = true; |
| 105 | |
| 106 | // PT: TODO: 'addObjects' for bucket pruner too. Not urgent since we always call the function with count=1 at the moment |
| 107 | const PxU32 valid = mPool.addObjects(results, bounds, payload, count); |
| 108 | |
| 109 | // Bucket pruner is only used while the dynamic pruner is rebuilding |
| 110 | // For the static pruner a full rebuild will happen in commit() every time we modify something, this is not true if |
| 111 | // pruning structure was provided. The objects tree will be merged directly into the static tree. No rebuild will be triggered. |
| 112 | if(mIncrementalRebuild && mAABBTree) |
| 113 | { |
| 114 | mNeedsNewTree = true; // each add forces a tree rebuild |
| 115 | |
| 116 | // if a pruner structure is provided, we dont move the new objects into bucket pruner |
| 117 | // the pruning structure will be merged into the bucket pruner |
| 118 | if(!hasPruningStructure) |
| 119 | { |
| 120 | for(PxU32 i=0;i<valid;i++) |
| 121 | { |
| 122 | #if USE_INCREMENTAL_PRUNER |
| 123 | const PrunerHandle& handle = results[i]; |
| 124 | const PoolIndex poolIndex = mPool.getIndex(handle); |
| 125 | mBucketPruner.addObject(payload[i], bounds[i], mTimeStamp, poolIndex); |
| 126 | #else |
| 127 | mBucketPruner.addObject(payload[i], bounds[i], mTimeStamp, INVALID_NODE_ID); |
| 128 | #endif |
| 129 | } |
| 130 | } |
| 131 | } |
| 132 | return valid==count; |
| 133 | } |
| 134 | |
| 135 | void AABBPruner::updateObjectsAfterManualBoundsUpdates(const PrunerHandle* handles, PxU32 count) |
| 136 | { |
no test coverage detected