@blooper.gg/toodle / textures/TextureComputeShader / TextureComputeShader
Class: TextureComputeShader
Defined in: textures/TextureComputeShader.ts:32
A GPU-based texture processor that uses compute shaders to:
- Find the non-transparent bounding box in a texture.
- Crop the texture to that bounding box.
- 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
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