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.cpp33
1 files changed, 31 insertions, 2 deletions
diff --git a/indra/newview/gltfscenemanager.cpp b/indra/newview/gltfscenemanager.cpp
index 7b2de4d6de..e55d630940 100644
--- a/indra/newview/gltfscenemanager.cpp
+++ b/indra/newview/gltfscenemanager.cpp
@@ -42,8 +42,10 @@
#include "llviewertexturelist.h"
#include "llimagej2c.h"
#include "llfloaterperms.h"
+#include "llfloaterreg.h"
#include "llagentbenefits.h"
#include "llfilesystem.h"
+#include "llviewercontrol.h"
#include "boost/json.hpp"
#define GLTF_SIM_SUPPORT 1
@@ -144,7 +146,17 @@ void GLTFSceneManager::uploadSelection()
}
else
{
- raw = image.mTexture->getCachedRawImage();
+ raw = image.mTexture->getRawImage();
+ }
+
+ if (raw.isNull())
+ {
+ raw = image.mTexture->getSavedRawImage();
+ }
+
+ if (raw.isNull())
+ {
+ image.mTexture->readbackRawImage();
}
if (raw.notNull())
@@ -314,6 +326,7 @@ void GLTFSceneManager::load(const std::string& filename)
{
mObjects.push_back(obj);
}
+ LLFloaterReg::showInstance("gltf_asset_editor");
}
}
else
@@ -339,9 +352,18 @@ void GLTFSceneManager::renderAlpha()
void GLTFSceneManager::addGLTFObject(LLViewerObject* obj, LLUUID gltf_id)
{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_GLTF;
llassert(obj->getVolume()->getParams().getSculptID() == gltf_id);
llassert(obj->getVolume()->getParams().getSculptType() == LL_SCULPT_TYPE_GLTF);
+ if (obj->mGLTFAsset)
+ { // object already has a GLTF asset, don't reload it
+
+ // TODO: below assertion fails on dupliate requests for assets -- possibly need to touch up asset loading state machine
+ // llassert(std::find(mObjects.begin(), mObjects.end(), obj) != mObjects.end());
+ return;
+ }
+
obj->ref();
gAssetStorage->getAssetData(gltf_id, LLAssetType::AT_GLTF, onGLTFLoadComplete, obj);
}
@@ -597,6 +619,13 @@ void GLTFSceneManager::render(Asset& asset, U8 variant)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_GLTF;
+ static LLCachedControl<bool> can_use_shaders(gSavedSettings, "RenderCanUseGLTFPBROpaqueShaders", true);
+ if (!can_use_shaders)
+ {
+ // user should already have been notified of unsupported hardware
+ return;
+ }
+
for (U32 ds = 0; ds < 2; ++ds)
{
RenderData& rd = asset.mRenderData[ds];
@@ -773,7 +802,7 @@ void GLTFSceneManager::bind(Asset& asset, Material& material)
bindTexture(asset, TextureType::EMISSIVE, material.mEmissiveTexture, LLViewerFetchedTexture::sWhiteImagep);
}
- shader->uniform1i(LLShaderMgr::GLTF_MATERIAL_ID, &material - &asset.mMaterials[0]);
+ shader->uniform1i(LLShaderMgr::GLTF_MATERIAL_ID, (GLint)(&material - &asset.mMaterials[0]));
}
LLMatrix4a inverse(const LLMatrix4a& mat)