diff --git a/examples/webgl_loader_gltf2.html b/examples/webgl_loader_gltf2.html
index eb95c2ebb2e47c8fdc9e887b5649293bde1827df..406cd8ca80868288dc7c4f93391d017af72fcb11 100644
--- a/examples/webgl_loader_gltf2.html
+++ b/examples/webgl_loader_gltf2.html
@@ -253,6 +253,25 @@
if (sceneInfo.objectScale)
object.scale.copy(sceneInfo.objectScale);
+ if ( sceneInfo.addEnvMap ) {
+
+ var envMap = getEnvMap();
+
+ object.traverse( function( node ) {
+
+ if ( node.material && node.material.isMeshStandardMaterial ) {
+
+ node.material.envMap = envMap;
+ node.material.needsUpdate = true;
+
+ }
+
+ } );
+
+ scene.background = envMap;
+
+ }
+
cameraIndex = 0;
cameras = [];
cameraNames = [];
@@ -367,13 +386,38 @@
}
+ var envMap;
+
+ function getEnvMap() {
+
+ if ( envMap ) {
+
+ return envMap;
+
+ }
+
+ var path = 'textures/cube/Park2/';
+ var format = '.jpg';
+ var urls = [
+ path + 'posx' + format, path + 'negx' + format,
+ path + 'posy' + format, path + 'negy' + format,
+ path + 'posz' + format, path + 'negz' + format
+ ];
+
+ envMap = new THREE.CubeTextureLoader().load( urls );
+ envMap.format = THREE.RGBFormat;
+ return envMap;
+
+ }
+
var sceneList = [
{
name : "BoomBox (PBR)", url : "./models/gltf/BoomBox/%s/BoomBox.gltf",
cameraPos: new THREE.Vector3(2, 1, 3),
objectRotation: new THREE.Euler(0, Math.PI, 0),
addLights:true,
- extensions: ["glTF", "glTF-Binary"]
+ extensions: ["glTF", "glTF-Binary"],
+ addEnvMap: true
}
];