diff options
author | Dave Parks <davep@lindenlab.com> | 2024-06-11 17:10:13 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-11 17:10:13 -0500 |
commit | f40fbdf4ad27a547e30781cd44cd6847d68d3300 (patch) | |
tree | b26dd135413752a90037bd48ad2217c4dea027ef /indra/newview/gltfscenemanager.cpp | |
parent | 429c92ad75fd3b3f7b9dfc52ed034b25004a3b9c (diff) |
#1718 Add GLTF support for multiple texcoords (#1720)
* Fix for GLTF MeshPrimitiveModes test
Diffstat (limited to 'indra/newview/gltfscenemanager.cpp')
-rw-r--r-- | indra/newview/gltfscenemanager.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/indra/newview/gltfscenemanager.cpp b/indra/newview/gltfscenemanager.cpp index b390afee37..16f362b3e4 100644 --- a/indra/newview/gltfscenemanager.cpp +++ b/indra/newview/gltfscenemanager.cpp @@ -549,10 +549,16 @@ void GLTFSceneManager::render(bool opaque, bool rigged, bool unlit) void GLTFSceneManager::render(U8 variant) { - // for debugging, just render the whole scene as opaque - // by traversing the whole scenegraph - // Assumes camera transform is already set and - // appropriate shader is already boundd + // just render the whole scene by traversing the whole scenegraph + // Assumes camera transform is already set and appropriate shader is already bound. + // Eventually we'll want a smarter render pipe that has pre-sorted the scene graph + // into buckets by material and shader. + + // HACK -- implicitly render multi-uv variant + if (!(variant & LLGLSLShader::GLTFVariant::MULTI_UV)) + { + render((U8) (variant | LLGLSLShader::GLTFVariant::MULTI_UV)); + } gGL.matrixMode(LLRender::MM_MODELVIEW); @@ -732,6 +738,7 @@ void GLTFSceneManager::bind(Asset& asset, Material& material) F32 tf[8]; material.mPbrMetallicRoughness.mBaseColorTexture.mTextureTransform.getPacked(tf); shader->uniform4fv(LLShaderMgr::TEXTURE_BASE_COLOR_TRANSFORM, 2, tf); + shader->uniform1i(LLShaderMgr::BASE_COLOR_TEXCOORD, material.mPbrMetallicRoughness.mBaseColorTexture.getTexCoord()); if (!LLPipeline::sShadowRender) { @@ -748,15 +755,19 @@ void GLTFSceneManager::bind(Asset& asset, Material& material) material.mNormalTexture.mTextureTransform.getPacked(tf); shader->uniform4fv(LLShaderMgr::TEXTURE_NORMAL_TRANSFORM, 2, tf); + shader->uniform1i(LLShaderMgr::NORMAL_TEXCOORD, material.mNormalTexture.getTexCoord()); material.mPbrMetallicRoughness.mMetallicRoughnessTexture.mTextureTransform.getPacked(tf); shader->uniform4fv(LLShaderMgr::TEXTURE_METALLIC_ROUGHNESS_TRANSFORM, 2, tf); + shader->uniform1i(LLShaderMgr::METALLIC_ROUGHNESS_TEXCOORD, material.mPbrMetallicRoughness.mMetallicRoughnessTexture.getTexCoord()); material.mOcclusionTexture.mTextureTransform.getPacked(tf); shader->uniform4fv(LLShaderMgr::TEXTURE_OCCLUSION_TRANSFORM, 2, tf); + shader->uniform1i(LLShaderMgr::OCCLUSION_TEXCOORD, material.mOcclusionTexture.getTexCoord()); material.mEmissiveTexture.mTextureTransform.getPacked(tf); shader->uniform4fv(LLShaderMgr::TEXTURE_EMISSIVE_TRANSFORM, 2, tf); + shader->uniform1i(LLShaderMgr::EMISSIVE_TEXCOORD, material.mEmissiveTexture.getTexCoord()); } } |