Skip to content

Documentation / scene / Blitter

Abstract Class: Blitter ​

Defined in: libs/scene/src/blitter/blitter.ts:35

Base class for any kind of blitters

Extended by ​

Constructors ​

Constructor ​

new Blitter(): Blitter

Defined in: libs/scene/src/blitter/blitter.ts:55

Creates an instance of Blitter

Returns ​

Blitter

Accessors ​

viewport ​

Get Signature ​

get viewport(): number[]

Defined in: libs/scene/src/blitter/blitter.ts:66

Viewport

Returns ​

number[]

Set Signature ​

set viewport(val): void

Defined in: libs/scene/src/blitter/blitter.ts:69

Parameters ​
val ​

number[]

Returns ​

void


scissor ​

Get Signature ​

get scissor(): number[]

Defined in: libs/scene/src/blitter/blitter.ts:73

Scissor rect

Returns ​

number[]

Set Signature ​

set scissor(val): void

Defined in: libs/scene/src/blitter/blitter.ts:76

Parameters ​
val ​

number[]

Returns ​

void


destRect ​

Get Signature ​

get destRect(): number[]

Defined in: libs/scene/src/blitter/blitter.ts:80

Destination rectangle

Returns ​

number[]

Set Signature ​

set destRect(val): void

Defined in: libs/scene/src/blitter/blitter.ts:83

Parameters ​
val ​

number[]

Returns ​

void


srgbOut ​

Get Signature ​

get srgbOut(): boolean

Defined in: libs/scene/src/blitter/blitter.ts:92

Whether output color value in gamma color space

Returns ​

boolean

Set Signature ​

set srgbOut(val): void

Defined in: libs/scene/src/blitter/blitter.ts:95

Parameters ​
val ​

boolean

Returns ​

void


renderStates ​

Get Signature ​

get renderStates(): RenderStateSet

Defined in: libs/scene/src/blitter/blitter.ts:104

Render states used to do the blitting

Returns ​

RenderStateSet

Set Signature ​

set renderStates(rs): void

Defined in: libs/scene/src/blitter/blitter.ts:107

Parameters ​
rs ​

RenderStateSet

Returns ​

void


hash ​

Get Signature ​

get hash(): string

Defined in: libs/scene/src/blitter/blitter.ts:113

Program hash code

Returns ​

string

Methods ​

invalidateHash() ​

invalidateHash(): void

Defined in: libs/scene/src/blitter/blitter.ts:124

Force the hash code to be regenerated

Returns ​

void


readTexel() ​

readTexel(scope, type, srcTex, uv, srcLayer, sampleType): PBShaderExp

Defined in: libs/scene/src/blitter/blitter.ts:136

Reads a texel from the source texture

Parameters ​

scope ​

PBInsideFunctionScope

The shader scope

type ​

BlitType

The blit type

srcTex ​

PBShaderExp

The source texture

uv ​

PBShaderExp

The texture coordinate from where the texel will be read

srcLayer ​

PBShaderExp

The layer of the source texture

sampleType ​

"float" | "depth" | "uint" | "int"

Returns ​

PBShaderExp

The read texel


writeTexel() ​

writeTexel(scope, type, uv, texel): PBShaderExp

Defined in: libs/scene/src/blitter/blitter.ts:183

Writes a texel to destination texture

Parameters ​

scope ​

PBInsideFunctionScope

The shader scope

type ​

BlitType

The blit type

uv ​

PBShaderExp

The texture coordinate to where the texel will be written

texel ​

PBShaderExp

The texel to be written

Returns ​

PBShaderExp

The written texel


setup() ​

setup(_scope, _type): void

Defined in: libs/scene/src/blitter/blitter.ts:191

Initialize uniforms of the blit program

Parameters ​

_scope ​

PBGlobalScope

The shader scope

_type ​

BlitType

The blit type

Returns ​

void


setUniforms() ​

setUniforms(_bindGroup, _sourceTex): void

Defined in: libs/scene/src/blitter/blitter.ts:196

Update uniforms of the bind group

Parameters ​

_bindGroup ​

BindGroup

_sourceTex ​

BaseTexture

Returns ​

void


filter() ​

abstract filter(scope, type, srcTex, srcUV, srcLayer, sampeType): PBShaderExp

Defined in: libs/scene/src/blitter/blitter.ts:206

Calculates the destination texel by the source texel

Parameters ​

scope ​

PBInsideFunctionScope

The shader scope

type ​

BlitType

The blit type

srcTex ​

PBShaderExp

The source texel

srcUV ​

PBShaderExp

The texture coordinate of the source texel

srcLayer ​

PBShaderExp

