From 424786d8d05093abd816a3decd86aace64816179 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Thu, 18 Nov 2010 15:55:53 -0800 Subject: Added viewer-side "object overlaps parcel" check encroachment returnabilty UI Reviewed with Falcon --- indra/newview/llviewerparceloverlay.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'indra/newview/llviewerparceloverlay.cpp') diff --git a/indra/newview/llviewerparceloverlay.cpp b/indra/newview/llviewerparceloverlay.cpp index eee653b0c1..58d9009c90 100644 --- a/indra/newview/llviewerparceloverlay.cpp +++ b/indra/newview/llviewerparceloverlay.cpp @@ -145,6 +145,30 @@ BOOL LLViewerParcelOverlay::isOwnedOther(const LLVector3& pos) const return (PARCEL_OWNED == overlay || PARCEL_FOR_SALE == overlay); } +bool LLViewerParcelOverlay::encroachesOwned(const LLBBox& bbox) const +{ + LLBBox bbox_aligned = bbox.getAxisAligned(); + + LLVector3 min = bbox_aligned.getMinAgent(); + LLVector3 max = bbox_aligned.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)); + + 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; +} + BOOL LLViewerParcelOverlay::isSoundLocal(const LLVector3& pos) const { S32 row = S32(pos.mV[VY] / PARCEL_GRID_STEP_METERS); -- cgit v1.2.3 From 7fc9d701190a75c8f96a0a808d793dbc34860916 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Fri, 17 Dec 2010 19:52:45 -0800 Subject: For object-vs-parcel overlap we now use list of axis aligned boxes one box for each prim, for less slop on queries --- indra/newview/llviewerparceloverlay.cpp | 39 +++++++++++++++++---------------- 1 file changed, 20 insertions(+), 19 deletions(-) (limited to 'indra/newview/llviewerparceloverlay.cpp') 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& 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; } -- cgit v1.2.3 From 049b00a6f10d50609055810b0800f49476b351d2 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Mon, 20 Dec 2010 09:03:59 -0800 Subject: Fixing windows build error about inequality comparison between S32 and U32. --- indra/newview/llviewerparceloverlay.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llviewerparceloverlay.cpp') diff --git a/indra/newview/llviewerparceloverlay.cpp b/indra/newview/llviewerparceloverlay.cpp index 395da5a036..1207ef3340 100644 --- a/indra/newview/llviewerparceloverlay.cpp +++ b/indra/newview/llviewerparceloverlay.cpp @@ -148,7 +148,7 @@ BOOL LLViewerParcelOverlay::isOwnedOther(const LLVector3& pos) const bool LLViewerParcelOverlay::encroachesOwned(const std::vector& boxes) const { // boxes are expected to already be axis aligned - for (S32 i = 0; i < boxes.size(); ++i) + for (U32 i = 0; i < boxes.size(); ++i) { LLVector3 min = boxes[i].getMinAgent(); LLVector3 max = boxes[i].getMaxAgent(); -- cgit v1.2.3 From c8457f266423370e6f8e84c1b23ef95ed69a2997 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 10 Jan 2011 18:01:16 -0800 Subject: STORM-807 : Clean up code as discussed with Andrew --- indra/newview/llviewerparceloverlay.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'indra/newview/llviewerparceloverlay.cpp') diff --git a/indra/newview/llviewerparceloverlay.cpp b/indra/newview/llviewerparceloverlay.cpp index 1207ef3340..d07e06f6a7 100644 --- a/indra/newview/llviewerparceloverlay.cpp +++ b/indra/newview/llviewerparceloverlay.cpp @@ -159,13 +159,17 @@ bool LLViewerParcelOverlay::encroachesOwned(const std::vector& boxes) co 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 ) + if ((PARCEL_SELF == type) + || (PARCEL_GROUP == type)) + { return true; + } } + } } return false; } -- cgit v1.2.3