Merge remote-tracking branch 'singu/master'

This commit is contained in:
Aleric Inglewood
2013-07-08 02:05:09 +02:00
2 changed files with 46 additions and 11 deletions

View File

@@ -17225,6 +17225,28 @@ This should be as low as possible, but too low may break functionality</string>
<key>Value</key>
<string>Random</string>
</map>
<key>DerenderHugeAttachments</key>
<map>
<key>Comment</key>
<string>Allow the viewer to automatically hide attachments that are really just way too big</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>MaxAttachmentSpan</key>
<map>
<key>Comment</key>
<string>Size constraint for attachments (minimum value == 256.0)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>F32</string>
<key>Value</key>
<real>1280.0</real>
</map>
</map>
</llsd>

View File

@@ -1616,13 +1616,16 @@ void LLVOAvatar::updateSpatialExtents(LLVector4a& newMin, LLVector4a &newMax)
void LLVOAvatar::getSpatialExtents(LLVector4a& newMin, LLVector4a& newMax)
{
static const LLCachedControl<bool> control_derender_huge_attachments("DerenderHugeAttachments", true);
static const LLCachedControl<F32> control_max_attachment_span("MaxAttachmentSpan", 5.0f * DEFAULT_MAX_PRIM_SCALE);
LLVector4a buffer(0.25f);
LLVector4a pos;
pos.load3(getRenderPosition().mV);
newMin.setSub(pos, buffer);
newMax.setAdd(pos, buffer);
float max_attachment_span = DEFAULT_MAX_PRIM_SCALE * 5.0f;
float max_attachment_span = llmax<F32>(DEFAULT_MAX_PRIM_SCALE, control_max_attachment_span);
//stretch bounding box by joint positions
for (polymesh_map_t::iterator i = mPolyMeshes.begin(); i != mPolyMeshes.end(); ++i)
@@ -1645,10 +1648,12 @@ void LLVOAvatar::getSpatialExtents(LLVector4a& newMin, LLVector4a& newMax)
mPixelArea = LLPipeline::calcPixelArea(center, size, *LLViewerCamera::getInstance());
static std::vector<LLViewerObject*> removal;
//stretch bounding box by attachments
/*for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
iter != mAttachmentPoints.end();
++iter)
for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
iter != mAttachmentPoints.end();
++iter)
{
LLViewerJointAttachment* attachment = iter->second;
@@ -1661,13 +1666,7 @@ void LLVOAvatar::getSpatialExtents(LLVector4a& newMin, LLVector4a& newMax)
attachment_iter != attachment->mAttachedObjects.end();
++attachment_iter)
{
const LLViewerObject* attached_object = (*attachment_iter);*/
std::vector<std::pair<LLViewerObject*,LLViewerJointAttachment*> >::iterator attachment_iter = mAttachedObjectsVector.begin();
for(;attachment_iter!=mAttachedObjectsVector.end();++attachment_iter)
{
if(attachment_iter->second->getValid())
{
const LLViewerObject* attached_object = attachment_iter->first;
const LLViewerObject* attached_object = (*attachment_iter);
if (attached_object && !attached_object->isHUDAttachment())
{
LLDrawable* drawable = attached_object->mDrawable;
@@ -1691,12 +1690,26 @@ void LLVOAvatar::getSpatialExtents(LLVector4a& newMin, LLVector4a& newMax)
update_min_max(newMin,newMax,ext[0]);
update_min_max(newMin,newMax,ext[1]);
}
else if(control_derender_huge_attachments)
{
removal.push_back((LLViewerObject *)attached_object);
}
}
}
}
}
}
if(removal.size() > 0)
{
for(std::vector<LLViewerObject*>::iterator removal_iter = removal.begin(); removal_iter != removal.end(); ++removal_iter)
{
LLViewerObject *object_to_remove = *removal_iter;
gObjectList.killObject(object_to_remove);
}
removal.clear();
}
//pad bounding box
newMin.sub(buffer);