summaryrefslogtreecommitdiff
path: root/indra/newview/llvovolume.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llvovolume.cpp')
-rw-r--r--indra/newview/llvovolume.cpp85
1 files changed, 70 insertions, 15 deletions
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 20f8674655..7492a06784 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -4097,6 +4097,32 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
LLFastTimer ftm2(FTM_REBUILD_VOLUME_VB);
+ LLVOAvatar* pAvatarVO = NULL;
+
+ LLSpatialBridge* bridge = group->mSpatialPartition->asBridge();
+ if (bridge)
+ {
+ if (bridge->mAvatar.isNull())
+ {
+ LLViewerObject* vobj = bridge->mDrawable->getVObj();
+ if (vobj)
+ {
+ bridge->mAvatar = vobj->getAvatar();
+ }
+ }
+
+ pAvatarVO = bridge->mAvatar;
+ }
+
+ if (pAvatarVO)
+ {
+ pAvatarVO->mAttachmentGeometryBytes -= group->mGeometryBytes;
+ pAvatarVO->mAttachmentSurfaceArea -= group->mSurfaceArea;
+ }
+
+ group->mGeometryBytes = 0;
+ group->mSurfaceArea = 0;
+
group->clearDrawMap();
mFaceList.clear();
@@ -4133,12 +4159,24 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
LLVOVolume* vobj = drawablep->getVOVolume();
+ if (!vobj)
+ {
+ continue;
+ }
+
if (vobj->isMesh() &&
(vobj->getVolume() && !vobj->getVolume()->isMeshAssetLoaded() || !gMeshRepo.meshRezEnabled()))
{
continue;
}
+ LLVolume* volume = vobj->getVolume();
+ if (volume)
+ {
+ const LLVector3& scale = vobj->getScale();
+ group->mSurfaceArea += volume->getSurfaceArea() * llmax(llmax(scale.mV[0], scale.mV[1]), scale.mV[2]);
+ }
+
llassert_always(vobj);
vobj->updateTextureVirtualSize(true);
vobj->preRebuild();
@@ -4183,7 +4221,6 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
//Determine if we've received skininfo that contains an
//alternate bind matrix - if it does then apply the translational component
//to the joints of the avatar.
- LLVOAvatar* pAvatarVO = vobj->getAvatar();
bool pelvisGotSet = false;
if ( pAvatarVO )
@@ -4253,13 +4290,16 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
if (type == LLDrawPool::POOL_ALPHA)
{
- if (te->getFullbright())
+ if (te->getColor().mV[3] > 0.f)
{
- pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_FULLBRIGHT_ALPHA);
- }
- else
- {
- pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_ALPHA);
+ if (te->getFullbright())
+ {
+ pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_FULLBRIGHT_ALPHA);
+ }
+ else
+ {
+ pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_ALPHA);
+ }
}
}
else if (te->getShiny())
@@ -4392,8 +4432,11 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
}
else
{
- drawablep->setState(LLDrawable::HAS_ALPHA);
- alpha_faces.push_back(facep);
+ if (te->getColor().mV[3] > 0.f)
+ {
+ drawablep->setState(LLDrawable::HAS_ALPHA);
+ alpha_faces.push_back(facep);
+ }
}
}
else
@@ -4510,6 +4553,12 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
}
mFaceList.clear();
+
+ if (pAvatarVO)
+ {
+ pAvatarVO->mAttachmentGeometryBytes += group->mGeometryBytes;
+ pAvatarVO->mAttachmentSurfaceArea += group->mSurfaceArea;
+ }
}
static LLFastTimer::DeclareTimer FTM_VOLUME_GEOM("Volume Geometry");
@@ -4806,17 +4855,20 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
//create/delete/resize vertex buffer if needed
LLVertexBuffer* buffer = NULL;
- LLSpatialGroup::buffer_texture_map_t::iterator found_iter = group->mBufferMap[mask].find(*face_iter);
+
+ { //try to find a buffer to reuse
+ LLSpatialGroup::buffer_texture_map_t::iterator found_iter = group->mBufferMap[mask].find(*face_iter);
- if (found_iter != group->mBufferMap[mask].end())
- {
- if ((U32) buffer_index < found_iter->second.size())
+ if (found_iter != group->mBufferMap[mask].end())
{
- buffer = found_iter->second[buffer_index];
+ if ((U32) buffer_index < found_iter->second.size())
+ {
+ buffer = found_iter->second[buffer_index];
+ }
}
}
- if (!buffer)
+ if (!buffer || !buffer->isWriteable())
{ //create new buffer if needed
buffer = createVertexBuffer(mask, buffer_usage);
buffer->allocateBuffer(geom_count, index_count, TRUE);
@@ -4835,6 +4887,9 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
}
}
+ group->mGeometryBytes += buffer->getSize() + buffer->getIndicesSize();
+
+
buffer_map[mask][*face_iter].push_back(buffer);
//add face geometry