Skip to content

@orillusion/core


Class: BitmapTexture2D

Defined in: src/textures/BitmapTexture2D.ts:25

bitmap texture

Extends

Constructors

Constructor

new BitmapTexture2D(useMipmap?, ctx?, colorSpace?): BitmapTexture2D

Defined in: src/textures/BitmapTexture2D.ts:48

Parameters

useMipmap?

boolean = true

Set whether to use mipmap

ctx?

Context3D

Optional Context3D — binds the texture to this engine's device so GPU materialization has a target. Required whenever the caller already knows which engine owns the texture (loaders, Res, GLTF).

colorSpace?

TextureColorSpace = 'linear'

'srgb' to enable hardware sRGB decode (use for baseColor / emissive textures), 'linear' (default) for normal / mask / metallic-roughness / AO / height data.

Returns

BitmapTexture2D

Overrides

Texture.constructor

Properties

_boundCtx

_boundCtx: Context3D = null

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:19

The Context3D this texture is bound to. Set on first GPU use.

Inherited from

Texture._boundCtx


name

name: string

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:39

name of texture

Inherited from

Texture.name


url

url: string

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:44

source url

Inherited from

Texture.url


pid

pid: number

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:94

Return index in texture array

Inherited from

Texture.pid


format

format: GPUTextureFormat

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:153

GPUTextureFormat

Inherited from

Texture.format


usage

usage: number

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:158

GPUTextureUsage

Inherited from

Texture.usage


width

width: number = 4

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:163

texture width

Inherited from

Texture.width


height

height: number = 4

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:168

texture height

Inherited from

Texture.height


depthOrArrayLayers

depthOrArrayLayers: number = 1

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:173

depth or layers, default value is 1

Inherited from

Texture.depthOrArrayLayers


numberLayer

numberLayer: number = 1

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:178

depth or layers, default value is 1

Inherited from

Texture.numberLayer


viewDescriptor

viewDescriptor: GPUTextureViewDescriptor

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:183

GPUTextureViewDescriptor

Inherited from

Texture.viewDescriptor


textureDescriptor

textureDescriptor: GPUTextureDescriptor

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:188

GPUTextureDescriptor

Inherited from

Texture.textureDescriptor


visibility

visibility: number

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:193

GPUShaderStage

Inherited from

Texture.visibility


textureBindingLayout

textureBindingLayout: GPUTextureBindingLayout

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:199

GPUTextureBindingLayout, contains viewDimension and multisampled

Inherited from

Texture.textureBindingLayout


samplerBindingLayout

samplerBindingLayout: GPUSamplerBindingLayout

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:207

GPUSamplerBindingLayout

Inherited from

Texture.samplerBindingLayout


sampler_comparisonBindingLayout

sampler_comparisonBindingLayout: GPUSamplerBindingLayout

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:214

GPUSamplerBindingLayout

Inherited from

Texture.sampler_comparisonBindingLayout


flipY

flipY: boolean

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:221

whether to flip the image on the y-axis

Inherited from

Texture.flipY


isVideoTexture?

optional isVideoTexture?: boolean

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:226

whether is video texture

Inherited from

Texture.isVideoTexture


isHDRTexture?

optional isHDRTexture?: boolean

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:230

whether this texture holds HDR (high dynamic range) image data

Inherited from

Texture.isHDRTexture


mipmapCount

mipmapCount: number = 1

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:297

mipmap Count, default value is 1

Inherited from

Texture.mipmapCount


premultiplyAlpha

premultiplyAlpha: PremultiplyAlpha = 'none'

Defined in: src/textures/BitmapTexture2D.ts:27


colorSpace

colorSpace: TextureColorSpace

Defined in: src/textures/BitmapTexture2D.ts:36

Color-space contract for the underlying bytes. 'srgb'rgba8unorm-srgb format (hardware decode on sample); 'linear'rgba8unorm (raw, no conversion). Default 'linear' preserves legacy behavior — migrate sRGB-encoded color textures by passing 'srgb' at the call site.

Accessors

view

Get Signature

get view(): GPUTextureView | GPUExternalTexture

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:101

Returns

GPUTextureView | GPUExternalTexture

Set Signature

set view(v): void

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:111

Parameters
v

GPUTextureView | GPUExternalTexture

Returns

void

Inherited from

Texture.view


gpuSampler

Get Signature

get gpuSampler(): GPUSampler

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:120

Returns

GPUSampler

Set Signature

set gpuSampler(v): void

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:127

Parameters
v

GPUSampler

Returns

void

Inherited from

