aboutsummaryrefslogtreecommitdiff
path: root/NvCloth/src/scalar/SwCollisionHelpers.h
diff options
context:
space:
mode:
Diffstat (limited to 'NvCloth/src/scalar/SwCollisionHelpers.h')
-rw-r--r--NvCloth/src/scalar/SwCollisionHelpers.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/NvCloth/src/scalar/SwCollisionHelpers.h b/NvCloth/src/scalar/SwCollisionHelpers.h
index 3ab756f..c86d939 100644
--- a/NvCloth/src/scalar/SwCollisionHelpers.h
+++ b/NvCloth/src/scalar/SwCollisionHelpers.h
@@ -69,13 +69,17 @@ struct Gather<Scalar4i>
Gather<Scalar4i>::Gather(const Scalar4i& index)
{
+ //index are grid positions
+
uint32_t mask = /* sGridSize */ 8 - 1;
+ // Get grid index (forced within range)
mIndex.u4[0] = index.u4[0] & mask;
mIndex.u4[1] = index.u4[1] & mask;
mIndex.u4[2] = index.u4[2] & mask;
mIndex.u4[3] = index.u4[3] & mask;
+ // true (filled with all ones = -1) when gridSize <= index || index < 0
mOutOfRange.i4[0] = index.u4[0] & ~mask ? 0 : -1;
mOutOfRange.i4[1] = index.u4[1] & ~mask ? 0 : -1;
mOutOfRange.i4[2] = index.u4[2] & ~mask ? 0 : -1;
@@ -84,6 +88,7 @@ Gather<Scalar4i>::Gather(const Scalar4i& index)
Scalar4i Gather<Scalar4i>::operator()(const Scalar4i* ptr) const
{
+ //ptr points to the cone/sphere grid
const int32_t* base = ptr->i4;
const int32_t* index = mIndex.i4;
const int32_t* mask = mOutOfRange.i4;