es5版本(旧版)Threejs添加hdr天空图

function changeEnvMap(url) {
    var loader99 = new THREE.RGBELoader();
    loader99.load(url, function (texture) {

        texture.encoding = THREE.RGBEEncoding;
        texture.minFilter = THREE.NearestFilter;
        texture.magFilter = THREE.NearestFilter;
        texture.flipY = true;

        var cubeGenerator = new THREE.EquirectangularToCubeGenerator(texture, { resolution: 1024 });
        cubeGenerator.update(renderer);

        var pmremGenerator = new THREE.PMREMGenerator(cubeGenerator.renderTarget.texture);
        pmremGenerator.update(renderer);

        var pmremCubeUVPacker = new THREE.PMREMCubeUVPacker(pmremGenerator.cubeLods);
        pmremCubeUVPacker.update(renderer);

        // var envMap = pmremCubeUVPacker.CubeUVRenderTarget.texture;
        pmremGenerator.dispose();
        pmremCubeUVPacker.dispose();

        scene.environment = cubeGenerator.renderTarget;
        scene.background = cubeGenerator.renderTarget;

    });
}