webgl_loader_obj2_options.html 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <title>three.js webgl - WWOBJLoader2</title>
  5. <meta charset="utf-8">
  6. <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  7. <style>
  8. body {
  9. font-family: Monospace;
  10. background-color: #000;
  11. color: #fff;
  12. margin: 0 0 0 0;
  13. padding: 0 0 0 0;
  14. border: none;
  15. cursor: default;
  16. }
  17. #info {
  18. color: #fff;
  19. position: absolute;
  20. top: 10px;
  21. width: 100%;
  22. text-align: center;
  23. z-index: 100;
  24. display:block;
  25. }
  26. #info a {
  27. color: #f00;
  28. font-weight: bold;
  29. text-decoration: underline;
  30. cursor: pointer
  31. }
  32. #glFullscreen {
  33. width: 100%;
  34. height: 100vh;
  35. min-width: 640px;
  36. min-height: 360px;
  37. position: relative;
  38. overflow: hidden;
  39. z-index: 0;
  40. }
  41. #example {
  42. width: 100%;
  43. height: 100%;
  44. top: 0;
  45. left: 0;
  46. background-color: #000000;
  47. }
  48. #feedback {
  49. color: darkorange;
  50. }
  51. #dat {
  52. user-select: none;
  53. position: absolute;
  54. left: 0;
  55. top: 0;
  56. z-Index: 200;
  57. }
  58. #fileUploadInput {
  59. display: none;
  60. }
  61. </style>
  62. </head>
  63. <body>
  64. <div id="glFullscreen">
  65. <canvas id="example"></canvas>
  66. </div>
  67. <div id="dat">
  68. </div>
  69. <div id="info">
  70. <a href="http://threejs.org" target="_blank" rel="noopener">three.js</a> - OBJLoader2 direct loader test
  71. <div id="feedback"></div>
  72. </div>
  73. <input id="fileUploadInput" type="file" name="files[]" multiple accept=".obj,.mtl" />
  74. <script src="js/Detector.js"></script>
  75. <script src="../build/three.js"></script>
  76. <script src="js/controls/TrackballControls.js"></script>
  77. <script src="js/loaders/MTLLoader.js"></script>
  78. <script src="js/libs/dat.gui.min.js"></script>
  79. <script src="js/loaders/LoaderSupport.js"></script>
  80. <script src="js/loaders/OBJLoader2.js"></script>
  81. <script>
  82. 'use strict';
  83. var WWOBJLoader2Example = (function () {
  84. var Validator = THREE.LoaderSupport.Validator;
  85. function WWOBJLoader2Example( elementToBindTo ) {
  86. this.renderer = null;
  87. this.canvas = elementToBindTo;
  88. this.aspectRatio = 1;
  89. this.recalcAspectRatio();
  90. this.scene = null;
  91. this.cameraDefaults = {
  92. posCamera: new THREE.Vector3( 0.0, 175.0, 500.0 ),
  93. posCameraTarget: new THREE.Vector3( 0, 0, 0 ),
  94. near: 0.1,
  95. far: 10000,
  96. fov: 45
  97. };
  98. this.camera = null;
  99. this.cameraTarget = this.cameraDefaults.posCameraTarget;
  100. this.controls = null;
  101. this.flatShading = false;
  102. this.doubleSide = false;
  103. this.cube = null;
  104. this.pivot = null;
  105. // Check for the various File API support.
  106. this.fileApiAvailable = true;
  107. if ( window.File && window.FileReader && window.FileList && window.Blob ) {
  108. console.log( 'File API is supported! Enabling all features.' );
  109. } else {
  110. this.fileApiAvailable = false;
  111. console.warn( 'File API is not supported! Disabling file loading.' );
  112. }
  113. this.streamMeshes = true;
  114. }
  115. WWOBJLoader2Example.prototype.initGL = function () {
  116. this.renderer = new THREE.WebGLRenderer( {
  117. canvas: this.canvas,
  118. antialias: true,
  119. autoClear: true
  120. } );
  121. this.renderer.setClearColor( 0x050505 );
  122. this.scene = new THREE.Scene();
  123. this.camera = new THREE.PerspectiveCamera( this.cameraDefaults.fov, this.aspectRatio, this.cameraDefaults.near, this.cameraDefaults.far );
  124. this.resetCamera();
  125. this.controls = new THREE.TrackballControls( this.camera, this.renderer.domElement );
  126. var ambientLight = new THREE.AmbientLight( 0x404040 );
  127. var directionalLight1 = new THREE.DirectionalLight( 0xC0C090 );
  128. var directionalLight2 = new THREE.DirectionalLight( 0xC0C090 );
  129. directionalLight1.position.set( -100, -50, 100 );
  130. directionalLight2.position.set( 100, 50, -100 );
  131. this.scene.add( directionalLight1 );
  132. this.scene.add( directionalLight2 );
  133. this.scene.add( ambientLight );
  134. var helper = new THREE.GridHelper( 1200, 60, 0xFF4444, 0x404040 );
  135. this.scene.add( helper );
  136. var geometry = new THREE.BoxGeometry( 10, 10, 10 );
  137. var material = new THREE.MeshNormalMaterial();
  138. this.cube = new THREE.Mesh( geometry, material );
  139. this.cube.position.set( 0, 0, 0 );
  140. this.scene.add( this.cube );
  141. this.pivot = new THREE.Object3D();
  142. this.pivot.name = 'Pivot';
  143. this.scene.add( this.pivot );
  144. };
  145. WWOBJLoader2Example.prototype.useParseSync = function () {
  146. var modelName = 'female02';
  147. this._reportProgress( 'Loading: ' + modelName );
  148. var scope = this;
  149. var objLoader = new THREE.OBJLoader2();
  150. var onLoadMtl = function ( materials ) {
  151. objLoader.setModelName( modelName );
  152. objLoader.setMaterials( materials );
  153. var fileLoader = new THREE.FileLoader();
  154. fileLoader.setResponseType( 'arraybuffer' );
  155. fileLoader.load( 'obj/female02/female02.obj',
  156. function ( content ) {
  157. var local = new THREE.Object3D();
  158. local.name = 'Pivot_female02';
  159. local.position.set( 75, 0, 0 );
  160. scope.pivot.add( local );
  161. local.add( objLoader.parse( content ) );
  162. scope._reportProgress( 'Loading complete: ' + modelName );
  163. }
  164. );
  165. };
  166. objLoader.loadMtl( 'obj/female02/female02.mtl', 'female02.mtl', null, onLoadMtl );
  167. };
  168. WWOBJLoader2Example.prototype.useParseAsync = function () {
  169. var modelName = 'female02_vertex' ;
  170. this._reportProgress( 'Loading: ' + modelName );
  171. var callbackOnLoad = function ( loaderRootNode, modelName, instanceNo ) {
  172. var local = new THREE.Object3D();
  173. local.name = 'Pivot_female02_vertex';
  174. local.position.set( -75, 0, 0 );
  175. scope.pivot.add( local );
  176. local.add( loaderRootNode );
  177. scope._reportProgress( 'Loading complete: ' + modelName );
  178. };
  179. var scope = this;
  180. var objLoader = new THREE.OBJLoader2();
  181. objLoader.setModelName( modelName );
  182. var fileLoader = new THREE.FileLoader();
  183. fileLoader.setResponseType( 'arraybuffer' );
  184. fileLoader.load( 'obj/female02/female02_vertex_colors.obj',
  185. function ( content ) {
  186. objLoader.parseAsync( content, callbackOnLoad );
  187. scope._reportProgress( 'Loading complete: ' + modelName );
  188. }
  189. );
  190. };
  191. WWOBJLoader2Example.prototype.useLoadSync = function () {
  192. var modelName = 'male02';
  193. this._reportProgress( 'Loading: ' + modelName );
  194. var scope = this;
  195. var objLoader = new THREE.OBJLoader2();
  196. var callbackOnLoad = function ( loaderRootNode, modelName, instanceNo ) {
  197. var local = new THREE.Object3D();
  198. local.name = 'Pivot_male02';
  199. local.position.set( 0, 0, -75 );
  200. scope.pivot.add( local );
  201. local.add( loaderRootNode );
  202. scope._reportProgress( 'Loading complete: ' + modelName );
  203. };
  204. var onLoadMtl = function ( materials ) {
  205. objLoader.setModelName( modelName );
  206. objLoader.setMaterials( materials );
  207. objLoader.load( 'obj/male02/male02.obj', callbackOnLoad, null, null, null, false );
  208. };
  209. objLoader.loadMtl( 'obj/male02/male02.mtl', 'female02.mtl', null, onLoadMtl );
  210. };
  211. WWOBJLoader2Example.prototype.useLoadAsync = function () {
  212. var modelName = 'WaltHead';
  213. this._reportProgress( 'Loading: ' + modelName );
  214. var scope = this;
  215. var objLoader = new THREE.OBJLoader2();
  216. var callbackOnLoad = function ( loaderRootNode, modelName, instanceNo ) {
  217. var local = new THREE.Object3D();
  218. local.name = 'Pivot_WaltHead';
  219. local.position.set( -125, 50, 0 );
  220. var scale = 0.5;
  221. local.scale.set( scale, scale, scale );
  222. scope.pivot.add( local );
  223. local.add( loaderRootNode );
  224. scope._reportProgress( 'Loading complete: ' + modelName );
  225. };
  226. var onLoadMtl = function ( materials ) {
  227. objLoader.setModelName( modelName );
  228. objLoader.setMaterials( materials );
  229. objLoader.load( 'obj/walt/WaltHead.obj', callbackOnLoad, null, null, null, true );
  230. };
  231. objLoader.loadMtl( 'obj/walt//WaltHead.mtl', 'WaltHead.mtl', null, onLoadMtl );
  232. };
  233. WWOBJLoader2Example.prototype.useRunSync = function () {
  234. var scope = this;
  235. var callbackOnLoad = function ( loaderRootNode, modelName, instanceNo ) {
  236. scope._reportProgress( 'Loading complete: ' + modelName );
  237. };
  238. var prepData = new THREE.LoaderSupport.PrepData( 'cerberus' );
  239. var local = new THREE.Object3D();
  240. local.position.set( 0, 0, 100 );
  241. local.scale.set( 50.0, 50.0, 50.0 );
  242. this.pivot.add( local );
  243. prepData.setStreamMeshesTo( local );
  244. prepData.addResource( new THREE.LoaderSupport.ResourceDescriptor( 'models/obj/cerberus/Cerberus.obj', 'OBJ' ) );
  245. var callbacks = prepData.getCallbacks();
  246. callbacks.setCallbackOnProgress( this._reportProgress );
  247. callbacks.setCallbackOnLoad( callbackOnLoad );
  248. var objLoader = new THREE.OBJLoader2();
  249. objLoader.run( prepData );
  250. };
  251. WWOBJLoader2Example.prototype.useRunAsyncMeshAlter = function () {
  252. var scope = this;
  253. var callbackOnLoad = function ( loaderRootNode, modelName, instanceNo ) {
  254. scope._reportProgress( 'Loading complete: ' + modelName );
  255. };
  256. var prepData = new THREE.LoaderSupport.PrepData( 'vive-controller' );
  257. var local = new THREE.Object3D();
  258. local.position.set( 125, 50, 0 );
  259. local.name = 'Pivot_vive-controller';
  260. this.pivot.add( local );
  261. prepData.setStreamMeshesTo( local );
  262. prepData.addResource( new THREE.LoaderSupport.ResourceDescriptor( 'models/obj/vive-controller/vr_controller_vive_1_5.obj', 'OBJ' ) );
  263. prepData.setUseAsync( true );
  264. var callbacks = prepData.getCallbacks();
  265. var callbackMeshAlter = function ( name, bufferGeometry, material ) {
  266. var override = new THREE.LoaderSupport.LoadedMeshUserOverride( false, true );
  267. var mesh = new THREE.Mesh( bufferGeometry, material );
  268. var scale = 200.0;
  269. mesh.scale.set( scale, scale, scale );
  270. mesh.name = name;
  271. var helper = new THREE.VertexNormalsHelper( mesh, 2, 0x00ff00, 1 );
  272. helper.name = 'VertexNormalsHelper';
  273. override.addMesh( mesh );
  274. override.addMesh( helper );
  275. return override;
  276. };
  277. callbacks.setCallbackOnMeshAlter( callbackMeshAlter );
  278. callbacks.setCallbackOnProgress( this._reportProgress );
  279. callbacks.setCallbackOnLoad( callbackOnLoad );
  280. var objLoader = new THREE.OBJLoader2();
  281. objLoader.run( prepData );
  282. };
  283. WWOBJLoader2Example.prototype.finalize = function () {
  284. this._reportProgress( '' );
  285. };
  286. WWOBJLoader2Example.prototype._reportProgress = function( content, modelName, instanceNo ) {
  287. console.log( 'Progress: ' + content );
  288. document.getElementById( 'feedback' ).innerHTML = Validator.isValid( content ) ? content : '';
  289. };
  290. WWOBJLoader2Example.prototype._handleFileSelect = function ( event, pathTexture ) {
  291. var fileObj = null;
  292. var fileMtl = null;
  293. var files = event.target.files;
  294. for ( var i = 0, file; file = files[ i ]; i++) {
  295. if ( file.name.indexOf( '\.obj' ) > 0 && fileObj === null ) {
  296. fileObj = file;
  297. }
  298. if ( file.name.indexOf( '\.mtl' ) > 0 && fileMtl === null ) {
  299. fileMtl = file;
  300. }
  301. }
  302. if ( ! Validator.isValid( fileObj ) ) {
  303. alert( 'Unable to load OBJ file from given files.' );
  304. }
  305. var scope = this;
  306. var callbackOnLoad = function ( loderRootNode, modelName, instanceNo ) {
  307. scope.scene.add( loderRootNode );
  308. console.log( 'Loading complete: ' + modelName );
  309. scope._reportProgress( '' );
  310. };
  311. var fileReader = new FileReader();
  312. fileReader.onload = function( fileDataObj ) {
  313. var uint8Array = new Uint8Array( fileDataObj.target.result );
  314. var prepData = new THREE.LoaderSupport.PrepData( 'userObj' );
  315. var resourceOBJ = new THREE.LoaderSupport.ResourceDescriptor( pathTexture + '/' + fileObj.name, 'OBJ' );
  316. var userPivot = new THREE.Object3D();
  317. userPivot.position.set(
  318. -100 + 200 * Math.random(),
  319. -100 + 200 * Math.random(),
  320. -100 + 200 * Math.random()
  321. );
  322. prepData.setStreamMeshesTo( userPivot );
  323. scope.pivot.add( prepData.streamMeshesTo );
  324. resourceOBJ.setContent( uint8Array );
  325. prepData.addResource( resourceOBJ );
  326. prepData.setUseAsync( true );
  327. var callbacks = prepData.getCallbacks();
  328. callbacks.setCallbackOnProgress( scope._reportProgress );
  329. callbacks.setCallbackOnLoad( callbackOnLoad );
  330. fileReader.onload = function( fileDataMtl ) {
  331. var resourceMTL = new THREE.LoaderSupport.ResourceDescriptor( pathTexture + '/' + fileMtl.name, 'MTL' );
  332. resourceMTL.setContent( fileDataMtl.target.result );
  333. prepData.addResource( resourceMTL );
  334. var objLoader = new THREE.OBJLoader2();
  335. objLoader.run( prepData );
  336. };
  337. fileReader.readAsText( fileMtl );
  338. };
  339. fileReader.readAsArrayBuffer( fileObj );
  340. };
  341. WWOBJLoader2Example.prototype.resizeDisplayGL = function () {
  342. this.controls.handleResize();
  343. this.recalcAspectRatio();
  344. this.renderer.setSize( this.canvas.offsetWidth, this.canvas.offsetHeight, false );
  345. this.updateCamera();
  346. };
  347. WWOBJLoader2Example.prototype.recalcAspectRatio = function () {
  348. this.aspectRatio = ( this.canvas.offsetHeight === 0 ) ? 1 : this.canvas.offsetWidth / this.canvas.offsetHeight;
  349. };
  350. WWOBJLoader2Example.prototype.resetCamera = function () {
  351. this.camera.position.copy( this.cameraDefaults.posCamera );
  352. this.cameraTarget.copy( this.cameraDefaults.posCameraTarget );
  353. this.updateCamera();
  354. };
  355. WWOBJLoader2Example.prototype.updateCamera = function () {
  356. this.camera.aspect = this.aspectRatio;
  357. this.camera.lookAt( this.cameraTarget );
  358. this.camera.updateProjectionMatrix();
  359. };
  360. WWOBJLoader2Example.prototype.render = function () {
  361. if ( ! this.renderer.autoClear ) this.renderer.clear();
  362. this.controls.update();
  363. this.cube.rotation.x += 0.05;
  364. this.cube.rotation.y += 0.05;
  365. this.renderer.render( this.scene, this.camera );
  366. };
  367. WWOBJLoader2Example.prototype.alterShading = function () {
  368. var scope = this;
  369. scope.flatShading = ! scope.flatShading;
  370. console.log( scope.flatShading ? 'Enabling flat shading' : 'Enabling smooth shading');
  371. scope.traversalFunction = function ( material ) {
  372. material.flatShading = scope.flatShading;
  373. material.needsUpdate = true;
  374. };
  375. var scopeTraverse = function ( object3d ) {
  376. scope.traverseScene( object3d );
  377. };
  378. scope.pivot.traverse( scopeTraverse );
  379. };
  380. WWOBJLoader2Example.prototype.alterDouble = function () {
  381. var scope = this;
  382. scope.doubleSide = ! scope.doubleSide;
  383. console.log( scope.doubleSide ? 'Enabling DoubleSide materials' : 'Enabling FrontSide materials');
  384. scope.traversalFunction = function ( material ) {
  385. material.side = scope.doubleSide ? THREE.DoubleSide : THREE.FrontSide;
  386. };
  387. var scopeTraverse = function ( object3d ) {
  388. scope.traverseScene( object3d );
  389. };
  390. scope.pivot.traverse( scopeTraverse );
  391. };
  392. WWOBJLoader2Example.prototype.traverseScene = function ( object3d ) {
  393. if ( object3d.material instanceof THREE.MultiMaterial ) {
  394. var materials = object3d.material.materials;
  395. for ( var name in materials ) {
  396. if ( materials.hasOwnProperty( name ) ) this.traversalFunction( materials[ name ] );
  397. }
  398. } else if ( object3d.material ) {
  399. this.traversalFunction( object3d.material );
  400. }
  401. };
  402. WWOBJLoader2Example.prototype.clearAllAssests = function () {
  403. var scope = this;
  404. var remover = function ( object3d ) {
  405. if ( object3d === scope.pivot ) {
  406. return;
  407. }
  408. console.log( 'Removing: ' + object3d.name );
  409. scope.scene.remove( object3d );
  410. if ( object3d.hasOwnProperty( 'geometry' ) ) {
  411. object3d.geometry.dispose();
  412. }
  413. if ( object3d.hasOwnProperty( 'material' ) ) {
  414. var mat = object3d.material;
  415. if ( mat.hasOwnProperty( 'materials' ) ) {
  416. var materials = mat.materials;
  417. for ( var name in materials ) {
  418. if ( materials.hasOwnProperty( name ) ) materials[ name ].dispose();
  419. }
  420. }
  421. }
  422. if ( object3d.hasOwnProperty( 'texture' ) ) {
  423. object3d.texture.dispose();
  424. }
  425. };
  426. scope.scene.remove( scope.pivot );
  427. scope.pivot.traverse( remover );
  428. };
  429. return WWOBJLoader2Example;
  430. })();
  431. var app = new WWOBJLoader2Example( document.getElementById( 'example' ) );
  432. // Init dat.gui and controls
  433. var elemFileInput = document.getElementById( 'fileUploadInput' );
  434. var WWOBJLoader2Control = function() {
  435. this.flatShading = app.flatShading;
  436. this.doubleSide = app.doubleSide;
  437. this.streamMeshes = app.streamMeshes;
  438. };
  439. var wwObjLoader2Control = new WWOBJLoader2Control();
  440. var gui = new dat.GUI( {
  441. autoPlace: false,
  442. width: 320
  443. } );
  444. var menuDiv = document.getElementById( 'dat' );
  445. menuDiv.appendChild(gui.domElement);
  446. var folderOptions = gui.addFolder( 'WWOBJLoader2 Options' );
  447. var controlSmooth = folderOptions.add( wwObjLoader2Control, 'flatShading' ).name( 'Flat Shading' );
  448. controlSmooth.onChange( function( value ) {
  449. console.log( 'Setting flatShading to: ' + value );
  450. app.alterShading();
  451. });
  452. var controlDouble = folderOptions.add( wwObjLoader2Control, 'doubleSide' ).name( 'Double Side Materials' );
  453. controlDouble.onChange( function( value ) {
  454. console.log( 'Setting doubleSide to: ' + value );
  455. app.alterDouble();
  456. });
  457. var controlStreamMeshes = folderOptions.add( wwObjLoader2Control, 'streamMeshes' ).name( 'Stream Meshes' );
  458. controlStreamMeshes.onChange( function( value ) {
  459. console.log( 'Setting streamMeshes to: ' + value );
  460. app.streamMeshes = value;
  461. });
  462. if ( app.fileApiAvailable ) {
  463. wwObjLoader2Control.pathTexture = 'obj/female02/';
  464. var controlPathTexture = folderOptions.add( wwObjLoader2Control, 'pathTexture' ).name( 'Relative path to textures' );
  465. controlPathTexture.onChange( function( value ) {
  466. console.log( 'Setting pathTexture to: ' + value );
  467. app.pathTexture = value + '/';
  468. });
  469. wwObjLoader2Control.loadObjFile = function () {
  470. elemFileInput.click();
  471. };
  472. folderOptions.add( wwObjLoader2Control, 'loadObjFile' ).name( 'Load OBJ/MTL Files' );
  473. var handleFileSelect = function ( object3d ) {
  474. app._handleFileSelect( object3d, wwObjLoader2Control.pathTexture );
  475. };
  476. elemFileInput.addEventListener( 'change' , handleFileSelect, false );
  477. wwObjLoader2Control.clearAllAssests = function () {
  478. app.clearAllAssests();
  479. };
  480. folderOptions.add( wwObjLoader2Control, 'clearAllAssests' ).name( 'Clear Scene' );
  481. }
  482. folderOptions.open();
  483. // init three.js example application
  484. var resizeWindow = function () {
  485. app.resizeDisplayGL();
  486. };
  487. var render = function () {
  488. requestAnimationFrame( render );
  489. app.render();
  490. };
  491. window.addEventListener( 'resize', resizeWindow, false );
  492. console.log( 'Starting initialisation phase...' );
  493. app.initGL();
  494. app.resizeDisplayGL();
  495. // kick render loop
  496. render();
  497. // Load a file with OBJLoader.parse synchronously
  498. app.useParseSync();
  499. // Load a file with OBJLoader.parseAsync asynchronously using a worker
  500. app.useParseAsync();
  501. // Load a file with OBJLoader.load synchronously
  502. app.useLoadSync();
  503. // Load a file with OBJLoader.load asynchronously
  504. app.useLoadAsync();
  505. // Load a file with OBJLoader.run synchronously
  506. app.useRunSync();
  507. // Load a file with OBJLoader.run asynchronously and add normals during onMeshAlter
  508. app.useRunAsyncMeshAlter();
  509. app.finalize();
  510. </script>
  511. </body>
  512. </html>