Skip to content

@blooper.gg/toodle


@blooper.gg/toodle / textures/TextureComputeShader / TextureComputeShader

Class: TextureComputeShader

Defined in: textures/TextureComputeShader.ts:32

A GPU-based texture processor that uses compute shaders to:

  1. Find the non-transparent bounding box in a texture.
  2. Crop the texture to that bounding box.
  3. Create a fallback texture if no non-transparent pixels are found.

Constructors

Constructor

new TextureComputeShader(device, cropPipeline, boundPipeline, missingTexturePipeline): TextureComputeShader

Defined in: textures/TextureComputeShader.ts:39

Parameters

device

GPUDevice

cropPipeline

GPUComputePipeline

boundPipeline

GPUComputePipeline

missingTexturePipeline

GPUComputePipeline

Returns

TextureComputeShader

Methods

processTexture()

processTexture(textureWrapper): Promise<TextureWithMetadata>

Defined in: textures/TextureComputeShader.ts:77

Main entry point to process a texture. Returns a cropped ImageBitmap and metadata.

Parameters

textureWrapper

TextureWithMetadata

Returns

Promise<TextureWithMetadata>


create()

static create(device): TextureComputeShader

Defined in: textures/TextureComputeShader.ts:63

Factory method to initialize pipelines and return an instance of TextureComputeShader.

Parameters

device

GPUDevice

Returns

TextureComputeShader