Skip to content

Commit 6884894

Browse files
committed
working on loaders docs, with new cross doc syntax
1 parent 0425538 commit 6884894

12 files changed

Lines changed: 297 additions & 175 deletions

docs/api/loaders/BabylonLoader.html

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,30 +28,53 @@ <h2>Properties</h2>
2828

2929
<h2>Methods</h2>
3030

31-
<h3>.load( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
31+
<h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
3232
<div>
3333
url — required<br />
34-
onLoad — Will be called when load completes. The argument will be the loaded [page:Object3D object].<br />
34+
onLoad — Will be called when load completes. The argument will be the loaded [page:Object3D].<br />
3535
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 />
3636
onError — Will be called when load errors.<br />
3737
</div>
3838
<div>
3939
Begin loading from url and call onLoad with the parsed response content.
4040
</div>
4141

42-
<h3>.parse([page:Object json])</h3>
42+
<h3>[method:Object3D parse]([page:Object json])</h3>
4343
<div>
4444
text — The <em>JSON</em> structure to parse.
4545
</div>
4646
<div>
4747
Parse a <em>JSON</em> structure and returns an [page:Object3D object] or a [page:Scene scene].<br />
48-
Found objects are converted to [page:Mesh meshs] with a [page:BufferGeometry BufferGeometry] and a default [page:MeshPhongMaterial MeshPhongMaterial].<br />
48+
Found objects are converted to [page:Mesh] with a [page:BufferGeometry] and a default [page:MeshPhongMaterial].<br />
4949
Lights are parsed accordingly.
5050
</div>
5151

5252
<h2>Example</h2>
5353

54-
<a target="_parent" href="http://threejs.org/examples/#webgl_loader_babylon">webgl_loader_babylon</a>
54+
<code>
55+
// instantiate a loader
56+
var loader = new THREE.BabylonLoader();
57+
58+
// load a Babylon resource
59+
loader.load(
60+
// resource URL
61+
'models/babylon/skull.babylon',
62+
// Function when resource is loaded
63+
function ( object ) {
64+
scene.add( object );
65+
},
66+
// Function called when download progresses
67+
function ( xhr ) {
68+
console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
69+
},
70+
// Function called when download errors
71+
function ( xhr ) {
72+
console.log( 'An error happened' );
73+
}
74+
);
75+
</code>
76+
77+
[example:webgl_loader_babylon]
5578

5679

5780
<h2>Source</h2>

docs/api/loaders/BufferGeometryLoader.html

Lines changed: 53 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,36 +9,72 @@
99
<body>
1010
<h1>[name]</h1>
1111

12-
<div class="desc">todo</div>
12+
<div class="desc">A loader for loading an [page:BufferGeometry].</div>
1313

14-
<h2>Example</h2>
15-
16-
<code>todo</code>
1714

1815
<h2>Constructor</h2>
1916

20-
21-
<h3>todo</h3>
22-
<div></div>
17+
<h3>[name]([page:LoadingManager manager])</h3>
18+
<div>
19+
manager -- The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
20+
</div>
21+
<div>
22+
Creates a new [name].
23+
</div>
2324

2425

2526
<h2>Properties</h2>
2627

27-
<h3>todo</h3>
28-
<div>
29-
todo
30-
</div>
31-
3228

3329
<h2>Methods</h2>
34-
3530

36-
<h3>todo</h3>
37-
<div>todo</div>
31+
<h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
32+
<div>
33+
url — required<br />
34+
onLoad — Will be called when load completes. The argument will be the loaded [page:BufferGeometry].<br />
35+
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 />
36+
onError — Will be called when load errors.<br />
37+
</div>
38+
<div>
39+
Begin loading from url and call onLoad with the parsed response content.
40+
</div>
41+
42+
<h3>[method:BufferGeometry parse]([page:Object json])</h3>
3843
<div>
39-
todo
44+
text — The <em>JSON</em> structure to parse.
4045
</div>
41-
46+
<div>
47+
Parse a <em>JSON</em> structure and returns an [page:BufferGeometry].
48+
</div>
49+
50+
51+
<h2>Example</h2>
52+
53+
<code>
54+
// instantiate a loader
55+
var loader = new THREE.BabylonLoader();
56+
57+
// load a resource
58+
loader.load(
59+
// resource URL
60+
'models/json/pressure.json',
61+
// Function when resource is loaded
62+
function ( geometry ) {
63+
var material = new THREE.MeshLambertMaterial( { color: 0xF5F5F5 } );
64+
var object = new THREE.Mesh( geometry, material );
65+
scene.add( object );
66+
},
67+
// Function called when download progresses
68+
function ( xhr ) {
69+
console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
70+
},
71+
// Function called when download errors
72+
function ( xhr ) {
73+
console.log( 'An error happened' );
74+
}
75+
);
76+
</code>
77+
4278
<h2>Source</h2>
4379

4480
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]

docs/api/loaders/Cache.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<body>
1010
<h1>[name]</h1>
1111

12-
<div class="desc">A simple caching classe.</div>
12+
<div class="desc">A simple caching classe, used internaly by [page:XHRLoader].</div>
1313

1414

1515
<h2>Constructor</h2>
@@ -22,15 +22,15 @@ <h3>[name]()</h3>
2222

2323
<h2>Properties</h2>
2424

25-
<h3>.[page:Object files]</h3>
25+
<h3>[property:Object files]</h3>
2626
<div>
2727
An [page:Object object] that hold cached values.
2828
</div>
2929

3030

3131
<h2>Methods</h2>
3232

