From e5e8d20b8b8eaa3309bfc5cda816688612ddb9f3 Mon Sep 17 00:00:00 2001 From: sunag Date: Wed, 13 Nov 2024 15:01:29 -0300 Subject: [PATCH] RenderObjects: Force `material.needsUpdate=true` to update the material if geometry is changed. (#29873) --- src/renderers/common/RenderObjects.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/renderers/common/RenderObjects.js b/src/renderers/common/RenderObjects.js index 54662d736491f1..63c1f3a54cf8ec 100644 --- a/src/renderers/common/RenderObjects.js +++ b/src/renderers/common/RenderObjects.js @@ -40,9 +40,13 @@ class RenderObjects { renderObject.updateClipping( clippingContext ); - const needsGeometryUpdate = renderObject.needsGeometryUpdate; + if ( renderObject.needsGeometryUpdate ) { - if ( renderObject.version !== material.version || renderObject.needsUpdate || needsGeometryUpdate ) { + renderObject.setGeometry( object.geometry ); + + } + + if ( renderObject.version !== material.version || renderObject.needsUpdate ) { if ( renderObject.initialCacheKey !== renderObject.getCacheKey() ) { @@ -54,12 +58,6 @@ class RenderObjects { renderObject.version = material.version; - if ( needsGeometryUpdate ) { - - renderObject.setGeometry( object.geometry ); - - } - } }