summaryrefslogtreecommitdiff
path: root/indra/newview/gltfscenemanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/gltfscenemanager.cpp')
-rw-r--r--indra/newview/gltfscenemanager.cpp65
1 files changed, 34 insertions, 31 deletions
diff --git a/indra/newview/gltfscenemanager.cpp b/indra/newview/gltfscenemanager.cpp
index acea1991ad..f362fa51cb 100644
--- a/indra/newview/gltfscenemanager.cpp
+++ b/indra/newview/gltfscenemanager.cpp
@@ -371,43 +371,46 @@ void GLTFSceneManager::addGLTFObject(LLViewerObject* obj, LLUUID gltf_id)
//static
void GLTFSceneManager::onGLTFBinLoadComplete(const LLUUID& id, LLAssetType::EType asset_type, void* user_data, S32 status, LLExtStat ext_status)
{
- LLViewerObject* obj = (LLViewerObject*)user_data;
- llassert(asset_type == LLAssetType::AT_GLTF_BIN);
-
- if (status == LL_ERR_NOERR)
- {
- if (obj)
+ LLAppViewer::instance()->postToMainCoro([=]()
{
- // find the Buffer with the given id in the asset
- if (obj->mGLTFAsset)
- {
- obj->mGLTFAsset->mPendingBuffers--;
-
+ LLViewerObject* obj = (LLViewerObject*)user_data;
+ llassert(asset_type == LLAssetType::AT_GLTF_BIN);
- if (obj->mGLTFAsset->mPendingBuffers == 0)
+ if (status == LL_ERR_NOERR)
+ {
+ if (obj)
{
- if (obj->mGLTFAsset->prep())
+ // find the Buffer with the given id in the asset
+ if (obj->mGLTFAsset)
{
- GLTFSceneManager& mgr = GLTFSceneManager::instance();
- if (std::find(mgr.mObjects.begin(), mgr.mObjects.end(), obj) == mgr.mObjects.end())
+ obj->mGLTFAsset->mPendingBuffers--;
+
+
+ if (obj->mGLTFAsset->mPendingBuffers == 0)
{
- GLTFSceneManager::instance().mObjects.push_back(obj);
+ if (obj->mGLTFAsset->prep())
+ {
+ GLTFSceneManager& mgr = GLTFSceneManager::instance();
+ if (std::find(mgr.mObjects.begin(), mgr.mObjects.end(), obj) == mgr.mObjects.end())
+ {
+ GLTFSceneManager::instance().mObjects.push_back(obj);
+ }
+ }
+ else
+ {
+ LL_WARNS("GLTF") << "Failed to prepare GLTF asset: " << id << LL_ENDL;
+ obj->mGLTFAsset = nullptr;
+ }
}
}
- else
- {
- LL_WARNS("GLTF") << "Failed to prepare GLTF asset: " << id << LL_ENDL;
- obj->mGLTFAsset = nullptr;
- }
}
}
- }
- }
- else
- {
- LL_WARNS("GLTF") << "Failed to load GLTF asset: " << id << LL_ENDL;
- obj->unref();
- }
+ else
+ {
+ LL_WARNS("GLTF") << "Failed to load GLTF asset: " << id << LL_ENDL;
+ obj->unref();
+ }
+ });
}
//static
@@ -807,10 +810,10 @@ void GLTFSceneManager::bind(Asset& asset, Material& material)
LLMatrix4a inverse(const LLMatrix4a& mat)
{
- glh::matrix4f m((F32*)mat.mMatrix);
- m = m.inverse();
+ glm::mat4 m = glm::make_mat4((F32*)mat.mMatrix);
+ m = glm::inverse(m);
LLMatrix4a ret;
- ret.loadu(m.m);
+ ret.loadu(glm::value_ptr(m));
return ret;
}