summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorAndrew Meadows <andrew@lindenlab.com>2010-12-17 19:52:45 -0800
committerAndrew Meadows <andrew@lindenlab.com>2010-12-17 19:52:45 -0800
commit7fc9d701190a75c8f96a0a808d793dbc34860916 (patch)
tree9d4079adaad40a72b287c70ed22db0c86a223b76 /indra/newview
parent3be87bb04685e971965ab5ac4166165c3785476f (diff)
For object-vs-parcel overlap we now use list of axis aligned boxes
one box for each prim, for less slop on queries
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llviewerobject.cpp15
-rw-r--r--indra/newview/llviewerparceloverlay.cpp39
-rw-r--r--indra/newview/llviewerparceloverlay.h6
-rw-r--r--indra/newview/llviewerregion.cpp4
-rw-r--r--indra/newview/llviewerregion.h2
5 files changed, 35 insertions, 31 deletions
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index ae2154d63b..18d6e4c8c8 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -518,18 +518,21 @@ void LLViewerObject::setNameValueList(const std::string& name_value_list)
// agent.
bool LLViewerObject::isReturnable()
{
- LLBBox bounding_box(getPositionRegion(), getRotationRegion(), getScale() * -0.5f, getScale() * 0.5f);
+ if (isAttachment())
+ {
+ return false;
+ }
+ std::vector<LLBBox> boxes;
+ boxes.push_back(LLBBox(getPositionRegion(), getRotationRegion(), getScale() * -0.5f, getScale() * 0.5f).getAxisAligned());
for (child_list_t::iterator iter = mChildList.begin();
iter != mChildList.end(); iter++)
{
LLViewerObject* child = *iter;
- LLBBox child_box(child->getPositionRegion(), child->getRotationRegion(), child->getScale() * -0.5f, child->getScale() * 0.5f);
- bounding_box.addBBoxAgent(child_box);
+ boxes.push_back(LLBBox(child->getPositionRegion(), child->getRotationRegion(), child->getScale() * -0.5f, child->getScale() * 0.5f).getAxisAligned());
}
- return !isAttachment()
- && mRegionp
- && mRegionp->objectIsReturnable(getPositionRegion(), bounding_box);
+ return mRegionp
+ && mRegionp->objectIsReturnable(getPositionRegion(), boxes);
}
BOOL LLViewerObject::setParent(LLViewerObject* parent)
diff --git a/indra/newview/llviewerparceloverlay.cpp b/indra/newview/llviewerparceloverlay.cpp
index 58d9009c90..395da5a036 100644
--- a/indra/newview/llviewerparceloverlay.cpp
+++ b/indra/newview/llviewerparceloverlay.cpp
@@ -145,27 +145,28 @@ BOOL LLViewerParcelOverlay::isOwnedOther(const LLVector3& pos) const
return (PARCEL_OWNED == overlay || PARCEL_FOR_SALE == overlay);
}
-bool LLViewerParcelOverlay::encroachesOwned(const LLBBox& bbox) const
+bool LLViewerParcelOverlay::encroachesOwned(const std::vector<LLBBox>& boxes) const
{
- LLBBox bbox_aligned = bbox.getAxisAligned();
-
- LLVector3 min = bbox_aligned.getMinAgent();
- LLVector3 max = bbox_aligned.getMaxAgent();
+ // boxes are expected to already be axis aligned
+ for (S32 i = 0; i < boxes.size(); ++i)
+ {
+ LLVector3 min = boxes[i].getMinAgent();
+ LLVector3 max = boxes[i].getMaxAgent();
+
+ S32 left = S32(llclamp((min.mV[VX] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1));
+ S32 right = S32(llclamp((max.mV[VX] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1));
+ S32 top = S32(llclamp((min.mV[VY] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1));
+ S32 bottom = S32(llclamp((max.mV[VY] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1));
- S32 left = S32(llclamp((min.mV[VX] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1));
- S32 right = S32(llclamp((max.mV[VX] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1));
- S32 top = S32(llclamp((min.mV[VY] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1));
- S32 bottom = S32(llclamp((max.mV[VY] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1));
-
- for (S32 row = top; row <= bottom; row++)
- for (S32 column = left; column <= right; column++)
- {
- U8 type = ownership(row, column);
- if (PARCEL_SELF == type
- || PARCEL_GROUP == type )
- return true;
- }
-
+ for (S32 row = top; row <= bottom; row++)
+ for (S32 column = left; column <= right; column++)
+ {
+ U8 type = ownership(row, column);
+ if (PARCEL_SELF == type
+ || PARCEL_GROUP == type )
+ return true;
+ }
+ }
return false;
}
diff --git a/indra/newview/llviewerparceloverlay.h b/indra/newview/llviewerparceloverlay.h
index 4aa42eb8a4..c80baedda6 100644
--- a/indra/newview/llviewerparceloverlay.h
+++ b/indra/newview/llviewerparceloverlay.h
@@ -57,9 +57,9 @@ public:
BOOL isOwnedOther(const LLVector3& pos) const;
// "encroaches" means the prim hangs over the parcel, but its center
- // might be in another parcel. for now, we simply test bounding boxes
- // which isn't perfect, but is close
- bool encroachesOwned(const LLBBox& bbox) const;
+ // might be in another parcel. for now, we simply test axis aligned
+ // bounding boxes which isn't perfect, but is close
+ bool encroachesOwned(const std::vector<LLBBox>& boxes) const;
BOOL isSoundLocal(const LLVector3& pos) const;
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index 43b26fe830..32e7cc3468 100644
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -1500,13 +1500,13 @@ LLSpatialPartition* LLViewerRegion::getSpatialPartition(U32 type)
const U32 ALLOW_RETURN_ENCROACHING_OBJECT = REGION_FLAGS_ALLOW_RETURN_ENCROACHING_OBJECT
| REGION_FLAGS_ALLOW_RETURN_ENCROACHING_ESTATE_OBJECT;
-bool LLViewerRegion::objectIsReturnable(const LLVector3& pos, const LLBBox& bbox)
+bool LLViewerRegion::objectIsReturnable(const LLVector3& pos, const std::vector<LLBBox>& boxes) const
{
return (mParcelOverlay != NULL)
&& (mParcelOverlay->isOwnedSelf(pos)
|| mParcelOverlay->isOwnedGroup(pos)
|| ((mRegionFlags & ALLOW_RETURN_ENCROACHING_OBJECT)
- && mParcelOverlay->encroachesOwned(bbox)) );
+ && mParcelOverlay->encroachesOwned(boxes)) );
}
void LLViewerRegion::showReleaseNotes()
diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h
index 76228c0d2a..3d3f1d62a6 100644
--- a/indra/newview/llviewerregion.h
+++ b/indra/newview/llviewerregion.h
@@ -295,7 +295,7 @@ public:
LLSpatialPartition* getSpatialPartition(U32 type);
- bool objectIsReturnable(const LLVector3& pos, const LLBBox& bbox);
+ bool objectIsReturnable(const LLVector3& pos, const std::vector<LLBBox>& boxes) const;
public:
struct CompareDistance
{