From 5f808671797170e800dfab5c0f022c9475742e32 Mon Sep 17 00:00:00 2001 From: Kieran Farr Date: Wed, 8 Nov 2023 20:38:31 -0800 Subject: [PATCH] fix merge, ensure sky visible for relevant presets --- src/index.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index e1c22fd6b..db331b4e7 100644 --- a/src/index.js +++ b/src/index.js @@ -379,7 +379,7 @@ AFRAME.registerComponent('intersection', { AFRAME.registerComponent('street-environment', { schema: { - preset: { type: 'string', default: 'day', oneOf: ['day', 'night', 'color', 'sunny-morning', 'cloudy-afternoon', 'sunny-afternoon', 'sunny-noon', 'foggy', 'cloudy'] } + preset: { type: 'string', default: 'day', oneOf: ['day', 'night', 'color', 'sunny-morning', 'cloudy-afternoon', 'sunny-afternoon', 'sunny-noon', 'foggy', 'cloudy'] }, backgroundColor: { type: 'color', default: '#FFF' } }, setEnvOption: function () { @@ -398,6 +398,7 @@ AFRAME.registerComponent('street-environment', { } else if (this.data.preset === 'day') { // TODO: create a parent with children light1.setAttribute('light', 'intensity', 0.8); + sky.setAttribute('visible', true); sky.setAttribute('color', '#FFF'); sky.setAttribute('src', '#sky'); sky.setAttribute('rotation', '0 20 0'); @@ -407,6 +408,7 @@ AFRAME.registerComponent('street-environment', { light1.setAttribute('light', 'intensity', 0.8); light2.setAttribute('light', 'intensity: 2.2; castShadow: true; shadowCameraBottom: -20; shadowCameraLeft: -30; shadowCameraRight: 40; shadowCameraTop: 30; shadowMapHeight: 2048; shadowMapWidth: 2048'); light2.setAttribute('position', '-60 56 -16'); + sky.setAttribute('visible', true); sky.setAttribute('color', '#FFF'); sky.setAttribute('src', `url(${assetsPathRoot}images/skies/2048-polyhaven-qwantani_puresky-sdr.jpeg)`); sky.setAttribute('rotation', '0 0 0'); @@ -415,14 +417,13 @@ AFRAME.registerComponent('street-environment', { light2.setAttribute('light', 'intensity', 0.6); sky.setAttribute('visible', true); sky.setAttribute('color', '#FFF'); - sky.setAttribute('src', '#sky'); - sky.setAttribute('rotation', '0 255 0'); sky.setAttribute('src', `url(${assetsPathRoot}images/skies/2048-mud_road_puresky-sdr.jpeg)`); sky.setAttribute('rotation', '0 0 0'); } else if (this.data.preset === 'sunny-afternoon') { light1.setAttribute('light', 'intensity', 2); light2.setAttribute('light', 'intensity: 2.2; castShadow: true; shadowCameraBottom: -20; shadowCameraLeft: -30; shadowCameraRight: 40; shadowCameraTop: 30; shadowMapHeight: 2048; shadowMapWidth: 2048'); light2.setAttribute('position', '60 56 -16'); + sky.setAttribute('visible', true); sky.setAttribute('color', '#FFF'); sky.setAttribute('src', `url(${assetsPathRoot}images/skies/2048-kloofendal_43d_clear_puresky-sdr.jpeg)`); sky.setAttribute('rotation', '0 0 0'); @@ -430,18 +431,21 @@ AFRAME.registerComponent('street-environment', { light1.setAttribute('light', 'intensity', 2); light2.setAttribute('light', 'intensity: 2.2; castShadow: true; shadowCameraBottom: -20; shadowCameraLeft: -30; shadowCameraRight: 40; shadowCameraTop: 30; shadowMapHeight: 2048; shadowMapWidth: 2048'); light2.setAttribute('position', '5 56 -16'); + sky.setAttribute('visible', true); sky.setAttribute('color', '#FFF'); sky.setAttribute('src', `url(${assetsPathRoot}images/skies/2048-kloppenheim_05_puresky-sdr.jpeg)`); sky.setAttribute('rotation', '0 0 0'); } else if (this.data.preset === 'foggy') { light1.setAttribute('light', 'intensity', 2); light2.setAttribute('light', 'intensity: 0.6; castShadow: false;'); + sky.setAttribute('visible', true); sky.setAttribute('color', '#FFF'); sky.setAttribute('src', `url(${assetsPathRoot}images/skies/2048-kloofendal_misty_morning_puresky-sdr.jpeg)`); sky.setAttribute('rotation', '0 0 0'); } else if (this.data.preset === 'cloudy') { light1.setAttribute('light', 'intensity', 2); light2.setAttribute('light', 'intensity', 0.6); + sky.setAttribute('visible', true); sky.setAttribute('color', '#FFF'); sky.setAttribute('src', `url(${assetsPathRoot}images/skies/2048-kloofendal_48d_partly_cloudy_puresky-sdr.jpeg)`); sky.setAttribute('rotation', '0 0 0');