33-
<h3>.add( [page:String key], value )</h3>
33+
<h3>[method:null add]( [page:String key], value )</h3>
3434
<div>
3535
key — required. A string key <br />
3636
value — <br />
@@ -39,23 +39,23 @@ <h3>.add( [page:String key], value )</h3>
3939
Adds a cache entry with that key to hold the value. If this key already holds a value, it is overwritten.
4040
</div>
4141

42-
<h3>.get( [page:String key] )</h3>
42+
<h3>[method:null get]( [page:String key] )</h3>
4343
<div>
4444
key — required. A string key <br />
4545
</div>
4646
<div>
4747
Get the value of key. If the key does not exist the null value is returned.
4848
</div>
4949

50-
<h3>.remove( [page:String key] )</h3>
50+
<h3>[method:null remove]( [page:String key] )</h3>
5151
<div>
5252
key — required. A string key <br />
5353
</div>
5454
<div>
5555
Remove the cached value associated with the key.
5656
</div>
5757

58-
<h3>.clear()</h3>
58+
<h3>[method:null clear]()</h3>
5959
<div>
6060
Remove all values from the cache.
6161
</div>

docs/api/loaders/ImageLoader.html

Lines changed: 50 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,46 +9,79 @@
99
<body>
1010
<h1>[name]</h1>
1111

12-
<div class="desc">A loader for loading an [page:Image image].</div>
12+
<div class="desc">A loader for loading an [page:Image].</div>
1313

14-
<h2>Constructor</h2>
1514

15+
<h2>Constructor</h2>
1616

1717
<h3>[name]([page:LoadingManager manager])</h3>
18-
<div>
19-
manager -- The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
20-
</div>
18+
<div>
19+
manager -- The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
20+
</div>
2121
<div>
2222
Creates a new [name].
2323
</div>
24-
24+
2525
<h2>Properties</h2>
2626

2727
<h3>[property:string crossOrigin]</h3>
2828
<div>
2929
The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS.
30-
</div>
30+
</div>
3131

3232
<h2>Methods</h2>
3333

34-
<h3>[method:Image load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
34+
<h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
3535
<div>
36-
onLoad -- Will be called when load completes. The argument will be the loaded Imageloader.
37-
onProgress -- Will be called while load progresses. The argument will be the progress event.
38-
onError -- Will be called when load errors.
36+
onLoad -- Will be called when load completes. The argument will be the loaded Imageloader.<br />
37+
onProgress -- Will be called while load progresses. The argument will be the progress event.<br />
38+
onError -- Will be called when load errors.<br />
3939
url — required
4040
</div>
4141
<div>
42-
Begin loading from url and return the [page:Image image] object that will contain the data.
43-
</div>
42+
Begin loading from url and return the [page:Image image] object that will contain the data.
43+
</div>
4444

45-
<h3>[method:todo setCrossOrigin]([page:String value])</h3>
45+
<h3>[method:null setCrossOrigin]([page:String value])</h3>
4646
<div>
47-
value -- The crossOrigin string.
47+
value -- The crossOrigin string.
4848
</div>
4949
<div>
50-
The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS.
51-
</div>
50+
The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS.
51+
</div>
52+
53+
<h2>Example</h2>
54+
55+
<code>
56+
// instantiate a loader
57+
var loader = new THREE.ImageLoader();
58+
59+
// load a image resource
60+
loader.load(
61+
// resource URL
62+
'textures/skyboxsun25degtest.png',
63+
// Function when resource is loaded
64+
function ( image ) {
65+
// do something with it
66+
67+
// like drawing a part of if on a canvas
68+
var canvas = document.createElement( 'canvas' );
69+
var context = canvas.getContext( '2d' );
70+
context.drawImage( image, 100, 100 );
71+
},
72+
// Function called when download progresses
73+
function ( xhr ) {
74+
console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
75+
},
76+
// Function called when download errors
77+
function ( xhr ) {
78+
console.log( 'An error happened' );
79+
}
80+
);
81+
</code>
82+
83+
[example:webgl_shaders_ocean]
84+
5285

5386
<h2>Source</h2>
5487

docs/api/loaders/JSONLoader.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,26 +23,26 @@ <h3>[name]([page:Boolean showStatus])</h3>
2323
<div>
2424
todo
2525
</div>
26-
26+
2727
<h2>Properties</h2>
2828

2929

3030
<h3>[property:boolean withCredentials]</h3>
3131
<div>
3232
todo
33-
</div>
33+
</div>
3434

3535
<h2>Methods</h2>
3636

37-
<h3>[method:todo load]( [page:String url], [page:Function callback], [page:String texturePath] )</h3>
37+
<h3>[method:null load]( [page:String url], [page:Function callback], [page:String texturePath] )</h3>
3838
<div>
3939
url — required<br />
4040
callback — required. This function will be called with the loaded model as an instance of [page:Geometry geometry] when the load is completed.<br />
4141
texturePath — optional. If not specified, textures will be assumed to be in the same folder as the Javascript model file.
4242
</div>
4343

4444

45-
<h3>[method:todo parse]([page:todo json], [page:todo texturePath])</h3>
45+
<h3>[method:Object3D parse]([page:todo json], [page:todo texturePath])</h3>
4646
<div>
4747
json -- todo <br />
4848
texturePath -- todo
@@ -51,7 +51,7 @@ <h3>[method:todo parse]([page:todo json], [page:todo texturePath])</h3>
5151
todo
5252
</div>
5353

54-
<h3>[method:todo loadAjaxJSON]([page:todo context], [page:todo url], [page:todo callback], [page:todo texturePath], [page:todo callbackProgress])</h3>
54+
<h3>[method:null loadAjaxJSON]([page:todo context], [page:todo url], [page:todo callback], [page:todo texturePath], [page:todo callbackProgress])</h3>
5555
<div>
5656
context -- todo <br />
5757
url -- todo <br />

0 commit comments

Comments
 (0)