ObjectLoader.html 2.1 KB
Newer Older
1 2 3
<!DOCTYPE html>
<html lang="en">
	<head>
4
		<meta charset="utf-8" />
5 6 7
		<script src="../../list.js"></script>
		<script src="../../page.js"></script>
		<link type="text/css" rel="stylesheet" href="../../page.css" />
8 9 10
	</head>
	<body>
		<h1>[name]</h1>
M
Mr.doob 已提交
11

12
		<div class="desc">A loader for loading a JSON resource. Unlike the [page:JSONLoader JSONLoader], this one make use of the <em>.type</em> attributes of objects to map them to their original classes.</div>
M
Mr.doob 已提交
13 14


15
		<h2>Constructor</h2>
M
Mr.doob 已提交
16

17 18 19 20 21 22 23
		<h3>[name]([page:LoadingManager manager])</h3>
		<div>
		manager — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
		</div>
		<div>
		Creates a new [name].
		</div>
M
Mr.doob 已提交
24 25


26
		<h2>Properties</h2>
M
Mr.doob 已提交
27

28 29 30

		<h2>Methods</h2>

31
		<h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
32 33 34 35 36 37
		<div>
		url — required<br />
		onLoad — Will be called when load completes. The argument will be the loaded [page:Object3D object].<br />
		onProgress — Will be called while load progresses. The argument will be the XmlHttpRequest instance, that contain .[page:Integer total] and .[page:Integer loaded] bytes.<br />
		onError — Will be called when load errors.<br />
		</div>
C
cjshannon 已提交
38
		<div>
39 40
		Begin loading from url and call onLoad with the parsed response content.
		</div>
C
cjshannon 已提交
41

M
Mr.doob 已提交
42

43
		<h3>[method:Object3D parse]( [page:String json] )</h3>
44 45 46 47 48 49
		<div>
		json — required. The JSON source to parse<br />
		</div>
		<div>
		Parses a JSON content and return a threejs object.
		</div>
M
Mr.doob 已提交
50

51
		<h3>[method:null setCrossOrigin]([page:String value]</h3>
C
cjshannon 已提交
52
		<div>
53
		value — The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS.
C
cjshannon 已提交
54
		</div>
55 56 57 58


		<h2>Example</h2>

59 60 61 62 63 64 65 66 67 68 69
		<code>
		// instantiate a loader
		var loader = new THREE.ObjectLoader();

		// assuming we loaded a JSON structure from elsewhere
		var object = loader.parse( a_json_object );

		scene.add( object );
		</code>

		[example:webgl_loader_msgpack]
70 71


72
		<h2>Source</h2>
M
Mr.doob 已提交
73

74 75 76
		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
	</body>
</html>