From 39f762c2d1e8666c93689e261380cd70e0fb1749 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 23 Jun 2022 20:59:42 -0500 Subject: SL-17653 Make sure GLTF material associated vertex buffers have all their texture coordinates --- indra/newview/llface.cpp | 3 ++- indra/newview/llvovolume.cpp | 53 ++++++++++++++++++++++++++------------------ 2 files changed, 34 insertions(+), 22 deletions(-) diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index a2d9c0ba2b..562042f8bc 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -1794,10 +1794,11 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, scalea.load3(scale.mV); LLMaterial* mat = tep->getMaterialParams().get(); + LLGLTFMaterial* gltf_mat = tep->getGLTFMaterial(); bool do_bump = bump_code && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_TEXCOORD1); - if (mat && !do_bump) + if ((mat || gltf_mat) && !do_bump) { do_bump = mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_TEXCOORD1) || mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_TEXCOORD2); diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 9ac5f908e7..0706e26fb1 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -6022,28 +6022,39 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) if (gPipeline.canUseWindLightShadersOnObjects() && LLPipeline::sRenderBump) { - if (LLPipeline::sRenderDeferred && te->getMaterialParams().notNull() && !te->getMaterialID().isNull()) + LLGLTFMaterial* gltf_mat = te->getGLTFMaterial(); + + if (LLPipeline::sRenderDeferred && + (gltf_mat != nullptr || (te->getMaterialParams().notNull() && !te->getMaterialID().isNull()))) { - LLMaterial* mat = te->getMaterialParams().get(); - if (mat->getNormalID().notNull()) - { - if (mat->getSpecularID().notNull()) - { //has normal and specular maps (needs texcoord1, texcoord2, and tangent) - add_face(sNormSpecFaces, normspec_count, facep); - } - else - { //has normal map (needs texcoord1 and tangent) - add_face(sNormFaces, norm_count, facep); - } - } - else if (mat->getSpecularID().notNull()) - { //has specular map but no normal map, needs texcoord2 - add_face(sSpecFaces, spec_count, facep); - } - else - { //has neither specular map nor normal map, only needs texcoord0 - add_face(sSimpleFaces, simple_count, facep); - } + if (gltf_mat != nullptr) + { + // all gltf materials have all vertex attributes for now + add_face(sNormSpecFaces, normspec_count, facep); + } + else + { + LLMaterial* mat = te->getMaterialParams().get(); + if (mat->getNormalID().notNull()) + { + if (mat->getSpecularID().notNull()) + { //has normal and specular maps (needs texcoord1, texcoord2, and tangent) + add_face(sNormSpecFaces, normspec_count, facep); + } + else + { //has normal map (needs texcoord1 and tangent) + add_face(sNormFaces, norm_count, facep); + } + } + else if (mat->getSpecularID().notNull()) + { //has specular map but no normal map, needs texcoord2 + add_face(sSpecFaces, spec_count, facep); + } + else + { //has neither specular map nor normal map, only needs texcoord0 + add_face(sSimpleFaces, simple_count, facep); + } + } } else if (te->getBumpmap()) { //needs normal + tangent -- cgit v1.2.3