summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llface.cpp6
-rw-r--r--indra/newview/llgltfmateriallist.cpp6
-rw-r--r--indra/newview/llviewerobject.cpp32
-rw-r--r--indra/newview/llviewerobject.h1
-rw-r--r--indra/newview/llvovolume.cpp10
-rw-r--r--indra/newview/pipeline.cpp2
6 files changed, 46 insertions, 11 deletions
diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp
index 4ae8335ca7..23b56aa579 100644
--- a/indra/newview/llface.cpp
+++ b/indra/newview/llface.cpp
@@ -1334,9 +1334,9 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
LLColor4U color = tep->getColor();
- if (tep->getGLTFMaterial())
+ if (tep->getGLTFRenderMaterial())
{
- color = tep->getGLTFMaterial()->mBaseColor;
+ color = tep->getGLTFRenderMaterial()->mBaseColor;
}
if (rebuild_color)
@@ -1599,7 +1599,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
scalea.load3(scale.mV);
LLMaterial* mat = tep->getMaterialParams().get();
- LLGLTFMaterial* gltf_mat = tep->getGLTFMaterial();
+ LLGLTFMaterial* gltf_mat = tep->getGLTFRenderMaterial();
bool do_bump = bump_code && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_TEXCOORD1);
diff --git a/indra/newview/llgltfmateriallist.cpp b/indra/newview/llgltfmateriallist.cpp
index 9c04ef4c38..86f4faa9d0 100644
--- a/indra/newview/llgltfmateriallist.cpp
+++ b/indra/newview/llgltfmateriallist.cpp
@@ -36,6 +36,7 @@
#include "llviewercontrol.h"
#include "llviewergenericmessage.h"
#include "llviewerobjectlist.h"
+#include "pipeline.h"
#include "tinygltf/tiny_gltf.h"
#include <strstream>
@@ -86,7 +87,10 @@ namespace
if(obj)
{
- obj->getTE(side)->setGLTFMaterialOverride(override_data);
+ if (obj->setTEGLTFMaterialOverride(side, override_data))
+ {
+ gPipeline.markTextured(obj->mDrawable);
+ }
}
LL_DEBUGS() << "successfully parsed override: " << override_data->asJSON() << LL_ENDL;
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index ccc1259c25..4923771a31 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -4920,7 +4920,7 @@ void LLViewerObject::updateTEMaterialTextures(U8 te)
mTESpecularMaps[te] = LLViewerTextureManager::getFetchedTexture(spec_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_ALM, LLViewerTexture::LOD_TEXTURE);
}
- LLFetchedGLTFMaterial* mat = (LLFetchedGLTFMaterial*) getTE(te)->getGLTFMaterial();
+ LLFetchedGLTFMaterial* mat = (LLFetchedGLTFMaterial*) getTE(te)->getGLTFRenderMaterial();
LLUUID mat_id = getRenderMaterialID(te);
if (mat == nullptr && mat_id.notNull())
{
@@ -5319,6 +5319,36 @@ S32 LLViewerObject::setTEMaterialParams(const U8 te, const LLMaterialPtr pMateri
return retval;
}
+S32 LLViewerObject::setTEGLTFMaterialOverride(U8 te, LLGLTFMaterial* override_mat)
+{
+ S32 retval = TEM_CHANGE_NONE;
+
+ LLTextureEntry* tep = getTE(te);
+ if (!tep)
+ {
+ LL_WARNS() << "No texture entry for te " << (S32)te << ", object " << mID << LL_ENDL;
+ return retval;
+ }
+
+ LLFetchedGLTFMaterial* src_mat = (LLFetchedGLTFMaterial*) tep->getGLTFMaterial();
+
+ tep->setGLTFMaterialOverride(override_mat);
+
+ if (override_mat && src_mat)
+ {
+ LLFetchedGLTFMaterial* render_mat = new LLFetchedGLTFMaterial(*src_mat);
+ render_mat->applyOverride(*override_mat);
+ tep->setGLTFRenderMaterial(render_mat);
+ retval = TEM_CHANGE_TEXTURE;
+ }
+ else if (tep->setGLTFRenderMaterial(nullptr))
+ {
+ retval = TEM_CHANGE_TEXTURE;
+ }
+
+ return retval;
+}
+
void LLViewerObject::refreshMaterials()
{
setChanged(TEXTURE);
diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h
index 5d72f7f3c3..bd70532ab7 100644
--- a/indra/newview/llviewerobject.h
+++ b/indra/newview/llviewerobject.h
@@ -356,6 +356,7 @@ public:
/*virtual*/ S32 setTEGlow(const U8 te, const F32 glow);
/*virtual*/ S32 setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID);
/*virtual*/ S32 setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams);
+ S32 setTEGLTFMaterialOverride(U8 te, LLGLTFMaterial* mat);
// Used by Materials update functions to properly kick off rebuilds
// of VBs etc when materials updates require changes.
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index c1c80d5adc..127abde19e 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -5223,7 +5223,7 @@ bool can_batch_texture(LLFace* facep)
return false;
}
- if (facep->getTextureEntry()->getGLTFMaterial() != nullptr)
+ if (facep->getTextureEntry()->getGLTFRenderMaterial() != nullptr)
{ // PBR materials break indexed texture batching
return false;
}
@@ -5390,7 +5390,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
LLUUID mat_id;
- auto* gltf_mat = (LLFetchedGLTFMaterial*) facep->getTextureEntry()->getGLTFMaterial();
+ auto* gltf_mat = (LLFetchedGLTFMaterial*) facep->getTextureEntry()->getGLTFRenderMaterial();
if (gltf_mat != nullptr)
{
mat_id = gltf_mat->getHash(); // TODO: cache this hash
@@ -5873,7 +5873,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
bool is_pbr = false;
#endif
#else
- LLGLTFMaterial *gltf_mat = facep->getTextureEntry()->getGLTFMaterial();
+ LLGLTFMaterial *gltf_mat = facep->getTextureEntry()->getGLTFRenderMaterial();
bool is_pbr = gltf_mat != nullptr;
#endif
@@ -6011,7 +6011,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
if (gPipeline.canUseWindLightShadersOnObjects()
&& LLPipeline::sRenderBump)
{
- LLGLTFMaterial* gltf_mat = te->getGLTFMaterial();
+ LLGLTFMaterial* gltf_mat = te->getGLTFRenderMaterial();
if (LLPipeline::sRenderDeferred &&
(gltf_mat != nullptr || (te->getMaterialParams().notNull() && !te->getMaterialID().isNull())))
@@ -6716,7 +6716,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
BOOL is_alpha = (facep->getPoolType() == LLDrawPool::POOL_ALPHA) ? TRUE : FALSE;
- LLGLTFMaterial* gltf_mat = te->getGLTFMaterial();
+ LLGLTFMaterial* gltf_mat = te->getGLTFRenderMaterial();
LLMaterial* mat = nullptr;
bool can_be_shiny = false;
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index cb54cec165..b6d9e5fd36 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -1617,7 +1617,7 @@ U32 LLPipeline::getPoolTypeFromTE(const LLTextureEntry* te, LLViewerTexture* ima
}
LLMaterial* mat = te->getMaterialParams().get();
- LLGLTFMaterial* gltf_mat = te->getGLTFMaterial();
+ LLGLTFMaterial* gltf_mat = te->getGLTFRenderMaterial();
bool color_alpha = te->getColor().mV[3] < 0.999f;
bool alpha = color_alpha;