Browse Source

GLTFLoader: Add shadows and error logging to example.

Don McCurdy 7 years ago
parent
commit
5107c06d86
1 changed files with 11 additions and 1 deletions
  1. 11 1
      examples/webgl_loader_gltf.html

+ 11 - 1
examples/webgl_loader_gltf.html

@@ -274,6 +274,12 @@
 
 
 					}
 					}
 
 
+					object.traverse( function ( node ) {
+
+						if ( node.isMesh ) node.castShadow = true;
+
+					} );
+
 					cameraIndex = 0;
 					cameraIndex = 0;
 					cameras = [];
 					cameras = [];
 					cameraNames = [];
 					cameraNames = [];
@@ -332,7 +338,11 @@
 					scene.add( object );
 					scene.add( object );
 					onWindowResize();
 					onWindowResize();
 
 
-				});
+				}, undefined, function ( error ) {
+
+					console.error( error );
+
+				} );
 
 
 			orbitControls = new THREE.OrbitControls(defaultCamera, renderer.domElement);
 			orbitControls = new THREE.OrbitControls(defaultCamera, renderer.domElement);