@oeave/bakery3 0.0.0-stage → 0.2.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 (86) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +562 -2
  3. package/dist/animation-B1h0Ryvj.d.ts +97 -0
  4. package/dist/bake/index.d.ts +369 -0
  5. package/dist/bake/index.js +9 -0
  6. package/dist/bake/index.js.map +1 -0
  7. package/dist/bake-DZ-CJR6f.d.ts +1364 -0
  8. package/dist/catalog/index.d.ts +100 -0
  9. package/dist/catalog/index.js +154 -0
  10. package/dist/catalog/index.js.map +1 -0
  11. package/dist/catalog.gen-BM-aNf7n.d.ts +733 -0
  12. package/dist/chunk-3G5QL4F4.js +145 -0
  13. package/dist/chunk-3G5QL4F4.js.map +1 -0
  14. package/dist/chunk-4E5VV4QY.js +12 -0
  15. package/dist/chunk-4E5VV4QY.js.map +1 -0
  16. package/dist/chunk-62M6XXNX.js +142 -0
  17. package/dist/chunk-62M6XXNX.js.map +1 -0
  18. package/dist/chunk-6FYI6AJM.js +1157 -0
  19. package/dist/chunk-6FYI6AJM.js.map +1 -0
  20. package/dist/chunk-6NYR73Y7.js +832 -0
  21. package/dist/chunk-6NYR73Y7.js.map +1 -0
  22. package/dist/chunk-APWUCEEB.js +118 -0
  23. package/dist/chunk-APWUCEEB.js.map +1 -0
  24. package/dist/chunk-HNMSWQU7.js +1709 -0
  25. package/dist/chunk-HNMSWQU7.js.map +1 -0
  26. package/dist/chunk-JFYUDERE.js +1412 -0
  27. package/dist/chunk-JFYUDERE.js.map +1 -0
  28. package/dist/chunk-KNUAOILG.js +551 -0
  29. package/dist/chunk-KNUAOILG.js.map +1 -0
  30. package/dist/chunk-KZLVTSBI.js +191 -0
  31. package/dist/chunk-KZLVTSBI.js.map +1 -0
  32. package/dist/chunk-LAKXC4WR.js +2028 -0
  33. package/dist/chunk-LAKXC4WR.js.map +1 -0
  34. package/dist/chunk-NXBAZGNB.js +1107 -0
  35. package/dist/chunk-NXBAZGNB.js.map +1 -0
  36. package/dist/chunk-QRCT5UGZ.js +3286 -0
  37. package/dist/chunk-QRCT5UGZ.js.map +1 -0
  38. package/dist/chunk-S4AJTLLN.js +23 -0
  39. package/dist/chunk-S4AJTLLN.js.map +1 -0
  40. package/dist/chunk-UWBP7B54.js +92 -0
  41. package/dist/chunk-UWBP7B54.js.map +1 -0
  42. package/dist/chunk-XK35ANPJ.js +346 -0
  43. package/dist/chunk-XK35ANPJ.js.map +1 -0
  44. package/dist/chunk-Z7IYVH22.js +4781 -0
  45. package/dist/chunk-Z7IYVH22.js.map +1 -0
  46. package/dist/chunk-ZEBVAIJJ.js +156 -0
  47. package/dist/chunk-ZEBVAIJJ.js.map +1 -0
  48. package/dist/devtools/index.d.ts +536 -0
  49. package/dist/devtools/index.js +15 -0
  50. package/dist/devtools/index.js.map +1 -0
  51. package/dist/environments/index.d.ts +93 -0
  52. package/dist/environments/index.js +382 -0
  53. package/dist/environments/index.js.map +1 -0
  54. package/dist/hotspots/index.d.ts +111 -0
  55. package/dist/hotspots/index.js +285 -0
  56. package/dist/hotspots/index.js.map +1 -0
  57. package/dist/index.d.ts +975 -0
  58. package/dist/index.js +15 -0
  59. package/dist/index.js.map +1 -0
  60. package/dist/node/index.cjs +5240 -0
  61. package/dist/node/index.cjs.map +1 -0
  62. package/dist/node/index.d.cts +4927 -0
  63. package/dist/node/index.d.ts +597 -0
  64. package/dist/node/index.js +1328 -0
  65. package/dist/node/index.js.map +1 -0
  66. package/dist/prepare-BtjY4G3q.d.ts +112 -0
  67. package/dist/presets/index.d.ts +562 -0
  68. package/dist/presets/index.js +14 -0
  69. package/dist/presets/index.js.map +1 -0
  70. package/dist/r3f/index.d.ts +159 -0
  71. package/dist/r3f/index.js +592 -0
  72. package/dist/r3f/index.js.map +1 -0
  73. package/dist/room-FS26KAPQ.js +9 -0
  74. package/dist/room-FS26KAPQ.js.map +1 -0
  75. package/dist/rooms.gen-DItzBR9k.d.ts +1462 -0
  76. package/dist/session-VCIQEO26.js +9 -0
  77. package/dist/session-VCIQEO26.js.map +1 -0
  78. package/dist/shapes/index.d.ts +222 -0
  79. package/dist/shapes/index.js +836 -0
  80. package/dist/shapes/index.js.map +1 -0
  81. package/dist/testRun-20OARnQr.d.ts +1139 -0
  82. package/dist/timeline-ChwgD7bT.d.ts +470 -0
  83. package/dist/tsl/index.d.ts +165 -0
  84. package/dist/tsl/index.js +310 -0
  85. package/dist/tsl/index.js.map +1 -0
  86. package/package.json +170 -4
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/shapes/shapes.ts"],"names":[],"mappings":";;;;;;;AA8CA,eAAA;AAAA,EACE,EAAE,IAAA,EAAO,aAAA,CAAoC,IAAA,EAAK;AAAA,EAClD,EAAE,IAAI,UAAA,EAAY,MAAA,EAAQ,OAAO,EAAE,KAAA,EAAO,SAAQ,CAAA;AACpD,CAAA;AASO,IAAM,WAAA,GAAc;AAAA,EACzB,QAAA;AAAA,EACA,MAAA;AAAA,EACA,QAAA;AAAA,EACA,OAAA;AAAA,EACA,MAAA;AAAA,EACA,MAAA;AAAA,EACA,SAAA;AAAA,EACA;AACF;AAoBO,IAAM,cAAA,GAAiB;AAAA,EAC5B,MAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA;AAAA,EACA,KAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,MAAA;AAAA,EACA,MAAA;AAAA,EACA,OAAA;AAAA,EACA,MAAA;AAAA,EACA,QAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF;AAGO,IAAM,YAAA,GAAe;AAAA,EAC1B,MAAA;AAAA,EACA,QAAA;AAAA,EACA,OAAA;AAAA,EACA,KAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA;AAAA,EACA,MAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF;AAwDO,IAAM,gBAAA,GAAgD;AAAA,EAC3D,IAAA,EAA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,IAAA,CAAK,KAAA,CAAM,CAAC,CAAA;AACzD,QAAA,KAAA,CAAM,SAAA,CAAU,KAAK,EAAE,IAAA,EAAM,OAAO,CAAC,GAAG,KAAK,CAAA,EAAG,CAAA;AAAA,MAClD;AAAA,IACF;AACA,IAAA,MAAA,IAAU,KAAA,CAAM,MAAA;AAAA,EAClB;AACA,EAAA,OAAO,MAAA;AACT","file":"index.js","sourcesContent":["/**\n * The implementation behind `@oeave/bakery3/shapes`. `index.ts` lists what\n * is public; the rest is shared with the SDK's own tests and tools.\n */\nimport * as THREE from 'three';\nimport { SimplexNoise } from 'three/addons/math/SimplexNoise.js';\nimport { mergeVertices } from 'three/addons/utils/BufferGeometryUtils.js';\nimport {\n MeshStandardNodeMaterial,\n PMREMGenerator,\n type WebGPURenderer,\n} from 'three/webgpu';\nimport {\n abs,\n asin,\n atan,\n color,\n cos,\n dot,\n float,\n fract,\n max,\n min,\n mix,\n mx_fractal_noise_float,\n mx_worley_noise_float,\n normalize,\n normalView,\n oneMinus,\n positionLocal,\n positionViewDirection,\n positionWorld,\n pow,\n saturate,\n sin,\n smoothstep,\n vec3,\n} from 'three/tsl';\nimport type { Timeline } from '../timeline/timeline.js';\nimport { registerBuiltin } from '../shader/registry.js';\n\n// `positionWorld` is an anonymous singleton: nothing in its structure says\n// what it is, so the extractor knows it only by being introduced\n// (`shader/registry.ts`). `@oeave/bakery3/tsl` introduces every builtin; the\n// `scan` finish needs this one, and a composition must extract without the\n// developer importing a second entry.\nregisterBuiltin(\n { uuid: (positionWorld as { uuid?: string }).uuid },\n { op: 'position', params: () => ({ space: 'world' }) },\n);\n\nexport type Vec3 = [number, number, number];\n\n// ---------------------------------------------------------------------------\n// The vocabulary: kinds, finishes and motions. Anything that describes a\n// composition reads these from here, so the words cannot drift.\n// ---------------------------------------------------------------------------\n\nexport const SHAPE_KINDS = [\n 'sphere',\n 'blob',\n 'pebble',\n 'torus',\n 'ring',\n 'knot',\n 'capsule',\n 'box',\n] as const;\nexport type ShapeKind = (typeof SHAPE_KINDS)[number];\n\n/**\n * `glow` emits its color (a real light in the render); `glass` refracts what\n * is behind it; `matte`, `satin` and `metal` are lit surfaces; `rim` is a\n * fresnel emission written in TSL (bright at the silhouette, dark in the\n * middle); `nebula` is emission driven by fractal noise in TSL; `beacon` is a\n * dark body that emits at a handful of fixed points, in TSL.\n *\n * The rest are TSL graphs too. `iris` is a metal whose color turns through\n * the spectrum with the angle it is seen from, like oil on water. `scan` is a\n * dark body crossed by bands of light that are fixed in the WORLD, so a shape\n * that bobs, tumbles or orbits moves through them. `magma` is dark plates\n * with glowing seams (cellular noise). `holo` is a globe's grid of glowing\n * meridians and parallels. `aurora` is soft emission in two colors, folded\n * by sines. `topo` is glowing contour lines at even heights of the shape, so\n * on a blob they map its lumps. `spiral` is a lit surface in two-tone\n * stripes that wind round the shape.\n */\nexport const SHAPE_FINISHES = [\n 'glow',\n 'glass',\n 'matte',\n 'satin',\n 'metal',\n 'rim',\n 'nebula',\n 'beacon',\n 'iris',\n 'scan',\n 'magma',\n 'holo',\n 'aurora',\n 'topo',\n 'spiral',\n] as const;\nexport type ShapeFinish = (typeof SHAPE_FINISHES)[number];\n\nexport const MOTION_KINDS = [\n 'spin',\n 'tumble',\n 'pulse',\n 'bob',\n 'orbit',\n 'drift',\n 'glow',\n 'tint',\n 'frost',\n] as const;\nexport type MotionKind = (typeof MOTION_KINDS)[number];\n\n/**\n * A motion runs for the whole clip. The cyclic ones (`spin`, `tumble`,\n * `pulse`, `bob`, `orbit`, `glow`) complete whole turns or cycles so the\n * clip loops; the one-way ones (`drift`, `tint`, `frost`) ease from the\n * shape's own value to the one given.\n */\nexport type Motion =\n /** Whole turns about one axis. Default y, one turn. */\n | { kind: 'spin'; axis?: 'x' | 'y' | 'z'; turns?: number }\n /** Whole turns about x and z at once. Default one turn. */\n | { kind: 'tumble'; turns?: number }\n /** Scale breathing by ±amount (fraction of size). Default 0.12, two cycles. */\n | { kind: 'pulse'; amount?: number; cycles?: number }\n /** Vertical drift by ±amount meters. Default 0.12, one cycle. */\n | { kind: 'bob'; amount?: number; cycles?: number }\n /** Circle the composition's center at the shape's own distance (or `radius`). Default one turn. */\n | { kind: 'orbit'; radius?: number; turns?: number }\n /** Ease to another point, meters. */\n | { kind: 'drift'; to: Vec3 }\n /** Emission breathing by ±amount (fraction of strength); glow shapes only. Default 0.6, two cycles. */\n | { kind: 'glow'; amount?: number; cycles?: number }\n /** Ease the color to another hex. */\n | { kind: 'tint'; to: string }\n /** Ease the roughness to `to` (default 0.6): glass frosts over, metal dulls. */\n | { kind: 'frost'; to?: number };\n\nexport type Shape = {\n id: string;\n kind: ShapeKind;\n finish: ShapeFinish;\n /** CSS hex. The emission color of a glow, the tint of a glass, the albedo of the rest. */\n color: string;\n /** Center, meters; y up from the floor (y = 0). */\n position: Vec3;\n /** Longest extent, meters. */\n size: number;\n /** Degrees. */\n rotation?: Vec3;\n /** 0–1: how far the surface is pushed by noise. Blobs and pebbles have their own default; the rest none. */\n noise?: number;\n /** Emission strength for the finishes that emit. Default per finish. */\n strength?: number;\n motion?: Motion[];\n};\n\nexport type Composition = {\n kind: 'composition';\n shapes: Shape[];\n /** Seeds the noise lattice, so a blob is the same blob in every capture. */\n seed?: number;\n};\n\n/** Emission strength a finish defaults to. */\nexport const DEFAULT_STRENGTH: Record<ShapeFinish, number> = {\n glow: 5,\n rim: 4,\n nebula: 3,\n beacon: 5,\n scan: 6,\n magma: 6,\n holo: 6,\n aurora: 2,\n topo: 6,\n glass: 0,\n matte: 0,\n satin: 0,\n metal: 0,\n iris: 0,\n spiral: 0,\n};\n\n/** Surface noise a kind defaults to. */\nexport const DEFAULT_NOISE: Record<ShapeKind, number> = {\n sphere: 0,\n blob: 0.5,\n pebble: 0.25,\n torus: 0,\n ring: 0,\n knot: 0,\n capsule: 0,\n box: 0,\n};\n\n/** Roughness per finish: the value a `frost` motion starts from. */\nexport const ROUGHNESS: Record<ShapeFinish, number> = {\n glow: 0.55,\n glass: 0.03,\n matte: 0.85,\n satin: 0.4,\n metal: 0.22,\n rim: 0.6,\n nebula: 0.6,\n beacon: 0.45,\n iris: 0.16,\n scan: 0.5,\n magma: 0.8,\n holo: 0.5,\n aurora: 0.6,\n topo: 0.5,\n spiral: 0.35,\n};\n\n/**\n * The finishes that are node graphs. A graph's color and roughness are\n * constants inside it, so none of them takes a tint or a frost, and none has\n * one opacity to fade: the loop's fade shrinks them instead.\n */\nconst GRAPH_FINISHES: ReadonlySet<ShapeFinish> = new Set([\n 'rim',\n 'nebula',\n 'beacon',\n 'iris',\n 'scan',\n 'magma',\n 'holo',\n 'aurora',\n 'topo',\n 'spiral',\n]);\n\n/**\n * How much of its surface a patterned emitter lights, roughly: what its\n * viewport stand-in light is scaled by, so a shape crossed by thin lines\n * lights the floor less than one that glows all over. The render needs no\n * such number; it has the emission itself.\n */\nconst EMISSION_COVERAGE: Partial<Record<ShapeFinish, number>> = {\n scan: 0.22,\n magma: 0.07,\n holo: 0.2,\n aurora: 0.5,\n topo: 0.16,\n};\n\n/**\n * Which motions make sense on a finish. A glow cycle on a matte shape would\n * do nothing the viewer sees; a tint on a graph finish cannot happen at all,\n * because a graph's color is a constant inside it.\n * `animateComposition` skips what does not suit.\n */\nexport function motionSuits(kind: MotionKind, finish: ShapeFinish): boolean {\n if (kind === 'glow') return finish === 'glow';\n if (kind === 'frost')\n return finish === 'glass' || finish === 'metal' || finish === 'satin';\n if (kind === 'tint') return !GRAPH_FINISHES.has(finish);\n return true;\n}\n\n/**\n * The viewport's stand-in for a glowing shape: candela per unit of emission\n * per square meter of extent. A sphere of diameter `size` and radiance L\n * lights a surface as a point source of L·π·(size/2)² candela does, which is\n * π/4 per size². A hotter stand-in reads fine on a near-black floor and burns\n * a pale one white where the render shows a soft pool.\n */\nconst GLOW_LIGHT = Math.PI / 4;\n\nexport type BuiltShape = {\n spec: Shape;\n mesh: THREE.Mesh;\n /**\n * The viewport-only light inside a glow shape.\n * @internal Driven by `followGlow`; may change without notice.\n */\n light?: THREE.PointLight;\n /**\n * The viewport-only halo round an emitter in fog.\n * @internal May change without notice.\n */\n halo?: THREE.Sprite;\n /**\n * The values the motions start from.\n * @internal What the timeline animates from; may change without notice.\n */\n base: {\n position: Vec3;\n rotation: Vec3;\n strength: number;\n roughness: number;\n color: THREE.Color;\n };\n};\n\nexport type BuiltComposition = { group: THREE.Group; shapes: BuiltShape[] };\n\n// ---------------------------------------------------------------------------\n// Geometry\n\nfunction mulberry32(seed: number): () => number {\n let a = Math.floor(seed) >>> 0 || 0x9e3779b9;\n return () => {\n a = (a + 0x6d2b79f5) >>> 0;\n let t = a;\n t = Math.imul(t ^ (t >>> 15), t | 1);\n t ^= t + Math.imul(t ^ (t >>> 7), t | 61);\n return ((t ^ (t >>> 14)) >>> 0) / 4294967296;\n };\n}\n\nfunction hashString(s: string): number {\n let h = 2166136261;\n for (let i = 0; i < s.length; i++) {\n h ^= s.charCodeAt(i);\n h = Math.imul(h, 16777619);\n }\n return h >>> 0;\n}\n\n/** The unit primitive for a kind, before sizing and noise. Smooth kinds are welded so noise and normals are seamless. */\nfunction primitive(kind: ShapeKind, noisy: boolean): THREE.BufferGeometry {\n switch (kind) {\n case 'sphere':\n return mergeVertices(new THREE.IcosahedronGeometry(0.5, noisy ? 5 : 4));\n case 'blob':\n return mergeVertices(new THREE.IcosahedronGeometry(0.5, 5));\n case 'pebble': {\n const g = mergeVertices(new THREE.IcosahedronGeometry(0.5, 5));\n g.scale(1, 0.62, 0.85);\n return g;\n }\n case 'torus':\n return mergeVertices(new THREE.TorusGeometry(0.36, 0.14, 48, 112));\n case 'ring':\n return mergeVertices(new THREE.TorusGeometry(0.45, 0.05, 24, 160));\n case 'knot':\n return mergeVertices(new THREE.TorusKnotGeometry(0.3, 0.1, 256, 32));\n case 'capsule':\n return mergeVertices(new THREE.CapsuleGeometry(0.22, 0.56, 16, 40));\n case 'box':\n // Welded only when noise will push it: a hard-edged box wants its\n // split normals, a pebbled one wants a continuous surface.\n return noisy\n ? mergeVertices(new THREE.BoxGeometry(1, 1, 1, 18, 18, 18))\n : new THREE.BoxGeometry(1, 1, 1, 18, 18, 18);\n }\n}\n\n/** Push every vertex along its normal by fractal simplex noise of its position. Deterministic in `seed`. */\nfunction displace(\n geometry: THREE.BufferGeometry,\n amount: number,\n size: number,\n seed: number,\n): void {\n geometry.computeVertexNormals();\n const random = mulberry32(seed);\n const simplex = new SimplexNoise({ random });\n const offset = new THREE.Vector3(\n random() * 100,\n random() * 100,\n random() * 100,\n );\n const frequency = 1.9 / size;\n const amplitude = amount * 0.2 * size;\n const positions = geometry.attributes.position as THREE.BufferAttribute;\n const normals = geometry.attributes.normal as THREE.BufferAttribute;\n const p = new THREE.Vector3();\n const n = new THREE.Vector3();\n const fbm = (x: number, y: number, z: number) =>\n (simplex.noise3d(x, y, z) +\n 0.5 * simplex.noise3d(x * 2.1, y * 2.1, z * 2.1) +\n 0.25 * simplex.noise3d(x * 4.3, y * 4.3, z * 4.3)) /\n 1.75;\n for (let i = 0; i < positions.count; i++) {\n p.fromBufferAttribute(positions, i);\n n.fromBufferAttribute(normals, i);\n const v = fbm(\n p.x * frequency + offset.x,\n p.y * frequency + offset.y,\n p.z * frequency + offset.z,\n );\n p.addScaledVector(n, v * amplitude);\n positions.setXYZ(i, p.x, p.y, p.z);\n }\n positions.needsUpdate = true;\n geometry.computeVertexNormals();\n}\n\n/** The geometry of a shape: the primitive sized so its longest extent is `size`, then pushed by noise. */\nexport function shapeGeometry(\n shape: Shape,\n compositionSeed: number,\n): THREE.BufferGeometry {\n const noise = shape.noise ?? DEFAULT_NOISE[shape.kind];\n const geometry = primitive(shape.kind, noise > 0);\n geometry.computeBoundingBox();\n const extent = geometry.boundingBox!.getSize(new THREE.Vector3());\n const longest = Math.max(extent.x, extent.y, extent.z) || 1;\n geometry.scale(\n shape.size / longest,\n shape.size / longest,\n shape.size / longest,\n );\n if (noise > 0)\n displace(\n geometry,\n noise,\n shape.size,\n (compositionSeed ^ hashString(shape.id)) >>> 0,\n );\n geometry.computeBoundingSphere();\n return geometry;\n}\n\n// ---------------------------------------------------------------------------\n// Materials\n\ntype Expr = ReturnType<typeof float>;\n\nfunction rimMaterial(\n c: THREE.Color,\n strength: number,\n): MeshStandardNodeMaterial {\n const material = new MeshStandardNodeMaterial();\n material.name = 'bakery3-shape-rim';\n material.roughness = ROUGHNESS.rim;\n material.metalness = 0;\n material.emissive.set(0x000000);\n material.emissiveIntensity = 1;\n // Bright where the surface turns away from the eye, dark where it faces\n // it: 1 − |n·v|, sharpened. Exact-tier ops only, so the render agrees.\n const facing: Expr = saturate(abs(dot(normalView, positionViewDirection)));\n const rim = pow(oneMinus(facing), 2.5);\n material.colorNode = color(c.clone().multiplyScalar(0.06));\n material.emissiveNode = color(c).mul(rim).mul(float(strength));\n return material;\n}\n\nfunction nebulaMaterial(\n c: THREE.Color,\n strength: number,\n size: number,\n seed: number,\n): MeshStandardNodeMaterial {\n const material = new MeshStandardNodeMaterial();\n material.name = 'bakery3-shape-nebula';\n material.roughness = ROUGHNESS.nebula;\n material.metalness = 0;\n material.emissive.set(0x000000);\n material.emissiveIntensity = 1;\n const random = mulberry32(seed);\n const offset = vec3(random() * 40, random() * 40, random() * 40);\n // Fractal noise of the object-space position: an approximate op (the\n // renderer's lattice differs), so the halves share the character, not\n // the exact pattern. `check()` says so; the render is the real one.\n const n: Expr = mx_fractal_noise_float(\n positionLocal.mul(float(3.2 / size)).add(offset),\n 3,\n 2,\n 0.5,\n );\n const mask = smoothstep(-0.05, 0.55, n);\n material.colorNode = color(c.clone().multiplyScalar(0.08));\n material.emissiveNode = mix(\n color(c.clone().multiplyScalar(0.12)),\n color(c),\n mask,\n ).mul(float(strength));\n return material;\n}\n\n/** How many points a beacon emits from, and the half-angle of each, degrees: the lit cap and its soft edge. */\nexport const BEACON = { points: 7, inner: 7, outer: 13 } as const;\n\n/**\n * The fraction of a beacon's surface that emits: `points` caps of the mean\n * half-angle, on a sphere. A beacon's `strength` is the glow it is worth: its\n * points emit that much divided by this, so a beacon of strength 5 puts out\n * what a glow of strength 5 and the same size would, gathered into its\n * points. The two finishes share one scale.\n */\nconst BEACON_COVERAGE =\n (BEACON.points *\n (1 -\n Math.cos(THREE.MathUtils.degToRad((BEACON.inner + BEACON.outer) / 2)))) /\n 2;\n\n/**\n * Where a beacon's points are, as unit directions from its center in object\n * space. A Fibonacci lattice, so they never bunch, turned by the seed so two\n * beacons in one composition do not point the same way.\n */\nexport function beaconPoints(seed: number): Vec3[] {\n const random = mulberry32(seed);\n const turn = new THREE.Euler(\n random() * Math.PI * 2,\n random() * Math.PI * 2,\n random() * Math.PI * 2,\n );\n const golden = Math.PI * (3 - Math.sqrt(5));\n const v = new THREE.Vector3();\n return Array.from({ length: BEACON.points }, (_, i) => {\n const y = 1 - (2 * (i + 0.5)) / BEACON.points;\n const r = Math.sqrt(1 - y * y);\n v.set(Math.cos(golden * i) * r, y, Math.sin(golden * i) * r).applyEuler(\n turn,\n );\n return [v.x, v.y, v.z] as Vec3;\n });\n}\n\nfunction beaconMaterial(\n c: THREE.Color,\n strength: number,\n seed: number,\n): MeshStandardNodeMaterial {\n const material = new MeshStandardNodeMaterial();\n material.name = 'bakery3-shape-beacon';\n material.roughness = ROUGHNESS.beacon;\n material.metalness = 0;\n material.emissive.set(0x000000);\n material.emissiveIntensity = 1;\n // The direction of this point of the surface from the shape's center,\n // compared with each beacon direction: inside the inner cone the cap is\n // fully lit, by the outer cone it is dark. Exact-tier ops and constants\n // only, so the points are the same points in both halves, and they are\n // read from the undisplaced direction, so a noise-pushed body keeps round\n // caps on a lumpy surface.\n const direction = normalize(positionLocal);\n const dark = Math.cos(THREE.MathUtils.degToRad(BEACON.outer));\n const lit = Math.cos(THREE.MathUtils.degToRad(BEACON.inner));\n let mask: Expr = float(0);\n for (const p of beaconPoints(seed))\n mask = mask.add(\n smoothstep(dark, lit, dot(direction, vec3(p[0], p[1], p[2]))),\n );\n material.colorNode = color(c.clone().multiplyScalar(0.04));\n material.emissiveNode = color(c)\n .mul(saturate(mask))\n .mul(float(strength / BEACON_COVERAGE));\n return material;\n}\n\n/** A node material with its static emission off: the graph is the emission. */\nfunction graphMaterial(finish: ShapeFinish): MeshStandardNodeMaterial {\n const material = new MeshStandardNodeMaterial();\n material.name = `bakery3-shape-${finish}`;\n material.roughness = ROUGHNESS[finish];\n material.metalness = 0;\n material.emissive.set(0x000000);\n material.emissiveIntensity = 1;\n return material;\n}\n\n/** 1 where the surface faces the eye, 0 at the silhouette. Exact-tier ops. */\nconst facingEye = (): Expr =>\n saturate(abs(dot(normalView, positionViewDirection)));\n\n/** The hue a companion color leans towards: violet, which sits between the brand's cyan and magenta. */\nconst COMPANION_HUE = 0.72;\n\n/**\n * A second color for a finish that wants one: the shape's own with its hue\n * turned towards violet, by at most a fifth of the wheel, so a cyan and a\n * magenta both find a neighbor on the arc between them and neither wanders\n * into orange or green. A color that is violet already turns towards cyan.\n */\nfunction companion(c: THREE.Color): THREE.Color {\n const hsl = c.getHSL({ h: 0, s: 0, l: 0 });\n const away = ((COMPANION_HUE - hsl.h + 1.5) % 1) - 0.5;\n const turn =\n Math.abs(away) < 0.06\n ? -0.17\n : Math.sign(away) * Math.min(Math.abs(away), 0.2);\n return c.clone().offsetHSL(turn, 0, 0);\n}\n\n/** How many times the iris turns through the spectrum between facing the eye and the silhouette, and along the body. */\nexport const IRIS = { turns: 1.15, along: 0.35 } as const;\n\nfunction irisMaterial(\n c: THREE.Color,\n size: number,\n seed: number,\n): MeshStandardNodeMaterial {\n const material = graphMaterial('iris');\n material.metalness = 1;\n const random = mulberry32(seed);\n // A thin film: the hue depends on how obliquely the surface is seen, so it\n // slides over the shape as the shape or the camera turns. Three cosines a\n // third of a turn apart are the spectrum. Exact-tier ops only.\n const phase: Expr = facingEye()\n .mul(IRIS.turns)\n .add(positionLocal.y.mul(IRIS.along / size))\n .add(random());\n const channel = (offset: number): Expr =>\n cos(phase.add(offset).mul(TAU)).mul(0.5).add(0.5);\n const film = vec3(channel(0), channel(1 / 3), channel(2 / 3));\n material.colorNode = mix(color(c), film, 0.72);\n // A metal under a dark dome has little to reflect; a faint film at the\n // silhouette keeps its outline in the picture.\n material.emissiveNode = film.mul(pow(oneMinus(facingEye()), 2)).mul(0.3);\n return material;\n}\n\n/** Bands of light per shape size, and the half-width of each as a fraction of the gap between two. */\nexport const SCAN = { lines: 5, width: 0.17 } as const;\n\nfunction scanMaterial(\n c: THREE.Color,\n strength: number,\n size: number,\n): MeshStandardNodeMaterial {\n const material = graphMaterial('scan');\n // Horizontal planes of light, fixed in the world and not on the shape:\n // the height of this point of the surface, in band gaps, and how near its\n // fraction is to the middle of a gap. A shape that moves passes through\n // them, which is the whole effect. Exact-tier ops only.\n const f: Expr = fract(positionWorld.y.mul(SCAN.lines / size));\n const w = SCAN.width;\n const band = smoothstep(0.5 - w, 0.5 - w * 0.45, f).mul(\n oneMinus(smoothstep(0.5 + w * 0.45, 0.5 + w, f)),\n );\n material.colorNode = color(c.clone().multiplyScalar(0.05));\n material.emissiveNode = color(c).mul(band).mul(float(strength));\n return material;\n}\n\n/** Cells across a magma shape, and the distances from a cell's middle between which its seam lights up. */\nexport const MAGMA = { cells: 5, from: 0.5, to: 0.7 } as const;\n\nfunction magmaMaterial(\n c: THREE.Color,\n strength: number,\n size: number,\n seed: number,\n): MeshStandardNodeMaterial {\n const material = graphMaterial('magma');\n const random = mulberry32(seed);\n const offset = vec3(random() * 40, random() * 40, random() * 40);\n // Cellular noise is the distance to the nearest of a scatter of points:\n // small in the middle of a plate, large where two plates meet, which is\n // where the light shows through. An approximate op, like the nebula's: the\n // renderer scatters its own points, so the plates differ between the halves.\n const d: Expr = mx_worley_noise_float(\n positionLocal.mul(float(MAGMA.cells / size)).add(offset),\n float(1),\n );\n const seam = smoothstep(MAGMA.from, MAGMA.to, d);\n material.colorNode = color(c.clone().multiplyScalar(0.03).addScalar(0.012));\n // Hotter, so paler, in the middle of a seam.\n material.emissiveNode = mix(color(c), color(0xffffff), pow(seam, 5).mul(0.25))\n .mul(seam)\n .mul(float(strength));\n return material;\n}\n\n/** A holo's grid: parallels from pole to pole, meridians round, and half a line's width as a fraction of a cell. */\nexport const HOLO = { parallels: 9, meridians: 14, width: 0.07 } as const;\n\nfunction holoMaterial(\n c: THREE.Color,\n strength: number,\n): MeshStandardNodeMaterial {\n const material = graphMaterial('holo');\n // Latitude and longitude of the direction from the shape's center, each\n // counted in cells; a line is where either is near a whole number. Whole\n // numbers of cells, so the grid closes on itself round the back. Exact-tier\n // ops only, and in object space, so the grid turns with the shape.\n const n = normalize(positionLocal);\n const latitude: Expr = asin(n.y).mul(HOLO.parallels / Math.PI);\n const longitude: Expr = atan(n.z, n.x).mul(HOLO.meridians / TAU);\n const line = (cells: Expr): Expr => {\n const f = fract(cells);\n return oneMinus(\n smoothstep(HOLO.width * 0.45, HOLO.width, min(f, oneMinus(f))),\n );\n };\n const grid = max(line(latitude), line(longitude));\n const edge = pow(oneMinus(facingEye()), 3).mul(0.45);\n material.colorNode = color(c.clone().multiplyScalar(0.03));\n material.emissiveNode = color(c).mul(grid.add(edge)).mul(float(strength));\n return material;\n}\n\nfunction auroraMaterial(\n c: THREE.Color,\n strength: number,\n size: number,\n seed: number,\n): MeshStandardNodeMaterial {\n const material = graphMaterial('aurora');\n const random = mulberry32(seed);\n const [a, b, d] = [random() * TAU, random() * TAU, random() * TAU];\n // Curtains: a sine up the shape whose phase is pushed sideways by two more,\n // so the bands fold instead of lying flat, and a slower one that trades the\n // shape's color for its companion. Exact-tier ops only.\n const p = positionLocal.mul(float(1 / size));\n const fold: Expr = sin(p.x.mul(7.3).add(a)).mul(sin(p.z.mul(6.1).add(b)));\n const veil = smoothstep(\n 0.2,\n 0.9,\n sin(p.y.mul(17).add(fold.mul(2.6)).add(d))\n .mul(0.5)\n .add(0.5),\n );\n const trade = sin(p.y.mul(4.1).add(fold).add(a)).mul(0.5).add(0.5);\n material.colorNode = color(c.clone().multiplyScalar(0.05));\n material.emissiveNode = mix(color(companion(c)), color(c), trade)\n .mul(mix(float(0.06), float(1), veil))\n .mul(float(strength));\n return material;\n}\n\n/** Contour lines per shape size, the wobble that keeps them from being flat rings, and half a line's width as a fraction of the gap. */\nexport const TOPO = { lines: 11, wobble: 0.05, width: 0.09 } as const;\n\nfunction topoMaterial(\n c: THREE.Color,\n strength: number,\n size: number,\n seed: number,\n): MeshStandardNodeMaterial {\n const material = graphMaterial('topo');\n const random = mulberry32(seed);\n const [a, b] = [random() * TAU, random() * TAU];\n // A line wherever the surface's height (in the shape's own space, after\n // the noise pushed it) is a whole number of steps. A blob's lumps bend the\n // lines the way hills bend a map's. Exact-tier ops only.\n const p = positionLocal.mul(float(1 / size));\n const height: Expr = p.y.add(\n sin(p.x.mul(6.3).add(a))\n .mul(sin(p.z.mul(5.7).add(b)))\n .mul(TOPO.wobble),\n );\n const f = fract(height.mul(TOPO.lines));\n const line = oneMinus(\n smoothstep(TOPO.width * 0.45, TOPO.width, min(f, oneMinus(f))),\n );\n material.colorNode = color(c.clone().multiplyScalar(0.05));\n material.emissiveNode = color(c).mul(line).mul(float(strength));\n return material;\n}\n\n/** Stripes round a spiral shape, and how many radians they wind per shape size of height. */\nexport const SPIRAL = { arms: 4, twist: 7 } as const;\n\nfunction spiralMaterial(\n c: THREE.Color,\n size: number,\n seed: number,\n): MeshStandardNodeMaterial {\n const material = graphMaterial('spiral');\n const random = mulberry32(seed);\n // The angle round the shape's own axis, plus its height: a stripe that\n // climbs as it goes round. A whole number of arms, so the stripes meet\n // round the back. A lit surface, not an emitter. Exact-tier ops only.\n const p = positionLocal.mul(float(1 / size));\n const wind: Expr = sin(\n atan(p.z, p.x)\n .mul(SPIRAL.arms)\n .add(p.y.mul(SPIRAL.twist))\n .add(random() * TAU),\n );\n material.colorNode = mix(\n color(c),\n color(0xf2f2f5),\n smoothstep(-0.08, 0.08, wind),\n );\n return material;\n}\n\nfunction materialFor(\n shape: Shape,\n c: THREE.Color,\n strength: number,\n seed: number,\n): THREE.Material {\n switch (shape.finish) {\n case 'glow':\n // A dark base under a strong emission: the shape reads as light, not as a lit thing.\n return new THREE.MeshStandardMaterial({\n color: c.clone().multiplyScalar(0.1),\n emissive: c,\n emissiveIntensity: strength,\n roughness: ROUGHNESS.glow,\n metalness: 0,\n });\n case 'glass':\n return new THREE.MeshPhysicalMaterial({\n color: c,\n transmission: 1,\n ior: 1.5,\n thickness: shape.size * 0.5,\n attenuationColor: c,\n attenuationDistance: shape.size,\n roughness: ROUGHNESS.glass,\n metalness: 0,\n specularIntensity: 1,\n });\n case 'matte':\n return new THREE.MeshStandardMaterial({\n color: c,\n roughness: ROUGHNESS.matte,\n metalness: 0,\n });\n case 'satin':\n return new THREE.MeshStandardMaterial({\n color: c,\n roughness: ROUGHNESS.satin,\n metalness: 0,\n });\n case 'metal':\n return new THREE.MeshStandardMaterial({\n color: c,\n roughness: ROUGHNESS.metal,\n metalness: 1,\n });\n case 'rim':\n return rimMaterial(c, strength);\n case 'nebula':\n return nebulaMaterial(c, strength, shape.size, seed);\n case 'beacon':\n return beaconMaterial(c, strength, seed);\n case 'iris':\n return irisMaterial(c, shape.size, seed);\n case 'scan':\n return scanMaterial(c, strength, shape.size);\n case 'magma':\n return magmaMaterial(c, strength, shape.size, seed);\n case 'holo':\n return holoMaterial(c, strength);\n case 'aurora':\n return auroraMaterial(c, strength, shape.size, seed);\n case 'topo':\n return topoMaterial(c, strength, shape.size, seed);\n case 'spiral':\n return spiralMaterial(c, shape.size, seed);\n }\n}\n\n// ---------------------------------------------------------------------------\n// Build\n\n/**\n * Build a composition at `at` (the floor point the shapes' y is measured\n * from). Returns the group to add to the scene and the built shapes the\n * timeline and the glow follower work on.\n */\nexport function createComposition(\n spec: Composition,\n at: Vec3 = [0, 0, 0],\n): BuiltComposition {\n const seed = spec.seed ?? 1;\n const group = new THREE.Group();\n group.name = 'bakery3-composition';\n group.position.set(at[0], at[1], at[2]);\n const shapes: BuiltShape[] = [];\n for (const shape of spec.shapes) {\n const c = new THREE.Color(shape.color);\n const strength = shape.strength ?? DEFAULT_STRENGTH[shape.finish];\n const shapeSeed = (seed ^ hashString(shape.id)) >>> 0;\n const mesh = new THREE.Mesh(\n shapeGeometry(shape, seed),\n materialFor(shape, c, strength, shapeSeed),\n );\n mesh.name = `shape-${shape.id}`;\n mesh.position.set(shape.position[0], shape.position[1], shape.position[2]);\n const rotation: Vec3 = [\n THREE.MathUtils.degToRad(shape.rotation?.[0] ?? 0),\n THREE.MathUtils.degToRad(shape.rotation?.[1] ?? 0),\n THREE.MathUtils.degToRad(shape.rotation?.[2] ?? 0),\n ];\n mesh.rotation.set(rotation[0], rotation[1], rotation[2]);\n mesh.castShadow = true;\n mesh.receiveShadow = true;\n group.add(mesh);\n const built: BuiltShape = {\n spec: shape,\n mesh,\n base: {\n position: [...shape.position],\n rotation,\n strength,\n roughness: ROUGHNESS[shape.finish],\n color: c.clone(),\n },\n };\n const worth = glowWorth(shape.finish, strength);\n if (worth > 0) {\n // A beacon's strength is the glow it is worth (`BEACON_COVERAGE`), so\n // the two take the same stand-in; a patterned emitter takes the share\n // of one that its pattern lights.\n const light = new THREE.PointLight(\n c,\n worth * shape.size * shape.size * GLOW_LIGHT,\n 0,\n 2,\n );\n light.name = `glow-${shape.id}`;\n light.castShadow = false;\n // Viewport only: the render has the emission itself. Excluded here so\n // the capture never doubles the light with a lamp of its own.\n light.userData.bakery3 = { exclude: true };\n mesh.add(light);\n built.light = light;\n }\n shapes.push(built);\n }\n return { group, shapes };\n}\n\n/**\n * The glow a shape's emission is worth to the scene around it: what its\n * viewport stand-in light is sized by. Zero for a finish that lights nothing\n * (or, for the rim and the nebula, that has never carried a stand-in).\n */\nfunction glowWorth(finish: ShapeFinish, strength: number): number {\n if (finish === 'glow' || finish === 'beacon') return strength;\n return strength * (EMISSION_COVERAGE[finish] ?? 0);\n}\n\n/** Each frame: the stand-in light follows the emission the timeline is driving, and the loop's fade. */\nexport function followGlow(built: BuiltComposition): void {\n for (const shape of built.shapes) {\n if (!shape.light) continue;\n const material = shape.mesh.material as THREE.MeshStandardMaterial;\n const size2 = shape.spec.size * shape.spec.size;\n if (GRAPH_FINISHES.has(shape.spec.finish)) {\n // A graph's strength is a constant in it; what changes is the loop's\n // fade, which shrinks a node-material shape instead of dissolving it.\n const level = shape.mesh.scale.x;\n shape.light.intensity =\n glowWorth(shape.spec.finish, shape.base.strength) *\n size2 *\n GLOW_LIGHT *\n level;\n if (shape.halo) shape.halo.material.opacity = haloGain(shape) * level;\n continue;\n }\n shape.light.intensity =\n material.emissiveIntensity * material.opacity * size2 * GLOW_LIGHT;\n shape.light.color.copy(material.emissive);\n if (shape.halo) {\n shape.halo.material.opacity =\n (haloGain(shape) * material.emissiveIntensity * material.opacity) /\n Math.max(shape.base.strength, 1e-6);\n shape.halo.material.color.copy(material.emissive);\n }\n }\n}\n\n// ---------------------------------------------------------------------------\n// Halos: the viewport's stand-in for light scattered by fog\n\n/** A halo's diameter in shape sizes, and its opacity per unit of glow per unit of fog density, with the most it may reach. */\nconst HALO = { reach: 2.6, gain: 0.2, most: 0.5 } as const;\n\nlet haloTexture: THREE.DataTexture | undefined;\n\n/** A soft round falloff, made once: white in the middle, nothing at the edge. */\nfunction haloMap(): THREE.DataTexture {\n if (haloTexture) return haloTexture;\n const side = 64;\n const data = new Uint8Array(side * side * 4);\n for (let y = 0; y < side; y++)\n for (let x = 0; x < side; x++) {\n const r = Math.hypot(x + 0.5 - side / 2, y + 0.5 - side / 2) / (side / 2);\n const v = Math.round(255 * Math.pow(Math.max(0, 1 - r), 2.2));\n data.set([v, v, v, 255], (y * side + x) * 4);\n }\n haloTexture = new THREE.DataTexture(data, side, side, THREE.RGBAFormat);\n haloTexture.magFilter = THREE.LinearFilter;\n haloTexture.minFilter = THREE.LinearFilter;\n haloTexture.needsUpdate = true;\n return haloTexture;\n}\n\n/** A halo's opacity at the shape's base emission. */\nfunction haloGain(shape: BuiltShape): number {\n return (shape.halo?.userData.gain as number | undefined) ?? 0;\n}\n\n/**\n * Give every emitter that carries a stand-in light a soft halo, for a scene\n * with fog in it. In the render, fog is a volume and the light an emitter\n * sends into it is scattered back to the eye, so each one sits in a glow of\n * its own color; a rasterizer's fog only fades things with distance. The\n * halo is that glow's stand-in: an additive sprite on the shape, brighter\n * for a stronger emitter and a denser fog, excluded from the capture\n * (`userData.bakery3.exclude`). `followGlow` keeps it on the emission every\n * frame. What it cannot stand in for is a beam: the shafts a beacon's points\n * sweep through the fog are in the render only.\n *\n * `density` is the fog's own (`FogExp2.density`). Returns how many halos\n * were added; calling it again replaces them.\n */\nexport function addHalos(built: BuiltComposition, density: number): number {\n let added = 0;\n for (const shape of built.shapes) {\n if (shape.halo) {\n shape.mesh.remove(shape.halo);\n shape.halo.material.dispose();\n delete shape.halo;\n }\n if (!shape.light || !(density > 0)) continue;\n const gain = Math.min(\n HALO.most,\n glowWorth(shape.spec.finish, shape.base.strength) * density * HALO.gain,\n );\n const halo = new THREE.Sprite(\n new THREE.SpriteMaterial({\n map: haloMap(),\n color: shape.base.color,\n blending: THREE.AdditiveBlending,\n transparent: true,\n depthWrite: false,\n fog: false,\n opacity: gain,\n }),\n );\n halo.name = `halo-${shape.spec.id}`;\n halo.scale.setScalar(shape.spec.size * HALO.reach);\n halo.userData.gain = gain;\n halo.userData.bakery3 = { exclude: true };\n shape.mesh.add(halo);\n shape.halo = halo;\n added++;\n }\n return added;\n}\n\n/** Finishes whose look in the viewport is mostly what they reflect. */\nconst REFLECTIVE: ReadonlySet<ShapeFinish> = new Set([\n 'glass',\n 'metal',\n 'satin',\n 'matte',\n 'iris',\n 'spiral',\n]);\n\n/** Finishes that are light sources: they stay in the reflection snapshot, and it follows them. */\nconst EMITTERS: ReadonlySet<ShapeFinish> = new Set([\n 'glow',\n 'rim',\n 'nebula',\n 'beacon',\n 'scan',\n 'magma',\n 'holo',\n 'aurora',\n 'topo',\n]);\n\n/** An emitter as the last snapshot saw it. */\nexport type EmitterPose = { id: string; position: Vec3; strength: number };\n\n/** Where every emitter is and how hard it glows, right now. */\nexport function emitterPoses(built: BuiltComposition): EmitterPose[] {\n const world = new THREE.Vector3();\n return built.shapes\n .filter((s) => EMITTERS.has(s.spec.finish))\n .map((s) => {\n s.mesh.getWorldPosition(world);\n const material = s.mesh.material as THREE.MeshStandardMaterial;\n // A fading emitter dims by its opacity, a shrinking graph by its size.\n return {\n id: s.spec.id,\n position: [world.x, world.y, world.z],\n strength:\n (material.emissiveIntensity ?? 1) * material.opacity * s.mesh.scale.x,\n };\n });\n}\n\n/**\n * Whether a snapshot taken at `before` is stale now: an emitter moved more\n * than a centimeter, or its glow changed by more than a twentieth. The\n * thresholds are what a reflection in a lumpy glass shows; a nearer move is\n * invisible and not worth six cube faces.\n */\nexport function emittersMoved(\n before: EmitterPose[],\n after: EmitterPose[],\n): boolean {\n if (before.length !== after.length) return true;\n for (let i = 0; i < before.length; i++) {\n const a = before[i]!;\n const b = after[i]!;\n if (a.id !== b.id) return true;\n const d = Math.hypot(\n a.position[0] - b.position[0],\n a.position[1] - b.position[1],\n a.position[2] - b.position[2],\n );\n if (d > 0.01) return true;\n if (\n Math.abs(a.strength - b.strength) >\n 0.05 * Math.max(Math.abs(a.strength), 1e-6)\n )\n return true;\n }\n return false;\n}\n\nexport type Reflections = {\n /** How many shapes took the snapshot. Zero when the scene has its own environment map, or nothing reflects. */\n shapes: number;\n /** Take the snapshot again now (after the setting changed, say). */\n refresh(): Promise<void>;\n /** Once a frame: takes the snapshot again when an emitter has moved or changed its glow since the last one. */\n follow(): void;\n /**\n * True while a snapshot is being taken. The reflective shapes are hidden\n * for that long (they must not reflect themselves), across an await, so a\n * frame drawn meanwhile shows the composition without them: a render loop\n * should keep its last frame up instead of drawing one.\n */\n readonly busy: boolean;\n /**\n * For filming frame by frame: resolves once no snapshot is in flight and\n * the last one is of the emitters where they are now, with every shape\n * visible again. Await it after a seek and before the shot, or the shot\n * catches the glass hidden.\n */\n settle(): Promise<void>;\n /** Free the render target. The materials keep no map after this. */\n dispose(): void;\n};\n\n/** How often `follow` will take a new snapshot at most, in milliseconds. */\nconst FOLLOW_INTERVAL_MS = 100;\n\n/**\n * Give the reflective shapes something to reflect in the viewport: the\n * scene as seen from the composition's center (the setting and the\n * composition's own emitters, without the reflective shapes themselves),\n * filtered into a PMREM. Called once after the setting is built; a scene\n * that already has an environment map needs nothing. Call `follow()` on the\n * handle every frame so a moving or breathing emitter is reflected where it\n * is.\n */\nexport async function snapshotReflections(\n renderer: WebGPURenderer,\n scene: THREE.Scene,\n built: BuiltComposition,\n center: Vec3,\n): Promise<Reflections> {\n const none: Reflections = {\n shapes: 0,\n refresh: async () => {},\n follow: () => {},\n busy: false,\n settle: async () => {},\n dispose: () => {},\n };\n if (scene.environment) return none;\n const targets = built.shapes.filter((s) => REFLECTIVE.has(s.spec.finish));\n if (!targets.length) return none;\n const position = new THREE.Vector3(center[0], center[1], center[2]);\n let current: THREE.RenderTarget | undefined;\n /** The snapshot before `current`, on a three that cannot reuse a target: kept one more round, see `take`. */\n let retired: THREE.RenderTarget | undefined;\n let last: EmitterPose[] = [];\n let lastAt = 0;\n let busy: Promise<void> | undefined;\n let disposed = false;\n\n // One generator and one render target for the life of the handle. WebGPU\n // rejects a whole submit that touches a destroyed texture, and three names\n // the generator's scratch target like its output, so a generator made and\n // disposed per snapshot (or an output freed as it is replaced) drops every\n // frame after the first re-snapshot: the canvas freezes on the last good\n // one while the timeline goes on moving the scene underneath it. The\n // snapshot is rendered into the same target again instead, and nothing is\n // freed until `dispose()`.\n const generator = new PMREMGenerator(renderer);\n\n const take = async (): Promise<void> => {\n const hidden = targets.map((s) => [s.mesh, s.mesh.visible] as const);\n for (const [mesh] of hidden) mesh.visible = false;\n try {\n last = emitterPoses(built);\n lastAt = performance.now();\n const target = await generator.fromSceneAsync(scene, 0.03, 0.1, 100, {\n position,\n ...(current ? { renderTarget: current } : {}),\n });\n if (disposed) {\n if (target !== current) target.dispose();\n return;\n }\n if (target !== current) {\n // The first snapshot, or a three that takes no `renderTarget` and\n // hands back a new one each time: that one is kept a round longer\n // than it is used, for the same reason.\n for (const shape of targets) {\n const material = shape.mesh.material as THREE.MeshStandardMaterial;\n material.envMap = target.texture;\n material.envMapIntensity = 1;\n material.needsUpdate = true;\n }\n retired?.dispose();\n retired = current;\n current = target;\n }\n } finally {\n for (const [mesh, visible] of hidden) mesh.visible = visible;\n }\n };\n\n const refresh = (): Promise<void> => {\n if (!busy) busy = take().finally(() => (busy = undefined));\n return busy;\n };\n\n await refresh();\n return {\n shapes: targets.length,\n refresh,\n follow() {\n if (disposed || busy || performance.now() - lastAt < FOLLOW_INTERVAL_MS)\n return;\n if (emittersMoved(last, emitterPoses(built))) void refresh();\n },\n get busy() {\n return busy !== undefined;\n },\n async settle() {\n // One in flight was started for an earlier pose; wait it out, then\n // take the one this pose needs.\n if (busy) await busy;\n if (!disposed && emittersMoved(last, emitterPoses(built)))\n await refresh();\n },\n dispose() {\n disposed = true;\n for (const shape of targets) {\n const material = shape.mesh.material as THREE.MeshStandardMaterial;\n material.envMap = null;\n material.needsUpdate = true;\n }\n current?.dispose();\n retired?.dispose();\n current = undefined;\n retired = undefined;\n generator.dispose();\n },\n };\n}\n\n// ---------------------------------------------------------------------------\n// Motion\n\nconst TAU = Math.PI * 2;\nconst easeInOut = (u: number) =>\n u < 0.5 ? 2 * u * u : 1 - Math.pow(-2 * u + 2, 2) / 2;\nconst smoothstep01 = (x: number) =>\n x <= 0 ? 0 : x >= 1 ? 1 : x * x * (3 - 2 * x);\n\n/** The longest a composition takes to fade out before the seam, and in after it. A quarter of a short clip at most. */\nexport const LOOP_FADE_SECONDS = 1.5;\n\n/**\n * How a clip loops. `fade` is seconds of fade-out at the end and fade-in at\n * the start (0: the clip loops by itself); `start` is the frame the cut opens\n * on, the first one after the fade-in, so the loop never opens on an empty\n * stage.\n */\nexport type Loop = { fade: number; start: number };\n\n/** Whether a motion comes back to where it started by the end of the clip: cyclic, in whole turns or cycles. */\nexport function motionLoops(m: Motion): boolean {\n switch (m.kind) {\n case 'spin':\n case 'tumble':\n case 'orbit':\n return Number.isInteger(m.turns ?? 1);\n case 'pulse':\n case 'glow':\n return Number.isInteger(m.cycles ?? 2);\n case 'bob':\n return Number.isInteger(m.cycles ?? 1);\n case 'drift':\n case 'tint':\n case 'frost':\n return false;\n }\n}\n\n/**\n * How a clip of `spec` loops: by itself when the camera move (in the\n * timeline's own terms: `orbitY`, `orbitX`, `dolly`) comes back to its start\n * and every motion the shapes actually run is cyclic; otherwise with a fade.\n */\nexport function compositionLoop(\n spec: Composition,\n clip: {\n seconds: number;\n fps: number;\n camera?: { orbitY?: number; orbitX?: number; dolly?: number };\n },\n): Loop {\n const camera = clip.camera ?? {};\n const cameraLoops =\n (camera.orbitY ?? 0) % 360 === 0 && !camera.orbitX && !camera.dolly;\n const motionsLoop = spec.shapes.every((s) =>\n (s.motion ?? []).every(\n (m) => !motionSuits(m.kind, s.finish) || motionLoops(m),\n ),\n );\n if (cameraLoops && motionsLoop) return { fade: 0, start: 0 };\n const frames = Math.max(1, Math.round(clip.seconds * clip.fps));\n const fade = Math.min(LOOP_FADE_SECONDS, clip.seconds / 4);\n return { fade, start: Math.min(frames - 1, Math.ceil(fade * clip.fps)) };\n}\n\n/** How present the composition is at `time` in a clip that loops with `fade`: 0 at the seam, 1 once faded in. */\nexport function loopPresence(\n time: number,\n duration: number,\n fade: number,\n): number {\n if (fade <= 0) return 1;\n return Math.min(\n smoothstep01(time / fade),\n smoothstep01((duration - time) / fade),\n );\n}\n\n/**\n * The graph finishes are rebuilt by the renderer, so there is no single\n * opacity to fade; they shrink to nothing instead. Every other finish fades\n * its opacity, which renders as a true dissolve.\n */\nconst fadesByScale = (finish: ShapeFinish) => GRAPH_FINISHES.has(finish);\n\ntype Pose = {\n position: Vec3;\n rotation: Vec3;\n scale: number;\n strength: number;\n roughness: number;\n color: THREE.Color;\n opacity: number;\n};\n\n/** Where a shape is at `u` (0–1 through the clip), from its base and its motions. */\nfunction poseAt(shape: BuiltShape, u: number): Pose {\n const b = shape.base;\n const pose: Pose = {\n position: [...b.position],\n rotation: [...b.rotation],\n scale: 1,\n strength: b.strength,\n roughness: b.roughness,\n color: b.color.clone(),\n opacity: 1,\n };\n for (const m of shape.spec.motion ?? []) {\n if (!motionSuits(m.kind, shape.spec.finish)) continue;\n switch (m.kind) {\n case 'spin': {\n const axis = m.axis === 'x' ? 0 : m.axis === 'z' ? 2 : 1;\n pose.rotation[axis] += (m.turns ?? 1) * TAU * u;\n break;\n }\n case 'tumble':\n pose.rotation[0] += (m.turns ?? 1) * TAU * u;\n pose.rotation[2] += (m.turns ?? 1) * TAU * u;\n break;\n case 'pulse':\n pose.scale *=\n 1 + (m.amount ?? 0.12) * Math.sin(TAU * (m.cycles ?? 2) * u);\n break;\n case 'bob':\n pose.position[1] +=\n (m.amount ?? 0.12) * Math.sin(TAU * (m.cycles ?? 1) * u);\n break;\n case 'orbit': {\n const radius = m.radius ?? Math.hypot(b.position[0], b.position[2]);\n const start = Math.atan2(b.position[2], b.position[0]);\n const angle = start + (m.turns ?? 1) * TAU * u;\n pose.position[0] = Math.cos(angle) * radius;\n pose.position[2] = Math.sin(angle) * radius;\n break;\n }\n case 'drift': {\n const e = easeInOut(u);\n for (let i = 0; i < 3; i++)\n pose.position[i] = b.position[i]! + (m.to[i]! - b.position[i]!) * e;\n break;\n }\n case 'glow':\n pose.strength =\n b.strength *\n (1 + (m.amount ?? 0.6) * Math.sin(TAU * (m.cycles ?? 2) * u));\n break;\n case 'tint':\n pose.color = b.color.clone().lerp(new THREE.Color(m.to), easeInOut(u));\n break;\n case 'frost':\n pose.roughness =\n b.roughness + ((m.to ?? 0.6) - b.roughness) * easeInOut(u);\n break;\n }\n }\n return pose;\n}\n\ntype Animated =\n | 'position'\n | 'rotation'\n | 'scale'\n | 'emissiveIntensity'\n | 'color'\n | 'emissive'\n | 'roughness'\n | 'opacity';\n\n/** Which properties a shape's motions (and the loop's fade) touch, so only those get a track. */\nfunction touched(shape: BuiltShape, fades: boolean): Set<Animated> {\n const out = new Set<Animated>();\n if (fades) out.add(fadesByScale(shape.spec.finish) ? 'scale' : 'opacity');\n for (const m of shape.spec.motion ?? []) {\n if (!motionSuits(m.kind, shape.spec.finish)) continue;\n if (m.kind === 'spin' || m.kind === 'tumble') out.add('rotation');\n else if (m.kind === 'pulse') out.add('scale');\n else if (m.kind === 'bob' || m.kind === 'orbit' || m.kind === 'drift')\n out.add('position');\n else if (m.kind === 'glow') out.add('emissiveIntensity');\n else if (m.kind === 'tint')\n out.add(shape.spec.finish === 'glow' ? 'emissive' : 'color');\n else if (m.kind === 'frost') out.add('roughness');\n }\n return out;\n}\n\n/**\n * Put every shape's motions on the timeline, one keyframe per output frame.\n * The timeline then drives the live meshes on `seek()` and ships the same\n * samples in the manifest: one evaluator, two halves.\n *\n * Pass the clip's `compositionLoop()` so a clip that cannot loop by itself\n * fades the shapes out at its end and in at its start; then open the cut on\n * `loop.start`, not on frame 0.\n */\nexport function animateComposition(\n tl: Timeline,\n built: BuiltComposition,\n duration: number,\n fps: number,\n loop: Loop = { fade: 0, start: 0 },\n): number {\n const frames = Math.max(1, Math.round(duration * fps));\n const fades = loop.fade > 0;\n let tracks = 0;\n for (const shape of built.shapes) {\n const props = touched(shape, fades);\n if (!props.size) continue;\n const lanes = [...props].map((property) => ({\n property,\n track: tl.track(shape.mesh, property),\n }));\n const byScale = fadesByScale(shape.spec.finish);\n for (let f = 0; f < frames; f++) {\n const time = f / fps;\n const pose = poseAt(shape, duration > 0 ? time / duration : 0);\n if (fades) {\n const presence = loopPresence(time, duration, loop.fade);\n // Never exactly zero: a singular matrix is a transform nobody can decompose.\n if (byScale) pose.scale *= Math.max(presence, 1e-3);\n else pose.opacity = presence;\n }\n for (const { property, track } of lanes) {\n const value =\n property === 'position'\n ? pose.position\n : property === 'rotation'\n ? pose.rotation\n : property === 'scale'\n ? [pose.scale, pose.scale, pose.scale]\n : property === 'emissiveIntensity'\n ? [pose.strength]\n : property === 'roughness'\n ? [pose.roughness]\n : property === 'opacity'\n ? [pose.opacity]\n : [pose.color.r, pose.color.g, pose.color.b];\n track.keyframes.push({ time, value: [...value] });\n }\n }\n tracks += lanes.length;\n }\n return tracks;\n}\n"]}