webgl_loader_obj2_options.html 20.1 KB
Newer Older
K
Kai Salmen 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
<!DOCTYPE html>
<html lang="en">
	<head>
		<title>three.js webgl - WWOBJLoader2</title>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">

		<style>
			body {
				font-family: Monospace;
				background-color: #000;
				color: #fff;
				margin: 0 0 0 0;
				padding: 0 0 0 0;
				border: none;
				cursor: default;
			}
			#info {
				color: #fff;
				position: absolute;
				top: 10px;
				width: 100%;
				text-align: center;
				z-index: 100;
				display:block;
			}
			#info a {
				color: #f00;
				font-weight: bold;
				text-decoration: underline;
				cursor: pointer
			}
			#glFullscreen {
				width: 100%;
				height: 100vh;
				min-width: 640px;
				min-height: 360px;
				position: relative;
				overflow: hidden;
				z-index: 0;
			}
			#example {
				width: 100%;
				height: 100%;
				top: 0;
				left: 0;
				background-color: #000000;
			}
			#feedback {
				color: darkorange;
			}
			#dat {
				user-select: none;
				position: absolute;
				left: 0;
				top: 0;
				z-Index: 200;
			}
			#fileUploadInput {
				display: none;
			}
		</style>

	</head>

	<body>
		<div id="glFullscreen">
			<canvas id="example"></canvas>
		</div>
		<div id="dat">

		</div>
		<div id="info">
74
			<a href="http://threejs.org" target="_blank" rel="noopener">three.js</a> - OBJLoader2 direct loader test
K
Kai Salmen 已提交
75 76 77 78 79 80 81 82 83 84
			<div id="feedback"></div>
		</div>
		<input id="fileUploadInput" type="file" name="files[]" multiple accept=".obj,.mtl" />

		<script src="js/Detector.js"></script>
		<script src="../build/three.js"></script>
		<script src="js/controls/TrackballControls.js"></script>
		<script src="js/loaders/MTLLoader.js"></script>
		<script src="js/libs/dat.gui.min.js"></script>

85
		<script src="js/loaders/LoaderSupport.js"></script>
