From 237e6679ad790696eb6d072fe5be2fabb3eae9de Mon Sep 17 00:00:00 2001 From: Peter Butcher Date: Sun, 26 Nov 2017 06:01:50 +0000 Subject: [PATCH 1/3] Update groundMaterial shading Suppresses the following warning: `THREE.MeshLambertMaterial: .shading has been removed. Use the boolean .flatShading instead.` `.shading` has been removed and is now `.flatShading`, see: https://threejs.org/docs/index.html#api/materials/Material --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 0a08bb45..fada1523 100644 --- a/index.js +++ b/index.js @@ -563,7 +563,7 @@ AFRAME.registerComponent('environment', { map: this.groundTexture, emissive: new THREE.Color(0xFFFFFF), emissiveMap: this.gridTexture, - shading: this.data.flatShading ? THREE.FlatShading : THREE.SmoothShading + flatShading: this.data.flatShading }); } From ba4a896be91177a629c72b6176c1319deb800784 Mon Sep 17 00:00:00 2001 From: Peter Butcher Date: Tue, 28 Nov 2017 15:37:08 +0000 Subject: [PATCH 2/3] Update groundMaterial shading (backwards compatible) Use .shading for ground MeshLambertMaterial in A-Frame < 0.7.0 and .flatShading for >= 0.7.0 --- index.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index fada1523..4a27291e 100644 --- a/index.js +++ b/index.js @@ -559,12 +559,20 @@ AFRAME.registerComponent('environment', { // ground material diffuse map is the regular ground texture and the grid texture // is used in the emissive map. This way, the grid is always equally visible, even at night. - this.groundMaterial = new THREE.MeshLambertMaterial({ + this.groundMaterialProps = { map: this.groundTexture, emissive: new THREE.Color(0xFFFFFF), - emissiveMap: this.gridTexture, - flatShading: this.data.flatShading - }); + emissiveMap: this.gridTexture + }; + + // use .shading for A-Frame < 0.6.0 and .flatShading for A-Frame >= 0.7.0 + if (new THREE.Material().hasOwnProperty('shading')) { + this.groundMaterialProps.shading = this.data.flatShading ? THREE.FlatShading : THREE.SmoothShading; + } else { + this.groundMaterialProps.flatShading = this.data.flatShading; + } + + this.groundMaterial = new THREE.MeshLambertMaterial(this.groundMaterialProps); } var groundctx = this.groundCanvas.getContext('2d'); From c677c5e37eabdcac91f296fd913fe30f2ad18cdb Mon Sep 17 00:00:00 2001 From: Peter Butcher Date: Tue, 28 Nov 2017 15:42:25 +0000 Subject: [PATCH 3/3] Comment typo --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 4a27291e..473cfdb6 100644 --- a/index.js +++ b/index.js @@ -565,7 +565,7 @@ AFRAME.registerComponent('environment', { emissiveMap: this.gridTexture }; - // use .shading for A-Frame < 0.6.0 and .flatShading for A-Frame >= 0.7.0 + // use .shading for A-Frame < 0.7.0 and .flatShading for A-Frame >= 0.7.0 if (new THREE.Material().hasOwnProperty('shading')) { this.groundMaterialProps.shading = this.data.flatShading ? THREE.FlatShading : THREE.SmoothShading; } else {