Texture.gpuSampler


gpuSampler_comparison

Get Signature

get gpuSampler_comparison(): GPUSampler

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:136

Returns

GPUSampler

Set Signature

set gpuSampler_comparison(v): void

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:146

Parameters
v

GPUSampler

Returns

void

Inherited from

Texture.gpuSampler_comparison


useMipmap

Get Signature

get useMipmap(): boolean

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:469

enable/disable mipmap

Returns

boolean

Set Signature

set useMipmap(value): void

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:476

get mipmap

Parameters
value

boolean

Returns

void

Inherited from

Texture.useMipmap


sourceImageData

Get Signature

get sourceImageData(): HTMLCanvasElement | ImageBitmap | OffscreenCanvas

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:507

the cached CPU source image used to (re)upload the GPU texture

Returns

HTMLCanvasElement | ImageBitmap | OffscreenCanvas

Inherited from

Texture.sourceImageData


addressModeU

Get Signature

get addressModeU(): GPUAddressMode

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:621

Sampler address mode for the U (width) texture coordinate.

Returns

GPUAddressMode

Set Signature

set addressModeU(value): void

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:625

Parameters
value

GPUAddressMode

Returns

void

Inherited from

Texture.addressModeU


addressModeV

Get Signature

get addressModeV(): GPUAddressMode

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:635

Sampler address mode for the V (height) texture coordinate.

Returns

GPUAddressMode

Set Signature

set addressModeV(value): void

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:639

Parameters
value

GPUAddressMode

Returns

void

Inherited from

Texture.addressModeV


addressModeW

Get Signature

get addressModeW(): GPUAddressMode

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:649

Sampler address mode for the W (depth) texture coordinate.

Returns

GPUAddressMode

Set Signature

set addressModeW(value): void

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:653

Specifies the GPUAddressMode | address modes for the texture width, height, and depth coordinates, respectively.

Parameters
value

GPUAddressMode

Returns

void

Inherited from

Texture.addressModeW


magFilter

Get Signature

get magFilter(): GPUFilterMode

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:664

Sampling filter used when the sample footprint is smaller than or equal to one texel (magnification).

Returns

GPUFilterMode

Set Signature

set magFilter(value): void

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:668

Specifies the sampling behavior when the sampled area is smaller than or equal to one texel.

Parameters
value

GPUFilterMode

Returns

void

Inherited from

Texture.magFilter


minFilter

Get Signature

get minFilter(): GPUFilterMode

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:679

Sampling filter used when the sample footprint is larger than one texel (minification).

Returns

GPUFilterMode

Set Signature

set minFilter(value): void

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:683

Specifies the sampling behavior when the sampled area is larger than one texel.

Parameters
value

GPUFilterMode

Returns

void

Inherited from

Texture.minFilter


mipmapFilter

Get Signature

get mipmapFilter(): GPUMipmapFilterMode

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:693

Filter used when sampling between mipmap levels.

Returns

GPUMipmapFilterMode

Set Signature

set mipmapFilter(value): void

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:697

Specifies behavior for sampling between mipmap levels.

Parameters
value

GPUMipmapFilterMode

Returns

void

Inherited from

Texture.mipmapFilter


lodMinClamp

Get Signature

get lodMinClamp(): number

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:707

Minimum level-of-detail clamp used internally when sampling.

Returns

number

Set Signature

set lodMinClamp(value): void

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:711

Parameters
value

number

Returns

void

Inherited from

Texture.lodMinClamp


lodMaxClamp

Get Signature

get lodMaxClamp(): number

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:721

Maximum level-of-detail clamp used internally when sampling.

Returns

number

Set Signature

set lodMaxClamp(value): void

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:725

Specifies the minimum and maximum levels of detail, respectively, used internally when sampling a texture.

Parameters
value

number

Returns

void

Inherited from

Texture.lodMaxClamp


compare

Get Signature

get compare(): GPUCompareFunction

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:735

Comparison function; when set the sampler becomes a comparison sampler.

Returns

GPUCompareFunction

Set Signature

set compare(value): void

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:739

When provided the sampler will be a comparison sampler with the specified GPUCompareFunction. Note: Comparison samplers may use filtering, but the sampling results will be implementation-dependent and may differ from the normal filtering rules.

Parameters
value

GPUCompareFunction

Returns

void

Inherited from

Texture.compare


maxAnisotropy

Get Signature

get maxAnisotropy(): number

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:749

Maximum anisotropy clamp used by the sampler.

Returns

number

Set Signature

set maxAnisotropy(value): void

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:753

