You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rapidly changing the folder property causes unpredictable behaviour.
<a-scene><a-entityid="skybox" cubemap="folder: /assets/Yokohama3/"></a-entity></a-scene><scripttype="text/javascript">setTimeout(changeBackground,2000);functionchangeBackground(){letskybox=document.querySelector("#skybox");skybox.setAttribute("cubemap","folder: /assets/GoldenGateBridge2/");skybox.setAttribute("cubemap","folder: /assets/Yokohama3/");// Which cubemap will be displayed?}</script>
The cubemap that ultimately gets displayed depends on the order texture load callbacks are executed which is random. It is quite easy to end up in situations where component data is inconsistent with the displayed texture:
In the above, /assets/GoldenGateBridge2/" is displayed, but data.folder is "/assets/Yokohama3/".
Proposed fix
The texture load callback is closed over the original folder path it was called to load (srcPath) and can be given access to the current component data by binding this. By comparing past and current folder paths, the texture load callback can figure out what to do.
// Within the texture load callbackif(srcPath!==this.data.folder){// The texture that just finished loading no longer matches the folder// set on this component.texture.dispose();return;}// The folder property has not changed, so go ahead with the texture update.
The text was updated successfully, but these errors were encountered:
Rapidly changing the
folder
property causes unpredictable behaviour.The cubemap that ultimately gets displayed depends on the order texture load callbacks are executed which is random. It is quite easy to end up in situations where component data is inconsistent with the displayed texture:
In the above,
/assets/GoldenGateBridge2/"
is displayed, butdata.folder
is"/assets/Yokohama3/"
.Proposed fix
The texture load callback is closed over the original folder path it was called to load (srcPath) and can be given access to the current component data by binding
this
. By comparing past and current folder paths, the texture load callback can figure out what to do.The text was updated successfully, but these errors were encountered: