pixi-effects 0.48.2 → 0.50.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.
Files changed (88) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +53 -8
  3. package/ai/chat-template.html +8 -4
  4. package/ai/tools/check.mjs +6 -6
  5. package/dist/3d.cjs +967 -0
  6. package/dist/3d.cjs.map +1 -0
  7. package/dist/3d.d.cts +305 -0
  8. package/dist/3d.d.ts +305 -0
  9. package/dist/3d.js +960 -0
  10. package/dist/3d.js.map +1 -0
  11. package/dist/Canvas-BfZkAFJm.d.cts +12 -0
  12. package/dist/Canvas-BfZkAFJm.d.ts +12 -0
  13. package/dist/Composition-47U5U637.cjs +16 -0
  14. package/dist/{Composition-TJ5D7Z63.cjs.map → Composition-47U5U637.cjs.map} +1 -1
  15. package/dist/Composition-GVWWLFDL.js +7 -0
  16. package/dist/{Composition-5FKV2IBP.js.map → Composition-GVWWLFDL.js.map} +1 -1
  17. package/dist/Controller.d.cts +2 -2
  18. package/dist/Controller.d.ts +2 -2
  19. package/dist/{Movie-svZQF-9Z.d.cts → Movie-DogzDBuW.d.cts} +36 -5
  20. package/dist/{Movie--qSYKgAQ.d.ts → Movie-Y7iHg2V8.d.ts} +36 -5
  21. package/dist/{Spans-6A3VLHRH.js → Spans-3SEZSTQV.js} +6 -6
  22. package/dist/{Spans-6A3VLHRH.js.map → Spans-3SEZSTQV.js.map} +1 -1
  23. package/dist/{Spans-5ENZ3XGS.cjs → Spans-R426NVY3.cjs} +11 -11
  24. package/dist/{Spans-5ENZ3XGS.cjs.map → Spans-R426NVY3.cjs.map} +1 -1
  25. package/dist/{blendModes-V5XHC7U4.cjs → blendModes-2IDILRN6.cjs} +5 -5
  26. package/dist/{blendModes-V5XHC7U4.cjs.map → blendModes-2IDILRN6.cjs.map} +1 -1
  27. package/dist/{blendModes-535EMYGK.js → blendModes-4QH44GOL.js} +4 -4
  28. package/dist/{blendModes-535EMYGK.js.map → blendModes-4QH44GOL.js.map} +1 -1
  29. package/dist/{chunk-NGJXVJB7.cjs → chunk-3FCDRLW3.cjs} +5 -3
  30. package/dist/chunk-3FCDRLW3.cjs.map +1 -0
  31. package/dist/{chunk-JBDBICS2.js → chunk-C2HL5236.js} +4 -4
  32. package/dist/{chunk-JBDBICS2.js.map → chunk-C2HL5236.js.map} +1 -1
  33. package/dist/{chunk-WYR2AU4W.cjs → chunk-GXGIISFS.cjs} +5 -5
  34. package/dist/{chunk-WYR2AU4W.cjs.map → chunk-GXGIISFS.cjs.map} +1 -1
  35. package/dist/{chunk-BFRWSV3R.js → chunk-J4ZP76IL.js} +5 -4
  36. package/dist/chunk-J4ZP76IL.js.map +1 -0
  37. package/dist/{chunk-CCPJD76D.cjs → chunk-O2MD3L4J.cjs} +93 -93
  38. package/dist/chunk-O2MD3L4J.cjs.map +1 -0
  39. package/dist/{chunk-IVKI6CPH.js → chunk-SSVHAF3Q.js} +483 -20
  40. package/dist/chunk-SSVHAF3Q.js.map +1 -0
  41. package/dist/{chunk-6D4W2KZQ.js → chunk-TXNQLMRT.js} +6 -6
  42. package/dist/chunk-TXNQLMRT.js.map +1 -0
  43. package/dist/{chunk-RCKLUCB7.js → chunk-UTUUOQ47.js} +46 -20
  44. package/dist/chunk-UTUUOQ47.js.map +1 -0
  45. package/dist/{chunk-Z3DM4ETD.cjs → chunk-VVUSZVP7.cjs} +507 -42
  46. package/dist/chunk-VVUSZVP7.cjs.map +1 -0
  47. package/dist/{chunk-45ALIMAF.cjs → chunk-YOKRPAKA.cjs} +89 -63
  48. package/dist/chunk-YOKRPAKA.cjs.map +1 -0
  49. package/dist/index.cjs +35 -35
  50. package/dist/index.d.cts +3 -3
  51. package/dist/index.d.ts +3 -3
  52. package/dist/index.js +5 -5
  53. package/dist/loader.css +1 -1
  54. package/dist/{music-P4JRT73P.js → music-ATX22VAT.js} +3 -3
  55. package/dist/{music-P4JRT73P.js.map → music-ATX22VAT.js.map} +1 -1
  56. package/dist/{music-XQEPBIDT.cjs → music-OFVM3PYH.cjs} +3 -3
  57. package/dist/{music-XQEPBIDT.cjs.map → music-OFVM3PYH.cjs.map} +1 -1
  58. package/dist/present.cjs +5 -5
  59. package/dist/present.d.cts +2 -2
  60. package/dist/present.d.ts +2 -2
  61. package/dist/present.js +5 -5
  62. package/dist/three.cjs +13 -10
  63. package/dist/three.cjs.map +1 -1
  64. package/dist/three.d.cts +4 -12
  65. package/dist/three.d.ts +4 -12
  66. package/dist/three.js +8 -5
  67. package/dist/three.js.map +1 -1
  68. package/dist/{types-CTSrPvY3.d.cts → types-BZngm4nT.d.cts} +48 -5
  69. package/dist/{types-CTSrPvY3.d.ts → types-BZngm4nT.d.ts} +48 -5
  70. package/docs/api.md +45 -2
  71. package/docs/dsl.md +115 -1
  72. package/llms-full.txt +307 -6
  73. package/package.json +19 -3
  74. package/skills/pixi-effects/SKILL.md +4 -2
  75. package/skills/pixi-effects/reference/cheatsheet.md +4 -0
  76. package/skills/pixi-effects/reference/pitfalls.md +20 -0
  77. package/skills/pixi-effects/reference/recipes.md +119 -1
  78. package/skills/pixi-effects/template.html +14 -8
  79. package/dist/Composition-5FKV2IBP.js +0 -7
  80. package/dist/Composition-TJ5D7Z63.cjs +0 -16
  81. package/dist/chunk-45ALIMAF.cjs.map +0 -1
  82. package/dist/chunk-6D4W2KZQ.js.map +0 -1
  83. package/dist/chunk-BFRWSV3R.js.map +0 -1
  84. package/dist/chunk-CCPJD76D.cjs.map +0 -1
  85. package/dist/chunk-IVKI6CPH.js.map +0 -1
  86. package/dist/chunk-NGJXVJB7.cjs.map +0 -1
  87. package/dist/chunk-RCKLUCB7.js.map +0 -1
  88. package/dist/chunk-Z3DM4ETD.cjs.map +0 -1
package/dist/three.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/three/defaults.ts","../src/three/spaceBridge.ts","../src/three/budget.ts","../src/three/ThreeSequence.ts","../src/three/gltf.ts","../src/three/layerTexture.ts","../src/three/index.ts"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E;AAMO,SAAS,MAAM,IAAA,EAAuC;AAC3D,EAAA,OAAO,IAAA;AACT","file":"three.js","sourcesContent":["/** The page-level default renderer of the three layers: `registerThree({ renderer })` sets it, a layer's own `renderer` wins. */\nexport type ThreeRendererKind = 'webgl' | 'webgpu';\n\nlet pageRenderer: ThreeRendererKind = 'webgl';\n\nexport function checkRendererKind(kind: unknown, where: string): asserts kind is ThreeRendererKind {\n if (kind !== 'webgl' && kind !== 'webgpu') throw new Error(`pixi-effects: ${where} must be 'webgl' or 'webgpu' (got ${JSON.stringify(kind)})`);\n}\nexport function setPageRenderer(kind: ThreeRendererKind): void { pageRenderer = kind; }\nexport function getPageRenderer(): ThreeRendererKind { return pageRenderer; }\n","/**\n * What lets a `three` layer live in the composition's space (`followCamera`, `followLights`): the composition's camera and lights, in three.\n *\n * The scene is in composition pixels with y flipped: a point the composition calls (x, y, z) is `new Vector3(x, -y, z)` here (the composition's y runs down, three's up;\n * +z is toward the viewer in both). A three camera with the composition camera's position, look-at point and vertical fov then projects that point to the pixel the\n * composition's own projection gives it (tests/three/spaceBridge.test.ts checks it to 1e-6 px).\n */\nimport { AmbientLight, Color, DirectionalLight, Fog, OrthographicCamera, PerspectiveCamera, PointLight, SRGBColorSpace, SpotLight, type Light, type Object3D, type Scene } from 'three';\nimport type { CameraState } from '../space/math';\nimport type { LightState } from '../space/lighting';\nimport type { FogState } from '../space/LitMaterial';\n\n/** The camera's near plane and far plane in composition pixels: the home camera sits about 740 px from the picture, a long dolly can be several thousand. */\nconst NEAR = 1;\nconst FAR = 20000;\n\n/** Put a three camera where the composition camera is. The aspect is the layer's (it must be the composition's: see `followCamera`). */\nexport function applyCameraState(camera: PerspectiveCamera, s: CameraState, aspect: number): void {\n camera.fov = s.fov;\n camera.aspect = aspect;\n camera.near = NEAR;\n camera.far = FAR;\n camera.up.set(0, 1, 0);\n camera.position.set(s.x, -s.y, s.z);\n const same = Math.hypot(s.lookAtX - s.x, s.lookAtY - s.y, s.lookAtZ - s.z) < 1e-9; // the composition then looks along -z\n camera.lookAt(same ? s.x : s.lookAtX, same ? -s.y : -s.lookAtY, same ? s.z - 1 : s.lookAtZ);\n camera.updateProjectionMatrix();\n camera.updateMatrixWorld();\n}\n\ninterface Entry { kind: LightState['kind']; light: Light; target: Object3D | null }\n\n/**\n * The composition's lights as three lights, one per light layer alive, in layer order. The objects are made once and moved every frame (a light that has ended is switched off,\n * not removed: the shader of a three layer must not be rebuilt as lights come and go).\n *\n * Intensity: three divides a diffuse surface by pi, so a light of intensity 1 is multiplied by pi to be \"as bright as the colour\" like a card's shading. Falloff: 'none' is no\n * attenuation; 'inverseSquare' is decay 2 with the intensity scaled so it is full at `radius` (it keeps rising inside it, where the composition's stays at 1); 'smooth' is three's\n * cut-off fitted to the composition's curve (see below). Shadows follow the light (castsShadows: the layer's own meshes cast and receive).\n */\nexport class LightMirror {\n private entries: Entry[] = [];\n /** True when a light alive casts shadows: the layer's renderer must have its shadow map on. */\n castsShadows = false;\n constructor(private readonly scene: Object3D, private readonly extent = 2000) {}\n\n update(lights: readonly LightState[]): void {\n this.castsShadows = lights.some((s) => s.castsShadows && s.kind !== 'ambient');\n lights.forEach((s, i) => {\n let e = this.entries[i];\n if (!e || e.kind !== s.kind) {\n if (e) this.remove(e);\n e = this.entries[i] = this.make(s.kind);\n }\n this.configure(e, s);\n });\n for (let i = lights.length; i < this.entries.length; i++) this.entries[i]!.light.visible = false;\n }\n\n dispose(): void {\n for (const e of this.entries) this.remove(e);\n this.entries = [];\n }\n\n private make(kind: LightState['kind']): Entry {\n const light: Light = kind === 'ambient' ? new AmbientLight() : kind === 'parallel' ? new DirectionalLight() : kind === 'spot' ? new SpotLight() : new PointLight();\n light.name = 'pixi-effects:composition-light';\n const target = (light as DirectionalLight | SpotLight).target ?? null;\n this.scene.add(light);\n if (target) this.scene.add(target);\n return { kind, light, target };\n }\n\n private remove(e: Entry): void {\n this.scene.remove(e.light);\n if (e.target) this.scene.remove(e.target);\n }\n\n private configure(e: Entry, s: LightState): void {\n const { light } = e;\n light.visible = true;\n light.color = (light.color ?? new Color()).setRGB(s.r, s.g, s.b, SRGBColorSpace);\n let intensity = s.intensity * Math.PI;\n if (s.kind !== 'ambient') {\n light.position.set(s.x, -s.y, s.z);\n e.target?.position.set(s.lookAtX, -s.lookAtY, s.lookAtZ);\n }\n if (s.kind === 'point' || s.kind === 'spot') {\n const l = light as PointLight | SpotLight;\n if (s.falloff === 'inverseSquare') { l.distance = 0; l.decay = 2; intensity *= s.radius * s.radius; }\n else if (s.falloff === 'smooth') {\n // The composition: 1 inside `radius`, a smoothstep down to 0 at radius + falloffDistance. three's cut-off distance D with decay 0 attenuates by saturate(1 - (d/D)^4)^2, a gentler curve that\n // starts to fall at once. A cut-off and a gain chosen from where the fall starts (p = radius / (radius + falloffDistance)) halve the largest difference over the range (0.15-0.40 with\n // D = radius + falloffDistance and no gain, 0.09-0.17 here for a fall that is not steep); a fall that is steep against its radius cannot be matched by three's curve.\n const reach = s.radius + Math.max(s.falloffDistance, 1e-3), p = s.radius / reach;\n l.distance = reach * (0.8 + 0.45 * p); l.decay = 0; intensity *= 0.87 + 0.45 * p;\n }\n else { l.distance = 0; l.decay = 0; }\n }\n if (s.kind === 'spot') {\n const l = light as SpotLight;\n l.angle = ((s.coneAngle / 2) * Math.PI) / 180;\n l.penumbra = s.coneFeather;\n }\n light.intensity = intensity;\n if (s.kind !== 'ambient') {\n const l = light as PointLight | SpotLight | DirectionalLight;\n l.castShadow = s.castsShadows;\n if (s.castsShadows) {\n l.shadow.mapSize.set(2048, 2048);\n l.shadow.intensity = s.shadowDarkness;\n l.shadow.radius = Math.max(1, s.shadowDiffusion / 4);\n // Scale-aware: three compares depths AFTER the perspective divide, so a bias of b is about b·d²/near world units at distance d from the light. A near plane of 1 px and a bias of\n // -0.0005 hid every caster within ~250 px of its receiver at 1280 x 720 (found by an AI trial). The near plane follows the size of the composition (~20 px at 1280 x 720) and the\n // bias is small, so the gap is about a pixel or two; normalBias (world units, along the surface normal) is a pixel or two too.\n l.shadow.bias = -0.00005;\n l.shadow.normalBias = this.extent / 1000;\n const cam = l.shadow.camera;\n cam.near = Math.max(1, this.extent / 128); cam.far = 20000;\n if (s.kind === 'parallel') { const o = cam as OrthographicCamera; o.left = -this.extent; o.right = this.extent; o.top = this.extent; o.bottom = -this.extent; }\n cam.updateProjectionMatrix();\n }\n }\n light.updateMatrixWorld?.();\n e.target?.updateMatrixWorld?.();\n }\n}\n\n/**\n * The composition camera's fog as the scene's `Fog`: the same colour, `near` and `far` (distances along the view, in composition pixels). three's Fog fades with `smoothstep` where the\n * composition's fades linearly, and has no amount below 1: close, not equal (see docs/dsl.md). The Fog is made when the camera has one and removed when it has not; a Fog the layer made\n * itself is never touched.\n */\nexport class FogMirror {\n private own: Fog | null = null;\n constructor(private readonly scene: Scene) {}\n\n update(fog: FogState | null): void {\n if (!fog) {\n if (this.own && this.scene.fog === this.own) this.scene.fog = null;\n this.own = null;\n return;\n }\n if (!this.own || this.scene.fog !== this.own) {\n if (this.scene.fog && this.scene.fog !== this.own) return; // the layer has its own fog: leave it\n this.own = new Fog(0x000000, fog.near, fog.far);\n this.scene.fog = this.own;\n }\n this.own.color.setRGB(fog.r, fog.g, fog.b, SRGBColorSpace);\n this.own.near = fog.near;\n this.own.far = fog.far;\n }\n\n dispose(): void { this.update(null); }\n}\n","/**\n * How many three layers a page can hold. Each `three` layer owns a renderer, and a browser keeps only so many live graphics contexts for a whole page: about 16 for WebGL, about 32 for\n * WebGPU (measured 2026-10-15 on Chrome: layers beyond it draw nothing, without an error). PixiJS and a `shader` layer use contexts of their own, so the warning comes a little before the\n * limit: more than 12 WebGL layers, more than 28 WebGPU layers. A WebGPU layer that draws on PixiJS's own GPU device has no context of its own and is not counted.\n */\nexport type ThreeKind = 'webgl' | 'webgpu';\n\nconst WARN_ABOVE: Record<ThreeKind, number> = { webgl: 12, webgpu: 28 };\nconst LIMIT: Record<ThreeKind, string> = { webgl: 'about 16 WebGL contexts', webgpu: 'about 32 WebGPU contexts' };\nconst live: Record<ThreeKind, number> = { webgl: 0, webgpu: 0 };\nconst warned = new Set<ThreeKind>();\n\n/** A three layer made its renderer: count it, and say once per kind when the page holds too many. */\nexport function trackThree(kind: ThreeKind): void {\n live[kind]++;\n if (live[kind] > WARN_ABOVE[kind] && !warned.has(kind)) {\n warned.add(kind);\n console.warn(`pixi-effects: ${live[kind]} three layers are alive with renderer: '${kind}', and a browser keeps ${LIMIT[kind]} for the whole page; layers beyond that draw nothing, without an error. ` +\n `Put several objects in one three layer, destroy layers that are over, ` + (kind === 'webgl' ? `or use renderer: 'webgpu' for some (in a movie PixiJS draws on WebGPU they share its GPU device and have no limit; otherwise it is about 32)` : `or use renderer: 'webgl' for some of them (a different pool of contexts), or leave shareGpu on in a movie PixiJS draws on WebGPU (the layers then share its device)`));\n }\n}\n\n/** A three layer let its renderer go. */\nexport function releaseThree(kind: ThreeKind): void {\n live[kind] = Math.max(0, live[kind] - 1);\n}\n\n/** What the page holds now, per renderer. */\nexport function threeBudget(): Record<ThreeKind, number> {\n return { ...live };\n}\n\n/** For tests: forget everything. */\nexport function resetThreeBudget(): void {\n live.webgl = live.webgpu = 0;\n warned.clear();\n}\n","import { Sprite, Texture, TextureSource } from 'pixi.js';\nimport { Box3, PerspectiveCamera, Plane, Quaternion, Raycaster, RenderTarget, Scene, Vector2, Vector3, WebGLRenderer, type Camera, type Object3D } from 'three';\nimport type { WebGPURenderer } from 'three/webgpu';\nimport { Sequence } from '../sequences/Base';\nimport { buildScope } from '../expr/Scope';\nimport { evaluateExpr } from '../expr/Parser';\nimport type { PathRouters } from '../core/Timeline';\nimport type { PropValue } from '../types';\nimport type { ThreeContext, ThreeSequenceSpec } from './types';\nimport { checkRendererKind, getPageRenderer } from './defaults';\nimport { applyCameraState, FogMirror, LightMirror } from './spaceBridge';\nimport { releaseThree, trackThree } from './budget';\nimport type { CanvasCheck } from '../sequences/Canvas';\nimport type { SharedGpu } from '../core/gpuShare';\nimport type { Rebindable, ThreeLayerHost } from './layerTexture';\n\n/** What makes a frame depend on more than the time (the same list as the canvas layer's). */\nconst NOT_PURE = /\\bMath\\s*\\.\\s*random\\s*\\(|\\bDate\\s*\\.\\s*now\\s*\\(|\\bperformance\\s*\\.\\s*now\\s*\\(|\\bnew\\s+Date\\s*\\(/;\n\nexport class ThreeSequence extends Sequence {\n private _renderer: WebGLRenderer | WebGPURenderer | null = null;\n /** The renderer this layer draws with (`'webgl'` or `'webgpu'`), once it is built. */\n renderer: 'webgl' | 'webgpu' | null = null;\n /** The backend under it: `'webgl'`, `'webgpu'`, or `'webgl2'` when three's WebGPURenderer found no WebGPU in this browser and used its own WebGL2 backend (the same picture). */\n backend: 'webgl' | 'webgpu' | 'webgl2' | null = null;\n private _gpu = false; // renderer: 'webgpu': async init and async render\n /** True when the layer draws on PixiJS's own GPU device into a texture PixiJS samples directly (no canvas of its own, no copy, no share of the page's context cap). */\n sharedGpu = false;\n private _rt: RenderTarget | null = null; // the texture a shared layer draws into\n private _sharedTexture: Texture | null = null;\n private _texture: Texture | null = null; // what the layer's sprite shows (the canvas's, or the shared render target's)\n /** What a rebuilt layer is compared with to take this one's place (core/reuse.ts); null: this layer is never kept (`reuse: false`, no `name`). */\n private _key: string | null = null;\n /** The layer of the tree being replaced whose state this one is using until the new tree is on stage (`commitReuse`): not this layer's to let go. */\n private _borrowed: ThreeSequence | null = null;\n /** True once another layer owns this layer's state: destroying this one must not let it go. */\n private _donated = false;\n /** Things to do just before every draw (the 2D layers shown on meshes: `threeLayerTexture`), and those layers' handles. Both go with the state to a layer that takes it over. */\n private _drawHooks = new Set<() => void>();\n private _layerTextures: Rebindable[] = [];\n private _pendingRebinds: Array<() => void> = [];\n /** Every frame, whether this layer is alive or not: a 2D layer it shows stays off the stage (a tween of `autoAlpha` writes `visible = true` on it). */\n override syncFrame(): void {\n super.syncFrame();\n for (const h of this._layerTextures) h.keepHidden();\n }\n /** True when this layer shows 2D layers on its meshes (`threeLayerTexture`): the movie draws it after the rest of the frame is ready. */\n get showsLayers(): boolean { return this._layerTextures.length > 0; }\n private _scene: Scene | null = null;\n private _camera: Camera | null = null;\n private _ctx: ThreeContext | null = null;\n private _objects: Record<string, object> = {};\n private _warnedUpdate = false;\n private _warnedNodeFrame = false;\n private _warnedPaths = new Set<string>();\n private _lightMirror: LightMirror | null = null;\n private _fogMirror: FogMirror | null = null;\n private _warnedSpace = new Set<string>();\n private _tracked = false;\n /** Set when this layer lets its renderer go on purpose: the context loss that follows is its own doing, not the browser's. */\n private _closing = false;\n\n private get _threeSpec(): ThreeSequenceSpec {\n return this.spec as unknown as ThreeSequenceSpec;\n }\n\n protected override pathRouters(): PathRouters {\n return { three: (path) => this._resolveThreePath(path) };\n }\n\n async build(): Promise<void> {\n const spec = this._threeSpec;\n if (this.duration === undefined) {\n this.duration = this.parent?.duration ?? this.root.duration;\n }\n if (typeof spec.update === 'function' && NOT_PURE.test(spec.update.toString())) {\n console.warn(`pixi-effects: three layer${spec.name ? ` \"${spec.name}\"` : ''}: update calls Math.random, Date.now, performance.now or new Date, so it is not deterministic: the same frame would draw differently in playback, in a seek and in an export. Derive the value from t`);\n }\n\n // Resolve layer size. Expressions see the usual scope; intrinsic w/h are\n // still 0 here (same chicken-and-egg as shapes), so W/H/GW/GH carry it.\n const scope = buildScope(this, this.parent, this.root) as unknown as Record<string, number>;\n const width = resolveDim(spec.width, scope) ?? this.parent?.width ?? this.root.width;\n const height = resolveDim(spec.height, scope) ?? this.parent?.height ?? this.root.height;\n const resolution = spec.resolution ?? 1;\n\n const antialias = spec.antialias ?? true;\n const kind = spec.renderer ?? getPageRenderer();\n checkRendererKind(kind, \"a three layer's renderer\");\n this._gpu = kind === 'webgpu';\n this.renderer = kind;\n\n // A rebuild (setVars, resize) builds this layer while the old one still plays: when it cannot be told apart from one of the old tree it takes over that one's scene and renderer (setup does not run again).\n this._key = spec.reuse === false || !spec.name ? null\n : JSON.stringify([spec.name, idOf(spec.setup), width, height, resolution, antialias, kind, spec.shareGpu !== false && !!this.root.gpu, !!spec.followCamera, !!spec.followLights, !!spec.followFog]);\n const donor = this._key !== null ? (this.root.reuse?.claim(this._key) as ThreeSequence | null | undefined) : null;\n if (donor && donor._lendable()) { this._borrow(donor, width, height, spec.name); return; }\n\n // Offscreen canvas — never attached to the DOM. document.createElement\n // (not OffscreenCanvas) so PIXI's Texture.from and three both accept it.\n const canvas = document.createElement('canvas');\n let renderer: WebGLRenderer | WebGPURenderer;\n if (this._gpu) {\n let mod: typeof import('three/webgpu');\n try { mod = await import('three/webgpu'); } catch (err) {\n throw new Error(`pixi-effects: renderer: 'webgpu' needs three 0.17x or later with \"three/webgpu\" in the import map (${err instanceof Error ? err.message : err})`);\n }\n // On PixiJS's own GPU device when there is one (a WebGPU movie): the layer draws into a texture PixiJS samples, with no canvas of its own. Anything that goes wrong there is said once\n // and the layer is made again on a canvas of its own, before its setup has run.\n let shared = spec.shareGpu === false ? undefined : this.root.gpu;\n for (;;) {\n renderer = new mod.WebGPURenderer(shared ? { device: shared.device as never, alpha: true, antialias } : { canvas, alpha: true, antialias });\n this._renderer = renderer;\n if (!shared) this._track();\n // The device is made here: nothing may render before. Where there is no WebGPU three uses its own WebGL2 backend and says so with a warning: that is not a problem\n // (it draws the same picture), so it becomes `backend: 'webgl2'` instead of a line in the author's console.\n const warn = console.warn;\n let noGpu = false;\n console.warn = (...args: unknown[]) => { if (/WebGPU is not available/.test(String(args[0]))) noGpu = true; else warn.apply(console, args as []); };\n try {\n await renderer.init();\n if (shared) { renderer.setSize(Math.round(width * resolution), Math.round(height * resolution), false); renderer.setClearColor(0x000000, 0); this._prepareShared(renderer, shared, width, height, resolution, antialias); }\n this.backend = noGpu ? 'webgl2' : 'webgpu';\n break;\n } catch (err) {\n this._disposeRenderer();\n if (!shared) throw err;\n console.warn(`pixi-effects: three layer${spec.name ? ` \"${spec.name}\"` : ''}: could not draw on PixiJS's GPU device (${err instanceof Error ? err.message : err}); it uses a canvas of its own (shareGpu: false does this on purpose)`);\n shared = undefined;\n this._closing = false;\n } finally { console.warn = warn; }\n }\n } else {\n renderer = new WebGLRenderer({ canvas, alpha: true, antialias });\n this._renderer = renderer;\n this._track();\n let said = false;\n canvas.addEventListener('webglcontextlost', () => { // the browser took the context away: the layer draws nothing from now on\n if (said || this._closing) return; // not the browser's doing: this layer is letting its context go\n said = true;\n console.warn(`pixi-effects: three layer${spec.name ? ` \"${spec.name}\"` : ''}: the browser took this layer's WebGL context away (a page keeps about 16 for all its layers, PixiJS and shader layers: too many were alive), so the layer draws nothing. Put several objects in one three layer, or destroy layers that are over`);\n });\n this.backend = 'webgl';\n }\n try {\n renderer.setSize(Math.round(width * resolution), Math.round(height * resolution), false);\n renderer.setClearColor(0x000000, 0);\n\n const scene = new Scene();\n const camera: Camera = new PerspectiveCamera(50, width / height, 0.1, 2000);\n const ctx: ThreeContext = { scene, camera, renderer, width, height, _host: this._makeHost() };\n if (spec.followCamera) this._checkFollowShape(width, height, spec.name);\n\n let result: Awaited<ReturnType<ThreeSequenceSpec['setup']>>;\n try { result = await spec.setup(ctx); } catch (err) { throw this._gpu ? this._explainWebGpuError(err, spec.name) : err; }\n if (result?.camera) ctx.camera = result.camera;\n this._scene = scene;\n this._camera = ctx.camera;\n this._ctx = ctx;\n this._objects = { ...(result?.objects ?? {}) };\n if (!('camera' in this._objects)) this._objects.camera = this._camera;\n\n if (this._gpu) this._checkWebGpuMaterials(scene, spec.name);\n // Frame 0 so the texture is never blank before the first tick.\n this._draw(0);\n\n this._texture = this._sharedTexture ?? Texture.from(canvas);\n this._makeSprite(this._texture, width, height, spec.name);\n } catch (err) {\n this._disposeRenderer();\n throw err;\n }\n }\n\n private _makeSprite(texture: Texture, width: number, height: number, name: string | undefined): void {\n const sprite = new Sprite({ texture, label: name });\n sprite.cullable = true;\n // Texture is canvas-sized (layer px × resolution); scale back to comp px.\n sprite.width = width;\n sprite.height = height;\n this.target = sprite;\n this.intrinsicWidth = width;\n this.intrinsicHeight = height;\n this.buildFilters();\n }\n\n /** The 2D layer that a material shows (`threeLayerTexture`), for a click on the mesh to reach it (movie.pick); null for any other material. */\n screenOf(material: unknown): { source: Sequence; at(u: number, v: number): { x: number; y: number } } | null {\n const handle = this._layerTextures.find((h) => h.material === material);\n return handle ? { source: handle.source(), at: (u, v) => handle.sourceAt(u, v) } : null;\n }\n\n /** What `threeLayerTexture` asks of this layer: the layers listed before it, PixiJS's renderer, whether the GPU device is shared, and a place to hook in before every draw. */\n private _makeHost(): ThreeLayerHost {\n return {\n findLayer: (name) => this.parent?.findLayer?.(name) ?? null,\n layerNames: () => this.parent?.layerNames?.() ?? [],\n pixiRenderer: this.root.pixiRenderer ?? null,\n shared: this.sharedGpu,\n beforeDraw: (fn) => { this._drawHooks.add(fn); return () => { this._drawHooks.delete(fn); }; },\n track: (handle) => { this._layerTextures.push(handle); return () => { const i = this._layerTextures.indexOf(handle); if (i >= 0) this._layerTextures.splice(i, 1); }; },\n };\n }\n\n /** Reuse (core/reuse.ts): the key this layer is matched by, while it can still lend its state. */\n reuseKey(): string | null { return this._renderer && !this._donated && !this._closing ? this._key : null; }\n private _lendable(): boolean { return this.reuseKey() !== null && !!this._scene && !!this._ctx && !!this._texture; }\n\n /** Take over a layer of the tree being replaced: its scene, renderer, texture and mirrors. Nothing is drawn until the new tree is on stage; the old layer goes on drawing meanwhile. */\n private _borrow(d: ThreeSequence, width: number, height: number, name: string | undefined): void {\n this.renderer = d.renderer; this.backend = d.backend; this._gpu = d._gpu; this.sharedGpu = d.sharedGpu;\n this._renderer = d._renderer; this._scene = d._scene; this._camera = d._camera; this._ctx = d._ctx; this._objects = d._objects;\n this._rt = d._rt; this._sharedTexture = d._sharedTexture; this._texture = d._texture;\n this._lightMirror = d._lightMirror; this._fogMirror = d._fogMirror; this._tracked = d._tracked;\n this._borrowed = d;\n this._drawHooks = d._drawHooks; this._layerTextures = d._layerTextures;\n const host = this._makeHost();\n this._pendingRebinds = this._layerTextures.map(h => h.prepare(host)); // the 2D layers of the new tree are shown from the swap on (commitReuse), not before: the old layer goes on drawing its own\n if (this.spec && (this._threeSpec as { followCamera?: boolean }).followCamera) this._checkFollowShape(width, height, name);\n this._makeSprite(this._texture!, width, height, name);\n }\n\n /** The new tree is on stage: the layer this one borrowed from has given its state away for good. */\n commitReuse(): void {\n const d = this._borrowed;\n if (!d) return;\n d._donated = true; d._tracked = false;\n this._borrowed = null;\n for (const apply of this._pendingRebinds) apply();\n this._pendingRebinds = [];\n }\n\n /**\n * Per-frame sync hook. Movie._awaitVideoFrames duck-types on this method\n * (same contract as VideoSequence) and awaits it inside gotoFrame — the\n * single frame path shared by playback and export, which is what makes\n * three layers deterministic in both.\n */\n async awaitFrameAt(local: number): Promise<void> {\n if (!this._renderer || !this._scene || !this._camera || !this._ctx) return;\n const spec = this._threeSpec;\n const t = Math.max(0, Math.min(local, this.duration ?? local));\n this._followSpace(t);\n if (spec.update) {\n try {\n spec.update(t, this._ctx);\n } catch (err) {\n if (!this._warnedUpdate) {\n this._warnedUpdate = true;\n console.warn('pixi-effects: three update() threw (reported once) —', err);\n }\n }\n }\n this._draw(t);\n if (!this.sharedGpu) (this.target as Sprite | null)?.texture.source.update(); // a shared layer's texture is the GPU's own: it is already the new picture\n }\n\n /**\n * `movie.pick`: a ray through the point (u, v) of the layer's picture (0..1, v down) from the layer's camera, and what it meets first: the object's name (its own, or its nearest\n * ancestor's that has one), where, and how far from the camera. Invisible objects and groups are not met. null when the ray meets nothing.\n */\n pickAt(u: number, v: number): { object: string; point: [number, number, number]; distance: number; object3d: Object3D; uv?: { u: number; v: number }; material?: unknown } | null {\n const scene = this._scene, camera = this._camera;\n if (!scene || !camera) return null;\n scene.updateMatrixWorld();\n camera.updateMatrixWorld();\n const ray = new Raycaster();\n ray.setFromCamera(new Vector2(u * 2 - 1, -(v * 2 - 1)), camera);\n const visibleChain = (o: Object3D | null): boolean => { for (let n = o; n; n = n.parent) if (!n.visible) return false; return true; };\n for (const hit of ray.intersectObjects(scene.children, true)) {\n if (!visibleChain(hit.object)) continue;\n let name = '';\n for (let n: Object3D | null = hit.object; n && n !== scene; n = n.parent) if (n.name) { name = n.name; break; }\n const m = (hit.object as unknown as { material?: unknown }).material;\n const material = Array.isArray(m) ? m[hit.face?.materialIndex ?? 0] : m;\n return { object: name, point: hit.point.toArray() as [number, number, number], distance: hit.distance, object3d: hit.object, ...(hit.uv ? { uv: { u: hit.uv.x, v: hit.uv.y } } : {}), material };\n }\n return null;\n }\n\n /**\n * `hit.three.grab(plane)`: drag a grabbed point of the scene. Returns a function of a point (u, v) of the layer's picture (0..1, v down) that gives where the pointer's ray through the layer's\n * camera meets a plane through the grabbed point, and how far that is from the grabbed point (`delta`): move the object by it and it follows the pointer exactly. `plane`: `'screen'` (facing the\n * camera: the default), `'floor'` (horizontal, the three y up), `'wall'` (z constant), or a normal `[x, y, z]`. null where the ray never meets it (a floor seen edge-on, behind the camera).\n */\n dragPlane(point: [number, number, number], plane: 'screen' | 'floor' | 'wall' | [number, number, number] = 'screen'): (u: number, v: number) => { point: [number, number, number]; delta: [number, number, number] } | null {\n const grabbed = new Vector3(...point);\n let normal: Vector3;\n if (plane === 'floor') normal = new Vector3(0, 1, 0);\n else if (plane === 'wall') normal = new Vector3(0, 0, 1);\n else if (Array.isArray(plane)) normal = new Vector3(...plane).normalize();\n else {\n const turn = new Quaternion();\n this._camera?.updateMatrixWorld();\n this._camera?.getWorldQuaternion(turn);\n normal = new Vector3(0, 0, 1).applyQuaternion(turn); // the camera looks along -z: its back is the plane's normal\n }\n const surface = new Plane().setFromNormalAndCoplanarPoint(normal, grabbed);\n return (u, v) => {\n const scene = this._scene, camera = this._camera;\n if (!scene || !camera) return null;\n scene.updateMatrixWorld();\n camera.updateMatrixWorld();\n const ray = new Raycaster();\n ray.setFromCamera(new Vector2(u * 2 - 1, -(v * 2 - 1)), camera);\n const at = ray.ray.intersectPlane(surface, new Vector3());\n if (!at) return null;\n return { point: at.toArray() as [number, number, number], delta: at.clone().sub(grabbed).toArray() as [number, number, number] };\n };\n }\n\n /**\n * The determinism check (`check`, `movie.review()`): the scene drawn at a few moments in two orders, with one draw thrown away first, and the pictures compared, as the canvas layer\n * does. A layer whose same frame is not the same picture (a clock, `Math.random`, a mixer advanced with `update(dt)`, any state that builds up from call to call) is reported.\n * It runs the layer's own `update`, draws with its renderer and reads the picture from the renderer's canvas in the same task; the next real frame draws again, so nothing is left behind.\n */\n checkDeterminism(times: number[]): CanvasCheck {\n const none: CanvasCheck = { differs: [], drawMs: 0, threw: [] };\n const renderer = this._renderer, ctx = this._ctx;\n if (!renderer || !this._scene || !this._camera || !ctx) return none;\n const source = (renderer as unknown as { domElement: HTMLCanvasElement }).domElement;\n const w = source.width, h = source.height;\n const scratch = document.createElement('canvas');\n scratch.width = w; scratch.height = h;\n const g = scratch.getContext('2d', { willReadFrequently: true });\n if (!g) return none;\n const keep = w * h * 4 * times.length <= 96e6;\n const hash = (d: Uint8ClampedArray): number => { let x = 0x811c9dc5; for (let i = 0; i < d.length; i++) { x ^= d[i]!; x = Math.imul(x, 0x01000193); } return x >>> 0; };\n const ms: number[] = [];\n const threw = new Set<number>();\n const once = (t: number, timed: boolean): Uint8ClampedArray => {\n const from = performance.now();\n try {\n this._followSpace(t);\n this._threeSpec.update?.(t, ctx);\n this._draw(t, true); // (a shared layer draws to the renderer's own canvas here: the same scene and update, the picture readable now)\n g.clearRect(0, 0, w, h);\n g.drawImage(source, 0, 0);\n } catch { threw.add(t); }\n if (timed) { g.getImageData(0, 0, 1, 1); ms.push(performance.now() - from); }\n return g.getImageData(0, 0, w, h).data;\n };\n for (const t of times) once(t, false); // the warm-up\n const first = times.map(t => { const d = once(t, true); return keep ? d.slice() : hash(d); });\n const second = [...times].reverse().map(t => once(t, false)).reverse();\n scratch.width = scratch.height = 1;\n const differs: CanvasCheck['differs'] = [];\n times.forEach((t, i) => {\n const a = first[i]!, b = second[i]!;\n if (typeof a === 'number') { if (a !== hash(b)) differs.push({ t, pixels: -1, maxDiff: -1 }); return; }\n let pixels = 0, maxDiff = 0;\n for (let k = 0; k < a.length; k++) { const d = Math.abs(a[k]! - b[k]!); if (d) { pixels++; if (d > maxDiff) maxDiff = d; } }\n if (pixels) differs.push({ t, pixels, maxDiff });\n });\n ms.sort((x, y) => x - y);\n return { differs: differs.filter(d => !threw.has(d.t)), drawMs: ms.length ? ms[Math.floor(ms.length / 2)]! : 0, threw: times.filter(t => threw.has(t)) };\n }\n\n /** `followCamera` / `followLights`: before each frame, ask the composition for its camera and lights at this moment (the layer's time on the composition's clock) and mirror them in the scene. */\n private _followSpace(t: number): void {\n const spec = this._threeSpec;\n if (!spec.followCamera && !spec.followLights && !spec.followFog) return;\n const ctx = this._ctx, scene = this._scene;\n if (!ctx || !scene) return;\n if (!this.parent?.spaceAt) {\n this._saidOnce('parent', `followCamera / followLights / followFog need the layer to sit in a composition that has a camera or a light to follow; this layer's parent cannot say (it keeps its own camera and lights)`, spec.name);\n return;\n }\n const space = this.parent.spaceAt((this.absoluteStart ?? this.at) + t);\n ctx.space = space;\n if (spec.followCamera) {\n const camera = ctx.camera as PerspectiveCamera;\n if (!camera.isPerspectiveCamera) this._saidOnce('camera', `followCamera needs a PerspectiveCamera (this layer's camera is a ${(ctx.camera as { type?: string }).type ?? 'different camera'}); it keeps it as it is`, spec.name);\n else applyCameraState(camera, space.camera, ctx.width / ctx.height);\n }\n if (spec.followLights) {\n const mirror = (this._lightMirror ??= new LightMirror(scene, Math.max(ctx.width, ctx.height) * 2));\n mirror.update(space.lights);\n if (!this._warnedSpace.has('inverseSquare')) this._checkInverseSquare(space.lights, scene, spec.name);\n if (mirror.castsShadows && !ctx.renderer.shadowMap.enabled) ctx.renderer.shadowMap.enabled = true;\n }\n if (spec.followFog) {\n if (space.fog && space.fog.amount !== 1) this._saidOnce('fogAmount', `followFog: the camera's fogAmount is ${space.fog.amount}, and three's Fog has no amount below 1: the layer uses the full amount (set fogColor to the colour you want at the far end, or leave followFog off and make the fog yourself from ctx.space.fog)`, spec.name);\n (this._fogMirror ??= new FogMirror(scene)).update(space.fog);\n }\n }\n\n /**\n * An inverse-square light is held at full strength inside its `radius` by the composition; three's decay-2 light keeps rising (4x at half the radius, 11x at a third). When the scene has\n * an object closer to such a light than 0.8 of its radius, say so once, with the way out. (The check is the scene's bounding box against the light's place: no object is measured.)\n */\n private _checkInverseSquare(lights: ReadonlyArray<{ kind: string; falloff: string; radius: number; x: number; y: number; z: number }>, scene: Scene, name: string | undefined): void {\n const near = lights.filter((l) => l.falloff === 'inverseSquare' && (l.kind === 'point' || l.kind === 'spot'));\n if (!near.length) return;\n const box = new Box3().setFromObject(scene);\n if (box.isEmpty()) return;\n for (const l of near) {\n const d = box.distanceToPoint(new Vector3(l.x, -l.y, l.z));\n if (d < 0.8 * l.radius) {\n this._saidOnce('inverseSquare', `followLights: a light with falloff 'inverseSquare' and radius ${l.radius} is only ${Math.round(d)} px from the nearest part of the scene. The composition holds such a light at full strength inside its radius; three's inverse-square light keeps rising there (${(Math.pow(l.radius / Math.max(d, 1), 2)).toFixed(1)}x at that distance), so those parts come out much brighter. Make the radius smaller than that distance, or use falloff 'smooth' (it is fitted to the composition's curve)`, name);\n return;\n }\n }\n }\n\n /** followCamera shows the whole composition through the layer's picture: a layer of another shape would show it squeezed or cut. Said once at build. */\n private _checkFollowShape(width: number, height: number, name: string | undefined): void {\n const p = this.parent;\n if (!p || !(p.width > 0 && p.height > 0)) return;\n if (Math.abs(width * p.height - height * p.width) <= 1e-3 * width * p.height) return;\n this._saidOnce('shape', `followCamera: the layer is ${width} x ${height} but the composition is ${p.width} x ${p.height}; the camera shows the whole composition, so the layer needs its aspect ratio (drop width / height to cover the composition)`, name);\n }\n\n private _saidOnce(key: string, message: string, name: string | undefined): void {\n if (this._warnedSpace.has(key)) return;\n this._warnedSpace.add(key);\n console.warn(`pixi-effects: three layer${name ? ` \"${name}\"` : ''}: ${message}`);\n }\n\n /**\n * One render of the scene at the layer-local time `t`. WebGPURenderer.render() needs `await init()` first (done in build); it queues the GPU work, and PixiJS reads the canvas after.\n *\n * Three's WebGPU node system updates the light uniforms (and its `time`) once per FRAME ID, and bumps that id in its own requestAnimationFrame loop only. Renders that\n * follow each other in one task (a seek, an export) would all show the lights of the last animation frame: a lamp keyframed with `three.lamp.intensity` would not move.\n * So before each render the layer advances the node frame itself, and gives `time` the layer's own time (not three's wall clock).\n */\n private _draw(t: number, toCanvas = false): void {\n if (!this._renderer || !this._scene || !this._camera) return;\n for (const hook of this._drawHooks) hook(); // the 2D layers shown on meshes are drawn into their textures first\n if (this._gpu) this._advanceNodeFrame(t);\n if (!this._rt || toCanvas) { this._renderer.render(this._scene, this._camera); return; }\n // A shared layer draws into its texture. setOutputRenderTarget (not setRenderTarget) keeps the canvas route's output pass: tone mapping, the sRGB encode, fog and the multisample resolve.\n const r = this._renderer as unknown as { setOutputRenderTarget(rt: RenderTarget | null): void; setRenderTarget(rt: RenderTarget | null): void };\n r.setOutputRenderTarget(this._rt);\n try { this._renderer.render(this._scene, this._camera); } finally { r.setOutputRenderTarget(null); r.setRenderTarget(null); } // (three leaves the output target set as the render target too)\n }\n\n /**\n * A shared layer's texture: a render target of the layer's size, drawn into once (the GPU texture exists only after a draw) and adopted by a PixiJS texture source. Throws when something\n * is not as this expects (the build then makes the layer again on a canvas of its own). Done before `setup`, so nothing the author made yet depends on the renderer.\n */\n private _prepareShared(renderer: WebGPURenderer, shared: SharedGpu, width: number, height: number, resolution: number, antialias: boolean): void {\n const w = Math.round(width * resolution), h = Math.round(height * resolution);\n const rt = new RenderTarget(w, h, { depthBuffer: true, samples: antialias ? 4 : 0 });\n this._rt = rt;\n const r = renderer as unknown as { setOutputRenderTarget(rt: RenderTarget | null): void; setRenderTarget(rt: RenderTarget | null): void; backend?: { get?(t: unknown): { texture?: { format?: string; createView?: unknown } } | undefined } };\n if (typeof r.setOutputRenderTarget !== 'function') throw new Error('this three has no setOutputRenderTarget');\n r.setOutputRenderTarget(rt);\n try { renderer.render(new Scene(), new PerspectiveCamera()); } finally { r.setOutputRenderTarget(null); r.setRenderTarget(null); }\n const gpuTexture = r.backend?.get?.(rt.texture)?.texture;\n if (!gpuTexture || typeof gpuTexture.createView !== 'function') throw new Error(\"three keeps no GPU texture for a render target\");\n const source = new TextureSource({ width: w, height: h, format: gpuTexture.format as never, label: 'three layer (shared GPU)' });\n shared.adopt(source, gpuTexture);\n this._sharedTexture = new Texture({ source });\n this.sharedGpu = true;\n }\n\n /**\n * The author chose renderer: 'webgpu'. Three's WebGPU renderer turns materials into node materials: a ShaderMaterial / RawShaderMaterial cannot run there (three logs an error on\n * every render and draws a default material) and `onBeforeCompile` (a patch of the WebGL shader text) is ignored without a word. Stop, once, naming the first such material and the fix,\n * instead of drawing a picture that is wrong without saying so.\n */\n private _checkWebGpuMaterials(scene: Scene, layerName: string | undefined): void {\n const bad: string[] = [];\n const seen = new Set<unknown>();\n const check = (m: unknown): void => {\n if (!m || typeof m !== 'object' || seen.has(m)) return;\n seen.add(m);\n const mat = m as { type?: string; name?: string; isShaderMaterial?: boolean; isRawShaderMaterial?: boolean };\n const label = `${mat.name ? `\"${mat.name}\" ` : ''}${mat.type ?? 'material'}`;\n if (mat.isShaderMaterial || mat.isRawShaderMaterial) bad.push(`${label} is a ShaderMaterial (it cannot run on the WebGPU renderer)`);\n else if (Object.prototype.hasOwnProperty.call(mat, 'onBeforeCompile')) bad.push(`${label} sets onBeforeCompile (the WebGPU renderer ignores it)`);\n };\n scene.traverse?.((o: unknown) => {\n const mats = (o as { material?: unknown }).material;\n for (const m of Array.isArray(mats) ? mats : [mats]) check(m);\n });\n if (!bad.length) return;\n this._disposeRenderer();\n throw new Error(`pixi-effects: three layer${layerName ? ` \"${layerName}\"` : ''} with renderer: 'webgpu': ${bad[0]}${bad.length > 1 ? ` (and ${bad.length - 1} more)` : ''}. ` +\n `Add renderer: 'webgl' to this layer (or registerThree({ renderer: 'webgl' }) for the page), or write the look with three's node materials (TSL).`);\n }\n\n /** The one setup failure everybody meets on the WebGPU renderer: a PMREMGenerator imported from 'three' reads WebGL state the WebGPU renderer does not have. */\n private _explainWebGpuError(err: unknown, layerName: string | undefined): unknown {\n if (err instanceof TypeError && /reading 'buffers'|renderer\\.state/.test(err.message)) {\n return new Error(`pixi-effects: three layer${layerName ? ` \"${layerName}\"` : ''} with renderer: 'webgpu': setup used a WebGL-only helper, most likely a PMREMGenerator imported from 'three'. ` +\n `Import it from 'three/webgpu' (import * as THREE from 'three/webgpu'), or add renderer: 'webgl' to this layer.`, { cause: err });\n }\n return err;\n }\n\n private _advanceNodeFrame(t: number): void {\n const frame = (this._renderer as unknown as { _nodes?: { nodeFrame?: { update?: () => void; time: number; deltaTime: number } } })._nodes?.nodeFrame;\n if (!frame || typeof frame.update !== 'function') {\n if (!this._warnedNodeFrame) {\n this._warnedNodeFrame = true;\n console.warn(\"pixi-effects: this three has no node frame to advance (renderer: 'webgpu'): a light animated by keyframes may not follow the time in a seek or an export; use renderer: 'webgl' or report the three version\");\n }\n return;\n }\n frame.update();\n frame.time = t;\n frame.deltaTime = 1 / ((this.root as { frameRate?: number }).frameRate ?? 30);\n }\n\n private _resolveThreePath(path: string): { target: object; prop: string } | null {\n const segs = path.split('.');\n if (segs.length < 2) {\n this._warnPath(path, 'needs at least <object>.<prop>');\n return null;\n }\n let obj: unknown = this._objects[segs[0]!];\n if (obj == null) {\n this._warnPath(path, `unknown object \"${segs[0]}\" — expose it via setup's { objects }`);\n return null;\n }\n for (let i = 1; i < segs.length - 1; i++) {\n obj = (obj as Record<string, unknown>)[segs[i]!];\n if (obj == null) {\n this._warnPath(path, `\"${segs[i]}\" is undefined along the path`);\n return null;\n }\n }\n const prop = segs[segs.length - 1]!;\n if (typeof obj !== 'object' || !(prop in (obj as object))) {\n this._warnPath(path, `no property \"${prop}\"`);\n return null;\n }\n return { target: obj as object, prop };\n }\n\n private _warnPath(path: string, why: string): void {\n if (this._warnedPaths.has(path)) return;\n this._warnedPaths.add(path);\n console.warn(`pixi-effects: keyframe path three.${path} ${why}; skipped`);\n }\n\n /** Count this layer's renderer against the page's allowance of graphics contexts (given back when the renderer is disposed). */\n private _track(): void {\n this._tracked = true;\n trackThree(this._gpu ? 'webgpu' : 'webgl');\n }\n\n private _disposeRenderer(): void {\n if (!this._renderer) return;\n this._closing = true;\n if (this._tracked) { this._tracked = false; releaseThree(this._gpu ? 'webgpu' : 'webgl'); }\n try {\n this._renderer.dispose();\n if (!this._gpu) (this._renderer as WebGLRenderer).forceContextLoss();\n } catch (err) {\n console.warn('pixi-effects: three renderer dispose threw —', err);\n }\n this._renderer = null;\n try { this._rt?.dispose(); } catch { /* the renderer took the texture with it */ }\n this._rt = null;\n }\n\n override destroy(): void {\n const spec = this._threeSpec;\n // another layer has this layer's state, or has not yet let go of it (a rebuild in progress): the scene, the renderer and the texture are not this layer's to let go\n const kept = this._donated || this._borrowed !== null;\n if (!kept && this._ctx && spec.dispose) {\n try { spec.dispose(this._ctx); } catch (err) {\n console.warn('pixi-effects: three dispose() threw —', err);\n }\n }\n const texture = this._texture;\n if (!kept) {\n for (const h of this._layerTextures) { try { h.dispose(); } catch { /* the 2D layer is gone with its tree */ } }\n this._lightMirror?.dispose();\n this._fogMirror?.dispose();\n this._disposeRenderer();\n }\n this._lightMirror = null;\n this._fogMirror = null;\n this._renderer = null;\n this._rt = null;\n this._scene = null;\n this._camera = null;\n this._ctx = null;\n this._objects = {};\n super.destroy();\n if (!kept) texture?.destroy(true); // canvas-backed source is per-sequence; safe to kill (a shared layer's source owns no GPU texture: the render target did)\n this._texture = null;\n this._sharedTexture = null;\n }\n}\n\nfunction resolveDim(v: PropValue | undefined, scope: Record<string, number>): number | undefined {\n if (v === undefined) return undefined;\n if (typeof v === 'number') return v;\n return evaluateExpr(v, scope);\n}\n\n/** A number for each function: two layers are the same layer only when their `setup` is the same function. */\nconst ids = new WeakMap<object, number>();\nlet lastId = 0;\nfunction idOf(fn: unknown): number {\n if (typeof fn !== 'function') return 0;\n let id = ids.get(fn);\n if (id === undefined) { id = ++lastId; ids.set(fn, id); }\n return id;\n}\n","/**\n * Two helpers for a glTF model in a `three` layer's `setup` / `update` (the layer stays the free box; these are what is easy to get wrong by hand):\n *\n * const fox = await threeGltf('Fox.glb', { animation: 'Run' }); // in setup\n * ctx.scene.add(fox.object); threeFrameCamera(ctx.camera, fox.object);\n * ... update: (t) => fox.pose(t) // the clip at the layer's time: a function of t, never of a clock\n *\n * The loader is an addon: a page that never calls `threeGltf` never loads it (the import map needs `\"three/addons/\"` next to `\"three\"`).\n */\nimport { AnimationMixer, Box3, Group, LoopOnce, LoopRepeat, Vector3, type AnimationClip, type Camera, type Object3D, type PerspectiveCamera } from 'three';\n\nexport interface ThreeGltfOptions {\n /** A clip name, a clip index, or `false` (no animation: the model's bind pose). Default: the first clip, if the file has one. */\n animation?: string | number | false;\n /** The clip time is `t × speed + offset` (the layer's seconds). Defaults 1 and 0. */\n speed?: number;\n offset?: number;\n /** `true` (default): the clip repeats; `false`: it holds its last pose. */\n loop?: boolean;\n}\n\nexport interface ThreeGltfModel {\n /** Add this to `ctx.scene`. A group whose origin is the centre of the model's bounding box (bind pose): position, turn and `fit` it about its centre. */\n object: Group;\n /** The names of the clips the file has. */\n clips: string[];\n /** The size of the model's bounding box in the file's own units (bind pose, before `fit`). */\n size: Vector3;\n /** Pose the model at the layer's time `t` (seconds). `AnimationMixer.setTime` evaluates the clip from zero every call: a seek, an export and a repeat give the same pose. */\n pose(t: number): void;\n /** Scale `object` so the model's longest side is `px` (a model in metres in a scene in composition pixels). */\n fit(px: number): void;\n /** Stop the clip. Geometries, materials and textures are yours to dispose with the scene. */\n dispose(): void;\n}\n\nexport async function threeGltf(url: string, options: ThreeGltfOptions = {}): Promise<ThreeGltfModel> {\n const label = 'pixi-effects: threeGltf';\n if (typeof url !== 'string' || !url) throw new Error(`${label}: the first argument is the URL of a .glb or .gltf file`);\n let GLTFLoader: typeof import('three/addons/loaders/GLTFLoader.js').GLTFLoader;\n try { ({ GLTFLoader } = await import('three/addons/loaders/GLTFLoader.js')); } catch (err) {\n throw new Error(`${label}: needs \"three/addons/\" in the import map next to \"three\" (${err instanceof Error ? err.message : err})`);\n }\n let gltf: Awaited<ReturnType<InstanceType<typeof GLTFLoader>['loadAsync']>>;\n try { gltf = await new GLTFLoader().loadAsync(url); } catch (err) {\n throw new Error(`${label}: could not load \"${url}\" (${err instanceof Error ? err.message : err})`, { cause: err });\n }\n\n const clips: AnimationClip[] = gltf.animations ?? [];\n let clip: AnimationClip | undefined;\n const wanted = options.animation;\n if (wanted === false || (wanted === undefined && clips.length === 0)) clip = undefined;\n else if (wanted === undefined) clip = clips[0];\n else {\n clip = typeof wanted === 'number' ? clips[wanted] : clips.find((c) => c.name === wanted);\n if (!clip) throw new Error(`${label}: \"${url}\" has no animation ${JSON.stringify(wanted)}; its clips: ${clips.length ? clips.map((c, i) => `${i}: \"${c.name}\"`).join(', ') : '(none)'}`);\n }\n\n // The origin of the group is the centre of the box, so the model is placed and turned about its centre.\n const root: Object3D = gltf.scene;\n // A skinned mesh is always drawn. three culls a mesh by a bounding sphere, and a skinned mesh's sphere does not follow its animation or its place: a model that MOVES and throws a shadow\n // drew its shadow differently depending on the frames drawn before it (found on the Khronos Fox: `check` reported the layer as not a function of the time; with culling off the\n // pictures are the same in any order). The cost is that an off-screen model is still drawn.\n root.traverse((o) => { if ((o as { isSkinnedMesh?: boolean }).isSkinnedMesh) o.frustumCulled = false; });\n const object = new Group();\n object.add(root);\n const bounds = new Box3().setFromObject(root);\n const centre = bounds.getCenter(new Vector3());\n const size = bounds.getSize(new Vector3());\n root.position.sub(centre);\n\n let mixer: AnimationMixer | null = null;\n if (clip) {\n mixer = new AnimationMixer(root);\n const action = mixer.clipAction(clip);\n action.setLoop(options.loop === false ? LoopOnce : LoopRepeat, Infinity);\n action.clampWhenFinished = true;\n action.play();\n }\n const speed = options.speed ?? 1, offset = options.offset ?? 0;\n\n return {\n object,\n clips: clips.map((c) => c.name),\n size,\n pose: (t) => { mixer?.setTime(t * speed + offset); },\n fit: (px) => { object.scale.setScalar(px / Math.max(size.x, size.y, size.z, 1e-9)); },\n dispose: () => { mixer?.stopAllAction(); mixer?.uncacheRoot(root); mixer = null; },\n };\n}\n\nexport interface ThreeFrameCameraOptions {\n /** The direction the camera sits in from the centre of the model, any length. Default `[0.45, 0.3, 1]`: a three-quarter view, a little from the side and above. */\n direction?: [number, number, number];\n /** Free room around the model: 1.1 (the default) leaves 10 %. */\n margin?: number;\n}\n\n/**\n * Put `camera` where the whole of `object` (its bounding box now, with its scale and place) fits the frame, looking at its centre: the smallest distance at which the 8 corners of\n * the box all fit both the vertical and the horizontal field of view (a bounding sphere would leave a long model small and head-on). `near` and `far` follow the distance.\n * Uses the camera's own `fov` and `aspect`. For a clip that travels far, give your own camera: the box is the bind pose.\n */\nexport function threeFrameCamera(camera: PerspectiveCamera | Camera, object: Object3D, options: ThreeFrameCameraOptions = {}): void {\n const cam = camera as PerspectiveCamera;\n object.updateMatrixWorld(true);\n const bounds = new Box3().setFromObject(object);\n const centre = bounds.getCenter(new Vector3());\n const margin = options.margin ?? 1.1;\n const [dx, dy, dz] = options.direction ?? [0.45, 0.3, 1];\n const toCamera = new Vector3(dx, dy, dz).normalize();\n const right = new Vector3().crossVectors(new Vector3(0, 1, 0), toCamera);\n if (right.lengthSq() < 1e-12) right.set(1, 0, 0); // straight above or below: any right will do\n right.normalize();\n const up = new Vector3().crossVectors(toCamera, right);\n const tanV = Math.tan((cam.fov * Math.PI) / 360), tanH = tanV * cam.aspect;\n let distance = 1e-3;\n for (const x of [bounds.min.x, bounds.max.x]) for (const y of [bounds.min.y, bounds.max.y]) for (const z of [bounds.min.z, bounds.max.z]) {\n const r = new Vector3(x, y, z).sub(centre);\n distance = Math.max(distance, r.dot(toCamera) + (Math.abs(r.dot(right)) * margin) / tanH, r.dot(toCamera) + (Math.abs(r.dot(up)) * margin) / tanV);\n }\n cam.position.copy(centre).addScaledVector(toCamera, distance);\n cam.near = Math.max(distance / 100, 1e-4);\n cam.far = distance * 100;\n cam.lookAt(centre);\n cam.updateProjectionMatrix();\n}\n","/**\n * `threeLayerTexture(ctx, 'screen')`: a live 2D layer (a `composition`) as the picture on a mesh of a `three` layer (a phone's screen, a television, a billboard, a label).\n *\n * The 2D layer stays a layer of the movie: the timeline drives it, its own `at` / `duration` / keyframes / filters apply. It is not drawn on the stage any more: just before the three layer draws,\n * PixiJS draws it into a texture, and the mesh shows that texture. Two routes, chosen by what the layer has:\n * - the three layer draws on PixiJS's own GPU device (`renderer: 'webgpu'` in a WebGPU movie, the default): the texture is PixiJS's GPUTexture itself, used through three's `ExternalTexture`\n * (no copy; 0.3 ms a frame measured). It is not decoded from sRGB by three (the texture is plain rgba8), so the material decodes it in its shader and the picture is flipped by its UV.\n * - otherwise (the layer has a canvas of its own, or PixiJS is on WebGL): the pixels are read back into a canvas (1.6 ms a frame at 480 x 270, 4 ms at 1280 x 720) and three treats it as an ordinary\n * sRGB canvas texture.\n * Both give the 2D layer's colours exactly (tests/films/three-layer-texture).\n */\nimport { Matrix, RenderTexture, type Container, type Renderer } from 'pixi.js';\nimport type { Material, Texture } from 'three';\nimport type { Sequence } from '../sequences/Base';\nimport type { ThreeContext } from './types';\n\nexport interface ThreeLayerTextureOptions {\n /** Pixels of the texture per pixel of the 2D layer: 2 for a screen that is seen large. Default 1. */\n resolution?: number;\n /**\n * The 2D layer's empty and half-transparent parts let what is behind the mesh show through (a sticker, a label with rounded corners, a hologram). Default `false`: an opaque screen, empty parts black,\n * which is cheaper and never has the sorting trouble of transparent meshes (give the composition a background rect and use that). With `true` the material blends and does not write depth.\n */\n transparent?: boolean;\n}\n\nexport interface ThreeLayerTexture {\n /** An unlit material that shows the 2D layer: put it on a mesh (or on one face of a box: an array of materials). A screen shines by itself, so scene lights do not shade it. */\n material: Material;\n /** The three texture behind the material (colours are only right through `material`, which decodes them). */\n texture: Texture;\n /** The size of the texture in pixels. */\n width: number;\n height: number;\n /** Stop showing the layer (it is drawn on the stage again). Called when the three layer is destroyed. */\n dispose(): void;\n}\n\n/** What a three layer lends to `threeLayerTexture` (set on `ctx._host` by the layer itself). */\nexport interface ThreeLayerHost {\n /** A layer of the same composition by its name, among those built before this one. */\n findLayer(name: string): Sequence | null;\n /** The names of those layers, for the message when the name is wrong. */\n layerNames(): string[];\n pixiRenderer: Renderer | null;\n /** The three layer draws on PixiJS's GPU device (no copy is needed). */\n shared: boolean;\n /** Run `fn` just before every draw of the three layer; returns the function that stops it. */\n beforeDraw(fn: () => void): () => void;\n /** Remember a handle: a rebuild that keeps the three layer gives it the new tree's layer (`prepare`). */\n track(handle: Rebindable): () => void;\n}\n\n/** What a rebuild that keeps the three layer needs: show the layer of the new tree with the same name. */\n/** `prepare` looks for the layer in the new tree and throws if it is gone, but changes nothing; the function it returns puts the handle on the new tree's layer (called when that tree is on stage, so a rebuild that fails or is slow leaves the old movie showing its own screen). */\nexport interface Rebindable { material: Material; source(): Sequence; /** Where in the source (0..1 across, 0..1 down) a point (u, v) of the mesh's uv shows: the texture's own repeat / offset / rotation taken into account. */ sourceAt(u: number, v: number): { x: number; y: number }; prepare(host: ThreeLayerHost): () => void; keepHidden(): void; dispose(): void }\n\nconst label = 'pixi-effects: threeLayerTexture';\n\nexport async function threeLayerTexture(ctx: ThreeContext, name: string, options: ThreeLayerTextureOptions = {}): Promise<ThreeLayerTexture> {\n const host = ctx._host;\n if (!host) throw new Error(`${label}: call it from the setup of a three layer: const screen = await threeLayerTexture(ctx, 'screen')`);\n if (typeof name !== 'string' || !name) throw new Error(`${label}: the second argument is the name of a 2D layer: threeLayerTexture(ctx, 'screen')`);\n const resolution = options.resolution ?? 1;\n const transparent = options.transparent === true;\n if (!(Number.isFinite(resolution) && resolution > 0 && resolution <= 4)) throw new Error(`${label}: resolution is a number from above 0 to 4 (2 = twice the pixels), got ${JSON.stringify(options.resolution)}`);\n const pixi = host.pixiRenderer;\n if (!pixi) throw new Error(`${label}: PixiJS's renderer is not available here (the movie is not ready)`);\n\n const source = host.findLayer(name);\n if (!source) {\n const names = host.layerNames();\n throw new Error(`${label}: no layer named \"${name}\" before this three layer${names.length ? ` (the layers built before it: ${names.map((n) => `\"${n}\"`).join(', ')})` : ''}. ` +\n `A layer shown on a mesh must be listed BEFORE the three layer, in the same composition, and have that name.`);\n }\n if (source.spec.type !== 'composition') {\n throw new Error(`${label}: \"${name}\" is a ${source.spec.type} layer: a layer shown on a mesh must be a composition (wrap it: { type: 'composition', name: '${name}', width: 480, height: 270, sequences: [ … ] })`);\n }\n\n // A mask or a matte on the screen composition itself is placed in the PARENT's space; the content is drawn from the origin: unless the screen sits at the origin untouched, the mask lands shifted on the mesh.\n {\n const ini = ((source.spec as { initial?: Record<string, unknown> }).initial ?? {}) as Record<string, unknown>; // (its place, as the spec says it: the timeline has not put it there yet)\n const moved = ['x', 'y', 'rotation', 'pivotX', 'pivotY'].some(k => typeof ini[k] === 'number' && ini[k] !== 0) || ['scale', 'scaleX', 'scaleY'].some(k => typeof ini[k] === 'number' && ini[k] !== 1);\n if (moved && (source.maskSequence || (source.spec as { mask?: unknown }).mask !== undefined)) {\n console.warn(`${label}: \"${name}\" has a mask and is not at x: 0, y: 0 (anchor 0, scale 1, rotation 0): on the mesh its content is drawn from (0, 0) but its mask stays where the parent puts it, so the mask lands shifted. ` +\n `Put the screen at the origin (or mask a layer INSIDE the screen: that mask moves with it).`);\n }\n }\n // The texture is made at the layer's own size and the resolution asked for, drawn with no scale: PixiJS then scales filters, masks and mattes by the resolution itself, so `resolution` sharpens the screen and does\n // not change it (a blur is the same width at 1 and 2). `width` / `height` are the pixels of the texture.\n const logicalW = Math.max(1, Math.round(source.intrinsicWidth)), logicalH = Math.max(1, Math.round(source.intrinsicHeight));\n const width = Math.max(1, Math.round(logicalW * resolution)), height = Math.max(1, Math.round(logicalH * resolution));\n const limit = (() => {\n const g = pixi as unknown as { gpu?: { device?: { limits?: { maxTextureDimension2D?: number } } }; gl?: WebGL2RenderingContext | WebGLRenderingContext };\n return g.gpu?.device?.limits?.maxTextureDimension2D ?? (g.gl ? (g.gl.getParameter(g.gl.MAX_TEXTURE_SIZE) as number) : null) ?? 8192;\n })();\n if (width > limit || height > limit) {\n throw new Error(`${label}: the texture would be ${width} x ${height} pixels (the layer is ${logicalW} x ${logicalH}, resolution ${resolution}), above what this GPU allows (${limit}). Use resolution ${Math.max(1, Math.floor((limit / Math.max(logicalW, logicalH)) * 10) / 10)} or lower, or a smaller composition.`);\n }\n let sharedRoute = host.shared && pixi.name === 'webgpu';\n let webgpu: typeof import('three/webgpu') | undefined, tsl: typeof import('three/tsl') | undefined;\n if (sharedRoute) {\n try { [webgpu, tsl] = await Promise.all([import('three/webgpu'), import('three/tsl')]); } catch (err) {\n throw new Error(`${label}: needs \"three/webgpu\" and \"three/tsl\" in the import map (${err instanceof Error ? err.message : err})`);\n }\n if (typeof (webgpu as { ExternalTexture?: unknown }).ExternalTexture !== 'function') { // three before r180 has no ExternalTexture: read the pixels back instead\n console.warn(`${label}: this page's three has no ExternalTexture (it came with three 0.180): the screen is read back every frame (1.6 ms at 480 x 270) instead of shared with the GPU. Use three 0.180 or later for the no-copy route.`);\n sharedRoute = false;\n }\n }\n // on the shared GPU device the mesh samples PixiJS's texture itself: it needs its mip levels (a screen seen small or at a slant would alias to stripes), made after every draw. A read-back canvas gets them from three.\n const rt = RenderTexture.create({ width: logicalW, height: logicalH, resolution, ...(sharedRoute ? { autoGenerateMipmaps: true } : {}) });\n const gpuTexture = sharedRoute ? (pixi as unknown as { texture: { getGpuSource?: (s: unknown) => unknown } }).texture.getGpuSource?.(rt.source) : undefined;\n\n let texture: Texture, material: Material, readCanvas: HTMLCanvasElement | null = null;\n if (gpuTexture) {\n // three's WebGPU renderer takes a GPUTexture made on its own device; sRGB decoding is done by the material (an external texture is read as plain rgba8)\n const ext = new webgpu!.ExternalTexture(gpuTexture as never);\n ext.colorSpace = webgpu!.NoColorSpace;\n ext.minFilter = webgpu!.LinearMipmapLinearFilter; ext.magFilter = webgpu!.LinearFilter; ext.generateMipmaps = false; ext.anisotropy = 4; // the levels are PixiJS's; four taps along a slant\n ext.repeat.set(1, -1); ext.offset.set(0, 1); // the GPU texture's rows run top to bottom: a texture that three uploads is flipped, this is not\n const m = new webgpu!.MeshBasicNodeMaterial();\n const t = tsl!.texture(ext);\n // PixiJS stores the picture premultiplied by its alpha, in sRGB bytes: divide the alpha out (the blend of the mesh is the ordinary one), then decode\n // TSL's own types do not describe swizzles (`.rgb`, `.a`) on a plain Node: a loose view of the three nodes used below\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const tex = t as any, vec4 = tsl!.vec4 as any, eotf = tsl!.sRGBTransferEOTF as any, max = tsl!.max as any;\n const straight = eotf(vec4(tex.rgb.div(max(tex.a, 0.0001)), 1));\n m.colorNode = (transparent ? vec4(straight.rgb, tex.a) : vec4(eotf(vec4(tex.rgb, 1)).rgb, 1)) as never;\n m.toneMapped = false;\n if (transparent) { m.transparent = true; m.depthWrite = false; }\n texture = ext; material = m;\n } else {\n const three = await import('three');\n readCanvas = document.createElement('canvas');\n readCanvas.width = width; readCanvas.height = height;\n const ct = new three.CanvasTexture(readCanvas);\n ct.colorSpace = three.SRGBColorSpace;\n texture = ct;\n material = new three.MeshBasicMaterial({ map: ct, toneMapped: false, ...(transparent ? { transparent: true, depthWrite: false } : {}) });\n }\n\n let current: Sequence = source;\n let display: Container = source.target as Container;\n let sx = logicalW / source.intrinsicWidth, sy = logicalH / source.intrinsicHeight; // 1, unless a rebuild gave the layer another size (it is then drawn stretched to the texture)\n let hidden = false;\n const hide = (): void => { display.visible = false; hidden = true; };\n hide();\n\n // drawn at the layer's own place in the frame: the timeline has put every layer at this frame before a three layer draws. The layer's own transform is left out (identity): its content is at (0, 0) to (width, height).\n // The stage's cull (Movie._renderNow) skips what is hidden, so the layers of the source keep the `culled` flag they got when they were last measured against the PICTURE: a layer of a screen that lies\n // beyond the picture's edge (a phone screen is taller than the picture), or one that was empty then (scale 0), stayed culled and was missing until a second draw. The texture is the layer's own\n // rectangle, not the picture: nothing in it is culled.\n const uncull = (c: Container): void => { if (c.culled) c.culled = false; for (const k of c.children) uncull(k); };\n const refresh = (): void => {\n const m = new Matrix().scale(sx, sy);\n display.visible = true;\n uncull(display);\n try { pixi.render({ container: display, target: rt, transform: m, clear: true, clearColor: [0, 0, 0, 0] }); } finally { display.visible = false; }\n if (gpuTexture) rt.source.updateMipmaps();\n if (readCanvas) {\n const g = readCanvas.getContext('2d')!;\n if (transparent) {\n // PixiJS's pixels are premultiplied by the alpha (and `extract.canvas` would treat them as straight: a half-transparent part would come out twice as dark): divide the alpha out\n const { pixels, width: w, height: h } = pixi.extract.pixels(rt);\n for (let i = 0; i < pixels.length; i += 4) {\n const a = pixels[i + 3]!;\n if (a > 0 && a < 255) { const k = 255 / a; pixels[i] = pixels[i]! * k; pixels[i + 1] = pixels[i + 1]! * k; pixels[i + 2] = pixels[i + 2]! * k; }\n }\n g.putImageData(new ImageData(pixels as unknown as Uint8ClampedArray<ArrayBuffer>, w, h), 0, 0);\n } else {\n // The mesh shows the layer OVER BLACK, as the other route does: a layer at alpha 0.5 shows half its colour. On WebGL PixiJS's bytes are premultiplied by the alpha (so over black they are the colour as\n // they stand, alpha set to 1); `extract.canvas` there would treat them as straight and darken a half-transparent layer twice. On WebGPU the canvas it gives is straight: composite it over black.\n if (pixi.name === 'webgl') {\n const { pixels, width: w, height: h } = pixi.extract.pixels(rt);\n for (let i = 3; i < pixels.length; i += 4) pixels[i] = 255;\n g.putImageData(new ImageData(pixels as unknown as Uint8ClampedArray<ArrayBuffer>, w, h), 0, 0);\n } else {\n g.globalCompositeOperation = 'source-over'; g.fillStyle = '#000'; g.fillRect(0, 0, width, height);\n g.drawImage(pixi.extract.canvas(rt) as unknown as CanvasImageSource, 0, 0);\n }\n }\n texture.needsUpdate = true;\n }\n };\n const stop = host.beforeDraw(refresh);\n refresh();\n\n let disposed = false;\n const handle: ThreeLayerTexture & Rebindable = {\n material, texture, width, height,\n source: () => current,\n sourceAt(u, v) {\n const t = texture as unknown as { updateMatrix?: () => void; matrix?: { elements: number[] } };\n t.updateMatrix?.();\n const e = t.matrix?.elements;\n const tu = e ? e[0]! * u + e[3]! * v + e[6]! : u, tv = e ? e[1]! * u + e[4]! * v + e[7]! : v; // the texture's own matrix: what the picture samples there\n return { x: tu, y: gpuTexture ? tv : 1 - tv }; // a shared texture's rows run top to bottom (its matrix holds the flip); an uploaded canvas is flipped by three\n },\n prepare(next) {\n const again = next.findLayer(name);\n if (disposed) return () => {};\n if (!again) throw new Error(`${label}: after a rebuild there is no layer \"${name}\" before the three layer any more`);\n return () => {\n current = again;\n display = again.target as Container;\n sx = logicalW / again.intrinsicWidth; sy = logicalH / again.intrinsicHeight; // a layer that changed size is drawn stretched to the texture\n hide();\n refresh();\n };\n },\n keepHidden() { if (hidden && !disposed) display.visible = false; }, // (the timeline can put it back: autoAlpha writes `visible`)\n dispose() {\n stop();\n if (hidden) { display.visible = true; hidden = false; }\n try { rt.destroy(true); } catch { /* the renderer is gone */ }\n texture.dispose?.(); material.dispose?.();\n },\n };\n const untrack = host.track(handle);\n handle.dispose = ((inner: () => void) => () => { if (disposed) return; disposed = true; untrack(); inner(); })(handle.dispose);\n return handle;\n}\n","/**\n * pixi-effects/three — optional three.js integration.\n *\n * Import this entry only when you use `type: 'three'` sequences; the core\n * `pixi-effects` entry never touches three.js. Call `registerThree()` once\n * before Movie.init builds a composition containing a three sequence.\n */\nimport { registerSequenceType, type SequenceCtor } from '../core/Composition';\nimport { ThreeSequence } from './ThreeSequence';\nimport { checkRendererKind, setPageRenderer, type ThreeRendererKind } from './defaults';\nimport type { SequenceSpec } from '../types';\nimport type { ThreeSequenceSpec } from './types';\n\nexport { ThreeSequence } from './ThreeSequence';\nexport { threeGltf, threeFrameCamera } from './gltf';\nexport { threeLayerTexture } from './layerTexture';\nexport type { ThreeLayerTexture, ThreeLayerTextureOptions } from './layerTexture';\nexport type { ThreeGltfModel, ThreeGltfOptions, ThreeFrameCameraOptions } from './gltf';\nexport type { ThreeContext, ThreeSetupResult, ThreeSequenceSpec } from './types';\nexport type { ThreeRendererKind } from './defaults';\n\n/**\n * Register the 'three' sequence type. Explicit call so `sideEffects: false` bundlers can't drop it; calling it again is fine.\n * `registerThree({ renderer: 'webgpu' })` makes every three layer that does not name a `renderer` of its own use three's WebGPU renderer; the default is `'webgl'`\n * (the last call wins).\n */\nexport function registerThree(options: { renderer?: ThreeRendererKind } = {}): void {\n const kind = options.renderer ?? 'webgl';\n checkRendererKind(kind, \"registerThree's renderer\");\n setPageRenderer(kind);\n registerSequenceType('three', ThreeSequence as unknown as SequenceCtor);\n}\n\n/**\n * Typing helper: accepts a strongly-typed three spec and returns it as a\n * core SequenceSpec, keeping three.js types out of the core union.\n */\nexport function three(spec: ThreeSequenceSpec): SequenceSpec {\n return spec as unknown as SequenceSpec;\n}\n"]}
1
+ {"version":3,"sources":["../src/three/defaults.ts","../src/three/spaceBridge.ts","../src/three/budget.ts","../src/three/ThreeSequence.ts","../src/three/gltf.ts","../src/three/layerTexture.ts","../src/three/index.ts"],"names":["PerspectiveCamera","label","Box3","Vector3","three"],"mappings":";;;;;;;AAGA,IAAI,YAAA,GAAkC,OAAA;AAE/B,SAAS,iBAAA,CAAkB,MAAe,KAAA,EAAkD;AACjG,EAAA,IAAI,IAAA,KAAS,OAAA,IAAW,IAAA,KAAS,QAAA,QAAgB,IAAI,KAAA,CAAM,CAAA,cAAA,EAAiB,KAAK,CAAA,kCAAA,EAAqC,IAAA,CAAK,SAAA,CAAU,IAAI,CAAC,CAAA,CAAA,CAAG,CAAA;AAC/I;AACO,SAAS,gBAAgB,IAAA,EAA+B;AAAE,EAAA,YAAA,GAAe,IAAA;AAAM;AAC/E,SAAS,eAAA,GAAqC;AAAE,EAAA,OAAO,YAAA;AAAc;ACI5E,IAAM,IAAA,GAAO,CAAA;AACb,IAAM,GAAA,GAAM,GAAA;AAGL,SAAS,gBAAA,CAAiB,MAAA,EAA2B,CAAA,EAAgB,MAAA,EAAsB;AAChG,EAAA,MAAA,CAAO,MAAM,CAAA,CAAE,GAAA;AACf,EAAA,MAAA,CAAO,MAAA,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A,IAAA,EAAK;AACL,MAAA,IAAI,MAAA,EAAQ;AAAE,QAAA,OAAA,CAAQ,OAAA,GAAU,IAAA;AAAM,QAAA,MAAA,GAAS,KAAA;AAAA,MAAO;AACtD,MAAA,IAAI;AAAE,QAAA,EAAA,CAAG,QAAQ,IAAI,CAAA;AAAA,MAAG,CAAA,CAAA,MAAQ;AAAA,MAA6B;AAC7D,MAAA,OAAA,CAAQ,OAAA,IAAU;AAAG,MAAA,QAAA,CAAS,OAAA,IAAU;AAAA,IAC1C;AAAA,GACF;AACA,EAAA,MAAM,OAAA,GAAU,IAAA,CAAK,KAAA,CAAM,MAAM,CAAA;AACjC,EAAA,MAAA,CAAO,OAAA,mBAAW,CAAA,CAAC,KAAA,KAAsB,MAAM;AAAE,IAAA,IAAI,QAAA,EAAU;AAAQ,IAAA,QAAA,GAAW,IAAA;AAAM,IAAA,OAAA,EAAQ;AAAG,IAAA,KAAA,EAAM;AAAA,EAAG,CAAA,EAAG,OAAO,OAAO,CAAA;AAC7H,EAAA,OAAO,MAAA;AACT;;;ACpMO,SAAS,aAAA,CAAc,OAAA,GAA4C,EAAC,EAAS;AAClF,EAAA,MAAM,IAAA,GAAO,QAAQ,QAAA,IAAY,OAAA;AACjC,EAAA,iBAAA,CAAkB,MAAM,0BAA0B,CAAA;AAClD,EAAA,eAAA,CAAgB,IAAI,CAAA;AACpB,EAAA,oBAAA,CAAqB,SAAS,aAAwC,CAAA;AACxE;AAMO,SAAS,MAAM,IAAA,EAAuC;AAC3D,EAAA,OAAO,IAAA;AACT","file":"three.js","sourcesContent":["/** The page-level default renderer of the three layers: `registerThree({ renderer })` sets it, a layer's own `renderer` wins. */\nexport type ThreeRendererKind = 'webgl' | 'webgpu';\n\nlet pageRenderer: ThreeRendererKind = 'webgl';\n\nexport function checkRendererKind(kind: unknown, where: string): asserts kind is ThreeRendererKind {\n if (kind !== 'webgl' && kind !== 'webgpu') throw new Error(`pixi-effects: ${where} must be 'webgl' or 'webgpu' (got ${JSON.stringify(kind)})`);\n}\nexport function setPageRenderer(kind: ThreeRendererKind): void { pageRenderer = kind; }\nexport function getPageRenderer(): ThreeRendererKind { return pageRenderer; }\n","/**\n * What lets a `three` layer live in the composition's space (`followCamera`, `followLights`): the composition's camera and lights, in three.\n *\n * The scene is in composition pixels with y flipped: a point the composition calls (x, y, z) is `new Vector3(x, -y, z)` here (the composition's y runs down, three's up;\n * +z is toward the viewer in both). A three camera with the composition camera's position, look-at point and vertical fov then projects that point to the pixel the\n * composition's own projection gives it (tests/three/spaceBridge.test.ts checks it to 1e-6 px).\n */\nimport { AmbientLight, Color, DirectionalLight, Fog, OrthographicCamera, PerspectiveCamera, PointLight, SRGBColorSpace, SpotLight, type Light, type Object3D, type Scene } from 'three';\nimport type { CameraState } from '../space/math';\nimport type { LightState } from '../space/lighting';\nimport type { FogState } from '../space/LitMaterial';\n\n/** The camera's near plane and far plane in composition pixels: the home camera sits about 740 px from the picture, a long dolly can be several thousand. */\nconst NEAR = 1;\nconst FAR = 20000;\n\n/** Put a three camera where the composition camera is. The aspect is the layer's (it must be the composition's: see `followCamera`). */\nexport function applyCameraState(camera: PerspectiveCamera, s: CameraState, aspect: number): void {\n camera.fov = s.fov;\n camera.aspect = aspect;\n camera.near = NEAR;\n camera.far = FAR;\n camera.up.set(0, 1, 0);\n camera.position.set(s.x, -s.y, s.z);\n const same = Math.hypot(s.lookAtX - s.x, s.lookAtY - s.y, s.lookAtZ - s.z) < 1e-9; // the composition then looks along -z\n camera.lookAt(same ? s.x : s.lookAtX, same ? -s.y : -s.lookAtY, same ? s.z - 1 : s.lookAtZ);\n camera.updateProjectionMatrix();\n camera.updateMatrixWorld();\n}\n\ninterface Entry { kind: LightState['kind']; light: Light; target: Object3D | null }\n\n/**\n * The composition's lights as three lights, one per light layer alive, in layer order. The objects are made once and moved every frame (a light that has ended is switched off,\n * not removed: the shader of a three layer must not be rebuilt as lights come and go).\n *\n * Intensity: three divides a diffuse surface by pi, so a light of intensity 1 is multiplied by pi to be \"as bright as the colour\" like a card's shading. Falloff: 'none' is no\n * attenuation; 'inverseSquare' is decay 2 with the intensity scaled so it is full at `radius` (it keeps rising inside it, where the composition's stays at 1); 'smooth' is three's\n * cut-off fitted to the composition's curve (see below). Shadows follow the light (castsShadows: the layer's own meshes cast and receive).\n */\nexport class LightMirror {\n private entries: Entry[] = [];\n /** True when a light alive casts shadows: the layer's renderer must have its shadow map on. */\n castsShadows = false;\n constructor(private readonly scene: Object3D, private readonly extent = 2000) {}\n\n update(lights: readonly LightState[]): void {\n this.castsShadows = lights.some((s) => s.castsShadows && s.kind !== 'ambient');\n lights.forEach((s, i) => {\n let e = this.entries[i];\n if (!e || e.kind !== s.kind) {\n if (e) this.remove(e);\n e = this.entries[i] = this.make(s.kind);\n }\n this.configure(e, s);\n });\n for (let i = lights.length; i < this.entries.length; i++) this.entries[i]!.light.visible = false;\n }\n\n dispose(): void {\n for (const e of this.entries) this.remove(e);\n this.entries = [];\n }\n\n private make(kind: LightState['kind']): Entry {\n const light: Light = kind === 'ambient' ? new AmbientLight() : kind === 'parallel' ? new DirectionalLight() : kind === 'spot' ? new SpotLight() : new PointLight();\n light.name = 'pixi-effects:composition-light';\n const target = (light as DirectionalLight | SpotLight).target ?? null;\n this.scene.add(light);\n if (target) this.scene.add(target);\n return { kind, light, target };\n }\n\n private remove(e: Entry): void {\n this.scene.remove(e.light);\n if (e.target) this.scene.remove(e.target);\n }\n\n private configure(e: Entry, s: LightState): void {\n const { light } = e;\n light.visible = true;\n light.color = (light.color ?? new Color()).setRGB(s.r, s.g, s.b, SRGBColorSpace);\n let intensity = s.intensity * Math.PI;\n if (s.kind !== 'ambient') {\n light.position.set(s.x, -s.y, s.z);\n e.target?.position.set(s.lookAtX, -s.lookAtY, s.lookAtZ);\n }\n if (s.kind === 'point' || s.kind === 'spot') {\n const l = light as PointLight | SpotLight;\n if (s.falloff === 'inverseSquare') { l.distance = 0; l.decay = 2; intensity *= s.radius * s.radius; }\n else if (s.falloff === 'smooth') {\n // The composition: 1 inside `radius`, a smoothstep down to 0 at radius + falloffDistance. three's cut-off distance D with decay 0 attenuates by saturate(1 - (d/D)^4)^2, a gentler curve that\n // starts to fall at once. A cut-off and a gain chosen from where the fall starts (p = radius / (radius + falloffDistance)) halve the largest difference over the range (0.15-0.40 with\n // D = radius + falloffDistance and no gain, 0.09-0.17 here for a fall that is not steep); a fall that is steep against its radius cannot be matched by three's curve.\n const reach = s.radius + Math.max(s.falloffDistance, 1e-3), p = s.radius / reach;\n l.distance = reach * (0.8 + 0.45 * p); l.decay = 0; intensity *= 0.87 + 0.45 * p;\n }\n else { l.distance = 0; l.decay = 0; }\n }\n if (s.kind === 'spot') {\n const l = light as SpotLight;\n l.angle = ((s.coneAngle / 2) * Math.PI) / 180;\n l.penumbra = s.coneFeather;\n }\n light.intensity = intensity;\n if (s.kind !== 'ambient') {\n const l = light as PointLight | SpotLight | DirectionalLight;\n l.castShadow = s.castsShadows;\n if (s.castsShadows) {\n l.shadow.mapSize.set(2048, 2048);\n l.shadow.intensity = s.shadowDarkness;\n l.shadow.radius = Math.max(1, s.shadowDiffusion / 4);\n // Scale-aware: three compares depths AFTER the perspective divide, so a bias of b is about b·d²/near world units at distance d from the light. A near plane of 1 px and a bias of\n // -0.0005 hid every caster within ~250 px of its receiver at 1280 x 720 (found by an AI trial). The near plane follows the size of the composition (~20 px at 1280 x 720) and the\n // bias is small, so the gap is about a pixel or two; normalBias (world units, along the surface normal) is a pixel or two too.\n l.shadow.bias = -0.00005;\n l.shadow.normalBias = this.extent / 1000;\n const cam = l.shadow.camera;\n cam.near = Math.max(1, this.extent / 128); cam.far = 20000;\n if (s.kind === 'parallel') { const o = cam as OrthographicCamera; o.left = -this.extent; o.right = this.extent; o.top = this.extent; o.bottom = -this.extent; }\n cam.updateProjectionMatrix();\n }\n }\n light.updateMatrixWorld?.();\n e.target?.updateMatrixWorld?.();\n }\n}\n\n/**\n * The composition camera's fog as the scene's `Fog`: the same colour, `near` and `far` (distances along the view, in composition pixels). three's Fog fades with `smoothstep` where the\n * composition's fades linearly, and has no amount below 1: close, not equal (see docs/dsl.md). The Fog is made when the camera has one and removed when it has not; a Fog the layer made\n * itself is never touched.\n */\nexport class FogMirror {\n private own: Fog | null = null;\n constructor(private readonly scene: Scene) {}\n\n update(fog: FogState | null): void {\n if (!fog) {\n if (this.own && this.scene.fog === this.own) this.scene.fog = null;\n this.own = null;\n return;\n }\n if (!this.own || this.scene.fog !== this.own) {\n if (this.scene.fog && this.scene.fog !== this.own) return; // the layer has its own fog: leave it\n this.own = new Fog(0x000000, fog.near, fog.far);\n this.scene.fog = this.own;\n }\n this.own.color.setRGB(fog.r, fog.g, fog.b, SRGBColorSpace);\n this.own.near = fog.near;\n this.own.far = fog.far;\n }\n\n dispose(): void { this.update(null); }\n}\n","/**\n * How many three layers a page can hold. Each `three` layer owns a renderer, and a browser keeps only so many live graphics contexts for a whole page: about 16 for WebGL, about 32 for\n * WebGPU (measured 2026-10-15 on Chrome: layers beyond it draw nothing, without an error). PixiJS and a `shader` layer use contexts of their own, so the warning comes a little before the\n * limit: more than 12 WebGL layers, more than 28 WebGPU layers. A WebGPU layer that draws on PixiJS's own GPU device has no context of its own and is not counted.\n */\nexport type ThreeKind = 'webgl' | 'webgpu';\n\nconst WARN_ABOVE: Record<ThreeKind, number> = { webgl: 12, webgpu: 28 };\nconst LIMIT: Record<ThreeKind, string> = { webgl: 'about 16 WebGL contexts', webgpu: 'about 32 WebGPU contexts' };\nconst live: Record<ThreeKind, number> = { webgl: 0, webgpu: 0 };\nconst warned = new Set<ThreeKind>();\n\n/** A three layer made its renderer: count it, and say once per kind when the page holds too many. */\nexport function trackThree(kind: ThreeKind): void {\n live[kind]++;\n if (live[kind] > WARN_ABOVE[kind] && !warned.has(kind)) {\n warned.add(kind);\n console.warn(`pixi-effects: ${live[kind]} three layers are alive with renderer: '${kind}', and a browser keeps ${LIMIT[kind]} for the whole page; layers beyond that draw nothing, without an error. ` +\n `Put several objects in one three layer, destroy layers that are over, ` + (kind === 'webgl' ? `or use renderer: 'webgpu' for some (in a movie PixiJS draws on WebGPU they share its GPU device and have no limit; otherwise it is about 32)` : `or use renderer: 'webgl' for some of them (a different pool of contexts), or leave shareGpu on in a movie PixiJS draws on WebGPU (the layers then share its device)`));\n }\n}\n\n/** A three layer let its renderer go. */\nexport function releaseThree(kind: ThreeKind): void {\n live[kind] = Math.max(0, live[kind] - 1);\n}\n\n/** What the page holds now, per renderer. */\nexport function threeBudget(): Record<ThreeKind, number> {\n return { ...live };\n}\n\n/** For tests: forget everything. */\nexport function resetThreeBudget(): void {\n live.webgl = live.webgpu = 0;\n warned.clear();\n}\n","import { Sprite, Texture, TextureSource } from 'pixi.js';\nimport { Box3, PerspectiveCamera, Plane, Quaternion, Raycaster, RenderTarget, Scene, Vector2, Vector3, WebGLRenderer, type Camera, type Object3D } from 'three';\nimport type { WebGPURenderer } from 'three/webgpu';\nimport { Sequence } from '../sequences/Base';\nimport { buildScope } from '../expr/Scope';\nimport { evaluateExpr } from '../expr/Parser';\nimport type { PathRouters } from '../core/Timeline';\nimport type { PropValue } from '../types';\nimport type { ThreeContext, ThreeSequenceSpec } from './types';\nimport { checkRendererKind, getPageRenderer } from './defaults';\nimport { applyCameraState, FogMirror, LightMirror } from './spaceBridge';\nimport { releaseThree, trackThree } from './budget';\nimport type { CanvasCheck } from '../sequences/Canvas';\nimport type { SharedGpu } from '../core/gpuShare';\nimport type { Rebindable, ThreeLayerHost } from './layerTexture';\nimport { NOT_PURE } from '../core/purity';\nimport { SetupValues } from '../core/setupValues';\n\n\nexport class ThreeSequence extends Sequence {\n private _renderer: WebGLRenderer | WebGPURenderer | null = null;\n /** The renderer this layer draws with (`'webgl'` or `'webgpu'`), once it is built. */\n renderer: 'webgl' | 'webgpu' | null = null;\n /** The backend under it: `'webgl'`, `'webgpu'`, or `'webgl2'` when three's WebGPURenderer found no WebGPU in this browser and used its own WebGL2 backend (the same picture). */\n backend: 'webgl' | 'webgpu' | 'webgl2' | null = null;\n private _gpu = false; // renderer: 'webgpu': async init and async render\n /** True when the layer draws on PixiJS's own GPU device into a texture PixiJS samples directly (no canvas of its own, no copy, no share of the page's context cap). */\n sharedGpu = false;\n private _rt: RenderTarget | null = null; // the texture a shared layer draws into\n private _sharedTexture: Texture | null = null;\n private _texture: Texture | null = null; // what the layer's sprite shows (the canvas's, or the shared render target's)\n /** What a rebuilt layer is compared with to take this one's place (core/reuse.ts); null: this layer is never kept (`reuse: false`, no `name`). */\n private _key: string | null = null;\n /** The layer of the tree being replaced whose state this one is using until the new tree is on stage (`commitReuse`): not this layer's to let go. */\n private _borrowed: ThreeSequence | null = null;\n /** True once another layer owns this layer's state: destroying this one must not let it go. */\n private _donated = false;\n /** What setup left on the objects the keyframes reach, shared with a layer that takes the scene over (core/setupValues.ts). */\n private _setupValues = new SetupValues();\n /** Things to do just before every draw (the 2D layers shown on meshes: `threeLayerTexture`), and those layers' handles. Both go with the state to a layer that takes it over. */\n private _drawHooks = new Set<() => void>();\n private _layerTextures: Rebindable[] = [];\n private _pendingRebinds: Array<() => void> = [];\n /** Every frame, whether this layer is alive or not: a 2D layer it shows stays off the stage (a tween of `autoAlpha` writes `visible = true` on it). */\n override syncFrame(): void {\n super.syncFrame();\n for (const h of this._layerTextures) h.keepHidden();\n }\n /** True when this layer shows 2D layers on its meshes (`threeLayerTexture`): the movie draws it after the rest of the frame is ready. */\n get showsLayers(): boolean { return this._layerTextures.length > 0; }\n private _scene: Scene | null = null;\n private _camera: Camera | null = null;\n private _ctx: ThreeContext | null = null;\n private _objects: Record<string, object> = {};\n private _warnedUpdate = false;\n private _warnedNodeFrame = false;\n private _warnedPaths = new Set<string>();\n private _lightMirror: LightMirror | null = null;\n private _fogMirror: FogMirror | null = null;\n private _warnedSpace = new Set<string>();\n private _tracked = false;\n /** Set when this layer lets its renderer go on purpose: the context loss that follows is its own doing, not the browser's. */\n private _closing = false;\n\n private get _threeSpec(): ThreeSequenceSpec {\n return this.spec as unknown as ThreeSequenceSpec;\n }\n\n protected override pathRouters(): PathRouters {\n return { three: (path) => this._resolveThreePath(path) };\n }\n\n async build(): Promise<void> {\n const spec = this._threeSpec;\n if (this.duration === undefined) {\n this.duration = this.parent?.duration ?? this.root.duration;\n }\n if (typeof spec.update === 'function' && NOT_PURE.test(spec.update.toString())) {\n console.warn(`pixi-effects: three layer${spec.name ? ` \"${spec.name}\"` : ''}: update calls Math.random, Date.now, performance.now or new Date, so it is not deterministic: the same frame would draw differently in playback, in a seek and in an export. Derive the value from t`);\n }\n\n // Resolve layer size. Expressions see the usual scope; intrinsic w/h are\n // still 0 here (same chicken-and-egg as shapes), so W/H/GW/GH carry it.\n const scope = buildScope(this, this.parent, this.root) as unknown as Record<string, number>;\n const width = resolveDim(spec.width, scope) ?? this.parent?.width ?? this.root.width;\n const height = resolveDim(spec.height, scope) ?? this.parent?.height ?? this.root.height;\n const resolution = spec.resolution ?? 1;\n\n const antialias = spec.antialias ?? true;\n const kind = spec.renderer ?? getPageRenderer();\n checkRendererKind(kind, \"a three layer's renderer\");\n this._gpu = kind === 'webgpu';\n this.renderer = kind;\n\n // A rebuild (setVars, resize) builds this layer while the old one still plays: when it cannot be told apart from one of the old tree it takes over that one's scene and renderer (setup does not run again).\n this._key = spec.reuse === false || !spec.name ? null\n : JSON.stringify([spec.name, idOf(spec.setup), width, height, resolution, antialias, kind, spec.shareGpu !== false && !!this.root.gpu, !!spec.followCamera, !!spec.followLights, !!spec.followFog]);\n const donor = this._key !== null ? (this.root.reuse?.claim(this._key, this) as ThreeSequence | null | undefined) : null;\n if (donor && donor._lendable()) { this._borrow(donor, width, height, spec.name); return; }\n\n // Offscreen canvas — never attached to the DOM. document.createElement\n // (not OffscreenCanvas) so PIXI's Texture.from and three both accept it.\n const canvas = document.createElement('canvas');\n let renderer: WebGLRenderer | WebGPURenderer;\n if (this._gpu) {\n let mod: typeof import('three/webgpu');\n try { mod = await import('three/webgpu'); } catch (err) {\n throw new Error(`pixi-effects: renderer: 'webgpu' needs three 0.17x or later with \"three/webgpu\" in the import map (${err instanceof Error ? err.message : err})`);\n }\n // On PixiJS's own GPU device when there is one (a WebGPU movie): the layer draws into a texture PixiJS samples, with no canvas of its own. Anything that goes wrong there is said once\n // and the layer is made again on a canvas of its own, before its setup has run.\n let shared = spec.shareGpu === false ? undefined : this.root.gpu;\n for (;;) {\n renderer = new mod.WebGPURenderer(shared ? { device: shared.device as never, alpha: true, antialias } : { canvas, alpha: true, antialias });\n this._renderer = renderer;\n if (!shared) this._track();\n // The device is made here: nothing may render before. Where there is no WebGPU three uses its own WebGL2 backend and says so with a warning: that is not a problem\n // (it draws the same picture), so it becomes `backend: 'webgl2'` instead of a line in the author's console.\n const warn = console.warn;\n let noGpu = false;\n console.warn = (...args: unknown[]) => { if (/WebGPU is not available/.test(String(args[0]))) noGpu = true; else warn.apply(console, args as []); };\n try {\n await renderer.init();\n if (shared) { renderer.setSize(Math.round(width * resolution), Math.round(height * resolution), false); renderer.setClearColor(0x000000, 0); this._prepareShared(renderer, shared, width, height, resolution, antialias); }\n this.backend = noGpu ? 'webgl2' : 'webgpu';\n break;\n } catch (err) {\n this._disposeRenderer();\n if (!shared) throw err;\n console.warn(`pixi-effects: three layer${spec.name ? ` \"${spec.name}\"` : ''}: could not draw on PixiJS's GPU device (${err instanceof Error ? err.message : err}); it uses a canvas of its own (shareGpu: false does this on purpose)`);\n shared = undefined;\n this._closing = false;\n } finally { console.warn = warn; }\n }\n } else {\n renderer = new WebGLRenderer({ canvas, alpha: true, antialias });\n this._renderer = renderer;\n this._track();\n let said = false;\n canvas.addEventListener('webglcontextlost', () => { // the browser took the context away: the layer draws nothing from now on\n if (said || this._closing) return; // not the browser's doing: this layer is letting its context go\n said = true;\n console.warn(`pixi-effects: three layer${spec.name ? ` \"${spec.name}\"` : ''}: the browser took this layer's WebGL context away (a page keeps about 16 for all its layers, PixiJS and shader layers: too many were alive), so the layer draws nothing. Put several objects in one three layer, or destroy layers that are over`);\n });\n this.backend = 'webgl';\n }\n try {\n renderer.setSize(Math.round(width * resolution), Math.round(height * resolution), false);\n renderer.setClearColor(0x000000, 0);\n\n const scene = new Scene();\n const camera: Camera = new PerspectiveCamera(50, width / height, 0.1, 2000);\n const ctx: ThreeContext = { scene, camera, renderer, width, height, _host: this._makeHost() };\n if (spec.followCamera) this._checkFollowShape(width, height, spec.name);\n\n let result: Awaited<ReturnType<ThreeSequenceSpec['setup']>>;\n try { result = await spec.setup(ctx); } catch (err) { throw this._gpu ? this._explainWebGpuError(err, spec.name) : err; }\n if (result?.camera) ctx.camera = result.camera;\n this._scene = scene;\n this._camera = ctx.camera;\n this._ctx = ctx;\n this._objects = { ...(result?.objects ?? {}) };\n if (!('camera' in this._objects)) this._objects.camera = this._camera;\n\n if (this._gpu) this._checkWebGpuMaterials(scene, spec.name);\n // Frame 0 so the texture is never blank before the first tick.\n this._draw(0);\n\n this._texture = this._sharedTexture ?? Texture.from(canvas);\n this._makeSprite(this._texture, width, height, spec.name);\n } catch (err) {\n this._disposeRenderer();\n throw err;\n }\n }\n\n private _makeSprite(texture: Texture, width: number, height: number, name: string | undefined): void {\n const sprite = new Sprite({ texture, label: name });\n sprite.cullable = true;\n // Texture is canvas-sized (layer px × resolution); scale back to comp px.\n sprite.width = width;\n sprite.height = height;\n this.target = sprite;\n this.intrinsicWidth = width;\n this.intrinsicHeight = height;\n this.buildFilters();\n }\n\n /** The 2D layer that a material shows (`threeLayerTexture`), for a click on the mesh to reach it (movie.pick); null for any other material. */\n screenOf(material: unknown): { source: Sequence; at(u: number, v: number): { x: number; y: number } } | null {\n const handle = this._layerTextures.find((h) => h.material === material);\n return handle ? { source: handle.source(), at: (u, v) => handle.sourceAt(u, v) } : null;\n }\n\n /** What `threeLayerTexture` asks of this layer: the layers listed before it, PixiJS's renderer, whether the GPU device is shared, and a place to hook in before every draw. */\n private _makeHost(): ThreeLayerHost {\n return {\n findLayer: (name) => this.parent?.findLayer?.(name) ?? null,\n layerNames: () => this.parent?.layerNames?.() ?? [],\n pixiRenderer: this.root.pixiRenderer ?? null,\n shared: this.sharedGpu,\n beforeDraw: (fn) => { this._drawHooks.add(fn); return () => { this._drawHooks.delete(fn); }; },\n track: (handle) => { this._layerTextures.push(handle); return () => { const i = this._layerTextures.indexOf(handle); if (i >= 0) this._layerTextures.splice(i, 1); }; },\n };\n }\n\n /** Reuse (core/reuse.ts): the key this layer is matched by, while it can still lend its state. */\n reuseKey(): string | null { return this._renderer && !this._donated && !this._closing ? this._key : null; }\n private _lendable(): boolean { return this.reuseKey() !== null && !!this._scene && !!this._ctx && !!this._texture; }\n\n /** Take over a layer of the tree being replaced: its scene, renderer, texture and mirrors. Nothing is drawn until the new tree is on stage; the old layer goes on drawing meanwhile. */\n private _borrow(d: ThreeSequence, width: number, height: number, name: string | undefined): void {\n this.renderer = d.renderer; this.backend = d.backend; this._gpu = d._gpu; this.sharedGpu = d.sharedGpu;\n this._renderer = d._renderer; this._scene = d._scene; this._camera = d._camera; this._ctx = d._ctx; this._objects = d._objects; this._setupValues = d._setupValues;\n this._rt = d._rt; this._sharedTexture = d._sharedTexture; this._texture = d._texture;\n this._lightMirror = d._lightMirror; this._fogMirror = d._fogMirror; this._tracked = d._tracked;\n this._borrowed = d;\n this._drawHooks = d._drawHooks; this._layerTextures = d._layerTextures;\n const host = this._makeHost();\n this._pendingRebinds = this._layerTextures.map(h => h.prepare(host)); // the 2D layers of the new tree are shown from the swap on (commitReuse), not before: the old layer goes on drawing its own\n if (this.spec && (this._threeSpec as { followCamera?: boolean }).followCamera) this._checkFollowShape(width, height, name);\n this._makeSprite(this._texture!, width, height, name);\n }\n\n /** The new tree is on stage: the layer this one borrowed from has given its state away for good. */\n commitReuse(): void {\n const d = this._borrowed;\n if (!d) return;\n this._setupValues.restore(); // the new timeline starts from setup's picture (the frame drawn next writes the rest)\n d._donated = true; d._tracked = false;\n this._borrowed = null;\n for (const apply of this._pendingRebinds) apply();\n this._pendingRebinds = [];\n }\n\n /**\n * Per-frame sync hook. Movie._awaitVideoFrames duck-types on this method\n * (same contract as VideoSequence) and awaits it inside gotoFrame — the\n * single frame path shared by playback and export, which is what makes\n * three layers deterministic in both.\n */\n async awaitFrameAt(local: number): Promise<void> {\n if (!this._renderer || !this._scene || !this._camera || !this._ctx) return;\n const spec = this._threeSpec;\n const t = Math.max(0, Math.min(local, this.duration ?? local));\n this._followSpace(t);\n if (spec.update) {\n try {\n spec.update(t, this._ctx);\n } catch (err) {\n if (!this._warnedUpdate) {\n this._warnedUpdate = true;\n console.warn('pixi-effects: three update() threw (reported once) —', err);\n }\n }\n }\n this._draw(t);\n if (!this.sharedGpu) (this.target as Sprite | null)?.texture.source.update(); // a shared layer's texture is the GPU's own: it is already the new picture\n }\n\n /**\n * `movie.pick`: a ray through the point (u, v) of the layer's picture (0..1, v down) from the layer's camera, and what it meets first: the object's name (its own, or its nearest\n * ancestor's that has one), where, and how far from the camera. Invisible objects and groups are not met. null when the ray meets nothing.\n */\n pickAt(u: number, v: number): { object: string; point: [number, number, number]; distance: number; object3d: Object3D; uv?: { u: number; v: number }; material?: unknown } | null {\n const scene = this._scene, camera = this._camera;\n if (!scene || !camera) return null;\n scene.updateMatrixWorld();\n camera.updateMatrixWorld();\n const ray = new Raycaster();\n ray.setFromCamera(new Vector2(u * 2 - 1, -(v * 2 - 1)), camera);\n const visibleChain = (o: Object3D | null): boolean => { for (let n = o; n; n = n.parent) if (!n.visible) return false; return true; };\n for (const hit of ray.intersectObjects(scene.children, true)) {\n if (!visibleChain(hit.object)) continue;\n let name = '';\n for (let n: Object3D | null = hit.object; n && n !== scene; n = n.parent) if (n.name) { name = n.name; break; }\n const m = (hit.object as unknown as { material?: unknown }).material;\n const material = Array.isArray(m) ? m[hit.face?.materialIndex ?? 0] : m;\n return { object: name, point: hit.point.toArray() as [number, number, number], distance: hit.distance, object3d: hit.object, ...(hit.uv ? { uv: { u: hit.uv.x, v: hit.uv.y } } : {}), material };\n }\n return null;\n }\n\n /**\n * `hit.three.grab(plane)`: drag a grabbed point of the scene. Returns a function of a point (u, v) of the layer's picture (0..1, v down) that gives where the pointer's ray through the layer's\n * camera meets a plane through the grabbed point, and how far that is from the grabbed point (`delta`): move the object by it and it follows the pointer exactly. `plane`: `'screen'` (facing the\n * camera: the default), `'floor'` (horizontal, the three y up), `'wall'` (z constant), or a normal `[x, y, z]`. null where the ray never meets it (a floor seen edge-on, behind the camera).\n */\n dragPlane(point: [number, number, number], plane: 'screen' | 'floor' | 'wall' | [number, number, number] = 'screen'): (u: number, v: number) => { point: [number, number, number]; delta: [number, number, number] } | null {\n const grabbed = new Vector3(...point);\n let normal: Vector3;\n if (plane === 'floor') normal = new Vector3(0, 1, 0);\n else if (plane === 'wall') normal = new Vector3(0, 0, 1);\n else if (Array.isArray(plane)) normal = new Vector3(...plane).normalize();\n else {\n const turn = new Quaternion();\n this._camera?.updateMatrixWorld();\n this._camera?.getWorldQuaternion(turn);\n normal = new Vector3(0, 0, 1).applyQuaternion(turn); // the camera looks along -z: its back is the plane's normal\n }\n const surface = new Plane().setFromNormalAndCoplanarPoint(normal, grabbed);\n return (u, v) => {\n const scene = this._scene, camera = this._camera;\n if (!scene || !camera) return null;\n scene.updateMatrixWorld();\n camera.updateMatrixWorld();\n const ray = new Raycaster();\n ray.setFromCamera(new Vector2(u * 2 - 1, -(v * 2 - 1)), camera);\n const at = ray.ray.intersectPlane(surface, new Vector3());\n if (!at) return null;\n return { point: at.toArray() as [number, number, number], delta: at.clone().sub(grabbed).toArray() as [number, number, number] };\n };\n }\n\n /**\n * The determinism check (`check`, `movie.review()`): the scene drawn at a few moments in two orders, with one draw thrown away first, and the pictures compared, as the canvas layer\n * does. A layer whose same frame is not the same picture (a clock, `Math.random`, a mixer advanced with `update(dt)`, any state that builds up from call to call) is reported.\n * It runs the layer's own `update`, draws with its renderer and reads the picture from the renderer's canvas in the same task; the next real frame draws again, so nothing is left behind.\n */\n checkDeterminism(times: number[]): CanvasCheck {\n const none: CanvasCheck = { differs: [], drawMs: 0, threw: [] };\n const renderer = this._renderer, ctx = this._ctx;\n if (!renderer || !this._scene || !this._camera || !ctx) return none;\n const source = (renderer as unknown as { domElement: HTMLCanvasElement }).domElement;\n const w = source.width, h = source.height;\n const scratch = document.createElement('canvas');\n scratch.width = w; scratch.height = h;\n const g = scratch.getContext('2d', { willReadFrequently: true });\n if (!g) return none;\n const keep = w * h * 4 * times.length <= 96e6;\n const hash = (d: Uint8ClampedArray): number => { let x = 0x811c9dc5; for (let i = 0; i < d.length; i++) { x ^= d[i]!; x = Math.imul(x, 0x01000193); } return x >>> 0; };\n const ms: number[] = [];\n const threw = new Set<number>();\n const once = (t: number, timed: boolean): Uint8ClampedArray => {\n const from = performance.now();\n try {\n this._followSpace(t);\n this._threeSpec.update?.(t, ctx);\n this._draw(t, true); // (a shared layer draws to the renderer's own canvas here: the same scene and update, the picture readable now)\n g.clearRect(0, 0, w, h);\n g.drawImage(source, 0, 0);\n } catch { threw.add(t); }\n if (timed) { g.getImageData(0, 0, 1, 1); ms.push(performance.now() - from); }\n return g.getImageData(0, 0, w, h).data;\n };\n for (const t of times) once(t, false); // the warm-up\n const first = times.map(t => { const d = once(t, true); return keep ? d.slice() : hash(d); });\n const second = [...times].reverse().map(t => once(t, false)).reverse();\n scratch.width = scratch.height = 1;\n const differs: CanvasCheck['differs'] = [];\n times.forEach((t, i) => {\n const a = first[i]!, b = second[i]!;\n if (typeof a === 'number') { if (a !== hash(b)) differs.push({ t, pixels: -1, maxDiff: -1 }); return; }\n let pixels = 0, maxDiff = 0;\n for (let k = 0; k < a.length; k++) { const d = Math.abs(a[k]! - b[k]!); if (d) { pixels++; if (d > maxDiff) maxDiff = d; } }\n if (pixels) differs.push({ t, pixels, maxDiff });\n });\n ms.sort((x, y) => x - y);\n return { differs: differs.filter(d => !threw.has(d.t)), drawMs: ms.length ? ms[Math.floor(ms.length / 2)]! : 0, threw: times.filter(t => threw.has(t)) };\n }\n\n /** `followCamera` / `followLights`: before each frame, ask the composition for its camera and lights at this moment (the layer's time on the composition's clock) and mirror them in the scene. */\n private _followSpace(t: number): void {\n const spec = this._threeSpec;\n if (!spec.followCamera && !spec.followLights && !spec.followFog) return;\n const ctx = this._ctx, scene = this._scene;\n if (!ctx || !scene) return;\n if (!this.parent?.spaceAt) {\n this._saidOnce('parent', `followCamera / followLights / followFog need the layer to sit in a composition that has a camera or a light to follow; this layer's parent cannot say (it keeps its own camera and lights)`, spec.name);\n return;\n }\n const space = this.parent.spaceAt((this.absoluteStart ?? this.at) + t);\n ctx.space = space;\n if (spec.followCamera) {\n const camera = ctx.camera as PerspectiveCamera;\n if (!camera.isPerspectiveCamera) this._saidOnce('camera', `followCamera needs a PerspectiveCamera (this layer's camera is a ${(ctx.camera as { type?: string }).type ?? 'different camera'}); it keeps it as it is`, spec.name);\n else applyCameraState(camera, space.camera, ctx.width / ctx.height);\n }\n if (spec.followLights) {\n const mirror = (this._lightMirror ??= new LightMirror(scene, Math.max(ctx.width, ctx.height) * 2));\n mirror.update(space.lights);\n if (!this._warnedSpace.has('inverseSquare')) this._checkInverseSquare(space.lights, scene, spec.name);\n if (mirror.castsShadows && !ctx.renderer.shadowMap.enabled) ctx.renderer.shadowMap.enabled = true;\n }\n if (spec.followFog) {\n if (space.fog && space.fog.amount !== 1) this._saidOnce('fogAmount', `followFog: the camera's fogAmount is ${space.fog.amount}, and three's Fog has no amount below 1: the layer uses the full amount (set fogColor to the colour you want at the far end, or leave followFog off and make the fog yourself from ctx.space.fog)`, spec.name);\n (this._fogMirror ??= new FogMirror(scene)).update(space.fog);\n }\n }\n\n /**\n * An inverse-square light is held at full strength inside its `radius` by the composition; three's decay-2 light keeps rising (4x at half the radius, 11x at a third). When the scene has\n * an object closer to such a light than 0.8 of its radius, say so once, with the way out. (The check is the scene's bounding box against the light's place: no object is measured.)\n */\n private _checkInverseSquare(lights: ReadonlyArray<{ kind: string; falloff: string; radius: number; x: number; y: number; z: number }>, scene: Scene, name: string | undefined): void {\n const near = lights.filter((l) => l.falloff === 'inverseSquare' && (l.kind === 'point' || l.kind === 'spot'));\n if (!near.length) return;\n const box = new Box3().setFromObject(scene);\n if (box.isEmpty()) return;\n for (const l of near) {\n const d = box.distanceToPoint(new Vector3(l.x, -l.y, l.z));\n if (d < 0.8 * l.radius) {\n this._saidOnce('inverseSquare', `followLights: a light with falloff 'inverseSquare' and radius ${l.radius} is only ${Math.round(d)} px from the nearest part of the scene. The composition holds such a light at full strength inside its radius; three's inverse-square light keeps rising there (${(Math.pow(l.radius / Math.max(d, 1), 2)).toFixed(1)}x at that distance), so those parts come out much brighter. Make the radius smaller than that distance, or use falloff 'smooth' (it is fitted to the composition's curve)`, name);\n return;\n }\n }\n }\n\n /** followCamera shows the whole composition through the layer's picture: a layer of another shape would show it squeezed or cut. Said once at build. */\n private _checkFollowShape(width: number, height: number, name: string | undefined): void {\n const p = this.parent;\n if (!p || !(p.width > 0 && p.height > 0)) return;\n if (Math.abs(width * p.height - height * p.width) <= 1e-3 * width * p.height) return;\n this._saidOnce('shape', `followCamera: the layer is ${width} x ${height} but the composition is ${p.width} x ${p.height}; the camera shows the whole composition, so the layer needs its aspect ratio (drop width / height to cover the composition)`, name);\n }\n\n private _saidOnce(key: string, message: string, name: string | undefined): void {\n if (this._warnedSpace.has(key)) return;\n this._warnedSpace.add(key);\n console.warn(`pixi-effects: three layer${name ? ` \"${name}\"` : ''}: ${message}`);\n }\n\n /**\n * One render of the scene at the layer-local time `t`. WebGPURenderer.render() needs `await init()` first (done in build); it queues the GPU work, and PixiJS reads the canvas after.\n *\n * Three's WebGPU node system updates the light uniforms (and its `time`) once per FRAME ID, and bumps that id in its own requestAnimationFrame loop only. Renders that\n * follow each other in one task (a seek, an export) would all show the lights of the last animation frame: a lamp keyframed with `three.lamp.intensity` would not move.\n * So before each render the layer advances the node frame itself, and gives `time` the layer's own time (not three's wall clock).\n */\n private _draw(t: number, toCanvas = false): void {\n if (!this._renderer || !this._scene || !this._camera) return;\n for (const hook of this._drawHooks) hook(); // the 2D layers shown on meshes are drawn into their textures first\n if (this._gpu) this._advanceNodeFrame(t);\n if (!this._rt || toCanvas) { this._renderer.render(this._scene, this._camera); return; }\n // A shared layer draws into its texture. setOutputRenderTarget (not setRenderTarget) keeps the canvas route's output pass: tone mapping, the sRGB encode, fog and the multisample resolve.\n const r = this._renderer as unknown as { setOutputRenderTarget(rt: RenderTarget | null): void; setRenderTarget(rt: RenderTarget | null): void };\n r.setOutputRenderTarget(this._rt);\n try { this._renderer.render(this._scene, this._camera); } finally { r.setOutputRenderTarget(null); r.setRenderTarget(null); } // (three leaves the output target set as the render target too)\n }\n\n /**\n * A shared layer's texture: a render target of the layer's size, drawn into once (the GPU texture exists only after a draw) and adopted by a PixiJS texture source. Throws when something\n * is not as this expects (the build then makes the layer again on a canvas of its own). Done before `setup`, so nothing the author made yet depends on the renderer.\n */\n private _prepareShared(renderer: WebGPURenderer, shared: SharedGpu, width: number, height: number, resolution: number, antialias: boolean): void {\n const w = Math.round(width * resolution), h = Math.round(height * resolution);\n const rt = new RenderTarget(w, h, { depthBuffer: true, samples: antialias ? 4 : 0 });\n this._rt = rt;\n const r = renderer as unknown as { setOutputRenderTarget(rt: RenderTarget | null): void; setRenderTarget(rt: RenderTarget | null): void; backend?: { get?(t: unknown): { texture?: { format?: string; createView?: unknown } } | undefined } };\n if (typeof r.setOutputRenderTarget !== 'function') throw new Error('this three has no setOutputRenderTarget');\n r.setOutputRenderTarget(rt);\n try { renderer.render(new Scene(), new PerspectiveCamera()); } finally { r.setOutputRenderTarget(null); r.setRenderTarget(null); }\n const gpuTexture = r.backend?.get?.(rt.texture)?.texture;\n if (!gpuTexture || typeof gpuTexture.createView !== 'function') throw new Error(\"three keeps no GPU texture for a render target\");\n const source = new TextureSource({ width: w, height: h, format: gpuTexture.format as never, label: 'three layer (shared GPU)' });\n shared.adopt(source, gpuTexture);\n this._sharedTexture = new Texture({ source });\n this.sharedGpu = true;\n }\n\n /**\n * The author chose renderer: 'webgpu'. Three's WebGPU renderer turns materials into node materials: a ShaderMaterial / RawShaderMaterial cannot run there (three logs an error on\n * every render and draws a default material) and `onBeforeCompile` (a patch of the WebGL shader text) is ignored without a word. Stop, once, naming the first such material and the fix,\n * instead of drawing a picture that is wrong without saying so.\n */\n private _checkWebGpuMaterials(scene: Scene, layerName: string | undefined): void {\n const bad: string[] = [];\n const seen = new Set<unknown>();\n const check = (m: unknown): void => {\n if (!m || typeof m !== 'object' || seen.has(m)) return;\n seen.add(m);\n const mat = m as { type?: string; name?: string; isShaderMaterial?: boolean; isRawShaderMaterial?: boolean };\n const label = `${mat.name ? `\"${mat.name}\" ` : ''}${mat.type ?? 'material'}`;\n if (mat.isShaderMaterial || mat.isRawShaderMaterial) bad.push(`${label} is a ShaderMaterial (it cannot run on the WebGPU renderer)`);\n else if (Object.prototype.hasOwnProperty.call(mat, 'onBeforeCompile')) bad.push(`${label} sets onBeforeCompile (the WebGPU renderer ignores it)`);\n };\n scene.traverse?.((o: unknown) => {\n const mats = (o as { material?: unknown }).material;\n for (const m of Array.isArray(mats) ? mats : [mats]) check(m);\n });\n if (!bad.length) return;\n this._disposeRenderer();\n throw new Error(`pixi-effects: three layer${layerName ? ` \"${layerName}\"` : ''} with renderer: 'webgpu': ${bad[0]}${bad.length > 1 ? ` (and ${bad.length - 1} more)` : ''}. ` +\n `Add renderer: 'webgl' to this layer (or registerThree({ renderer: 'webgl' }) for the page), or write the look with three's node materials (TSL).`);\n }\n\n /** The one setup failure everybody meets on the WebGPU renderer: a PMREMGenerator imported from 'three' reads WebGL state the WebGPU renderer does not have. */\n private _explainWebGpuError(err: unknown, layerName: string | undefined): unknown {\n if (err instanceof TypeError && /reading 'buffers'|renderer\\.state/.test(err.message)) {\n return new Error(`pixi-effects: three layer${layerName ? ` \"${layerName}\"` : ''} with renderer: 'webgpu': setup used a WebGL-only helper, most likely a PMREMGenerator imported from 'three'. ` +\n `Import it from 'three/webgpu' (import * as THREE from 'three/webgpu'), or add renderer: 'webgl' to this layer.`, { cause: err });\n }\n return err;\n }\n\n private _advanceNodeFrame(t: number): void {\n const frame = (this._renderer as unknown as { _nodes?: { nodeFrame?: { update?: () => void; time: number; deltaTime: number } } })._nodes?.nodeFrame;\n if (!frame || typeof frame.update !== 'function') {\n if (!this._warnedNodeFrame) {\n this._warnedNodeFrame = true;\n console.warn(\"pixi-effects: this three has no node frame to advance (renderer: 'webgpu'): a light animated by keyframes may not follow the time in a seek or an export; use renderer: 'webgl' or report the three version\");\n }\n return;\n }\n frame.update();\n frame.time = t;\n frame.deltaTime = 1 / ((this.root as { frameRate?: number }).frameRate ?? 30);\n }\n\n private _resolveThreePath(path: string): { target: object; prop: string } | null {\n const segs = path.split('.');\n if (segs.length < 2) {\n this._warnPath(path, 'needs at least <object>.<prop>');\n return null;\n }\n let obj: unknown = this._objects[segs[0]!];\n if (obj == null) {\n this._warnPath(path, `unknown object \"${segs[0]}\" — expose it via setup's { objects }`);\n return null;\n }\n for (let i = 1; i < segs.length - 1; i++) {\n obj = (obj as Record<string, unknown>)[segs[i]!];\n if (obj == null) {\n this._warnPath(path, `\"${segs[i]}\" is undefined along the path`);\n return null;\n }\n }\n const prop = segs[segs.length - 1]!;\n if (typeof obj !== 'object' || !(prop in (obj as object))) {\n this._warnPath(path, `no property \"${prop}\"`);\n return null;\n }\n return this._borrowed ? this._setupValues.view(obj as object, prop, () => this._borrowed !== null) : (this._setupValues.note(obj as object, prop), { target: obj as object, prop });\n }\n\n private _warnPath(path: string, why: string): void {\n if (this._warnedPaths.has(path)) return;\n this._warnedPaths.add(path);\n console.warn(`pixi-effects: keyframe path three.${path} ${why}; skipped`);\n }\n\n /** Count this layer's renderer against the page's allowance of graphics contexts (given back when the renderer is disposed). */\n private _track(): void {\n this._tracked = true;\n trackThree(this._gpu ? 'webgpu' : 'webgl');\n }\n\n private _disposeRenderer(): void {\n if (!this._renderer) return;\n this._closing = true;\n if (this._tracked) { this._tracked = false; releaseThree(this._gpu ? 'webgpu' : 'webgl'); }\n try {\n this._renderer.dispose();\n if (!this._gpu) (this._renderer as WebGLRenderer).forceContextLoss();\n } catch (err) {\n console.warn('pixi-effects: three renderer dispose threw —', err);\n }\n this._renderer = null;\n try { this._rt?.dispose(); } catch { /* the renderer took the texture with it */ }\n this._rt = null;\n }\n\n override destroy(): void {\n const spec = this._threeSpec;\n // another layer has this layer's state, or has not yet let go of it (a rebuild in progress): the scene, the renderer and the texture are not this layer's to let go\n const kept = this._donated || this._borrowed !== null;\n if (!kept && this._ctx && spec.dispose) {\n try { spec.dispose(this._ctx); } catch (err) {\n console.warn('pixi-effects: three dispose() threw —', err);\n }\n }\n const texture = this._texture;\n if (!kept) {\n for (const h of this._layerTextures) { try { h.dispose(); } catch { /* the 2D layer is gone with its tree */ } }\n this._lightMirror?.dispose();\n this._fogMirror?.dispose();\n this._disposeRenderer();\n }\n this._lightMirror = null;\n this._fogMirror = null;\n this._renderer = null;\n this._rt = null;\n this._scene = null;\n this._camera = null;\n this._ctx = null;\n this._objects = {};\n super.destroy();\n if (!kept) texture?.destroy(true); // canvas-backed source is per-sequence; safe to kill (a shared layer's source owns no GPU texture: the render target did)\n this._texture = null;\n this._sharedTexture = null;\n }\n}\n\nfunction resolveDim(v: PropValue | undefined, scope: Record<string, number>): number | undefined {\n if (v === undefined) return undefined;\n if (typeof v === 'number') return v;\n return evaluateExpr(v, scope);\n}\n\n/** A number for each function: two layers are the same layer only when their `setup` is the same function. */\nconst ids = new WeakMap<object, number>();\nlet lastId = 0;\nfunction idOf(fn: unknown): number {\n if (typeof fn !== 'function') return 0;\n let id = ids.get(fn);\n if (id === undefined) { id = ++lastId; ids.set(fn, id); }\n return id;\n}\n","/**\n * Two helpers for a glTF model in a `three` layer's `setup` / `update` (the layer stays the free box; these are what is easy to get wrong by hand):\n *\n * const fox = await threeGltf('Fox.glb', { animation: 'Run' }); // in setup\n * ctx.scene.add(fox.object); threeFrameCamera(ctx.camera, fox.object);\n * ... update: (t) => fox.pose(t) // the clip at the layer's time: a function of t, never of a clock\n *\n * The loader is an addon: a page that never calls `threeGltf` never loads it (the import map needs `\"three/addons/\"` next to `\"three\"`).\n */\nimport { AnimationMixer, Box3, Group, LoopOnce, LoopRepeat, Vector3, type AnimationClip, type Camera, type Object3D, type PerspectiveCamera } from 'three';\n\nexport interface ThreeGltfOptions {\n /** A clip name, a clip index, or `false` (no animation: the model's bind pose). Default: the first clip, if the file has one. */\n animation?: string | number | false;\n /** The clip time is `t × speed + offset` (the layer's seconds). Defaults 1 and 0. */\n speed?: number;\n offset?: number;\n /** `true` (default): the clip repeats; `false`: it holds its last pose. */\n loop?: boolean;\n}\n\nexport interface ThreeGltfModel {\n /** Add this to `ctx.scene`. A group whose origin is the centre of the model's bounding box (bind pose): position, turn and `fit` it about its centre. */\n object: Group;\n /** The names of the clips the file has. */\n clips: string[];\n /** The size of the model's bounding box in the file's own units (bind pose, before `fit`). */\n size: Vector3;\n /** Pose the model at the layer's time `t` (seconds). `AnimationMixer.setTime` evaluates the clip from zero every call: a seek, an export and a repeat give the same pose. */\n pose(t: number): void;\n /** Scale `object` so the model's longest side is `px` (a model in metres in a scene in composition pixels). */\n fit(px: number): void;\n /** Stop the clip. Geometries, materials and textures are yours to dispose with the scene. */\n dispose(): void;\n}\n\nexport async function threeGltf(url: string, options: ThreeGltfOptions = {}): Promise<ThreeGltfModel> {\n const label = 'pixi-effects: threeGltf';\n if (typeof url !== 'string' || !url) throw new Error(`${label}: the first argument is the URL of a .glb or .gltf file`);\n let GLTFLoader: typeof import('three/addons/loaders/GLTFLoader.js').GLTFLoader;\n try { ({ GLTFLoader } = await import('three/addons/loaders/GLTFLoader.js')); } catch (err) {\n throw new Error(`${label}: needs \"three/addons/\" in the import map next to \"three\" (${err instanceof Error ? err.message : err})`);\n }\n let gltf: Awaited<ReturnType<InstanceType<typeof GLTFLoader>['loadAsync']>>;\n try { gltf = await new GLTFLoader().loadAsync(url); } catch (err) {\n throw new Error(`${label}: could not load \"${url}\" (${err instanceof Error ? err.message : err})`, { cause: err });\n }\n\n const clips: AnimationClip[] = gltf.animations ?? [];\n let clip: AnimationClip | undefined;\n const wanted = options.animation;\n if (wanted === false || (wanted === undefined && clips.length === 0)) clip = undefined;\n else if (wanted === undefined) clip = clips[0];\n else {\n clip = typeof wanted === 'number' ? clips[wanted] : clips.find((c) => c.name === wanted);\n if (!clip) throw new Error(`${label}: \"${url}\" has no animation ${JSON.stringify(wanted)}; its clips: ${clips.length ? clips.map((c, i) => `${i}: \"${c.name}\"`).join(', ') : '(none)'}`);\n }\n\n // The origin of the group is the centre of the box, so the model is placed and turned about its centre.\n const root: Object3D = gltf.scene;\n // A skinned mesh is always drawn. three culls a mesh by a bounding sphere, and a skinned mesh's sphere does not follow its animation or its place: a model that MOVES and throws a shadow\n // drew its shadow differently depending on the frames drawn before it (found on the Khronos Fox: `check` reported the layer as not a function of the time; with culling off the\n // pictures are the same in any order). The cost is that an off-screen model is still drawn.\n root.traverse((o) => { if ((o as { isSkinnedMesh?: boolean }).isSkinnedMesh) o.frustumCulled = false; });\n const object = new Group();\n object.add(root);\n const bounds = new Box3().setFromObject(root);\n const centre = bounds.getCenter(new Vector3());\n const size = bounds.getSize(new Vector3());\n root.position.sub(centre);\n\n let mixer: AnimationMixer | null = null;\n if (clip) {\n mixer = new AnimationMixer(root);\n const action = mixer.clipAction(clip);\n action.setLoop(options.loop === false ? LoopOnce : LoopRepeat, Infinity);\n action.clampWhenFinished = true;\n action.play();\n }\n const speed = options.speed ?? 1, offset = options.offset ?? 0;\n\n return {\n object,\n clips: clips.map((c) => c.name),\n size,\n pose: (t) => { mixer?.setTime(t * speed + offset); },\n fit: (px) => { object.scale.setScalar(px / Math.max(size.x, size.y, size.z, 1e-9)); },\n dispose: () => { mixer?.stopAllAction(); mixer?.uncacheRoot(root); mixer = null; },\n };\n}\n\nexport interface ThreeFrameCameraOptions {\n /** The direction the camera sits in from the centre of the model, any length. Default `[0.45, 0.3, 1]`: a three-quarter view, a little from the side and above. */\n direction?: [number, number, number];\n /** Free room around the model: 1.1 (the default) leaves 10 %. */\n margin?: number;\n}\n\n/**\n * Put `camera` where the whole of `object` (its bounding box now, with its scale and place) fits the frame, looking at its centre: the smallest distance at which the 8 corners of\n * the box all fit both the vertical and the horizontal field of view (a bounding sphere would leave a long model small and head-on). `near` and `far` follow the distance.\n * Uses the camera's own `fov` and `aspect`. For a clip that travels far, give your own camera: the box is the bind pose.\n */\nexport function threeFrameCamera(camera: PerspectiveCamera | Camera, object: Object3D, options: ThreeFrameCameraOptions = {}): void {\n const cam = camera as PerspectiveCamera;\n object.updateMatrixWorld(true);\n const bounds = new Box3().setFromObject(object);\n const centre = bounds.getCenter(new Vector3());\n const margin = options.margin ?? 1.1;\n const [dx, dy, dz] = options.direction ?? [0.45, 0.3, 1];\n const toCamera = new Vector3(dx, dy, dz).normalize();\n const right = new Vector3().crossVectors(new Vector3(0, 1, 0), toCamera);\n if (right.lengthSq() < 1e-12) right.set(1, 0, 0); // straight above or below: any right will do\n right.normalize();\n const up = new Vector3().crossVectors(toCamera, right);\n const tanV = Math.tan((cam.fov * Math.PI) / 360), tanH = tanV * cam.aspect;\n let distance = 1e-3;\n for (const x of [bounds.min.x, bounds.max.x]) for (const y of [bounds.min.y, bounds.max.y]) for (const z of [bounds.min.z, bounds.max.z]) {\n const r = new Vector3(x, y, z).sub(centre);\n distance = Math.max(distance, r.dot(toCamera) + (Math.abs(r.dot(right)) * margin) / tanH, r.dot(toCamera) + (Math.abs(r.dot(up)) * margin) / tanV);\n }\n cam.position.copy(centre).addScaledVector(toCamera, distance);\n cam.near = Math.max(distance / 100, 1e-4);\n cam.far = distance * 100;\n cam.lookAt(centre);\n cam.updateProjectionMatrix();\n}\n","/**\n * `threeLayerTexture(ctx, 'screen')`: a live 2D layer (a `composition`) as the picture on a mesh of a `three` layer (a phone's screen, a television, a billboard, a label).\n *\n * The 2D layer stays a layer of the movie: the timeline drives it, its own `at` / `duration` / keyframes / filters apply. It is not drawn on the stage any more: just before the three layer draws,\n * PixiJS draws it into a texture, and the mesh shows that texture. Two routes, chosen by what the layer has:\n * - the three layer draws on PixiJS's own GPU device (`renderer: 'webgpu'` in a WebGPU movie, the default): the texture is PixiJS's GPUTexture itself, used through three's `ExternalTexture`\n * (no copy; 0.3 ms a frame measured). It is not decoded from sRGB by three (the texture is plain rgba8), so the material decodes it in its shader and the picture is flipped by its UV.\n * - otherwise (the layer has a canvas of its own, or PixiJS is on WebGL): the pixels are read back into a canvas (1.6 ms a frame at 480 x 270, 4 ms at 1280 x 720) and three treats it as an ordinary\n * sRGB canvas texture.\n * Both give the 2D layer's colours exactly (tests/films/three-layer-texture).\n */\nimport { Matrix, RenderTexture, type Container, type Renderer } from 'pixi.js';\nimport type { Material, Texture } from 'three';\nimport type { Sequence } from '../sequences/Base';\nimport type { ThreeContext } from './types';\n\nexport interface ThreeLayerTextureOptions {\n /** Pixels of the texture per pixel of the 2D layer: 2 for a screen that is seen large. Default 1. */\n resolution?: number;\n /**\n * The 2D layer's empty and half-transparent parts let what is behind the mesh show through (a sticker, a label with rounded corners, a hologram). Default `false`: an opaque screen, empty parts black,\n * which is cheaper and never has the sorting trouble of transparent meshes (give the composition a background rect and use that). With `true` the material blends and does not write depth.\n */\n transparent?: boolean;\n}\n\nexport interface ThreeLayerTexture {\n /** An unlit material that shows the 2D layer: put it on a mesh (or on one face of a box: an array of materials). A screen shines by itself, so scene lights do not shade it. */\n material: Material;\n /** The three texture behind the material (colours are only right through `material`, which decodes them). */\n texture: Texture;\n /** The size of the texture in pixels. */\n width: number;\n height: number;\n /** Stop showing the layer (it is drawn on the stage again). Called when the three layer is destroyed. */\n dispose(): void;\n}\n\n/** What a three layer lends to `threeLayerTexture` (set on `ctx._host` by the layer itself). */\nexport interface ThreeLayerHost {\n /** A layer of the same composition by its name, among those built before this one. */\n findLayer(name: string): Sequence | null;\n /** The names of those layers, for the message when the name is wrong. */\n layerNames(): string[];\n pixiRenderer: Renderer | null;\n /** The three layer draws on PixiJS's GPU device (no copy is needed). */\n shared: boolean;\n /** Run `fn` just before every draw of the three layer; returns the function that stops it. */\n beforeDraw(fn: () => void): () => void;\n /** Remember a handle: a rebuild that keeps the three layer gives it the new tree's layer (`prepare`). */\n track(handle: Rebindable): () => void;\n}\n\n/** What a rebuild that keeps the three layer needs: show the layer of the new tree with the same name. */\n/** `prepare` looks for the layer in the new tree and throws if it is gone, but changes nothing; the function it returns puts the handle on the new tree's layer (called when that tree is on stage, so a rebuild that fails or is slow leaves the old movie showing its own screen). */\nexport interface Rebindable { material: Material; source(): Sequence; /** Where in the source (0..1 across, 0..1 down) a point (u, v) of the mesh's uv shows: the texture's own repeat / offset / rotation taken into account. */ sourceAt(u: number, v: number): { x: number; y: number }; prepare(host: ThreeLayerHost): () => void; keepHidden(): void; dispose(): void }\n\nconst label = 'pixi-effects: threeLayerTexture';\n\nexport async function threeLayerTexture(ctx: ThreeContext, name: string, options: ThreeLayerTextureOptions = {}): Promise<ThreeLayerTexture> {\n const host = ctx._host;\n if (!host) throw new Error(`${label}: call it from the setup of a three layer: const screen = await threeLayerTexture(ctx, 'screen')`);\n if (typeof name !== 'string' || !name) throw new Error(`${label}: the second argument is the name of a 2D layer: threeLayerTexture(ctx, 'screen')`);\n const resolution = options.resolution ?? 1;\n const transparent = options.transparent === true;\n if (!(Number.isFinite(resolution) && resolution > 0 && resolution <= 4)) throw new Error(`${label}: resolution is a number from above 0 to 4 (2 = twice the pixels), got ${JSON.stringify(options.resolution)}`);\n const pixi = host.pixiRenderer;\n if (!pixi) throw new Error(`${label}: PixiJS's renderer is not available here (the movie is not ready)`);\n\n const source = host.findLayer(name);\n if (!source) {\n const names = host.layerNames();\n throw new Error(`${label}: no layer named \"${name}\" before this three layer${names.length ? ` (the layers built before it: ${names.map((n) => `\"${n}\"`).join(', ')})` : ''}. ` +\n `A layer shown on a mesh must be listed BEFORE the three layer, in the same composition, and have that name.`);\n }\n if (source.spec.type !== 'composition') {\n throw new Error(`${label}: \"${name}\" is a ${source.spec.type} layer: a layer shown on a mesh must be a composition (wrap it: { type: 'composition', name: '${name}', width: 480, height: 270, sequences: [ … ] })`);\n }\n\n // A mask or a matte on the screen composition itself is placed in the PARENT's space; the content is drawn from the origin: unless the screen sits at the origin untouched, the mask lands shifted on the mesh.\n {\n const ini = ((source.spec as { initial?: Record<string, unknown> }).initial ?? {}) as Record<string, unknown>; // (its place, as the spec says it: the timeline has not put it there yet)\n const moved = ['x', 'y', 'rotation', 'pivotX', 'pivotY'].some(k => typeof ini[k] === 'number' && ini[k] !== 0) || ['scale', 'scaleX', 'scaleY'].some(k => typeof ini[k] === 'number' && ini[k] !== 1);\n if (moved && (source.maskSequence || (source.spec as { mask?: unknown }).mask !== undefined)) {\n console.warn(`${label}: \"${name}\" has a mask and is not at x: 0, y: 0 (anchor 0, scale 1, rotation 0): on the mesh its content is drawn from (0, 0) but its mask stays where the parent puts it, so the mask lands shifted. ` +\n `Put the screen at the origin (or mask a layer INSIDE the screen: that mask moves with it).`);\n }\n }\n // The texture is made at the layer's own size and the resolution asked for, drawn with no scale: PixiJS then scales filters, masks and mattes by the resolution itself, so `resolution` sharpens the screen and does\n // not change it (a blur is the same width at 1 and 2). `width` / `height` are the pixels of the texture.\n const logicalW = Math.max(1, Math.round(source.intrinsicWidth)), logicalH = Math.max(1, Math.round(source.intrinsicHeight));\n const width = Math.max(1, Math.round(logicalW * resolution)), height = Math.max(1, Math.round(logicalH * resolution));\n const limit = (() => {\n const g = pixi as unknown as { gpu?: { device?: { limits?: { maxTextureDimension2D?: number } } }; gl?: WebGL2RenderingContext | WebGLRenderingContext };\n return g.gpu?.device?.limits?.maxTextureDimension2D ?? (g.gl ? (g.gl.getParameter(g.gl.MAX_TEXTURE_SIZE) as number) : null) ?? 8192;\n })();\n if (width > limit || height > limit) {\n throw new Error(`${label}: the texture would be ${width} x ${height} pixels (the layer is ${logicalW} x ${logicalH}, resolution ${resolution}), above what this GPU allows (${limit}). Use resolution ${Math.max(1, Math.floor((limit / Math.max(logicalW, logicalH)) * 10) / 10)} or lower, or a smaller composition.`);\n }\n let sharedRoute = host.shared && pixi.name === 'webgpu';\n let webgpu: typeof import('three/webgpu') | undefined, tsl: typeof import('three/tsl') | undefined;\n if (sharedRoute) {\n try { [webgpu, tsl] = await Promise.all([import('three/webgpu'), import('three/tsl')]); } catch (err) {\n throw new Error(`${label}: needs \"three/webgpu\" and \"three/tsl\" in the import map (${err instanceof Error ? err.message : err})`);\n }\n if (typeof (webgpu as { ExternalTexture?: unknown }).ExternalTexture !== 'function') { // three before r180 has no ExternalTexture: read the pixels back instead\n console.warn(`${label}: this page's three has no ExternalTexture (it came with three 0.180): the screen is read back every frame (1.6 ms at 480 x 270) instead of shared with the GPU. Use three 0.180 or later for the no-copy route.`);\n sharedRoute = false;\n }\n }\n // on the shared GPU device the mesh samples PixiJS's texture itself: it needs its mip levels (a screen seen small or at a slant would alias to stripes), made after every draw. A read-back canvas gets them from three.\n const rt = RenderTexture.create({ width: logicalW, height: logicalH, resolution, ...(sharedRoute ? { autoGenerateMipmaps: true } : {}) });\n const gpuTexture = sharedRoute ? (pixi as unknown as { texture: { getGpuSource?: (s: unknown) => unknown } }).texture.getGpuSource?.(rt.source) : undefined;\n\n let texture: Texture, material: Material, readCanvas: HTMLCanvasElement | null = null;\n if (gpuTexture) {\n // three's WebGPU renderer takes a GPUTexture made on its own device; sRGB decoding is done by the material (an external texture is read as plain rgba8)\n const ext = new webgpu!.ExternalTexture(gpuTexture as never);\n ext.colorSpace = webgpu!.NoColorSpace;\n ext.minFilter = webgpu!.LinearMipmapLinearFilter; ext.magFilter = webgpu!.LinearFilter; ext.generateMipmaps = false; ext.anisotropy = 4; // the levels are PixiJS's; four taps along a slant\n ext.repeat.set(1, -1); ext.offset.set(0, 1); // the GPU texture's rows run top to bottom: a texture that three uploads is flipped, this is not\n const m = new webgpu!.MeshBasicNodeMaterial();\n const t = tsl!.texture(ext);\n // PixiJS stores the picture premultiplied by its alpha, in sRGB bytes: divide the alpha out (the blend of the mesh is the ordinary one), then decode\n // TSL's own types do not describe swizzles (`.rgb`, `.a`) on a plain Node: a loose view of the three nodes used below\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const tex = t as any, vec4 = tsl!.vec4 as any, eotf = tsl!.sRGBTransferEOTF as any, max = tsl!.max as any;\n const straight = eotf(vec4(tex.rgb.div(max(tex.a, 0.0001)), 1));\n m.colorNode = (transparent ? vec4(straight.rgb, tex.a) : vec4(eotf(vec4(tex.rgb, 1)).rgb, 1)) as never;\n m.toneMapped = false;\n if (transparent) { m.transparent = true; m.depthWrite = false; }\n texture = ext; material = m;\n } else {\n const three = await import('three');\n readCanvas = document.createElement('canvas');\n readCanvas.width = width; readCanvas.height = height;\n const ct = new three.CanvasTexture(readCanvas);\n ct.colorSpace = three.SRGBColorSpace;\n texture = ct;\n material = new three.MeshBasicMaterial({ map: ct, toneMapped: false, ...(transparent ? { transparent: true, depthWrite: false } : {}) });\n }\n\n let current: Sequence = source;\n let display: Container = source.target as Container;\n let sx = logicalW / source.intrinsicWidth, sy = logicalH / source.intrinsicHeight; // 1, unless a rebuild gave the layer another size (it is then drawn stretched to the texture)\n let hidden = false;\n const hide = (): void => { display.visible = false; hidden = true; };\n hide();\n\n // drawn at the layer's own place in the frame: the timeline has put every layer at this frame before a three layer draws. The layer's own transform is left out (identity): its content is at (0, 0) to (width, height).\n // The stage's cull (Movie._renderNow) skips what is hidden, so the layers of the source keep the `culled` flag they got when they were last measured against the PICTURE: a layer of a screen that lies\n // beyond the picture's edge (a phone screen is taller than the picture), or one that was empty then (scale 0), stayed culled and was missing until a second draw. The texture is the layer's own\n // rectangle, not the picture: nothing in it is culled.\n const uncull = (c: Container): void => { if (c.culled) c.culled = false; for (const k of c.children) uncull(k); };\n const refresh = (): void => {\n const m = new Matrix().scale(sx, sy);\n display.visible = true;\n uncull(display);\n try { pixi.render({ container: display, target: rt, transform: m, clear: true, clearColor: [0, 0, 0, 0] }); } finally { display.visible = false; }\n if (gpuTexture) rt.source.updateMipmaps();\n if (readCanvas) {\n const g = readCanvas.getContext('2d')!;\n if (transparent) {\n // PixiJS's pixels are premultiplied by the alpha (and `extract.canvas` would treat them as straight: a half-transparent part would come out twice as dark): divide the alpha out\n const { pixels, width: w, height: h } = pixi.extract.pixels(rt);\n for (let i = 0; i < pixels.length; i += 4) {\n const a = pixels[i + 3]!;\n if (a > 0 && a < 255) { const k = 255 / a; pixels[i] = pixels[i]! * k; pixels[i + 1] = pixels[i + 1]! * k; pixels[i + 2] = pixels[i + 2]! * k; }\n }\n g.putImageData(new ImageData(pixels as unknown as Uint8ClampedArray<ArrayBuffer>, w, h), 0, 0);\n } else {\n // The mesh shows the layer OVER BLACK, as the other route does: a layer at alpha 0.5 shows half its colour. On WebGL PixiJS's bytes are premultiplied by the alpha (so over black they are the colour as\n // they stand, alpha set to 1); `extract.canvas` there would treat them as straight and darken a half-transparent layer twice. On WebGPU the canvas it gives is straight: composite it over black.\n if (pixi.name === 'webgl') {\n const { pixels, width: w, height: h } = pixi.extract.pixels(rt);\n for (let i = 3; i < pixels.length; i += 4) pixels[i] = 255;\n g.putImageData(new ImageData(pixels as unknown as Uint8ClampedArray<ArrayBuffer>, w, h), 0, 0);\n } else {\n g.globalCompositeOperation = 'source-over'; g.fillStyle = '#000'; g.fillRect(0, 0, width, height);\n g.drawImage(pixi.extract.canvas(rt) as unknown as CanvasImageSource, 0, 0);\n }\n }\n texture.needsUpdate = true;\n }\n };\n const stop = host.beforeDraw(refresh);\n refresh();\n\n let disposed = false;\n const handle: ThreeLayerTexture & Rebindable = {\n material, texture, width, height,\n source: () => current,\n sourceAt(u, v) {\n const t = texture as unknown as { updateMatrix?: () => void; matrix?: { elements: number[] } };\n t.updateMatrix?.();\n const e = t.matrix?.elements;\n const tu = e ? e[0]! * u + e[3]! * v + e[6]! : u, tv = e ? e[1]! * u + e[4]! * v + e[7]! : v; // the texture's own matrix: what the picture samples there\n return { x: tu, y: gpuTexture ? tv : 1 - tv }; // a shared texture's rows run top to bottom (its matrix holds the flip); an uploaded canvas is flipped by three\n },\n prepare(next) {\n const again = next.findLayer(name);\n if (disposed) return () => {};\n if (!again) throw new Error(`${label}: after a rebuild there is no layer \"${name}\" before the three layer any more`);\n return () => {\n current = again;\n display = again.target as Container;\n sx = logicalW / again.intrinsicWidth; sy = logicalH / again.intrinsicHeight; // a layer that changed size is drawn stretched to the texture\n hide();\n refresh();\n };\n },\n keepHidden() { if (hidden && !disposed) display.visible = false; }, // (the timeline can put it back: autoAlpha writes `visible`)\n dispose() {\n stop();\n if (hidden) { display.visible = true; hidden = false; }\n try { rt.destroy(true); } catch { /* the renderer is gone */ }\n texture.dispose?.(); material.dispose?.();\n },\n };\n const untrack = host.track(handle);\n handle.dispose = ((inner: () => void) => () => { if (disposed) return; disposed = true; untrack(); inner(); })(handle.dispose);\n return handle;\n}\n","/**\n * pixi-effects/three — optional three.js integration.\n *\n * Import this entry only when you use `type: 'three'` sequences; the core\n * `pixi-effects` entry never touches three.js. Call `registerThree()` once\n * before Movie.init builds a composition containing a three sequence.\n */\nimport { registerSequenceType, type SequenceCtor } from '../core/Composition';\nimport { ThreeSequence } from './ThreeSequence';\nimport { checkRendererKind, setPageRenderer, type ThreeRendererKind } from './defaults';\nimport type { SequenceSpec } from '../types';\nimport type { ThreeSequenceSpec } from './types';\n\nexport { ThreeSequence } from './ThreeSequence';\nexport { threeGltf, threeFrameCamera } from './gltf';\nexport { threeLayerTexture } from './layerTexture';\nexport type { ThreeLayerTexture, ThreeLayerTextureOptions } from './layerTexture';\nexport type { ThreeGltfModel, ThreeGltfOptions, ThreeFrameCameraOptions } from './gltf';\nexport type { ThreeContext, ThreeSetupResult, ThreeSequenceSpec } from './types';\nexport type { ThreeRendererKind } from './defaults';\n\n/**\n * Register the 'three' sequence type. Explicit call so `sideEffects: false` bundlers can't drop it; calling it again is fine.\n * `registerThree({ renderer: 'webgpu' })` makes every three layer that does not name a `renderer` of its own use three's WebGPU renderer; the default is `'webgl'`\n * (the last call wins).\n */\nexport function registerThree(options: { renderer?: ThreeRendererKind } = {}): void {\n const kind = options.renderer ?? 'webgl';\n checkRendererKind(kind, \"registerThree's renderer\");\n setPageRenderer(kind);\n registerSequenceType('three', ThreeSequence as unknown as SequenceCtor);\n}\n\n/**\n * Typing helper: accepts a strongly-typed three spec and returns it as a\n * core SequenceSpec, keeping three.js types out of the core union.\n */\nexport function three(spec: ThreeSequenceSpec): SequenceSpec {\n return spec as unknown as SequenceSpec;\n}\n"]}