@ascii-fx/three 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/asciiPass.d.ts +15 -6
- package/dist/index.js +28 -4
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/asciiPass.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { RenderTarget } from 'three';
|
|
2
2
|
import type { Camera, Object3D } from 'three';
|
|
3
3
|
import type { WebGPURenderer } from 'three/webgpu';
|
|
4
|
-
import type { AsciiFrame, AsciiProfile } from '@ascii-fx/core';
|
|
5
|
-
import type { AsciiPointer, FitMode, InteractionOptions, StreamMatchOptions } from '@ascii-fx/gpu';
|
|
4
|
+
import type { AsciiFrame, AsciiProfile, PaletteOptions } from '@ascii-fx/core';
|
|
5
|
+
import type { AsciiPointer, FitMode, InteractionOptions, PostOptions, StreamMatchOptions } from '@ascii-fx/gpu';
|
|
6
6
|
export interface AsciiPassOptions extends StreamMatchOptions {
|
|
7
7
|
profile: AsciiProfile;
|
|
8
8
|
renderer: WebGPURenderer;
|
|
@@ -12,7 +12,16 @@ export interface AsciiPassOptions extends StreamMatchOptions {
|
|
|
12
12
|
fit?: FitMode;
|
|
13
13
|
clearColor?: readonly [number, number, number, number];
|
|
14
14
|
interaction?: InteractionOptions | null;
|
|
15
|
+
/** palette-v1 colour snap between matching and the composite; see AsciiRendererOptions. */
|
|
16
|
+
palette?: PaletteOptions | null;
|
|
17
|
+
post?: PostOptions | null;
|
|
15
18
|
}
|
|
19
|
+
type ViewOptions = {
|
|
20
|
+
fit: FitMode;
|
|
21
|
+
clearColor: readonly [number, number, number, number];
|
|
22
|
+
palette: PaletteOptions | null;
|
|
23
|
+
post: PostOptions | null;
|
|
24
|
+
};
|
|
16
25
|
/**
|
|
17
26
|
* Fullscreen ASCII postprocessing for THREE.WebGPURenderer (spec §30):
|
|
18
27
|
* scene → render target → exact structural-v1 compute on Three's own
|
|
@@ -35,6 +44,8 @@ export declare class AsciiPass {
|
|
|
35
44
|
private matchOpts;
|
|
36
45
|
private fit;
|
|
37
46
|
private clearColor;
|
|
47
|
+
private palette;
|
|
48
|
+
private post;
|
|
38
49
|
private interaction;
|
|
39
50
|
private pointerX;
|
|
40
51
|
private pointerY;
|
|
@@ -50,10 +61,7 @@ export declare class AsciiPass {
|
|
|
50
61
|
/** Compile pipelines on the renderer's device. Call once after renderer.init(). */
|
|
51
62
|
init(): Promise<void>;
|
|
52
63
|
/** Update matcher/composite options (spec §2: `ascii.set({...})`). */
|
|
53
|
-
set(options: Partial<StreamMatchOptions &
|
|
54
|
-
fit: FitMode;
|
|
55
|
-
clearColor: readonly [number, number, number, number];
|
|
56
|
-
}>): void;
|
|
64
|
+
set(options: Partial<StreamMatchOptions & ViewOptions>): void;
|
|
57
65
|
setInteraction(interaction: InteractionOptions | null): void;
|
|
58
66
|
setSize(width: number, height: number): void;
|
|
59
67
|
grid(): {
|
|
@@ -66,3 +74,4 @@ export declare class AsciiPass {
|
|
|
66
74
|
captureFrame(): Promise<AsciiFrame>;
|
|
67
75
|
dispose(): void;
|
|
68
76
|
}
|
|
77
|
+
export {};
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/asciiPass.ts
|
|
2
2
|
import { RenderTarget, Vector2 } from "three";
|
|
3
|
-
import { AsciiEngine } from "@ascii-fx/gpu";
|
|
3
|
+
import { AsciiEngine } from "@ascii-fx/gpu/webgpu";
|
|
4
4
|
|
|
5
5
|
// src/internals.ts
|
|
6
6
|
var backendOf = (renderer) => renderer.backend;
|
|
@@ -42,6 +42,8 @@ var AsciiPass = class {
|
|
|
42
42
|
matchOpts;
|
|
43
43
|
fit;
|
|
44
44
|
clearColor;
|
|
45
|
+
palette;
|
|
46
|
+
post;
|
|
45
47
|
interaction;
|
|
46
48
|
pointerX = 0.5;
|
|
47
49
|
pointerY = 0.5;
|
|
@@ -54,12 +56,25 @@ var AsciiPass = class {
|
|
|
54
56
|
device;
|
|
55
57
|
disposed = false;
|
|
56
58
|
constructor(options) {
|
|
57
|
-
const {
|
|
59
|
+
const {
|
|
60
|
+
profile,
|
|
61
|
+
renderer,
|
|
62
|
+
width,
|
|
63
|
+
height,
|
|
64
|
+
fit,
|
|
65
|
+
clearColor,
|
|
66
|
+
interaction,
|
|
67
|
+
palette,
|
|
68
|
+
post,
|
|
69
|
+
...match
|
|
70
|
+
} = options;
|
|
58
71
|
this.profile = profile;
|
|
59
72
|
this.rendererRef = renderer;
|
|
60
73
|
this.matchOpts = match;
|
|
61
74
|
this.fit = fit;
|
|
62
75
|
this.clearColor = clearColor;
|
|
76
|
+
this.palette = palette ?? null;
|
|
77
|
+
this.post = post ?? null;
|
|
63
78
|
this.interaction = interaction ?? null;
|
|
64
79
|
const size = renderer.getDrawingBufferSize(this.drawSize);
|
|
65
80
|
this.renderTarget = new RenderTarget(
|
|
@@ -104,9 +119,11 @@ var AsciiPass = class {
|
|
|
104
119
|
}
|
|
105
120
|
/** Update matcher/composite options (spec §2: `ascii.set({...})`). */
|
|
106
121
|
set(options) {
|
|
107
|
-
const { fit, clearColor, ...match } = options;
|
|
122
|
+
const { fit, clearColor, palette, post, ...match } = options;
|
|
108
123
|
if (fit !== void 0) this.fit = fit;
|
|
109
124
|
if (clearColor !== void 0) this.clearColor = clearColor;
|
|
125
|
+
if (palette !== void 0) this.palette = palette;
|
|
126
|
+
if (post !== void 0) this.post = post;
|
|
110
127
|
this.matchOpts = { ...this.matchOpts, ...match };
|
|
111
128
|
}
|
|
112
129
|
setInteraction(interaction) {
|
|
@@ -142,7 +159,14 @@ var AsciiPass = class {
|
|
|
142
159
|
stream.encodeMatch(cenc);
|
|
143
160
|
this.device.queue.submit([cenc.finish()]);
|
|
144
161
|
const size = renderer.getDrawingBufferSize(this.drawSize);
|
|
145
|
-
stream.syncView({
|
|
162
|
+
stream.syncView({
|
|
163
|
+
width: size.x,
|
|
164
|
+
height: size.y,
|
|
165
|
+
fit: this.fit,
|
|
166
|
+
clearColor: this.clearColor,
|
|
167
|
+
palette: this.palette,
|
|
168
|
+
post: this.post
|
|
169
|
+
});
|
|
146
170
|
stream.syncFx(
|
|
147
171
|
{
|
|
148
172
|
interaction: this.interaction,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/asciiPass.ts","../src/internals.ts","../src/asciiGlyphs.ts"],"sourcesContent":["import { RenderTarget, Vector2 } from 'three'\nimport type { Camera, Object3D } from 'three'\nimport type { WebGPURenderer } from 'three/webgpu'\nimport type { AsciiFrame, AsciiProfile } from '@ascii-fx/core'\nimport { AsciiEngine, AsciiStream } from '@ascii-fx/gpu'\nimport type { AsciiPointer, FitMode, InteractionOptions, StreamMatchOptions } from '@ascii-fx/gpu'\nimport { getCanvasContext, getDevice, getGpuTexture } from './internals.js'\n\nexport interface AsciiPassOptions extends StreamMatchOptions {\n profile: AsciiProfile\n renderer: WebGPURenderer\n /** Render-target resolution; defaults to the renderer's drawing buffer size. */\n width?: number\n height?: number\n fit?: FitMode\n clearColor?: readonly [number, number, number, number]\n interaction?: InteractionOptions | null\n}\n\n/**\n * Fullscreen ASCII postprocessing for THREE.WebGPURenderer (spec §30):\n * scene → render target → exact structural-v1 compute on Three's own\n * GPUDevice → one-draw atlas composite straight to the canvas.\n *\n * The render target holds linear-light values, so the source is sRGB-encoded\n * before matching (§28). Usage:\n *\n * ```ts\n * const pass = new AsciiPass({ profile, renderer, columns: 160 })\n * await pass.init()\n * pass.render(scene, camera) // instead of renderer.render(...)\n * ```\n */\nexport class AsciiPass {\n readonly renderTarget: RenderTarget\n readonly pointer: AsciiPointer\n\n private readonly rendererRef: WebGPURenderer\n private readonly profile: AsciiProfile\n private matchOpts: StreamMatchOptions\n private fit: FitMode | undefined\n private clearColor: readonly [number, number, number, number] | undefined\n private interaction: InteractionOptions | null\n private pointerX = 0.5\n private pointerY = 0.5\n private velX = 0\n private velY = 0\n private readonly t0 = performance.now()\n private readonly drawSize = new Vector2()\n\n private engine?: AsciiEngine\n private stream?: AsciiStream\n private device?: GPUDevice\n private disposed = false\n\n constructor(options: AsciiPassOptions) {\n const { profile, renderer, width, height, fit, clearColor, interaction, ...match } = options\n this.profile = profile\n this.rendererRef = renderer\n this.matchOpts = match\n this.fit = fit\n this.clearColor = clearColor\n this.interaction = interaction ?? null\n const size = renderer.getDrawingBufferSize(this.drawSize)\n this.renderTarget = new RenderTarget(\n width ?? Math.max(1, size.x),\n height ?? Math.max(1, size.y),\n )\n this.pointer = {\n set: (x: number, y: number) => {\n this.pointerX = x\n this.pointerY = y\n },\n setVelocity: (x: number, y: number) => {\n this.velX = x\n this.velY = y\n },\n }\n }\n\n /** Compile pipelines on the renderer's device. Call once after renderer.init(). */\n async init(): Promise<void> {\n if (this.disposed) throw new Error('AsciiPass.init() called after dispose().')\n if (this.stream) return\n const device = getDevice(this.rendererRef)\n const engine = await AsciiEngine.create(device, this.profile)\n if (this.disposed) {\n engine.destroy()\n return\n }\n try {\n const stream = await engine.createStream(navigator.gpu.getPreferredCanvasFormat())\n if (this.disposed) {\n stream.destroy()\n engine.destroy()\n return\n }\n this.device = device\n this.engine = engine\n this.stream = stream\n } catch (error) {\n engine.destroy()\n throw error\n }\n }\n\n /** Update matcher/composite options (spec §2: `ascii.set({...})`). */\n set(\n options: Partial<\n StreamMatchOptions & { fit: FitMode; clearColor: readonly [number, number, number, number] }\n >,\n ): void {\n const { fit, clearColor, ...match } = options\n if (fit !== undefined) this.fit = fit\n if (clearColor !== undefined) this.clearColor = clearColor\n this.matchOpts = { ...this.matchOpts, ...match }\n }\n\n setInteraction(interaction: InteractionOptions | null): void {\n this.interaction = interaction\n }\n\n setSize(width: number, height: number): void {\n this.renderTarget.setSize(width, height)\n }\n\n grid(): { columns: number; rows: number } | null {\n return this.stream?.grid() ?? null\n }\n\n /** Render the scene through the ASCII pipeline to the canvas. */\n render(scene: Object3D, camera: Camera): void {\n if (this.disposed) return\n const stream = this.stream\n if (!stream || !this.device) {\n throw new Error(\n 'AsciiPass.render() called before init() — `await pass.init()` after creating the pass.',\n )\n }\n const renderer = this.rendererRef\n\n const prev = renderer.getRenderTarget()\n renderer.setRenderTarget(this.renderTarget)\n renderer.render(scene, camera)\n renderer.setRenderTarget(prev)\n\n const srcTexture = getGpuTexture(renderer, this.renderTarget.texture)\n stream.configure(srcTexture, this.renderTarget.width, this.renderTarget.height, {\n srgbEncode: true,\n alpha: 'ignore',\n ...this.matchOpts,\n })\n\n const cenc = this.device.createCommandEncoder()\n stream.encodeMatch(cenc)\n this.device.queue.submit([cenc.finish()])\n\n const size = renderer.getDrawingBufferSize(this.drawSize)\n stream.syncView({ width: size.x, height: size.y, fit: this.fit, clearColor: this.clearColor })\n stream.syncFx(\n {\n interaction: this.interaction,\n pointerX: this.pointerX * size.x,\n pointerY: this.pointerY * size.y,\n velX: this.velX,\n velY: this.velY,\n time: (performance.now() - this.t0) / 1000,\n },\n size.x,\n size.y,\n )\n const enc = this.device.createCommandEncoder()\n stream.encodeComposite(enc, getCanvasContext(renderer).getCurrentTexture().createView())\n this.device.queue.submit([enc.finish()])\n }\n\n /** Explicit readback of the matched frame (spec §33). */\n async captureFrame(): Promise<AsciiFrame> {\n if (!this.stream)\n throw new Error('AsciiPass.captureFrame() requires init() and at least one render().')\n return this.stream.captureFrame()\n }\n\n dispose(): void {\n if (this.disposed) return\n this.disposed = true\n this.renderTarget.dispose()\n this.stream?.destroy()\n this.engine?.destroy() // engine resources only — the device belongs to Three\n }\n}\n","// Access to WebGPURenderer backend internals. Three does not yet expose the\n// GPUDevice / canvas context / texture handles publicly; these accessors are\n// the supported-in-practice interop points, verified against r170–r185.\nimport type { Texture } from 'three'\nimport type { WebGPURenderer } from 'three/webgpu'\n\ninterface BackendLike {\n device?: GPUDevice\n context?: GPUCanvasContext\n get?: (object: unknown) => { texture?: GPUTexture } | undefined\n}\n\nconst backendOf = (renderer: WebGPURenderer): BackendLike | undefined =>\n (renderer as unknown as { backend?: BackendLike }).backend\n\nexport function getDevice(renderer: WebGPURenderer): GPUDevice {\n const device = backendOf(renderer)?.device\n if (!device) {\n throw new Error(\n 'AsciiPass requires an initialized THREE.WebGPURenderer — `await renderer.init()` first. ' +\n 'WebGL renderers are unsupported: exact matching would require per-frame GPU→CPU readback (spec §30).',\n )\n }\n return device\n}\n\nexport function getCanvasContext(renderer: WebGPURenderer): GPUCanvasContext {\n const context = backendOf(renderer)?.context\n if (!context) {\n throw new Error(\n 'Could not access the WebGPU canvas context via renderer.backend (supported: three r170–r185).',\n )\n }\n return context\n}\n\nexport function getGpuTexture(renderer: WebGPURenderer, texture: Texture): GPUTexture {\n const data = backendOf(renderer)?.get?.(texture)\n const gpuTexture = data?.texture\n if (!gpuTexture) {\n throw new Error(\n 'Could not access the render target GPU texture via renderer.backend — render to the target once first ' +\n '(supported: three r170–r185).',\n )\n }\n return gpuTexture\n}\n","import {\n DataTexture,\n InstancedBufferAttribute,\n InstancedMesh,\n LinearFilter,\n LinearMipmapLinearFilter,\n Matrix4,\n PlaneGeometry,\n RedFormat,\n UnsignedByteType,\n} from 'three'\nimport { MeshBasicNodeMaterial } from 'three/webgpu'\nimport { add, attribute, div, float, floor, mix, mod, mul, texture, uv, vec2 } from 'three/tsl'\nimport type { AsciiFrame, AsciiProfile } from '@ascii-fx/core'\nimport { FLAG_TRANSPARENT, blankGlyphId, unpackB, unpackG, unpackR } from '@ascii-fx/core'\n\nexport interface AsciiGlyphsOptions {\n profile: AsciiProfile\n columns: number\n rows: number\n /** World-space cell height. Default 1. */\n cellSize?: number\n}\n\n/**\n * Instanced 3D glyph renderer (spec §8 'instances', §30): one plane instance\n * per cell, glyph/colors as instanced attributes, atlas sampled via TSL.\n * Instance transforms live in the standard instanceMatrix so effects can\n * animate them (GPU-side via node materials, or CPU-side via setMatrixAt).\n *\n * v1 data path: populate from a captured AsciiFrame (`updateFromFrame`).\n * A zero-readback bridge from the GPU cell buffer is a planned optimization.\n */\nexport class AsciiGlyphs {\n readonly mesh: InstancedMesh\n readonly material: MeshBasicNodeMaterial\n readonly columns: number\n readonly rows: number\n\n private readonly aGlyph: InstancedBufferAttribute\n private readonly aFg: InstancedBufferAttribute\n private readonly aBg: InstancedBufferAttribute\n private readonly aVisible: InstancedBufferAttribute\n private readonly aUseBackground: InstancedBufferAttribute\n private readonly atlasTexture: DataTexture\n private readonly profileFingerprint: string\n private readonly glyphCount: number\n private readonly blankGlyph: number\n\n constructor(options: AsciiGlyphsOptions) {\n const { profile, columns, rows } = options\n const cellSize = options.cellSize ?? 1\n this.columns = columns\n this.rows = rows\n this.profileFingerprint = profile.fingerprint\n this.glyphCount = profile.glyphCount\n this.blankGlyph = blankGlyphId(profile)\n const { atlas } = profile\n const aspect = atlas.cellWidth / atlas.cellHeight\n const count = columns * rows\n\n const geometry = new PlaneGeometry(cellSize * aspect, cellSize)\n this.aGlyph = new InstancedBufferAttribute(new Float32Array(count), 1)\n this.aFg = new InstancedBufferAttribute(new Float32Array(count * 3).fill(1), 3)\n this.aBg = new InstancedBufferAttribute(new Float32Array(count * 3), 3)\n this.aVisible = new InstancedBufferAttribute(new Float32Array(count).fill(1), 1)\n this.aUseBackground = new InstancedBufferAttribute(new Float32Array(count).fill(1), 1)\n geometry.setAttribute('aGlyph', this.aGlyph)\n geometry.setAttribute('aFg', this.aFg)\n geometry.setAttribute('aBg', this.aBg)\n geometry.setAttribute('aVisible', this.aVisible)\n geometry.setAttribute('aUseBackground', this.aUseBackground)\n\n this.atlasTexture = new DataTexture(\n atlas.data as Uint8Array<ArrayBuffer>,\n atlas.width,\n atlas.height,\n RedFormat,\n UnsignedByteType,\n )\n this.atlasTexture.flipY = false\n this.atlasTexture.magFilter = LinearFilter\n this.atlasTexture.minFilter = LinearMipmapLinearFilter\n this.atlasTexture.generateMipmaps = true\n this.atlasTexture.needsUpdate = true\n\n this.material = new MeshBasicNodeMaterial()\n // @types/three cannot yet type composed TSL node graphs; the runtime API\n // is stable, so the graph is built through a single contained cast.\n /* eslint-disable @typescript-eslint/no-explicit-any */\n const n = {\n add,\n attribute,\n div,\n float,\n floor,\n mix,\n mod,\n mul,\n texture,\n uv,\n vec2,\n } as unknown as Record<\n | 'add'\n | 'attribute'\n | 'div'\n | 'float'\n | 'floor'\n | 'mix'\n | 'mod'\n | 'mul'\n | 'texture'\n | 'uv'\n | 'vec2',\n (...args: any[]) => any\n >\n /* eslint-enable @typescript-eslint/no-explicit-any */\n const id = n.attribute('aGlyph')\n const col = n.mod(id, n.float(atlas.columns))\n const row = n.floor(n.div(id, n.float(atlas.columns)))\n const tile = n.vec2(\n n.add(n.mul(col, n.float(atlas.pitchWidth)), n.float(atlas.padding)),\n n.add(n.mul(row, n.float(atlas.pitchHeight)), n.float(atlas.padding)),\n )\n // PlaneGeometry uv has v=0 at the bottom; the atlas is y-down: flip v.\n const guv = n.add(n.mul(n.uv(), n.vec2(1, -1)), n.vec2(0, 1))\n const texel = n.add(tile, n.mul(guv, n.vec2(atlas.cellWidth, atlas.cellHeight)))\n const auv = n.div(texel, n.vec2(atlas.width, atlas.height))\n const alpha = n.texture(this.atlasTexture, auv).r\n const foreground = n.attribute('aFg')\n const useBackground = n.attribute('aUseBackground')\n const cellColor = n.mix(n.attribute('aBg'), foreground, alpha)\n this.material.colorNode = n.mix(foreground, cellColor, useBackground)\n this.material.opacityNode = n.mul(\n n.attribute('aVisible'),\n n.mix(alpha, n.float(1), useBackground),\n )\n this.material.transparent = true\n this.material.depthWrite = false\n\n this.mesh = new InstancedMesh(geometry, this.material, count)\n this.mesh.frustumCulled = false\n const m = new Matrix4()\n const cw = cellSize * aspect\n for (let cy = 0; cy < rows; cy++) {\n for (let cx = 0; cx < columns; cx++) {\n m.makeTranslation((cx - (columns - 1) / 2) * cw, ((rows - 1) / 2 - cy) * cellSize, 0)\n this.mesh.setMatrixAt(cy * columns + cx, m)\n }\n }\n this.mesh.instanceMatrix.needsUpdate = true\n }\n\n /** Load glyph ids and colors from a matched frame (same grid dimensions). */\n updateFromFrame(frame: AsciiFrame): void {\n if (frame.profile.fingerprint !== this.profileFingerprint) {\n throw new Error(\n `Frame profile \"${frame.profile.id}\" (${frame.profile.fingerprint.slice(0, 12)}…) does not match ` +\n `AsciiGlyphs profile (${this.profileFingerprint.slice(0, 12)}…).`,\n )\n }\n if (frame.columns !== this.columns || frame.rows !== this.rows) {\n throw new Error(\n `Frame grid ${frame.columns}×${frame.rows} does not match AsciiGlyphs grid ${this.columns}×${this.rows}.`,\n )\n }\n const n = this.columns * this.rows\n const g = this.aGlyph.array as Float32Array\n const fg = this.aFg.array as Float32Array\n const bg = this.aBg.array as Float32Array\n const visible = this.aVisible.array as Float32Array\n const useBackground = this.aUseBackground.array as Float32Array\n for (let i = 0; i < n; i++) {\n const transparent = (frame.flags[i] & FLAG_TRANSPARENT) !== 0\n const glyphId = frame.glyphIds[i]\n if (glyphId >= this.glyphCount) {\n throw new Error(\n `Frame cell ${i} references glyph ${glyphId}, but the profile has ${this.glyphCount} glyphs.`,\n )\n }\n g[i] = transparent ? this.blankGlyph : glyphId\n visible[i] = transparent ? 0 : 1\n useBackground[i] = frame.colorMode === 'foreground' ? 0 : 1\n const fgc = frame.foreground?.[i]\n const bgc = frame.background?.[i]\n fg[i * 3] = fgc !== undefined ? unpackR(fgc) / 255 : 1\n fg[i * 3 + 1] = fgc !== undefined ? unpackG(fgc) / 255 : 1\n fg[i * 3 + 2] = fgc !== undefined ? unpackB(fgc) / 255 : 1\n bg[i * 3] = bgc !== undefined ? unpackR(bgc) / 255 : 0\n bg[i * 3 + 1] = bgc !== undefined ? unpackG(bgc) / 255 : 0\n bg[i * 3 + 2] = bgc !== undefined ? unpackB(bgc) / 255 : 0\n }\n this.aGlyph.needsUpdate = true\n this.aFg.needsUpdate = true\n this.aBg.needsUpdate = true\n this.aVisible.needsUpdate = true\n this.aUseBackground.needsUpdate = true\n }\n\n dispose(): void {\n // The mesh's own dispose releases its instanced attributes (instanceMatrix et al.);\n // without it their GPU buffers wait on backend WeakMap GC.\n this.mes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,MAAM;AACrD,SAAG,IAAI,IAAI,CAAC,IAAI,QAAQ,SAAY,QAAQ,GAAG,IAAI,MAAM;AACzD,SAAG,IAAI,IAAI,CAAC,IAAI,QAAQ,SAAY,QAAQ,GAAG,IAAI,MAAM;AACzD,SAAG,IAAI,CAAC,IAAI,QAAQ,SAAY,QAAQ,GAAG,IAAI,MAAM;AACrD,SAAG,IAAI,IAAI,CAAC,IAAI,QAAQ,SAAY,QAAQ,GAAG,IAAI,MAAM;AACzD,SAAG,IAAI,IAAI,CAAC,IAAI,QAAQ,SAAY,QAAQ,GAAG,IAAI,MAAM;AAAA,IAC3D;AACA,SAAK,OAAO,cAAc;AAC1B,SAAK,IAAI,cAAc;AACvB,SAAK,IAAI,cAAc;AACvB,SAAK,SAAS,cAAc;AAC5B,SAAK,eAAe,cAAc;AAAA,EACpC;AAAA,EAEA,UAAgB;AAGd,SAAK,KAAK,QAAQ;AAClB,SAAK,KAAK,SAAS,QAAQ;AAC3B,SAAK,SAAS,QAAQ;AACtB,SAAK,aAAa,QAAQ;AAAA,EAC5B;AACF;","names":["texture"]}
|
|
1
|
+
{"version":3,"sources":["../src/asciiPass.ts","../src/internals.ts","../src/asciiGlyphs.ts"],"sourcesContent":["import { RenderTarget, Vector2 } from 'three'\nimport type { Camera, Object3D } from 'three'\nimport type { WebGPURenderer } from 'three/webgpu'\nimport type { AsciiFrame, AsciiProfile, PaletteOptions } from '@ascii-fx/core'\nimport { AsciiEngine, AsciiStream } from '@ascii-fx/gpu/webgpu'\nimport type {\n AsciiPointer,\n FitMode,\n InteractionOptions,\n PostOptions,\n StreamMatchOptions,\n} from '@ascii-fx/gpu'\nimport { getCanvasContext, getDevice, getGpuTexture } from './internals.js'\n\nexport interface AsciiPassOptions extends StreamMatchOptions {\n profile: AsciiProfile\n renderer: WebGPURenderer\n /** Render-target resolution; defaults to the renderer's drawing buffer size. */\n width?: number\n height?: number\n fit?: FitMode\n clearColor?: readonly [number, number, number, number]\n interaction?: InteractionOptions | null\n /** palette-v1 colour snap between matching and the composite; see AsciiRendererOptions. */\n palette?: PaletteOptions | null\n post?: PostOptions | null\n}\n\ntype ViewOptions = {\n fit: FitMode\n clearColor: readonly [number, number, number, number]\n palette: PaletteOptions | null\n post: PostOptions | null\n}\n\n/**\n * Fullscreen ASCII postprocessing for THREE.WebGPURenderer (spec §30):\n * scene → render target → exact structural-v1 compute on Three's own\n * GPUDevice → one-draw atlas composite straight to the canvas.\n *\n * The render target holds linear-light values, so the source is sRGB-encoded\n * before matching (§28). Usage:\n *\n * ```ts\n * const pass = new AsciiPass({ profile, renderer, columns: 160 })\n * await pass.init()\n * pass.render(scene, camera) // instead of renderer.render(...)\n * ```\n */\nexport class AsciiPass {\n readonly renderTarget: RenderTarget\n readonly pointer: AsciiPointer\n\n private readonly rendererRef: WebGPURenderer\n private readonly profile: AsciiProfile\n private matchOpts: StreamMatchOptions\n private fit: FitMode | undefined\n private clearColor: readonly [number, number, number, number] | undefined\n private palette: PaletteOptions | null\n private post: PostOptions | null\n private interaction: InteractionOptions | null\n private pointerX = 0.5\n private pointerY = 0.5\n private velX = 0\n private velY = 0\n private readonly t0 = performance.now()\n private readonly drawSize = new Vector2()\n\n private engine?: AsciiEngine\n private stream?: AsciiStream\n private device?: GPUDevice\n private disposed = false\n\n constructor(options: AsciiPassOptions) {\n const {\n profile,\n renderer,\n width,\n height,\n fit,\n clearColor,\n interaction,\n palette,\n post,\n ...match\n } = options\n this.profile = profile\n this.rendererRef = renderer\n this.matchOpts = match\n this.fit = fit\n this.clearColor = clearColor\n this.palette = palette ?? null\n this.post = post ?? null\n this.interaction = interaction ?? null\n const size = renderer.getDrawingBufferSize(this.drawSize)\n this.renderTarget = new RenderTarget(\n width ?? Math.max(1, size.x),\n height ?? Math.max(1, size.y),\n )\n this.pointer = {\n set: (x: number, y: number) => {\n this.pointerX = x\n this.pointerY = y\n },\n setVelocity: (x: number, y: number) => {\n this.velX = x\n this.velY = y\n },\n }\n }\n\n /** Compile pipelines on the renderer's device. Call once after renderer.init(). */\n async init(): Promise<void> {\n if (this.disposed) throw new Error('AsciiPass.init() called after dispose().')\n if (this.stream) return\n const device = getDevice(this.rendererRef)\n const engine = await AsciiEngine.create(device, this.profile)\n if (this.disposed) {\n engine.destroy()\n return\n }\n try {\n const stream = await engine.createStream(navigator.gpu.getPreferredCanvasFormat())\n if (this.disposed) {\n stream.destroy()\n engine.destroy()\n return\n }\n this.device = device\n this.engine = engine\n this.stream = stream\n } catch (error) {\n engine.destroy()\n throw error\n }\n }\n\n /** Update matcher/composite options (spec §2: `ascii.set({...})`). */\n set(options: Partial<StreamMatchOptions & ViewOptions>): void {\n const { fit, clearColor, palette, post, ...match } = options\n if (fit !== undefined) this.fit = fit\n if (clearColor !== undefined) this.clearColor = clearColor\n if (palette !== undefined) this.palette = palette\n if (post !== undefined) this.post = post\n this.matchOpts = { ...this.matchOpts, ...match }\n }\n\n setInteraction(interaction: InteractionOptions | null): void {\n this.interaction = interaction\n }\n\n setSize(width: number, height: number): void {\n this.renderTarget.setSize(width, height)\n }\n\n grid(): { columns: number; rows: number } | null {\n return this.stream?.grid() ?? null\n }\n\n /** Render the scene through the ASCII pipeline to the canvas. */\n render(scene: Object3D, camera: Camera): void {\n if (this.disposed) return\n const stream = this.stream\n if (!stream || !this.device) {\n throw new Error(\n 'AsciiPass.render() called before init() — `await pass.init()` after creating the pass.',\n )\n }\n const renderer = this.rendererRef\n\n const prev = renderer.getRenderTarget()\n renderer.setRenderTarget(this.renderTarget)\n renderer.render(scene, camera)\n renderer.setRenderTarget(prev)\n\n const srcTexture = getGpuTexture(renderer, this.renderTarget.texture)\n stream.configure(srcTexture, this.renderTarget.width, this.renderTarget.height, {\n srgbEncode: true,\n alpha: 'ignore',\n ...this.matchOpts,\n })\n\n const cenc = this.device.createCommandEncoder()\n stream.encodeMatch(cenc)\n this.device.queue.submit([cenc.finish()])\n\n const size = renderer.getDrawingBufferSize(this.drawSize)\n stream.syncView({\n width: size.x,\n height: size.y,\n fit: this.fit,\n clearColor: this.clearColor,\n palette: this.palette,\n post: this.post,\n })\n stream.syncFx(\n {\n interaction: this.interaction,\n pointerX: this.pointerX * size.x,\n pointerY: this.pointerY * size.y,\n velX: this.velX,\n velY: this.velY,\n time: (performance.now() - this.t0) / 1000,\n },\n size.x,\n size.y,\n )\n const enc = this.device.createCommandEncoder()\n stream.encodeComposite(enc, getCanvasContext(renderer).getCurrentTexture().createView())\n this.device.queue.submit([enc.finish()])\n }\n\n /** Explicit readback of the matched frame (spec §33). */\n async captureFrame(): Promise<AsciiFrame> {\n if (!this.stream)\n throw new Error('AsciiPass.captureFrame() requires init() and at least one render().')\n return this.stream.captureFrame()\n }\n\n dispose(): void {\n if (this.disposed) return\n this.disposed = true\n this.renderTarget.dispose()\n this.stream?.destroy()\n this.engine?.destroy() // engine resources only — the device belongs to Three\n }\n}\n","// Access to WebGPURenderer backend internals. Three does not yet expose the\n// GPUDevice / canvas context / texture handles publicly; these accessors are\n// the supported-in-practice interop points, verified against r170–r185.\nimport type { Texture } from 'three'\nimport type { WebGPURenderer } from 'three/webgpu'\n\ninterface BackendLike {\n device?: GPUDevice\n context?: GPUCanvasContext\n get?: (object: unknown) => { texture?: GPUTexture } | undefined\n}\n\nconst backendOf = (renderer: WebGPURenderer): BackendLike | undefined =>\n (renderer as unknown as { backend?: BackendLike }).backend\n\nexport function getDevice(renderer: WebGPURenderer): GPUDevice {\n const device = backendOf(renderer)?.device\n if (!device) {\n throw new Error(\n 'AsciiPass requires an initialized THREE.WebGPURenderer — `await renderer.init()` first. ' +\n 'WebGL renderers are unsupported: exact matching would require per-frame GPU→CPU readback (spec §30).',\n )\n }\n return device\n}\n\nexport function getCanvasContext(renderer: WebGPURenderer): GPUCanvasContext {\n const context = backendOf(renderer)?.context\n if (!context) {\n throw new Error(\n 'Could not access the WebGPU canvas context via renderer.backend (supported: three r170–r185).',\n )\n }\n return context\n}\n\nexport function getGpuTexture(renderer: WebGPURenderer, texture: Texture): GPUTexture {\n const data = backendOf(renderer)?.get?.(texture)\n const gpuTexture = data?.texture\n if (!gpuTexture) {\n throw new Error(\n 'Could not access the render target GPU texture via renderer.backend — render to the target once first ' +\n '(supported: three r170–r185).',\n )\n }\n return gpuTexture\n}\n","import {\n DataTexture,\n InstancedBufferAttribute,\n InstancedMesh,\n LinearFilter,\n LinearMipmapLinearFilter,\n Matrix4,\n PlaneGeometry,\n RedFormat,\n UnsignedByteType,\n} from 'three'\nimport { MeshBasicNodeMaterial } from 'three/webgpu'\nimport { add, attribute, div, float, floor, mix, mod, mul, texture, uv, vec2 } from 'three/tsl'\nimport type { AsciiFrame, AsciiProfile } from '@ascii-fx/core'\nimport { FLAG_TRANSPARENT, blankGlyphId, unpackB, unpackG, unpackR } from '@ascii-fx/core'\n\nexport interface AsciiGlyphsOptions {\n profile: AsciiProfile\n columns: number\n rows: number\n /** World-space cell height. Default 1. */\n cellSize?: number\n}\n\n/**\n * Instanced 3D glyph renderer (spec §8 'instances', §30): one plane instance\n * per cell, glyph/colors as instanced attributes, atlas sampled via TSL.\n * Instance transforms live in the standard instanceMatrix so effects can\n * animate them (GPU-side via node materials, or CPU-side via setMatrixAt).\n *\n * v1 data path: populate from a captured AsciiFrame (`updateFromFrame`).\n * A zero-readback bridge from the GPU cell buffer is a planned optimization.\n */\nexport class AsciiGlyphs {\n readonly mesh: InstancedMesh\n readonly material: MeshBasicNodeMaterial\n readonly columns: number\n readonly rows: number\n\n private readonly aGlyph: InstancedBufferAttribute\n private readonly aFg: InstancedBufferAttribute\n private readonly aBg: InstancedBufferAttribute\n private readonly aVisible: InstancedBufferAttribute\n private readonly aUseBackground: InstancedBufferAttribute\n private readonly atlasTexture: DataTexture\n private readonly profileFingerprint: string\n private readonly glyphCount: number\n private readonly blankGlyph: number\n\n constructor(options: AsciiGlyphsOptions) {\n const { profile, columns, rows } = options\n const cellSize = options.cellSize ?? 1\n this.columns = columns\n this.rows = rows\n this.profileFingerprint = profile.fingerprint\n this.glyphCount = profile.glyphCount\n this.blankGlyph = blankGlyphId(profile)\n const { atlas } = profile\n const aspect = atlas.cellWidth / atlas.cellHeight\n const count = columns * rows\n\n const geometry = new PlaneGeometry(cellSize * aspect, cellSize)\n this.aGlyph = new InstancedBufferAttribute(new Float32Array(count), 1)\n this.aFg = new InstancedBufferAttribute(new Float32Array(count * 3).fill(1), 3)\n this.aBg = new InstancedBufferAttribute(new Float32Array(count * 3), 3)\n this.aVisible = new InstancedBufferAttribute(new Float32Array(count).fill(1), 1)\n this.aUseBackground = new InstancedBufferAttribute(new Float32Array(count).fill(1), 1)\n geometry.setAttribute('aGlyph', this.aGlyph)\n geometry.setAttribute('aFg', this.aFg)\n geometry.setAttribute('aBg', this.aBg)\n geometry.setAttribute('aVisible', this.aVisible)\n geometry.setAttribute('aUseBackground', this.aUseBackground)\n\n this.atlasTexture = new DataTexture(\n atlas.data as Uint8Array<ArrayBuffer>,\n atlas.width,\n atlas.height,\n RedFormat,\n UnsignedByteType,\n )\n this.atlasTexture.flipY = false\n this.atlasTexture.magFilter = LinearFilter\n this.atlasTexture.minFilter = LinearMipmapLinearFilter\n this.atlasTexture.generateMipmaps = true\n this.atlasTexture.needsUpdate = true\n\n this.material = new MeshBasicNodeMaterial()\n // @types/three cannot yet type composed TSL node graphs; the runtime API\n // is stable, so the graph is built through a single contained cast.\n /* eslint-disable @typescript-eslint/no-explicit-any */\n const n = {\n add,\n attribute,\n div,\n float,\n floor,\n mix,\n mod,\n mul,\n texture,\n uv,\n vec2,\n } as unknown as Record<\n | 'add'\n | 'attribute'\n | 'div'\n | 'float'\n | 'floor'\n | 'mix'\n | 'mod'\n | 'mul'\n | 'texture'\n | 'uv'\n | 'vec2',\n (...args: any[]) => any\n >\n /* eslint-enable @typescript-eslint/no-explicit-any */\n const id = n.attribute('aGlyph')\n const col = n.mod(id, n.float(atlas.columns))\n const row = n.floor(n.div(id, n.float(atlas.columns)))\n const tile = n.vec2(\n n.add(n.mul(col, n.float(atlas.pitchWidth)), n.float(atlas.padding)),\n n.add(n.mul(row, n.float(atlas.pitchHeight)), n.float(atlas.padding)),\n )\n // PlaneGeometry uv has v=0 at the bottom; the atlas is y-down: flip v.\n const guv = n.add(n.mul(n.uv(), n.vec2(1, -1)), n.vec2(0, 1))\n const texel = n.add(tile, n.mul(guv, n.vec2(atlas.cellWidth, atlas.cellHeight)))\n const auv = n.div(texel, n.vec2(atlas.width, atlas.height))\n const alpha = n.texture(this.atlasTexture, auv).r\n const foreground = n.attribute('aFg')\n const useBackground = n.attribute('aUseBackground')\n const cellColor = n.mix(n.attribute('aBg'), foreground, alpha)\n this.material.colorNode = n.mix(foreground, cellColor, useBackground)\n this.material.opacityNode = n.mul(\n n.attribute('aVisible'),\n n.mix(alpha, n.float(1), useBackground),\n )\n this.material.transparent = true\n this.material.depthWrite = false\n\n this.mesh = new InstancedMesh(geometry, this.material, count)\n this.mesh.frustumCulled = false\n const m = new Matrix4()\n const cw = cellSize * aspect\n for (let cy = 0; cy < rows; cy++) {\n for (let cx = 0; cx < columns; cx++) {\n m.makeTranslation((cx - (columns - 1) / 2) * cw, ((rows - 1) / 2 - cy) * cellSize, 0)\n this.mesh.setMatrixAt(cy * columns + cx, m)\n }\n }\n this.mesh.instanceMatrix.needsUpdate = true\n }\n\n /** Load glyph ids and colors from a matched frame (same grid dimensions). */\n updateFromFrame(frame: AsciiFrame): void {\n if (frame.profile.fingerprint !== this.profileFingerprint) {\n throw new Error(\n `Frame profile \"${frame.profile.id}\" (${frame.profile.fingerprint.slice(0, 12)}…) does not match ` +\n `AsciiGlyphs profile (${this.profileFingerprint.slice(0, 12)}…).`,\n )\n }\n if (frame.columns !== this.columns || frame.rows !== this.rows) {\n throw new Error(\n `Frame grid ${frame.columns}×${frame.rows} does not match AsciiGlyphs grid ${this.columns}×${this.rows}.`,\n )\n }\n const n = this.columns * this.rows\n const g = this.aGlyph.array as Float32Array\n const fg = this.aFg.array as Float32Array\n const bg = this.aBg.array as Float32Array\n const visible = this.aVisible.array as Float32Array\n const useBackground = this.aUseBackground.array as Float32Array\n for (let i = 0; i < n; i++) {\n const transparent = (frame.flags[i] & FLAG_TRANSPARENT) !== 0\n const glyphId = frame.glyphIds[i]\n if (glyphId >= this.glyphCount) {\n throw new Error(\n `Frame cell ${i} references glyph ${glyphId}, but the profile has ${this.glyphCount} glyphs.`,\n )\n }\n g[i] = transparent ? this.blankGlyph : glyphId\n visible[i] = transparent ? 0 : 1\n useBackground[i] = frame.colorMode === 'foreground' ? 0 : 1\n const fgc = frame.foreground?.[i]\n const bgc = frame.background?.[i]\n fg[i * 3] = fgc !== undefined ? unpackR(fgc) / 255 : 1\n fg[i * 3 + 1] = fgc !== undefined ? unpackG(fgc) / 255 : 1\n fg[i * 3 + 2] = fgc !== undefined ? unpackB(fgc) / 255 : 1\n bg[i * 3] = bgc !== undefined ? unpackR(bgc) / 255 : 0\n bg[i * 3 + 1] = bgc !== undefined ? unpackG(bgc) / 255 : 0\n bg[i * 3 + 2] = bgc !== undefined ? unpackB(bgc) / 255 : 0\n }\n this.aGlyph.needsUpdate = true\n this.aFg.needsUpdate = true\n this.aBg.needsUpdate = true\n this.aVisible.needsUpdate = true\n this.aUseBackground.needsUpdate = true\n }\n\n dispose(): void {\n // The mesh's own dispose releases its instanced attributes (instanceMatrix et al.);\n // without it their GPU buffers wait on backend WeakMap GC.\n this.mesh.dispose()\n this.mesh.geometry.dispose()\n this.material.dispose()\n this.atlasTexture.dispose()\n }\n}\n"],"mappings":";AAAA,SAAS,cAAc,eAAe;AAItC,SAAS,mBAAgC;;;ACQzC,IAAM,YAAY,CAAC,aAChB,SAAkD;AAE9C,SAAS,UAAU,UAAqC;AAC7D,QAAM,SAAS,UAAU,QAAQ,GAAG;AACpC,MAAI,CAAC,QAAQ;AACX,UAAM,IAAI;AAAA,MACR;AAAA,IAEF;AAAA,EACF;AACA,SAAO;AACT;AAEO,SAAS,iBAAiB,UAA4C;AAC3E,QAAM,UAAU,UAAU,QAAQ,GAAG;AACrC,MAAI,CAAC,SAAS;AACZ,UAAM,IA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AAY,QAAQ,GAAG,IAAI,MAAM;AACzD,SAAG,IAAI,CAAC,IAAI,QAAQ,SAAY,QAAQ,GAAG,IAAI,MAAM;AACrD,SAAG,IAAI,IAAI,CAAC,IAAI,QAAQ,SAAY,QAAQ,GAAG,IAAI,MAAM;AACzD,SAAG,IAAI,IAAI,CAAC,IAAI,QAAQ,SAAY,QAAQ,GAAG,IAAI,MAAM;AAAA,IAC3D;AACA,SAAK,OAAO,cAAc;AAC1B,SAAK,IAAI,cAAc;AACvB,SAAK,IAAI,cAAc;AACvB,SAAK,SAAS,cAAc;AAC5B,SAAK,eAAe,cAAc;AAAA,EACpC;AAAA,EAEA,UAAgB;AAGd,SAAK,KAAK,QAAQ;AAClB,SAAK,KAAK,SAAS,QAAQ;AAC3B,SAAK,SAAS,QAAQ;AACtB,SAAK,aAAa,QAAQ;AAAA,EAC5B;AACF;","names":["texture"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ascii-fx/three",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Three.js adapter for ASCII FX: AsciiPass postprocessing for WebGPURenderer and an instanced AsciiGlyphs renderer.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ascii",
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@ascii-fx/core": "0.
|
|
41
|
-
"@ascii-fx/gpu": "0.
|
|
40
|
+
"@ascii-fx/core": "0.9.0",
|
|
41
|
+
"@ascii-fx/gpu": "0.9.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@types/three": "0.
|
|
45
|
-
"@webgpu/types": "^0.1.
|
|
46
|
-
"three": "0.
|
|
44
|
+
"@types/three": "0.186.0",
|
|
45
|
+
"@webgpu/types": "^0.1.74",
|
|
46
|
+
"three": "0.186.1",
|
|
47
47
|
"tsup": "^8.5.1",
|
|
48
48
|
"typescript": "^7.0.2"
|
|
49
49
|
},
|