fix mine env map preloading

This commit is contained in:
Kevin Ngo
2018-10-15 16:24:58 -07:00
parent 4854f3ea61
commit cc23743198
2 changed files with 32 additions and 23 deletions

View File

@@ -6,11 +6,12 @@ let i = 0;
*/
AFRAME.registerComponent('gpu-preloader', {
play: function () {
this.preloadMineEnvMaps();
setTimeout(() => {
this.preloadBeamMap();
this.preloadBeatEnvMap();
this.preloadCutParticles();
this.preloadMineEnvMaps();
this.preloadMissMap();
this.preloadWallMap();
this.preloadWrongMap();
@@ -42,8 +43,12 @@ AFRAME.registerComponent('gpu-preloader', {
preloadMineEnvMaps: function () {
const stageColors = this.el.sceneEl.components['stage-colors'];
this.preloadTexture(stageColors.mineEnvMap.red);
this.preloadTexture(stageColors.mineEnvMap.blue);
this.el.sceneEl.addEventListener('mineredenvmaploaded', () => {
this.preloadTexture(stageColors.mineEnvMap.red);
});
this.el.sceneEl.addEventListener('mineblueenvmaploaded', () => {
this.preloadTexture(stageColors.mineEnvMap.blue);
});
},
preloadMissMap: function () {