aboutsummaryrefslogtreecommitdiff
path: root/PhysX_3.4/Source/PhysX/src/NpSpatialIndex.cpp
diff options
context:
space:
mode:
authorsschirm <[email protected]>2016-12-23 14:20:36 +0100
committersschirm <[email protected]>2016-12-23 14:56:17 +0100
commitef6937e69e8ee3f409cf9d460d5ad300a65d5924 (patch)
tree710426e8daa605551ce3f34b581897011101c30f /PhysX_3.4/Source/PhysX/src/NpSpatialIndex.cpp
parentInitial commit: (diff)
downloadphysx-3.4-ef6937e69e8ee3f409cf9d460d5ad300a65d5924.tar.xz
physx-3.4-ef6937e69e8ee3f409cf9d460d5ad300a65d5924.zip
PhysX 3.4 / APEX 1.4 release candidate @21506124
Diffstat (limited to 'PhysX_3.4/Source/PhysX/src/NpSpatialIndex.cpp')
-rw-r--r--PhysX_3.4/Source/PhysX/src/NpSpatialIndex.cpp41
1 files changed, 15 insertions, 26 deletions
diff --git a/PhysX_3.4/Source/PhysX/src/NpSpatialIndex.cpp b/PhysX_3.4/Source/PhysX/src/NpSpatialIndex.cpp
index bda0b2ff..3164b473 100644
--- a/PhysX_3.4/Source/PhysX/src/NpSpatialIndex.cpp
+++ b/PhysX_3.4/Source/PhysX/src/NpSpatialIndex.cpp
@@ -49,27 +49,29 @@ NpSpatialIndex::~NpSpatialIndex()
PX_DELETE(mPruner);
}
-PxSpatialIndexItemId NpSpatialIndex::insert(PxSpatialIndexItem& item,
- const PxBounds3& bounds)
+PxSpatialIndexItemId NpSpatialIndex::insert(PxSpatialIndexItem& item, const PxBounds3& bounds)
{
PX_SIMD_GUARD;
- PX_CHECK_AND_RETURN_VAL(bounds.isValid(), "PxSpatialIndex::insert: bounds are not valid.", PX_SPATIAL_INDEX_INVALID_ITEM_ID);
+ PX_CHECK_AND_RETURN_VAL(bounds.isValid(), "PxSpatialIndex::insert: bounds are not valid.", PX_SPATIAL_INDEX_INVALID_ITEM_ID);
PrunerHandle output;
PrunerPayload payload;
payload.data[0] = reinterpret_cast<size_t>(&item);
- mPruner->addObjects(&output, &bounds, &payload);
+ mPruner->addObjects(&output, &bounds, &payload, 1, false);
mPendingUpdates = true;
return output;
}
-void NpSpatialIndex::update(PxSpatialIndexItemId id,
- const PxBounds3& bounds)
+void NpSpatialIndex::update(PxSpatialIndexItemId id, const PxBounds3& bounds)
{
PX_SIMD_GUARD;
- PX_CHECK_AND_RETURN(bounds.isValid(), "PxSpatialIndex::update: bounds are not valid.");
+ PX_CHECK_AND_RETURN(bounds.isValid(), "PxSpatialIndex::update: bounds are not valid.");
+
+ PxBounds3* b;
+ mPruner->getPayload(id, b);
+ *b = bounds;
+ mPruner->updateObjectsAfterManualBoundsUpdates(&id, 1);
- mPruner->updateObjects(&id, &bounds);
mPendingUpdates = true;
}
@@ -77,15 +79,10 @@ void NpSpatialIndex::remove(PxSpatialIndexItemId id)
{
PX_SIMD_GUARD;
- mPruner->removeObjects(&id);
+ mPruner->removeObjects(&id, 1);
mPendingUpdates = true;
}
-PxBounds3 NpSpatialIndex::getBounds(PxSpatialIndexItemId /*id*/) const
-{
- return PxBounds3();
-}
-
namespace
{
struct OverlapCallback: public PrunerCallback
@@ -137,11 +134,10 @@ void NpSpatialIndex::flushUpdates() const
mPendingUpdates = false;
}
-void NpSpatialIndex::overlap(const PxBounds3& aabb,
- PxSpatialOverlapCallback& callback) const
+void NpSpatialIndex::overlap(const PxBounds3& aabb, PxSpatialOverlapCallback& callback) const
{
PX_SIMD_GUARD;
- PX_CHECK_AND_RETURN(aabb.isValid(), "PxSpatialIndex::overlap: aabb is not valid.");
+ PX_CHECK_AND_RETURN(aabb.isValid(), "PxSpatialIndex::overlap: aabb is not valid.");
flushUpdates();
OverlapCallback cb(callback);
@@ -151,10 +147,7 @@ void NpSpatialIndex::overlap(const PxBounds3& aabb,
mPruner->overlap(shapeData, cb);
}
-void NpSpatialIndex::raycast(const PxVec3& origin,
- const PxVec3& unitDir,
- PxReal maxDist,
- PxSpatialLocationCallback& callback) const
+void NpSpatialIndex::raycast(const PxVec3& origin, const PxVec3& unitDir, PxReal maxDist, PxSpatialLocationCallback& callback) const
{
PX_SIMD_GUARD;
@@ -167,10 +160,7 @@ void NpSpatialIndex::raycast(const PxVec3& origin,
mPruner->raycast(origin, unitDir, maxDist, cb);
}
-void NpSpatialIndex::sweep(const PxBounds3& aabb,
- const PxVec3& unitDir,
- PxReal maxDist,
- PxSpatialLocationCallback& callback) const
+void NpSpatialIndex::sweep(const PxBounds3& aabb, const PxVec3& unitDir, PxReal maxDist, PxSpatialLocationCallback& callback) const
{
PX_SIMD_GUARD;
@@ -213,7 +203,6 @@ void NpSpatialIndex::release()
delete this;
}
-
PxSpatialIndex* physx::PxCreateSpatialIndex()
{
return PX_NEW(NpSpatialIndex)();