preload keyboard img
This commit is contained in:
@@ -12,6 +12,7 @@ AFRAME.registerComponent('gpu-preloader', {
|
||||
this.preloadBeamMap();
|
||||
this.preloadBeatEnvMap();
|
||||
this.preloadCutParticles();
|
||||
this.preloadKeyboard();
|
||||
this.preloadMissMap();
|
||||
this.preloadWallMap();
|
||||
this.preloadWrongMap();
|
||||
@@ -41,6 +42,12 @@ AFRAME.registerComponent('gpu-preloader', {
|
||||
this.preloadTexture(particles.components.particleplayer.material.map);
|
||||
},
|
||||
|
||||
preloadKeyboard: function () {
|
||||
const keyboard = document.getElementById('keyboard')
|
||||
const kbImg = keyboard.components['super-keyboard'].kbImg;
|
||||
this.preloadTexture(kbImg.getObject3D('mesh').material.map);
|
||||
},
|
||||
|
||||
preloadMineEnvMaps: function () {
|
||||
const stageColors = this.el.sceneEl.components['stage-colors'];
|
||||
this.el.sceneEl.addEventListener('mineredenvmaploaded', () => {
|
||||
@@ -71,6 +78,10 @@ AFRAME.registerComponent('gpu-preloader', {
|
||||
console.warn('[gpu-preloader] Error preloading texture', texture);
|
||||
return;
|
||||
}
|
||||
if (!texture.image.complete) {
|
||||
console.warn('[gpu-preloader] Error preloading, image not loaded', texture);
|
||||
return;
|
||||
}
|
||||
this.el.renderer.setTexture2D(texture, i++ % 8);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user