@@ -74,6 +74,9 @@ AFRAME.registerComponent('environment', {
74
74
init : function ( ) {
75
75
this . environmentData = { } ;
76
76
77
+ // renderer system for color correction
78
+ this . rendererSystem = this . el . sceneEl . systems . renderer ;
79
+
77
80
// stage ground diameter (and sky radius)
78
81
this . STAGE_SIZE = 200 ;
79
82
@@ -270,13 +273,18 @@ AFRAME.registerComponent('environment', {
270
273
skycol . r = ( skycol . r + 1.0 ) / 2.0 ;
271
274
skycol . g = ( skycol . g + 1.0 ) / 2.0 ;
272
275
skycol . b = ( skycol . b + 1.0 ) / 2.0 ;
273
- this . hemilight . setAttribute ( 'light' , { 'color' : '#' + skycol . getHexString ( ) } ) ;
276
+ this . hemilight . setAttribute ( 'light' , {
277
+ 'color' : '#' + skycol . getHexString ( ) ,
278
+ 'intensity' : 0.6
279
+ } ) ;
274
280
this . sunlight . setAttribute ( 'light' , { 'intensity' : 0.6 } ) ;
275
- this . hemilight . setAttribute ( 'light' , { 'intensity' : 0.6 } ) ;
276
281
}
277
282
else {
283
+ this . hemilight . setAttribute ( 'light' , {
284
+ 'color' : '#CEE4F0' ,
285
+ 'intensity' : 0.1 + sunPos . y * 0.5
286
+ } ) ;
278
287
this . sunlight . setAttribute ( 'light' , { 'intensity' : 0.1 + sunPos . y * 0.5 } ) ;
279
- this . hemilight . setAttribute ( 'light' , { 'intensity' : 0.1 + sunPos . y * 0.5 } ) ;
280
288
}
281
289
282
290
this . sunlight . setAttribute ( 'light' , {
@@ -553,6 +561,7 @@ AFRAME.registerComponent('environment', {
553
561
this . gridTexture . wrapS = THREE . RepeatWrapping ;
554
562
this . gridTexture . wrapT = THREE . RepeatWrapping ;
555
563
this . gridTexture . repeat . set ( texRepeat , texRepeat ) ;
564
+ this . rendererSystem . applyColorCorrection ( this . gridTexture ) ;
556
565
557
566
this . groundCanvas = document . createElement ( 'canvas' ) ;
558
567
this . groundCanvas . width = groundResolution ;
@@ -561,6 +570,7 @@ AFRAME.registerComponent('environment', {
561
570
this . groundTexture . wrapS = THREE . RepeatWrapping ;
562
571
this . groundTexture . wrapT = THREE . RepeatWrapping ;
563
572
this . groundTexture . repeat . set ( texRepeat , texRepeat ) ;
573
+ this . rendererSystem . applyColorCorrection ( this . groundTexture ) ;
564
574
565
575
// ground material diffuse map is the regular ground texture and the grid texture
566
576
// is used in the emissive map. This way, the grid is always equally visible, even at night.
@@ -943,6 +953,7 @@ AFRAME.registerComponent('environment', {
943
953
var material = new THREE . MeshLambertMaterial ( {
944
954
color : new THREE . Color ( this . environmentData . dressingColor )
945
955
} ) ;
956
+ this . rendererSystem . applyColorCorrection ( material . color ) ;
946
957
947
958
// create mesh
948
959
var mesh = new THREE . Mesh ( bufgeo , material ) ;
0 commit comments