summaryrefslogtreecommitdiff
path: root/indra/newview/llvovolume.cpp
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2022-10-24 16:27:05 -0500
committerDave Parks <davep@lindenlab.com>2022-10-24 16:27:05 -0500
commited1e5214cefc5f0aeb630bf2fbcda9dff9ed8d61 (patch)
treecff031a651487a47a863950616f89dda098b8830 /indra/newview/llvovolume.cpp
parent5c86ec6a6130bef9348d6155c6a7404914c20418 (diff)
parent4a1397c621eec2deb90d4953762fea6187c0a270 (diff)
Merge branch 'DRTVWR-559' of ssh://bitbucket.org/lindenlab/viewer into DRTVWR-559
Diffstat (limited to 'indra/newview/llvovolume.cpp')
-rw-r--r--indra/newview/llvovolume.cpp70
1 files changed, 49 insertions, 21 deletions
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index aea4353bc8..8415d457df 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -1995,7 +1995,7 @@ BOOL LLVOVolume::updateGeometry(LLDrawable *drawable)
if (mDrawable->isState(LLDrawable::REBUILD_RIGGED))
{
- updateRiggedVolume(false);
+ updateRiggedVolume(false);
genBBoxes(FALSE);
mDrawable->clearState(LLDrawable::REBUILD_RIGGED);
}
@@ -4774,7 +4774,7 @@ BOOL LLVOVolume::lineSegmentIntersect(const LLVector4a& start, const LLVector4a&
{
if ((pick_rigged) || (getAvatar() && (getAvatar()->isSelf()) && (LLFloater::isVisible(gFloaterTools))))
{
- updateRiggedVolume(true, LLRiggedVolume::DO_NOT_UPDATE_FACES);
+ updateRiggedVolume(true, LLRiggedVolume::DO_NOT_UPDATE_FACES);
volume = mRiggedVolume;
transform = false;
}
@@ -4981,7 +4981,7 @@ void LLVOVolume::updateRiggedVolume(bool force_treat_as_rigged, LLRiggedVolume::
//Update mRiggedVolume to match current animation frame of avatar.
//Also update position/size in octree.
- if ((!force_treat_as_rigged) && (!treatAsRigged()))
+ if ((!force_treat_as_rigged) && (!treatAsRigged()))
{
clearRiggedVolume();
@@ -5010,7 +5010,7 @@ void LLVOVolume::updateRiggedVolume(bool force_treat_as_rigged, LLRiggedVolume::
updateRelativeXform();
}
- mRiggedVolume->update(skin, avatar, volume, face_index, rebuild_face_octrees);
+ mRiggedVolume->update(skin, avatar, volume, face_index, rebuild_face_octrees);
}
void LLRiggedVolume::update(
@@ -5173,12 +5173,7 @@ void LLRiggedVolume::update(
if (rebuild_face_octrees)
{
dst_face.destroyOctree();
-
- LLVector4a size;
- size.setSub(dst_face.mExtents[1], dst_face.mExtents[0]);
- size.splat(size.getLength3().getF32()*0.5f);
-
- dst_face.createOctree(1.f);
+ dst_face.createOctree();
}
}
}
@@ -5428,7 +5423,6 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
LLViewerTexture* tex = facep->getTexture();
-
U8 index = facep->getTextureIndex();
LLMaterial* mat = nullptr;
@@ -5711,7 +5705,7 @@ static inline void add_face(T*** list, U32* count, T* face)
{
if (count[1] < MAX_FACE_COUNT)
{
- face->setDrawOrderIndex(count[1]);
+ //face->setDrawOrderIndex(count[1]);
list[1][count[1]++] = face;
}
}
@@ -5719,12 +5713,36 @@ static inline void add_face(T*** list, U32* count, T* face)
{
if (count[0] < MAX_FACE_COUNT)
{
- face->setDrawOrderIndex(count[0]);
+ //face->setDrawOrderIndex(count[0]);
list[0][count[0]++] = face;
}
}
}
+// return index into linkset for given object (0 for root prim)
+U32 get_linkset_index(LLVOVolume* vobj)
+{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE;
+ if (vobj->isRootEdit())
+ {
+ return 0;
+ }
+
+ LLViewerObject* root = vobj->getRootEdit();
+ U32 idx = 1;
+ for (const auto& child : root->getChildren())
+ {
+ if (child == vobj)
+ {
+ return idx;
+ }
+ ++idx;
+ }
+
+ llassert(false);
+ return idx; //should never get here
+}
+
void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
@@ -5891,6 +5909,8 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
avatar->addAttachmentOverridesForObject(vobj, NULL, false);
}
+ U32 linkset_index = get_linkset_index(vobj);
+
// Standard rigged mesh attachments:
bool rigged = !vobj->isAnimatedObject() && skinInfo && vobj->isAttachment();
// Animated objects. Have to check for isRiggedMesh() to
@@ -5910,6 +5930,9 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
continue;
}
+ // order by linkset index first and face index second
+ facep->setDrawOrderIndex(linkset_index * 100 + i);
+
// HACK -- brute force this check every time a drawable gets rebuilt
vobj->updateTEMaterialTextures(i);
#if 0
@@ -5949,11 +5972,6 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
if (facep->isState(LLFace::RIGGED))
{
//face is not rigged but used to be, remove from rigged face pool
- LLDrawPoolAvatar* pool = (LLDrawPoolAvatar*) facep->getPool();
- if (pool)
- {
- pool->removeFace(facep);
- }
facep->clearState(LLFace::RIGGED);
facep->mAvatar = NULL;
facep->mSkinInfo = NULL;
@@ -6261,7 +6279,7 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)
{
LLDrawable* drawablep = (LLDrawable*)(*drawable_iter)->getDrawable();
- if (drawablep && !drawablep->isDead() && drawablep->isState(LLDrawable::REBUILD_ALL) && !drawablep->isState(LLDrawable::RIGGED) )
+ if (drawablep && !drawablep->isDead() && drawablep->isState(LLDrawable::REBUILD_ALL))
{
LLVOVolume* vobj = drawablep->getVOVolume();
@@ -6295,8 +6313,6 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)
LLVertexBuffer* buff = face->getVertexBuffer();
if (buff)
{
- llassert(!face->isState(LLFace::RIGGED));
-
if (!face->getGeometryVolume(*volume, face->getTEOffset(),
vobj->getRelativeXform(), vobj->getRelativeXformInvTrans(), face->getGeomIndex()))
{ //something's gone wrong with the vertex buffer accounting, rebuild this group
@@ -6425,6 +6441,13 @@ struct CompareBatchBreakerRigged
}
};
+struct CompareDrawOrder
+{
+ bool operator()(const LLFace* const& lhs, const LLFace* const& rhs)
+ {
+ return lhs->getDrawOrderIndex() < rhs->getDrawOrderIndex();
+ }
+};
U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace** faces, U32 face_count, BOOL distance_sort, BOOL batch_textures, BOOL rigged)
{
@@ -6459,6 +6482,11 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
//sort faces by things that break batches, including avatar and mesh id
std::sort(faces, faces + face_count, CompareBatchBreakerRigged());
}
+ else
+ {
+ // preserve legacy draw order for rigged faces
+ std::sort(faces, faces + face_count, CompareDrawOrder());
+ }
}
else if (!distance_sort)
{