Last active
June 27, 2022 20:26
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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