File: OBJLoader2Parallel.html

package info (click to toggle)
three.js 111%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 15,184 kB
  • sloc: javascript: 133,174; makefile: 24; sh: 1
file content (109 lines) | stat: -rw-r--r-- 3,450 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8" />
		<base href="../../../" />
		<script src="list.js"></script>
		<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>Examples</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>

		[example:webgl_loader_obj2_options] - Example for multiple use-cases (parse and load, sync (see [page:OBJLoader2]) or in parallel to main)<br>


		<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>