Class: AppResourcePoolComponent

THING.AppResourcePoolComponent()

AppResourcePoolComponent The application resource pool component.

Constructor

new AppResourcePoolComponent()

The resource manager to use duplicate resources, prevent to create multiple times.
Source:

Extends

Members

active :Boolean

Active or deactive component.
Type:
  • Boolean
Overrides:
Source:

app :THING.App

Get application.
Type:
Overrides:
Source:

object :THING.BaseObject

Get object.
Type:
Overrides:
Source:

onActiveChange :OnActiveChangeComponentCallback

When active change callback function.
Type:
Overrides:
Source:

onAfterAdd :OnAfterAddComponentCallback

After add.
Type:
Overrides:
Source:

onAfterAddChild :OnAddChildComponentCallback

When after add child callback function.
Type:
Overrides:
Source:

onAfterRemove :OnAfterRemoveComponentCallback

After remove.
Type:
Overrides:
Source:

onAfterRemoveChild :OnRemoveChildComponentCallback

When after remove child callback function.
Type:
Overrides:
Source:

onBeforeAdd :OnBeforeAddComponentCallback

Before add.
Type:
Overrides:
Source:

onBeforeAddChild :OnAddChildComponentCallback

When before add child callback function.
Type:
Overrides:
Source:

onBeforeRemove :OnBeforeRemoveComponentCallback

Before remove.
Type:
Overrides:
Source:

onBeforeRemoveChild :OnRemoveChildComponentCallback

When before remove child callback function.
Type:
Overrides:
Source:

onCopy :OnCopyComponentCallback

When copy callback function.
Type:
Overrides:
Source:

onExport :OnExportComponentCallback

When export data.
Type:
Overrides:
Source:

onImport :OnImportComponentCallback

When import data.
Type:
Overrides:
Source:

onInit :OnInitComponentCallback

When initialize callback function.
Type:
Overrides:
Source:

onLoadResource :OnLoadResourceComponentCallback

When load resource callback function.
Type:
Overrides:
Source:

onParentChange :OnParentChangeComponentCallback

When change parent callback function.
Type:
Overrides:
Source:

onRefresh :OnRefreshComponentCallback

When refresh callback function.
Type:
Overrides:
Source:

onResize :OnResizeComponentCallback

When resize callback function.
Type:
Overrides:
Source:

onUnloadResource :OnUnloadResourceComponentCallback

When unload resource callback function.
Type:
Overrides:
Source:

onUpdate :OnUpdateComponentCallback

When update callback function.
Type:
Overrides:
Source:

onVisibleChange :OnVisibleChangeComponentCallback

When visible change callback function.
Type:
Overrides:
Source:

Methods

load(url, options) → {Promise}

Load scene file
Parameters:
Name Type Description
url String | Object The load URL or options.
options Object The load options.
Properties
Name Type Description
url String The resource URL.
dynamic Boolean Dynamic loading scene.
hidden Boolean Hidden loading.
useDefaultTheme Boolean Use defalt theme for scene. (The last registered theme is used by default)
useDefaultViewpoint Boolean Use default viewpoint for scene file.
useDefaultRenderSettings Boolean Use default render settings for scene file.
position Array Set the scene position.
rotation Array Set the scene rotation.
onComplete function The load complete callback function.
onProgress function The progress callback function.
onError function The error callback function.
Source:
Returns:
- A Promise that resolves when the loading is complete.
Type
Promise

loadImageTexture(url, sampler) → {THING.ImageTexture}

Load image texture from URL.
Parameters:
Name Type Description
url String The resource url.
sampler LoadTextureResourceSamplerInfo The sampler info.
Source:
Returns:
Type
THING.ImageTexture
Example
let image = THING.App.current.loadImageTexture('./flower.png');
	await image.waitForComplete();
	console.log(image);

loadImageTextureAsync(url, sampler) → {Promise.<any>}

Load image texture from URL in async mode.
Parameters:
Name Type Description
url String The resource url.
sampler LoadTextureResourceSamplerInfo The sampler info.
Source:
Returns:
Type
Promise.<any>
Example
let image = await THING.App.current.loadImageTextureAsync('./flower.png');
	console.log(image);

loadPlugin(url, options) → {Promise}

Load plugin
Parameters:
Name Type Description
url String | Object The load URL or options.
options Object The load options.
Properties
Name Type Description
url String The plugin URL.
name String The plugin name.
onComplete function The load complete callback function.
onError function The error callback function.
Source:
Returns:
Type
Promise

onAdd(object)

When add component.
Parameters:
Name Type Description
object THING.BaseObject The object.
Overrides:
Source:

onRemove()

When remove component.
Overrides:
Source: