From 3c9041bdd921fa8eb13144f8fbcf18453db5fe34 Mon Sep 17 00:00:00 2001 From: Kevin Ngo Date: Tue, 16 Oct 2018 01:47:19 -0700 Subject: [PATCH] preload play button and search prev page --- src/components/gpu-preloader.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/components/gpu-preloader.js b/src/components/gpu-preloader.js index a2c6b39..681fc20 100644 --- a/src/components/gpu-preloader.js +++ b/src/components/gpu-preloader.js @@ -1,7 +1,7 @@ let i = 0; /** - * Preload stuff to GPU. + * Preload textures to GPU that are not visible from the start.. * three.js renderer by default will not upload textures from non-visible entities. */ AFRAME.registerComponent('gpu-preloader', { @@ -14,6 +14,8 @@ AFRAME.registerComponent('gpu-preloader', { this.preloadCutParticles(); this.preloadKeyboard(); this.preloadMissMap(); + this.preloadPlayButton(); + this.preloadSearchPrevPage(); this.preloadWallMap(); this.preloadWrongMap(); }, 1000); @@ -63,6 +65,16 @@ AFRAME.registerComponent('gpu-preloader', { this.preloadTexture(miss.getObject3D('mesh').material.map); }, + preloadPlayButton: function () { + const playButton = document.querySelector('#playButton'); + this.preloadTexture(playButton.getObject3D('mesh').material.map); + }, + + preloadSearchPrevPage : function () { + const prevPage = document.querySelector('#searchPrevPage'); + this.preloadTexture(prevPage.children[0].getObject3D('mesh').material.map); + }, + preloadWallMap: function () { const wall = document.querySelector('a-entity[wall]'); this.preloadTexture(wall.getObject3D('mesh').material.uniforms.tex.value);