Bladeren bron

Merge pull request #21014 from mrdoob/objloader2

Removed OBJLoader2 and OBJLoader2Parallel
Mr.doob 4 jaren geleden
bovenliggende
commit
4a8b1fa614
33 gewijzigde bestanden met toevoegingen van 0 en 5984 verwijderingen
  1. 0 206
      docs/examples/en/loaders/OBJLoader2.html
  2. 0 110
      docs/examples/en/loaders/OBJLoader2Parallel.html
  3. 0 206
      docs/examples/zh/loaders/OBJLoader2.html
  4. 0 110
      docs/examples/zh/loaders/OBJLoader2Parallel.html
  5. 0 4
      docs/list.json
  6. 0 2
      examples/files.json
  7. 0 46
      examples/jsm/loaders/OBJLoader2.d.ts
  8. 0 389
      examples/jsm/loaders/OBJLoader2.js
  9. 0 23
      examples/jsm/loaders/OBJLoader2Parallel.d.ts
  10. 0 232
      examples/jsm/loaders/OBJLoader2Parallel.js
  11. 0 74
      examples/jsm/loaders/obj2/OBJLoader2Parser.d.ts
  12. 0 1123
      examples/jsm/loaders/obj2/OBJLoader2Parser.js
  13. 0 8
      examples/jsm/loaders/obj2/bridge/MtlObjBridge.d.ts
  14. 0 46
      examples/jsm/loaders/obj2/bridge/MtlObjBridge.js
  15. 0 26
      examples/jsm/loaders/obj2/shared/MaterialHandler.d.ts
  16. 0 276
      examples/jsm/loaders/obj2/shared/MaterialHandler.js
  17. 0 23
      examples/jsm/loaders/obj2/shared/MeshReceiver.d.ts
  18. 0 313
      examples/jsm/loaders/obj2/shared/MeshReceiver.js
  19. 0 22
      examples/jsm/loaders/obj2/utils/CodeSerializer.d.ts
  20. 0 264
      examples/jsm/loaders/obj2/utils/CodeSerializer.js
  21. 0 63
      examples/jsm/loaders/obj2/worker/main/WorkerExecutionSupport.d.ts
  22. 0 584
      examples/jsm/loaders/obj2/worker/main/WorkerExecutionSupport.js
  23. 0 12
      examples/jsm/loaders/obj2/worker/parallel/OBJLoader2JsmWorker.js
  24. 0 29
      examples/jsm/loaders/obj2/worker/parallel/WorkerRunner.d.ts
  25. 0 165
      examples/jsm/loaders/obj2/worker/parallel/WorkerRunner.js
  26. 0 281
      examples/models/obj/verify/gulpfile.js
  27. 0 242
      examples/models/obj/verify/verify.html
  28. 0 42
      examples/models/obj/verify/verify.mtl
  29. 0 215
      examples/models/obj/verify/verify.obj
  30. BIN
      examples/screenshots/webgl_loader_obj2.jpg
  31. BIN
      examples/screenshots/webgl_loader_obj2_options.jpg
  32. 0 234
      examples/webgl_loader_obj2.html
  33. 0 614
      examples/webgl_loader_obj2_options.html

+ 0 - 206
docs/examples/en/loaders/OBJLoader2.html

@@ -1,206 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-	<head>
-		<meta charset="utf-8" />
-		<base href="../../../" />
-		<script src="page.js"></script>
-		<link type="text/css" rel="stylesheet" href="page.css" />
-	</head>
-	<body>
-
-		<h1>[name]</h1>
-
-		<p class="desc">A loader for loading a <em>.obj</em> resource.<br />
-			The <a href="https://en.wikipedia.org/wiki/Wavefront_.obj_file">OBJ file format</a> is a simple data-format
-			that represents 3D geometry in a human readable format as, the position of each vertex, the UV position of
-			each texture coordinate vertex, vertex normals, and the faces that make each polygon defined as a list of
-			vertices, and texture vertices.
-		</p>
-
-		<h2>Code Example</h2>
-
-		<code>
-		// instantiate the loader
-		let loader = new OBJLoader2();
-
-		// function called on successful load
-		function callbackOnLoad ( object3d ) {
-			scene.add( object3d );
-		}
-
-		// load a resource from provided URL synchronously
-		loader.load( 'obj/female02/female02.obj', callbackOnLoad, null, null, null );
-		</code>
-
-		<h2>Examples</h2>
-		<p>
-			[example:webgl_loader_obj2] - Simple example<br />
-			[example:webgl_loader_obj2_options] - Example for multiple use-cases (parse and load, sync or in parallel to main (see [page:OBJLoader2Parallel]))
-		</p>
-
-		<h2>Constructor</h2>
-
-		<h3>[name]( [param:LoadingManager manager] )</h3>
-		<p>
-			[page:LoadingManager manager] - The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].<br>
-		</p>
-		<p>
-			Creates a new [name]. Use it to load OBJ data from files or to parse OBJ data from arraybuffer or text.
-		</p>
-
-
-		<h2>Properties</h2>
-		<p>See the base [page:Loader] class for common properties.</p>
-
-
-		<h2>Methods</h2>
-		<p>See the base [page:Loader] class for common methods.</p>
-
-
-		<h3>[method:Object3D parse]( [param:Arraybuffer content]|[param:String content] )</h3>
-		<p>
-			[[page:Arraybuffer content]|[page:String content]] OBJ data as Uint8Array or String
-		</p>
-		<p>
-			Parses OBJ data synchronously from arraybuffer or string and returns the [page:Object3D baseObject3d].
-		</p>
-
-
-		<h3>[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError], [param:Function onMeshAlter] )</h3>
-		<p>
-			[page:String url] - A string containing the path/URL of the file to be loaded.<br>
-			[page:Function onLoad] - A function to be called after loading is successfully completed. The function receives loaded [page:Object3D] as an argument.<br>
-			[page:Function onProgress] - (optional) A function to be called while the loading is in progress. The argument will be the XMLHttpRequest instance, which contains [page:Integer total] and [page:Integer loaded] bytes.<br>
-			[page:Function onError] - (optional) A function to be called if an error occurs during loading. The function receives the error as an argument.<br>
-			[page:Function onMeshAlter] - (optional) A function to be called after a new mesh raw data becomes available for alteration.<br>
-		</p>
-		<p>
-			Use this convenient method to load a file at the given URL. By default the fileLoader uses an ArrayBuffer.
-		</p>
-
-
-		<h3>[method:OBJLoader2 setLogging]( [param:Boolean enabled], [param:Boolean debug] )</h3>
-		<p>
-			[page:Boolean enabled] True or false.<br>
-			[page:Boolean debug] True or false.
-		</p>
-		<p>
-			Enable or disable logging in general (except warn and error), plus enable or disable debug logging.
-		</p>
-
-
-		<h3>[method:OBJLoader2 addMaterialPerSmoothingGroup] ( [param:Boolean materialPerSmoothingGroup] )</h3>
-		<p>
-			[page:Boolean materialPerSmoothingGroup]
-		</p>
-		<p>
-			Tells whether a material shall be created per smoothing group.
-		</p>
-
-
-		<h3>[method:OBJLoader2 setUseOAsMesh] ( [param:Boolean useOAsMesh] )</h3>
-		<p>
-			[page:Boolean useOAsMesh]
-		</p>
-		<p>
-			Usually 'o' is meta-information and does not result in creation of new meshes, but mesh creation on occurrence of "o" can be enforced.
-		</p>
-
-
-		<h3>[method:OBJLoader2 setUseIndices]( [param:Boolean useIndices] )</h3>
-		<p>
-			[page:Boolean useIndices]
-		</p>
-		<p>
-			Instructs loaders to create indexed [page:BufferGeometry].
-		</p>
-
-
-		<h3>[method:OBJLoader2 setDisregardNormals]( [param:Boolean disregardNormals] )</h3>
-		<p>
-			[page:Boolean disregardNormals]
-		</p>
-		<p>
-			Tells whether normals should be completely disregarded and regenerated.
-		</p>
-
-
-		<h3>[method:OBJLoader2 setModelName] ( [param:String modelName] )</h3>
-		<p>
-			[page:String modelName]
-		</p>
-		<p>
-			Set the name of the model.
-		</p>
-
-
-		<h3>[method:OBJLoader2 setBaseObject3d] ( [param:Object3d baseObject3d] )</h3>
-		<p>
-			[page:Object3D baseObject3d - Object already attached to scenegraph where new meshes will be attached to
-		</p>
-		<p>
-			Set the node where the loaded objects will be attached directly.
-		</p>
-
-
-		<h3>[method:OBJLoader2 setMaterials] ( [param:Object materials] )</h3>
-		<p>
-			[page:Object materials] -  materials Object with named [page:Material Materials]
-		</p>
-		<p>
-			Add materials as associated array.
-		</p>
-
-
-		<h3>[method:OBJLoader2 setCallbackOnLoad] ( [param:Function onLoad] )</h3>
-		<p>
-			[page:Function onLoad]
-		</p>
-		<p>
-			Register a function that is called when parsing was completed.
-		</p>
-
-
-		<h3>[method:OBJLoader2 setCallbackOnAssetAvailable] ( [param:Function onAssetAvailable] )</h3>
-		<p>
-			[page:Function onAssetAvailable]
-		</p>
-		<p>
-			Register a function that is called once an asset (mesh/material) becomes available.
-		</p>
-
-
-		<h3>[method:OBJLoader2 setCallbackOnProgress] ( [param:Function onProgress] )</h3>
-		<p>
-			[page:Function onProgress]
-		</p>
-		<p>
-			Register a function that is used to report overall processing progress.
-		</p>
-
-
-		<h3>[method:OBJLoader2 setCallbackOnError] ( [param:Function onError] )</h3>
-		<p>
-			[page:Function onError]
-		</p>
-		<p>
-			Register an error handler function that is called if errors occur. It can decide to just log or to throw an exception.
-		</p>
-
-
-		<h3>[method:OBJLoader2 setCallbackOnMeshAlter] ( [param:Function onMeshAlter] )</h3>
-		<p>
-			[page:Function onMeshAlter]
-		</p>
-		<p>
-			Register a function that is called once a single mesh is available and it could be altered by the supplied function.
-		</p>
-
-
-		<h2>Source</h2>
-
-		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/OBJLoader2.js examples/jsm/loaders/OBJLoader2.js]
-		</p>
-	</body>
-</html>

+ 0 - 110
docs/examples/en/loaders/OBJLoader2Parallel.html

@@ -1,110 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-	<head>
-		<meta charset="utf-8" />
-		<base href="../../../" />
-		<script src="page.js"></script>
-		<link type="text/css" rel="stylesheet" href="page.css" />
-	</head>
-	<body>
-
-		<h1>[name]</h1>
-
-		<p class="desc">A loader for loading a <em>.obj</em> resource.<br />
-			The <a href="https://en.wikipedia.org/wiki/Wavefront_.obj_file">OBJ file format</a> is a simple data-format
-			that represents 3D geometry in a human readable format as, the position of each vertex, the UV position of
-			each texture coordinate vertex, vertex normals, and the faces that make each polygon defined as a list of
-			vertices, and texture vertices.
-		</p>
-
-		<h2>Code Example</h2>
-
-		<code>
-		// instantiate the loader
-		let objLoader2Parallel = new OBJLoader2Parallel();
-
-		// define where to attach the data
-		let local = new THREE.Object3D();
-
-		// function called on successful completion of parsing
-		function callbackOnLoad( object3d, message ) {
-			local.add( object3d );
-		}
-
-		// load a resource from provided URL in parallel to Main
-		objLoader2Parallel.load( 'models/obj/walt/WaltHead.obj', callbackOnLoad, null, null, null );
-		</code>
-
-		<h2>Examples</h2>
-		<p>
-		[example:webgl_loader_obj2_options] - Example for multiple use-cases (parse and load, sync (see [page:OBJLoader2]) or in parallel to main)
-		</p>
-
-		<h2>Constructor</h2>
-
-		<h3>[name]( [param:LoadingManager manager] )</h3>
-		<p>
-			[page:LoadingManager manager] - The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].<br>
-		</p>
-		<p>
-			Creates a new [name]. Use it to load OBJ data from files or to parse OBJ data from arraybuffer.
-			It extends [page:OBJLoader2]  with the capability to run the parser in a web worker.
-		</p>
-
-
-		<h2>Properties</h2>
-		<p>See the base [page:OBJLoader2] class for common properties.</p>
-
-
-		<h2>Methods</h2>
-		<p>See the base [page:OBJLoader2] class for common methods. </p>
-
-
-		<h3>[method:Object3D parse]</h3>
-		<p>See [page:OBJLoader2.parse].<br>
-			The callback [page:OBJLoader2.setCallbackOnLoad OBJLoader2.onLoad] needs to be set to be able to receive the content if used in parallel mode.
-			Fallback is possible via [page:OBJLoader2Parallel.setExecuteParallel].
-		</p>
-
-
-		<h3>[method:null load]</h3>
-		<p>See [page:OBJLoader2.load].</p>
-
-
-		<h3>[method:OBJLoader2Parallel setExecuteParallel] ( [param:Boolean executeParallel] )</h3>
-		<p>
-			[page:Boolean executeParallel] - True or False
-		</p>
-		<p>
-			Execution of parse in parallel via Worker is default, but synchronous [page:OBJLoader2] parsing can be enforced via false here.
-		</p>
-
-
-		<h3>[method:OBJLoader2Parallel setPreferJsmWorker] ( [param:Boolean preferJsmWorker] )</h3>
-		<p>
-			[page:Boolean preferJsmWorker] - True or False
-		</p>
-		<p>
-			Set whether jsm modules in workers should be used. This requires browser support which is currently only experimental.
-		</p>
-
-
-		<h3>[method:WorkerExecutionSupport getWorkerExecutionSupport] ()</h3>
-		<p>
-			Allow to get hold of [page:WorkerExecutionSupport] for configuration purposes.
-		</p>
-
-
-		<h3>[method:CodeBuilderInstructions buildWorkerCode] ()</h3>
-		<p>
-			Provide instructions on what is to be contained in the worker.
-		</p>
-
-
-		<h2>Source</h2>
-
-		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/OBJLoader2Parallel.js examples/jsm/loaders/OBJLoader2Parallel.js]
-		</p>
-	</body>
-</html>

+ 0 - 206
docs/examples/zh/loaders/OBJLoader2.html

@@ -1,206 +0,0 @@
-<!DOCTYPE html>
-<html lang="zh">
-	<head>
-		<meta charset="utf-8" />
-		<base href="../../../" />
-		<script src="page.js"></script>
-		<link type="text/css" rel="stylesheet" href="page.css" />
-	</head>
-	<body>
-
-		<h1>[name]</h1>
-
-		<p class="desc">A loader for loading a <em>.obj</em> resource.<br />
-			The <a href="https://en.wikipedia.org/wiki/Wavefront_.obj_file">OBJ file format</a> is a simple data-format
-			that represents 3D geometry in a human readable format as, the position of each vertex, the UV position of
-			each texture coordinate vertex, vertex normals, and the faces that make each polygon defined as a list of
-			vertices, and texture vertices.
-		</p>
-
-		<h2>代码示例</h2>
-
-		<code>
-		// instantiate the loader
-		let loader = new OBJLoader2();
-
-		// function called on successful load
-		function callbackOnLoad ( object3d ) {
-			scene.add( object3d );
-		}
-
-		// load a resource from provided URL synchronously
-		loader.load( 'obj/female02/female02.obj', callbackOnLoad, null, null, null );
-		</code>
-
-		<h2>例子</h2>
-		<p>
-			[example:webgl_loader_obj2] - Simple example<br />
-			[example:webgl_loader_obj2_options] - Example for multiple use-cases (parse and load, sync or in parallel to main (see [page:OBJLoader2Parallel]))
-		</p>
-
-		<h2>Constructor</h2>
-
-		<h3>[name]( [param:LoadingManager manager] )</h3>
-		<p>
-			[page:LoadingManager manager] - The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].<br>
-		</p>
-		<p>
-			Creates a new [name]. Use it to load OBJ data from files or to parse OBJ data from arraybuffer or text.
-		</p>
-
-
-		<h2>Properties</h2>
-		<p>See the base [page:Loader] class for common properties.</p>
-
-
-		<h2>Methods</h2>
-		<p>See the base [page:Loader] class for common methods.</p>
-
-
-		<h3>[method:Object3D parse]( [param:Arraybuffer content]|[param:String content] )</h3>
-		<p>
-			[[page:Arraybuffer content]|[page:String content]] OBJ data as Uint8Array or String
-		</p>
-		<p>
-			Parses OBJ data synchronously from arraybuffer or string and returns the [page:Object3D baseObject3d].
-		</p>
-
-
-		<h3>[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError], [param:Function onMeshAlter] )</h3>
-		<p>
-			[page:String url] - A string containing the path/URL of the file to be loaded.<br>
-			[page:Function onLoad] - A function to be called after loading is successfully completed. The function receives loaded [page:Object3D] as an argument.<br>
-			[page:Function onProgress] - (optional) A function to be called while the loading is in progress. The argument will be the XMLHttpRequest instance, which contains [page:Integer total] and [page:Integer loaded] bytes.<br>
-			[page:Function onError] - (optional) A function to be called if an error occurs during loading. The function receives the error as an argument.<br>
-			[page:Function onMeshAlter] - (optional) A function to be called after a new mesh raw data becomes available for alteration.<br>
-		</p>
-		<p>
-			Use this convenient method to load a file at the given URL. By default the fileLoader uses an ArrayBuffer.
-		</p>
-
-
-		<h3>[method:OBJLoader2 setLogging]( [param:Boolean enabled], [param:Boolean debug] )</h3>
-		<p>
-			[page:Boolean enabled] True or false.<br>
-			[page:Boolean debug] True or false.
-		</p>
-		<p>
-			Enable or disable logging in general (except warn and error), plus enable or disable debug logging.
-		</p>
-
-
-		<h3>[method:OBJLoader2 addMaterialPerSmoothingGroup] ( [param:Boolean materialPerSmoothingGroup] )</h3>
-		<p>
-			[page:Boolean materialPerSmoothingGroup]
-		</p>
-		<p>
-			Tells whether a material shall be created per smoothing group.
-		</p>
-
-
-		<h3>[method:OBJLoader2 setUseOAsMesh] ( [param:Boolean useOAsMesh] )</h3>
-		<p>
-			[page:Boolean useOAsMesh]
-		</p>
-		<p>
-			Usually 'o' is meta-information and does not result in creation of new meshes, but mesh creation on occurrence of "o" can be enforced.
-		</p>
-
-
-		<h3>[method:OBJLoader2 setUseIndices]( [param:Boolean useIndices] )</h3>
-		<p>
-			[page:Boolean useIndices]
-		</p>
-		<p>
-			Instructs loaders to create indexed [page:BufferGeometry].
-		</p>
-
-
-		<h3>[method:OBJLoader2 setDisregardNormals]( [param:Boolean disregardNormals] )</h3>
-		<p>
-			[page:Boolean disregardNormals]
-		</p>
-		<p>
-			Tells whether normals should be completely disregarded and regenerated.
-		</p>
-
-
-		<h3>[method:OBJLoader2 setModelName] ( [param:String modelName] )</h3>
-		<p>
-			[page:String modelName]
-		</p>
-		<p>
-			Set the name of the model.
-		</p>
-
-
-		<h3>[method:OBJLoader2 setBaseObject3d] ( [param:Object3d baseObject3d] )</h3>
-		<p>
-			[page:Object3D baseObject3d - Object already attached to scenegraph where new meshes will be attached to
-		</p>
-		<p>
-			Set the node where the loaded objects will be attached directly.
-		</p>
-
-
-		<h3>[method:OBJLoader2 setMaterials] ( [param:Object materials] )</h3>
-		<p>
-			[page:Object materials] -  materials Object with named [page:Material Materials]
-		</p>
-		<p>
-			Add materials as associated array.
-		</p>
-
-
-		<h3>[method:OBJLoader2 setCallbackOnLoad] ( [param:Function onLoad] )</h3>
-		<p>
-			[page:Function onLoad]
-		</p>
-		<p>
-			Register a function that is called when parsing was completed.
-		</p>
-
-
-		<h3>[method:OBJLoader2 setCallbackOnAssetAvailable] ( [param:Function onAssetAvailable] )</h3>
-		<p>
-			[page:Function onAssetAvailable]
-		</p>
-		<p>
-			Register a function that is called once an asset (mesh/material) becomes available.
-		</p>
-
-
-		<h3>[method:OBJLoader2 setCallbackOnProgress] ( [param:Function onProgress] )</h3>
-		<p>
-			[page:Function onProgress]
-		</p>
-		<p>
-			Register a function that is used to report overall processing progress.
-		</p>
-
-
-		<h3>[method:OBJLoader2 setCallbackOnError] ( [param:Function onError] )</h3>
-		<p>
-			[page:Function onError]
-		</p>
-		<p>
-			Register an error handler function that is called if errors occur. It can decide to just log or to throw an exception.
-		</p>
-
-
-		<h3>[method:OBJLoader2 setCallbackOnMeshAlter] ( [param:Function onMeshAlter] )</h3>
-		<p>
-			[page:Function onMeshAlter]
-		</p>
-		<p>
-			Register a function that is called once a single mesh is available and it could be altered by the supplied function.
-		</p>
-
-
-		<h2>Source</h2>
-
-		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/OBJLoader2.js examples/jsm/loaders/OBJLoader2.js]
-		</p>
-	</body>
-</html>

+ 0 - 110
docs/examples/zh/loaders/OBJLoader2Parallel.html

@@ -1,110 +0,0 @@
-<!DOCTYPE html>
-<html lang="zh">
-	<head>
-		<meta charset="utf-8" />
-		<base href="../../../" />
-		<script src="page.js"></script>
-		<link type="text/css" rel="stylesheet" href="page.css" />
-	</head>
-	<body>
-
-		<h1>[name]</h1>
-
-		<p class="desc">A loader for loading a <em>.obj</em> resource.<br />
-			The <a href="https://en.wikipedia.org/wiki/Wavefront_.obj_file">OBJ file format</a> is a simple data-format
-			that represents 3D geometry in a human readable format as, the position of each vertex, the UV position of
-			each texture coordinate vertex, vertex normals, and the faces that make each polygon defined as a list of
-			vertices, and texture vertices.
-		</p>
-
-		<h2>代码示例</h2>
-
-		<code>
-		// instantiate the loader
-		let objLoader2Parallel = new OBJLoader2Parallel();
-
-		// define where to attach the data
-		let local = new THREE.Object3D();
-
-		// function called on successful completion of parsing
-		function callbackOnLoad( object3d, message ) {
-			local.add( object3d );
-		}
-
-		// load a resource from provided URL in parallel to Main
-		objLoader2Parallel.load( 'models/obj/walt/WaltHead.obj', callbackOnLoad, null, null, null );
-		</code>
-
-		<h2>例子</h2>
-		<p>
-		[example:webgl_loader_obj2_options] - Example for multiple use-cases (parse and load, sync (see [page:OBJLoader2]) or in parallel to main)
-		</p>
-
-		<h2>Constructor</h2>
-
-		<h3>[name]( [param:LoadingManager manager] )</h3>
-		<p>
-			[page:LoadingManager manager] - The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].<br>
-		</p>
-		<p>
-			Creates a new [name]. Use it to load OBJ data from files or to parse OBJ data from arraybuffer.
-			It extends [page:OBJLoader2]  with the capability to run the parser in a web worker.
-		</p>
-
-
-		<h2>Properties</h2>
-		<p>See the base [page:OBJLoader2] class for common properties.</p>
-
-
-		<h2>Methods</h2>
-		<p>See the base [page:OBJLoader2] class for common methods. </p>
-
-
-		<h3>[method:Object3D parse]</h3>
-		<p>See [page:OBJLoader2.parse].<br>
-			The callback [page:OBJLoader2.setCallbackOnLoad OBJLoader2.onLoad] needs to be set to be able to receive the content if used in parallel mode.
-			Fallback is possible via [page:OBJLoader2Parallel.setExecuteParallel].
-		</p>
-
-
-		<h3>[method:null load]</h3>
-		<p>See [page:OBJLoader2.load].</p>
-
-
-		<h3>[method:OBJLoader2Parallel setExecuteParallel] ( [param:Boolean executeParallel] )</h3>
-		<p>
-			[page:Boolean executeParallel] - True or False
-		</p>
-		<p>
-			Execution of parse in parallel via Worker is default, but synchronous [page:OBJLoader2] parsing can be enforced via false here.
-		</p>
-
-
-		<h3>[method:OBJLoader2Parallel setPreferJsmWorker] ( [param:Boolean preferJsmWorker] )</h3>
-		<p>
-			[page:Boolean preferJsmWorker] - True or False
-		</p>
-		<p>
-			Set whether jsm modules in workers should be used. This requires browser support which is currently only experimental.
-		</p>
-
-
-		<h3>[method:WorkerExecutionSupport getWorkerExecutionSupport] ()</h3>
-		<p>
-			Allow to get hold of [page:WorkerExecutionSupport] for configuration purposes.
-		</p>
-
-
-		<h3>[method:CodeBuilderInstructions buildWorkerCode] ()</h3>
-		<p>
-			Provide instructions on what is to be contained in the worker.
-		</p>
-
-
-		<h2>Source</h2>
-
-		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/OBJLoader2Parallel.js examples/jsm/loaders/OBJLoader2Parallel.js]
-		</p>
-	</body>
-</html>

+ 0 - 4
docs/list.json

@@ -397,8 +397,6 @@
 				"MMDLoader": "examples/en/loaders/MMDLoader",
 				"MTLLoader": "examples/en/loaders/MTLLoader",
 				"OBJLoader": "examples/en/loaders/OBJLoader",
-				"OBJLoader2": "examples/en/loaders/OBJLoader2",
-				"OBJLoader2Parallel": "examples/en/loaders/OBJLoader2Parallel",
 				"PCDLoader": "examples/en/loaders/PCDLoader",
 				"PDBLoader": "examples/en/loaders/PDBLoader",
 				"PRWMLoader": "examples/en/loaders/PRWMLoader",
@@ -933,8 +931,6 @@
 				"MMDLoader": "examples/zh/loaders/MMDLoader",
 				"MTLLoader": "examples/zh/loaders/MTLLoader",
 				"OBJLoader": "examples/zh/loaders/OBJLoader",
-				"OBJLoader2": "examples/zh/loaders/OBJLoader2",
-				"OBJLoader2Parallel": "examples/zh/loaders/OBJLoader2Parallel",
 				"PCDLoader": "examples/zh/loaders/PCDLoader",
 				"PDBLoader": "examples/zh/loaders/PDBLoader",
 				"PRWMLoader": "examples/zh/loaders/PRWMLoader",

+ 0 - 2
examples/files.json

@@ -106,8 +106,6 @@
 		"webgl_loader_nrrd",
 		"webgl_loader_obj",
 		"webgl_loader_obj_mtl",
-		"webgl_loader_obj2",
-		"webgl_loader_obj2_options",
 		"webgl_loader_pcd",
 		"webgl_loader_pdb",
 		"webgl_loader_ply",

+ 0 - 46
examples/jsm/loaders/OBJLoader2.d.ts

@@ -1,46 +0,0 @@
-import {
-	Loader,
-	LoadingManager,
-	Object3D,
-} from '../../../src/Three';
-
-import { OBJLoader2Parser } from './obj2/OBJLoader2Parser';
-import { MaterialHandler } from './obj2/shared/MaterialHandler';
-import { MeshReceiver } from './obj2/shared/MeshReceiver';
-
-export class OBJLoader2 extends Loader {
-
-	constructor( manager?: LoadingManager );
-	parser: OBJLoader2Parser;
-	modelName: string;
-	instanceNo: number;
-	path: string;
-	resourcePath: string;
-	baseObject3d: Object3D;
-	materialHandler: MaterialHandler;
-	meshReceiver: MeshReceiver;
-
-	setLogging( enabled: boolean, debug: boolean ): this;
-	setMaterialPerSmoothingGroup( materialPerSmoothingGroup: boolean ): this;
-	setUseOAsMesh( useOAsMesh: boolean ): this;
-	setUseIndices( useIndices: boolean ): this;
-	setDisregardNormals( disregardNormals: boolean ): this;
-
-	setModelName( modelName: string ): this;
-	setPath( path: string ): this;
-	setResourcePath( path: string ): this;
-	setBaseObject3d( baseObject3d: Object3D ): this;
-	addMaterials( materials: object, overrideExisting: boolean ): this;
-
-	setCallbackOnAssetAvailable( onAssetAvailable: Function ): this;
-	setCallbackOnProgress( onProgress: Function ): this;
-	setCallbackOnError( onError: Function ): this;
-	setCallbackOnLoad( onLoad: Function ): this;
-	setCallbackOnMeshAlter( onMeshAlter: Function ): this;
-	setCallbackOnLoadMaterials( onLoadMaterials: Function ): this;
-
-	load( url: string, onLoad: ( object3d: Object3D ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void, onMeshAlter?: ( meshData: object ) => void ): void;
-	loadAsync( url: string, onProgress?: ( event: ProgressEvent ) => void ): Promise<Object3D>;
-	parse( content: ArrayBuffer | string ): Object3D;
-
-}

+ 0 - 389
examples/jsm/loaders/OBJLoader2.js

@@ -1,389 +0,0 @@
-/**
- * Development repository: https://github.com/kaisalmen/WWOBJLoader
- */
-
-import {
-	FileLoader,
-	Object3D,
-	Loader
-} from '../../../build/three.module.js';
-
-import { OBJLoader2Parser } from './obj2/OBJLoader2Parser.js';
-import { MeshReceiver } from './obj2/shared/MeshReceiver.js';
-import { MaterialHandler } from './obj2/shared/MaterialHandler.js';
-
-/**
- * Creates a new OBJLoader2. Use it to load OBJ data from files or to parse OBJ data from arraybuffer or text.
- *
- * @param {LoadingManager} [manager] The loadingManager for the loader to use. Default is {@link LoadingManager}
- * @constructor
- */
-const OBJLoader2 = function ( manager ) {
-
-	Loader.call( this, manager );
-
-	this.parser = new OBJLoader2Parser();
-
-	this.modelName = '';
-	this.instanceNo = 0;
-	this.baseObject3d = new Object3D();
-
-	this.materialHandler = new MaterialHandler();
-	this.meshReceiver = new MeshReceiver( this.materialHandler );
-
-	// as OBJLoader2 is no longer derived from OBJLoader2Parser, we need to override the default onAssetAvailable callback
-	const scope = this;
-	const defaultOnAssetAvailable = function ( payload ) {
-
-		scope._onAssetAvailable( payload );
-
-	};
-
-	this.parser.setCallbackOnAssetAvailable( defaultOnAssetAvailable );
-
-};
-
-OBJLoader2.OBJLOADER2_VERSION = '3.2.0';
-console.info( 'Using OBJLoader2 version: ' + OBJLoader2.OBJLOADER2_VERSION );
-
-
-OBJLoader2.prototype = Object.assign( Object.create( Loader.prototype ), {
-
-	constructor: OBJLoader2,
-
-	/**
-	 * See {@link OBJLoader2Parser.setLogging}
-	 * @return {OBJLoader2}
-	 */
-	setLogging: function ( enabled, debug ) {
-
-		this.parser.setLogging( enabled, debug );
-		return this;
-
-	},
-
-	/**
-	 * See {@link OBJLoader2Parser.setMaterialPerSmoothingGroup}
-	 * @return {OBJLoader2}
-	 */
-	setMaterialPerSmoothingGroup: function ( materialPerSmoothingGroup ) {
-
-		this.parser.setMaterialPerSmoothingGroup( materialPerSmoothingGroup );
-		return this;
-
-	},
-
-	/**
-	 * See {@link OBJLoader2Parser.setUseOAsMesh}
-	 * @return {OBJLoader2}
-	 */
-	setUseOAsMesh: function ( useOAsMesh ) {
-
-		this.parser.setUseOAsMesh( useOAsMesh );
-		return this;
-
-	},
-
-	/**
-	 * See {@link OBJLoader2Parser.setUseIndices}
-	 * @return {OBJLoader2}
-	 */
-	setUseIndices: function ( useIndices ) {
-
-		this.parser.setUseIndices( useIndices );
-		return this;
-
-	},
-
-	/**
-	 * See {@link OBJLoader2Parser.setDisregardNormals}
-	 * @return {OBJLoader2}
-	 */
-	setDisregardNormals: function ( disregardNormals ) {
-
-		this.parser.setDisregardNormals( disregardNormals );
-		return this;
-
-	},
-
-	/**
-	 * Set the name of the model.
-	 *
-	 * @param {string} modelName
-	 * @return {OBJLoader2}
-	 */
-	setModelName: function ( modelName ) {
-
-		this.modelName = modelName ? modelName : this.modelName;
-		return this;
-
-	},
-
-	/**
-	 * Set the node where the loaded objects will be attached directly.
-	 *
-	 * @param {Object3D} baseObject3d Object already attached to scenegraph where new meshes will be attached to
-	 * @return {OBJLoader2}
-	 */
-	setBaseObject3d: function ( baseObject3d ) {
-
-		this.baseObject3d = ( baseObject3d === undefined || baseObject3d === null ) ? this.baseObject3d : baseObject3d;
-		return this;
-
-	},
-
-	/**
-	 * Add materials as associated array.
-	 *
-	 * @param {Object} materials Object with named {@link Material}
-	 * @param overrideExisting boolean Override existing material
-	 * @return {OBJLoader2}
-	 */
-	addMaterials: function ( materials, overrideExisting ) {
-
-		this.materialHandler.addMaterials( materials, overrideExisting );
-		return this;
-
-	},
-
-	/**
-	 * See {@link OBJLoader2Parser.setCallbackOnAssetAvailable}
-	 * @return {OBJLoader2}
-	 */
-	setCallbackOnAssetAvailable: function ( onAssetAvailable ) {
-
-		this.parser.setCallbackOnAssetAvailable( onAssetAvailable );
-		return this;
-
-	},
-
-	/**
-	 * See {@link OBJLoader2Parser.setCallbackOnProgress}
-	 * @return {OBJLoader2}
-	 */
-	setCallbackOnProgress: function ( onProgress ) {
-
-		this.parser.setCallbackOnProgress( onProgress );
-		return this;
-
-	},
-
-	/**
-	 * See {@link OBJLoader2Parser.setCallbackOnError}
-	 * @return {OBJLoader2}
-	 */
-	setCallbackOnError: function ( onError ) {
-
-		this.parser.setCallbackOnError( onError );
-		return this;
-
-	},
-
-	/**
-	 * See {@link OBJLoader2Parser.setCallbackOnLoad}
-	 * @return {OBJLoader2}
-	 */
-	setCallbackOnLoad: function ( onLoad ) {
-
-		this.parser.setCallbackOnLoad( onLoad );
-		return this;
-
-	},
-
-	/**
-	 * Register a function that is called once a single mesh is available and it could be altered by the supplied function.
-	 *
-	 * @param {Function} [onMeshAlter]
-	 * @return {OBJLoader2}
-	 */
-	setCallbackOnMeshAlter: function ( onMeshAlter ) {
-
-		this.meshReceiver._setCallbacks( this.parser.callbacks.onProgress, onMeshAlter );
-		return this;
-
-	},
-
-	/**
-	 * Register a function that is called once all materials have been loaded and they could be altered by the supplied function.
-	 *
-	 * @param {Function} [onLoadMaterials]
-	 * @return {OBJLoader2}
-	 */
-	setCallbackOnLoadMaterials: function ( onLoadMaterials ) {
-
-		this.materialHandler._setCallbacks( onLoadMaterials );
-		return this;
-
-	},
-
-	/**
-	 * Use this convenient method to load a file at the given URL. By default the fileLoader uses an ArrayBuffer.
-	 *
-	 * @param {string}  url A string containing the path/URL of the file to be loaded.
-	 * @param {function} onLoad A function to be called after loading is successfully completed. The function receives loaded Object3D as an argument.
-	 * @param {function} [onFileLoadProgress] A function to be called while the loading is in progress. The argument will be the XMLHttpRequest instance, which contains total and Integer bytes.
-	 * @param {function} [onError] A function to be called if an error occurs during loading. The function receives the error as an argument.
-	 * @param {function} [onMeshAlter] Called after every single mesh is made available by the parser
-	 */
-	load: function ( url, onLoad, onFileLoadProgress, onError, onMeshAlter ) {
-
-		const scope = this;
-		if ( onLoad === null || onLoad === undefined || ! ( onLoad instanceof Function ) ) {
-
-			const errorMessage = 'onLoad is not a function! Aborting...';
-			scope.parser.callbacks.onError( errorMessage );
-			throw errorMessage;
-
-		} else {
-
-			this.parser.setCallbackOnLoad( onLoad );
-
-		}
-
-		if ( onError === null || onError === undefined || ! ( onError instanceof Function ) ) {
-
-			onError = function ( event ) {
-
-				let errorMessage = event;
-
-				if ( event.currentTarget && event.currentTarget.statusText !== null ) {
-
-					errorMessage = 'Error occurred while downloading!\nurl: ' + event.currentTarget.responseURL + '\nstatus: ' + event.currentTarget.statusText;
-
-				}
-
-				scope.parser.callbacks.onError( errorMessage );
-
-			};
-
-		}
-
-		if ( ! url ) {
-
-			onError( 'An invalid url was provided. Unable to continue!' );
-
-		}
-
-		const urlFull = new URL( url, window.location.href ).href;
-		let filename = urlFull;
-		const urlParts = urlFull.split( '/' );
-		if ( urlParts.length > 2 ) {
-
-			filename = urlParts[ urlParts.length - 1 ];
-			this.path = urlParts.slice( 0, urlParts.length - 1 ).join( '/' ) + '/';
-
-		}
-
-		if ( onFileLoadProgress === null || onFileLoadProgress === undefined || ! ( onFileLoadProgress instanceof Function ) ) {
-
-			let numericalValueRef = 0;
-			let numericalValue = 0;
-			onFileLoadProgress = function ( event ) {
-
-				if ( ! event.lengthComputable ) return;
-
-				numericalValue = event.loaded / event.total;
-
-				if ( numericalValue > numericalValueRef ) {
-
-					numericalValueRef = numericalValue;
-					const output = 'Download of "' + url + '": ' + ( numericalValue * 100 ).toFixed( 2 ) + '%';
-					scope.parser.callbacks.onProgress( 'progressLoad', output, numericalValue );
-
-				}
-
-			};
-
-		}
-
-		this.setCallbackOnMeshAlter( onMeshAlter );
-		const fileLoaderOnLoad = function ( content ) {
-
-			scope.parser.callbacks.onLoad( scope.parse( content ), 'OBJLoader2#load: Parsing completed' );
-
-		};
-
-		const fileLoader = new FileLoader( this.manager );
-		fileLoader.setPath( this.path || this.resourcePath );
-		fileLoader.setResponseType( 'arraybuffer' );
-		fileLoader.load( filename, fileLoaderOnLoad, onFileLoadProgress, onError );
-
-	},
-
-	/**
-	 * Parses OBJ data synchronously from arraybuffer or string and returns the {@link Object3D}.
-	 *
-	 * @param {arraybuffer|string} content OBJ data as Uint8Array or String
-	 * @return {Object3D}
-	 */
-	parse: function ( content ) {
-
-		// fast-fail in case of illegal data
-		if ( content === null || content === undefined ) {
-
-			throw 'Provided content is not a valid ArrayBuffer or String. Unable to continue parsing';
-
-		}
-
-		if ( this.parser.logging.enabled ) {
-
-			console.time( 'OBJLoader parse: ' + this.modelName );
-
-		}
-
-		// Create default materials beforehand, but do not override previously set materials (e.g. during init)
-		this.materialHandler.createDefaultMaterials( false );
-
-		// code works directly on the material references, parser clear its materials before updating
-		this.parser.setMaterials( this.materialHandler.getMaterials() );
-
-		if ( content instanceof ArrayBuffer || content instanceof Uint8Array ) {
-
-			if ( this.parser.logging.enabled ) console.info( 'Parsing arrayBuffer...' );
-			this.parser.execute( content );
-
-		} else if ( typeof ( content ) === 'string' || content instanceof String ) {
-
-			if ( this.parser.logging.enabled ) console.info( 'Parsing text...' );
-			this.parser.executeLegacy( content );
-
-		} else {
-
-			this.parser.callbacks.onError( 'Provided content was neither of type String nor Uint8Array! Aborting...' );
-
-		}
-
-		if ( this.parser.logging.enabled ) {
-
-			console.timeEnd( 'OBJLoader parse: ' + this.modelName );
-
-		}
-
-		return this.baseObject3d;
-
-	},
-
-	_onAssetAvailable: function ( payload ) {
-
-		if ( payload.cmd !== 'assetAvailable' ) return;
-
-		if ( payload.type === 'mesh' ) {
-
-			const meshes = this.meshReceiver.buildMeshes( payload );
-			for ( const mesh of meshes ) {
-
-				this.baseObject3d.add( mesh );
-
-			}
-
-		} else if ( payload.type === 'material' ) {
-
-			this.materialHandler.addPayloadMaterials( payload );
-
-		}
-
-	}
-
-} );
-
-export { OBJLoader2 };

+ 0 - 23
examples/jsm/loaders/OBJLoader2Parallel.d.ts

@@ -1,23 +0,0 @@
-import {
-	LoadingManager
-} from '../../../src/Three';
-import { OBJLoader2 } from './OBJLoader2';
-
-import { WorkerExecutionSupport } from './obj2/worker/main/WorkerExecutionSupport';
-
-export class OBJLoader2Parallel extends OBJLoader2 {
-
-	constructor( manager?: LoadingManager );
-	preferJsmWorker: boolean;
-	executeParallel: boolean;
-	workerExecutionSupport: WorkerExecutionSupport;
-
-	setJsmWorker( preferJsmWorker: boolean, jsmWorkerUrl: URL ): this;
-	setExecuteParallel( executeParallel: boolean ): this;
-	getWorkerExecutionSupport(): object;
-	buildWorkerCode(): object;
-
-	// @ts-ignore
-	parse( content: ArrayBuffer ): void;
-
-}

+ 0 - 232
examples/jsm/loaders/OBJLoader2Parallel.js

@@ -1,232 +0,0 @@
-/**
- * Development repository: https://github.com/kaisalmen/WWOBJLoader
- */
-
-// Imports only related to wrapper
-import {
-	Object3D
-} from '../../../build/three.module.js';
-import {
-	CodeBuilderInstructions,
-	WorkerExecutionSupport
-} from './obj2/worker/main/WorkerExecutionSupport.js';
-import { CodeSerializer } from './obj2/utils/CodeSerializer.js';
-import { OBJLoader2 } from './OBJLoader2.js';
-
-// Imports only related to worker (when standard workers (modules aren't supported) are used)
-import { OBJLoader2Parser } from './obj2/OBJLoader2Parser.js';
-import {
-	WorkerRunner,
-	DefaultWorkerPayloadHandler,
-	ObjectManipulator
-} from './obj2/worker/parallel/WorkerRunner.js';
-
-
-/**
- * Creates a new OBJLoader2Parallel. Use it to load OBJ data from files or to parse OBJ data from arraybuffer.
- * It extends {@link OBJLoader2} with the capability to run the parser in a web worker.
- *
- * @param [LoadingManager] manager The loadingManager for the loader to use. Default is {@link LoadingManager}
- * @constructor
- */
-const OBJLoader2Parallel = function ( manager ) {
-
-	OBJLoader2.call( this, manager );
-	this.preferJsmWorker = false;
-	this.jsmWorkerUrl = null;
-
-	this.executeParallel = true;
-	this.workerExecutionSupport = new WorkerExecutionSupport();
-
-};
-
-OBJLoader2Parallel.OBJLOADER2_PARALLEL_VERSION = '3.2.0';
-console.info( 'Using OBJLoader2Parallel version: ' + OBJLoader2Parallel.OBJLOADER2_PARALLEL_VERSION );
-OBJLoader2Parallel.DEFAULT_JSM_WORKER_PATH = './jsm/loaders/obj2/worker/parallel/OBJLoader2JsmWorker.js';
-
-OBJLoader2Parallel.prototype = Object.assign( Object.create( OBJLoader2.prototype ), {
-
-	constructor: OBJLoader2Parallel,
-
-	/**
-	 * Execution of parse in parallel via Worker is default, but normal {OBJLoader2} parsing can be enforced via false here.
-	 *
-	 * @param {boolean} executeParallel True or False
-	 * @return {OBJLoader2Parallel}
-	 */
-	setExecuteParallel: function ( executeParallel ) {
-
-		this.executeParallel = executeParallel === true;
-		return this;
-
-	},
-
-	/**
-	 * Set whether jsm modules in workers should be used. This requires browser support which is currently only experimental.
-	 * @param {boolean} preferJsmWorker True or False
-	 * @param {URL} jsmWorkerUrl Provide complete jsm worker URL otherwise relative path to this module may not be correct
-	 * @return {OBJLoader2Parallel}
-	 */
-	setJsmWorker: function ( preferJsmWorker, jsmWorkerUrl ) {
-
-		this.preferJsmWorker = preferJsmWorker === true;
-
-		if ( jsmWorkerUrl === undefined || jsmWorkerUrl === null ) {
-
-			throw 'The url to the jsm worker is not valid. Aborting...';
-
-		}
-
-		this.jsmWorkerUrl = jsmWorkerUrl;
-
-		return this;
-
-	},
-
-	/**
-	 * Allow to get hold of {@link WorkerExecutionSupport} for configuration purposes.
-	 * @return {WorkerExecutionSupport}
-	 */
-	getWorkerExecutionSupport: function () {
-
-		return this.workerExecutionSupport;
-
-	},
-
-	/**
-	 * Provide instructions on what is to be contained in the worker.
-	 * @return {CodeBuilderInstructions}
-	 */
-	buildWorkerCode: function () {
-
-		const codeBuilderInstructions = new CodeBuilderInstructions( true, true, this.preferJsmWorker );
-
-		if ( codeBuilderInstructions.isSupportsJsmWorker() ) {
-
-			codeBuilderInstructions.setJsmWorkerUrl( this.jsmWorkerUrl );
-
-		}
-
-		if ( codeBuilderInstructions.isSupportsStandardWorker() ) {
-
-			const objectManipulator = new ObjectManipulator();
-			const defaultWorkerPayloadHandler = new DefaultWorkerPayloadHandler( this.parser );
-			const workerRunner = new WorkerRunner( {} );
-			codeBuilderInstructions.addCodeFragment( CodeSerializer.serializeClass( OBJLoader2Parser, this.parser ) );
-			codeBuilderInstructions.addCodeFragment( CodeSerializer.serializeClass( ObjectManipulator, objectManipulator ) );
-			codeBuilderInstructions.addCodeFragment( CodeSerializer.serializeClass( DefaultWorkerPayloadHandler, defaultWorkerPayloadHandler ) );
-			codeBuilderInstructions.addCodeFragment( CodeSerializer.serializeClass( WorkerRunner, workerRunner ) );
-
-			const startCode = 'new ' + workerRunner.constructor.name + '( new ' + defaultWorkerPayloadHandler.constructor.name + '( new ' + this.parser.constructor.name + '() ) );';
-			codeBuilderInstructions.addStartCode( startCode );
-
-		}
-
-		return codeBuilderInstructions;
-
-	},
-
-	/**
-	 * See {@link OBJLoader2.load}
-	 */
-	load: function ( content, onLoad, onFileLoadProgress, onError, onMeshAlter ) {
-
- 		const scope = this;
-		function interceptOnLoad( object3d, message ) {
-
-			if ( object3d.name === 'OBJLoader2ParallelDummy' ) {
-
-				if ( scope.parser.logging.enabled && scope.parser.logging.debug ) {
-
-					console.debug( 'Received dummy answer from OBJLoader2Parallel#parse' );
-
-				}
-
-			} else {
-
-				onLoad( object3d, message );
-
-			}
-
-		}
-
-		OBJLoader2.prototype.load.call( this, content, interceptOnLoad, onFileLoadProgress, onError, onMeshAlter );
-
-	},
-
-	/**
-	 * See {@link OBJLoader2.parse}
-	 * The callback onLoad needs to be set to be able to receive the content if used in parallel mode.
-	 * Fallback is possible via {@link OBJLoader2Parallel#setExecuteParallel}.
-	 */
-	parse: function ( content ) {
-
-		if ( this.executeParallel ) {
-
-			if ( this.parser.callbacks.onLoad === this.parser._onLoad ) {
-
-				throw 'No callback other than the default callback was provided! Aborting!';
-
-			}
-
-			// check if worker has been initialize before. If yes, skip init
-			if ( ! this.workerExecutionSupport.isWorkerLoaded( this.preferJsmWorker ) ) {
-
-				this.workerExecutionSupport.buildWorker( this.buildWorkerCode() );
-
-				const scope = this;
-				const scopedOnAssetAvailable = function ( payload ) {
-
-					scope._onAssetAvailable( payload );
-
-				};
-
-				function scopedOnLoad( message ) {
-
-					scope.parser.callbacks.onLoad( scope.baseObject3d, message );
-
-				}
-
-				this.workerExecutionSupport.updateCallbacks( scopedOnAssetAvailable, scopedOnLoad );
-
-			}
-
-			// Create default materials beforehand, but do not override previously set materials (e.g. during init)
-			this.materialHandler.createDefaultMaterials( false );
-
-			this.workerExecutionSupport.executeParallel(
-				{
-					params: {
-						modelName: this.modelName,
-						instanceNo: this.instanceNo,
-						useIndices: this.parser.useIndices,
-						disregardNormals: this.parser.disregardNormals,
-						materialPerSmoothingGroup: this.parser.materialPerSmoothingGroup,
-						useOAsMesh: this.parser.useOAsMesh,
-						materials: this.materialHandler.getMaterialsJSON()
-					},
-					data: {
-						input: content,
-						options: null
-					},
-					logging: {
-						enabled: this.parser.logging.enabled,
-						debug: this.parser.logging.debug
-					}
-				} );
-
-			const dummy = new Object3D();
-			dummy.name = 'OBJLoader2ParallelDummy';
-			return dummy;
-
-		} else {
-
-			return OBJLoader2.prototype.parse.call( this, content );
-
-		}
-
-	},
-
-} );
-
-export { OBJLoader2Parallel };

+ 0 - 74
examples/jsm/loaders/obj2/OBJLoader2Parser.d.ts

@@ -1,74 +0,0 @@
-export class OBJLoader2Parser {
-
-	constructor();
-	callbacks: {
-		onProgress: Function;
-		onAssetAvailable: Function;
-		onError: Function;
-		onLoad: Function;
-	};
-	contentRef: Uint8Array;
-	legacyMode: boolean;
-	materials: object;
-	materialPerSmoothingGroup: boolean;
-	useOAsMesh: boolean;
-	useIndices: boolean;
-	disregardNormals: boolean;
-
-	vertices: number[];
-	colors: number[];
-	normals: number[];
-	uvs: number[];
-
-	rawMesh: {
-		objectName: string;
-		groupName: string;
-		activeMtlName: string;
-		mtllibName: string;
-		faceType: number;
-		subGroups: object[];
-		subGroupInUse: object;
-		smoothingGroup: {
-			splitMaterials: boolean;
-			normalized: boolean;
-			real: boolean;
-		};
-		counts: {
-			doubleIndicesCount: number;
-			faceCount: number;
-			mtlCount: number;
-			smoothingGroupCount: number;
-		}
-	};
-
-	inputObjectCount: number;
-	outputObjectCount: number;
-	globalCounts: {
-		vertices: number;
-		faces: number;
-		doubleIndicesCount: number;
-		lineByte: number;
-		currentByte: number;
-		totalBytes: number;
-	};
-
-	logging: {
-		enabled: boolean;
-		debug: boolean;
-	};
-
-	setMaterialPerSmoothingGroup( materialPerSmoothingGroup: boolean ): this;
-	setUseOAsMesh( useOAsMesh: boolean ): this;
-	setUseIndices( useIndices: boolean ): this;
-	setDisregardNormals( disregardNormals: boolean ): this;
-
-	setCallbackOnAssetAvailable( onAssetAvailable: Function ): this;
-	setCallbackOnProgress( onProgress: Function ): this;
-	setCallbackOnError( onError: Function ): this;
-	setCallbackOnLoad( onLoad: Function ): this;
-	setLogging( enabled: boolean, debug: boolean ): this;
-	setMaterials( materials: Object ): void;
-	execute( arrayBuffer: Uint8Array ): void;
-	executeLegacy( text: string ): void;
-
-}

+ 0 - 1123
examples/jsm/loaders/obj2/OBJLoader2Parser.js

@@ -1,1123 +0,0 @@
-/**
- * Development repository: https://github.com/kaisalmen/WWOBJLoader
- */
-
-/**
- * Parse OBJ data either from ArrayBuffer or string
- */
-const OBJLoader2Parser = function () {
-
-	this.logging = {
-		enabled: false,
-		debug: false
-	};
-
-	const scope = this;
-	this.callbacks = {
-		onProgress: function ( text ) {
-
-			scope._onProgress( text );
-
-		},
-		onAssetAvailable: function ( payload ) {
-
-			scope._onAssetAvailable( payload );
-
-		},
-		onError: function ( errorMessage ) {
-
-			scope._onError( errorMessage );
-
-		},
-		onLoad: function ( object3d, message ) {
-
-			scope._onLoad( object3d, message );
-
-		},
-	};
-	this.contentRef = null;
-	this.legacyMode = false;
-
-	this.materials = {};
-	this.materialPerSmoothingGroup = false;
-	this.useOAsMesh = false;
-	this.useIndices = false;
-	this.disregardNormals = false;
-
-	this.vertices = [];
-	this.colors = [];
-	this.normals = [];
-	this.uvs = [];
-
-	this.rawMesh = {
-		objectName: '',
-		groupName: '',
-		activeMtlName: '',
-		mtllibName: '',
-
-		// reset with new mesh
-		faceType: - 1,
-		subGroups: [],
-		subGroupInUse: null,
-		smoothingGroup: {
-			splitMaterials: false,
-			normalized: - 1,
-			real: - 1
-		},
-		counts: {
-			doubleIndicesCount: 0,
-			faceCount: 0,
-			mtlCount: 0,
-			smoothingGroupCount: 0
-		}
-	};
-
-	this.inputObjectCount = 1;
-	this.outputObjectCount = 1;
-	this.globalCounts = {
-		vertices: 0,
-		faces: 0,
-		doubleIndicesCount: 0,
-		lineByte: 0,
-		currentByte: 0,
-		totalBytes: 0
-	};
-
-};
-
-OBJLoader2Parser.prototype = {
-
-	constructor: OBJLoader2Parser,
-
-	_resetRawMesh: function () {
-
-		// faces are stored according combined index of group, material and smoothingGroup (0 or not)
-		this.rawMesh.subGroups = [];
-		this.rawMesh.subGroupInUse = null;
-		this.rawMesh.smoothingGroup.normalized = - 1;
-		this.rawMesh.smoothingGroup.real = - 1;
-
-		// this default index is required as it is possible to define faces without 'g' or 'usemtl'
-		this._pushSmoothingGroup( 1 );
-
-		this.rawMesh.counts.doubleIndicesCount = 0;
-		this.rawMesh.counts.faceCount = 0;
-		this.rawMesh.counts.mtlCount = 0;
-		this.rawMesh.counts.smoothingGroupCount = 0;
-
-	},
-
-	/**
-	 * Tells whether a material shall be created per smoothing group.
-	 *
-	 * @param {boolean} materialPerSmoothingGroup=false
-	 * @return {OBJLoader2Parser}
-	 */
-	setMaterialPerSmoothingGroup: function ( materialPerSmoothingGroup ) {
-
-		this.materialPerSmoothingGroup = materialPerSmoothingGroup === true;
-		return this;
-
-	},
-
-	/**
-	 * Usually 'o' is meta-information and does not result in creation of new meshes, but mesh creation on occurrence of "o" can be enforced.
-	 *
-	 * @param {boolean} useOAsMesh=false
-	 * @return {OBJLoader2Parser}
-	 */
-	setUseOAsMesh: function ( useOAsMesh ) {
-
-		this.useOAsMesh = useOAsMesh === true;
-		return this;
-
-	},
-
-	/**
-	 * Instructs loaders to create indexed {@link BufferGeometry}.
-	 *
-	 * @param {boolean} useIndices=false
-	 * @return {OBJLoader2Parser}
-	 */
-	setUseIndices: function ( useIndices ) {
-
-		this.useIndices = useIndices === true;
-		return this;
-
-	},
-
-	/**
-	 * Tells whether normals should be completely disregarded and regenerated.
-	 *
-	 * @param {boolean} disregardNormals=false
-	 * @return {OBJLoader2Parser}
-	 */
-	setDisregardNormals: function ( disregardNormals ) {
-
-		this.disregardNormals = disregardNormals === true;
-		return this;
-
-	},
-
-	/**
-	 * Clears materials object and sets the new ones.
-	 *
-	 * @param {Object} materials Object with named materials
-	 */
-	setMaterials: function ( materials ) {
-
- 		this.materials = Object.assign( {}, materials );
-
-	},
-
-	/**
-	 * Register a function that is called once an asset (mesh/material) becomes available.
-	 *
-	 * @param onAssetAvailable
-	 * @return {OBJLoader2Parser}
-	 */
-	setCallbackOnAssetAvailable: function ( onAssetAvailable ) {
-
-		if ( onAssetAvailable !== null && onAssetAvailable !== undefined && onAssetAvailable instanceof Function ) {
-
-			this.callbacks.onAssetAvailable = onAssetAvailable;
-
-		}
-
-		return this;
-
-	},
-
-	/**
-	 * Register a function that is used to report overall processing progress.
-	 *
-	 * @param {Function} onProgress
-	 * @return {OBJLoader2Parser}
-	 */
-	setCallbackOnProgress: function ( onProgress ) {
-
-		if ( onProgress !== null && onProgress !== undefined && onProgress instanceof Function ) {
-
-			this.callbacks.onProgress = onProgress;
-
-		}
-
-		return this;
-
-	},
-
-	/**
-	 * Register an error handler function that is called if errors occur. It can decide to just log or to throw an exception.
-	 *
-	 * @param {Function} onError
-	 * @return {OBJLoader2Parser}
-	 */
-	setCallbackOnError: function ( onError ) {
-
-		if ( onError !== null && onError !== undefined && onError instanceof Function ) {
-
-			this.callbacks.onError = onError;
-
-		}
-
-		return this;
-
-	},
-
-	/**
-	 * Register a function that is called when parsing was completed.
-	 *
-	 * @param {Function} onLoad
-	 * @return {OBJLoader2Parser}
-	 */
-	setCallbackOnLoad: function ( onLoad ) {
-
-		if ( onLoad !== null && onLoad !== undefined && onLoad instanceof Function ) {
-
-			this.callbacks.onLoad = onLoad;
-
-		}
-
-		return this;
-
-	},
-
-	/**
-	 * Announce parse progress feedback which is logged to the console.
-	 * @private
-	 *
-	 * @param {string} text Textual description of the event
-	 */
-	_onProgress: function ( text ) {
-
-		const message = text ? text : '';
-		if ( this.logging.enabled && this.logging.debug ) {
-
-			console.log( message );
-
-		}
-
-	},
-
-	/**
-	 * Announce error feedback which is logged as error message.
-	 * @private
-	 *
-	 * @param {String} errorMessage The event containing the error
-	 */
-	_onError: function ( errorMessage ) {
-
-		if ( this.logging.enabled && this.logging.debug ) {
-
-			console.error( errorMessage );
-
-		}
-
-	},
-
-	_onAssetAvailable: function ( /*payload*/ ) {
-
-		const errorMessage = 'OBJLoader2Parser does not provide implementation for onAssetAvailable. Aborting...';
-		this.callbacks.onError( errorMessage );
-		throw errorMessage;
-
-	},
-
-	_onLoad: function ( object3d, message ) {
-
-		console.log( 'You reached parser default onLoad callback: ' + message );
-
-	},
-
-	/**
-	 * Enable or disable logging in general (except warn and error), plus enable or disable debug logging.
-	 *
-	 * @param {boolean} enabled True or false.
-	 * @param {boolean} debug True or false.
-	 *
-	 * @return {OBJLoader2Parser}
-	 */
-	setLogging: function ( enabled, debug ) {
-
-		this.logging.enabled = enabled === true;
-		this.logging.debug = debug === true;
-		return this;
-
-	},
-
-	_configure: function () {
-
-		this._pushSmoothingGroup( 1 );
-		if ( this.logging.enabled ) {
-
-			const matKeys = Object.keys( this.materials );
-			const matNames = ( matKeys.length > 0 ) ? '\n\tmaterialNames:\n\t\t- ' + matKeys.join( '\n\t\t- ' ) : '\n\tmaterialNames: None';
-			let printedConfig = 'OBJLoader.Parser configuration:'
-				+ matNames
-				+ '\n\tmaterialPerSmoothingGroup: ' + this.materialPerSmoothingGroup
-				+ '\n\tuseOAsMesh: ' + this.useOAsMesh
-				+ '\n\tuseIndices: ' + this.useIndices
-				+ '\n\tdisregardNormals: ' + this.disregardNormals;
-			printedConfig += '\n\tcallbacks.onProgress: ' + this.callbacks.onProgress.name;
-			printedConfig += '\n\tcallbacks.onAssetAvailable: ' + this.callbacks.onAssetAvailable.name;
-			printedConfig += '\n\tcallbacks.onError: ' + this.callbacks.onError.name;
-			console.info( printedConfig );
-
-		}
-
-	},
-
-	/**
-	 * Parse the provided arraybuffer
-	 *
-	 * @param {Uint8Array} arrayBuffer OBJ data as Uint8Array
-	 */
-	execute: function ( arrayBuffer ) {
-
-		if ( this.logging.enabled ) console.time( 'OBJLoader2Parser.execute' );
-		this._configure();
-
-		const arrayBufferView = new Uint8Array( arrayBuffer );
-		this.contentRef = arrayBufferView;
-		const length = arrayBufferView.byteLength;
-		this.globalCounts.totalBytes = length;
-		const buffer = new Array( 128 );
-
-		let bufferPointer = 0;
-		let slashesCount = 0;
-		let word = '';
-		let currentByte = 0;
-		for ( let code; currentByte < length; currentByte ++ ) {
-
-			code = arrayBufferView[ currentByte ];
-			switch ( code ) {
-
-				// space
-				case 32:
-					if ( word.length > 0 ) buffer[ bufferPointer ++ ] = word;
-					word = '';
-					break;
-				// slash
-				case 47:
-					if ( word.length > 0 ) buffer[ bufferPointer ++ ] = word;
-					slashesCount ++;
-					word = '';
-					break;
-
-				// LF
-				case 10:
-					this._processLine( buffer, bufferPointer, slashesCount, word, currentByte );
-					word = '';
-					bufferPointer = 0;
-					slashesCount = 0;
-					break;
-
-				// CR
-				case 13:
-					break;
-
-				default:
-					word += String.fromCharCode( code );
-					break;
-
-			}
-
-		}
-
-		this._processLine( buffer, bufferPointer, slashesCount, word, currentByte );
-		this._finalizeParsing();
-		if ( this.logging.enabled ) console.timeEnd( 'OBJLoader2Parser.execute' );
-
-	},
-
-	/**
-	 * Parse the provided text
-	 *
-	 * @param {string} text OBJ data as string
-	 */
-	executeLegacy: function ( text ) {
-
-		if ( this.logging.enabled ) console.time( 'OBJLoader2Parser.executeLegacy' );
-		this._configure();
-		this.legacyMode = true;
-		this.contentRef = text;
-		const length = text.length;
-		this.globalCounts.totalBytes = length;
-		const buffer = new Array( 128 );
-
-		let bufferPointer = 0;
-		let slashesCount = 0;
-		let word = '';
-		let currentByte = 0;
-		for ( let char; currentByte < length; currentByte ++ ) {
-
-			char = text[ currentByte ];
-			switch ( char ) {
-
-				case ' ':
-					if ( word.length > 0 ) buffer[ bufferPointer ++ ] = word;
-					word = '';
-					break;
-
-				case '/':
-					if ( word.length > 0 ) buffer[ bufferPointer ++ ] = word;
-					slashesCount ++;
-					word = '';
-					break;
-
-				case '\n':
-					this._processLine( buffer, bufferPointer, slashesCount, word, currentByte );
-					word = '';
-					bufferPointer = 0;
-					slashesCount = 0;
-					break;
-
-				case '\r':
-					break;
-
-				default:
-					word += char;
-
-			}
-
-		}
-
-		this._processLine( buffer, bufferPointer, word, slashesCount );
-		this._finalizeParsing();
-		if ( this.logging.enabled ) console.timeEnd( 'OBJLoader2Parser.executeLegacy' );
-
-	},
-
-	_processLine: function ( buffer, bufferPointer, slashesCount, word, currentByte ) {
-
-		this.globalCounts.lineByte = this.globalCounts.currentByte;
-		this.globalCounts.currentByte = currentByte;
-		if ( bufferPointer < 1 ) return;
-
-		if ( word.length > 0 ) buffer[ bufferPointer ++ ] = word;
-
-		const reconstructString = function ( content, legacyMode, start, stop ) {
-
-			let line = '';
-			if ( stop > start ) {
-
-				let i;
-				if ( legacyMode ) {
-
-					for ( i = start; i < stop; i ++ ) line += content[ i ];
-
-				} else {
-
-
-					for ( i = start; i < stop; i ++ ) line += String.fromCharCode( content[ i ] );
-
-				}
-
-				line = line.trim();
-
-			}
-
-			return line;
-
-		};
-
-		let bufferLength, length, i;
-		const lineDesignation = buffer[ 0 ];
-		switch ( lineDesignation ) {
-
-			case 'v':
-				this.vertices.push( parseFloat( buffer[ 1 ] ) );
-				this.vertices.push( parseFloat( buffer[ 2 ] ) );
-				this.vertices.push( parseFloat( buffer[ 3 ] ) );
-				if ( bufferPointer > 4 ) {
-
-					this.colors.push( parseFloat( buffer[ 4 ] ) );
-					this.colors.push( parseFloat( buffer[ 5 ] ) );
-					this.colors.push( parseFloat( buffer[ 6 ] ) );
-
-				}
-
-				break;
-
-			case 'vt':
-				this.uvs.push( parseFloat( buffer[ 1 ] ) );
-				this.uvs.push( parseFloat( buffer[ 2 ] ) );
-				break;
-
-			case 'vn':
-				this.normals.push( parseFloat( buffer[ 1 ] ) );
-				this.normals.push( parseFloat( buffer[ 2 ] ) );
-				this.normals.push( parseFloat( buffer[ 3 ] ) );
-				break;
-
-			case 'f':
-				bufferLength = bufferPointer - 1;
-
-				// "f vertex ..."
-				if ( slashesCount === 0 ) {
-
-					this._checkFaceType( 0 );
-					for ( i = 2, length = bufferLength; i < length; i ++ ) {
-
-						this._buildFace( buffer[ 1 ] );
-						this._buildFace( buffer[ i ] );
-						this._buildFace( buffer[ i + 1 ] );
-
-					}
-
-					// "f vertex/uv ..."
-
-				} else if ( bufferLength === slashesCount * 2 ) {
-
-					this._checkFaceType( 1 );
-					for ( i = 3, length = bufferLength - 2; i < length; i += 2 ) {
-
-						this._buildFace( buffer[ 1 ], buffer[ 2 ] );
-						this._buildFace( buffer[ i ], buffer[ i + 1 ] );
-						this._buildFace( buffer[ i + 2 ], buffer[ i + 3 ] );
-
-					}
-
-					// "f vertex/uv/normal ..."
-
-				} else if ( bufferLength * 2 === slashesCount * 3 ) {
-
-					this._checkFaceType( 2 );
-					for ( i = 4, length = bufferLength - 3; i < length; i += 3 ) {
-
-						this._buildFace( buffer[ 1 ], buffer[ 2 ], buffer[ 3 ] );
-						this._buildFace( buffer[ i ], buffer[ i + 1 ], buffer[ i + 2 ] );
-						this._buildFace( buffer[ i + 3 ], buffer[ i + 4 ], buffer[ i + 5 ] );
-
-					}
-
-					// "f vertex//normal ..."
-
-				} else {
-
-					this._checkFaceType( 3 );
-					for ( i = 3, length = bufferLength - 2; i < length; i += 2 ) {
-
-						this._buildFace( buffer[ 1 ], undefined, buffer[ 2 ] );
-						this._buildFace( buffer[ i ], undefined, buffer[ i + 1 ] );
-						this._buildFace( buffer[ i + 2 ], undefined, buffer[ i + 3 ] );
-
-					}
-
-				}
-
-				break;
-
-			case 'l':
-			case 'p':
-				bufferLength = bufferPointer - 1;
-				if ( bufferLength === slashesCount * 2 ) {
-
-					this._checkFaceType( 4 );
-					for ( i = 1, length = bufferLength + 1; i < length; i += 2 ) this._buildFace( buffer[ i ], buffer[ i + 1 ] );
-
-				} else {
-
-					this._checkFaceType( ( lineDesignation === 'l' ) ? 5 : 6 );
-					for ( i = 1, length = bufferLength + 1; i < length; i ++ ) this._buildFace( buffer[ i ] );
-
-				}
-
-				break;
-
-			case 's':
-				this._pushSmoothingGroup( buffer[ 1 ] );
-				break;
-
-			case 'g':
-				// 'g' leads to creation of mesh if valid data (faces declaration was done before), otherwise only groupName gets set
-				this._processCompletedMesh();
-				this.rawMesh.groupName = reconstructString( this.contentRef, this.legacyMode, this.globalCounts.lineByte + 2, this.globalCounts.currentByte );
-				break;
-
-			case 'o':
-				// 'o' is meta-information and usually does not result in creation of new meshes, but can be enforced with "useOAsMesh"
-				if ( this.useOAsMesh ) this._processCompletedMesh();
-				this.rawMesh.objectName = reconstructString( this.contentRef, this.legacyMode, this.globalCounts.lineByte + 2, this.globalCounts.currentByte );
-				break;
-
-			case 'mtllib':
-				this.rawMesh.mtllibName = reconstructString( this.contentRef, this.legacyMode, this.globalCounts.lineByte + 7, this.globalCounts.currentByte );
-				break;
-
-			case 'usemtl':
-				const mtlName = reconstructString( this.contentRef, this.legacyMode, this.globalCounts.lineByte + 7, this.globalCounts.currentByte );
-				if ( mtlName !== '' && this.rawMesh.activeMtlName !== mtlName ) {
-
-					this.rawMesh.activeMtlName = mtlName;
-					this.rawMesh.counts.mtlCount ++;
-					this._checkSubGroup();
-
-				}
-
-				break;
-
-			default:
-				break;
-
-		}
-
-	},
-
-	_pushSmoothingGroup: function ( smoothingGroup ) {
-
-		let smoothingGroupInt = parseInt( smoothingGroup );
-		if ( isNaN( smoothingGroupInt ) ) {
-
-			smoothingGroupInt = smoothingGroup === 'off' ? 0 : 1;
-
-		}
-
-		const smoothCheck = this.rawMesh.smoothingGroup.normalized;
-		this.rawMesh.smoothingGroup.normalized = this.rawMesh.smoothingGroup.splitMaterials ? smoothingGroupInt : ( smoothingGroupInt === 0 ) ? 0 : 1;
-		this.rawMesh.smoothingGroup.real = smoothingGroupInt;
-
-		if ( smoothCheck !== smoothingGroupInt ) {
-
-			this.rawMesh.counts.smoothingGroupCount ++;
-			this._checkSubGroup();
-
-		}
-
-	},
-
-	/**
-	 * Expanded faceTypes include all four face types, both line types and the point type
-	 * faceType = 0: "f vertex ..."
-	 * faceType = 1: "f vertex/uv ..."
-	 * faceType = 2: "f vertex/uv/normal ..."
-	 * faceType = 3: "f vertex//normal ..."
-	 * faceType = 4: "l vertex/uv ..." or "l vertex ..."
-	 * faceType = 5: "l vertex ..."
-	 * faceType = 6: "p vertex ..."
-	 */
-	_checkFaceType: function ( faceType ) {
-
-		if ( this.rawMesh.faceType !== faceType ) {
-
-			this._processCompletedMesh();
-			this.rawMesh.faceType = faceType;
-			this._checkSubGroup();
-
-		}
-
-	},
-
-	_checkSubGroup: function () {
-
-		const index = this.rawMesh.activeMtlName + '|' + this.rawMesh.smoothingGroup.normalized;
-		this.rawMesh.subGroupInUse = this.rawMesh.subGroups[ index ];
-
-		if ( this.rawMesh.subGroupInUse === undefined || this.rawMesh.subGroupInUse === null ) {
-
-			this.rawMesh.subGroupInUse = {
-				index: index,
-				objectName: this.rawMesh.objectName,
-				groupName: this.rawMesh.groupName,
-				materialName: this.rawMesh.activeMtlName,
-				smoothingGroup: this.rawMesh.smoothingGroup.normalized,
-				vertices: [],
-				indexMappingsCount: 0,
-				indexMappings: [],
-				indices: [],
-				colors: [],
-				uvs: [],
-				normals: []
-			};
-			this.rawMesh.subGroups[ index ] = this.rawMesh.subGroupInUse;
-
-		}
-
-	},
-
-	_buildFace: function ( faceIndexV, faceIndexU, faceIndexN ) {
-
-		const subGroupInUse = this.rawMesh.subGroupInUse;
-		const scope = this;
-		const updateSubGroupInUse = function () {
-
-			const faceIndexVi = parseInt( faceIndexV );
-			let indexPointerV = 3 * ( faceIndexVi > 0 ? faceIndexVi - 1 : faceIndexVi + scope.vertices.length / 3 );
-			let indexPointerC = scope.colors.length > 0 ? indexPointerV : null;
-
-			const vertices = subGroupInUse.vertices;
-			vertices.push( scope.vertices[ indexPointerV ++ ] );
-			vertices.push( scope.vertices[ indexPointerV ++ ] );
-			vertices.push( scope.vertices[ indexPointerV ] );
-
-			if ( indexPointerC !== null ) {
-
-				const colors = subGroupInUse.colors;
-				colors.push( scope.colors[ indexPointerC ++ ] );
-				colors.push( scope.colors[ indexPointerC ++ ] );
-				colors.push( scope.colors[ indexPointerC ] );
-
-			}
-
-			if ( faceIndexU ) {
-
-				const faceIndexUi = parseInt( faceIndexU );
-				let indexPointerU = 2 * ( faceIndexUi > 0 ? faceIndexUi - 1 : faceIndexUi + scope.uvs.length / 2 );
-				const uvs = subGroupInUse.uvs;
-				uvs.push( scope.uvs[ indexPointerU ++ ] );
-				uvs.push( scope.uvs[ indexPointerU ] );
-
-			}
-
-			if ( faceIndexN && ! scope.disregardNormals ) {
-
-				const faceIndexNi = parseInt( faceIndexN );
-				let indexPointerN = 3 * ( faceIndexNi > 0 ? faceIndexNi - 1 : faceIndexNi + scope.normals.length / 3 );
-				const normals = subGroupInUse.normals;
-				normals.push( scope.normals[ indexPointerN ++ ] );
-				normals.push( scope.normals[ indexPointerN ++ ] );
-				normals.push( scope.normals[ indexPointerN ] );
-
-			}
-
-		};
-
-		if ( this.useIndices ) {
-
-			if ( this.disregardNormals ) faceIndexN = undefined;
-			const mappingName = faceIndexV + ( faceIndexU ? '_' + faceIndexU : '_n' ) + ( faceIndexN ? '_' + faceIndexN : '_n' );
-			let indicesPointer = subGroupInUse.indexMappings[ mappingName ];
-			if ( indicesPointer === undefined || indicesPointer === null ) {
-
-				indicesPointer = this.rawMesh.subGroupInUse.vertices.length / 3;
-				updateSubGroupInUse();
-				subGroupInUse.indexMappings[ mappingName ] = indicesPointer;
-				subGroupInUse.indexMappingsCount ++;
-
-			} else {
-
-				this.rawMesh.counts.doubleIndicesCount ++;
-
-			}
-
-			subGroupInUse.indices.push( indicesPointer );
-
-		} else {
-
-			updateSubGroupInUse();
-
-		}
-
-		this.rawMesh.counts.faceCount ++;
-
-	},
-
-	_createRawMeshReport: function ( inputObjectCount ) {
-
-		return 'Input Object number: ' + inputObjectCount +
-			'\n\tObject name: ' + this.rawMesh.objectName +
-			'\n\tGroup name: ' + this.rawMesh.groupName +
-			'\n\tMtllib name: ' + this.rawMesh.mtllibName +
-			'\n\tVertex count: ' + this.vertices.length / 3 +
-			'\n\tNormal count: ' + this.normals.length / 3 +
-			'\n\tUV count: ' + this.uvs.length / 2 +
-			'\n\tSmoothingGroup count: ' + this.rawMesh.counts.smoothingGroupCount +
-			'\n\tMaterial count: ' + this.rawMesh.counts.mtlCount +
-			'\n\tReal MeshOutputGroup count: ' + this.rawMesh.subGroups.length;
-
-	},
-
-	/**
-	 * Clear any empty subGroup and calculate absolute vertex, normal and uv counts
-	 */
-	_finalizeRawMesh: function () {
-
-		const meshOutputGroupTemp = [];
-		let meshOutputGroup;
-		let absoluteVertexCount = 0;
-		let absoluteIndexMappingsCount = 0;
-		let absoluteIndexCount = 0;
-		let absoluteColorCount = 0;
-		let absoluteNormalCount = 0;
-		let absoluteUvCount = 0;
-		let indices;
-		for ( const name in this.rawMesh.subGroups ) {
-
-			meshOutputGroup = this.rawMesh.subGroups[ name ];
-			if ( meshOutputGroup.vertices.length > 0 ) {
-
-				indices = meshOutputGroup.indices;
-				if ( indices.length > 0 && absoluteIndexMappingsCount > 0 ) {
-
-					for ( let i = 0; i < indices.length; i ++ ) {
-
-						indices[ i ] = indices[ i ] + absoluteIndexMappingsCount;
-
-					}
-
-				}
-
-				meshOutputGroupTemp.push( meshOutputGroup );
-				absoluteVertexCount += meshOutputGroup.vertices.length;
-				absoluteIndexMappingsCount += meshOutputGroup.indexMappingsCount;
-				absoluteIndexCount += meshOutputGroup.indices.length;
-				absoluteColorCount += meshOutputGroup.colors.length;
-				absoluteUvCount += meshOutputGroup.uvs.length;
-				absoluteNormalCount += meshOutputGroup.normals.length;
-
-			}
-
-		}
-
-		// do not continue if no result
-		let result = null;
-		if ( meshOutputGroupTemp.length > 0 ) {
-
-			result = {
-				name: this.rawMesh.groupName !== '' ? this.rawMesh.groupName : this.rawMesh.objectName,
-				subGroups: meshOutputGroupTemp,
-				absoluteVertexCount: absoluteVertexCount,
-				absoluteIndexCount: absoluteIndexCount,
-				absoluteColorCount: absoluteColorCount,
-				absoluteNormalCount: absoluteNormalCount,
-				absoluteUvCount: absoluteUvCount,
-				faceCount: this.rawMesh.counts.faceCount,
-				doubleIndicesCount: this.rawMesh.counts.doubleIndicesCount
-			};
-
-		}
-
-		return result;
-
-	},
-
-	_processCompletedMesh: function () {
-
-		const result = this._finalizeRawMesh();
-		const haveMesh = result !== null;
-		if ( haveMesh ) {
-
-			if ( this.colors.length > 0 && this.colors.length !== this.vertices.length ) {
-
-				this.callbacks.onError( 'Vertex Colors were detected, but vertex count and color count do not match!' );
-
-			}
-
-			if ( this.logging.enabled && this.logging.debug ) console.debug( this._createRawMeshReport( this.inputObjectCount ) );
-			this.inputObjectCount ++;
-
-			this._buildMesh( result );
-			const progressBytesPercent = this.globalCounts.currentByte / this.globalCounts.totalBytes;
-			this._onProgress( 'Completed [o: ' + this.rawMesh.objectName + ' g:' + this.rawMesh.groupName + '' +
-				'] Total progress: ' + ( progressBytesPercent * 100 ).toFixed( 2 ) + '%' );
-			this._resetRawMesh();
-
-		}
-
-		return haveMesh;
-
-	},
-
-	/**
-	 * SubGroups are transformed to too intermediate format that is forwarded to the MeshReceiver.
-	 * It is ensured that SubGroups only contain objects with vertices (no need to check).
-	 *
-	 * @param result
-	 */
-	_buildMesh: function ( result ) {
-
-		const meshOutputGroups = result.subGroups;
-
-		const vertexFA = new Float32Array( result.absoluteVertexCount );
-		this.globalCounts.vertices += result.absoluteVertexCount / 3;
-		this.globalCounts.faces += result.faceCount;
-		this.globalCounts.doubleIndicesCount += result.doubleIndicesCount;
-		const indexUA = ( result.absoluteIndexCount > 0 ) ? new Uint32Array( result.absoluteIndexCount ) : null;
-		const colorFA = ( result.absoluteColorCount > 0 ) ? new Float32Array( result.absoluteColorCount ) : null;
-		const normalFA = ( result.absoluteNormalCount > 0 ) ? new Float32Array( result.absoluteNormalCount ) : null;
-		const uvFA = ( result.absoluteUvCount > 0 ) ? new Float32Array( result.absoluteUvCount ) : null;
-		const haveVertexColors = colorFA !== null;
-
-		let meshOutputGroup;
-		const materialNames = [];
-
-		const createMultiMaterial = ( meshOutputGroups.length > 1 );
-		let materialIndex = 0;
-		const materialIndexMapping = [];
-		let selectedMaterialIndex;
-		let materialGroup;
-		const materialGroups = [];
-
-		let vertexFAOffset = 0;
-		let indexUAOffset = 0;
-		let colorFAOffset = 0;
-		let normalFAOffset = 0;
-		let uvFAOffset = 0;
-		let materialGroupOffset = 0;
-		let materialGroupLength = 0;
-
-		let materialOrg, material, materialName, materialNameOrg;
-		// only one specific face type
-		for ( const oodIndex in meshOutputGroups ) {
-
-			if ( ! meshOutputGroups.hasOwnProperty( oodIndex ) ) continue;
-			meshOutputGroup = meshOutputGroups[ oodIndex ];
-
-			materialNameOrg = meshOutputGroup.materialName;
-			if ( this.rawMesh.faceType < 4 ) {
-
-				materialName = materialNameOrg + ( haveVertexColors ? '_vertexColor' : '' ) + ( meshOutputGroup.smoothingGroup === 0 ? '_flat' : '' );
-
-
-			} else {
-
-				materialName = this.rawMesh.faceType === 6 ? 'defaultPointMaterial' : 'defaultLineMaterial';
-
-			}
-
-			materialOrg = this.materials[ materialNameOrg ];
-			material = this.materials[ materialName ];
-
-			// both original and derived names do not lead to an existing material => need to use a default material
-			if ( ( materialOrg === undefined || materialOrg === null ) && ( material === undefined || material === null ) ) {
-
-				materialName = haveVertexColors ? 'defaultVertexColorMaterial' : 'defaultMaterial';
-				material = this.materials[ materialName ];
-				if ( this.logging.enabled ) {
-
-					console.info( 'object_group "' + meshOutputGroup.objectName + '_' +
-						meshOutputGroup.groupName + '" was defined with unresolvable material "' +
-						materialNameOrg + '"! Assigning "' + materialName + '".' );
-
-				}
-
-			}
-
-			if ( material === undefined || material === null ) {
-
-				const materialCloneInstructions = {
-					materialNameOrg: materialNameOrg,
-					materialName: materialName,
-					materialProperties: {
-						vertexColors: haveVertexColors ? 2 : 0,
-						flatShading: meshOutputGroup.smoothingGroup === 0
-					}
-				};
-				const payload = {
-					cmd: 'assetAvailable',
-					type: 'material',
-					materials: {
-						materialCloneInstructions: materialCloneInstructions
-					}
-				};
-				this.callbacks.onAssetAvailable( payload );
-
-				// only set materials if they don't exist, yet
-				const matCheck = this.materials[ materialName ];
-				if ( matCheck === undefined || matCheck === null ) {
-
-					this.materials[ materialName ] = materialCloneInstructions;
-
-				}
-
-			}
-
-			if ( createMultiMaterial ) {
-
-				// re-use material if already used before. Reduces materials array size and eliminates duplicates
-				selectedMaterialIndex = materialIndexMapping[ materialName ];
-				if ( ! selectedMaterialIndex ) {
-
-					selectedMaterialIndex = materialIndex;
-					materialIndexMapping[ materialName ] = materialIndex;
-					materialNames.push( materialName );
-					materialIndex ++;
-
-				}
-
-				materialGroupLength = this.useIndices ? meshOutputGroup.indices.length : meshOutputGroup.vertices.length / 3;
-				materialGroup = {
-					start: materialGroupOffset,
-					count: materialGroupLength,
-					index: selectedMaterialIndex
-				};
-				materialGroups.push( materialGroup );
-				materialGroupOffset += materialGroupLength;
-
-			} else {
-
-				materialNames.push( materialName );
-
-			}
-
-			vertexFA.set( meshOutputGroup.vertices, vertexFAOffset );
-			vertexFAOffset += meshOutputGroup.vertices.length;
-
-			if ( indexUA ) {
-
-				indexUA.set( meshOutputGroup.indices, indexUAOffset );
-				indexUAOffset += meshOutputGroup.indices.length;
-
-			}
-
-			if ( colorFA ) {
-
-				colorFA.set( meshOutputGroup.colors, colorFAOffset );
-				colorFAOffset += meshOutputGroup.colors.length;
-
-			}
-
-			if ( normalFA ) {
-
-				normalFA.set( meshOutputGroup.normals, normalFAOffset );
-				normalFAOffset += meshOutputGroup.normals.length;
-
-			}
-
-			if ( uvFA ) {
-
-				uvFA.set( meshOutputGroup.uvs, uvFAOffset );
-				uvFAOffset += meshOutputGroup.uvs.length;
-
-			}
-
-			if ( this.logging.enabled && this.logging.debug ) {
-
-				let materialIndexLine = '';
-				if ( selectedMaterialIndex ) {
-
-					materialIndexLine = '\n\t\tmaterialIndex: ' + selectedMaterialIndex;
-
-				}
-
-				const createdReport = '\tOutput Object no.: ' + this.outputObjectCount +
-					'\n\t\tgroupName: ' + meshOutputGroup.groupName +
-					'\n\t\tIndex: ' + meshOutputGroup.index +
-					'\n\t\tfaceType: ' + this.rawMesh.faceType +
-					'\n\t\tmaterialName: ' + meshOutputGroup.materialName +
-					'\n\t\tsmoothingGroup: ' + meshOutputGroup.smoothingGroup +
-					materialIndexLine +
-					'\n\t\tobjectName: ' + meshOutputGroup.objectName +
-					'\n\t\t#vertices: ' + meshOutputGroup.vertices.length / 3 +
-					'\n\t\t#indices: ' + meshOutputGroup.indices.length +
-					'\n\t\t#colors: ' + meshOutputGroup.colors.length / 3 +
-					'\n\t\t#uvs: ' + meshOutputGroup.uvs.length / 2 +
-					'\n\t\t#normals: ' + meshOutputGroup.normals.length / 3;
-				console.debug( createdReport );
-
-			}
-
-		}
-
-		this.outputObjectCount ++;
-		this.callbacks.onAssetAvailable(
-			{
-				cmd: 'assetAvailable',
-				type: 'mesh',
-				progress: {
-					numericalValue: this.globalCounts.currentByte / this.globalCounts.totalBytes
-				},
-				params: {
-					meshName: result.name
-				},
-				materials: {
-					multiMaterial: createMultiMaterial,
-					materialNames: materialNames,
-					materialGroups: materialGroups
-				},
-				buffers: {
-					vertices: vertexFA,
-					indices: indexUA,
-					colors: colorFA,
-					normals: normalFA,
-					uvs: uvFA
-				},
-				// 0: mesh, 1: line, 2: point
-				geometryType: this.rawMesh.faceType < 4 ? 0 : ( this.rawMesh.faceType === 6 ) ? 2 : 1
-			},
-			[ vertexFA.buffer ],
-			indexUA !== null ? [ indexUA.buffer ] : null,
-			colorFA !== null ? [ colorFA.buffer ] : null,
-			normalFA !== null ? [ normalFA.buffer ] : null,
-			uvFA !== null ? [ uvFA.buffer ] : null
-		);
-
-	},
-
-	_finalizeParsing: function () {
-
-		if ( this.logging.enabled ) console.info( 'Global output object count: ' + this.outputObjectCount );
-		if ( this._processCompletedMesh() && this.logging.enabled ) {
-
-			const parserFinalReport = 'Overall counts: ' +
-				'\n\tVertices: ' + this.globalCounts.vertices +
-				'\n\tFaces: ' + this.globalCounts.faces +
-				'\n\tMultiple definitions: ' + this.globalCounts.doubleIndicesCount;
-			console.info( parserFinalReport );
-
-		}
-
-	}
-};
-
-export { OBJLoader2Parser };

+ 0 - 8
examples/jsm/loaders/obj2/bridge/MtlObjBridge.d.ts

@@ -1,8 +0,0 @@
-import {
-	MTLLoader
-} from '../../MTLLoader';
-
-export namespace MtlObjBridge {
-	export function link( processResult: object, assetLoader: object ): void;
-	export function addMaterialsFromMtlLoader( materialCreator: MTLLoader.MaterialCreator ): object;
-}

+ 0 - 46
examples/jsm/loaders/obj2/bridge/MtlObjBridge.js

@@ -1,46 +0,0 @@
-/**
- * Development repository: https://github.com/kaisalmen/WWOBJLoader
- */
-
-import { MTLLoader } from '../../../../jsm/loaders/MTLLoader.js';
-
-
-const MtlObjBridge = {
-
-	/**
-	 *
-	 * @param processResult
-	 * @param assetLoader
-	 */
-	link: function ( processResult, assetLoader ) {
-
-		if ( typeof assetLoader.addMaterials === 'function' ) {
-
-			assetLoader.addMaterials( this.addMaterialsFromMtlLoader( processResult ), true );
-
-		}
-
-	},
-
-	/**
-	 * Returns the array instance of {@link MTLLoader.MaterialCreator}.
-	 *
-	 * @param Instance of {@link MTLLoader.MaterialCreator}
-	 */
-	addMaterialsFromMtlLoader: function ( materialCreator ) {
-
-		let newMaterials = {};
-
-		if ( materialCreator instanceof MTLLoader.MaterialCreator ) {
-
-			materialCreator.preload();
-			newMaterials = materialCreator.materials;
-
-		}
-
-		return newMaterials;
-
-	}
-};
-
-export { MtlObjBridge };

+ 0 - 26
examples/jsm/loaders/obj2/shared/MaterialHandler.d.ts

@@ -1,26 +0,0 @@
-import {
-	Material
-} from '../../../../../src/Three';
-
-export class MaterialHandler {
-
-	constructor();
-	logging: {
-		enabled: boolean;
-		debug: boolean;
-	};
-	callbacks: {
-		onLoadMaterials: Function;
-	};
-	materials: object;
-
-	createDefaultMaterials( overrideExisting: boolean ): void;
-	addMaterials( materials: object, overrideExisting: boolean, newMaterials?: object ): object;
-	addPayloadMaterials( materialPayload: object ): object;
-	setLogging( enabled: boolean, debug: boolean ): void;
-	getMaterials(): object;
-	getMaterial( materialName: string ): Material;
-	getMaterialsJSON(): object;
-	clearMaterials(): void;
-
-}

+ 0 - 276
examples/jsm/loaders/obj2/shared/MaterialHandler.js

@@ -1,276 +0,0 @@
-/**
- * Development repository: https://github.com/kaisalmen/WWOBJLoader
- */
-
-import {
-	LineBasicMaterial,
-	MaterialLoader,
-	MeshStandardMaterial,
-	PointsMaterial
-} from '../../../../../build/three.module.js';
-
-
-const MaterialHandler = function () {
-
-	this.logging = {
-		enabled: false,
-		debug: false
-	};
-
-	this.callbacks = {
-		onLoadMaterials: null
-	};
-	this.materials = {};
-
-};
-
-MaterialHandler.prototype = {
-
-	constructor: MaterialHandler,
-
-	/**
-	 * Enable or disable logging in general (except warn and error), plus enable or disable debug logging.
-	 *
-	 * @param {boolean} enabled True or false.
-	 * @param {boolean} debug True or false.
-	 */
-	setLogging:	function ( enabled, debug ) {
-
-		this.logging.enabled = enabled === true;
-		this.logging.debug = debug === true;
-
-	},
-
-	_setCallbacks: function ( onLoadMaterials ) {
-
-		if ( onLoadMaterials !== undefined && onLoadMaterials !== null && onLoadMaterials instanceof Function ) {
-
-			this.callbacks.onLoadMaterials = onLoadMaterials;
-
-		}
-
-	},
-
-	/**
-	 * Creates default materials and adds them to the materials object.
-	 *
-	 * @param overrideExisting boolean Override existing material
-	 */
-	createDefaultMaterials: function ( overrideExisting ) {
-
-		const defaultMaterial = new MeshStandardMaterial( { color: 0xDCF1FF } );
-		defaultMaterial.name = 'defaultMaterial';
-
-		const defaultVertexColorMaterial = new MeshStandardMaterial( { color: 0xDCF1FF } );
-		defaultVertexColorMaterial.name = 'defaultVertexColorMaterial';
-		defaultVertexColorMaterial.vertexColors = true;
-
-		const defaultLineMaterial = new LineBasicMaterial();
-		defaultLineMaterial.name = 'defaultLineMaterial';
-
-		const defaultPointMaterial = new PointsMaterial( { size: 0.1 } );
-		defaultPointMaterial.name = 'defaultPointMaterial';
-
-		const runtimeMaterials = {};
-		runtimeMaterials[ defaultMaterial.name ] = defaultMaterial;
-		runtimeMaterials[ defaultVertexColorMaterial.name ] = defaultVertexColorMaterial;
-		runtimeMaterials[ defaultLineMaterial.name ] = defaultLineMaterial;
-		runtimeMaterials[ defaultPointMaterial.name ] = defaultPointMaterial;
-
-		this.addMaterials( runtimeMaterials, overrideExisting );
-
-	},
-
-	/**
-	 * Updates the materials with contained material objects (sync) or from alteration instructions (async).
-	 *
-	 * @param {Object} materialPayload Material update instructions
-	 * @returns {Object} Map of {@link Material}
-	 */
-	addPayloadMaterials: function ( materialPayload ) {
-
-		let material, materialName;
-		const materialCloneInstructions = materialPayload.materials.materialCloneInstructions;
-		let newMaterials = {};
-
-		if ( materialCloneInstructions !== undefined && materialCloneInstructions !== null ) {
-
-			let materialNameOrg = materialCloneInstructions.materialNameOrg;
-			materialNameOrg = ( materialNameOrg !== undefined && materialNameOrg !== null ) ? materialNameOrg : '';
-			const materialOrg = this.materials[ materialNameOrg ];
-			if ( materialOrg ) {
-
-				material = materialOrg.clone();
-
-				materialName = materialCloneInstructions.materialName;
-				material.name = materialName;
-
-				Object.assign( material, materialCloneInstructions.materialProperties );
-
-				this.materials[ materialName ] = material;
-				newMaterials[ materialName ] = material;
-
-			} else {
-
-				if ( this.logging.enabled ) {
-
-					console.info( 'Requested material "' + materialNameOrg + '" is not available!' );
-
-				}
-
-			}
-
-		}
-
-		let materials = materialPayload.materials.serializedMaterials;
-
-		if ( materials !== undefined && materials !== null && Object.keys( materials ).length > 0 ) {
-
-			const loader = new MaterialLoader();
-			let materialJson;
-
-			for ( materialName in materials ) {
-
-				materialJson = materials[ materialName ];
-
-				if ( materialJson !== undefined && materialJson !== null ) {
-
-					material = loader.parse( materialJson );
-
-					if ( this.logging.enabled ) {
-
-						console.info( 'De-serialized material with name "' + materialName + '" will be added.' );
-
-					}
-
-					this.materials[ materialName ] = material;
-					newMaterials[ materialName ] = material;
-
-				}
-
-			}
-
-		}
-
-		materials = materialPayload.materials.runtimeMaterials;
-		newMaterials = this.addMaterials( materials, true, newMaterials );
-
-		return newMaterials;
-
-	},
-
-	/**
-	 * Set materials loaded by any supplier of an Array of {@link Material}.
-	 *
-	 * @param materials Object with named {@link Material}
-	 * @param overrideExisting boolean Override existing material
-	 * @param newMaterials [Object] with named {@link Material}
-	 */
-	addMaterials: function ( materials, overrideExisting, newMaterials ) {
-
-		if ( newMaterials === undefined || newMaterials === null ) {
-
-			newMaterials = {};
-
-		}
-
-		if ( materials !== undefined && materials !== null && Object.keys( materials ).length > 0 ) {
-
-			let material;
-			let existingMaterial;
-			let add;
-
-			for ( const materialName in materials ) {
-
-				material = materials[ materialName ];
-				add = overrideExisting === true;
-
-				if ( ! add ) {
-
-					existingMaterial = this.materials[ materialName ];
-					add = ( existingMaterial === null || existingMaterial === undefined );
-
-				}
-
-				if ( add ) {
-
-					this.materials[ materialName ] = material;
-					newMaterials[ materialName ] = material;
-
-				}
-
-				if ( this.logging.enabled && this.logging.debug ) {
-
-					console.info( 'Material with name "' + materialName + '" was added.' );
-
-				}
-
-			}
-
-		}
-
-		if ( this.callbacks.onLoadMaterials ) {
-
-			this.callbacks.onLoadMaterials( newMaterials );
-
-		}
-
-		return newMaterials;
-
-	},
-
-	/**
-	 * Returns the mapping object of material name and corresponding material.
-	 *
-	 * @returns {Object} Map of {@link Material}
-	 */
-	getMaterials: function () {
-
-		return this.materials;
-
-	},
-
-	/**
-	 *
-	 * @param {String} materialName
-	 * @returns {Material}
-	 */
-	getMaterial: function ( materialName ) {
-
-		return this.materials[ materialName ];
-
-	},
-
-	/**
-	 * Returns the mapping object of material name and corresponding jsonified material.
-	 *
-	 * @returns {Object} Map of Materials in JSON representation
-	 */
-	getMaterialsJSON: function () {
-
-		const materialsJSON = {};
-		let material;
-
-		for ( const materialName in this.materials ) {
-
-			material = this.materials[ materialName ];
-			materialsJSON[ materialName ] = material.toJSON();
-
-		}
-
-		return materialsJSON;
-
-	},
-
-	/**
-	 * Removes all materials
-	 */
-	clearMaterials: function () {
-
-		this.materials = {};
-
-	}
-
-};
-
-export { MaterialHandler };

+ 0 - 23
examples/jsm/loaders/obj2/shared/MeshReceiver.d.ts

@@ -1,23 +0,0 @@
-import {
-	Mesh
-} from '../../../../../src/Three';
-
-import { MaterialHandler } from './MaterialHandler';
-
-export class MeshReceiver {
-
-	constructor( materialHandler: MaterialHandler );
-	logging: {
-		enabled: boolean;
-		debug: boolean;
-	};
-	callbacks: {
-		onParseProgress: Function;
-		onMeshAlter: Function;
-	};
-	materialHandler: MaterialHandler;
-
-	buildMeshes( meshPayload: object ): Mesh[];
-	setLogging( enabled: boolean, debug: boolean ): void;
-
-}

+ 0 - 313
examples/jsm/loaders/obj2/shared/MeshReceiver.js

@@ -1,313 +0,0 @@
-/**
- * Development repository: https://github.com/kaisalmen/WWOBJLoader
- */
-
-import {
-	BufferAttribute,
-	BufferGeometry,
-	LineSegments,
-	Mesh,
-	Points
-} from '../../../../../build/three.module.js';
-
-
-/**
- *
- * @param {MaterialHandler} materialHandler
- * @constructor
- */
-const MeshReceiver = function ( materialHandler ) {
-
-	this.logging = {
-		enabled: false,
-		debug: false
-	};
-
-	this.callbacks = {
-		onProgress: null,
-		onMeshAlter: null
-	};
-	this.materialHandler = materialHandler;
-
-};
-
-MeshReceiver.prototype = {
-
-	constructor: MeshReceiver,
-
-	/**
-	 * Enable or disable logging in general (except warn and error), plus enable or disable debug logging.
-	 *
-	 * @param {boolean} enabled True or false.
-	 * @param {boolean} debug True or false.
-	 */
-	setLogging:	function ( enabled, debug ) {
-
-		this.logging.enabled = enabled === true;
-		this.logging.debug = debug === true;
-
-	},
-
-	/**
-	 *
-	 * @param {Function} onProgress
-	 * @param {Function} onMeshAlter
-	 * @private
-	 */
-	_setCallbacks: function ( onProgress, onMeshAlter ) {
-
-		if ( onProgress !== null && onProgress !== undefined && onProgress instanceof Function ) {
-
-			this.callbacks.onProgress = onProgress;
-
-		}
-
-		if ( onMeshAlter !== null && onMeshAlter !== undefined && onMeshAlter instanceof Function ) {
-
-			this.callbacks.onMeshAlter = onMeshAlter;
-
-		}
-
-	},
-
-	/**
-	 * Builds one or multiple meshes from the data described in the payload (buffers, params, material info).
-	 *
-	 * @param {Object} meshPayload Raw mesh description (buffers, params, materials) used to build one to many meshes.
-	 * @returns {Mesh[]} mesh Array of {@link Mesh}
-	 */
-	buildMeshes: function ( meshPayload ) {
-
-		const meshName = meshPayload.params.meshName;
-		const buffers = meshPayload.buffers;
-
-		const bufferGeometry = new BufferGeometry();
-		if ( buffers.vertices !== undefined && buffers.vertices !== null ) {
-
-			bufferGeometry.setAttribute( 'position', new BufferAttribute( new Float32Array( buffers.vertices ), 3 ) );
-
-		}
-
-		if ( buffers.indices !== undefined && buffers.indices !== null ) {
-
-			bufferGeometry.setIndex( new BufferAttribute( new Uint32Array( buffers.indices ), 1 ) );
-
-		}
-
-		if ( buffers.colors !== undefined && buffers.colors !== null ) {
-
-			bufferGeometry.setAttribute( 'color', new BufferAttribute( new Float32Array( buffers.colors ), 3 ) );
-
-		}
-
-		if ( buffers.normals !== undefined && buffers.normals !== null ) {
-
-			bufferGeometry.setAttribute( 'normal', new BufferAttribute( new Float32Array( buffers.normals ), 3 ) );
-
-		} else {
-
-			bufferGeometry.computeVertexNormals();
-
-		}
-
-		if ( buffers.uvs !== undefined && buffers.uvs !== null ) {
-
-			bufferGeometry.setAttribute( 'uv', new BufferAttribute( new Float32Array( buffers.uvs ), 2 ) );
-
-		}
-
-		if ( buffers.skinIndex !== undefined && buffers.skinIndex !== null ) {
-
-			bufferGeometry.setAttribute( 'skinIndex', new BufferAttribute( new Uint16Array( buffers.skinIndex ), 4 ) );
-
-		}
-
-		if ( buffers.skinWeight !== undefined && buffers.skinWeight !== null ) {
-
-			bufferGeometry.setAttribute( 'skinWeight', new BufferAttribute( new Float32Array( buffers.skinWeight ), 4 ) );
-
-		}
-
-		let material, materialName, key;
-		const materialNames = meshPayload.materials.materialNames;
-		const createMultiMaterial = meshPayload.materials.multiMaterial;
-		const multiMaterials = [];
-
-		for ( key in materialNames ) {
-
-			materialName = materialNames[ key ];
-			material = this.materialHandler.getMaterial( materialName );
-			if ( createMultiMaterial ) multiMaterials.push( material );
-
-		}
-
-		if ( createMultiMaterial ) {
-
-			material = multiMaterials;
-			const materialGroups = meshPayload.materials.materialGroups;
-			let materialGroup;
-			for ( key in materialGroups ) {
-
-				materialGroup = materialGroups[ key ];
-				bufferGeometry.addGroup( materialGroup.start, materialGroup.count, materialGroup.index );
-
-			}
-
-		}
-
-		const meshes = [];
-		let mesh;
-		let callbackOnMeshAlterResult;
-		let useOrgMesh = true;
-		const geometryType = meshPayload.geometryType === null ? 0 : meshPayload.geometryType;
-
-		if ( this.callbacks.onMeshAlter ) {
-
-			callbackOnMeshAlterResult = this.callbacks.onMeshAlter(
-				{
-					detail: {
-						meshName: meshName,
-						bufferGeometry: bufferGeometry,
-						material: material,
-						geometryType: geometryType
-					}
-				}
-			);
-
-		}
-
-		// here LoadedMeshUserOverride is required to be provided by the callback used to alter the results
-		if ( callbackOnMeshAlterResult ) {
-
-			if ( callbackOnMeshAlterResult.isDisregardMesh() ) {
-
-				useOrgMesh = false;
-
-			} else if ( callbackOnMeshAlterResult.providesAlteredMeshes() ) {
-
-				for ( const i in callbackOnMeshAlterResult.meshes ) {
-
-					meshes.push( callbackOnMeshAlterResult.meshes[ i ] );
-
-				}
-
-				useOrgMesh = false;
-
-			}
-
-		}
-
-		if ( useOrgMesh ) {
-
-			if ( meshPayload.computeBoundingSphere ) bufferGeometry.computeBoundingSphere();
-			if ( geometryType === 0 ) {
-
-				mesh = new Mesh( bufferGeometry, material );
-
-			} else if ( geometryType === 1 ) {
-
-				mesh = new LineSegments( bufferGeometry, material );
-
-			} else {
-
-				mesh = new Points( bufferGeometry, material );
-
-			}
-
-			mesh.name = meshName;
-			meshes.push( mesh );
-
-		}
-
-		let progressMessage = meshPayload.params.meshName;
-		if ( meshes.length > 0 ) {
-
-			const meshNames = [];
-			for ( const i in meshes ) {
-
-				mesh = meshes[ i ];
-				meshNames[ i ] = mesh.name;
-
-			}
-
-			progressMessage += ': Adding mesh(es) (' + meshNames.length + ': ' + meshNames + ') from input mesh: ' + meshName;
-			progressMessage += ' (' + ( meshPayload.progress.numericalValue * 100 ).toFixed( 2 ) + '%)';
-
-		} else {
-
-			progressMessage += ': Not adding mesh: ' + meshName;
-			progressMessage += ' (' + ( meshPayload.progress.numericalValue * 100 ).toFixed( 2 ) + '%)';
-
-		}
-
-		if ( this.callbacks.onProgress ) {
-
-			this.callbacks.onProgress( 'progress', progressMessage, meshPayload.progress.numericalValue );
-
-		}
-
-		return meshes;
-
-	}
-
-};
-
-/**
- * Object to return by callback onMeshAlter. Used to disregard a certain mesh or to return one to many meshes.
- * @class
- *
- * @param {boolean} disregardMesh=false Tell implementation to completely disregard this mesh
- * @param {boolean} disregardMesh=false Tell implementation that mesh(es) have been altered or added
- */
-const LoadedMeshUserOverride = function ( disregardMesh, alteredMesh ) {
-
-	this.disregardMesh = disregardMesh === true;
-	this.alteredMesh = alteredMesh === true;
-	this.meshes = [];
-
-};
-
-
-LoadedMeshUserOverride.prototype = {
-
-	constructor: LoadedMeshUserOverride,
-
-	/**
-	 * Add a mesh created within callback.
-	 *
-	 * @param {Mesh} mesh
-	 */
-	addMesh: function ( mesh ) {
-
-		this.meshes.push( mesh );
-		this.alteredMesh = true;
-
-	},
-
-	/**
-	 * Answers if mesh shall be disregarded completely.
-	 *
-	 * @returns {boolean}
-	 */
-	isDisregardMesh: function () {
-
-		return this.disregardMesh;
-
-	},
-
-	/**
-	 * Answers if new mesh(es) were created.
-	 *
-	 * @returns {boolean}
-	 */
-	providesAlteredMeshes: function () {
-
-		return this.alteredMesh;
-
-	}
-};
-
-export {
-	MeshReceiver,
-	LoadedMeshUserOverride
-};

+ 0 - 22
examples/jsm/loaders/obj2/utils/CodeSerializer.d.ts

@@ -1,22 +0,0 @@
-export namespace CodeSerializer {
-
-	export function serializeClass( targetPrototype: object, targetPrototypeInstance: object, basePrototypeName?: string, overrideFunctions?: CodeSerializationInstruction[] ): string;
-
-}
-
-export class CodeSerializationInstruction {
-
-	constructor( name: string, fullName: string );
-	name: string;
-	fullName: string;
-	code: string;
-	removeCode: boolean;
-
-	getName(): string;
-	getFullName(): string;
-	setCode( code: string ): this;
-	getCode(): string;
-	setRemoveCode( removeCode: boolean ): this;
-	isRemoveCode(): boolean;
-
-}

+ 0 - 264
examples/jsm/loaders/obj2/utils/CodeSerializer.js

@@ -1,264 +0,0 @@
-/**
- * Development repository: https://github.com/kaisalmen/WWOBJLoader
- */
-
-const CodeSerializer = {
-
-	/**
-	 * Serialize an object with specific prototype definition.
-	 *
-	 * @param {Object} targetPrototype The object that should be serialized
-	 * @param {Object} targetPrototypeInstance An instance of the oriobject that should be serialized
-	 * @param {String} [basePrototypeName] Name of the prototype
-	 * @param {Object} [overrideFunctions} Array of {@Link CodeSerializationInstruction} allows to replace or remove function with provided content
-	 *
-	 * @returns {String}
-	 */
-	serializeClass: function ( targetPrototype, targetPrototypeInstance, basePrototypeName, overrideFunctions ) {
-
-		let objectPart, constructorString, i, funcInstructions, funcTemp;
-		const fullObjectName = targetPrototypeInstance.constructor.name;
-		const prototypeFunctions = [];
-		const objectProperties = [];
-		const objectFunctions = [];
-		const isExtended = ( basePrototypeName !== null && basePrototypeName !== undefined );
-
-		if ( ! Array.isArray( overrideFunctions ) ) overrideFunctions = [];
-
-		for ( const name in targetPrototype.prototype ) {
-
-			objectPart = targetPrototype.prototype[ name ];
-			funcInstructions = new CodeSerializationInstruction( name, fullObjectName + '.prototype.' + name );
-			funcInstructions.setCode( objectPart.toString() );
-
-			if ( name === 'constructor' ) {
-
-				if ( ! funcInstructions.isRemoveCode() ) {
-
-					constructorString = fullObjectName + ' = ' + funcInstructions.getCode() + ';\n\n';
-
-				}
-
-			} else if ( typeof objectPart === 'function' ) {
-
-				funcTemp = overrideFunctions[ name ];
-
-				if ( funcTemp instanceof CodeSerializationInstruction && funcTemp.getName() === funcInstructions.getName() ) {
-
-					funcInstructions = funcTemp;
-
-				}
-
-				if ( ! funcInstructions.isRemoveCode() ) {
-
-					if ( isExtended ) {
-
-						prototypeFunctions.push( funcInstructions.getFullName() + ' = ' + funcInstructions.getCode() + ';\n\n' );
-
-					} else {
-
-						prototypeFunctions.push( '\t' + funcInstructions.getName() + ': ' + funcInstructions.getCode() + ',\n\n' );
-
-					}
-
-				}
-
-			}
-
-		}
-
-		for ( const name in targetPrototype ) {
-
-			objectPart = targetPrototype[ name ];
-			funcInstructions = new CodeSerializationInstruction( name, fullObjectName + '.' + name );
-
-			if ( typeof objectPart === 'function' ) {
-
-				funcTemp = overrideFunctions[ name ];
-				if ( funcTemp instanceof CodeSerializationInstruction && funcTemp.getName() === funcInstructions.getName() ) {
-
-					funcInstructions = funcTemp;
-
-				} else {
-
-					funcInstructions.setCode( objectPart.toString() );
-
-				}
-
-				if ( ! funcInstructions.isRemoveCode() ) {
-
-					objectFunctions.push( funcInstructions.getFullName() + ' = ' + funcInstructions.getCode() + ';\n\n' );
-
-				}
-
-			} else {
-
-				if ( typeof ( objectPart ) === 'string' || objectPart instanceof String ) {
-
-					funcInstructions.setCode( '\"' + objectPart.toString() + '\"' );
-
-				} else if ( typeof objectPart === 'object' ) {
-
-					console.log( 'Omitting object "' + funcInstructions.getName() + '" and replace it with empty object.' );
-					funcInstructions.setCode( '{}' );
-
-				} else {
-
-					funcInstructions.setCode( objectPart );
-
-				}
-
-				if ( ! funcInstructions.isRemoveCode() ) {
-
-					objectProperties.push( funcInstructions.getFullName() + ' = ' + funcInstructions.getCode() + ';\n' );
-
-				}
-
-			}
-
-		}
-
-		let objectString = constructorString + '\n\n';
-
-		if ( isExtended ) {
-
-			objectString += fullObjectName + '.prototype = Object.create( ' + basePrototypeName + '.prototype );\n';
-
-		}
-
-		objectString += fullObjectName + '.prototype.constructor = ' + fullObjectName + ';\n';
-		objectString += '\n\n';
-
-		for ( i = 0; i < objectProperties.length; i ++ ) {
-
-			objectString += objectProperties[ i ];
-
-		}
-
-		objectString += '\n\n';
-
-		for ( i = 0; i < objectFunctions.length; i ++ ) {
-
-			objectString += objectFunctions[ i ];
-
-		}
-
-		objectString += '\n\n';
-
-		if ( isExtended ) {
-
-			for ( i = 0; i < prototypeFunctions.length; i ++ ) {
-
-				objectString += prototypeFunctions[ i ];
-
-			}
-
-		} else {
-
-			objectString += fullObjectName + '.prototype = {\n\n';
-			for ( i = 0; i < prototypeFunctions.length; i ++ ) {
-
-				objectString += prototypeFunctions[ i ];
-
-			}
-
-			objectString += '\n};';
-
-		}
-
-		objectString += '\n\n';
-
-		return objectString;
-
-	},
-};
-
-/**
- * Allows to define instructions to override or remove
- * @param {String} name Usually the name of a function
- * @param {String} fullName The name plus full object description
- * @constructor
- */
-const CodeSerializationInstruction = function ( name, fullName ) {
-
-	this.name = name;
-	this.fullName = fullName;
-	this.code = null;
-	this.removeCode = false;
-
-};
-
-CodeSerializationInstruction.prototype = {
-
-	constructor: CodeSerializationInstruction,
-
-	/**
-	 * Returns the name of the function
-	 * @return {String}
-	 */
-	getName: function () {
-
-		return this.name;
-
-	},
-
-	/**
-	 * Returns the full name of the function
-	 * @return {String}
-	 */
-	getFullName: function () {
-
-		return this.fullName;
-
-	},
-
-	/**
-	 * Set the string containing the serialized function
-	 * @param {String} code
-	 * @return {CodeSerializationInstruction}
-	 */
-	setCode: function ( code ) {
-
-		this.code = code;
-		return this;
-
-	},
-
-	/**
-	 * Returns the serialized function code
-	 * @return {String}
-	 */
-	getCode: function () {
-
-		return this.code;
-
-	},
-
-	/**
-	 * Set if function should be removed
-	 * @param {boolean} removeCode
-	 * @return {CodeSerializationInstruction}
-	 */
-	setRemoveCode: function ( removeCode ) {
-
-		this.removeCode = removeCode;
-		return this;
-
-	},
-
-	/**
-	 * If function should be completely removed
-	 * @return {boolean}
-	 */
-	isRemoveCode: function () {
-
-		return this.removeCode;
-
-	}
-
-};
-
-export {
-	CodeSerializer,
-	CodeSerializationInstruction
-};

+ 0 - 63
examples/jsm/loaders/obj2/worker/main/WorkerExecutionSupport.d.ts

@@ -1,63 +0,0 @@
-export class CodeBuilderInstructions {
-
-	constructor( supportsStandardWorker: boolean, supportsJsmWorker: boolean, preferJsmWorker: boolean );
-	supportsStandardWorker: boolean;
-	supportsJsmWorker: boolean;
-	preferJsmWorker: boolean;
-	startCode: string;
-	codeFragments: string[];
-	importStatements: string[];
-	jsmWorkerFile: string;
-	defaultGeometryType: number;
-
-	isSupportsStandardWorker(): boolean;
-	isSupportsJsmWorker(): boolean;
-	isPreferJsmWorker(): boolean;
-	setJsmWorkerUrl( jsmWorkerUrl: string ): void;
-	addStartCode( startCode: string ): void;
-	addCodeFragment( code: string ): void;
-	addLibraryImport( libraryPath: string ): void;
-	getImportStatements(): string[];
-	getCodeFragments(): string[];
-	getStartCode(): string;
-
-}
-
-export class WorkerExecutionSupport {
-
-	constructor();
-
-	logging: {
-		enabled: boolean;
-		debug: boolean;
-	};
-
-	worker: {
-		native: Worker;
-		jsmWorker: boolean;
-		logging: boolean;
-		workerRunner: {
-			name: string;
-			usesMeshDisassembler: boolean;
-			defaultGeometryType: number;
-		};
-		terminateWorkerOnLoad: boolean;
-		forceWorkerDataCopy: boolean;
-		started: boolean;
-		queuedMessage: object;
-		callbacks: {
-			onAssetAvailable: Function;
-			onLoad: Function;
-			terminate: Function;
-		};
-	};
-
-	setLogging( enabled: boolean, debug: boolean ): this;
-	setForceWorkerDataCopy( forceWorkerDataCopy: boolean ): this;
-	setTerminateWorkerOnLoad( terminateWorkerOnLoad: boolean ): this;
-	updateCallbacks( onAssetAvailable: Function, onLoad: Function ): void;
-	buildWorker( codeBuilderInstructions: CodeBuilderInstructions ): void;
-	isWorkerLoaded( requireJsmWorker: boolean ): boolean;
-	executeParallel( payload:object, transferables?: object[] ): void;
-
-}

+ 0 - 584
examples/jsm/loaders/obj2/worker/main/WorkerExecutionSupport.js

@@ -1,584 +0,0 @@
-/**
- * Development repository: https://github.com/kaisalmen/WWOBJLoader
- */
-
-/**
- * These instructions are used by {WorkerExecutionSupport} to build code for the web worker or to assign code
- *
- * @param {boolean} supportsStandardWorker
- * @param {boolean} supportsJsmWorker
- * @constructor
- */
-const CodeBuilderInstructions = function ( supportsStandardWorker, supportsJsmWorker, preferJsmWorker ) {
-
-	this.supportsStandardWorker = supportsStandardWorker;
-	this.supportsJsmWorker = supportsJsmWorker;
-	this.preferJsmWorker = preferJsmWorker;
-	this.startCode = '';
-	this.codeFragments = [];
-	this.importStatements = [];
-
-	this.jsmWorkerUrl = null;
-	this.defaultGeometryType = 0;
-
-};
-
-CodeBuilderInstructions.prototype = {
-
-	constructor: CodeBuilderInstructions,
-
-	isSupportsStandardWorker: function () {
-
-		return this.supportsStandardWorker;
-
-	},
-
-	isSupportsJsmWorker: function () {
-
-		return this.supportsJsmWorker;
-
-	},
-
-	isPreferJsmWorker: function () {
-
-		return this.preferJsmWorker;
-
-	},
-
-	/**
-	 * Set the full path to the module that contains the worker code.
-	 *
-	 * @param {String} jsmWorkerUrl
-	 */
-	setJsmWorkerUrl: function ( jsmWorkerUrl ) {
-
-		if ( jsmWorkerUrl !== undefined && jsmWorkerUrl !== null ) {
-
-			this.jsmWorkerUrl = jsmWorkerUrl;
-
-		}
-
-	},
-
-	/**
-	 * Add code that is contained in addition to fragments and libraries
-	 * @param {String} startCode
-	 */
-	addStartCode: function ( startCode ) {
-
-		this.startCode = startCode;
-
-	},
-
-	/**
-	 * Add code fragment that is included in the provided order
-	 * @param {String} code
-	 */
-	addCodeFragment: function ( code ) {
-
-		this.codeFragments.push( code );
-
-	},
-
-	/**
-	 * Add full path to a library that is contained at the start of the worker via "importScripts"
-	 * @param {String} libraryPath
-	 */
-	addLibraryImport: function ( libraryPath ) {
-
-		const libraryUrl = new URL( libraryPath, window.location.href ).href;
-		const code = 'importScripts( "' + libraryUrl + '" );';
-		this.importStatements.push(	code );
-
-	},
-
-	getImportStatements: function () {
-
-		return this.importStatements;
-
-	},
-
-	getCodeFragments: function () {
-
-		return this.codeFragments;
-
-	},
-
-	getStartCode: function () {
-
-		return this.startCode;
-
-	}
-
-};
-/**
- * This class provides means to transform existing parser code into a web worker. It defines a simple communication protocol
- * which allows to configure the worker and receive raw mesh data during execution.
- * @class
- */
-const WorkerExecutionSupport = function () {
-
-	// check worker support first
-	if ( window.Worker === undefined ) throw 'This browser does not support web workers!';
-	if ( window.Blob === undefined ) throw 'This browser does not support Blob!';
-	if ( typeof window.URL.createObjectURL !== 'function' ) throw 'This browser does not support Object creation from URL!';
-
-	this._reset();
-
-};
-
-WorkerExecutionSupport.WORKER_SUPPORT_VERSION = '3.2.0';
-console.info( 'Using WorkerSupport version: ' + WorkerExecutionSupport.WORKER_SUPPORT_VERSION );
-
-
-WorkerExecutionSupport.prototype = {
-
-	constructor: WorkerExecutionSupport,
-
-	_reset: function () {
-
-		this.logging = {
-			enabled: false,
-			debug: false
-		};
-
-		const scope = this;
-		const scopeTerminate = function ( ) {
-
-			scope._terminate();
-
-		};
-
-		this.worker = {
-			native: null,
-			jsmWorker: false,
-			logging: true,
-			workerRunner: {
-				name: 'WorkerRunner',
-				usesMeshDisassembler: false,
-				defaultGeometryType: 0
-			},
-			terminateWorkerOnLoad: true,
-			forceWorkerDataCopy: false,
-			started: false,
-			queuedMessage: null,
-			callbacks: {
-				onAssetAvailable: null,
-				onLoad: null,
-				terminate: scopeTerminate
-			}
-		};
-
-	},
-
-	/**
-	 * Enable or disable logging in general (except warn and error), plus enable or disable debug logging.
-	 *
-	 * @param {boolean} enabled True or false.
-	 * @param {boolean} debug True or false.
-	 */
-	setLogging: function ( enabled, debug ) {
-
-		this.logging.enabled = enabled === true;
-		this.logging.debug = debug === true;
-		this.worker.logging = enabled === true;
-		return this;
-
-	},
-
-	/**
-	 * Forces all ArrayBuffers to be transferred to worker to be copied.
-	 *
-	 * @param {boolean} forceWorkerDataCopy True or false.
-	 */
-	setForceWorkerDataCopy: function ( forceWorkerDataCopy ) {
-
-		this.worker.forceWorkerDataCopy = forceWorkerDataCopy === true;
-		return this;
-
-	},
-
-	/**
-	 * Request termination of worker once parser is finished.
-	 *
-	 * @param {boolean} terminateWorkerOnLoad True or false.
-	 */
-	setTerminateWorkerOnLoad: function ( terminateWorkerOnLoad ) {
-
-		this.worker.terminateWorkerOnLoad = terminateWorkerOnLoad === true;
-		if ( this.worker.terminateWorkerOnLoad && this.isWorkerLoaded( this.worker.jsmWorker ) &&
-				this.worker.queuedMessage === null && this.worker.started ) {
-
-			if ( this.logging.enabled ) {
-
-				console.info( 'Worker is terminated immediately as it is not running!' );
-
-			}
-
-			this._terminate();
-
-		}
-
-		return this;
-
-	},
-
-	/**
-	 * Update all callbacks.
-	 *
-	 * @param {Function} onAssetAvailable The function for processing the data, e.g. {@link MeshReceiver}.
-	 * @param {Function} [onLoad] The function that is called when parsing is complete.
-	 */
-	updateCallbacks: function ( onAssetAvailable, onLoad ) {
-
-		if ( onAssetAvailable !== undefined && onAssetAvailable !== null ) {
-
-			this.worker.callbacks.onAssetAvailable = onAssetAvailable;
-
-		}
-
-		if ( onLoad !== undefined && onLoad !== null ) {
-
-			this.worker.callbacks.onLoad = onLoad;
-
-		}
-
-		this._verifyCallbacks();
-
-	},
-
-	_verifyCallbacks: function () {
-
-		if ( this.worker.callbacks.onAssetAvailable === undefined || this.worker.callbacks.onAssetAvailable === null ) {
-
-			throw 'Unable to run as no "onAssetAvailable" callback is set.';
-
-		}
-
-	},
-
-	/**
-	 * Builds the worker code according the provided Instructions.
-	 * If jsm worker code shall be built, then function may fall back to standard if lag is set
-	 *
- 	 * @param {CodeBuilderInstructions} codeBuilderInstructions
-	 */
-	buildWorker: function ( codeBuilderInstructions ) {
-
-		let jsmSuccess = false;
-
-		if ( codeBuilderInstructions.isSupportsJsmWorker() && codeBuilderInstructions.isPreferJsmWorker() ) {
-
-			jsmSuccess = this._buildWorkerJsm( codeBuilderInstructions );
-
-		}
-
-		if ( ! jsmSuccess && codeBuilderInstructions.isSupportsStandardWorker() ) {
-
-			this._buildWorkerStandard( codeBuilderInstructions );
-
-		}
-
-	},
-
-	/**
-	 *
-	 * @param {CodeBuilderInstructions} codeBuilderInstructions
-	 * @return {boolean} Whether loading of jsm worker was successful
-	 * @private
-	 */
-	_buildWorkerJsm: function ( codeBuilderInstructions ) {
-
-		let jsmSuccess = true;
-		const timeLabel = 'buildWorkerJsm';
-		const workerAvailable = this._buildWorkerCheckPreconditions( true, timeLabel );
-		if ( ! workerAvailable ) {
-
-			try {
-
-				const worker = new Worker( codeBuilderInstructions.jsmWorkerUrl.href, { type: 'module' } );
-				this._configureWorkerCommunication( worker, true, codeBuilderInstructions.defaultGeometryType, timeLabel );
-
-			} catch ( e ) {
-
-				jsmSuccess = false;
-				// Chrome throws this exception, but Firefox currently does not complain, but can't execute the worker afterwards
-				if ( e instanceof TypeError || e instanceof SyntaxError ) {
-
-					console.error( 'Modules are not supported in workers.' );
-
-				}
-
-			}
-
-		}
-
-		return jsmSuccess;
-
-	},
-
-	/**
-	 * Validate the status of worker code and the derived worker and specify functions that should be build when new raw mesh data becomes available and when the parser is finished.
-	 *
-	 * @param {CodeBuilderIns} buildWorkerCode The function that is invoked to create the worker code of the parser.
-	 */
-
-	/**
-	 *
-	 * @param {CodeBuilderInstructions} codeBuilderInstructions
-	 * @private
-	 */
-	_buildWorkerStandard: function ( codeBuilderInstructions ) {
-
-		const timeLabel = 'buildWorkerStandard';
-		const workerAvailable = this._buildWorkerCheckPreconditions( false, timeLabel );
-		if ( ! workerAvailable ) {
-
-			let concatenateCode = '';
-			codeBuilderInstructions.getImportStatements().forEach( function ( element ) {
-
-				concatenateCode += element + '\n';
-
-			} );
-			concatenateCode += '\n';
-			codeBuilderInstructions.getCodeFragments().forEach( function ( element ) {
-
-				concatenateCode += element + '\n';
-
-			} );
-			concatenateCode += '\n';
-			concatenateCode += codeBuilderInstructions.getStartCode();
-
-			const blob = new Blob( [ concatenateCode ], { type: 'application/javascript' } );
-			const worker = new Worker( window.URL.createObjectURL( blob ) );
-
-			this._configureWorkerCommunication( worker, false, codeBuilderInstructions.defaultGeometryType, timeLabel );
-
-		}
-
-	},
-
-	_buildWorkerCheckPreconditions: function ( requireJsmWorker, timeLabel ) {
-
-		let workerAvailable = false;
-		if ( this.isWorkerLoaded( requireJsmWorker ) ) {
-
-			workerAvailable = true;
-
-		} else {
-
-			if ( this.logging.enabled ) {
-
-				console.info( 'WorkerExecutionSupport: Building ' + ( requireJsmWorker ? 'jsm' : 'standard' ) + ' worker code...' );
-				console.time( timeLabel );
-
-			}
-
-		}
-
-		return workerAvailable;
-
-	},
-
-	_configureWorkerCommunication: function ( worker, haveJsmWorker, defaultGeometryType, timeLabel ) {
-
-		this.worker.native = worker;
-		this.worker.jsmWorker = haveJsmWorker;
-
-		const scope = this;
-		const scopedReceiveWorkerMessage = function ( event ) {
-
-			scope._receiveWorkerMessage( event );
-
-		};
-
-		this.worker.native.onmessage = scopedReceiveWorkerMessage;
-		this.worker.native.onerror = scopedReceiveWorkerMessage;
-		if ( defaultGeometryType !== undefined && defaultGeometryType !== null ) {
-
-			this.worker.workerRunner.defaultGeometryType = defaultGeometryType;
-
-		}
-
-		if ( this.logging.enabled ) {
-
-			console.timeEnd( timeLabel );
-
-		}
-
-	},
-
-	/**
-	 * Returns if Worker code is available and complies with expectation.
-	 * @param {boolean} requireJsmWorker
-	 * @return {boolean|*}
-	 */
-	isWorkerLoaded: function ( requireJsmWorker ) {
-
-		return this.worker.native !== null &&
-			( ( requireJsmWorker && this.worker.jsmWorker ) || ( ! requireJsmWorker && ! this.worker.jsmWorker ) );
-
-	},
-
-	/**
-	 * Executed in worker scope
-	 */
-	_receiveWorkerMessage: function ( event ) {
-
-		// fast-fail in case of error
-		if ( event.type === 'error' ) {
-
-			console.error( event );
-			return;
-
-		}
-
-		const payload = event.data;
-		const workerRunnerName = this.worker.workerRunner.name;
-		switch ( payload.cmd ) {
-
-			case 'assetAvailable':
-				this.worker.callbacks.onAssetAvailable( payload );
-				break;
-
-			case 'completeOverall':
-				this.worker.queuedMessage = null;
-				this.worker.started = false;
-				if ( this.worker.callbacks.onLoad !== null ) {
-
-					this.worker.callbacks.onLoad( payload.msg );
-
-				}
-
-				if ( this.worker.terminateWorkerOnLoad ) {
-
-					if ( this.worker.logging.enabled ) {
-
-						console.info( 'WorkerSupport [' + workerRunnerName + ']: Run is complete. Terminating application on request!' );
-
-					}
-
-					this.worker.callbacks.terminate();
-
-				}
-
-				break;
-
-			case 'error':
-				console.error( 'WorkerSupport [' + workerRunnerName + ']: Reported error: ' + payload.msg );
-				this.worker.queuedMessage = null;
-				this.worker.started = false;
-				if ( this.worker.callbacks.onLoad !== null ) {
-
-					this.worker.callbacks.onLoad( payload.msg );
-
-				}
-
-				if ( this.worker.terminateWorkerOnLoad ) {
-
-					if ( this.worker.logging.enabled ) {
-
-						console.info( 'WorkerSupport [' + workerRunnerName + ']: Run reported error. Terminating application on request!' );
-
-					}
-
-					this.worker.callbacks.terminate();
-
-				}
-
-				break;
-
-			default:
-				console.error( 'WorkerSupport [' + workerRunnerName + ']: Received unknown command: ' + payload.cmd );
-				break;
-
-		}
-
-	},
-
-	/**
-	 * Runs the parser with the provided configuration.
-	 *
-	 * @param {Object} payload Raw mesh description (buffers, params, materials) used to build one to many meshes.
-	 */
-	executeParallel: function ( payload, transferables ) {
-
-		payload.cmd = 'parse';
-		payload.usesMeshDisassembler = this.worker.workerRunner.usesMeshDisassembler;
-		payload.defaultGeometryType = this.worker.workerRunner.defaultGeometryType;
-		if ( ! this._verifyWorkerIsAvailable( payload, transferables ) ) return;
-
-		this._postMessage();
-
-	},
-
-	_verifyWorkerIsAvailable: function ( payload, transferables ) {
-
-		this._verifyCallbacks();
-		let ready = true;
-		if ( this.worker.queuedMessage !== null ) {
-
-			console.warn( 'Already processing message. Rejecting new run instruction' );
-			ready = false;
-
-		} else {
-
-			this.worker.queuedMessage = {
-				payload: payload,
-				transferables: ( transferables === undefined || transferables === null ) ? [] : transferables
-			};
-			this.worker.started = true;
-
-		}
-
-		return ready;
-
-	},
-
-	_postMessage: function () {
-
-		if ( this.worker.queuedMessage !== null ) {
-
-			if ( this.worker.queuedMessage.payload.data.input instanceof ArrayBuffer ) {
-
-				let transferables = [];
-				if ( this.worker.forceWorkerDataCopy ) {
-
-					transferables.push( this.worker.queuedMessage.payload.data.input.slice( 0 ) );
-
-				} else {
-
-					transferables.push( this.worker.queuedMessage.payload.data.input );
-
-				}
-
-				if ( this.worker.queuedMessage.transferables.length > 0 ) {
-
-					transferables = transferables.concat( this.worker.queuedMessage.transferables );
-
-				}
-
-				this.worker.native.postMessage( this.worker.queuedMessage.payload, transferables );
-
-			} else {
-
-				this.worker.native.postMessage( this.worker.queuedMessage.payload );
-
-			}
-
-		}
-
-	},
-
-	_terminate: function () {
-
-		this.worker.native.terminate();
-		this._reset();
-
-	}
-};
-
-export {
-	CodeBuilderInstructions,
-	WorkerExecutionSupport
-};

+ 0 - 12
examples/jsm/loaders/obj2/worker/parallel/OBJLoader2JsmWorker.js

@@ -1,12 +0,0 @@
-/**
- * Development repository: https://github.com/kaisalmen/WWOBJLoader
- */
-
-import { OBJLoader2Parser } from '../../OBJLoader2Parser.js';
-
-import {
-	WorkerRunner,
-	DefaultWorkerPayloadHandler
-} from './WorkerRunner.js';
-
-new WorkerRunner( new DefaultWorkerPayloadHandler( new OBJLoader2Parser() ) );

+ 0 - 29
examples/jsm/loaders/obj2/worker/parallel/WorkerRunner.d.ts

@@ -1,29 +0,0 @@
-export class ObjectManipulator {
-
-	constructor();
-
-	applyProperties( objToAlter: object, params: object, forceCreation: boolean ): void;
-
-}
-
-export class DefaultWorkerPayloadHandler {
-
-	constructor( parser: object );
-	logging: {
-		enabled: boolean;
-		debug: boolean;
-	};
-	parser: object;
-
-	handlePayload( payload: object ): void;
-
-}
-
-export class WorkerRunner {
-
-	constructor( payloadHandler: object );
-	payloadHandler: object;
-
-	processMessage( payload: object ): void;
-
-}

+ 0 - 165
examples/jsm/loaders/obj2/worker/parallel/WorkerRunner.js

@@ -1,165 +0,0 @@
-/**
- * Development repository: https://github.com/kaisalmen/WWOBJLoader
- */
-
-const ObjectManipulator = function () {
-};
-
-ObjectManipulator.prototype = {
-
-	constructor: ObjectManipulator,
-
-	/**
-	 * Applies values from parameter object via set functions or via direct assignment.
-	 *
-	 * @param {Object} objToAlter The objToAlter instance
-	 * @param {Object} params The parameter object
-	 * @param {boolean} forceCreation Force the creation of a property
-	 */
-	applyProperties: function ( objToAlter, params, forceCreation ) {
-
-		// fast-fail
-		if ( objToAlter === undefined || objToAlter === null || params === undefined || params === null ) return;
-
-		let property, funcName, values;
-		for ( property in params ) {
-
-			funcName = 'set' + property.substring( 0, 1 ).toLocaleUpperCase() + property.substring( 1 );
-			values = params[ property ];
-
-			if ( typeof objToAlter[ funcName ] === 'function' ) {
-
-				objToAlter[ funcName ]( values );
-
-			} else if ( objToAlter.hasOwnProperty( property ) || forceCreation ) {
-
-				objToAlter[ property ] = values;
-
-			}
-
-		}
-
-	}
-};
-
-const DefaultWorkerPayloadHandler = function ( parser ) {
-
-	this.parser = parser;
-	this.logging = {
-		enabled: false,
-		debug: false
-	};
-
-};
-
-DefaultWorkerPayloadHandler.prototype = {
-
-	constructor: DefaultWorkerPayloadHandler,
-
-	handlePayload: function ( payload ) {
-
-		if ( payload.logging ) {
-
-			this.logging.enabled = payload.logging.enabled === true;
-			this.logging.debug = payload.logging.debug === true;
-
-		}
-
-		if ( payload.cmd === 'parse' ) {
-
-			const scope = this;
-			const callbacks = {
-				callbackOnAssetAvailable: function ( payload ) {
-
-					self.postMessage( payload );
-
-				},
-				callbackOnProgress: function ( text ) {
-
-					if ( scope.logging.enabled && scope.logging.debug ) console.debug( 'WorkerRunner: progress: ' + text );
-
-				}
-			};
-
-			const parser = this.parser;
-			if ( typeof parser[ 'setLogging' ] === 'function' ) {
-
-				parser.setLogging( this.logging.enabled, this.logging.debug );
-
-			}
-
-			const objectManipulator = new ObjectManipulator();
-			objectManipulator.applyProperties( parser, payload.params, false );
-			objectManipulator.applyProperties( parser, callbacks, false );
-
-			const arraybuffer = payload.data.input;
-			let executeFunctionName = 'execute';
-			if ( typeof parser.getParseFunctionName === 'function' ) executeFunctionName = parser.getParseFunctionName();
-			if ( payload.usesMeshDisassembler ) {
-
-				// TODO: Allow to plug and use generic MeshDisassembler
-
-			} else {
-
-				parser[ executeFunctionName ]( arraybuffer, payload.data.options );
-
-			}
-
-			if ( this.logging.enabled ) console.log( 'WorkerRunner: Run complete!' );
-
-			self.postMessage( {
-				cmd: 'completeOverall',
-				msg: 'WorkerRunner completed run.'
-			} );
-
-		} else {
-
-			console.error( 'WorkerRunner: Received unknown command: ' + payload.cmd );
-
-		}
-
-	}
-};
-
-
-/**
- * Default implementation of the WorkerRunner responsible for creation and configuration of the parser within the worker.
- * @constructor
- */
-const WorkerRunner = function ( payloadHandler ) {
-
-	this.payloadHandler = payloadHandler;
-
-	const scope = this;
-	const scopedRunner = function ( event ) {
-
-		scope.processMessage( event.data );
-
-	};
-
-	self.addEventListener( 'message', scopedRunner, false );
-
-};
-
-WorkerRunner.prototype = {
-
-	constructor: WorkerRunner,
-
-	/**
-	 * Configures the Parser implementation according the supplied configuration object.
-	 *
-	 * @param {Object} payload Raw mesh description (buffers, params, materials) used to build one to many meshes.
-	 */
-	processMessage: function ( payload ) {
-
-		this.payloadHandler.handlePayload( payload );
-
-	}
-
-};
-
-export {
-	WorkerRunner,
-	DefaultWorkerPayloadHandler,
-	ObjectManipulator
-};

+ 0 - 281
examples/models/obj/verify/gulpfile.js

@@ -1,281 +0,0 @@
-
-'use strict';
-
-var fs = require( 'fs' );
-
-var gulp = require( 'gulp' );
-var gutil = require( 'gulp-util' );
-
-
-var obj_verify = {
-	vertices: [],
-	normals: [],
-	uvs: [],
-	facesV: [],
-	facesVn: [],
-	facesVt: [],
-	materials: []
-};
-
-obj_verify.vertices.push( [ - 1, 1, 1 ] );
-obj_verify.vertices.push( [ - 1, - 1, 1 ] );
-obj_verify.vertices.push( [ 1, - 1, 1 ] );
-obj_verify.vertices.push( [ 1, 1, 1 ] );
-obj_verify.vertices.push( [ - 1, 1, - 1 ] );
-obj_verify.vertices.push( [ - 1, - 1, - 1 ] );
-obj_verify.vertices.push( [ 1, - 1, - 1 ] );
-obj_verify.vertices.push( [ 1, 1, - 1 ] );
-
-obj_verify.normals.push( [ 0, 0, 1 ] );
-obj_verify.normals.push( [ 0, 0, - 1 ] );
-obj_verify.normals.push( [ 0, 1, 0 ] );
-obj_verify.normals.push( [ 0, - 1, 0 ] );
-obj_verify.normals.push( [ 1, 0, 0 ] );
-obj_verify.normals.push( [ - 1, 0, 0 ] );
-
-obj_verify.uvs.push( [ 0, 1 ] );
-obj_verify.uvs.push( [ 1, 1 ] );
-obj_verify.uvs.push( [ 1, 0 ] );
-obj_verify.uvs.push( [ 0, 0 ] );
-
-obj_verify.facesV.push( [ 1, 2, 3, 4 ] );
-obj_verify.facesV.push( [ 8, 7, 6, 5 ] );
-obj_verify.facesV.push( [ 4, 3, 7, 8 ] );
-obj_verify.facesV.push( [ 5, 1, 4, 8 ] );
-obj_verify.facesV.push( [ 5, 6, 2, 1 ] );
-obj_verify.facesV.push( [ 2, 6, 7, 3 ] );
-
-obj_verify.facesVn.push( [ 1, 1, 1, 1 ] );
-obj_verify.facesVn.push( [ 2, 2, 2, 2 ] );
-obj_verify.facesVn.push( [ 5, 5, 5, 5 ] );
-obj_verify.facesVn.push( [ 3, 3, 3, 3 ] );
-obj_verify.facesVn.push( [ 6, 6, 6, 6 ] );
-obj_verify.facesVn.push( [ 4, 4, 4, 4 ] );
-
-obj_verify.facesVt.push( [ 1, 2, 3, 4 ] );
-obj_verify.facesVt.push( [ 1, 2, 3, 4 ] );
-obj_verify.facesVt.push( [ 1, 2, 3, 4 ] );
-obj_verify.facesVt.push( [ 1, 2, 3, 4 ] );
-obj_verify.facesVt.push( [ 1, 2, 3, 4 ] );
-obj_verify.facesVt.push( [ 1, 2, 3, 4 ] );
-
-obj_verify.materials.push( 'usemtl red' );
-obj_verify.materials.push( 'usemtl blue' );
-obj_verify.materials.push( 'usemtl green' );
-obj_verify.materials.push( 'usemtl lightblue' );
-obj_verify.materials.push( 'usemtl orange' );
-obj_verify.materials.push( 'usemtl purple' );
-
-
-function vobjCreateVertices( factor, offsets ) {
-
-	var output = '\n';
-	for ( var x, y, z, i = 0, v = obj_verify.vertices, length = v.length; i < length; i ++ ) {
-
-		x = v[ i ][ 0 ] * factor + offsets[ 0 ];
-		y = v[ i ][ 1 ] * factor + offsets[ 1 ];
-		z = v[ i ][ 2 ] * factor + offsets[ 2 ];
-		output += 'v ' + x + ' ' + y + ' ' + z + '\n';
-
-	}
-	return output;
-
-}
-
-function vobjCreateUvs() {
-
-	var output = '\n';
-	for ( var x, y, i = 0, vn = obj_verify.uvs, length = vn.length; i < length; i ++ ) {
-
-		x = vn[ i ][ 0 ];
-		y = vn[ i ][ 1 ];
-		output += 'vt ' + x + ' ' + y + '\n';
-
-	}
-	return output;
-
-}
-
-function vobjCreateNormals() {
-
-	var output = '\n';
-	for ( var x, y, z, i = 0, vn = obj_verify.normals, length = vn.length; i < length; i ++ ) {
-
-		x = vn[ i ][ 0 ];
-		y = vn[ i ][ 1 ];
-		z = vn[ i ][ 2 ];
-		output += 'vn ' + x + ' ' + y + ' ' + z + '\n';
-
-	}
-	return output;
-
-}
-
-function vobjCreateCubeV( offsets, groups, usemtls ) {
-
-	var output = '\n';
-	if ( groups === null || groups.length === 0 ) groups = [ null, null, null, null, null, null ];
-	if ( usemtls === null || usemtls.length === 0 ) usemtls = [ null, null, null, null, null, null ];
-	for ( var group, usemtl, f0, f1, f2, f3, i = 0, facesV = obj_verify.facesV, length = facesV.length; i < length; i ++ ) {
-
-		f0 = facesV[ i ][ 0 ] + offsets[ 0 ];
-		f1 = facesV[ i ][ 1 ] + offsets[ 0 ];
-		f2 = facesV[ i ][ 2 ] + offsets[ 0 ];
-		f3 = facesV[ i ][ 3 ] + offsets[ 0 ];
-
-		group = groups[ i ];
-		usemtl = usemtls[ i ];
-		if ( group ) output += 'g ' + group + '\n';
-		if ( usemtl ) output += 'usemtl ' + usemtl + '\n';
-		output += 'f ' + f0 + ' ' + f1 + ' ' + f2 + ' ' + f3 + '\n';
-
-	}
-	return output;
-
-}
-
-function vobjCreateCubeVVn( offsets, groups, usemtls ) {
-
-	var output = '\n';
-	if ( groups === null || groups.length === 0 ) groups = [ null, null, null, null, null, null ];
-	if ( usemtls === null || usemtls.length === 0 ) usemtls = [ null, null, null, null, null, null ];
-	for ( var group, usemtl, f0, f1, f2, f3, i = 0, facesV = obj_verify.facesV, facesVn = obj_verify.facesVn; i < 6; i ++ ) {
-
-		f0 = facesV[ i ][ 0 ] + offsets[ 0 ] + '//' + ( facesVn[ i ][ 0 ] + offsets[ 1 ] );
-		f1 = facesV[ i ][ 1 ] + offsets[ 0 ] + '//' + ( facesVn[ i ][ 1 ] + offsets[ 1 ] );
-		f2 = facesV[ i ][ 2 ] + offsets[ 0 ] + '//' + ( facesVn[ i ][ 2 ] + offsets[ 1 ] );
-		f3 = facesV[ i ][ 3 ] + offsets[ 0 ] + '//' + ( facesVn[ i ][ 3 ] + offsets[ 1 ] );
-
-		group = groups[ i ];
-		usemtl = usemtls[ i ];
-		if ( group ) output += 'g ' + group + '\n';
-		if ( usemtl ) output += 'usemtl ' + usemtl + '\n';
-		output += 'f ' + f0 + ' ' + f1 + ' ' + f2 + ' ' + f3 + '\n';
-
-	}
-	return output;
-
-}
-
-function vobjCreateCubeVVt( offsets, groups, usemtls ) {
-
-	var output = '\n';
-	if ( groups === null || groups.length === 0 ) groups = [ null, null, null, null, null, null ];
-	if ( usemtls === null || usemtls.length === 0 ) usemtls = [ null, null, null, null, null, null ];
-	for ( var group, usemtl, f0, f1, f2, f3, i = 0, facesV = obj_verify.facesV, facesVt = obj_verify.facesVt; i < 6; i ++ ) {
-
-		f0 = facesV[ i ][ 0 ] + offsets[ 0 ] + '/' + ( facesVt[ i ][ 0 ] + offsets[ 1 ] );
-		f1 = facesV[ i ][ 1 ] + offsets[ 0 ] + '/' + ( facesVt[ i ][ 1 ] + offsets[ 1 ] );
-		f2 = facesV[ i ][ 2 ] + offsets[ 0 ] + '/' + ( facesVt[ i ][ 2 ] + offsets[ 1 ] );
-		f3 = facesV[ i ][ 3 ] + offsets[ 0 ] + '/' + ( facesVt[ i ][ 3 ] + offsets[ 1 ] );
-
-		group = groups[ i ];
-		usemtl = usemtls[ i ];
-		if ( group ) output += 'g ' + group + '\n';
-		if ( usemtl ) output += 'usemtl ' + usemtl + '\n';
-		output += 'f ' + f0 + ' ' + f1 + ' ' + f2 + ' ' + f3 + '\n';
-
-	}
-	return output;
-
-}
-
-function vobjCreateCubeVVnVt( offsets, groups, usemtls ) {
-
-	var output = '\n';
-	if ( groups === null || groups.length === 0 ) groups = [ null, null, null, null, null, null ];
-	if ( usemtls === null || usemtls.length === 0 ) usemtls = [ null, null, null, null, null, null ];
-	for ( var group, usemtl, f0, f1, f2, f3, i = 0, facesV = obj_verify.facesV, facesVt = obj_verify.facesVt, facesVn = obj_verify.facesVn; i < 6; i ++ ) {
-
-		f0 = facesV[ i ][ 0 ] + offsets[ 0 ] + '/' + ( facesVt[ i ][ 0 ] + offsets[ 1 ] ) + '/' + ( facesVn[ i ][ 0 ] + offsets[ 2 ] );
-		f1 = facesV[ i ][ 1 ] + offsets[ 0 ] + '/' + ( facesVt[ i ][ 1 ] + offsets[ 1 ] ) + '/' + ( facesVn[ i ][ 1 ] + offsets[ 2 ] );
-		f2 = facesV[ i ][ 2 ] + offsets[ 0 ] + '/' + ( facesVt[ i ][ 2 ] + offsets[ 1 ] ) + '/' + ( facesVn[ i ][ 2 ] + offsets[ 2 ] );
-		f3 = facesV[ i ][ 3 ] + offsets[ 0 ] + '/' + ( facesVt[ i ][ 3 ] + offsets[ 1 ] ) + '/' + ( facesVn[ i ][ 3 ] + offsets[ 2 ] );
-
-		group = groups[ i ];
-		usemtl = usemtls[ i ];
-		if ( group ) output += 'g ' + group + '\n';
-		if ( usemtl ) output += 'usemtl ' + usemtl + '\n';
-		output += 'f ' + f0 + ' ' + f1 + ' ' + f2 + ' ' + f3 + '\n';
-
-	}
-	return output;
-
-}
-
-gulp.task( 'default', function () {
-
-	gutil.log( 'Building: verify.obj' );
-	var offsets = [ 0, 0, 0 ];
-	var pos = [ - 150, 50, 0 ];
-	fs.writeFileSync( './verify.obj', '# Verification OBJ created with gulp\n\n' );
-	fs.appendFileSync( './verify.obj', 'mtllib verify.mtl\n\n# Cube no materials. Translated x:' + pos[ 0 ] );
-	fs.appendFileSync( './verify.obj', vobjCreateVertices( 10, pos ) );
-	fs.appendFileSync( './verify.obj', vobjCreateCubeV( offsets, null, null ) );
-
-	pos[ 0 ] += 50;
-	offsets[ 0 ] += 8;
-	fs.appendFileSync( './verify.obj', '\n\n# Cube with two materials. Translated x:' + pos[ 0 ] );
-	fs.appendFileSync( './verify.obj', vobjCreateVertices( 10, pos ) );
-	fs.appendFileSync( './verify.obj', vobjCreateCubeV( offsets, null, [ 'orange', null, null, 'purple', null, null ] ) );
-
-	pos[ 0 ] += 50;
-	offsets[ 0 ] += 8;
-	fs.appendFileSync( './verify.obj', '\n\n# Cube with normals no materials. Translated x:' + pos[ 0 ] );
-	fs.appendFileSync( './verify.obj', vobjCreateVertices( 10, pos ) );
-	fs.appendFileSync( './verify.obj', vobjCreateNormals() );
-	fs.appendFileSync( './verify.obj', vobjCreateCubeVVn( offsets, [ 'cube3', null, null, null, null, null ], [ 'lightblue', null, null, null, null, null ] ) );
-
-	pos[ 0 ] += 50;
-	offsets[ 0 ] += 8;
-	fs.appendFileSync( './verify.obj', '\n\n# Cube with uvs and red material. Translated x:' + pos[ 0 ] );
-	fs.appendFileSync( './verify.obj', vobjCreateVertices( 10, pos ) );
-	fs.appendFileSync( './verify.obj', vobjCreateUvs() );
-	fs.appendFileSync( './verify.obj', vobjCreateCubeVVt( offsets, null, [ 'red', null, null, null, null, null ] ) );
-
-	pos[ 0 ] += 50;
-	offsets[ 0 ] += 8;
-	fs.appendFileSync( './verify.obj', '\n\n# cube with uvs and normals and material. Translated x' + pos[ 0 ] );
-	fs.appendFileSync( './verify.obj', vobjCreateVertices( 10, pos ) );
-
-	fs.appendFileSync( './verify.obj', vobjCreateCubeVVnVt( offsets, [], [ 'red', null, null, 'blue', null, 'green' ] ) );
-
-	pos[ 0 ] += 50;
-	offsets[ 0 ] += 8;
-	offsets[ 1 ] += 6;
-	fs.appendFileSync( './verify.obj', '\n\n# cube with uvs and normals and two materials and group for every quad. Translated x:' + pos[ 0 ] );
-	fs.appendFileSync( './verify.obj', vobjCreateVertices( 10, pos ) );
-	fs.appendFileSync( './verify.obj', vobjCreateNormals() );
-	fs.appendFileSync( './verify.obj', vobjCreateCubeVVnVt( [ - 9, offsets[ 1 ], offsets[ 2 ] ],
-		[ 'cube6a', 'cube6b', 'cube6c', 'cube6d', 'cube6e', 'cube6f' ],
-		[ 'green', null, null, 'orange', null, null ] ) );
-
-	pos[ 0 ] += 50;
-	offsets[ 0 ] += 8;
-	fs.appendFileSync( './verify.obj', '\n\n# cube with uvs and normals and six materials and six groups, one for every quad. Translated x:' + pos[ 0 ] );
-	fs.appendFileSync( './verify.obj', vobjCreateVertices( 10, pos ) );
-	fs.appendFileSync( './verify.obj', vobjCreateCubeVVnVt( offsets,
-		[ 'cube6a', 'cube6b', 'cube6c', 'cube6d', 'cube6e', 'cube6f' ],
-		[ 'red', 'blue', 'green', 'lightblue', 'orange', 'purple' ] ) );
-
-	pos[ 0 ] += 50;
-	offsets[ 0 ] += 8;
-	fs.appendFileSync( './verify.obj', '\n\n# Point. Translated x:' + pos[ 0 ] );
-	fs.appendFileSync( './verify.obj', vobjCreateVertices( 10, pos ) );
-	fs.appendFileSync( './verify.obj', '\np -8 -7 -6 -5 -4 -3 -2 -1\n' );
-
-	pos[ 0 ] += 50;
-	offsets[ 0 ] += 8;
-	fs.appendFileSync( './verify.obj', '\n\n# Line. Translated x:' + pos[ 0 ] );
-	fs.appendFileSync( './verify.obj', vobjCreateVertices( 10, pos ) );
-	fs.appendFileSync( './verify.obj', 'l -8 -7 -6 -5 -4 -3 -2 -1 -8 -5 -8 -4 -7 -6 -7 -3 -5 -1 -3 -2 -6 -2 -4 -1\n' );
-
-	pos[ 0 ] += 50;
-	offsets[ 0 ] += 8;
-	fs.appendFileSync( './verify.obj', '\n\n# Line UV. Translated x:' + pos[ 0 ] );
-	fs.appendFileSync( './verify.obj', vobjCreateVertices( 10, pos ) );
-	fs.appendFileSync( './verify.obj', '\nl -8/-2 -7/-1 -6/-2 -5/-1\n' );
-
-
-
-} );

+ 0 - 242
examples/models/obj/verify/verify.html

@@ -1,242 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-	<head>
-		<title>three.js webgl - OBJLoader2/OBJLoader verification</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;
-			}
-		</style>
-	</head>
-
-	<body>
-		<div id="glFullscreen">
-			<canvas id="example"></canvas>
-		</div>
-		<div id="dat">
-
-		</div>
-		<div id="info">
-			<a href="https://threejs.org" target="_blank" rel="noopener">three.js</a> - OBJLoader2/OBJLoader verification
-			<div id="feedback"></div>
-		</div>
-
-		<script type="module">
-
-			'use strict';
-
-			import {
-				AmbientLight,
-				DirectionalLight,
-				GridHelper,
-				PerspectiveCamera,
-				Scene,
-				Vector3,
-				WebGLRenderer
-			} from "../../../../build/three.module.js";
-
-			import { TrackballControls } from "../../../jsm/controls/TrackballControls.js";
-
-			import { MTLLoader } from "../../../jsm/loaders/MTLLoader.js";
-			import { MtlObjBridge } from "../../../jsm/loaders/obj2/bridge/MtlObjBridge.js";
-			import { OBJLoader } from "../../../jsm/loaders/OBJLoader.js";
-			import { OBJLoader2 } from "../../../jsm/loaders/OBJLoader2.js";
-
-			const OBJLoaderVerify = function ( elementToBindTo ) {
-				this.renderer = null;
-				this.canvas = elementToBindTo;
-				this.aspectRatio = 1;
-				this.recalcAspectRatio();
-
-				this.scene = null;
-				this.cameraDefaults = {
-					posCamera: new Vector3( 0.0, 175.0, 500.0 ),
-					posCameraTarget: new Vector3( 0, 0, 0 ),
-					near: 0.1,
-					far: 10000,
-					fov: 45
-				};
-				this.camera = null;
-				this.cameraTarget = this.cameraDefaults.posCameraTarget;
-
-				this.controls = null;
-			};
-
-				OBJLoaderVerify.prototype = {
-
-					constructor: OBJLoaderVerify,
-
-					initGL: function () {
-					this.renderer = new WebGLRenderer( {
-						canvas: this.canvas,
-						antialias: true,
-						autoClear: true
-					} );
-					this.renderer.setClearColor( 0x050505 );
-
-					this.scene = new Scene();
-
-					this.camera = new PerspectiveCamera( this.cameraDefaults.fov, this.aspectRatio, this.cameraDefaults.near, this.cameraDefaults.far );
-					this.resetCamera();
-					this.controls = new TrackballControls( this.camera, this.renderer.domElement );
-
-					let ambientLight = new AmbientLight( 0x404040 );
-					let directionalLight1 = new DirectionalLight( 0xC0C090 );
-					let directionalLight2 = new 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 );
-
-					let helper = new GridHelper( 1200, 60, 0xFF4444, 0x404040 );
-					this.scene.add( helper );
-				},
-
-				initContent: function () {
-					let modelName = 'verificationCubes';
-					this._reportProgress( { detail: { text: 'Loading: ' + modelName } } );
-
-					let objLoader = new OBJLoader();
-
-					let objLoader2 = new OBJLoader2();
-					objLoader2.setModelName( modelName );
-					objLoader2.setLogging( true, false );
-					objLoader2.setUseOAsMesh( true );
-
-					let scope = this;
-					let callbackOnLoad = function ( object3d ) {
-						scope.scene.add( object3d );
-						console.log( 'Loading complete: ' + modelName );
-						scope._reportProgress( { detail: { text: '' } } );
-					};
-
-					let onLoadMtl = function ( mtlParseResult ) {
-						objLoader.setMaterials( mtlParseResult );
-						objLoader.load( './verify.obj', function ( object ) {
-							object.position.y = -100;
-							scope.scene.add( object );
-						} );
-
-						objLoader2.addMaterials( MtlObjBridge.addMaterialsFromMtlLoader( mtlParseResult ) );
-						objLoader2.load( './verify.obj', callbackOnLoad, null, null, null );
-					};
-
-					let mtlLoader = new MTLLoader();
-					mtlLoader.load( './verify.mtl', onLoadMtl );
-				},
-
-				_reportProgress: function( event ) {
-					let output = ( event.detail !== undefined && event.detail !== null && event.detail.text !== undefined && event.detail.text !== null ) ? event.detail.text : '';
-					console.log( 'Progress: ' + output );
-					document.getElementById( 'feedback' ).innerHTML = output;
-				},
-
-				resizeDisplayGL: function () {
-					this.controls.handleResize();
-
-					this.recalcAspectRatio();
-					this.renderer.setSize( this.canvas.offsetWidth, this.canvas.offsetHeight, false );
-
-					this.updateCamera();
-				},
-
-				recalcAspectRatio: function () {
-					this.aspectRatio = ( this.canvas.offsetHeight === 0 ) ? 1 : this.canvas.offsetWidth / this.canvas.offsetHeight;
-				},
-
-				resetCamera: function () {
-					this.camera.position.copy( this.cameraDefaults.posCamera );
-					this.cameraTarget.copy( this.cameraDefaults.posCameraTarget );
-
-					this.updateCamera();
-				},
-
-				updateCamera: function () {
-					this.camera.aspect = this.aspectRatio;
-					this.camera.lookAt( this.cameraTarget );
-					this.camera.updateProjectionMatrix();
-				},
-
-				render: function () {
-					if ( ! this.renderer.autoClear ) this.renderer.clear();
-					this.controls.update();
-					this.renderer.render( this.scene, this.camera );
-				}
-			};
-
-			let app = new OBJLoaderVerify( document.getElementById( 'example' ) );
-
-			let resizeWindow = function () {
-				app.resizeDisplayGL();
-			};
-
-			let render = function () {
-				requestAnimationFrame( render );
-				app.render();
-			};
-
-			window.addEventListener( 'resize', resizeWindow, false );
-
-			console.log( 'Starting initialisation phase...' );
-			app.initGL();
-			app.resizeDisplayGL();
-			app.initContent();
-
-			render();
-
-		</script>
-	</body>
-</html>

+ 0 - 42
examples/models/obj/verify/verify.mtl

@@ -1,42 +0,0 @@
-newmtl red
-	Ka 1.000000 0.000000 0.000000
-	Kd 1.000000 0.000000 0.000000
-	Ks 0.000000 0.000000 0.000000
-	illum 2
-	Ns 0.000000
-	map_Kd ../female02/02_-_Default1noCulling.JPG
-
-newmtl blue
-	Ka 0.000000 0.000000 1.000000
-	Kd 0.000000 0.000000 1.000000
-	Ks 0.000000 0.000000 0.000000
-	illum 1
-	Ns 0.000000
-
-newmtl green
-	Ka 0.000000 1.000000 0.000000
-	Kd 0.000000 1.000000 0.000000
-	Ks 0.000000 0.000000 0.000000
-	illum 1
-	Ns 0.000000
-
-newmtl lightblue
-	Ka 0.000000 1.000000 1.000000
-	Kd 0.000000 1.000000 1.000000
-	Ks 0.000000 0.000000 0.000000
-	illum 1
-	Ns 0.000000
-
-newmtl orange
-	Ka 1.000000 0.647059 0.000000
-	Kd 1.000000 0.647059 0.000000
-	Ks 0.000000 0.000000 0.000000
-	illum 1
-	Ns 0.000000
-
-newmtl purple
-	Ka 0.825806 0.000000 0.825806
-	Kd 0.825806 0.000000 0.825806
-	Ks 0.000000 0.000000 0.000000
-	illum 1
-	Ns 0.000000

+ 0 - 215
examples/models/obj/verify/verify.obj

@@ -1,215 +0,0 @@
-# Verification OBJ created with gulp
-
-mtllib verify.mtl
-
-# Cube no materials. Translated x:-150
-o cube 1
-v -160 60 10
-v -160 40 10
-v -140 40 10
-v -140 60 10
-v -160 60 -10
-v -160 40 -10
-v -140 40 -10
-v -140 60 -10
-
-f 1 2 3 4
-f 8 7 6 5
-f 4 3 7 8
-f 5 1 4 8
-f 5 6 2 1
-f 2 6 7 3
-
-
-# Cube with two materials. Translated x:-100
-o cube 2
-v -110 60 10
-v -110 40 10
-v -90 40 10
-v -90 60 10
-v -110 60 -10
-v -110 40 -10
-v -90 40 -10
-v -90 60 -10
-
-usemtl orange
-f 9 10 11 12
-f 16 15 14 13
-f 12 11 15 16
-usemtl purple
-f 13 9 12 16
-f 13 14 10 9
-f 10 14 15 11
-
-
-# Cube with normals no materials. Translated x:-50
-v -60 60 10
-v -60 40 10
-v -40 40 10
-v -40 60 10
-v -60 60 -10
-v -60 40 -10
-v -40 40 -10
-v -40 60 -10
-
-vn 0 0 1
-vn 0 0 -1
-vn 0 1 0
-vn 0 -1 0
-vn 1 0 0
-vn -1 0 0
-
-g cube3
-usemtl lightblue
-f 17//1 18//1 19//1 20//1
-f 24//2 23//2 22//2 21//2
-f 20//5 19//5 23//5 24//5
-f 21//3 17//3 20//3 24//3
-f 21//6 22//6 18//6 17//6
-f 18//4 22//4 23//4 19//4
-
-
-# Cube with uvs and red material. Translated x:0
-v -10 60 10
-v -10 40 10
-v 10 40 10
-v 10 60 10
-v -10 60 -10
-v -10 40 -10
-v 10 40 -10
-v 10 60 -10
-
-vt 0 1
-vt 1 1
-vt 1 0
-vt 0 0
-
-usemtl red
-f 25/1 26/2 27/3 28/4
-f 32/1 31/2 30/3 29/4
-f 28/1 27/2 31/3 32/4
-f 29/1 25/2 28/3 32/4
-f 29/1 30/2 26/3 25/4
-f 26/1 30/2 31/3 27/4
-
-
-# cube with uvs and normals and material. Translated x50
-v 40 60 10
-v 40 40 10
-v 60 40 10
-v 60 60 10
-v 40 60 -10
-v 40 40 -10
-v 60 40 -10
-v 60 60 -10
-
-usemtl red
-f 33/1/1 34/2/1 35/3/1 36/4/1
-f 40/1/2 39/2/2 38/3/2 37/4/2
-f 36/1/5 35/2/5 39/3/5 40/4/5
-usemtl blue
-f 37/1/3 33/2/3 36/3/3 40/4/3
-f 37/1/6 38/2/6 34/3/6 33/4/6
-usemtl green
-f 34/1/4 38/2/4 39/3/4 35/4/4
-
-
-# cube with uvs and normals and two materials and group for every quad. Translated x:100
-v 90 60 10
-v 90 40 10
-v 110 40 10
-v 110 60 10
-v 90 60 -10
-v 90 40 -10
-v 110 40 -10
-v 110 60 -10
-
-vn 0 0 1
-vn 0 0 -1
-vn 0 1 0
-vn 0 -1 0
-vn 1 0 0
-vn -1 0 0
-
-g cube6a
-usemtl green
-f -8/7/1 -7/8/1 -6/9/1 -5/10/1
-g cube6b
-f -1/7/2 -2/8/2 -3/9/2 -4/10/2
-g cube6c
-f -5/7/5 -6/8/5 -2/9/5 -1/10/5
-g cube6d
-usemtl orange
-f -4/7/3 -8/8/3 -5/9/3 -1/10/3
-g cube6e
-f -4/7/6 -3/8/6 -7/9/6 -8/10/6
-g cube6f
-f -7/7/4 -3/8/4 -2/9/4 -6/10/4
-
-
-# cube with uvs and normals and six materials and six groups, one for every quad. Translated x:150
-v 140 60 10
-v 140 40 10
-v 160 40 10
-v 160 60 10
-v 140 60 -10
-v 140 40 -10
-v 160 40 -10
-v 160 60 -10
-
-g cube6a
-usemtl red
-f 49/7/1 50/8/1 51/9/1 52/10/1
-g cube6b
-usemtl blue
-f 56/7/2 55/8/2 54/9/2 53/10/2
-g cube6c
-usemtl green
-f 52/7/5 51/8/5 55/9/5 56/10/5
-g cube6d
-usemtl lightblue
-f 53/7/3 49/8/3 52/9/3 56/10/3
-g cube6e
-usemtl orange
-f 53/7/6 54/8/6 50/9/6 49/10/6
-g cube6f
-usemtl purple
-f 50/7/4 54/8/4 55/9/4 51/10/4
-
-
-# Point. Translated x:200
-v 190 60 10
-v 190 40 10
-v 210 40 10
-v 210 60 10
-v 190 60 -10
-v 190 40 -10
-v 210 40 -10
-v 210 60 -10
-
-p -8 -7 -6 -5 -4 -3 -2 -1
-
-
-# Point/Line. Translated x:250
-v 240 60 10
-v 240 40 10
-v 260 40 10
-v 260 60 10
-v 240 60 -10
-v 240 40 -10
-v 260 40 -10
-v 260 60 -10
-l -8 -7 -6 -5 -4 -3 -2 -1 -8 -5 -8 -4 -7 -6 -7 -3 -5 -1 -3 -2 -6 -2 -4 -1
-
-
-# Line UV. Translated x:300
-v 290 60 10
-v 290 40 10
-v 310 40 10
-v 310 60 10
-v 290 60 -10
-v 290 40 -10
-v 310 40 -10
-v 310 60 -10
-
-l -8/-2 -7/-1 -6/-2 -5/-1

BIN
examples/screenshots/webgl_loader_obj2.jpg


BIN
examples/screenshots/webgl_loader_obj2_options.jpg


+ 0 - 234
examples/webgl_loader_obj2.html

@@ -1,234 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-	<head>
-		<title>three.js webgl - OBJLoader2 basic usage</title>
-		<meta charset="utf-8">
-		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
-		<link type="text/css" rel="stylesheet" href="main.css">
-		<style>
-			#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;
-			}
-		</style>
-
-	</head>
-
-	<body>
-		<div id="glFullscreen">
-			<canvas id="example"></canvas>
-		</div>
-		<div id="dat">
-
-		</div>
-		<div id="info">
-			<a href="https://threejs.org" target="_blank" rel="noopener">three.js</a> - OBJLoader2 direct loader test
-			<div id="feedback"></div>
-		</div>
-
-		<script type="module">
-
-			'use strict';
-
-			import * as THREE from '../build/three.module.js';
-
-			import { TrackballControls } from "./jsm/controls/TrackballControls.js";
-
-			import { MTLLoader } from "./jsm/loaders/MTLLoader.js";
-			import { OBJLoader2 } from "./jsm/loaders/OBJLoader2.js";
-			import { MtlObjBridge } from "./jsm/loaders/obj2/bridge/MtlObjBridge.js";
-
-
-			const OBJLoader2Example = function ( 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;
-
-			};
-
-			OBJLoader2Example.prototype = {
-
-				constructor: OBJLoader2Example,
-
-				initGL: function () {
-
-					this.renderer = new THREE.WebGLRenderer( {
-						canvas: this.canvas,
-						antialias: true,
-						autoClear: true
-					} );
-					this.renderer.setClearColor( 0x050505 );
-
-					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 TrackballControls( this.camera, this.renderer.domElement );
-
-					const ambientLight = new THREE.AmbientLight( 0x404040 );
-					const directionalLight1 = new THREE.DirectionalLight( 0xC0C090 );
-					const 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 );
-
-					const helper = new THREE.GridHelper( 1200, 60, 0xFF4444, 0x404040 );
-					this.scene.add( helper );
-
-				},
-
-				initContent: function () {
-
-					const modelName = 'female02';
-					this._reportProgress( { detail: { text: 'Loading: ' + modelName } } );
-
-
-					const scope = this;
-					const objLoader2 = new OBJLoader2();
-					const callbackOnLoad = function ( object3d ) {
-
-						scope.scene.add( object3d );
-						console.log( 'Loading complete: ' + modelName );
-						scope._reportProgress( { detail: { text: '' } } );
-
-					};
-
-					const onLoadMtl = function ( mtlParseResult ) {
-
-						objLoader2.setModelName( modelName );
-						objLoader2.setLogging( true, true );
-						objLoader2.addMaterials( MtlObjBridge.addMaterialsFromMtlLoader( mtlParseResult ), true );
-						objLoader2.load( 'models/obj/female02/female02.obj', callbackOnLoad, null, null, null );
-
-					};
-
-					const mtlLoader = new MTLLoader();
-					mtlLoader.load( 'models/obj/female02/female02.mtl', onLoadMtl );
-
-				},
-
-				_reportProgress: function ( event ) {
-
-					let output = '';
-					if ( event.detail !== null && event.detail !== undefined && event.detail.text ) {
-
-						output = event.detail.text;
-
-					}
-
-					console.log( 'Progress: ' + output );
-					document.getElementById( 'feedback' ).innerHTML = output;
-
-				},
-
-				resizeDisplayGL: function () {
-
-					this.controls.handleResize();
-
-					this.recalcAspectRatio();
-					this.renderer.setSize( this.canvas.offsetWidth, this.canvas.offsetHeight, false );
-
-					this.updateCamera();
-
-				},
-
-				recalcAspectRatio: function () {
-
-					this.aspectRatio = ( this.canvas.offsetHeight === 0 ) ? 1 : this.canvas.offsetWidth / this.canvas.offsetHeight;
-
-				},
-
-				resetCamera: function () {
-
-					this.camera.position.copy( this.cameraDefaults.posCamera );
-					this.cameraTarget.copy( this.cameraDefaults.posCameraTarget );
-
-					this.updateCamera();
-
-				},
-
-				updateCamera: function () {
-
-					this.camera.aspect = this.aspectRatio;
-					this.camera.lookAt( this.cameraTarget );
-					this.camera.updateProjectionMatrix();
-
-				},
-
-				render: function () {
-
-					if ( ! this.renderer.autoClear ) this.renderer.clear();
-					this.controls.update();
-					this.renderer.render( this.scene, this.camera );
-
-				}
-			};
-
-			const app = new OBJLoader2Example( document.getElementById( 'example' ) );
-
-			const resizeWindow = function () {
-
-				app.resizeDisplayGL();
-
-			};
-
-			const render = function () {
-
-				requestAnimationFrame( render );
-				app.render();
-
-			};
-
-			window.addEventListener( 'resize', resizeWindow, false );
-
-			console.log( 'Starting initialisation phase...' );
-			app.initGL();
-			app.resizeDisplayGL();
-			app.initContent();
-
-			render();
-
-		</script>
-	</body>
-</html>

