Skip to content

Instantly share code, notes, and snippets.

@dosterz97
Last active June 27, 2022 20:26
Show Gist options
  • Save dosterz97/92d8fb99261292e0518eb3508a51b98c to your computer and use it in GitHub Desktop.
Save dosterz97/92d8fb99261292e0518eb3508a51b98c to your computer and use it in GitHub Desktop.
Add a loader function to help us get the file added to our environment.
loadBackground(url, renderer) {
return new Promise((resolve) => {
const loader = new RGBELoader()
const generator = new THREE.PMREMGenerator(renderer)
loader.load(url, (texture) => {
const envMap = generator.fromEquirectangular(texture).texture
generator.dispose()
texture.dispose()
resolve(envMap)
})
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment