提交 7ec8b026 编写于 作者: Z zhangpeng26

translate

上级 bf10f071
......@@ -11,77 +11,77 @@
<h1>[name]</h1>
<p class="desc">
Class for loading [page:AnimationClip AnimationClips] in JSON format.
This uses the [page:FileLoader] internally for loading files.
以JSON格式来加载 [page:AnimationClip AnimationClips] 的一个类。
内部使用 [page:FileLoader] 来加载文件。
</p>
<h2>Example</h2>
<h2>例子</h2>
<code>
// instantiate a loader
// 初始化一个加载器
var loader = new THREE.AnimationLoader();
// load a resource
// 加载资源
loader.load(
// resource URL
// 资源URL
'animations/animation.js',
// onLoad callback
// onLoad回调
function ( animations ) {
// animations is an array of AnimationClips
// animations时一个AnimationClips组数
},
// onProgress callback
// onProgress回调
function ( xhr ) {
console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
},
// onError callback
// onError回调
function ( err ) {
console.log( 'An error happened' );
}
);
</code>
<h2>Constructor</h2>
<h2>构造函数</h2>
<h3>[name]( [param:LoadingManager manager] )</h3>
<p>
[page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].<br /><br />
[page:LoadingManager manager] — 加载器所使用的[page:LoadingManager loadingManager]。 默认为[page:LoadingManager THREE.DefaultLoadingManager].<br /><br />
Creates a new [name].
创建一个新的[name].
</p>
<h2>Properties</h2>
<h2>属性</h2>
<h3>[property:LoadingManager manager]</h3>
<p>
The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager].
加载器正在使用的[page:LoadingManager loadingManager]。默认为[page:DefaultLoadingManager].
</p>
<h2>Methods</h2>
<h2>方法</h2>
<h3>[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )</h3>
<p>
[page:String url] — the path or URL to the file. This can also be a
[page:String url] — 文件的URL或者路径,也可以为
[link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].<br />
[page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:Animation animation].<br />
[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 />
[page:Function onError] — Will be called if load errors.<br /><br />
[page:Function onLoad] — 加载完成时将调用。回调参数为将要加载的[page:Animation animation].<br />
[page:Function onProgress] — 将在加载过程中进行调用。参数为XMLHttpRequest实例,实例包含[page:Integer total]和[page:Integer loaded]字节。<br />
[page:Function onError] — 在加载错误时被调用。<br /><br />
Begin loading from url and pass the loaded animation to onLoad.
从URL中进行加载并将动画传递给onLoad。
</p>
<h3>[method:null parse]( [param:JSON json], [param:Function onLoad] )</h3>
<p>
[page:JSON json] — required<br />
[page:Function onLoad] — Will be called when parsing completes. <br /><br />
[page:JSON json] — 请求<br />
[page:Function onLoad] — 当解析完成时,将被调用 <br /><br />
Parse the JSON object and pass the result to onLoad. Individual clips in the object will
be parsed with [page:AnimationClip.parse].
解析JSON对象并将结果传递给onLoad。对象中的单个片段将
用[page [page:AnimationClip.parse]进行解析。
</p>
<h2>Source</h2>
<h2></h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
......
......@@ -11,88 +11,88 @@
<h1>[name]</h1>
<p class="desc">
Class for loading an
[link:https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer AudioBuffer].
This uses the [page:FileLoader] internally for loading files.
用来加载
[link:https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer AudioBuffer]的一个类。
内部默认使用[page:FileLoader]来加载文件。
</p>
<h2>Example</h2>
<h2>例子</h2>
<code>
// instantiate a listener
// 初始化一个监听
var audioListener = new THREE.AudioListener();
// add the listener to the camera
// 把监听添加到camera
camera.add( audioListener );
// instantiate audio object
// 初始化音频对象
var oceanAmbientSound = new THREE.Audio( audioListener );
// add the audio object to the scene
// 添加一个音频对象到场景中
scene.add( oceanAmbientSound );
// instantiate a loader
// 初始化一个加载器
var loader = new THREE.AudioLoader();
// load a resource
// 加载资源
loader.load(
// resource URL
// 资源URL
'audio/ambient_ocean.ogg',
// onLoad callback
// onLoad回调
function ( audioBuffer ) {
// set the audio object buffer to the loaded object
// 给一个加载器对象设置音频对象的缓存
oceanAmbientSound.setBuffer( audioBuffer );
// play the audio
// 播放音频
oceanAmbientSound.play();
},
// onProgress callback
// onProgress回调
function ( xhr ) {
console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
},
// onError callback
// onError回调
function ( err ) {
console.log( 'An error happened' );
}
);
</code>
<h2>Constructor</h2>
<h2>构造函数</h2>
<h3>[name]( [param:String context], [param:LoadingManager manager] )</h3>
<p>
[page:String context] — The [page:String AudioContext] for the loader to use. Default is [page:String window.AudioContext].<br />
[page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].<br /><br />
[page:String context] — 加载器使用的[page:String AudioContext]。 默认为[page:String window.AudioContext].<br />
[page:LoadingManager manager] — 加载器使用的[page:LoadingManager loadingManager]。默认为[page:LoadingManager THREE.DefaultLoadingManager].<br /><br />
Creates a new [name].
创建一个新的[name].
</p>
<h2>Properties</h2>
<h2>属性</h2>
<h3>[property:LoadingManager manager]</h3>
<p>
The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager].
加载器正在使用的[page:LoadingManager loadingManager]。默认为[page:DefaultLoadingManager].
</p>
<h2>Methods</h2>
<h2>方法</h2>
<h3>[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )</h3>
<p>
[page:String url] — the path or URL to the file. This can also be a
[page:String url] — 文件的URL或者路径,也可以为
[link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].<br />
[page:Function onLoad] — Will be called when load completes. The argument will be the loaded text response.<br />
[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 />
[page:Function onError] — Will be called when load errors.<br />
[page:Function onLoad] — 加载完成时将调用。回调参数为将要加载的响应文本。<br />
[page:Function onProgress] — 将在加载过程中进行调用。参数为XMLHttpRequest实例,实例包含[page:Integer total]和[page:Integer loaded]字节.<br />
[page:Function onError] — 在加载错误时被调用。<br />
</p>
<p>
Begin loading from url and pass the loaded [page:String AudioBuffer] to onLoad.
从URL中进行加载并将已经加载的[page:String AudioBuffer]传递给onLoad。
</p>
<h2>Source</h2>
<h2></h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
......
......@@ -11,81 +11,81 @@
<h1>[name]</h1>
<p class="desc">
A loader for loading a [page:BufferGeometry].
This uses the [page:FileLoader] internally for loading files.
用来加载[page:BufferGeometry]的加载器。
内部使用[page:FileLoader]来加载文件。
</p>
<h2>Example</h2>
<h2>例子</h2>
[example:webgl_geometry_colors_lookuptable WebGL / geometry / colors / lookuptable]
<code>
// instantiate a loader
// 初始化一个加载器
var loader = new THREE.BufferGeometryLoader();
// load a resource
// 加载资源
loader.load(
// resource URL
// 资源URL
'models/json/pressure.json',
// onLoad callback
// onLoad回调
function ( geometry ) {
var material = new THREE.MeshLambertMaterial( { color: 0xF5F5F5 } );
var object = new THREE.Mesh( geometry, material );
scene.add( object );
},
// onProgress callback
// onProgress回调
function ( xhr ) {
console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
},
// onError callback
// onError回调
function ( err ) {
console.log( 'An error happened' );
}
);
</code>
<h2>Constructor</h2>
<h2>构造函数</h2>
<h3>[name]( [param:LoadingManager manager] )</h3>
<p>
[page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
[page:LoadingManager manager] — 加载器所使用的[page:LoadingManager loadingManager]。默认为[page:LoadingManager THREE.DefaultLoadingManager].
</p>
<p>
Creates a new [name].
创建一个新的[name].
</p>
<h2>Properties</h2>
<h2>属性</h2>
<h3>[property:LoadingManager manager]</h3>
<p>
The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager].
正在使用的[page:LoadingManager loadingManager]。默认为[page:DefaultLoadingManager].
</p>
<h2>Methods</h2>
<h2>方法</h2>
<h3>[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )</h3>
<p>
[page:String url] — the path or URL to the file. This can also be a
[page:String url] — 文件的URL或者路径,也可以为
[link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].d<br />
[page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:BufferGeometry].<br />
[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 />
[page:Function onError] — Will be called when load errors.<br />
[page:Function onLoad] — 加载完成时将调用。回调参数为将要加载的[page:BufferGeometry].<br />
[page:Function onProgress] — 将在加载过程中进行调用。参数为XMLHttpRequest实例,实例包含[page:Integer total]和[page:Integer loaded]字节。<br />
[page:Function onError] —在加载错误时被调用。<br />
</p>
<p>
Begin loading from url and call onLoad with the parsed response content.
从URL中进行加载,并将已经以解析的响应内容传递给onLoad。
</p>
<h3>[method:BufferGeometry parse]( [param:Object json] )</h3>
<p>
[page:Object json] — The <em>JSON</em> structure to parse.<br /><br />
Parse a <em>JSON</em> structure and return a [page:BufferGeometry].
[page:Object json] — 所需要解析的<em>JSON</em>结构。<br /><br />
解析一个<em>JSON</em>结构,并返回[page:BufferGeometry].
</p>
<h2>Source</h2>
<h2></h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
......
......@@ -11,10 +11,10 @@
<h1>[name]</h1>
<p class="desc">
A simple caching system, used internally by [page:FileLoader].
一个简单的缓存系统,内部使用[page:FileLoader]。
</p>
<h2>Examples</h2>
<h2>例子</h2>
<p>
[example:webgl_geometry_text WebGL / geometry / text ]<br />
......@@ -24,51 +24,51 @@
<h2>Usage</h2>
<p>To enable caching across all loaders that use [page:FileLoader], set</p>
<p>
要在所有使用[page:FileLoader]的加载器上启用缓存, 需设置</p>
<code>
THREE.Cache.enabled = true.
</code>
<h2>Properties</h2>
<h2>属性</h2>
<h3>[property:Boolean enabled]</h3>
<p>Whether caching is enabled. Default is *false*.</p>
<p>是否启用缓存,默认为*false*.</p>
<h3>[property:Object files]</h3>
<p>An [page:Object object] that holds cached files.</p>
<p>一个[page:Object object]所持有的缓存文件。</p>
<h2>Methods</h2>
<h2>方法</h2>
<h3>[method:null add]( [param:String key], file )</h3>
<p>
[page:String key] — the [page:String key] to reference the cached file by.<br />
[page:Object file] — The file to be cached.<br /><br />
[page:String key] — 通过引用缓存文件的[page:String key]。<br />
[page:Object file] — 所被缓存的文件<br /><br />
Adds a cache entry with a key to reference the file. If this key already holds a file,
it is overwritten.
使用key为引用文件增加一个缓存入口。如果该key已持有一个文件,则会被覆盖。
</p>
<h3>[method:null get]( [param:String key] )</h3>
<p>
[page:String key] — A string key <br /><br />
[page:String key] — 一个字符串key <br /><br />
Get the value of [page:String key]. If the key does not exist *undefined* is returned.
获得该[page:String key]的值。 如果该key不存在,则以*undefined*被返回。
</p>
<h3>[method:null remove]( [param:String key] )</h3>
<p>
[page:String key] — A string key that references a cached file.<br /><br />
[page:String key] — 引用缓存文件的一个字符串key<br /><br />
Remove the cached file associated with the key.
使用key来删除相应的缓存文件。
</p>
<h3>[method:null clear]()</h3>
<p>Remove all values from the cache.</p>
<p>清除所有缓存中的值。</p>
<h2>Source</h2>
<h2></h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
......
......@@ -11,62 +11,61 @@
<h1>[name]</h1>
<p class="desc">
Abstract base class for block based textures loader (dds, pvr, ...).
This uses the [page:FileLoader] internally for loading files.
基于块的纹理加载器 (dds, pvr, ...)的抽象类。
内部使用[page:FileLoader]来加载文件。
</p>
<h2>Examples</h2>
<h2>例子</h2>
<p>
See the [link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/DDSLoader.js DDSLoader]
and [link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/PVRLoader.js PVRLoader]
for examples of derived classes.
请参考[link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/DDSLoader.js DDSLoader]
[link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/PVRLoader.js PVRLoader]
子类的例子
</p>
<h2>Constructor</h2>
<h2>构造函数</h2>
<h3>[name]( [param:LoadingManager manager] )</h3>
<p>
[page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use.
Default is [page:LoadingManager THREE.DefaultLoadingManager].<br /><br />
[page:LoadingManager manager] — 加载器使用的[page:LoadingManager loadingManager]。
默认为[page:LoadingManager THREE.DefaultLoadingManager].<br /><br />
Creates a new [name].
创建一个新的[name].
</p>
<h2>Properties</h2>
<h2>属性</h2>
<h3>[property:LoadingManager manager]</h3>
<p>
The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager].
加载器正在使用的[page:LoadingManager loadingManager]。默认为[page:DefaultLoadingManager]。
</p>
<h3>[property:String path]</h3>
<p>The base path from which files will be loaded. See [page:.setPath]. Default is *undefined*.</p>
<p>加载的基本路径。请参考[page:.setPath]。默认为*undefined*.</p>
<h2>Methods</h2>
<h2>方法</h2>
<h3>[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )</h3>
<p>
[page:String url] — the path or URL to the file. This can also be a
[page:String url] — 文件的URL或者路径,也可以为
[link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].<br />
[page:Function onLoad] — Will be called when load completes. The argument will be the loaded texture.<br />
[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 />
[page:Function onError] — Will be called when load errors.<br />
[page:Function onLoad] — 加载完成时将调用。回调参数为将要加载的纹理。<br />
[page:Function onProgress] — 将在加载过程中进行调用。参数为XMLHttpRequest实例,实例包含[page:Integer total]和[page:Integer loaded]字节。<br />
[page:Function onError] — 在加载错误时被调用。<br />
</p>
<p>
Begin loading from url and pass the loaded texture to onLoad.
从URL中进行加载,并将被加载的纹理传递给onLoad。
</p>
<h3>[method:FileLoader setPath]( [param:String path] )</h3>
<p>
Set the base path or URL from which to load files. This can be useful if
you are loading many textures from the same directory.
设置加载文件的基本路径或URL。当加载同一目录中的许多模型,此方法将很有用。
</p>
<h2>Source</h2>
<h2></h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
......
......@@ -11,11 +11,11 @@
<h1>[name]</h1>
<p class="desc">
Class for loading a [page:CubeTexture CubeTexture].
This uses the [page:ImageLoader] internally for loading files.
加载[page:CubeTexture CubeTexture]的一个类。
内部使用[page:ImageLoader]来加载文件。
</p>
<h2>Example</h2>
<h2>例子</h2>
<p>
[example:webgl_materials_cubemap materials / cubemap]<br />
......@@ -40,63 +40,62 @@ scene.background = new THREE.CubeTextureLoader()
] );
</code>
<h2>Constructor</h2>
<h2>构造函数</h2>
<h3>[name]( [param:LoadingManager manager] )</h3>
<p>
[page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].<br /><br />
[page:LoadingManager manager] — 加载器使用的[page:LoadingManager loadingManager]。默认为[page:LoadingManager THREE.DefaultLoadingManager].<br /><br />
Creates a new [name].
创建一个新的[name].
</p>
<h2>Properties</h2>
<h2>属性</h2>
<h3>[property:String crossOrigin]</h3>
<p>
If set, assigns the [link:https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes crossOrigin]
attribute of the image to the value of *crossOrigin*,
prior to starting the load. Default is *"anonymous"*.
如果设置了,在开始加载前, 将为图片分配 [link:https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes crossOrigin]
属性,其值为 *crossOrigin*, 默认为"anonymous"。
</p>
<h3>[property:LoadingManager manager]</h3>
<p>
The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager].
加载器正在使用的[page:LoadingManager loadingManager]。默认为[page:DefaultLoadingManager]。
</p>
<h3>[property:String path]</h3>
<p>The base path from which files will be loaded. See [page:.setPath]. Default is *undefined*.</p>
<p>加载加载的文件的基本路径。 请参考[page:.setPath]。默认为*undefined*.</p>
<h2>Methods</h2>
<h2>方法</h2>
<h3>[method:null load]( [param:String urls], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )</h3>
<p>
[page:String urls] — array of 6 urls to images, one for each side of the CubeTexture.
The urls should be specified in the following order: pos-x, neg-x, pos-y, neg-y, pos-z, neg-z.
They can also be [link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URIs].<br />
Note that, by convention, cube maps are specified in a coordinate system in which positive-x is to the right
when looking up the positive-z axis -- in other words, using a left-handed coordinate system.
Since three.js uses a right-handed coordinate system, environment maps used in three.js will have pos-x and neg-x swapped.<br />
[page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:Texture texture].<br />
[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 />
[page:Function onError] — Will be called when load errors.<br />
[page:String urls] — 数组长度为6的图像数组,数组内容为URL,每一个URL用于CubeTexture的每一侧。
这些URL将被指定顺序: pos-x, neg-x, pos-y, neg-y, pos-z, neg-z.
数组内容也可以为 [link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URIs].<br />
请注意,一般来说,在立方体贴图坐标系中,当查找positive-z轴时,positive-x表示右侧
- 换句话说,此坐标系使用左手坐标系。
由于three.js使用右手坐标系, 环境贴图将在three.js进行pos-x和neg-x进行交互.<br />
[page:Function onLoad] — 加载完成时将调用。回调参数是已被加载的[page:Texture texture].<br />
[page:Function onProgress] — 将在加载过程中进行调用。参数为XMLHttpRequest实例,
其中包含 [page:Integer total] 和 [page:Integer loaded] 字节。<br />
[page:Function onError] — 在加载错误时被调用。<br />
</p>
<p>
Begin loading from url and pass the loaded [page:Texture texture] to onLoad.
从URL中进行加载,并将被加载的[page:Texture texture]传递给onLoad。
</p>
<h3>[method:null setCrossOrigin]( [param:String value] )</h3>
<p> Set the [page:.crossOrigin] attribute.</p>
<p> 设置[page:.crossOrigin]的属性。</p>
<h3>[method:FileLoader setPath]( [param:String path] )</h3>
<p>
Set the base path or URL from which to load files. This can be useful if
you are loading many textures from the same directory.
设置加载文件的基本路径或URL。当加载同一目录中的许多模型,此方法将很有用。
</p>
<h2>Source</h2>
<h2></h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
......
......@@ -11,52 +11,52 @@
<h1>[name]</h1>
<p class="desc">
Abstract base class to load generic binary textures formats (rgbe, hdr, ...).
This uses the [page:FileLoader] internally for loading files, and creates a new
用于加载二进制文件格式的(rgbe, hdr, ...)的抽象类。
内部使用[page:FileLoader]来加载文件, 和创建一个新的
[page:DataTexture].
</p>
<h2>Examples</h2>
<h2>例子</h2>
<p>
See the [link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/RGBELoader.js RGBELoader]
for an example of a derived class.
请参考[link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/RGBELoader.js RGBELoader]
这个子类的例子。
</p>
<h2>Constructor</h2>
<h2>构造函数</h2>
<h3>[name]( [param:LoadingManager manager] )</h3>
<p>
[page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use.
Default is [page:LoadingManager THREE.DefaultLoadingManager].<br /><br />
[page:LoadingManager manager] — 加载器所使用的[page:LoadingManager loadingManager]。
默认为[page:LoadingManager THREE.DefaultLoadingManager].<br /><br />
Creates a new [name].
创建一个新的[name].
</p>
<h2>Properties</h2>
<h2>属性</h2>
<h3>[property:LoadingManager manager]</h3>
<p>
The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager].
加载器正在使用的[page:LoadingManager loadingManager]。默认为[page:DefaultLoadingManager].
</p>
<h2>Methods</h2>
<h2>方法</h2>
<h3>[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )</h3>
<p>
[page:String url] — the path or URL to the file. This can also be a
[page:String url] — 文件的URL或者路径,也可以为
[link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].<br />
[page:Function onLoad] — Will be called when load completes. The argument will be the loaded texture.<br />
[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 />
[page:Function onError] — Will be called when load errors.<br />
[page:Function onLoad] — 加载完成时将调用。回调参数为将要加载的纹理。<br />
[page:Function onProgress] — 将在加载过程中进行调用。参数为XMLHttpRequest实例,实例包含[page:Integer total]和[page:Integer loaded]字节。<br />
[page:Function onError] —在加载错误时被调用。<br />
</p>
<p>
Begin loading from url and pass the loaded texture to onLoad.
从URL中进行加载,并将被加载的纹理传递给onLoad。
</p>
<h2>Source</h2>
<h2></h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
......
......@@ -12,11 +12,11 @@
<h1>[name]</h1>
<p class="desc">
A low level class for loading resources with XMLHttpRequest, used internaly by most loaders.
It can also be used directly to load any file type that does not have a loader.
使用XMLHttpRequest来加载资源的低级类,并由大多数加载器内部使用。
它也可以直接用于加载任何没有对应加载器的文件类型。
</p>
<h2>Example</h2>
<h2>例子</h2>
<p>
[example:webgl_loader_msgpack WebGL / loader / msgpack]<br />
[example:webgl_morphtargets_human WebGL / morphtargets / human]<br />
......@@ -24,23 +24,23 @@
<code>
var loader = new THREE.FileLoader();
//load a text file and output the result to the console
//加载一个文本文件,并把结果输出到控制台上
loader.load(
// resource URL
'example.txt',
// onLoad callback
// onLoad回调
function ( data ) {
// output the text to the console
console.log( data )
},
// onProgress callback
// onProgress回调
function ( xhr ) {
console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
},
// onError callback
// onError回调
function ( err ) {
console.error( 'An error happened' );
}
......@@ -48,103 +48,102 @@
</code>
<p>
<em>Note:</em> The cache must be enabled using
<em>注意:</em>
必须启用缓存
<code>THREE.Cache.enabled = true;</code>
This is a global property and only needs to be set once to be used by all loaders that use FileLoader internally.
[page:Cache Cache] is a cache module that holds the response from each request made through this loader, so each file is requested once.
这是一个全局属性,只需要设置一次,供内部使用FileLoader的所有加载器使用。
[page:Cache Cache] 是​​一个缓存模块,用于保存通过此加载器发出的每个请求的响应,因此每个文件都会被请求一次。
</p>
<h2>Constructor</h2>
<h2>构造函数</h2>
<h3>[name] ( [param:LoadingManager manager] )</h3>
<p>
[page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use.
Default is [page:DefaultLoadingManager].
[page:LoadingManager manager] — [page:LoadingManager loadingManager] 是加载器所使用的加载管理器。
默认为 [page:DefaultLoadingManager].
</p>
<h2>Properties</h2>
<h2>属性</h2>
<h3>[property:LoadingManager manager]</h3>
<p>
The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager].
[page:LoadingManager loadingManager] 是加载器所使用的加载管理器,默认为 [page:DefaultLoadingManager].
</p>
<h3>[property:String mimeType]</h3>
<p>
The expected [link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types mimeType].
See [page:.setMimeType]. Default is *undefined*.
详情 [link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types mimeType].
请参考 [page:.setMimeType]。默认为 *undefined*。
</p>
<h3>[property:String path]</h3>
<p>The base path from which files will be loaded. See [page:.setPath]. Default is *undefined*.</p>
<p>将要加载的文件的基本路径。请参考 [page:.setPath]。 默认为 *undefined*.</p>
<h3>[property:object requestHeader]</h3>
<p>The [link:https://developer.mozilla.org/en-US/docs/Glossary/Request_header request header] used in HTTP request. See [page:.setRequestHeader]. Default is *undefined*.</p>
<p>[link:https://developer.mozilla.org/en-US/docs/Glossary/Request_header request header] 在HTTP 请求中使用。 请参考 [page:.setRequestHeader]。 默认为 *undefined*.</p>
<h3>[property:String responseType]</h3>
<p>The expected response type. See [page:.setResponseType]. Default is *undefined*.</p>
<p>请求的响应类型。 请参考 [page:.setResponseType]. 默认为 *undefined*.</p>
<h3>[property:String withCredentials]</h3>
<p>
Whether the XMLHttpRequest uses credentials. See [page:.setWithCredentials].
Default is *undefined*.
XMLHttpRequest是否使用证书。 请参考 [page:.setWithCredentials].
默认为 *undefined*.
</p>
<h2>Methods</h2>
<h2>方法</h2>
<h3>[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )</h3>
<p>
[page:String url] — the path or URL to the file. This can also be a
[page:String url] — 文件的URL或者路径,也可以为
[link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].<br />
[page:Function onLoad] (optional) — Will be called when loading completes. The argument will be the loaded response.<br />
[page:Function onProgress] (optional) — Will be called while load progresses. The argument will be the XMLHttpRequest instance,
which contains .[page:Integer total] and .[page:Integer loaded] bytes.<br />
[page:Function onError] (optional) — Will be called if an error occurs.<br /><br />
[page:Function onLoad] (可选) — 加载完成时将调用。回调参数将是加载的响应。<br />
[page:Function onProgress] (可选) — 将在加载过程中进行调用。参数将是XMLHttpRequest实例,
其中包含 [page:Integer total] 和 [page:Integer loaded] 字节<br />
[page:Function onError] (可选) — 在加载错误时被调用。<br /><br />
Load the URL and pass the response to the onLoad function.
加载URL并将响应传递给onLoad函数。
</p>
<h3>[method:FileLoader setMimeType]( [param:String mimeType] )</h3>
<p>
Set the expected [link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types mimeType]
of the file being loaded. Note that in many cases this will be determined automatically, so by default it is *undefined*.
设置正在加载的文件预期类型 [link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types mimeType]
。请注意,在许多情况下,这将自动确定,因此默认情况下它是 *undefined* 。
</p>
<h3>[method:FileLoader setPath]( [param:String path] )</h3>
<p>
Set the base path or URL from which to load files. This can be useful if
you are loading many models from the same directory.
设置加载文件的基本路径或URL。当加载同一目录中的许多模型,此方法将很有用。
</p>
<h3>[method:FileLoader setRequestHeader]( [param:object requestHeader] )</h3>
<p>
[page:object requestHeader] - key: The name of the header whose value is to be set. value: The value to set as the body of the header.<br /><br />
[page:object requestHeader] - key: 要设置header的名称。 value:要设置header的值。<br /><br />
Set the [link:https://developer.mozilla.org/en-US/docs/Glossary/Request_header request header] used in HTTP request.
请参考在HTTP 请求中的 [link:https://developer.mozilla.org/en-US/docs/Glossary/Request_header request header]。
</p>
<h3>[method:FileLoader setResponseType]( [param:String responseType] )</h3>
<p>
Change the response type. Valid values are:<br />
[page:String text] or empty string (default) - returns the data as [page:String string].<br />
[page:String arraybuffer] - loads the data into a [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer ArrayBuffer] and returns that.<br />
[page:String blob] - returns the data as a [link:https://developer.mozilla.org/en/docs/Web/API/Blob Blob].<br />
[page:String document] - parses the file using the [link:https://developer.mozilla.org/en-US/docs/Web/API/DOMParser DOMParser].<br />
[page:String json] - parses the file using [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse JSON.parse].<br />
改变响应的类型,其类型有效值如下:<br />
[page:String text] 或者空 string (默认) - 返回的数据类型为 [page:String string].<br />
[page:String arraybuffer] - 加载的数据类型到一个数组buffer中 [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer ArrayBuffer] 并进行返回。<br />
[page:String blob] - 返回的数据为 [link:https://developer.mozilla.org/en/docs/Web/API/Blob Blob]。<br />
[page:String document] - 使用 [link:https://developer.mozilla.org/en-US/docs/Web/API/DOMParser DOMParser] 解析文件。<br />
[page:String json] - 将文件解析为 [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse JSON.parse].<br />
</p>
<h3>[method:FileLoader setWithCredentials]( [param:Boolean value] )</h3>
<p>
Whether the XMLHttpRequest uses credentials such as cookies, authorization headers or
TLS client certificates. See [link:https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials XMLHttpRequest.withCredentials].<br />
Note that this has no effect if you are loading files locally or from the same domain.
XMLHttpRequest是否使用cookie、授权头或TLS客户端证书等凭据。 请参考 [link:https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials XMLHttpRequest.withCredentials].<br />
请注意,当您在本地或从同一域加载文件,则该方法无效。
</p>
<h2>Source</h2>
<h2></h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
......
......@@ -11,14 +11,13 @@
<h1>[name]</h1>
<p class="desc">
Class for loading a font in JSON format. Returns a [page:Font Font], which is an
array of [page:Shape Shape]s representing the font.
This uses the [page:FileLoader] internally for loading files. <br /><br />
使用JSON格式中加载字体的一个类。返回[page:Font Font], 返回值是表示字体的[page:Shape Shape]类型的数组。
其内部使用[page:FileLoader]来加载文件。 <br /><br />
You can convert fonts online using [link:https://gero3.github.io/facetype.js/ facetype.js]
你可以使用[link:https://gero3.github.io/facetype.js/ facetype.js]在线转换字体。
</p>
<h2>Examples</h2>
<h2>例子</h2>
<p>
[example:webgl_geometry_text_shapes geometry / text / shapes ]<br/>
......@@ -28,71 +27,70 @@
<code>
var loader = new THREE.FontLoader();
var font = loader.load(
// resource URL
// 资源URL
'fonts/helvetiker_bold.typeface.json',
// onLoad callback
// onLoad回调
function ( font ) {
// do something with the font
scene.add( font );
},
// onProgress callback
// onProgress回调
function ( xhr ) {
console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
},
// onError callback
// onError回调
function ( err ) {
console.log( 'An error happened' );
}
);
</code>
<h2>Constructor</h2>
<h2>构造函数</h2>
<h3>[name]( [param:LoadingManager manager] )</h3>
<p>
[page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].<br /><br />
Creates a new [name].
[page:LoadingManager manager] — 加载器所使用的[page:LoadingManager loadingManager]。默认值为[page:LoadingManager THREE.DefaultLoadingManager].<br /><br />
创建一个新的[name].
</p>
<h2>Properties</h2>
<h2>属性</h2>
<h3>[property:LoadingManager manager]</h3>
<p>
The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager].
加载器正在使用的[page:LoadingManager loadingManager]。默认值为[page:DefaultLoadingManager].
</p>
<h3>[property:String path]</h3>
<p>The base path from which fonts will be loaded. See [page:.setPath]. Default is *undefined*.</p>
<p>所要加载字体的基本路径。 具体参考[page:.setPath]。 默认为*undefined*.</p>
<h2>Methods</h2>
<h2>方法</h2>
<h3>[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )</h3>
<p>
[page:String url] — the path or URL to the file. This can also be a
[page:String url] — 文件的URL或者路径,也可以为
[link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].<br />
[page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:Texture texture].<br />
[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 />
[page:Function onError] — Will be called when load errors.<br /><br />
[page:Function onLoad] — 加载完成时将调用。回调参数是将要被加载的[page:Texture texture].<br />
[page:Function onProgress] — 将在加载过程中进行调用。参数为XMLHttpRequest实例,实例包含[page:Integer total]和[page:Integer loaded]字节。<br />
[page:Function onError] — 在加载错误时被调用。<br /><br />
Begin loading from url and pass the loaded [page:Texture texture] to onLoad.
从URL中进行加载,并将被加载的[page:Texture texture]传递给onLoad。
</p>
<h3>[method:Font parse]( [param:Object json] )</h3>
<p>
[page:Object json] — The <em>JSON</em> structure to parse.<br /><br />
Parse a <em>JSON</em> structure and return a [page:Font].
<em>JSON</em>格式进行解析,并返回一个[page:Font].
</p>
<h3>[method:FontLoader setPath]( [param:String path] )</h3>
<p>
Set the base path or URL from which to load fonts. This can be useful if
you are loading many fonts from the same directory.
设置加载字体的基本路径或URL。当加载同一目录中下的许多字体时,此方法将很有用。
</p>
<h2>Source</h2>
<h2></h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
......
......@@ -11,36 +11,36 @@
<h1>[name]</h1>
<p class="desc">
A loader for loading an [page:Image] as an [link:https://developer.mozilla.org/de/docs/Web/API/ImageBitmap ImageBitmap].
An ImageBitmap provides an asynchronous and resource efficient pathway to prepare textures for rendering in WebGL.<br/>
Unlike [page:FileLoader], [name] does not avoid multiple concurrent requests to the same URL.
一个把[page:Image]加载为[link:https://developer.mozilla.org/de/docs/Web/API/ImageBitmap ImageBitmap]的加载器。
ImageBitmap提供了一种异步且有效的资源的途径,用于在WebGL中渲染的纹理。<br/>
不像[page:FileLoader], [name]无需避免对同一的URL进行多次请求。
</p>
<h2>Example</h2>
<h2>例子</h2>
<p>
[example:webgl_loader_imagebitmap WebGL / loader / ImageBitmap]
</p>
<code>
// instantiate a loader
// 初始化一个加载器
var loader = new THREE.ImageBitmapLoader();
// load a image resource
// 加载一个图片资源
loader.load(
// resource URL
// 资源的URL
'textures/skyboxsun25degtest.png',
// onLoad callback
// onLoad回调
function ( imageBitmap ) {
var texture = new THREE.CanvasTexture( imageBitmap );
var material = new THREE.MeshBasicMaterial( { map: texture } );
},
// onProgress callback currently not supported
// 目前暂不支持onProgress的回调
undefined,
// onError callback
// onError回调
function ( err ) {
console.log( 'An error happened' );
}
......@@ -48,58 +48,58 @@
</code>
<h2>Constructor</h2>
<h2>构造函数</h2>
<h3>[name]( [param:LoadingManager manager] )</h3>
<p>
[page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].<br /><br />
[page:LoadingManager manager] — 加载器使用的[page:LoadingManager loadingManager],默认为[page:LoadingManager THREE.DefaultLoadingManager].<br /><br />
Creates a new [name].
创建一个新的[name].
</p>
<h2>Properties</h2>
<h2>属性</h2>
<h3>[property:LoadingManager manager]</h3>
<p>
The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager].
加载器正在使用的[page:LoadingManager loadingManager] ,默认为[page:DefaultLoadingManager].
</p>
<h3>[property:String options]</h3>
<p>An optional object that sets options for the internally used [link:https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/createImageBitmap createImageBitmap] factory method. Default is *undefined*.</p>
<p>一个可选对象,用来设置内部使用的[link:https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/createImageBitmap createImageBitmap]工厂方法,
默认为*undefined*.</p>
<h3>[property:String path]</h3>
<p>The base path from which files will be loaded. See [page:.setPath]. Default is *undefined*.</p>
<p>所要加载文件的基本路径。 请参考[page:.setPath],默认为*undefined*。</p>
<h2>Methods</h2>
<h2>方法</h2>
<h3>[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )</h3>
<p>
[page:String url] — the path or URL to the file. This can also be a
[page:String url] — 文件的URL或者路径,也可以为
[link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].<br />
[page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:Image image].<br />
[page:Function onProgress] — This callback function is currently not supported.<br />
[page:Function onError] — Will be called when load errors.<br />
[page:Function onLoad] — 加载完成时将调用。回调参数为将要加载的[page:Image image].<br />
[page:Function onProgress] — 此回调函数暂时不支持<br />
[page:Function onError] — 在加载错误时被调用。<br />
</p>
<p>
Begin loading from url and return the [page:ImageBitmap image] object that will contain the data.
从URL中进行加载,并返回将包含数据的[page:ImageBitmap image]对象。
</p>
<h3>[method:ImageBitmapLoader setCrossOrigin]()</h3>
<p>This method exists for compatibility reasons and implements no logic. It ensures that [name] has a similar interface like [page:ImageLoader].</p>
<p>此方法出于兼容性原因而存在,并且不实现逻辑。它确保[name]具有[page:ImageLoader]的类似接口。</p>
<h3>[method:ImageBitmapLoader setOptions]( [param:Object options] )</h3>
<p>
Sets the options object for [link:https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/createImageBitmap createImageBitmap].
设置[link:https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/createImageBitmap createImageBitmap]的选项对象。
</p>
<h3>[method:ImageBitmapLoader setPath]( [param:String path] )</h3>
<p>
Sets the base path or URL from which to load files. This can be useful if
you are loading many images from the same directory.
设置加载文件的基本路径或URL。当加载同一目录中下的许多图片时,此方法将很有用。
</p>
<h2>Source</h2>
<h2></h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
......
......@@ -11,12 +11,12 @@
<h1>[name]</h1>
<p class="desc">
A loader for loading an [page:Image].
This uses the [page:FileLoader] internally for loading files, and is used internally by the
[page:CubeTextureLoader], [page:ObjectLoader] and [page:TextureLoader].
用来加载一个[page:Image]的加载器。
内部使用[page:FileLoader]来加载文件,并被
[page:CubeTextureLoader]、[page:ObjectLoader]、[page:TextureLoader]所使用。
</p>
<h2>Example</h2>
<h2>例子</h2>
<p>
[example:webgl_loader_obj WebGL / loader / obj]<br />
......@@ -24,15 +24,15 @@
</p>
<code>
// instantiate a loader
// 初始化一个加载器
var loader = new THREE.ImageLoader();
// load a image resource
// 加载一个图片资源
loader.load(
// resource URL
// 资源URL
'textures/skyboxsun25degtest.png',
// onLoad callback
// onLoad回调
function ( image ) {
// use the image, e.g. draw part of it on a canvas
var canvas = document.createElement( 'canvas' );
......@@ -40,10 +40,10 @@
context.drawImage( image, 100, 100 );
},
// onProgress callback currently not supported
// 目前暂不支持onProgress的回调
undefined,
// onError callback
// onError回调
function () {
console.error( 'An error happened.' );
}
......@@ -51,59 +51,58 @@
</code>
<p>
Please note three.js r84 dropped support for ImageLoader progress events. For an ImageLoader
that supports progress events, see [link:https://github.com/mrdoob/three.js/issues/10439#issuecomment-275785639 this thread].
请注意three.js r84遗弃了ImageLoader进度事件. 对于支持进度事件的ImageLoader
请参考[link:https://github.com/mrdoob/three.js/issues/10439#issuecomment-275785639 this thread].
</p>
<h2>Constructor</h2>
<h2>构造方法</h2>
<h3>[name]( [param:LoadingManager manager] )</h3>
<p>
[page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].<br /><br />
[page:LoadingManager manager] — 加载器使用的[page:LoadingManager loadingManager],默认为[page:LoadingManager THREE.DefaultLoadingManager].<br /><br />
Creates a new [name].
创建一个新的[name].
</p>
<h2>Properties</h2>
<h2>属性</h2>
<h3>[property:String crossOrigin]</h3>
<p>
If set, assigns the [link:https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes crossOrigin]
attribute of the image to the value of *crossOrigin*, prior to starting the load. Default is *"anonymous"*.
如果设置了,在开始加载前, 将为图片分配 [link:https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes crossOrigin]
属性,其值为 *crossOrigin*, 默认为"anonymous"。
</p>
<h3>[property:LoadingManager manager]</h3>
<p>
The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager].
加载器正在使用的[page:LoadingManager loadingManager],默认值为[page:DefaultLoadingManager].
</p>
<h3>[property:String path]</h3>
<p>The base path from which files will be loaded. See [page:.setPath]. Default is *undefined*.</p>
<p>所要加载文件的基本路径。 请参考[page:.setPath],默认为*undefined*。</p>
<h2>Methods</h2>
<h2>方法</h2>
<h3>[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )</h3>
<p>
[page:String url] — the path or URL to the file. This can also be a
[page:String url] — 文件的URL或者路径,也可以为
[link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].<br />
[page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:Image image].<br />
[page:Function onProgress] — This callback function is currently not supported.<br />
[page:Function onError] — Will be called when load errors.<br />
[page:Function onLoad] —加载完成时将调用。回调参数为将要加载的[page:Image image]。<br />
[page:Function onProgress] — 此回调函数暂时不支持。<br />
[page:Function onError] — 在加载错误时被调用。<br />
</p>
<p>
Begin loading from url and return the [page:Image image] object that will contain the data.
从URL中进行加载,并返回将包含数据的[page:Image image]对象。
</p>
<h3>[method:null setCrossOrigin]( [param:String value] )</h3>
<p>Set the [page:.crossOrigin] attribute.</p>
<p>设置[page:.crossOrigin]的属性。</p>
<h3>[method:FileLoader setPath]( [param:String path] )</h3>
<p>
Set the base path or URL from which to load files. This can be useful if
you are loading many images from the same directory.
设置加载文件的基本路径或URL。当加载同一目录中下的许多图片时,此方法将很有用。
</p>
<h2>Source</h2>
<h2></h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
......
......@@ -11,11 +11,11 @@
<h1>[name]</h1>
<p class="desc">
A loader for loading objects in JSON format.
This uses the [page:FileLoader] internally for loading files.
以JSON格式来加载对象的加载器。
此加载器内部用 [page:FileLoader] 来加载文件。
</p>
<h2>Example</h2>
<h2>例子</h2>
<p>
[example:webgl_loader_json WebGL / loader / json]<br />
......@@ -23,96 +23,96 @@
</p>
<code>
// instantiate a loader
// 初始化一个加载器
var loader = new THREE.JSONLoader();
// load a resource
// 加载一个资源
loader.load(
// resource URL
// 资源URL
'models/animated/monster/monster.js',
// onLoad callback
// onLoad的回调
function ( geometry, materials ) {
var material = materials[ 0 ];
var object = new THREE.Mesh( geometry, material );
scene.add( object );
},
// onProgress callback
// onProgress的回调
function ( xhr ) {
console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
},
// onError callback
// onError的回调
function( err ) {
console.log( 'An error happened' );
}
);
</code>
<h2>Constructor</h2>
<h2>构造函数</h2>
<h3>[name]( [param:LoadingManager manager] )</h3>
<p>
[page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
[page:LoadingManager manager] — 加载器所使用的 [page:LoadingManager loadingManager]。 默认为 [page:LoadingManager THREE.DefaultLoadingManager].
</p>
<p>
Creates a new [name].
创建一个新的 [name].
</p>
<h2>Properties</h2>
<h2>属性</h2>
<h3>[property:String crossOrigin]</h3>
<p>
If set, assigns the [link:https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes crossOrigin]
attribute of the image to the value of *crossOrigin*, prior to starting the load. Default is *"anonymous"*.
如果设置了,在开始加载前, 将为图片分配 [link:https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes crossOrigin]
属性,其值为 *crossOrigin*,默认为"anonymous"。
</p>
<h3>[property:LoadingManager manager]</h3>
<p>
The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager].
加载器正在使用的 [page:LoadingManager loadingManager] 。 默认为 [page:DefaultLoadingManager].
</p>
<h3>[property:String withCredentials]</h3>
<p>
Whether the XMLHttpRequest uses credentials.
Default is *false*.
XMLHttpRequest请求是否使用了证书。
默认为 *false*.
</p>
<h2>Methods</h2>
<h2>方法</h2>
<h3>[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )</h3>
<p>
[page:String url] — the path or URL to the file. This can also be a
[page:String url] — 文件的URL或者路径,也可以为
[link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI]..<br />
[page:Function onLoad] — Will be called when load completes. The argument will be the loaded text response.<br />
[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 />
[page:Function onError] — Will be called when load errors.<br />
[page:Function onLoad] — 加载完成时将调用。回调参数将是加载的响应。<br />
[page:Function onProgress] — 将在加载过程中进行调用。参数为XMLHttpRequest实例,
其中包含 [page:Integer total] 和 [page:Integer loaded] 字节。<br />
[page:Function onError] — 在加载错误时被调用。<br />
</p>
<p>
Begin loading from url and pass the <em>JSON</em> to onLoad.
从URL中进行加载并将 <em>JSON</em> 传递给 onLoad。
</p>
<h3>[method:JSONLoader setCrossOrigin]( [param:String value] )</h3>
<p>
Set the [page:.crossOrigin] attribute.
设置 [page:.crossOrigin] 的属性。
</p>
<h3>[method:JSONLoader setTexturePath]( [param:String texturePath] )</h3>
<p>
Set the base path or URL from which to load files. This can be useful if
you are loading many files from the same directory.
设置加载文件的基本路径或URL。当加载同一目录中的许多模型,此方法将很有用。
</p>
<h3>[method:Object3D parse]( [param:Object json], [param:String texturePath] )</h3>
<p>
[page:String json] — JSON object to parse.<br />
[page:String texturePath] — Base path for textures.<br /><br />
[page:String json] — 需要解析的JSON对象。<br />
[page:String texturePath] — 纹理的基本路径。<br /><br />
Parse a <em>JSON</em> structure and return an [page:object] containing the parsed [page:Geometry geometry] and [page:Array materials].
解析要给 <em>JSON</em> 结构并返回 [page:object] 包含 [page:Geometry geometry] 和 [page:Array materials] 的对象.
</p>
<h2>Source</h2>
<h2></h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
......
......@@ -10,56 +10,55 @@
<body>
<h1>[name]</h1>
<p class="desc">Base class for implementing loaders.</p>
<p class="desc">所有加载器的基类</p>
<h2>Constructor</h2>
<h2>构造方法</h2>
<h3>[name]()</h3>
<p>
Creates a new [name]. This should be called as base class.
当创建一个新的 [name], 将调用此基类。
</p>
<h2>Properties</h2>
<h2>属性</h2>
<h3>[property:Function onLoadStart]</h3>
<p>Will be called when load starts.</p>
<p>The default is a function with empty body.</p>
<p>当加载开始时,将被调用。</p>
<p>默认实现是一个空函数体。</p>
<h3>[property:Function onLoadProgress]</h3>
<p>Will be called while load progresses.</p>
<p>The default is a function with empty body.</p>
<p>当进入加载流程中,将被调用。</p>
<p>默认实现是一个空函数体。</p>
<h3>[property:Function onLoadComplete]</h3>
<p>Will be called when load completes.</p>
<p>The default is a function with empty body.</p>
<p>当加载完成时,将被调用。</p>
<p>默认实现是一个空函数体。</p>
<h3>[property:string crossOrigin]</h3>
<p>
The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS.
Default is *"anonymous"*.
跨域字符串,用于实现跨域,以便从允许CORS从其他域加载url。默认为"anonymous"。
</p>
<h2>Methods</h2>
<h3>[method:Material createMaterial]( [param:object m], [param:string texturePath] )</h3>
<p>
[page:Object m] — The parameters to create the material. <br />
[page:String texturePath] — The base path of the textures.
[page:Object m] — 所要创建的材质的参数。 <br />
[page:String texturePath] — 纹理加载路径。
</p>
<p>
Creates the Material based on the parameters m.
基于参数m来创建材质。
</p>
<h3>[method:Array initMaterials]( [param:Array materials], [param:string texturePath] )</h3>
<p>
[page:Array materials] — an array of parameters to create materials. <br />
[page:String texturePath] — The base path of the textures.
[page:Array materials] — 用于创建材质的参数数组。 <br />
[page:String texturePath] — 纹理加载路径。
</p>
<p>
Creates an array of [page:Material] based on the array of parameters m. The index of the parameters decide the correct index of the materials.
基于参数数组m,来创建 [page:Material] 数组. 参数索引与材质的索引一致。
</p>
......
......@@ -10,28 +10,28 @@
<body>
<h1>[name]</h1>
<p class="desc">An object with several loader utility functions.</p>
<p class="desc">具有多个实用的加载器函数功能的对象</p>
<h2>Functions</h2>
<h2>函数</h2>
<h3>[method:String decodeText]( [param:TypedArray array] )</h3>
<p>
[page:TypedArray array] — A stream of bytes as a typed array.
[page:TypedArray array] — 作为类型化数组的字节流
</p>
<p>
The function takes a stream of bytes as input and returns a string representation.
该函数将字节流作为输入并返回字符串作为表示。
</p>
<h3>[method:String extractUrlBase]( [param:string url] )</h3>
<p>
[page:String url] — The url to extract the base url from.
[page:String url] — 从基本URL中,进行提取的URL。
</p>
<p>
Extract the base from the URL.
从URL中提取基本信息。
</p>
<h2>Source</h2>
<h2></h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
......
......@@ -11,33 +11,33 @@
<h1>[name]</h1>
<p class="desc">
A loader for loading a [page:Material] in JSON format.
This uses the [page:FileLoader] internally for loading files.
以JSON格式来加载[page:Material]的加载器。
默认使用[page:FileLoader]进行加载文件。
</p>
<h2>Example</h2>
<h2>例子</h2>
<code>
// instantiate a loader
// 初始化一个加载器
var loader = new THREE.MaterialLoader();
// load a resource
// 加载资源
loader.load(
// resource URL
// 资源URL
'path/to/material.json',
// onLoad callback
// onLoad回调
function ( material ) {
object.material = material;
},
// onProgress callback
// onProgress回调
function ( xhr ) {
console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
},
// onError callback
// onError回调
function ( err ) {
console.log( 'An error happened' );
}
......@@ -45,53 +45,53 @@
</code>
<h2>Constructor</h2>
<h2>构造函数</h2>
<h3>[name]( [param:LoadingManager manager] )</h3>
<p>
[page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].<br /><br />
Creates a new [name].
[page:LoadingManager manager] — 加载器使用的[page:LoadingManager loadingManager],默认为[page:LoadingManager THREE.DefaultLoadingManager].<br /><br />
创建要给新的[name].
</p>
<h2>Properties</h2>
<h2>属性</h2>
<h3>[property:LoadingManager manager]</h3>
<p>
The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager].
加载器正在使用的[page:LoadingManager loadingManager],默认为[page:DefaultLoadingManager].
</p>
<h3>[property:Object textures]</h3>
<p>Object holding any textures used by the material. See [page:.setTextures].</p>
<p>持有材质的任何纹理的对象,请参考 [page:.setTextures].</p>
<h2>Methods</h2>
<h2>方法</h2>
<h3>[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )</h3>
<p>
[page:String url] — the path or URL to the file. This can also be a
[page:String url] — 文件的URL或者路径,也可以为
[link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].<br />
[page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:Material].<br />
[page:Function onProgress] — Will be called while load progresses. The argument will be the progress event.<br />
[page:Function onError] — Will be called when load errors.<br /><br />
[page:Function onLoad] — 加载完成时将调用。回调参数为将要加载的[page:Material]。<br />
[page:Function onProgress] — 将在加载过程中进行调用,参数为进度事件。<br />
[page:Function onError] — 在加载错误时被调用。<br /><br />
Begin loading from url and return the [page:Material] object that will contain the data.
从URL中进行加载,并返回将包含数据的[page:Material]对象。
</p>
<h3>[method:Material parse]( [param:Object json] )</h3>
<p>
[page:Object json] — The json object containing the parameters of the Material.<br /><br />
[page:Object json] — JSON对象包含材质参数。<br /><br />
Parse a <em>JSON</em> structure and create a new [page:Material] of the type [page:String json.type] with parameters defined in the json object.
解析<em>JSON</em>结构,以json对象的参数中的[page:String json.type]类型,创建一个新的[page:Material]。
</p>
<h3>[method:null setTextures]( [param:Object textures] )</h3>
<p>
[page:Object textures] — object containing any textures used by the material.
[page:Object textures] — 对象包含任何被材质所使用的纹理。
</p>
<h2>Source</h2>
<h2></h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
......
......@@ -11,15 +11,15 @@
<h1>[name]</h1>
<p class="desc">
A loader for loading a JSON resource. Unlike the [page:JSONLoader], this one make use of the
<em>.type</em> attributes of objects to map them to their original classes.<br /><br />
一个用来加载JSON资源的加载器。 不像[page:JSONLoader],这个加载器使用
<em>.type</em>对象属性,来映射它自己到源类。<br /><br />
Note that this loader can't load [page:Geometries]. Use [page:JSONLoader] instead for that.<br /><br />
请注意这个加载器不能用来加载[page:Geometries],而是用[page:JSONLoader]进行加载。<br /><br />
This uses the [page:FileLoader] internally for loading files.
此加载器内部使用[page:FileLoader]进行加载文件。
</p>
<h2>Example</h2>
<h2>例子</h2>
<p>
......@@ -32,29 +32,29 @@
var loader = new THREE.ObjectLoader();
loader.load(
// resource URL
// 资源的URL
"models/json/example.json",
// onLoad callback
// onLoad回调
// Here the loaded data is assumed to be an object
function ( obj ) {
// Add the loaded object to the scene
scene.add( obj );
},
// onProgress callback
// onProgress回调
function ( xhr ) {
console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
},
// onError callback
// onError回调
function ( err ) {
console.error( 'An error happened' );
}
);
// Alternatively, to parse a previously loaded JSON structure
// 或者,解析先前加载的JSON结构
var object = loader.parse( a_json_object );
scene.add( object );
......@@ -62,102 +62,100 @@
<h2>Constructor</h2>
<h2>构造函数</h2>
<h3>[name]( [param:LoadingManager manager] )</h3>
<p>
[page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].<br /><br />
[page:LoadingManager manager] — 加载器所使用的[page:LoadingManager loadingManager],默认值为[page:LoadingManager THREE.DefaultLoadingManager].<br /><br />
Creates a new [name].
创建一个新的[name].
</p>
<h2>Properties</h2>
<h2>属性</h2>
<h3>[property:String crossOrigin]</h3>
<p>
If set, assigns the [link:https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes crossOrigin]
attribute of the image to the value of *crossOrigin*, prior to starting the load. Default is *"anonymous"*.
如果设置了,在开始加载前, 将为图片分配 [link:https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes crossOrigin]
属性,其值为 *crossOrigin*, 默认为"anonymous"。
</p>
<h3>[property:LoadingManager manager]</h3>
<p>
The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager].
加载器正在使用的[page:LoadingManager loadingManager],默认值为[page:DefaultLoadingManager]。
</p>
<h3>[property:String texturePath]</h3>
<p>
The base path or URL from which textures will be loaded. See [page:.setTexturePath].
Default is the empty string.
将要被加载的纹理的路径或者URL,详情请参考[page:.setTexturePath]。
默认值为空字符串。
</p>
<h2>Methods</h2>
<h2>方法</h2>
<h3>[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )</h3>
<p>
[page:String url] — the path or URL to the file. This can also be a
[page:String url] — 文件的URL或者路径,也可以为
[link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].<br />
[page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:Object3D object].<br />
[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 />
[page:Function onError] — Will be called when load errors.<br />
[page:Function onLoad] — 加载完成时将调用。回调参数为将要加载的[page:Object3D object].<br />
[page:Function onProgress] — 将在加载过程中进行调用。参数为XMLHttpRequest实例,实例包含[page:Integer total]和[page:Integer loaded]字节。<br />
[page:Function onError] — 在加载错误时被调用。<br />
</p>
<p>
Begin loading from url and call onLoad with the parsed response content.
从URL中进行加载,并将被解析的响应内容传递给onLoad。
</p>
<h3>[method:Object3D parse]( [param:Object json], [param:Function onLoad] )</h3>
<p>
[page:Object json] — required. The JSON source to parse.<br /><br />
[page:Function onLoad] — Will be called when parsed completes. The argument will be the parsed [page:Object3D object].<br /><br />
[page:Object json] — 必选参数,需要被解析的JSON源。<br /><br />
[page:Function onLoad] — 当解析完成时被调用,其中参数被解析为[page:Object3D object].<br /><br />
Parse a <em>JSON</em> structure and return a threejs object.
This is used internally by [page:.load], but can also be used directly to parse
a previously loaded JSON structure.
解析一个<em>JSON</em>结构,并返回一个threejs对象.
内部使用[page:.load]进行加载, 但也可以直接用于解析先前加载的JSON结构。
</p>
<h3>[method:Object3D parseGeometries]( [param:Object json] )</h3>
<p>
[page:Object json] — required. The JSON source to parse.<br /><br />
[page:Object json] — 必选参数,需要被解析的JSON源。<br /><br />
This is used [page:.parse] to parse any [page:Geometry geometries] or [page:BufferGeometry buffer geometries] in the JSON structure.
Internally it uses [page:JSONLoader] for geometries and [page:BufferGeometryLoader] for buffer geometries.
此函数以JSON结构,用[page:.parse]去解析[page:Geometry geometries]或[page:BufferGeometry buffer geometries]。
在内部,它使用JSONLoader作为几何加载器,使用BufferGeometryLoader作为几何缓冲区加载器。
</p>
<h3>[method:Object3D parseMaterials]( [param:Object json] )</h3>
<p>
[page:Object json] — required. The JSON source to parse.<br /><br />
[page:Object json] — 必选参数,需要被解析的JSON源。<br /><br />
This is used [page:.parse] to parse any materials in the JSON structure using [page:MaterialLoader].
此函数通过[page:.parse]来使用[page:MaterialLoader],以解析JSON结构中任意材质。
</p>
<h3>[method:Object3D parseAnimations]( [param:Object json] )</h3>
<p>
[page:Object json] — required. The JSON source to parse.<br /><br />
[page:Object json] — 必选参数,需要被解析的JSON源。<br /><br />
This is used [page:.parse] to parse any animations in the JSON structure, using [page:AnimationClip.parse].
</p>
此函数通过[page:.parse]来使用[page:AnimationClip.parse], 以解析JSON结构中任意动画。
</p>
<h3>[method:Object3D parseImages]( [param:Object json] )</h3>
<p>
[page:Object json] — required. The JSON source to parse.<br /><br />
[page:Object json] — 必选参数,需要被解析的JSON源。<br /><br />
This is used [page:.parse] to parse any images in the JSON structure, using [page:ImageLoader].
此函数通过[page:.parse]来使用[page:ImageLoader], 以解析JSON结构中任意图片。
</p>
<h3>[method:Object3D parseTextures]( [param:Object json] )</h3>
<p>
[page:Object json] — required. The JSON source to parse.<br /><br />
This is used [page:.parse] to parse any textures in the JSON structure.
[page:Object json] — 必选参数,需要被解析的JSON源。<br /><br />
此函数通过[page:.parse]来解析JSON结构中任意纹理。
</p>
<h3>[method:Object3D parseObject]( [param:Object json] )</h3>
<p>
[page:Object json] — required. The JSON source to parse.<br /><br />
[page:Object json] — 必选参数,需要被解析的JSON源。<br /><br />
This is used [page:.parse] to parse any objects in the JSON structure.
Objects can be of the following types:
此函数通过[page:.parse]来解析JSON结构中任意对象。
对象可以为如下类型:
<ul>
<li>
......@@ -214,17 +212,17 @@
<h3>[method:ObjectLoader setCrossOrigin]( [param:String value] )</h3>
<p>
[page:String value] — The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS.
[page:String value] — 在允许CROS时,跨域字段通过实现CORS来加载不同域下的URL。
</p>
<h3>[method:ObjectLoader setTexturePath]( [param:String value] )</h3>
<p>
[page:String value] — The base path or URL from which textures will be loaded.<br /><br />
[page:String value] — 设置将要加载为纹理的路径或者URL<br /><br />
</p>
<h2>Source</h2>
<h2></h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
......
......@@ -11,16 +11,16 @@
<h1>[name]</h1>
<p class="desc">
Class for loading a [page:Texture texture].
This uses the [page:ImageLoader] internally for loading files.
加载[page:Texture texture]的一个类。
内部使用[page:ImageLoader]来加载文件。
</p>
<h2>Example</h2>
<h2>例子</h2>
<code>
var texture = new THREE.TextureLoader().load( 'textures/land_ocean_ice_cloud_2048.jpg' );
// immediately use the texture for material creation
// 立即使用纹理进行材质创建
var material = new THREE.MeshBasicMaterial( { map: texture } );
</code>
......@@ -29,15 +29,15 @@
<h2>Example with Callbacks</h2>
<code>
// instantiate a loader
// 初始化一个加载器
var loader = new THREE.TextureLoader();
// load a resource
// 加载一个资源
loader.load(
// resource URL
// 资源URL
'textures/land_ocean_ice_cloud_2048.jpg',
// onLoad callback
// onLoad回调
function ( texture ) {
// in this example we create the material when the texture is loaded
var material = new THREE.MeshBasicMaterial( {
......@@ -45,71 +45,70 @@
} );
},
// onProgress callback currently not supported
// 目前暂不支持onProgress的回调
undefined,
// onError callback
// onError回调
function ( err ) {
console.error( 'An error happened.' );
}
);
</code>
请注意three.js r84遗弃了TextureLoader进度事件。对于支持进度事件的TextureLoader ,
请参考[link:https://github.com/mrdoob/three.js/issues/10439#issuecomment-293260145 this thread]。
Please note three.js r84 dropped support for TextureLoader progress events. For a TextureLoader that supports progress events, see [link:https://github.com/mrdoob/three.js/issues/10439#issuecomment-293260145 this thread].
<h2>Constructor</h2>
<h2>构造函数</h2>
<h3>[name]( [param:LoadingManager manager] )</h3>
<p>
[page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].<br /><br />
[page:LoadingManager manager] — 加载器使用的[page:LoadingManager loadingManager],默认值为[page:LoadingManager THREE.DefaultLoadingManager].<br /><br />
Creates a new [name].
创建一个新的[name].
</p>
<h2>Properties</h2>
<h2>属性</h2>
<h3>[property:String crossOrigin]</h3>
<p>
If set, assigns the [link:https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes crossOrigin]
attribute of the image to the value of *crossOrigin*, prior to starting the load. Default is *"anonymous"*.
如果设置了,在开始加载前, 将为图片分配 [link:https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes crossOrigin]
属性,其值为 *crossOrigin*, 默认为"anonymous"。
</p>
<h3>[property:LoadingManager manager]</h3>
<p>
The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager].
加载器正在使用的[page:LoadingManager loadingManager],默认值为[page:DefaultLoadingManager].
</p>
<h3>[property:String path]</h3>
<p>The base path from which files will be loaded. See [page:.setPath]. Default is *undefined*.</p>
<p>被加载文件的基本路径,请参考[page:.setPath]。默认值为*undefined*.</p>
<h2>Methods</h2>
<h2>方法</h2>
<h3>[method:Texture load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )</h3>
<p>
[page:String url] — the path or URL to the file. This can also be a
[page:String url] — 文件的URL或者路径,也可以为
[link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].<br />
[page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:Texture texture].<br />
[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 />
[page:Function onError] — Will be called when load errors.<br /><br />
[page:Function onLoad] — 加载完成时将调用。回调参数为将要加载的[page:Texture texture].<br />
[page:Function onProgress] — 将在加载过程中进行调用。参数为XMLHttpRequest实例,实例包含[page:Integer total]和[page:Integer loaded]字节。<br />
[page:Function onError] — 在加载错误时被调用。<br /><br />
Begin loading from the given URL and pass the fully loaded [page:Texture texture] to onLoad. The method also returns a new texture object which can directly be used for material creation.
If you do it this way, the texture may pop up in your scene once the respective loading process is finished.
从给定的URL开始加载并将完全加载的[page:Texture texture]传递给onLoad。该方法还返回一个新的纹理对象,该纹理对象可以直接用于材质创建。
如果采用此方法,一旦相应的加载过程完成,纹理可能会在场景中出现。
</p>
<h3>[method:null setCrossOrigin]( [param:String value] )</h3>
<p>Set the [page:.crossOrigin] attribute.</p>
<p>设置[page:.crossOrigin]的属性。</p>
<h3>[method:FileLoader setPath]( [param:String path] )</h3>
<p>
Set the base path or URL from which to load files. This can be useful if
you are loading many models from the same directory.
设置加载文件的基本路径或URL。当加载同一目录中的许多模型,此方法将很有用。
</p>
<h2>Source</h2>
<h2></h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
......
......@@ -10,23 +10,20 @@
<body>
<h1>[name]</h1>
<p class="desc">A global instance of the [page:LoadingManager LoadingManager], used by most loaders
when no custom manager has been specified.<br /><br />
<p class="desc">[page:LoadingManager LoadingManager]是一个全局实例, 当其他加载器没有指定加载管理器时,它将被其他大多数的加载器设为默认的加载管理器。<br /><br />
This will be sufficient for most purposes, however there may be times when you desire seperate loading managers
for say, textures and models.
LoadingManager对于大多数加载器来说已经足够了,但有时您可能需要单独设置加载管理器,例如纹理、模型加载器。
</p>
<h2>Example</h2>
<h2>例子</h2>
<p>
You can optionally set the [page:LoadingManager.onStart onStart], [page:LoadingManager.onLoad onLoad],
[page:LoadingManager.onProgress onProgress], [page:LoadingManager.onStart onError] functions for the manager.
These will then apply to any loaders using the DefaultLoadingManager.<br /><br />
你可以选择性的为你的管理器设置 [page:LoadingManager.onStart onStart], [page:LoadingManager.onLoad onLoad],
[page:LoadingManager.onProgress onProgress], [page:LoadingManager.onStart onError] 这些方法。
当你的加载器使用默认加载管理器时,这些方法都将被应用到加载器上。<br /><br />
Note that these shouldn't be confused with the similarly named functions of individual loaders,
as they are intended for displaying information about the overall status of loading,
rather than dealing with the data that has been loaded.
请注意,个人的加载器的不应具有类似上面类似的命名函数,以避免混淆。因为这些函数时用于显示有关加载总体状态的信息,而不是处理已加载的数据。
</p>
<code>
THREE.DefaultLoadingManager.onStart = function ( url, itemsLoaded, itemsTotal ) {
......@@ -56,15 +53,15 @@ THREE.DefaultLoadingManager.onError = function ( url ) {
</code>
<h2>Properties</h2>
<h2>属性</h2>
<p>See the [page:LoadingManager LoadingManager] page for details of properties.</p>
<p>有关LoadingManager属性的详细信息,请查看[page:LoadingManager LoadingManager] 页面。</p>
<h2>Methods</h2>
<h2>方法</h2>
<p>See the [page:LoadingManager LoadingManager] page for details of methods.</p>
<p>有关LoadingManager方法的详细信息,请查看[page:LoadingManager LoadingManager] 页面。</p>
<h2>Source</h2>
<h2></h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/loaders/LoadingManager.js src/loaders/LoadingManager.js]
</body>
......
......@@ -11,16 +11,16 @@
<h1>[name]</h1>
<p class="desc">
Handles and keeps track of loaded and pending data. A default global instance of this class
is created and used by loaders if not supplied manually - see [page:DefaultLoadingManager].<br /><br />
In general that should be sufficient, however there are times when it can be useful to have seperate loaders -
for example if you want to show seperate loading bars for objects and textures.
其功能时处理并跟踪已加载和待处理的数据。如果未手动设置加强管理器,则会为加载器创建和使用默认全局实例加载器管理器
- 请参阅 [page:DefaultLoadingManager].<br /><br />
一般来说,默认的加载管理器已足够使用了,但有时候也需要设置单独的加载器 - 例如,如果你想为对象和纹理显示单独的加载条。
</p>
<h2>Example</h2>
<h2>例子</h2>
<p>
[example:webgl_loader_babylon WebGL / loader / babylon]<br />
......@@ -32,8 +32,7 @@
</p>
<p>
This example shows how to use LoadingManager to track the progress of
[page:OBJLoader].
下面的例子将介绍,如何使用加载管理器来跟踪 [page:OBJLoader] 的加载进度流程。
</p>
<code>
......@@ -72,19 +71,18 @@
</code>
<p>
In addition to observing progress, a LoadingManager can be used to
override resource URLs during loading. This may be helpful for assets
coming from drag-and-drop events, WebSockets, WebRTC, or other APIs. An
example showing how to load an in-memory model using Blob URLs is below.
除了观察进度流程之外,还可以使用LoadingManager在加载期间覆写资源URL。当某资源来自拖拽事件、
WebSockets、WebRTC或其他API时,此方法可以有所帮助。下面显示了如何使用Blob URL加载内存模型的示例。
</p>
<code>
// Blob or File objects created when dragging files into the webpage.
// 将文件拖入网页时创建的Blob或File对象。
var blobs = {'fish.gltf': blob1, 'diffuse.png': blob2, 'normal.png': blob3};
var manager = new THREE.LoadingManager();
// Initialize loading manager with URL callback.
// 使用URL回调初始化加载管理器。
var objectURLs = [];
manager.setURLModifier( ( url ) => {
......@@ -96,7 +94,7 @@
} );
// Load as usual, then revoke the blob URLs.
// 像通常一样加载,然后撤消blob URL
var loader = new THREE.GLTFLoader( manager );
loader.load( 'fish.gltf', (gltf) => {
......@@ -107,75 +105,73 @@
});
</code>
<h2>Constructor</h2>
<h2>构造方法</h2>
<h3>[name]( [param:Function onLoad], [param:Function onProgress], [param:Function onError] )</h3>
<p>
[page:Function onLoad] — (optional) this function will be called when all loaders are done.<br />
[page:Function onProgress] — (optional) this function will be called when an item is complete.<br />
[page:Function onError] — (optional) this function will be called a loader encounters errors. <br />
[page:Function onLoad] — (可选) 所有加载器加载完成后,将调用此函数。<br />
[page:Function onProgress] — (可选) 当每个项目完成后,将调用此函数。<br />
[page:Function onError] — (可选) 当一个加载器遇到错误时,将调用此函数。 <br />
Creates a new [name].
创建一个新的 [name].
</p>
<h2>Properties</h2>
<h2>属性</h2>
<h3>[property:Function onStart]</h3>
<p>
This function will be called when loading starts.
The arguments are:<br />
[page:String url] — The url of the item just loaded.<br />
[page:Integer itemsLoaded] — the number of items already loaded so far.<br />
[page:Iteger itemsTotal] — the total amount of items to be loaded.<br /><br />
此换上咋加载开始时,被调用.
有如下参数:<br />
[page:String url] — 被加载的项的url。<br />
[page:Integer itemsLoaded] — 目前已加载项的个数。<br />
[page:Iteger itemsTotal] — 总共所需要加载项的个数。<br /><br />
By default this is undefined.
此方法默认时未定义。
</p>
<h3>[property:Function onLoad]</h3>
<p>
This function will be called when all loading is completed. By default this is undefined,
unless passed in the constructor.
所有的项加载完成后将调用此函数。默认情况下,此方法时未定义的,除非在构造函数中进行传递。
</p>
<h3>[property:Function onProgress]</h3>
<p>
This function will be called when an item is complete.
The arguments are:<br />
[page:String url] — The url of the item just loaded.<br />
[page:Integer itemsLoaded] — the number of items already loaded so far.<br />
[page:Iteger itemsTotal] — the total amount of items to be loaded.<br /><br />
此方法加载每一个项,加载完成时进行调用。
有如下参数:<br />
[page:String url] — 被加载的项的url。<br />
[page:Integer itemsLoaded] — 目前已加载项的个数。<br />
[page:Iteger itemsTotal] — 总共所需要加载项的个数。<br /><br />
By default this is undefined, unless passed in the constructor.
默认情况下,此方法时未定义的,除非在构造函数中进行传递。
</p>
<h3>[property:Function onError]</h3>
<p>
This function will be called when any item errors, with the argument:<br />
[page:String url] — The url of the item that errored.<br /><br />
此方法将在任意项加载错误时,进行调用。
有如下参数:<br />
[page:String url] — 所加载出错误的项的url<br /><br />
By default this is undefined, unless passed in the constructor.
默认情况下,此方法时未定义的,除非在构造函数中进行传递。
</p>
<h2>Methods</h2>
<h2>方法</h2>
<h3>[method:null setURLModifier]( [param:Function callback] )</h3>
<p>
[page:Function callback] — URL modifier callback. Called with [page:String url] argument, and
must return [page:String resolvedURL].<br /><br />
[page:Function callback] —
设置URL修饰符成功时回调。使用url参数进行回调,并且必须返回 [page:String resolvedURL] 。<br /><br />
If provided, the callback will be passed each resource URL before a request is sent. The
callback may return the original URL, or a new URL to override loading behavior. This
behavior can be used to load assets from .ZIP files, drag-and-drop APIs, and Data URIs.
如果设置了回调,则在发送请求之前将向每个资源URL传递回调。回调可以返回最初的URL,也可以返回新URL以覆盖加载行为。
此行为可用于从.ZIP、拖拽API和数据URI中加载资源文件。
</p>
<h3>[method:String resolveURL]( [param:String url] )</h3>
<p>
[page:String url] — the url to load<br /><br />
[page:String url] — 所要加载的url<br /><br />
Given a URL, uses the URL modifier callback (if any) and returns a resolved URL. If no
URL modifier is set, returns the original URL.
给定URL,使用URL修饰符回调(如果有)并返回已解析的URL。如果未设置URL修饰符,则返回原始URL。
</p>
<br /><br />
......@@ -186,27 +182,27 @@
<h3>[method:null itemStart]( [param:String url] )</h3>
<p>
[page:String url] — the url to load<br /><br />
[page:String url] — 所要加载的url<br /><br />
This should be called by any loader using the manager when the loader starts loading an url.
任何使用管理器的加载器都会调用此方法, 当加载器需要开始加载URL时。
</p>
<h3>[method:null itemEnd]( [param:String url] )</h3>
<p>
[page:String url] — the loaded url<br /><br />
[page:String url] — 所要加载的url<br /><br />
This should be called by any loader using the manager when the loader ended loading an url.
任何使用管理器的加载器都会调用此方法, 当加载器需要加载URL结束时。
</p>
<h3>[method:null itemError]( [param:String url] )</h3>
<p>
[page:String url] — the loaded url<br /><br />
[page:String url] — 所要加载的url<br /><br />
This should be called by any loader using the manager when the loader errors loading an url.
任何使用管理器的加载器都会调用此方法, 当加载器出现加载错误时。
</p>
<h2>Source</h2>
<h2></h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/loaders/LoadingManager.js src/loaders/LoadingManager.js]
</body>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册