File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -567,12 +567,20 @@ AFRAME.registerComponent('environment', {
567
567
568
568
// ground material diffuse map is the regular ground texture and the grid texture
569
569
// is used in the emissive map. This way, the grid is always equally visible, even at night.
570
- this . groundMaterial = new THREE . MeshLambertMaterial ( {
570
+ this . groundMaterialProps = {
571
571
map : this . groundTexture ,
572
572
emissive : new THREE . Color ( 0xFFFFFF ) ,
573
- emissiveMap : this . gridTexture ,
574
- shading : this . data . flatShading ? THREE . FlatShading : THREE . SmoothShading
575
- } ) ;
573
+ emissiveMap : this . gridTexture
574
+ } ;
575
+
576
+ // use .shading for A-Frame < 0.7.0 and .flatShading for A-Frame >= 0.7.0
577
+ if ( new THREE . Material ( ) . hasOwnProperty ( 'shading' ) ) {
578
+ this . groundMaterialProps . shading = this . data . flatShading ? THREE . FlatShading : THREE . SmoothShading ;
579
+ } else {
580
+ this . groundMaterialProps . flatShading = this . data . flatShading ;
581
+ }
582
+
583
+ this . groundMaterial = new THREE . MeshLambertMaterial ( this . groundMaterialProps ) ;
576
584
}
577
585
578
586
var groundctx = this . groundCanvas . getContext ( '2d' ) ;
You can’t perform that action at this time.
0 commit comments