瀏覽代碼

Simplified Babylon example.

Mr.doob 10 年之前
父節點
當前提交
08b05d39d8
共有 1 個文件被更改,包括 6 次插入10 次删除
  1. 6 10
      examples/webgl_loader_babylon.html

+ 6 - 10
examples/webgl_loader_babylon.html

@@ -39,7 +39,6 @@
 			var camera, controls, scene, renderer;
 
 			init();
-			animate();
 
 			function init() {
 
@@ -52,13 +51,6 @@
 
 				scene = new THREE.Scene();
 
-				var ambient = new THREE.AmbientLight( 0x101030 );
-				scene.add( ambient );
-
-				var directionalLight = new THREE.DirectionalLight( 0xffeedd );
-				directionalLight.position.set( 0, 0, 1 );
-				scene.add( directionalLight );
-
 				// texture
 
 				var manager = new THREE.LoadingManager();
@@ -91,13 +83,17 @@
 
 						if ( object instanceof THREE.Mesh ) {
 
-							object.material = new THREE.MeshPhongMaterial( { color: Math.random() * 0xffffff } );
+							object.material = new THREE.MeshPhongMaterial( {
+								color: Math.random() * 0xffffff
+							} );
 
 						}
 
 					} );
 
-					scene.add( babylonScene );
+					scene = babylonScene;
+
+					animate();
 
 				}, onProgress, onError );