K
Kai Salmen 已提交
86 87 88 89 90 91 92
		<script src="js/loaders/OBJLoader2.js"></script>
		<script>

			'use strict';

			var WWOBJLoader2Example = (function () {

93
				var Validator = THREE.LoaderSupport.Validator;
K
#11200  
Kai Salmen 已提交
94

K
Kai Salmen 已提交
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
				function WWOBJLoader2Example( elementToBindTo ) {
					this.renderer = null;
					this.canvas = elementToBindTo;
					this.aspectRatio = 1;
					this.recalcAspectRatio();

					this.scene = null;
					this.cameraDefaults = {
						posCamera: new THREE.Vector3( 0.0, 175.0, 500.0 ),
						posCameraTarget: new THREE.Vector3( 0, 0, 0 ),
						near: 0.1,
						far: 10000,
						fov: 45
					};
					this.camera = null;
					this.cameraTarget = this.cameraDefaults.posCameraTarget;

					this.controls = null;

114
					this.flatShading = false;
K
Kai Salmen 已提交
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
					this.doubleSide = false;

					this.cube = null;
					this.pivot = null;

					// Check for the various File API support.
					this.fileApiAvailable = true;
					if ( window.File && window.FileReader && window.FileList && window.Blob ) {

						console.log( 'File API is supported! Enabling all features.' );

					} else {

						this.fileApiAvailable = false;
						console.warn( 'File API is not supported! Disabling file loading.' );

					}
132
					this.streamMeshes = true;
K
Kai Salmen 已提交
133 134 135 136 137
				}

				WWOBJLoader2Example.prototype.initGL = function () {
					this.renderer = new THREE.WebGLRenderer( {
						canvas: this.canvas,
138 139
						antialias: true,
						autoClear: true
K
Kai Salmen 已提交
140
					} );
141
					this.renderer.setClearColor( 0x050505 );
K
Kai Salmen 已提交
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173

					this.scene = new THREE.Scene();

					this.camera = new THREE.PerspectiveCamera( this.cameraDefaults.fov, this.aspectRatio, this.cameraDefaults.near, this.cameraDefaults.far );
					this.resetCamera();
					this.controls = new THREE.TrackballControls( this.camera, this.renderer.domElement );

					var ambientLight = new THREE.AmbientLight( 0x404040 );
					var directionalLight1 = new THREE.DirectionalLight( 0xC0C090 );
					var directionalLight2 = new THREE.DirectionalLight( 0xC0C090 );

					directionalLight1.position.set( -100, -50, 100 );
					directionalLight2.position.set( 100, 50, -100 );

					this.scene.add( directionalLight1 );
					this.scene.add( directionalLight2 );
					this.scene.add( ambientLight );

					var helper = new THREE.GridHelper( 1200, 60, 0xFF4444, 0x404040 );
					this.scene.add( helper );

					var geometry = new THREE.BoxGeometry( 10, 10, 10 );
					var material = new THREE.MeshNormalMaterial();
					this.cube = new THREE.Mesh( geometry, material );
					this.cube.position.set( 0, 0, 0 );
					this.scene.add( this.cube );

					this.pivot = new THREE.Object3D();
					this.pivot.name = 'Pivot';
					this.scene.add( this.pivot );
				};

174 175 176 177
				WWOBJLoader2Example.prototype.useParseSync = function () {
					var modelName = 'female02';
					this._reportProgress( 'Loading: ' + modelName );

178
					var scope = this;
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196
					var objLoader = new THREE.OBJLoader2();
					var onLoadMtl = function ( materials ) {
						objLoader.setModelName( modelName );
						objLoader.setMaterials( materials );

						var fileLoader = new THREE.FileLoader();
						fileLoader.setResponseType( 'arraybuffer' );
						fileLoader.load( 'obj/female02/female02.obj',
							function ( content ) {
								var local = new THREE.Object3D();
								local.name = 'Pivot_female02';
								local.position.set( 75, 0, 0 );
								scope.pivot.add( local );
								local.add( objLoader.parse( content ) );

								scope._reportProgress( 'Loading complete: ' + modelName );
							}
						);
K
Kai Salmen 已提交
197
					};
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213
					objLoader.loadMtl( 'obj/female02/female02.mtl', 'female02.mtl', null, onLoadMtl );
				};


				WWOBJLoader2Example.prototype.useParseAsync = function () {
					var modelName = 'female02_vertex' ;
					this._reportProgress( 'Loading: ' + modelName );

					var callbackOnLoad = function ( loaderRootNode, modelName, instanceNo ) {
						var local = new THREE.Object3D();
						local.name = 'Pivot_female02_vertex';
						local.position.set( -75, 0, 0 );
						scope.pivot.add( local );
						local.add( loaderRootNode );

						scope._reportProgress( 'Loading complete: ' + modelName );
214
					};
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283

					var scope = this;
					var objLoader = new THREE.OBJLoader2();
					objLoader.setModelName( modelName );

					var fileLoader = new THREE.FileLoader();
					fileLoader.setResponseType( 'arraybuffer' );
					fileLoader.load( 'obj/female02/female02_vertex_colors.obj',
						function ( content ) {
							objLoader.parseAsync( content, callbackOnLoad );
							scope._reportProgress( 'Loading complete: ' + modelName );
						}
					);
				};

				WWOBJLoader2Example.prototype.useLoadSync = function () {
					var modelName = 'male02';
					this._reportProgress( 'Loading: ' + modelName );

					var scope = this;
					var objLoader = new THREE.OBJLoader2();
					var callbackOnLoad = function ( loaderRootNode, modelName, instanceNo ) {
						var local = new THREE.Object3D();
						local.name = 'Pivot_male02';
						local.position.set( 0, 0, -75 );
						scope.pivot.add( local );
						local.add( loaderRootNode );

						scope._reportProgress( 'Loading complete: ' + modelName );
					};

					var onLoadMtl = function ( materials ) {
						objLoader.setModelName( modelName );
						objLoader.setMaterials( materials );
						objLoader.load( 'obj/male02/male02.obj', callbackOnLoad, null, null, null, false );
					};
					objLoader.loadMtl( 'obj/male02/male02.mtl', 'female02.mtl', null, onLoadMtl );
				};

				WWOBJLoader2Example.prototype.useLoadAsync = function () {
					var modelName = 'WaltHead';
					this._reportProgress( 'Loading: ' + modelName );

					var scope = this;
					var objLoader = new THREE.OBJLoader2();
					var callbackOnLoad = function ( loaderRootNode, modelName, instanceNo ) {
						var local = new THREE.Object3D();
						local.name = 'Pivot_WaltHead';
						local.position.set( -125, 50, 0 );
						var scale = 0.5;
						local.scale.set( scale, scale, scale );
						scope.pivot.add( local );
						local.add( loaderRootNode );

						scope._reportProgress( 'Loading complete: ' + modelName );
					};

					var onLoadMtl = function ( materials ) {
						objLoader.setModelName( modelName );
						objLoader.setMaterials( materials );
						objLoader.load( 'obj/walt/WaltHead.obj', callbackOnLoad, null, null, null, true );
					};
					objLoader.loadMtl( 'obj/walt//WaltHead.mtl', 'WaltHead.mtl', null, onLoadMtl );
				};

				WWOBJLoader2Example.prototype.useRunSync = function () {
					var scope = this;
					var callbackOnLoad = function ( loaderRootNode, modelName, instanceNo ) {
						scope._reportProgress( 'Loading complete: ' + modelName );
K
Kai Salmen 已提交
284 285
					};

286 287 288 289 290 291 292 293 294 295 296 297 298
					var prepData = new THREE.LoaderSupport.PrepData( 'cerberus' );
					var local = new THREE.Object3D();
					local.position.set( 0, 0, 100 );
					local.scale.set( 50.0, 50.0, 50.0 );
					this.pivot.add( local );
					prepData.setStreamMeshesTo( local );
					prepData.addResource( new THREE.LoaderSupport.ResourceDescriptor( 'models/obj/cerberus/Cerberus.obj', 'OBJ' ) );
					var callbacks = prepData.getCallbacks();
					callbacks.setCallbackOnProgress( this._reportProgress );
					callbacks.setCallbackOnLoad( callbackOnLoad );

					var objLoader = new THREE.OBJLoader2();
					objLoader.run( prepData );
K
Kai Salmen 已提交
299 300
				};

301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336
				WWOBJLoader2Example.prototype.useRunAsyncMeshAlter = function () {
					var scope = this;
					var callbackOnLoad = function ( loaderRootNode, modelName, instanceNo ) {
						scope._reportProgress( 'Loading complete: ' + modelName );
					};

					var prepData = new THREE.LoaderSupport.PrepData( 'vive-controller' );
					var local = new THREE.Object3D();
					local.position.set( 125, 50, 0 );
					local.name = 'Pivot_vive-controller';
					this.pivot.add( local );
					prepData.setStreamMeshesTo( local );
					prepData.addResource( new THREE.LoaderSupport.ResourceDescriptor( 'models/obj/vive-controller/vr_controller_vive_1_5.obj', 'OBJ' ) );
					prepData.setUseAsync( true );
					var callbacks = prepData.getCallbacks();
					var callbackMeshAlter = function ( name, bufferGeometry, material ) {
						var override = new THREE.LoaderSupport.LoadedMeshUserOverride( false, true );

						var mesh = new THREE.Mesh( bufferGeometry, material );
						var scale = 200.0;
						mesh.scale.set( scale, scale, scale );
						mesh.name = name;
						var helper = new THREE.VertexNormalsHelper( mesh, 2, 0x00ff00, 1 );
						helper.name = 'VertexNormalsHelper';

						override.addMesh( mesh );
						override.addMesh( helper );

						return override;
					};
					callbacks.setCallbackOnMeshAlter( callbackMeshAlter );
					callbacks.setCallbackOnProgress( this._reportProgress );
					callbacks.setCallbackOnLoad( callbackOnLoad );

					var objLoader = new THREE.OBJLoader2();
					objLoader.run( prepData );
337 338
				};

339 340 341 342 343 344 345
				WWOBJLoader2Example.prototype.finalize = function () {
					this._reportProgress( '' );
				};

				WWOBJLoader2Example.prototype._reportProgress = function( content, modelName, instanceNo ) {
					console.log( 'Progress: ' + content );
					document.getElementById( 'feedback' ).innerHTML = Validator.isValid( content ) ? content : '';
K
Kai Salmen 已提交
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364
				};

				WWOBJLoader2Example.prototype._handleFileSelect = function ( event, pathTexture ) {
					var fileObj = null;
					var fileMtl = null;
					var files = event.target.files;

					for ( var i = 0, file; file = files[ i ]; i++) {

						if ( file.name.indexOf( '\.obj' ) > 0 && fileObj === null ) {
							fileObj = file;
						}

						if ( file.name.indexOf( '\.mtl' ) > 0 && fileMtl === null ) {
							fileMtl = file;
						}

					}

K
#11200  
Kai Salmen 已提交
365
					if ( ! Validator.isValid( fileObj ) ) {
K
Kai Salmen 已提交
366 367 368
						alert( 'Unable to load OBJ file from given files.' );
					}

369 370 371 372 373 374 375
					var scope = this;
					var callbackOnLoad = function ( loderRootNode, modelName, instanceNo ) {
						scope.scene.add( loderRootNode );
						console.log( 'Loading complete: ' + modelName );
						scope._reportProgress( '' );
					};

K
Kai Salmen 已提交
376 377 378 379 380
					var fileReader = new FileReader();
					fileReader.onload = function( fileDataObj ) {

						var uint8Array = new Uint8Array( fileDataObj.target.result );

381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408
						var prepData = new THREE.LoaderSupport.PrepData( 'userObj' );
						var resourceOBJ = new THREE.LoaderSupport.ResourceDescriptor( pathTexture + '/' + fileObj.name, 'OBJ' );
						var userPivot = new THREE.Object3D();
						userPivot.position.set(
							-100 + 200 * Math.random(),
							-100 + 200 * Math.random(),
							-100 + 200 * Math.random()
						);
						prepData.setStreamMeshesTo( userPivot );
						scope.pivot.add( prepData.streamMeshesTo );

						resourceOBJ.setContent( uint8Array );
						prepData.addResource( resourceOBJ );
						prepData.setUseAsync( true );
						var callbacks = prepData.getCallbacks();
						callbacks.setCallbackOnProgress( scope._reportProgress );
						callbacks.setCallbackOnLoad( callbackOnLoad );

						fileReader.onload = function( fileDataMtl ) {

							var resourceMTL = new THREE.LoaderSupport.ResourceDescriptor( pathTexture + '/' + fileMtl.name, 'MTL' );
							resourceMTL.setContent( fileDataMtl.target.result );
							prepData.addResource( resourceMTL );

							var objLoader = new THREE.OBJLoader2();
							objLoader.run( prepData );
						};
						fileReader.readAsText( fileMtl );
K
Kai Salmen 已提交
409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451

					};
					fileReader.readAsArrayBuffer( fileObj );

				};

				WWOBJLoader2Example.prototype.resizeDisplayGL = function () {
					this.controls.handleResize();

					this.recalcAspectRatio();
					this.renderer.setSize( this.canvas.offsetWidth, this.canvas.offsetHeight, false );

					this.updateCamera();
				};

				WWOBJLoader2Example.prototype.recalcAspectRatio = function () {
					this.aspectRatio = ( this.canvas.offsetHeight === 0 ) ? 1 : this.canvas.offsetWidth / this.canvas.offsetHeight;
				};

				WWOBJLoader2Example.prototype.resetCamera = function () {
					this.camera.position.copy( this.cameraDefaults.posCamera );
					this.cameraTarget.copy( this.cameraDefaults.posCameraTarget );

					this.updateCamera();
				};

				WWOBJLoader2Example.prototype.updateCamera = function () {
					this.camera.aspect = this.aspectRatio;
					this.camera.lookAt( this.cameraTarget );
					this.camera.updateProjectionMatrix();
				};

				WWOBJLoader2Example.prototype.render = function () {
					if ( ! this.renderer.autoClear ) this.renderer.clear();

					this.controls.update();

					this.cube.rotation.x += 0.05;
					this.cube.rotation.y += 0.05;

					this.renderer.render( this.scene, this.camera );
				};

452
				WWOBJLoader2Example.prototype.alterShading = function () {
K
Kai Salmen 已提交
453
					var scope = this;
454 455
					scope.flatShading = ! scope.flatShading;
					console.log( scope.flatShading ? 'Enabling flat shading' : 'Enabling smooth shading');
K
Kai Salmen 已提交
456 457

					scope.traversalFunction = function ( material ) {
458
						material.flatShading = scope.flatShading;
K
Kai Salmen 已提交
459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484
						material.needsUpdate = true;
					};
					var scopeTraverse = function ( object3d ) {
						scope.traverseScene( object3d );
					};
					scope.pivot.traverse( scopeTraverse );
				};

				WWOBJLoader2Example.prototype.alterDouble = function () {
					var scope = this;
					scope.doubleSide = ! scope.doubleSide;
					console.log( scope.doubleSide ? 'Enabling DoubleSide materials' : 'Enabling FrontSide materials');

					scope.traversalFunction  = function ( material ) {
						material.side = scope.doubleSide ? THREE.DoubleSide : THREE.FrontSide;
					};

					var scopeTraverse = function ( object3d ) {
						scope.traverseScene( object3d );
					};
					scope.pivot.traverse( scopeTraverse );
				};

				WWOBJLoader2Example.prototype.traverseScene = function ( object3d ) {
					if ( object3d.material instanceof THREE.MultiMaterial ) {

485 486
						var materials = object3d.material.materials;
						for ( var name in materials ) {
K
Kai Salmen 已提交
487

488
							if ( materials.hasOwnProperty( name ) )	this.traversalFunction( materials[ name ] );
K
Kai Salmen 已提交
489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516

						}

					} else if ( object3d.material ) {

						this.traversalFunction( object3d.material );

					}
				};

				WWOBJLoader2Example.prototype.clearAllAssests = function () {
					var scope = this;
					var remover = function ( object3d ) {

						if ( object3d === scope.pivot ) {
							return;
						}
						console.log( 'Removing: ' + object3d.name );
						scope.scene.remove( object3d );

						if ( object3d.hasOwnProperty( 'geometry' ) ) {
							object3d.geometry.dispose();
						}
						if ( object3d.hasOwnProperty( 'material' ) ) {

							var mat = object3d.material;
							if ( mat.hasOwnProperty( 'materials' ) ) {

517 518 519 520 521
								var materials = mat.materials;
								for ( var name in materials ) {

									if ( materials.hasOwnProperty( name ) ) materials[ name ].dispose();

K
Kai Salmen 已提交
522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542
								}
							}
						}
						if ( object3d.hasOwnProperty( 'texture' ) ) {
							object3d.texture.dispose();
						}
					};

					scope.scene.remove( scope.pivot );
					scope.pivot.traverse( remover );
				};

				return WWOBJLoader2Example;

			})();

			var app = new WWOBJLoader2Example( document.getElementById( 'example' ) );

			// Init dat.gui and controls
			var elemFileInput = document.getElementById( 'fileUploadInput' );
			var WWOBJLoader2Control = function() {
543
				this.flatShading = app.flatShading;
K
Kai Salmen 已提交
544 545 546 547 548 549 550 551 552 553 554 555 556
				this.doubleSide = app.doubleSide;
				this.streamMeshes = app.streamMeshes;
			};
			var wwObjLoader2Control = new WWOBJLoader2Control();

			var gui = new dat.GUI( {
				autoPlace: false,
				width: 320
			} );

			var menuDiv = document.getElementById( 'dat' );
			menuDiv.appendChild(gui.domElement);
			var folderOptions = gui.addFolder( 'WWOBJLoader2 Options' );