+ 0 - 614
examples/webgl_loader_obj2_options.html

@@ -1,614 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-	<head>
-		<title>three.js webgl - OBJLoader2 usage options</title>
-		<meta charset="utf-8">
-		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
-		<link type="text/css" rel="stylesheet" href="main.css">
-		<style>
-			#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;
-			}
-		</style>
-
-	</head>
-
-	<body>
-		<div id="glFullscreen">
-			<canvas id="example"></canvas>
-		</div>
-		<div id="dat" class="dg ac"></div>
-		<div id="info">
-			<a href="https://threejs.org" target="_blank" rel="noopener">three.js</a> - OBJLoader2 usage options<br>Use module workers with Chromium based browser (80+)
-			<div id="feedback"></div>
-		</div>
-
-		<script type="module">
-
-			'use strict';
-
-			import * as THREE from '../build/three.module.js';
-			import { GUI } from './jsm/libs/dat.gui.module.js';
-
-			import { TrackballControls } from "./jsm/controls/TrackballControls.js";
-			import { VertexNormalsHelper } from "./jsm/helpers/VertexNormalsHelper.js";
-
-			import { MTLLoader } from "./jsm/loaders/MTLLoader.js";
-			import { MtlObjBridge } from "./jsm/loaders/obj2/bridge/MtlObjBridge.js";
-			import { OBJLoader2 } from "./jsm/loaders/OBJLoader2.js";
-			import { OBJLoader2Parallel } from "./jsm/loaders/OBJLoader2Parallel.js";
-			import { LoadedMeshUserOverride } from "./jsm/loaders/obj2/shared/MeshReceiver.js";
-
-			const WWOBJLoader2Example = function ( 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;
-
-				this.flatShading = false;
-				this.doubleSide = false;
-				this.useJsmWorker = false;
-				this.loadCount = 6;
-
-				this.cube = null;
-				this.pivot = null;
-
-			};
-
-			WWOBJLoader2Example.prototype = {
-
-				constructor: WWOBJLoader2Example,
-
-				initGL: function () {
-
-					this.renderer = new THREE.WebGLRenderer( {
-						canvas: this.canvas,
-						antialias: true,
-						autoClear: true
-					} );
-					this.renderer.setClearColor( 0x050505 );
-
-					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 TrackballControls( this.camera, this.renderer.domElement );
-
-					const ambientLight = new THREE.AmbientLight( 0x404040 );
-					const directionalLight1 = new THREE.DirectionalLight( 0xC0C090 );
-					const 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 );
-
-					const helper = new THREE.GridHelper( 1200, 60, 0xFF4444, 0x404040 );
-					this.scene.add( helper );
-
-					const geometry = new THREE.BoxBufferGeometry( 10, 10, 10 );
-					const 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 );
-
-				},
-
-				useParseMain: function () {
-
-					const modelName = 'female02';
-					this._reportProgress( { detail: { text: 'Loading: ' + modelName } } );
-
-					const objLoader2 = new OBJLoader2()
-						.setModelName( modelName );
-
-					const scope = this;
-					function onLoadMtl( mtlParseResult ) {
-
-						objLoader2.addMaterials( MtlObjBridge.addMaterialsFromMtlLoader( mtlParseResult ), true );
-
-						const fileLoader = new THREE.FileLoader();
-						fileLoader.setPath( '' );
-						fileLoader.setResponseType( 'arraybuffer' );
-						fileLoader.load( 'models/obj/female02/female02.obj',
-							function ( content ) {
-
-								const local = new THREE.Object3D();
-								local.name = 'Pivot_female02';
-								local.position.set( 75, 0, 0 );
-								scope.pivot.add( local );
-								local.add( objLoader2.parse( content ) );
-
-								scope._reportProgress( { detail: { text: 'Loading of ' + modelName + ' completed: OBJLoader2#pase: Parsing completed' } } );
-								scope.finalize();
-
-							}
-						);
-
-					}
-
-					const mtlLoader = new MTLLoader();
-					mtlLoader.load( 'models/obj/female02/female02.mtl', onLoadMtl );
-
-				},
-
-				useParseParallel: function () {
-
-					const modelName = 'female02_vertex';
-					this._reportProgress( { detail: { text: 'Loading: ' + modelName } } );
-
-					const local = new THREE.Object3D();
-					local.name = 'Pivot_female02_vertex';
-					local.position.set( - 75, 0, 0 );
-					this.pivot.add( local );
-
-					const scope = this;
-					function callbackOnLoad( object3d, message ) {
-
-						local.add( object3d );
-						scope._reportProgress( { detail: { text: 'Loading of ' + modelName + ' completed: ' + message } } );
-						scope.finalize();
-
-					}
-
-					const materials = {
-						tester: new THREE.MeshStandardMaterial()
-					};
-
-					const objLoader2Parallel = new OBJLoader2Parallel()
-						.setModelName( modelName )
-						.setJsmWorker( this.useJsmWorker, new URL( OBJLoader2Parallel.DEFAULT_JSM_WORKER_PATH, window.location.href ) )
-						.setCallbackOnLoad( callbackOnLoad )
-						.addMaterials( materials, true );
-
-					const fileLoader = new THREE.FileLoader();
-					fileLoader.setPath( '' );
-					fileLoader.setResponseType( 'arraybuffer' );
-					fileLoader.load( 'models/obj/female02/female02_vertex_colors.obj',
-						function ( content ) {
-
-							objLoader2Parallel.parse( content );
-
-						}
-					);
-
-				},
-
-				useLoadMain: function () {
-
-					const modelName = 'male02';
-					this._reportProgress( { detail: { text: 'Loading: ' + modelName } } );
-
-					const objLoader2 = new OBJLoader2()
-						.setModelName( modelName )
-						.setUseIndices( true );
-
-					const scope = this;
-					function callbackOnLoad( object3d, message ) {
-
-						const local = new THREE.Object3D();
-						local.name = 'Pivot_male02';
-						local.position.set( 0, 0, - 75 );
-						scope.pivot.add( local );
-						local.add( object3d );
-
-						scope._reportProgress( { detail: { text: 'Loading of ' + modelName + ' completed: ' + message } } );
-						scope.finalize();
-
-					}
-
-					function onLoadMtl( mtlParseResult ) {
-
-						objLoader2.addMaterials( MtlObjBridge.addMaterialsFromMtlLoader( mtlParseResult ), true );
-						objLoader2.load( 'models/obj/male02/male02.obj', callbackOnLoad, null, null, null );
-
-					}
-
-					const mtlLoader = new MTLLoader();
-					mtlLoader.load( 'models/obj/male02/male02.mtl', onLoadMtl );
-
-				},
-
-				useLoadParallel: function () {
-
-					const modelName = 'WaltHead';
-					this._reportProgress( { detail: { text: 'Loading: ' + modelName } } );
-
-					const local = new THREE.Object3D();
-					local.name = 'Pivot_WaltHead';
-					local.position.set( - 175, 50, 0 );
-					const scale = 0.5;
-					local.scale.set( scale, scale, scale );
-					this.pivot.add( local );
-
-					const objLoader2Parallel = new OBJLoader2Parallel()
-						.setModelName( modelName )
-						.setJsmWorker( this.useJsmWorker, new URL( OBJLoader2Parallel.DEFAULT_JSM_WORKER_PATH, window.location.href ) );
-
-					const scope = this;
-					function callbackOnLoad( object3d, message ) {
-
-						local.add( object3d );
-						scope._reportProgress( { detail: { text: 'Loading of ' + modelName + ' completed: ' + message } } );
-						scope.finalize();
-
-					}
-
-					function onLoadMtl( mtlParseResult ) {
-
-						objLoader2Parallel.addMaterials( MtlObjBridge.addMaterialsFromMtlLoader( mtlParseResult ), true );
-						objLoader2Parallel.load( 'models/obj/walt/WaltHead.obj', callbackOnLoad );
-
-					}
-
-					const mtlLoader = new MTLLoader();
-					mtlLoader.load( 'models/obj/walt/WaltHead.mtl', onLoadMtl );
-
-				},
-
-				useLoadMainFallback: function () {
-
-					const local = new THREE.Object3D();
-					local.name = 'Pivot_Cerberus';
-					local.position.set( 0, 0, 100 );
-					const scale = 50;
-					local.scale.set( scale, scale, scale );
-					this.pivot.add( local );
-
-					const objLoader2Parallel = new OBJLoader2Parallel()
-						.setModelName( local.name )
-						.setExecuteParallel( false );
-
-					const scope = this;
-					function callbackOnLoad( object3d, message ) {
-
-						local.add( object3d );
-						scope._reportProgress( { detail: { text: 'Loading of ' + objLoader2Parallel.modelName + ' completed: ' + message } } );
-						scope.finalize();
-
-					}
-
-					objLoader2Parallel.load( 'models/obj/cerberus/Cerberus.obj', callbackOnLoad );
-
-				},
-
-				useLoadParallelMeshAlter: function () {
-
-					const local = new THREE.Object3D();
-					local.position.set( 175, - 100, 0 );
-					local.name = 'Pivot_ninjaHead';
-					this.pivot.add( local );
-
-					const objLoader2Parallel = new OBJLoader2Parallel()
-						.setModelName( local.name )
-						.setJsmWorker( this.useJsmWorker, new URL( OBJLoader2Parallel.DEFAULT_JSM_WORKER_PATH, window.location.href ) )
-						.setBaseObject3d( local );
-
-					// Configure WorkerExecutionSupport to not disregard worker after execution
-					objLoader2Parallel.getWorkerExecutionSupport().setTerminateWorkerOnLoad( false );
-
-					function callbackMeshAlter( event ) {
-
-						const override = new LoadedMeshUserOverride( false, true );
-
-						const mesh = new THREE.Mesh( event.detail.bufferGeometry, event.detail.material );
-						mesh.name = event.detail.meshName;
-						const helper = new VertexNormalsHelper( mesh, 2, 0x00ff00 );
-						helper.name = 'VertexNormalsHelper';
-
-						override.addMesh( mesh );
-						override.addMesh( helper );
-
-						return override;
-
-					}
-
-					objLoader2Parallel.setCallbackOnMeshAlter( callbackMeshAlter );
-
-					const scope = this;
-					function callbackOnLoad( object3d, message ) {
-
-						scope._reportProgress( { detail: { text: 'Loading of ' + objLoader2Parallel.modelName + ' completed: ' + message } } );
-						scope.finalize();
-
-					}
-
-					objLoader2Parallel.load( 'models/obj/ninja/ninjaHead_Low.obj', callbackOnLoad );
-
-				},
-
-				finalize: function () {
-
-					this.loadCount --;
-					if ( this.loadCount === 0 ) {
-
-						this._reportProgress( { detail: { text: '' } } );
-
-					}
-
-				},
-
-				_reportProgress: function ( event ) {
-
-					let output = '';
-					if ( event.detail !== null && event.detail !== undefined && event.detail.text ) {
-
-						output = event.detail.text;
-
-					}
-
-					console.log( 'Progress: ' + output );
-					document.getElementById( 'feedback' ).innerHTML = output;
-
-				},
-
-				resizeDisplayGL: function () {
-
-					this.controls.handleResize();
-
-					this.recalcAspectRatio();
-					this.renderer.setSize( this.canvas.offsetWidth, this.canvas.offsetHeight, false );
-
-					this.updateCamera();
-
-				},
-
-				recalcAspectRatio: function () {
-
-					this.aspectRatio = ( this.canvas.offsetHeight === 0 ) ? 1 : this.canvas.offsetWidth / this.canvas.offsetHeight;
-
-				},
-
-				resetCamera: function () {
-
-					this.camera.position.copy( this.cameraDefaults.posCamera );
-					this.cameraTarget.copy( this.cameraDefaults.posCameraTarget );
-
-					this.updateCamera();
-
-				},
-
-				updateCamera: function () {
-
-					this.camera.aspect = this.aspectRatio;
-					this.camera.lookAt( this.cameraTarget );
-					this.camera.updateProjectionMatrix();
-
-				},
-
-				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 );
-
-				},
-
-				alterShading: function () {
-
-					const scope = this;
-					scope.flatShading = ! scope.flatShading;
-					console.log( scope.flatShading ? 'Enabling flat shading' : 'Enabling smooth shading' );
-
-					scope.traversalFunction = function ( material ) {
-
-						material.flatShading = scope.flatShading;
-						material.needsUpdate = true;
-
-					};
-
-					function scopeTraverse( object3d ) {
-
-						scope.traverseScene( object3d );
-
-					}
-
-					scope.pivot.traverse( scopeTraverse );
-
-				},
-
-				alterDouble: function () {
-
-					const scope = this;
-					scope.doubleSide = ! scope.doubleSide;
-					console.log( scope.doubleSide ? 'Enabling THREE.DoubleSide materials' : 'Enabling THREE.FrontSide materials' );
-
-					scope.traversalFunction = function ( material ) {
-
-						material.side = scope.doubleSide ? THREE.DoubleSide : THREE.FrontSide;
-
-					};
-
-					function scopeTraverse( object3d ) {
-
-						scope.traverseScene( object3d );
-
-					}
-
-					scope.pivot.traverse( scopeTraverse );
-
-				},
-
-				traverseScene: function ( object3d ) {
-
-					if ( Array.isArray( object3d.material ) ) {
-
-						const materials = object3d.material.materials;
-						for ( const name in materials ) {
-
-							if ( materials.hasOwnProperty( name ) )	this.traversalFunction( materials[ name ] );
-
-						}
-
-					} else if ( object3d.material ) {
-
-						this.traversalFunction( object3d.material );
-
-					}
-
-				},
-
-				executeLoading: function () {
-
-					// Load a file with OBJLoader2.parse on main
-					this.useParseMain();
-
-					// Load a file with OBJLoader2Parallel.parse in parallel in worker
-					this.useParseParallel();
-
-					// Load a file with OBJLoader.load on main
-					this.useLoadMain();
-
-					// Load a file with OBJLoader2Parallel.load in parallel in worker
-					this.useLoadParallel();
-
-					// Load a file with OBJLoader2Parallel.load on main with fallback to OBJLoader2.parse
-					this.useLoadMainFallback();
-
-					// Load a file with OBJLoader2Parallel.load in parallel in worker and add normals during onMeshAlter
-					this.useLoadParallelMeshAlter();
-
-				}
-
-			};
-
-			const app = new WWOBJLoader2Example( document.getElementById( 'example' ) );
-
-			const wwObjLoader2Control = {
-				flatShading: app.flatShading,
-				doubleSide: app.doubleSide,
-				useJsmWorker: app.useJsmWorker,
-				blockEvent: function ( event ) {
-
-					event.stopPropagation();
-
-				},
-				disableElement: function ( elementHandle ) {
-
-					elementHandle.domElement.addEventListener( 'click', this.blockEvent, true );
-					elementHandle.domElement.parentElement.style.pointerEvents = 'none';
-					elementHandle.domElement.parentElement.style.opacity = 0.5;
-
-				},
-				executeLoading: function () {
-
-					app.executeLoading();
-					this.disableElement( handleExecuteLoading );
-
-				},
-			};
-
-			const menuDiv = document.getElementById( 'dat' );
-			const gui = new GUI( {
-				autoPlace: false,
-				width: 320
-			} );
-			menuDiv.appendChild( gui.domElement );
-
-			const folderRenderingOptions = gui.addFolder( 'Rendering Options' );
-			const controlFlat = folderRenderingOptions.add( wwObjLoader2Control, 'flatShading' ).name( 'Flat Shading' );
-			controlFlat.onChange( function ( value ) {
-
-				console.log( 'Setting flatShading to: ' + value );
-				app.alterShading();
-
-			} );
-
-			const controlDouble = folderRenderingOptions.add( wwObjLoader2Control, 'doubleSide' ).name( 'Double Side Materials' );
-			controlDouble.onChange( function ( value ) {
-
-				console.log( 'Setting doubleSide to: ' + value );
-				app.alterDouble();
-
-			} );
-
-			const folderObjLoader2ParallelOptions = gui.addFolder( 'OBJLoader2Parallel Options' );
-			const controlJsmWorker = folderObjLoader2ParallelOptions.add( wwObjLoader2Control, 'useJsmWorker' ).name( 'Use Module Workers' );
-			controlJsmWorker.onChange( function ( value ) {
-
-				console.log( 'Setting useJsmWorker to: ' + value );
-				app.useJsmWorker = value;
-
-			} );
-			const folderExecution = gui.addFolder( 'Execution' );
-			const handleExecuteLoading = folderExecution.add( wwObjLoader2Control, 'executeLoading' ).name( 'Run' );
-			handleExecuteLoading.domElement.id = 'startButton';
-			folderRenderingOptions.open();
-			folderObjLoader2ParallelOptions.open();
-			folderExecution.open();
-
-
-			// init three.js example application
-			function resizeWindow() {
-
-				app.resizeDisplayGL();
-
-			}
-
-			function render() {
-
-				requestAnimationFrame( render );
-				app.render();
-
-			}
-
-			window.addEventListener( 'resize', resizeWindow, false );
-
-			console.log( 'Starting initialisation phase...' );
-			app.initGL();
-			app.resizeDisplayGL();
-
-			// kick render loop
-			render();
-
-		</script>
-	</body>
-</html>