-
new GLTFLoader()
-
glTF模型加载类
Example
var loader = new Hilo3d.GLTFLoader(); loader.load({ src: '//ossgw.alicdn.com/tmall-c3/tmx/a9bedc04da498b95c57057d6a5d29fe7.gltf' }).then(function (model) { stage.addChild(model.node); });
Extends
Members Show Inherited
| Name | Type | Default | Description |
|---|---|---|---|
isGLTFLoader
|
boolean | true | |
className
|
string | GLTFLoader | |
isBasicLoader
|
boolean | true | inherited |
Methods Show Inherited
-
asyncload(params){Promise.<GLTFModel, Error>}
-
加载glTF模型
Name Type Description paramsobject 加载参数
Name Type Default Description srcstring glTF模型地址
defaultScenenumber | string optional 加载后要展示的场景,默认读模型里的
isMultiAnimboolean false optional 模型是否多动画,如果是的话会返回 anims 对象保存多个动画对象
isProgressiveboolean false optional 是否渐进式加载,图片加载完前使用占位图片
isUnQuantizeInShaderboolean true optional 是否在shader中进行量化解压数据
ignoreTextureErrorboolean false optional 是否忽略图片加载错误
forceCreateNewBufferboolean false optional 解析模型数据的时候是否强制创建新buffer,以防内存被引用导致无法释放
preHandlerImageURIfunction null optional 图片URL预处理函数
preHandlerBufferURIfunction null optional Buffer URL预处理函数
customMaterialCreatorfunction null optional 是否使用自定义的Material创建器
isLoadAllTexturesfunction false optional 是否加载所有的贴图,默认只加载用到的贴图
Returns:
Type Description Promise.<GLTFModel, Error> 返回加载完的模型对象 -
inherited isCrossOrigin(url){boolean}
-
判断链接是否跨域,无法处理二级域名,及修改 document.domain 的情况
Name Type Description urlstring 需要判断的链接
Returns:
Type Description boolean 是否跨域 -
inherited loadImg(url, crossOrigin){Promise.<HTMLImageElement, Error>}
-
加载图片
Name Type Default Description urlstring 图片地址
crossOriginboolean false optional 是否跨域
Returns:
Type Description Promise.<HTMLImageElement, Error> 返回加载完的图片 -
inherited loadRes(url, type){Promise.<any, Error>}
-
使用XHR加载其他资源
Name Type Default Description urlstring 资源地址
typestring text optional 资源类型(json, buffer, text)
Returns:
Type Description Promise.<any, Error> 返回加载完的内容对象(Object, ArrayBuffer, String) -
inherited request(opt){Promise.<any, Error>}
-
XHR资源请求
Name Type Description optobject 请求参数
Name Type Default Description urlstring 资源地址
typestring text optional 资源类型(json, buffer, text)
methodstring GET optional 请求类型(GET, POST ..)
headersobject optional 请求头参数
bodystring optional POST请求发送的数据
Returns:
Type Description Promise.<any, Error> 返回加载完的内容对象(Object, ArrayBuffer, String)