Skip to main content

Class: VideoTexture

Defined in: modules/engine/src/dynamic-texture/video-texture.ts:26

Live video binding source.

GLSL sampler2D and WGSL texture_2d bindings resolve to copied luma textures. WGSL texture_external bindings resolve to native WebGPU external textures.

Implements​

Constructors​

Constructor​

new VideoTexture(device, props): VideoTexture

Defined in: modules/engine/src/dynamic-texture/video-texture.ts:81

Creates a live video binding source.

Parameters​

device​

Device

Device that resolves copied or native external bindings.

props​

VideoTextureProps

Live video source and copied texture options.

Returns​

VideoTexture

Properties​

destroyed​

destroyed: boolean = false

Defined in: modules/engine/src/dynamic-texture/video-texture.ts:33

Whether this video binding source has been destroyed.


device​

readonly device: Device

Defined in: modules/engine/src/dynamic-texture/video-texture.ts:28

Device used to create copied and native external texture bindings.


generation​

generation: number = 0

Defined in: modules/engine/src/dynamic-texture/video-texture.ts:35

Monotonic binding generation advanced when concrete draw bindings may need recreation.

Implementation of​

TextureBindingSource.generation


id​

readonly id: string

Defined in: modules/engine/src/dynamic-texture/video-texture.ts:30

Stable resource identifier used in loading and debug messages.

Implementation of​

TextureBindingSource.id

Accessors​

[toStringTag]​

Get Signature​

get [toStringTag](): string

Defined in: modules/engine/src/dynamic-texture/video-texture.ts:66

Resource label used by debug output.

Returns​

string


isReady​

Get Signature​

get isReady(): boolean

Defined in: modules/engine/src/dynamic-texture/video-texture.ts:54

Whether the current source exposes dimensions and a current frame.

Returns​

boolean

Whether the source can resolve a concrete binding for the current draw.

Implementation of​

TextureBindingSource.isReady


source​

Get Signature​

get source(): VideoFrame | HTMLVideoElement

Defined in: modules/engine/src/dynamic-texture/video-texture.ts:49

Current caller-owned live video source.

Returns​

VideoFrame | HTMLVideoElement


updateTimestamp​

Get Signature​

get updateTimestamp(): number

Defined in: modules/engine/src/dynamic-texture/video-texture.ts:60

Device timestamp of the most recent source content or binding identity update.

Returns​

number

Device timestamp of the most recent source content or binding identity update.

Implementation of​

TextureBindingSource.updateTimestamp

Methods​

destroy()​

destroy(): void

Defined in: modules/engine/src/dynamic-texture/video-texture.ts:142

Releases owned copied/external bindings without closing the caller-owned source.

Returns​

void


resolveTextureBinding()​

resolveTextureBinding(bindingLayout): Texture | ExternalTexture | null

Defined in: modules/engine/src/dynamic-texture/video-texture.ts:117

Resolves one reflected shader texture slot for the current video frame.

Parameters​

bindingLayout​

TextureBindingLayout

Reflected texture or external-texture shader slot.

Returns​

Texture | ExternalTexture | null

A copied texture, native external texture, or null while unavailable.

Implementation of​

TextureBindingSource.resolveTextureBinding


setSampler()​

setSampler(sampler): void

Defined in: modules/engine/src/dynamic-texture/video-texture.ts:134

Replaces the default sampler used by copied and native external bindings.

Parameters​

sampler​

Sampler | SamplerProps

Sampler instance or sampler properties to use for future resolutions.

Returns​

void


setSource()​

setSource(source): void

Defined in: modules/engine/src/dynamic-texture/video-texture.ts:99

Replaces the caller-owned video source and invalidates resolved bindings.

Parameters​

source​

VideoFrame | HTMLVideoElement

Next caller-owned video source to follow.

Returns​

void


toString()​

toString(): string

Defined in: modules/engine/src/dynamic-texture/video-texture.ts:71

Formats the current source dimensions and readiness for debug output.

Returns​

string