|
9 | 9 | <body> |
10 | 10 | <h1>[name]</h1> |
11 | 11 |
|
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> |
13 | 13 |
|
14 | | - <h2>Constructor</h2> |
15 | 14 |
|
| 15 | + <h2>Constructor</h2> |
16 | 16 |
|
17 | 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> |
| 18 | + <div> |
| 19 | + manager -- The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager]. |
| 20 | + </div> |
21 | 21 | <div> |
22 | 22 | Creates a new [name]. |
23 | 23 | </div> |
24 | | - |
| 24 | + |
25 | 25 | <h2>Properties</h2> |
26 | 26 |
|
27 | 27 | <h3>[property:string crossOrigin]</h3> |
28 | 28 | <div> |
29 | 29 | The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS. |
30 | | - </div> |
| 30 | + </div> |
31 | 31 |
|
32 | 32 | <h2>Methods</h2> |
33 | 33 |
|
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> |
35 | 35 | <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 /> |
39 | 39 | url — required |
40 | 40 | </div> |
41 | 41 | <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> |
44 | 44 |
|
45 | | - <h3>[method:todo setCrossOrigin]([page:String value])</h3> |
| 45 | + <h3>[method:null setCrossOrigin]([page:String value])</h3> |
46 | 46 | <div> |
47 | | - value -- The crossOrigin string. |
| 47 | + value -- The crossOrigin string. |
48 | 48 | </div> |
49 | 49 | <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 | + |
52 | 85 |
|
53 | 86 | <h2>Source</h2> |
54 | 87 |
|
|
0 commit comments