Skip to content

@bloopjs/toodle


@bloopjs/toodle / text/TextShader / TextShader

Class: TextShader

Defined in: text/TextShader.ts:19

Backend-agnostic shader interface.

This interface abstracts the differences between WebGPU and WebGL shaders. Each backend provides its own implementation.

Implements

Constructors

Constructor

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

Defined in: text/TextShader.ts:35

Parameters

backend

WebGPUBackend

pipeline

FontPipeline

font

MsdfFont

_colorFormat

GPUTextureFormat

instanceCount

number

Returns

TextShader

Properties

label

readonly label: "text" = "text"

Defined in: text/TextShader.ts:20

Debug label for the shader

Implementation of

IBackendShader.label

Accessors

font

Get Signature

get font(): MsdfFont

Defined in: text/TextShader.ts:222

Returns

MsdfFont


maxCharCount

Get Signature

get maxCharCount(): number

Defined in: text/TextShader.ts:226

Returns

number

Methods

endFrame()

endFrame(): void

Defined in: text/TextShader.ts:218

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

Returns

void

Implementation of

IBackendShader.endFrame


processBatch()

processBatch(nodes): number

Defined in: text/TextShader.ts:120

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

IBackendShader.processBatch


startFrame()

startFrame(uniform): void

Defined in: text/TextShader.ts:109

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

IBackendShader.startFrame