557
			var controlSmooth = folderOptions.add( wwObjLoader2Control, 'flatShading' ).name( 'Flat Shading' );
K
Kai Salmen 已提交
558
			controlSmooth.onChange( function( value ) {
559 560
				console.log( 'Setting flatShading to: ' + value );
				app.alterShading();
K
Kai Salmen 已提交
561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620
			});

			var controlDouble = folderOptions.add( wwObjLoader2Control, 'doubleSide' ).name( 'Double Side Materials' );
			controlDouble.onChange( function( value ) {
				console.log( 'Setting doubleSide to: ' + value );
				app.alterDouble();
			});

			var controlStreamMeshes = folderOptions.add( wwObjLoader2Control, 'streamMeshes' ).name( 'Stream Meshes' );
			controlStreamMeshes.onChange( function( value ) {
				console.log( 'Setting streamMeshes to: ' + value );
				app.streamMeshes = value;
			});

			if ( app.fileApiAvailable ) {

				wwObjLoader2Control.pathTexture = 'obj/female02/';
				var controlPathTexture = folderOptions.add( wwObjLoader2Control, 'pathTexture' ).name( 'Relative path to textures' );
				controlPathTexture.onChange( function( value ) {
					console.log( 'Setting pathTexture to: ' + value );
					app.pathTexture = value + '/';
				});

				wwObjLoader2Control.loadObjFile = function () {
					elemFileInput.click();
				};
				folderOptions.add( wwObjLoader2Control, 'loadObjFile' ).name( 'Load OBJ/MTL Files' );

				var handleFileSelect = function ( object3d ) {
					app._handleFileSelect( object3d, wwObjLoader2Control.pathTexture );
				};
				elemFileInput.addEventListener( 'change' , handleFileSelect, false );

				wwObjLoader2Control.clearAllAssests = function () {
					app.clearAllAssests();
				};
				folderOptions.add( wwObjLoader2Control, 'clearAllAssests' ).name( 'Clear Scene' );

			}
			folderOptions.open();


			// init three.js example application
			var resizeWindow = function () {
				app.resizeDisplayGL();
			};

			var render = function () {
				requestAnimationFrame( render );
				app.render();
			};
			window.addEventListener( 'resize', resizeWindow, false );

			console.log( 'Starting initialisation phase...' );
			app.initGL();
			app.resizeDisplayGL();

			// kick render loop
			render();

621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641

			// Load a file with OBJLoader.parse synchronously
			app.useParseSync();

			// Load a file with OBJLoader.parseAsync asynchronously using a worker
			app.useParseAsync();

			// Load a file with OBJLoader.load synchronously
			app.useLoadSync();

			// Load a file with OBJLoader.load asynchronously
			app.useLoadAsync();

			// Load a file with OBJLoader.run synchronously
			app.useRunSync();

			// Load a file with OBJLoader.run asynchronously and add normals during onMeshAlter
			app.useRunAsyncMeshAlter();

			app.finalize();

K
Kai Salmen 已提交
642 643 644
		</script>
	</body>
</html>