repo: janusweb action: commit revision: path_from: revision_from: 5b68860bf76a520622ca5ebe71c22e3bb8b569eb: path_to: revision_to:
commit 5b68860bf76a520622ca5ebe71c22e3bb8b569eb Author: James BaicoianuDate: Sat Aug 24 06:53:27 2024 -0700 Handle already-loaded skybox equi images diff --git a/scripts/room.js b/scripts/room.js
--- a/scripts/room.js
+++ b/scripts/room.js
@@ -317,16 +317,26 @@ elation.require([
var assets = [];
if (this.skybox_equi) {
let equi = this.getAsset('image', this.skybox_equi);
- elation.events.add(equi, 'asset_load', ev => {
- this.skyboxtexture = ev.target._texture;
+ if (equi.loaded) {
+ this.skyboxtexture = equi.getInstance();
this.skyboxtexture.mapping = THREE.EquirectangularReflectionMapping;
this.skyboxtexture.encoding = THREE.sRGBEncoding;
if (this.janus.currentroom === this) {
this.skyboxobj.setTexture(this.skyboxtexture);
}
elation.events.fire({element: this, type: 'skybox_update'});
- });
- equi.getInstance();
+ } else {
+ elation.events.add(equi, 'asset_load', ev => {
+ this.skyboxtexture = ev.target._texture;
+ this.skyboxtexture.mapping = THREE.EquirectangularReflectionMapping;
+ this.skyboxtexture.encoding = THREE.sRGBEncoding;
+ if (this.janus.currentroom === this) {
+ this.skyboxobj.setTexture(this.skyboxtexture);
+ }
+ elation.events.fire({element: this, type: 'skybox_update'});
+ });
+ equi.getInstance();
+ }
} else if (hasSkybox) {
assets = [
this.getAsset('image', this.skybox_right_id || 'black'),
-----END OF PAGE-----