summaryrefslogtreecommitdiff
path: root/indra/newview/llfetchedgltfmaterial.cpp
diff options
context:
space:
mode:
authorcosmic-linden <111533034+cosmic-linden@users.noreply.github.com>2023-01-25 13:31:25 -0800
committerGitHub <noreply@github.com>2023-01-25 13:31:25 -0800
commit98d2a46b30650465e9c0909b1c1d186752fa1d38 (patch)
tree4c4a0a12c6a838e9e452417c4e7ce1eaf06c0a21 /indra/newview/llfetchedgltfmaterial.cpp
parent623bb4d58c197fccc8a795426c5864104301cebe (diff)
parent2aaa15fef15243e6b38f46426d8ebb355ccfb807 (diff)
Merge pull request #59 from secondlife/SL-19012
SL-19012: Fix new material IDs sometimes not applying when set via LSL
Diffstat (limited to 'indra/newview/llfetchedgltfmaterial.cpp')
-rw-r--r--indra/newview/llfetchedgltfmaterial.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/indra/newview/llfetchedgltfmaterial.cpp b/indra/newview/llfetchedgltfmaterial.cpp
index b095b74519..047f1a4965 100644
--- a/indra/newview/llfetchedgltfmaterial.cpp
+++ b/indra/newview/llfetchedgltfmaterial.cpp
@@ -115,3 +115,35 @@ void LLFetchedGLTFMaterial::bind()
}
}
+
+void LLFetchedGLTFMaterial::materialBegin()
+{
+ llassert(!mFetching);
+ mFetching = true;
+}
+
+void LLFetchedGLTFMaterial::onMaterialComplete(std::function<void()> material_complete)
+{
+ if (!material_complete) { return; }
+
+ if (!mFetching)
+ {
+ material_complete();
+ return;
+ }
+
+ materialCompleteCallbacks.push_back(material_complete);
+}
+
+void LLFetchedGLTFMaterial::materialComplete()
+{
+ llassert(mFetching);
+ mFetching = false;
+
+ for (std::function<void()> material_complete : materialCompleteCallbacks)
+ {
+ material_complete();
+ }
+ materialCompleteCallbacks.clear();
+ materialCompleteCallbacks.shrink_to_fit();
+}