summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerregion.cpp
diff options
context:
space:
mode:
authorRunitaiLinden <davep@lindenlab.com>2023-04-03 17:22:40 -0500
committerGitHub <noreply@github.com>2023-04-03 15:22:40 -0700
commit7c831d115b55b96129806353a51a01dcf2bcebba (patch)
tree03d2a767ff5c4ce0200dbe5e44fa431cd0ed399c /indra/newview/llviewerregion.cpp
parent982281b6cbba2db8757c906d1c8d5053f1c6696b (diff)
SL-18458 Make LLVOCache the one source of truth on most recently received overrides. (#147)
Diffstat (limited to 'indra/newview/llviewerregion.cpp')
-rwxr-xr-xindra/newview/llviewerregion.cpp35
1 files changed, 21 insertions, 14 deletions
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index 192a96a408..b159cc2750 100755
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -2651,20 +2651,8 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLViewerObjec
void LLViewerRegion::cacheFullUpdateGLTFOverride(const LLGLTFOverrideCacheEntry &override_data)
{
- LLUUID object_id = override_data.mObjectId;
- LLViewerObject * obj = gObjectList.findObject(object_id);
- if (obj != nullptr)
- {
- llassert(obj->getRegion() == this);
-
- U32 local_id = obj->getLocalID();
-
- mImpl->mGLTFOverridesJson[local_id] = override_data;
- }
- else
- {
- LL_WARNS("GLTF") << "got material override for unknown object_id, cannot cache it" << LL_ENDL;
- }
+ U32 object_id = override_data.mLocalId;
+ mImpl->mGLTFOverridesJson[object_id] = override_data;
}
LLVOCacheEntry* LLViewerRegion::getCacheEntryForOctree(U32 local_id)
@@ -3560,3 +3548,22 @@ void LLViewerRegion::loadCacheMiscExtras(U32 local_id)
LLGLTFMaterialList::loadCacheOverrides(iter->second);
}
}
+
+void LLViewerRegion::applyCacheMiscExtras(LLViewerObject* obj)
+{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY;
+ llassert(obj);
+
+ U32 local_id = obj->getLocalID();
+ auto iter = mImpl->mGLTFOverridesJson.find(local_id);
+ if (iter != mImpl->mGLTFOverridesJson.end())
+ {
+ llassert(iter->second.mGLTFMaterial.size() == iter->second.mSides.size());
+
+ for (auto& side : iter->second.mGLTFMaterial)
+ {
+ obj->setTEGLTFMaterialOverride(side.first, side.second);
+ }
+ }
+}
+