preload play button and search prev page

This commit is contained in:
Kevin Ngo
2018-10-16 01:47:19 -07:00
parent f581e32bb4
commit 3c9041bdd9

View File

@@ -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);