The layer of the source texture

sampeType ​

"float" | "depth" | "uint" | "int"

Returns ​

PBShaderExp

the destination texel


calcHash() ​

abstract protected calcHash(): string

Defined in: libs/scene/src/blitter/blitter.ts:218

Calculates the hash code

Returns ​

string

the calculated hash code


blit() ​

Call Signature ​

blit(source, dest, sampler?): void

Defined in: libs/scene/src/blitter/blitter.ts:321

Blits a 2D texture to a frame buffer

Parameters ​
source ​

Texture2D

The source texture

dest ​

FrameBuffer<unknown>

The frame buffer to blit onto

sampler? ​

TextureSampler<unknown>

Sampler for source texture

Returns ​

void

Call Signature ​

blit(source, dest, sampler?): void

Defined in: libs/scene/src/blitter/blitter.ts:328

Blits a 2D texture to 2D texture or frame buffer

Parameters ​
source ​

Texture2D

The source texture

dest ​

Texture2D

The destination texture or frame buffer

sampler? ​

TextureSampler<unknown>

Sampler for source texture

Returns ​

void

Call Signature ​

blit(source, dest, layer, sampler?): void

Defined in: libs/scene/src/blitter/blitter.ts:336

Blits a 2D texture to given layer of a 2D array texture

Parameters ​
source ​

Texture2D

The source texture

dest ​

Texture2DArray

The destination texture

layer ​

number

The layer of the destination texture

sampler? ​

TextureSampler<unknown>

Sampler for source texture

Returns ​

void

Call Signature ​

blit(source, dest, sampler?): void

Defined in: libs/scene/src/blitter/blitter.ts:347

Blits a 2d array texture to another 2d array texture

Parameters ​
source ​

Texture2DArray

The source texture

dest ​

Texture2DArray

The destination texture

sampler? ​

TextureSampler<unknown>

Sampler for source texture

Returns ​

void

Remarks ​

All layers of the source texture will be copied to the destination texture

Call Signature ​

blit(source, dest, layer, sampler?): void

Defined in: libs/scene/src/blitter/blitter.ts:355

Blits given layer of a 2d array texture to a frame buffer

Parameters ​
source ​

Texture2DArray

The source texture

dest ​

FrameBuffer<unknown>

The frame buffer to blit onto

layer ​

number

The layer to be copied

sampler? ​

TextureSampler<unknown>

Sampler for source texture

Returns ​

void

Call Signature ​

blit(source, dest, layer, sampler?): void

Defined in: libs/scene/src/blitter/blitter.ts:368

Blits given layer of a 2d array texture to a 2d texture or frame buffer

Parameters ​
source ​

Texture2DArray

The source texture

dest ​

Texture2D

The destination texture or frame buffer

layer ​

number

The layer to be copied

sampler? ​

TextureSampler<unknown>

Sampler for source texture

Returns ​

void

Call Signature ​

blit(source, dest, sampler?): void

Defined in: libs/scene/src/blitter/blitter.ts:379

Blits a cube texture to another cube texture

Parameters ​
source ​

TextureCube

The source texture

dest ​

TextureCube

The destination texture

sampler? ​

TextureSampler<unknown>

Sampler for source texture

Returns ​

void

Remarks ​

All faces of the source texture will be copied to the destination texture

Call Signature ​

blit(source, dest, face, sampler?): void

Defined in: libs/scene/src/blitter/blitter.ts:387

Blits given face of a cube texture to a frame buffer

Parameters ​
source ​

TextureCube

The source texture

dest ​

FrameBuffer<unknown>

The frame buffer to blit onto

face ​

number

The face to be copied

sampler? ​

TextureSampler<unknown>

Sampler for source texture

Returns ​

void

Call Signature ​

blit(source, dest, face, sampler?): void

Defined in: libs/scene/src/blitter/blitter.ts:400

Blits given face of a cube texture to a 2d texture or frame buffer

Parameters ​
source ​

TextureCube

The source texture

dest ​

Texture2D

The destination texture or frame buffer

face ​

number

The face to be copied

sampler? ​

TextureSampler<unknown>

Sampler for source texture

Returns ​

void

Call Signature ​

blit(source, dest, layer?, sampler?): void

Defined in: libs/scene/src/blitter/blitter.ts:401

Blits a 2D texture to a frame buffer

Parameters ​
source ​

BaseTexture

The source texture

dest ​

FrameBuffer<unknown> | BaseTexture<unknown>

The frame buffer to blit onto

layer? ​

number | TextureSampler<unknown>

sampler? ​

TextureSampler<unknown>

Sampler for source texture

Returns ​

void

Released under the MIT License.