Skip to content

@bloopjs/toodle


@bloopjs/toodle / backends/webgpu/WebGPUTextShader / WebGPUTextShader

Class: WebGPUTextShader ​

Defined in: backends/webgpu/WebGPUTextShader.ts:23

Backend-agnostic text shader interface.

Extends IBackendShader with text-specific properties. Each backend provides its own implementation.

Implements ​

Constructors ​

Constructor ​

new WebGPUTextShader(backend, pipeline, font, _colorFormat, instanceCount): WebGPUTextShader

Defined in: backends/webgpu/WebGPUTextShader.ts:40

Parameters ​

backend ​

WebGPUBackend

pipeline ​

FontPipeline

font ​

MsdfFont

_colorFormat ​

GPUTextureFormat

instanceCount ​

number

Returns ​

WebGPUTextShader

Properties ​

code ​

readonly code: string = msdfShader

Defined in: backends/webgpu/WebGPUTextShader.ts:25

The final compiled shader code (for debugging)

Implementation of ​

ITextShader.code


label ​

readonly label: "text" = "text"

Defined in: backends/webgpu/WebGPUTextShader.ts:24

Debug label for the shader

Implementation of ​

ITextShader.label

Accessors ​

font ​

Get Signature ​

get font(): MsdfFont

Defined in: backends/webgpu/WebGPUTextShader.ts:227

The font used by this text shader

Returns ​

MsdfFont

The font used by this text shader

Implementation of ​

ITextShader.font


maxCharCount ​

Get Signature ​

get maxCharCount(): number

Defined in: backends/webgpu/WebGPUTextShader.ts:231

Maximum number of characters that can be rendered per text node

Returns ​

number

Maximum number of characters that can be rendered per text node

Implementation of ​

ITextShader.maxCharCount

Methods ​

endFrame() ​

endFrame(): void

Defined in: backends/webgpu/WebGPUTextShader.ts:223

Cleanup after frame. Called once per frame after all processBatch calls.

Returns ​

void

Implementation of ​

ITextShader.endFrame


processBatch() ​

processBatch(nodes): number

Defined in: backends/webgpu/WebGPUTextShader.ts:125

Process a batch of nodes and issue draw calls.

Parameters ​

nodes ​

SceneNode[]

The nodes to render

Returns ​

number

Number of draw calls issued

Implementation of ​

ITextShader.processBatch


startFrame() ​

startFrame(uniform): void

Defined in: backends/webgpu/WebGPUTextShader.ts:114

Prepare for a new frame. Called once per frame before any processBatch calls.

Parameters ​

uniform ​

EngineUniform

Engine uniforms (view-projection, resolution)

Returns ​

void

Implementation of ​

ITextShader.startFrame