From d9305538c7e95b3ee2b8ac99db23e5a4c7fc86f5 Mon Sep 17 00:00:00 2001 From: William Linna Date: Mon, 4 Sep 2023 18:07:19 +0300 Subject: [PATCH] Explicitly set r, g, b in setRGB calls (#26691) --- examples/jsm/loaders/GLTFLoader.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/examples/jsm/loaders/GLTFLoader.js b/examples/jsm/loaders/GLTFLoader.js index 2adbf58beb2f2b..c13d0d415df47a 100644 --- a/examples/jsm/loaders/GLTFLoader.js +++ b/examples/jsm/loaders/GLTFLoader.js @@ -547,7 +547,7 @@ class GLTFLightsExtension { const color = new Color( 0xffffff ); - if ( lightDef.color !== undefined ) color.setRGB( ...lightDef.color, LinearSRGBColorSpace ); + if ( lightDef.color !== undefined ) color.setRGB( lightDef.color[ 0 ], lightDef.color[ 1 ], lightDef.color[ 2 ], LinearSRGBColorSpace ); const range = lightDef.range !== undefined ? lightDef.range : 0; @@ -665,7 +665,7 @@ class GLTFMaterialsUnlitExtension { const array = metallicRoughness.baseColorFactor; - materialParams.color.setRGB( ...array, LinearSRGBColorSpace ); + materialParams.color.setRGB( array[ 0 ], array[ 1 ], array[ 2 ], LinearSRGBColorSpace ); materialParams.opacity = array[ 3 ]; } @@ -941,7 +941,8 @@ class GLTFMaterialsSheenExtension { if ( extension.sheenColorFactor !== undefined ) { - materialParams.sheenColor.setRGB( ...extension.sheenColorFactor, LinearSRGBColorSpace ); + const colorFactor = extension.sheenColorFactor; + materialParams.sheenColor.setRGB( colorFactor[ 0 ], colorFactor[ 1 ], colorFactor [ 2 ], LinearSRGBColorSpace ); } @@ -1079,7 +1080,7 @@ class GLTFMaterialsVolumeExtension { materialParams.attenuationDistance = extension.attenuationDistance || Infinity; const colorArray = extension.attenuationColor || [ 1, 1, 1 ]; - materialParams.attenuationColor = new Color().setRGB( ...colorArray, LinearSRGBColorSpace ); + materialParams.attenuationColor = new Color().setRGB( colorArray[ 0 ], colorArray[ 1 ], colorArray[ 2 ], LinearSRGBColorSpace ); return Promise.all( pending ); @@ -1182,7 +1183,7 @@ class GLTFMaterialsSpecularExtension { } const colorArray = extension.specularColorFactor || [ 1, 1, 1 ]; - materialParams.specularColor = new Color().setRGB( ...colorArray, LinearSRGBColorSpace ); + materialParams.specularColor = new Color().setRGB( colorArray[ 0 ], colorArray[ 1 ], colorArray[ 2 ], LinearSRGBColorSpace ); if ( extension.specularColorTexture !== undefined ) { @@ -3480,7 +3481,8 @@ class GLTFParser { if ( materialDef.emissiveFactor !== undefined && materialType !== MeshBasicMaterial ) { - materialParams.emissive = new Color().setRGB( ...materialDef.emissiveFactor, LinearSRGBColorSpace ); + const emissiveFactor = materialDef.emissiveFactor; + materialParams.emissive = new Color().setRGB( emissiveFactor[ 0 ], emissiveFactor[ 1 ], emissiveFactor[ 2 ], LinearSRGBColorSpace ); }