You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
110 lines
3.6 KiB
110 lines
3.6 KiB
2 years ago
|
<!DOCTYPE html>
|
||
|
<html lang="zh">
|
||
|
<head>
|
||
|
<meta charset="utf-8" />
|
||
|
<base href="../../../" />
|
||
|
<script src="page.js"></script>
|
||
|
<link type="text/css" rel="stylesheet" href="page.css" />
|
||
|
</head>
|
||
|
<body>
|
||
|
<h1>加载器([name])</h1>
|
||
|
|
||
|
<p class="desc">用于实现加载器的基类。</p>
|
||
|
|
||
|
|
||
|
<h2>构造函数</h2>
|
||
|
|
||
|
|
||
|
<h3>[name]( [param:LoadingManager manager] )</h3>
|
||
|
<p>
|
||
|
[page:LoadingManager manager] — 加载器将要使用的 [page:LoadingManager loadingManager]。默认为 [page:LoadingManager THREE.DefaultLoadingManager]。
|
||
|
</p>
|
||
|
<p>
|
||
|
创建一个新的[name]。
|
||
|
</p>
|
||
|
|
||
|
|
||
|
<h2>属性</h2>
|
||
|
|
||
|
<h3>[property:String crossOrigin]</h3>
|
||
|
<p>
|
||
|
crossOrigin 字符串用于实现 CORS ,以从允许 CORS 的其他域加载url。
|
||
|
默认为*anonymous*。
|
||
|
</p>
|
||
|
|
||
|
<h3>[property:LoadingManager manager]</h3>
|
||
|
<p>
|
||
|
加载器要使用的 [page:LoadingManager loadingManager] 。默认为 [page:DefaultLoadingManager] 。
|
||
|
</p>
|
||
|
|
||
|
<h3>[property:String path]</h3>
|
||
|
<p>
|
||
|
将从中加载资产的基本路径。
|
||
|
默认为空字符串。
|
||
|
</p>
|
||
|
|
||
|
<h3>[property:String resourcePath]</h3>
|
||
|
<p>
|
||
|
将从中加载额外资源(例如纹理贴图)的基本路径。
|
||
|
默认为空字符串。
|
||
|
</p>
|
||
|
|
||
|
<h3>[property:Object requestHeader]</h3>
|
||
|
<p>
|
||
|
[link:https://developer.mozilla.org/en-US/docs/Glossary/Request_header request header] 在 HTTP 请求中使用。 请参考 [page:.setRequestHeader]。 默认为 *undefined*。
|
||
|
</p>
|
||
|
|
||
|
<h2>方法</h2>
|
||
|
|
||
|
<h3>[method:undefined load]()</h3>
|
||
|
<p>
|
||
|
该方法需要被所有具体的加载器来实现。它包含了从后端加载资产的逻辑。
|
||
|
</p>
|
||
|
|
||
|
<h3>[method:Promise loadAsync]( [param:String url], [param:Function onProgress] )</h3>
|
||
|
<p>
|
||
|
[page:String url] — 一个字符串,包含要加载的文件的路径/URL。<br />
|
||
|
[page:Function onProgress] — (可选)加载过程中将会被调用的函数。参数将是一个XMLHttpRequest实例,其包含了 .[page:Integer total] (总)字节数和 .[page:Integer loaded] (已加载)字节数。<br />
|
||
|
</p>
|
||
|
<p>
|
||
|
该函数等效于[page:.load],但返回的是一个 [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise Promise]。
|
||
|
</p>
|
||
|
<p>
|
||
|
[page:Function onLoad] 由 [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/resolve Promise.resolve] 处理,而 [page:Function onError] 则由 [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/reject Promise.reject] 处理。
|
||
|
</p>
|
||
|
|
||
|
<h3>[method:undefined parse]()</h3>
|
||
|
<p>
|
||
|
该方法需要被所有具体的加载器来实现。它包含了解析资产到 three.js 实体的逻辑。
|
||
|
</p>
|
||
|
|
||
|
<h3>[method:this setCrossOrigin]( [param:String crossOrigin] )</h3>
|
||
|
<p>
|
||
|
[page:String crossOrigin] — crossOrigin字符串用于实现CORS,以从允许CORS的其它域加载url。
|
||
|
</p>
|
||
|
|
||
|
<h3>[method:this setPath]( [param:String path] )</h3>
|
||
|
<p>
|
||
|
[page:String path] — 设置资产的基本路径。
|
||
|
</p>
|
||
|
|
||
|
<h3>[method:this setResourcePath]( [param:String resourcePath] )</h3>
|
||
|
<p>
|
||
|
[page:String resourcePath] — 设置独立资源(如纹理贴图)的基本路径。
|
||
|
</p>
|
||
|
|
||
|
<h3>[method:this setRequestHeader]( [param:Object requestHeader] )</h3>
|
||
|
<p>
|
||
|
[page:Object requestHeader] - key: 要设置header的名称。 value:要设置header的值。<br /><br />
|
||
|
|
||
|
设置在 HTTP 请求中使用的 [link:https://developer.mozilla.org/en-US/docs/Glossary/Request_header request header](请求头)。
|
||
|
</p>
|
||
|
|
||
|
<h2>源码</h2>
|
||
|
|
||
|
<p>
|
||
|
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
|
||
|
</p>
|
||
|
</body>
|
||
|
</html>
|