Skip to main content

Class: Resource<T>

Type parameters

NameType
Textends ResourceOptions

Hierarchy

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new Resource<T>(renderer, options?): Resource<T>

Type parameters

NameType
Textends ResourceOptions

Parameters

NameType
rendererRenderer
optionsPartial<T>

Returns

Resource<T>

Overrides

Base.constructor

Defined in

src/core/Resource.ts:32

Properties

renderer

renderer: Renderer

Inherited from

Base.renderer

Defined in

src/core/Base.ts:7


id

id: string

Defined in

src/core/Resource.ts:21


name

name: WithUndef<string>

Defined in

src/core/Resource.ts:23


userData

userData: any

Defined in

src/core/Resource.ts:25


byteLength

byteLength: number

Defined in

src/core/Resource.ts:28


options

options: Partial<T>

Defined in

src/core/Resource.ts:30

Accessors

gl

get gl(): WebGLRenderingContext | WebGL2RenderingContext

获取 webgl 实例

Returns

WebGLRenderingContext | WebGL2RenderingContext

Inherited from

Base.gl

Defined in

src/core/Base.ts:16


rendererState

get rendererState(): State

获取渲染状态

Returns

State

Inherited from

Base.rendererState

Defined in

src/core/Base.ts:23


handle

get handle(): any

Returns

any

Defined in

src/core/Resource.ts:47

Methods

swapHandle

swapHandle(handle): void

交换为新的 handle(一般我们会用在虚拟 webgl 环境中)

Parameters

NameType
handleany

Returns

void

Defined in

src/core/Resource.ts:55


restoreHandle

restoreHandle(): void

恢复为原有 handle

Returns

void

Defined in

src/core/Resource.ts:63


destroy

destroy(): void

销毁相关资源

Returns

void

Defined in

src/core/Resource.ts:70


delete

delete(«destructured»?): Resource<T>

Parameters

NameTypeDefault value
«destructured»Object{}
› deleteChildrenundefined | booleanfalse

Returns

Resource<T>

Defined in

src/core/Resource.ts:74


bind

bind(funcOrHandle?): void

Parameters

NameType
funcOrHandleany

Returns

void

Defined in

src/core/Resource.ts:91


unbind

unbind(): void

Returns

void

Defined in

src/core/Resource.ts:95


removeStats

removeStats(): void

Returns

void

Defined in

src/core/Resource.ts:99


createHandle

createHandle(): void

Returns

void

Defined in

src/core/Resource.ts:103


deleteHandle

deleteHandle(): void

Returns

void

Defined in

src/core/Resource.ts:107


toString

toString(): string

Returns

string

Defined in

src/core/Resource.ts:111