-
-
Save JacobMuchow/48cd2b1f0e0e519c4568f395ca697665 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
import { RGBELoader } from 'three/examples/jsm/loaders/RGBELoader.js' | |
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