Specifies the maximum anisotropy value clamp used by the sampler. Anisotropic filtering is enabled when GPUSamplerDescriptor#maxAnisotropy is > 1 and the implementation supports it. Anisotropic filtering improves the image quality of textures sampled at oblique viewing angles. Higher GPUSamplerDescriptor#maxAnisotropy values indicate the maximum ratio of anisotropy supported when filtering.

Most implementations support GPUSamplerDescriptor#maxAnisotropy values in range between 1 and 16, inclusive. The used value of GPUSamplerDescriptor#maxAnisotropy will be clamped to the maximum value that the platform supports. The precise filtering behavior is implementation-dependent.
Parameters
value

number

Returns

void

Inherited from

Texture.maxAnisotropy


source

Get Signature

get source(): HTMLCanvasElement | ImageBitmap | OffscreenCanvas | HTMLImageElement

Defined in: src/textures/BitmapTexture2D.ts:71

get raw data of this texture

Returns

HTMLCanvasElement | ImageBitmap | OffscreenCanvas | HTMLImageElement

Set Signature

set source(value): void

Defined in: src/textures/BitmapTexture2D.ts:78

set raw data of this texture

Parameters
value

HTMLCanvasElement | ImageBitmap | OffscreenCanvas | HTMLImageElement

Returns

void

Methods

_ensureBound()

_ensureBound(ctx?): Context3D

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:28

Ensure this texture is bound to a Context3D and return it. Resolution order: explicit arg, prior bindCtx(), then the single-engine default (same contract as Engine3D._defaultContext() for no-arg material constructors). Throws only when the choice is ambiguous — no engine yet, or several engines alive without an explicit ctx.

Parameters

ctx?

Context3D

Returns

Context3D

Inherited from

Texture._ensureBound


init()

init(): this

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:327

Run the optional internal create hooks (binding layout, texture, view, sampler) if a subclass provides them.

Returns

this

this texture, for chaining

Inherited from

Texture.init


getMipmapCount()

getMipmapCount(): number

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:515

Compute the full mipmap chain length for the current texture size.

Returns

number

number of mip levels

Inherited from

Texture.getMipmapCount


getGPUTexture()

getGPUTexture(): GPUTexture

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:553

create or get GPUTexture (delegates to the per-context gpuTexture getter, which handles lazy creation + source-image upload).

Returns

GPUTexture

Inherited from

Texture.getGPUTexture


getGPUView()

getGPUView(_index?): GPUTextureView | GPUExternalTexture

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:561

create or get GPUTextureView (delegates to the per-context view getter, which handles lazy creation from viewDescriptor).

Parameters

_index?

number = 0

Returns

GPUTextureView | GPUExternalTexture

Inherited from

Texture.getGPUView


bindStateChange()

bindStateChange(fun, ref): void

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:573

Register a callback invoked when this texture's GPU resources change.

Parameters

fun

Function

callback to invoke on change

ref

any

owner reference used as the key for later unbinding

Returns

void

Inherited from

Texture.bindStateChange


unBindStateChange()

unBindStateChange(ref): void

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:581

Remove a previously registered state-change callback.

Parameters

ref

any

owner reference used when binding the callback

Returns

void

Inherited from

Texture.unBindStateChange


destroy()

destroy(force?): void

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:602

release the materialized texture and all GPU slots

Parameters

force?

boolean

Returns

void

Inherited from

Texture.destroy


delayDestroyTexture()

static delayDestroyTexture(ctx, tex): void

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:773

Queue a GPU texture for deferred destruction on the given context.

Parameters

ctx

Context3D

the owning context

tex

GPUTexture

the GPU texture to destroy later

Returns

void

Inherited from

Texture.delayDestroyTexture


destroyTexture()

static destroyTexture(ctx): void

Defined in: src/gfx/graphics/webGpu/core/texture/Texture.ts:784

Destroy all GPU textures queued for deferred destruction on the context.

Parameters

ctx

Context3D

the context whose queued textures are destroyed

Returns

void

Inherited from

Texture.destroyTexture


load()

load(url, loaderFunctions?): Promise<unknown>

Defined in: src/textures/BitmapTexture2D.ts:111

load texture data from web url

Parameters

url

string

web url

loaderFunctions?

LoaderFunctions

callback function when load complete

Returns

Promise<unknown>


loadFromBlob()

loadFromBlob(imgData): Promise<boolean>

Defined in: src/textures/BitmapTexture2D.ts:166

load data from Blob

Parameters

imgData

Blob

blob data which contains image

Returns

Promise<boolean>