Skip to content

Commit 99c0ba5

Browse files
committed
Formatted codegot approval from mrdoobapproves; it says Possibly \o/*\o
1 parent 4bd8e06 commit 99c0ba5

File tree

7 files changed

+92
-44
lines changed

7 files changed

+92
-44
lines changed

docs/examples/loaders/BabylonLoader.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,21 @@ <h2>Example</h2>
2727
'models/babylon/skull.babylon',
2828
// called when resource is loaded
2929
function ( object ) {
30+
3031
scene.add( object );
32+
3133
},
3234
// called when loading is in progress
3335
function ( xhr ) {
34-
console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
36+
37+
console.log( ( xhr.loaded / xhr.total * 100 ) + '% loaded' );
38+
3539
},
3640
// called when loading has errors
3741
function ( xhr ) {
42+
3843
console.log( 'An error happened' );
44+
3945
}
4046
);
4147
</code>

docs/examples/loaders/GLTFLoader.html

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -46,32 +46,38 @@ <h2>Extensions</h2>
4646
<h2>Example</h2>
4747

4848
<code>
49-
// Instantiate a loader
50-
var loader = new THREE.GLTFLoader();
51-
52-
// Load a glTF resource
53-
loader.load(
54-
// resource URL
55-
'models/gltf/duck/duck.gltf',
56-
// called when the resource is loaded
57-
function ( gltf ) {
58-
scene.add( gltf.scene );
59-
60-
gltf.animations; // Array&lt;THREE.AnimationClip&gt;
61-
gltf.scene; // THREE.Scene
62-
gltf.scenes; // Array&lt;THREE.Scene&gt;
63-
gltf.cameras; // Array&lt;THREE.Camera&gt;
64-
},
65-
// called when loading is in progresses
66-
function ( xhr ) {
67-
console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
68-
},
69-
// called when loading has errors
70-
function ( error ) {
71-
console.log( 'An error happened' );
72-
}
73-
);
74-
</code>
49+
// Instantiate a loader
50+
var loader = new THREE.GLTFLoader();
51+
52+
// Load a glTF resource
53+
loader.load(
54+
// resource URL
55+
'models/gltf/duck/duck.gltf',
56+
// called when the resource is loaded
57+
function ( gltf ) {
58+
59+
scene.add( gltf.scene );
60+
61+
gltf.animations; // Array&lt;THREE.AnimationClip&gt;
62+
gltf.scene; // THREE.Scene
63+
gltf.scenes; // Array&lt;THREE.Scene&gt;
64+
gltf.cameras; // Array&lt;THREE.Camera&gt;
65+
66+
},
67+
// called when loading is in progresses
68+
function ( xhr ) {
69+
70+
console.log( ( xhr.loaded / xhr.total * 100 ) + '% loaded' );
71+
72+
},
73+
// called when loading has errors
74+
function ( error ) {
75+
76+
console.log( 'An error happened' );
77+
78+
}
79+
);
80+
</code>
7581

7682
[example:webgl_loader_gltf]
7783

docs/examples/loaders/OBJLoader.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,21 @@ <h2>Example</h2>
3131
'models/monster.obj',
3232
// called when resource is loaded
3333
function ( object ) {
34+
3435
scene.add( object );
36+
3537
},
3638
// called when loading is in progresses
3739
function ( xhr ) {
38-
console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
40+
41+
console.log( ( xhr.loaded / xhr.total * 100 ) + '% loaded' );
42+
3943
},
4044
// called when loading has errors
4145
function ( error ) {
46+
4247
console.log( 'An error happened' );
48+
4349
}
4450
);
4551
</code>

docs/examples/loaders/PCDLoader.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,24 @@ <h2>Example</h2>
2626
// load a resource
2727
loader.load(
2828
// resource URL
29-
'pointcloud.pcd' ,
29+
'pointcloud.pcd',
3030
// called when the resource is loaded
3131
function ( mesh ) {
32+
3233
scene.add( mesh );
34+
3335
},
3436
// called when loading is in progresses
3537
function ( xhr ) {
36-
console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
38+
39+
console.log( ( xhr.loaded / xhr.total * 100 ) + '% loaded' );
40+
3741
},
3842
// called when loading has errors
3943
function ( error ) {
44+
4045
console.log( 'An error happened' );
46+
4147
}
4248
);
4349
</code>

docs/examples/loaders/PDBLoader.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,19 @@ <h2>Example</h2>
3333
var json = pdb.json;
3434

3535
console.log( 'This molecule has ' + json.atoms.length + ' atoms' );
36+
3637
},
3738
// called when loading is in progresses
3839
function ( xhr ) {
39-
console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
40+
41+
console.log( ( xhr.loaded / xhr.total * 100 ) + '% loaded' );
42+
4043
},
4144
// called when loading has errors
4245
function ( error ) {
46+
4347
console.log( 'An error happened' );
48+
4449
}
4550
);
4651
</code>

docs/examples/loaders/SVGLoader.html

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,34 @@ <h1>[name]</h1>
1818
<h2>Example</h2>
1919

2020
<code>
21+
// instantiate a loader
22+
var loader = new THREE.PDBLoader();
2123

22-
// instantiate the loader
23-
var loader = new THREE.SVGLoader();
24-
25-
// load a SVG resource
24+
// load a PDB resource
2625
loader.load(
27-
// resource URL
28-
'data/svgSample.svg',
29-
// called when the resource is loaded.
30-
function(doc){
31-
scene.add( new THREE.SVGObject(doc) );
26+
// resource URL
27+
'models/molecules/caffeine.pdb',
28+
// called when the resource is loaded
29+
function ( pdb ) {
30+
31+
var geometryAtoms = pdb.geometryAtoms;
32+
var geometryBonds = pdb.geometryBonds;
33+
var json = pdb.json;
34+
35+
console.log( 'This molecule has ' + json.atoms.length + ' atoms' );
36+
3237
},
33-
// called when the loading failed with errors.
34-
function(error){
35-
console.log("Error loading SVG!");
38+
// called when loading is in progresses
39+
function ( xhr ) {
40+
41+
console.log( ( xhr.loaded / xhr.total * 100 ) + '% loaded' );
42+
43+
},
44+
// called when loading has errors
45+
function ( error ) {
46+
47+
console.log( 'An error happened' );
48+
3649
}
3750
);
3851
</code>

docs/examples/loaders/TGALoader.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,21 @@ <h2>Example</h2>
2626
'textures/crate_grey8.tga'
2727
// called when loading is completed
2828
function ( texture ) {
29+
2930
console.log( 'Texture is loaded' );
31+
3032
},
3133
// called when the loading is in progresses
3234
function ( xhr ) {
33-
console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
35+
36+
console.log( ( xhr.loaded / xhr.total * 100 ) + '% loaded' );
37+
3438
},
3539
// called when the loading failes
3640
function ( error ) {
41+
3742
console.log( 'An error happened' );
43+
3844
}
3945
);
4046

0 commit comments

Comments
 (0)