diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/lldrawpool.cpp | 4 | ||||
-rw-r--r-- | indra/newview/lldrawpoolalpha.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llface.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llfetchedgltfmaterial.cpp | 14 | ||||
-rw-r--r-- | indra/newview/llfetchedgltfmaterial.h | 3 | ||||
-rw-r--r-- | indra/newview/llvovolume.cpp | 5 |
6 files changed, 19 insertions, 11 deletions
diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp index a5990492b1..e35e889a69 100644 --- a/indra/newview/lldrawpool.cpp +++ b/indra/newview/lldrawpool.cpp @@ -458,7 +458,7 @@ void LLRenderPass::pushGLTFBatches(U32 type) auto& mat = params.mGLTFMaterial; - mat->bind(); + mat->bind(params.mTexture); LLGLDisable cull_face(mat->mDoubleSided ? GL_CULL_FACE : 0); @@ -489,7 +489,7 @@ void LLRenderPass::pushRiggedGLTFBatches(U32 type) auto& mat = params.mGLTFMaterial; - mat->bind(); + mat->bind(params.mTexture); LLGLDisable cull_face(mat->mDoubleSided ? GL_CULL_FACE : 0); diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 4c8d32fad2..d3d5235770 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -679,7 +679,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged) gPipeline.bindDeferredShaderFast(*target_shader); } - params.mGLTFMaterial->bind(); + params.mGLTFMaterial->bind(params.mTexture); } else { diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 811f475705..45e7709409 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -362,7 +362,7 @@ void LLFace::switchTexture(U32 ch, LLViewerTexture* new_texture) if (ch == LLRender::DIFFUSE_MAP) { - getViewerObject()->changeTEImage(mTEOffset, new_texture) ; + getViewerObject()->changeTEImage(mTEOffset, new_texture) ; } setTexture(ch, new_texture) ; diff --git a/indra/newview/llfetchedgltfmaterial.cpp b/indra/newview/llfetchedgltfmaterial.cpp index 047f1a4965..003b373e50 100644 --- a/indra/newview/llfetchedgltfmaterial.cpp +++ b/indra/newview/llfetchedgltfmaterial.cpp @@ -46,7 +46,7 @@ LLFetchedGLTFMaterial::~LLFetchedGLTFMaterial() } -void LLFetchedGLTFMaterial::bind() +void LLFetchedGLTFMaterial::bind(LLViewerTexture* media_tex) { // glTF 2.0 Specification 3.9.4. Alpha Coverage // mAlphaCutoff is only valid for LLGLTFMaterial::ALPHA_MODE_MASK @@ -54,15 +54,19 @@ void LLFetchedGLTFMaterial::bind() LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; + // override emissive and base color textures with media tex if present + LLViewerTexture* baseColorTex = media_tex ? media_tex : mBaseColorTexture; + LLViewerTexture* emissiveTex = media_tex ? media_tex : mEmissiveTexture; + if (mAlphaMode == LLGLTFMaterial::ALPHA_MODE_MASK) { min_alpha = mAlphaCutoff; } shader->uniform1f(LLShaderMgr::MINIMUM_ALPHA, min_alpha); - if (mBaseColorTexture.notNull()) + if (baseColorTex != nullptr) { - gGL.getTexUnit(0)->bindFast(mBaseColorTexture); + gGL.getTexUnit(0)->bindFast(baseColorTex); } else { @@ -89,9 +93,9 @@ void LLFetchedGLTFMaterial::bind() shader->bindTexture(LLShaderMgr::SPECULAR_MAP, LLViewerFetchedTexture::sWhiteImagep); } - if (mEmissiveTexture.notNull()) + if (emissiveTex != nullptr) { - shader->bindTexture(LLShaderMgr::EMISSIVE_MAP, mEmissiveTexture); // PBR sRGB Emissive + shader->bindTexture(LLShaderMgr::EMISSIVE_MAP, emissiveTex); // PBR sRGB Emissive } else { diff --git a/indra/newview/llfetchedgltfmaterial.h b/indra/newview/llfetchedgltfmaterial.h index f784f19c4f..96f7fbea8e 100644 --- a/indra/newview/llfetchedgltfmaterial.h +++ b/indra/newview/llfetchedgltfmaterial.h @@ -43,7 +43,8 @@ public: void onMaterialComplete(std::function<void()> material_complete); // bind this material for rendering - void bind(); + // media_tex - optional media texture that may override the base color texture + void bind(LLViewerTexture* media_tex = nullptr); // Textures used for fetching/rendering LLPointer<LLViewerFetchedTexture> mBaseColorTexture; diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 02d1654878..c9fbe680c7 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -5220,13 +5220,16 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, if (gltf_mat != nullptr) { mat_id = gltf_mat->getHash(); // TODO: cache this hash + if (!facep->hasMedia()) + { // no media texture, face texture will be unused + tex = nullptr; + } } else { mat = facep->getTextureEntry()->getMaterialParams().get(); if (mat) { - //mat_id = facep->getTextureEntry()->getMaterialID().asUUID(); mat_id = facep->getTextureEntry()->getMaterialParams()->getHash(); } } |