Skip to content

Commit

Permalink
fix merge, ensure sky visible for relevant presets
Browse files Browse the repository at this point in the history
  • Loading branch information
kfarr committed Nov 9, 2023
1 parent 5ab4a89 commit 5f80867
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand All @@ -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');
Expand All @@ -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');
Expand All @@ -415,33 +417,35 @@ 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');
} else if (this.data.preset === 'sunny-noon') {
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');
Expand Down

0 comments on commit 5f80867

Please sign in to comment.