Browse Source

Adding first draft of 3dmLoader doc

Luis Fraguada 4 years ago
parent
commit
1558a493c4
2 changed files with 178 additions and 0 deletions
  1. 177 0
      docs/examples/en/loaders/3DMLoader.html
  2. 1 0
      docs/list.js

+ 177 - 0
docs/examples/en/loaders/3DMLoader.html

@@ -0,0 +1,177 @@
+<!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>
+		[page:Loader] &rarr;
+		<h1>[name]</h1>
+
+		<p class="desc">
+			A loader for Rhinoceros 3d files and objects. <br /><br />
+			Rhinoceros is a 3D modeler used to create, edit, analyze, document, render, animate, and translate NURBS curves, surfaces, solids, point clouds, as well as polygon meshes and SubD objects.
+			[link:https://github.com/mcneel/rhino3dm rhino3dm.js] is compiled to WebAssembly from the open source geometry library [link:https://github.com/mcneel/opennurbs openNURBS].
+
+		</p>
+
+		<h2>Supported Conversions</h2>
+
+		<p>
+			[name] loads the following objects to a respective three.js type:
+		</p>
+
+		<table>
+			<tr>
+				<th>3dm type</th>
+				<th>three.js type</th>
+			</tr>
+			<tr>
+				<td>Point</td>
+				<td>[page:Points Points]</td>
+			</tr>
+			<tr>
+				<td>PointSet</td>
+				<td>[page:Points Points]</td>
+			</tr>
+			<tr>
+				<td>TextDot</td>
+				<td>[page:Sprite Sprite]</td>
+			</tr>
+			<tr>
+				<td>Curve</td>
+				<td>[page:Line Line]</td>
+			</tr>
+			<tr>
+				<td>Mesh</td>
+				<td>[page:Mesh Mesh]</td>
+			</tr>
+			<tr>
+				<td>Extrusion</td>
+				<td>[page:Mesh Mesh]</td>
+			</tr>
+			<tr>
+				<td>BREP</td>
+				<td>[page:Object3D Object3D]</td>
+			</tr>
+			<tr>
+				<td>InstanceReferences</td>
+				<td>[page:Object3D Object3D]</td>
+			</tr>
+			<tr>
+				<td>DirectionalLight</td>
+				<td>[page:DirectionalLight DirectionalLight]</td>
+			</tr>
+			<tr>
+				<td>PointLight</td>
+				<td>[page:PointLight PointLight]</td>
+			</tr>
+			<tr>
+				<td>RectangularLight</td>
+				<td>[page:RectAreaLight RectAreaLight]</td>
+			</tr>
+			<tr>
+				<td>SpotLight</td>
+				<td>[page:SpotLight SpotLight]</td>
+			</tr>
+		</table>
+
+		<h2>Code Example</h2>
+
+		<code>
+		// Instantiate a loader
+		var loader = new Rhino3dmLoader();
+
+		// Specify path to a folder containing WASM/JS libraries.
+		loader.setLibraryPath( '/examples/jsm/libs/rhino3dm/' );
+
+		// Load a 3DM file
+		loader.load(
+			// resource URL
+			'model.3dm',
+			// called when the resource is loaded
+			function ( object ) {
+
+				scene.add( object );
+
+			},
+			// called as loading progresses
+			function ( xhr ) {
+
+				console.log( ( xhr.loaded / xhr.total * 100 ) + '% loaded' );
+
+			},
+			// called when loading has errors
+			function ( error ) {
+
+				console.log( 'An error happened' );
+
+			}
+		);
+		</code>
+
+		<h2>Examples</h2>
+
+		<p>
+			[example:webgl_loader_3dm]
+		</p>
+
+		<hr>
+
+		<h2>Constructor</h2>
+
+		<h3>Rhino3dmLoader( [param:LoadingManager manager] )</h3>
+		<p>
+		[page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
+		</p>
+		<p>
+		Creates a new Rhino3dmLoader.
+		</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:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )</h3>
+		<p>
+		[page:String url] — A string containing the path/URL of the <em>.3dm</em> file.<br />
+		[page:Function onLoad] — A function to be called after the loading is successfully completed.<br />
+		[page:Function onProgress] — (optional) A function to be called while the loading is in progress. The argument will be the XMLHttpRequest instance, that 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 error as an argument.<br />
+		</p>
+		<p>
+		Begin loading from url and call the <em>onLoad</em> function with the geometry.
+		</p>
+
+		<h3>[method:this setLibraryPath]( [param:String value] )</h3>
+		<p>
+		[page:String value] — Path to folder containing the JS and WASM libraries.
+		</p>
+
+		<h3>[method:this setWorkerLimit]( [param:Number workerLimit] )</h3>
+		<p>
+			[page:Number workerLimit] - Maximum number of workers to be allocated. Default is 4.<br />
+		</p>
+		<p>
+		Sets the maximum number of [link:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers Web Workers]
+		to be used during decoding. A lower limit may be preferable if workers are also for other tasks
+		in the application.
+		</p>
+
+		<h3>[method:this dispose]()</h3>
+		<p>
+		Disposes of the loader resources and deallocates memory.
+		</p>
+
+		<h2>Source</h2>
+
+		<p>
+			[link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/3DMLoader.js examples/jsm/loaders/3DMLoader.js]
+		</p>
+	</body>
+</html>

+ 1 - 0
docs/list.js

@@ -389,6 +389,7 @@ var list = {
 			},
 			},
 
 
 			"Loaders": {
 			"Loaders": {
+				"3DMLoader": "examples/en/loaders/3DMLoader",
 				"BasisTextureLoader": "examples/en/loaders/BasisTextureLoader",
 				"BasisTextureLoader": "examples/en/loaders/BasisTextureLoader",
 				"DRACOLoader": "examples/en/loaders/DRACOLoader",
 				"DRACOLoader": "examples/en/loaders/DRACOLoader",
 				"GLTFLoader": "examples/en/loaders/GLTFLoader",
 				"GLTFLoader": "examples/en/loaders/GLTFLoader",