Class: Res
纹理,材质,模型,预设体的资源管理类。
Constructors
Methods
- getGltf
- getPrefabLoader
- addAtlas
- getAtlas
- getSubTexture
- addTexture
- getTexture
- addMat
- getMat
- addPrefab
- getPrefab
- loadGltf
- loadObj
- loadB3DM
- loadI3DM
- loadFont
- loadAtlas
- loadTexture
- loadHDRTexture
- loadHDRTextureCube
- loadLDRTextureCube
- loadTextureCubeMaps
- loadTextureCubeStd
- loadPrefab
- loadJSON
Constructors
constructor
• new Res()
创建一个资源管理类对象
Defined in
Methods
getGltf
▸ getGltf(url
): GLTF_Info
Parameters
Name | Type |
---|---|
url | string |
Returns
GLTF_Info
Defined in
getPrefabLoader
▸ getPrefabLoader(url
): PrefabLoader
Parameters
Name | Type |
---|---|
url | string |
Returns
Defined in
addAtlas
▸ addAtlas(name
, atlas
): void
Parameters
Name | Type |
---|---|
name | string |
atlas | GUIAtlasTexture |
Returns
void
Defined in
getAtlas
▸ getAtlas(name
): GUIAtlasTexture
Parameters
Name | Type |
---|---|
name | string |
Returns
Defined in
getSubTexture
▸ getSubTexture(id
): GUISubTexture
Parameters
Name | Type |
---|---|
id | string |
Returns
Defined in
addTexture
▸ addTexture(url
, texture
): void
添加纹理对象到资源池
Parameters
Name | Type | Description |
---|---|---|
url | string | 资源路径 |
texture | Texture | 纹理数据 |
Returns
void
Defined in
getTexture
▸ getTexture(url
): Texture
获取纹理对象
Parameters
Name | Type | Description |
---|---|---|
url | string | 资源路径 |
Returns
Defined in
addMat
▸ addMat(name
, mat
): Map
<string
, MaterialBase
>
添加材质对象到资源池
Parameters
Name | Type | Description |
---|---|---|
name | string | 材质对象名称 |
mat | MaterialBase | 材质对象 |
Returns
Map
<string
, MaterialBase
>
Defined in
getMat
▸ getMat(name
): MaterialBase
获取材质对象
Parameters
Name | Type | Description |
---|---|---|
name | string | 材质对象名称 |
Returns
MaterialBase
Defined in
addPrefab
▸ addPrefab(name
, rootScene
): void
添加预设体到资源池
Parameters
Name | Type | Description |
---|---|---|
name | string | 预设体名称 |
rootScene | Object3D |
Returns
void
Defined in
getPrefab
▸ getPrefab(name
): Object3D
获取预设体
Parameters
Name | Type | Description |
---|---|---|
name | string | 预设体名称 |
Returns
Defined in
loadGltf
▸ loadGltf(url
, loaderFunctions?
): Promise
<Object3D
>
加载模型文件
Parameters
Name | Type | Description |
---|---|---|
url | string | 模型路径 |
loaderFunctions? | LoaderFunctions | 加载回调函数 |
Returns
Promise
<Object3D
>
Defined in
loadObj
▸ loadObj(url
, loaderFunctions?
): Promise
<Object3D
>
加载模型文件
Parameters
Name | Type | Description |
---|---|---|
url | string | 模型路径 |
loaderFunctions? | LoaderFunctions | 加载回调函数 |
Returns
Promise
<Object3D
>
Defined in
loadB3DM
▸ loadB3DM(url
, loaderFunctions?
, userData?
): Promise
<Object3D
>
加载b3dm文件
Parameters
Name | Type | Description |
---|---|---|
url | string | 模型路径 |
loaderFunctions? | LoaderFunctions | 加载回调函数 |
userData? | any | - |
Returns
Promise
<Object3D
>
Defined in
loadI3DM
▸ loadI3DM(url
, loaderFunctions?
, userData?
): Promise
<Object3D
>
加载i3dm文件
Parameters
Name | Type | Description |
---|---|---|
url | string | 模型路径 |
loaderFunctions? | LoaderFunctions | 加载回调函数 |
userData? | any | - |
Returns
Promise
<Object3D
>
Defined in
loadFont
▸ loadFont(url
, loaderFunctions?
, userData?
): Promise
<FontInfo
>
加载字体文件
Parameters
Name | Type | Description |
---|---|---|
url | string | 字体路径 |
loaderFunctions? | LoaderFunctions | 加载回调函数 |
userData? | any | - |
Returns
Promise
<FontInfo
>
Defined in
loadAtlas
▸ loadAtlas(url
, loaderFunctions?
): Promise
<FontInfo
>
加载图集
Parameters
Name | Type | Description |
---|---|---|
url | string | 图集路径 |
loaderFunctions? | LoaderFunctions | 加载回调函数 |
Returns
Promise
<FontInfo
>
Defined in
loadTexture
▸ loadTexture(url
, loaderFunctions?
, flipY?
): Promise
<Texture
>
加载贴图
Parameters
Name | Type | Description |
---|---|---|
url | string | 文件路径 |
loaderFunctions? | LoaderFunctions | 加载回调函数 |
flipY? | boolean | 是否颠倒y轴 |
Returns
Promise
<Texture
>
Defined in
loadHDRTexture
▸ loadHDRTexture(url
, loaderFunctions?
): Promise
<Texture
>
加载HDR单张纹理
Parameters
Name | Type | Description |
---|---|---|
url | string | 文件路径 |
loaderFunctions? | LoaderFunctions | 加载回调函数 |
Returns
Promise
<Texture
>
Defined in
loadHDRTextureCube
▸ loadHDRTextureCube(url
, loaderFunctions?
): Promise
<Texture
>
加载HDR立方体纹理
Parameters
Name | Type | Description |
---|---|---|
url | string | 文件路径 |
loaderFunctions? | LoaderFunctions | 加载回调函数 |
Returns
Promise
<Texture
>
Defined in
loadLDRTextureCube
▸ loadLDRTextureCube(url
, loaderFunctions?
): Promise
<Texture
>
加载LDR立方体纹理
Parameters
Name | Type | Description |
---|---|---|
url | string | 文件路径 |
loaderFunctions? | LoaderFunctions | 加载回调函数 |
Returns
Promise
<Texture
>
Defined in
loadTextureCubeMaps
▸ loadTextureCubeMaps(urls
): Promise
<Texture
>
加载立方体纹理
Parameters
Name | Type | Description |
---|---|---|
urls | string [] | 6 张 2D 纹理按顺序排列组合成一个立方盒子 |
Returns
Promise
<Texture
>
Defined in
loadTextureCubeStd
▸ loadTextureCubeStd(url
, loaderFunctions?
): Promise
<Texture
>
加载立方体纹理(十字型)
Parameters
Name | Type | Description |
---|---|---|
url | string | 文件路径 |
loaderFunctions? | LoaderFunctions | - |
Returns
Promise
<Texture
>
Defined in
loadPrefab
▸ loadPrefab(url
, loaderFunctions?
): Promise
<Object3D
>
加载Prefab文件
Parameters
Name | Type | Description |
---|---|---|
url | string | 文件路径 |
loaderFunctions? | LoaderFunctions | - |
Returns
Promise
<Object3D
>
Defined in
loadJSON
▸ loadJSON(url
, loaderFunctions?
): Promise
<void
| object
>
Parameters
Name | Type |
---|---|
url | string |
loaderFunctions? | LoaderFunctions |
Returns
Promise
<void
| object
>