Added viewer-side "object overlaps parcel" check encroachment returnabilty UI

Reviewed with Falcon
master
Andrew Meadows 2010-11-18 15:55:53 -08:00
parent 807007649a
commit 424786d8d0
10 changed files with 100 additions and 36 deletions

View File

@ -89,6 +89,20 @@ void LLBBox::addBBoxAgent(const LLBBox& b)
}
}
LLBBox LLBBox::getAxisAligned() const
{
// no rotiation = axis aligned rotation
LLBBox aligned(mPosAgent, LLQuaternion(), LLVector3(), LLVector3());
// add the center point so that it's not empty
aligned.addPointAgent(mPosAgent);
// add our BBox
aligned.addBBoxAgent(*this);
return aligned;
}
void LLBBox::expand( F32 delta )
{
@ -147,6 +161,15 @@ BOOL LLBBox::containsPointAgent(const LLVector3& p) const
return containsPointLocal(point_local);
}
LLVector3 LLBBox::getMinAgent() const
{
return localToAgent(mMinLocal);
}
LLVector3 LLBBox::getMaxAgent() const
{
return localToAgent(mMaxLocal);
}
/*
LLBBox operator*(const LLBBox &a, const LLMatrix4 &b)

View File

@ -51,9 +51,11 @@ public:
const LLVector3& getPositionAgent() const { return mPosAgent; }
const LLQuaternion& getRotation() const { return mRotation; }
LLVector3 getMinAgent() const;
const LLVector3& getMinLocal() const { return mMinLocal; }
void setMinLocal( const LLVector3& min ) { mMinLocal = min; }
LLVector3 getMaxAgent() const;
const LLVector3& getMaxLocal() const { return mMaxLocal; }
void setMaxLocal( const LLVector3& max ) { mMaxLocal = max; }
@ -80,6 +82,9 @@ public:
LLVector3 localToAgentBasis(const LLVector3& v) const;
LLVector3 agentToLocalBasis(const LLVector3& v) const;
// Get the smallest possible axis aligned bbox that contains this bbox
LLBBox getAxisAligned() const;
// friend LLBBox operator*(const LLBBox& a, const LLMatrix4& b);

View File

@ -42,8 +42,7 @@ const U32 REGION_FLAGS_RESET_HOME_ON_TELEPORT = (1 << 3);
// Does the sun move?
const U32 REGION_FLAGS_SUN_FIXED = (1 << 4);
// Tax free zone (no taxes on objects, land, etc.)
const U32 REGION_FLAGS_TAX_FREE = (1 << 5);
//const U32 REGION_FLAGS_TAX_FREE = (1 << 5); // legacy
// Can't change the terrain heightfield, even on owned parcels,
// but can plant trees and grass.
@ -54,17 +53,15 @@ const U32 REGION_FLAGS_BLOCK_LAND_RESELL = (1 << 7);
// All content wiped once per night
const U32 REGION_FLAGS_SANDBOX = (1 << 8);
const U32 REGION_FLAGS_NULL_LAYER = (1 << 9);
// const U32 REGION_FLAGS_SKIP_AGENT_ACTION = (1 << 10);
const U32 REGION_FLAGS_HARD_ALLOW_LAND_TRANSFER = (1 << 10); // Region allows land reselling
// const U32 REGION_FLAGS_SKIP_UPDATE_INTEREST_LIST= (1 << 11);
const U32 REGION_FLAGS_HARD_ALLOW_POST_CLASSIFIED = (1 << 11); // Region allows posting of classified ads
//const U32 REGION_FLAGS_NULL_LAYER = (1 << 9);
//const U32 REGION_FLAGS_HARD_ALLOW_LAND_TRANSFER = (1 << 10);
//const U32 REGION_FLAGS_SKIP_UPDATE_INTEREST_LIST= (1 << 11);
const U32 REGION_FLAGS_SKIP_COLLISIONS = (1 << 12); // Pin all non agent rigid bodies
const U32 REGION_FLAGS_SKIP_SCRIPTS = (1 << 13);
const U32 REGION_FLAGS_SKIP_PHYSICS = (1 << 14); // Skip all physics
const U32 REGION_FLAGS_EXTERNALLY_VISIBLE = (1 << 15);
//const U32 REGION_FLAGS_MAINLAND_VISIBLE = (1 << 16);
const U32 REGION_FLAGS_PUBLIC_ALLOWED = (1 << 17);
const U32 REGION_FLAGS_ALLOW_RETURN_ENCROACHING_OBJECT = (1 << 16);
const U32 REGION_FLAGS_ALLOW_RETURN_ENCROACHING_ESTATE_OBJECT = (1 << 17);
const U32 REGION_FLAGS_BLOCK_DWELL = (1 << 18);
// Is flight allowed?
@ -81,18 +78,22 @@ const U32 REGION_FLAGS_ESTATE_SKIP_SCRIPTS = (1 << 21);
const U32 REGION_FLAGS_RESTRICT_PUSHOBJECT = (1 << 22);
const U32 REGION_FLAGS_DENY_ANONYMOUS = (1 << 23);
// const U32 REGION_FLAGS_DENY_IDENTIFIED = (1 << 24);
// const U32 REGION_FLAGS_DENY_TRANSACTED = (1 << 25);
//const U32 REGION_FLAGS_DENY_IDENTIFIED = (1 << 24);
//const U32 REGION_FLAGS_DENY_TRANSACTED = (1 << 25);
const U32 REGION_FLAGS_ALLOW_PARCEL_CHANGES = (1 << 26);
// const U32 REGION_FLAGS_ABUSE_EMAIL_TO_ESTATE_OWNER = (1 << 27); // We no longer support ELAR
// Deprecated. Phoeinx 2009-12-11
// REGION_FLAGS_ABUSE_EMAIL_TO_ESTATE_OWNER is unused beyond viewer-1.23
// but we leave uncommented because viewer-1.23 still uses it
//const U32 REGION_FLAGS_ABUSE_EMAIL_TO_ESTATE_OWNER = (1 << 27);
const U32 REGION_FLAGS_ALLOW_VOICE = (1 << 28);
const U32 REGION_FLAGS_BLOCK_PARCEL_SEARCH = (1 << 29);
const U32 REGION_FLAGS_DENY_AGEUNVERIFIED = (1 << 30);
const U32 REGION_FLAGS_SKIP_MONO_SCRIPTS = (1 << 31);
//const U32 REGION_FLAGS_SKIP_MONO_SCRIPTS = (1 << 31);
const U32 REGION_FLAGS_DEFAULT = REGION_FLAGS_ALLOW_LANDMARK |
REGION_FLAGS_ALLOW_SET_HOME |
@ -105,7 +106,6 @@ const U32 REGION_FLAGS_PRELUDE_UNSET = REGION_FLAGS_ALLOW_LANDMARK
| REGION_FLAGS_ALLOW_SET_HOME;
const U32 REGION_FLAGS_ESTATE_MASK = REGION_FLAGS_EXTERNALLY_VISIBLE
| REGION_FLAGS_PUBLIC_ALLOWED
| REGION_FLAGS_SUN_FIXED
| REGION_FLAGS_DENY_ANONYMOUS
| REGION_FLAGS_DENY_AGEUNVERIFIED;

View File

@ -4166,9 +4166,9 @@ class LLObjectEnableReturn : public view_listener_t
{
virtual bool apply(LLViewerObject* obj)
{
return (obj->isOverAgentOwnedLand() ||
obj->isOverGroupOwnedLand() ||
obj->permModify());
return
obj->permModify() ||
obj->isReturnable();
}
} func;
const bool firstonly = true;

View File

@ -516,20 +516,12 @@ void LLViewerObject::setNameValueList(const std::string& name_value_list)
// This method returns true if the object is over land owned by the
// agent.
BOOL LLViewerObject::isOverAgentOwnedLand() const
bool LLViewerObject::isReturnable()
{
return mRegionp
&& mRegionp->getParcelOverlay()
&& mRegionp->getParcelOverlay()->isOwnedSelf(getPositionRegion());
}
// This method returns true if the object is over land owned by the
// agent.
BOOL LLViewerObject::isOverGroupOwnedLand() const
{
return mRegionp
&& mRegionp->getParcelOverlay()
&& mRegionp->getParcelOverlay()->isOwnedGroup(getPositionRegion());
LLBBox(getPositionRegion(), getRotationRegion(), getScale() * -0.5f, getScale() * 0.5f);
return !isAttachment()
&& mRegionp
&& mRegionp->objectIsReturnable(getPositionRegion(), getBoundingBoxRegion());
}
BOOL LLViewerObject::setParent(LLViewerObject* parent)

View File

@ -226,12 +226,9 @@ public:
virtual BOOL hasLightTexture() const { return FALSE; }
// This method returns true if the object is over land owned by
// the agent.
BOOL isOverAgentOwnedLand() const;
// True if over land owned by group of which the agent is
// either officer or member.
BOOL isOverGroupOwnedLand() const;
// the agent, one of its groups, or it it encroaches and
// anti-encroachment is enabled
bool isReturnable();
/*
// This method will scan through this object, and then query the

View File

@ -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);

View File

@ -30,6 +30,7 @@
// The ownership data for land parcels.
// One of these structures per region.
#include "llbbox.h"
#include "lldarray.h"
#include "llframetimer.h"
#include "lluuid.h"
@ -54,6 +55,12 @@ public:
BOOL isOwnedSelf(const LLVector3& pos) const;
BOOL isOwnedGroup(const LLVector3& pos) const;
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;
BOOL isSoundLocal(const LLVector3& pos) const;
BOOL isBuildCameraAllowed(const LLVector3& pos) const;

View File

@ -1495,6 +1495,19 @@ LLSpatialPartition* LLViewerRegion::getSpatialPartition(U32 type)
return NULL;
}
// the viewer can not yet distinquish between normal- and estate-owned objects
// so we collapse these two bits and enable the UI if either are set
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)
{
return mParcelOverlay
&& ( mParcelOverlay->isOwned(pos)
|| ((mRegionFlags & ALLOW_RETURN_ENCROACHING_OBJECT)
&& mParcelOverlay->encroachesOwned(bbox)) );
}
void LLViewerRegion::showReleaseNotes()
{
std::string url = this->getCapability("ServerReleaseNotes");

View File

@ -33,6 +33,7 @@
#include "lldarray.h"
#include "llwind.h"
#include "llbbox.h"
#include "llcloud.h"
#include "llstat.h"
#include "v3dmath.h"
@ -293,6 +294,8 @@ public:
std::string getHttpUrl() const { return mHttpUrl ;}
LLSpatialPartition* getSpatialPartition(U32 type);
bool objectIsReturnable(const LLVector3& pos, const LLBBox& bbox);
public:
struct CompareDistance
{