OSDN Git Service

three.jsをThirdPartyに追加
[webglgame/webgl_framework.git] / webglFramework / Thirdparty / three.js-master / docs / api / loaders / ObjectLoader.html
1 <!DOCTYPE html>
2 <html lang="en">
3         <head>
4                 <meta charset="utf-8" />
5                 <base href="../../" />
6                 <script src="list.js"></script>
7                 <script src="page.js"></script>
8                 <link type="text/css" rel="stylesheet" href="page.css" />
9         </head>
10         <body>
11                 <h1>[name]</h1>
12
13                 <div class="desc">
14                         A loader for loading a JSON resource. Unlike the [page:JSONLoader], this one make use of the
15                         <em>.type</em> attributes of objects to map them to their original classes.<br /><br />
16
17                         Note that this loader can't load [page:Geometries]. Use [page:JSONLoader] instead for that.<br /><br />
18
19                         This uses the [page:FileLoader] internally for loading files.
20                 </div>
21
22                 <h2>Example</h2>
23
24                 <div>
25
26                         [example:webgl_animation_scene WebGL / animation / scene]<br />
27                         [example:webgl_loader_json_claraio WebGL / loader / json / claraio]<br />
28                         [example:webgl_loader_msgpack WebGL / loader / msgpack]
29                 </div>
30
31                 <code>
32 var loader = new THREE.ObjectLoader();
33
34 loader.load(
35     // resource URL
36     "models/json/example.json",
37
38     // pass the loaded data to the onLoad function.
39                 //Here it is assumed to be an object
40     function ( obj ) {
41                                 //add the loaded object to the scene
42         scene.add( obj );
43     },
44
45     // Function called when download progresses
46     function ( xhr ) {
47         console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
48     },
49
50     // Function called when download errors
51     function ( xhr ) {
52         console.error( 'An error happened' );
53     }
54 );
55
56
57 // Alternatively, to parse a previously loaded JSON structure
58 var object = loader.parse( a_json_object );
59
60 scene.add( object );
61                 </code>
62
63
64
65                 <h2>Constructor</h2>
66
67                 <h3>[name]( [page:LoadingManager manager] )</h3>
68                 <div>
69                 [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].<br /><br />
70
71                 Creates a new [name].
72                 </div>
73
74
75                 <h2>Properties</h2>
76
77                 <h3>[property:String crossOrigin]</h3>
78                 <div>
79                 If set, assigns the [link:https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes crossOrigin]
80          attribute of the image to the value of *crossOrigin*,
81                 prior to starting the load. Default is *undefined*.
82                 </div>
83
84                 <h3>[property:LoadingManager manager]</h3>
85                 <div>
86                         The [page:LoadingManager loadingManager]  the loader is using. Default is [page:DefaultLoadingManager].
87                 </div>
88
89                 <h3>[property:String texturePath]</h3>
90                 <div>
91                         The base path or URL from which textures will be loaded. See [page:.setTexturePath].
92                         Default is the empty string.
93                 </div>
94
95                 <h2>Methods</h2>
96
97                 <h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
98                 <div>
99                 [page:String url] — the path or URL to the file. This can also be a
100                         [link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].<br />
101                 [page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:Object3D object].<br />
102                 [page:Function onProgress] — Will be called while load progresses. The argument will be the XMLHttpRequest instance, which contains .[page:Integer total] and .[page:Integer loaded] bytes.<br />
103                 [page:Function onError] — Will be called when load errors.<br />
104                 </div>
105                 <div>
106                 Begin loading from url and call onLoad with the parsed response content.
107                 </div>
108
109
110                 <h3>[method:Object3D parse]( [page:Object json], [page:Function onLoad]  )</h3>
111                 <div>
112                 [page:Object json] — required. The JSON source to parse.<br /><br />
113                 [page:Function onLoad] — Will be called when parsed completes. The argument will be the parsed [page:Object3D object].<br />
114
115                 Parse a <em>JSON</em> structure and return a threejs object.
116                 This is used internally by [page:.load], but can also be used directly to parse
117                 a previously loaded JSON structure.
118                 </div>
119
120                 <h3>[method:Object3D parseGeometries]( [page:Object json] )</h3>
121                 <div>
122                 [page:Object json] — required. The JSON source to parse.<br /><br />
123
124                 This is used [page:.parse] to parse any [page:Geometry geometries] or [page:BufferGeometry buffer geometries]  in the JSON structure.
125                 Internally it uses [page:JSONLoader] for geometries and [page:BufferGeometryLoader] for buffer geometries.
126                 </div>
127
128                 <h3>[method:Object3D parseMaterials]( [page:Object json] )</h3>
129                 <div>
130                 [page:Object json] — required. The JSON source to parse.<br /><br />
131
132                 This is used [page:.parse] to parse any materials in the JSON structure using [page:MaterialLoader].
133                 </div>
134
135                 <h3>[method:Object3D parseAnimations]( [page:Object json] )</h3>
136                 <div>
137                 [page:Object json] — required. The JSON source to parse.<br /><br />
138
139                 This is used [page:.parse] to parse any animations in the JSON structure, using [page:AnimationClip.parse].
140                 </div>
141
142                 <h3>[method:Object3D parseImages]( [page:Object json] )</h3>
143                 <div>
144                 [page:Object json] — required. The JSON source to parse.<br /><br />
145
146                 This is used [page:.parse] to parse any images in the JSON structure, using [page:ImageLoader].
147                 </div>
148
149                 <h3>[method:Object3D parseTextures]( [page:Object json] )</h3>
150                 <div>
151                 [page:Object json] — required. The JSON source to parse.<br /><br />
152
153                 This is used [page:.parse] to parse any textures in the JSON structure.
154                 </div>
155
156                 <h3>[method:Object3D parseObject]( [page:Object json] )</h3>
157                 <div>
158                 [page:Object json] — required. The JSON source to parse.<br /><br />
159
160                 This is used [page:.parse] to parse any objects in the JSON structure.
161                 Objects can be of the following types:
162
163                 <ul>
164                         <li>
165                                 [page:Scene]
166                         </li>
167                         <li>
168                                 [page:PerspectiveCamera]
169                         </li>
170                         <li>
171                                 [page:OrthographicCamera]
172                         </li>
173                         <li>
174                                 [page:AmbientLight]
175                         </li>
176                         <li>
177                                 [page:DirectionalLight]
178                         </li>
179                         <li>
180                                 [page:PointLight]
181                         </li>
182                         <li>
183                                 [page:SpotLight]
184                         </li>
185                         <li>
186                                 [page:HemisphereLight]
187                         </li>
188                         <li>
189                                 [page:Mesh]
190                         </li>
191                         <li>
192                                 [page:LOD]
193                         </li>
194                         <li>
195                                 [page:Line]
196                         </li>
197                         <li>
198                                 [page:LineSegments]
199                         </li>
200                         <li>
201                                 [page:Points]
202                         </li>
203                         <li>
204                                 [page:Sprite]
205                         </li>
206                         <li>
207                                 [page:Group]
208                         </li>
209                         <li>
210                                 [page:Object3D]
211                         </li>
212
213                 </ul>
214                 </div>
215
216                 <h3>[method:null setCrossOrigin]( [page:String value] )</h3>
217                 <div>
218                 [page:String value] — The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS.
219                 </div>
220
221                 <h3>[method:null setTexturePath]( [page:String value] )</h3>
222                 <div>
223                 [page:String value] — The base path or URL from which textures will be loaded.<br /><br />
224
225
226                 </div>
227
228                 <h2>Source</h2>
229
230                 [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
231         </body>
232 </html>