Build and revise procedural 3D assets with your coding agent. Local MCP server, CLI and TypeScript engine with rendered review, editable source and GLB export.
JavaScript 3d3d-assets3d-modelingagent-skillsagent-toolsai-agentsasset-pipelinecligame-assetsglbgltfmcpmcp-servermodel-context-protocolprocedural-generationprocedural-modelingtext-to-3dthreejstypescript
feat(gallery): shepherd 18 curated demo additions and compact 27-asset collection display (#57)
Matthew Kissingeracb9cd09bdf9
diff --git a/README.md b/README.mdindex ae9ee3d8..a418adb6 100644--- a/README.md+++ b/README.md@@ -13,9 +13,7 @@ Kiln runs locally. It includes an MCP server, a CLI, a TypeScript library, and sfor authoring, editing, animation review, and scene composition. Your agent suppliesthe model; Kiln does not require a separate model API key for its tools.-<video src="assets/video/kiln-launch.mp4" poster="assets/video/kiln-launch-poster.png" controls="controls" width="100%">- <a href="assets/video/kiln-launch.mp4">Watch the Kiln launch video (2:44)</a>-</video>+https://github.com/user-attachments/assets/69bc8b31-9be0-4f71-8cc8-2cc72747ce75diff --git a/docs/demo-gallery-additions.md b/docs/demo-gallery-additions.mdnew file mode 100644index 00000000..812adcca--- /dev/null+++ b/docs/demo-gallery-additions.md@@ -0,0 +1,24 @@+# Recorded demo additions++Saved source is preserved without geometry edits. Earlier saved revisions remain available in each example history. Model attribution is left unverified where no reliable run label was found.++- demo-diesel-locomotive: GPT-6 Astra / ChatGPT Work; 2 saved revision(s).+- demo-floating-observatory: GPT-6 Astra / ChatGPT Work; 2 saved revision(s).+- demo-deep-sea-station: Gemini 3.8 Flash / Antigravity CLI; 2 saved revision(s).+- demo-clockwork-dragonfly: Muse Spark 1.3 / OpenCode; 2 saved revision(s).+- demo-dauntless-cv-08: GPT-6 Astra / ChatGPT Work; 2 saved revision(s).+- demo-noctilus-nuclear-submarine: GPT-6 Astra / ChatGPT Work; 2 saved revision(s).+- demo-ocean-salvage-tug: Muse Spark 1.3 / OpenCode; 2 saved revision(s).+- demo-resolute-polar-fleet-flagship: Not independently recorded / Recorded demo session; 3 saved revision(s).+- demo-art-deco-conservatory: Gemini 3.8 Flash / Antigravity CLI; 1 saved revision(s).+- demo-unfolding-dragonfly: Gemini 3.8 Flash / Antigravity CLI; 1 saved revision(s).+- demo-solar-sail-courier: Gemini 3.8 Flash / Antigravity CLI; 1 saved revision(s).+- demo-brass-orrery: Gemini 3.8 Flash / Antigravity CLI; 1 saved revision(s).+- demo-argent-aircraft-carrier: GPT-6 Astra / ChatGPT Work; 2 saved revision(s).+- demo-umbra-submarine: GPT-6 Astra / ChatGPT Work; 2 saved revision(s).+- demo-battleship: Gemini 3.8 Flash / Antigravity CLI; 2 saved revision(s).+- demo-vintage-typewriter: Muse Spark 1.3 / OpenCode; 2 saved revision(s).+- demo-greywatch-stylized-aircraft-carrier: Not independently recorded / Recorded demo session; 1 saved revision(s).+- demo-abyssal-crown-deep-ocean-submarine: Not independently recorded / Recorded demo session; 2 saved revision(s).++Three setup-diagnostic revisions are retained in the private demo archive.diff --git a/examples/demo-abyssal-crown-deep-ocean-submarine.kiln.js b/examples/demo-abyssal-crown-deep-ocean-submarine.kiln.jsnew file mode 100644index 00000000..98bd3dd9--- /dev/null+++ b/examples/demo-abyssal-crown-deep-ocean-submarine.kiln.js@@ -0,0 +1,292 @@+const meta = {+ name: 'Abyssal Crown Deep-Ocean Submarine',+ category: 'vehicle',+ role: 'vehicle'+};++const P = {+ hullY: 2.18,+ hullVerticalScale: 0.88,+ stations: [+ [-7.15, 0.10], [-6.92, 0.52], [-6.35, 1.10], [-5.25, 1.48],+ [-3.20, 1.70], [-0.60, 1.80], [2.35, 1.82], [4.25, 1.67],+ [5.65, 1.30], [6.55, 0.72], [6.98, 0.16], [7.06, 0.06]+ ]+};++function ownedGeo(positions, indices, uvs) {+ return meshGeo({ positions, indices, uvs });+}++function hullHalfGeo(upper) {+ const positions = [], indices = [], uvs = [];+ const rings = P.stations.length;+ const around = 28;+ const a0 = upper ? -Math.PI * 0.5 : Math.PI * 0.5;+ const a1 = upper ? Math.PI * 0.5 : Math.PI * 1.5;+ for (let i = 0; i < rings; i++) {+ const x = P.stations[i][0];+ const r = P.stations[i][1];+ for (let j = 0; j <= around; j++) {+ const t = j / around;+ const a = a0 + (a1 - a0) * t;+ positions.push(x, r * P.hullVerticalScale * Math.cos(a), r * Math.sin(a));+ uvs.push(i / (rings - 1), t);+ }+ }+ const row = around + 1;+ for (let i = 0; i < rings - 1; i++) {+ for (let j = 0; j < around; j++) {+ const a = i * row + j, b = (i + 1) * row + j;+ const c = a + 1, d = b + 1;+ indices.push(a, c, b, b, c, d);+ }+ }+ return ownedGeo(positions, indices, uvs);+}++function hullRadiusAt(x) {+ const s = P.stations;+ if (x <= s[0][0]) return s[0][1];+ if (x >= s[s.length - 1][0]) return s[s.length - 1][1];+ for (let i = 0; i < s.length - 1; i++) {+ if (x >= s[i][0] && x <= s[i + 1][0]) {+ const t = (x - s[i][0]) / (s[i + 1][0] - s[i][0]);+ return s[i][1] * (1 - t) + s[i + 1][1] * t;+ }+ }+ return 1;+}++function waterlineBandGeo(thetaCenter) {+ const positions = [], indices = [], uvs = [];+ const rows = 4;+ const halfAngle = 0.025;+ for (let i = 0; i < P.stations.length; i++) {+ const x = P.stations[i][0];+ const r = P.stations[i][1] + 0.014;+ for (let j = 0; j < rows; j++) {+ const t = j / (rows - 1);+ const a = thetaCenter - halfAngle + 2 * halfAngle * t;+ positions.push(x, r * P.hullVerticalScale * Math.cos(a), r * Math.sin(a));+ uvs.push(i / (P.stations.length - 1), t);+ }+ }+ for (let i = 0; i < P.stations.length - 1; i++) {+ for (let j = 0; j < rows - 1; j++) {+ const a = i * rows + j, b = (i + 1) * rows + j;+ const c = a + 1, d = b + 1;+ indices.push(a, c, b, b, c, d);+ }+ }+ return ownedGeo(positions, indices, uvs);+}++function prismXY(points, depth) {+ const p = [], idx = [], n = points.length;+ for (let side = -1; side <= 1; side += 2) {+ for (const q of points) p.push(q[0], q[1], side * depth * 0.5);+ }+ for (let i = 1; i < n - 1; i++) {+ idx.push(0, i + 1, i);+ idx.push(n, n + i, n + i + 1);+ }+ for (let i = 0; i < n; i++) {+ const k = (i + 1) % n;+ idx.push(i, k, n + i, k, n + k, n + i);+ }+ return ownedGeo(p, idx);+}++function prismXZ(points, height) {+ const p = [], idx = [], n = points.length;+ for (let side = -1; side <= 1; side += 2) {+ for (const q of points) p.push(q[0], side * height * 0.5, q[1]);+ }+ for (let i = 1; i < n - 1; i++) {+ idx.push(0, i, i + 1);+ idx.push(n, n + i + 1, n + i);+ }+ for (let i = 0; i < n; i++) {+ const k = (i + 1) % n;+ idx.push(i, n + i, k, k, n + i, n + k);+ }+ return ownedGeo(p, idx);+}++async function build() {+ const root = createRoot('AbyssalCrown_Submarine');++ const charcoal = gameMaterial(0x182228, { metalness: 0.72, roughness: 0.30 });+ const charcoalSoft = gameMaterial(0x26343a, { metalness: 0.62, roughness: 0.38 });+ const lowerRed = gameMaterial(0x66161d, { metalness: 0.48, roughness: 0.38 });+ const pale = gameMaterial(0xd9d5c2, { metalness: 0.35, roughness: 0.34 });+ const brass = gameMaterial(0xb8893f, { metalness: 0.88, roughness: 0.23 });+ const dark = gameMaterial(0x090e11, { metalness: 0.78, roughness: 0.29 });+ const rubber = gameMaterial(0x121619, { metalness: 0.12, roughness: 0.70 });+ const baseMat = gameMaterial(0x101518, { metalness: 0.60, roughness: 0.32 });++ createPart('UpperPressureHull', hullHalfGeo(true), charcoal, {+ position: [0, P.hullY, 0], parent: root+ });+ createPart('LowerPressureHull', hullHalfGeo(false), lowerRed, {+ position: [0, P.hullY, 0], parent: root+ });+ createPart('Waterline_Starboard', waterlineBandGeo(Math.PI * 0.5), pale, {+ position: [0, P.hullY, 0], parent: root+ });+ createPart('Waterline_Port', waterlineBandGeo(-Math.PI * 0.5), pale, {+ position: [0, P.hullY, 0], parent: root+ });++ const seamXs = [-4.65, -2.35, 0.15, 2.65, 4.65];+ for (let i = 0; i < seamXs.length; i++) {+ const x = seamXs[i], r = hullRadiusAt(x) + 0.018;+ createPart('PressureRing_' + (i + 1), torusGeo(r, 0.018, 8, 48), charcoalSoft, {+ position: [x, P.hullY, 0], rotation: [0, 90, 0],+ scale: [1, P.hullVerticalScale, 1], parent: root+ });+ }++ const sailFairing = sphereGeo(1, 48, 24);+ createPart('SailBaseFairing', sailFairing, charcoalSoft, {+ position: [0.55, 3.47, 0], scale: [1.72, 0.46, 0.70], parent: root+ });+ const sailBody = await roundedBoxGeo(2.55, 2.07, 0.78, 0.20, { segments: 8, smooth: true });+ createPart('CommandSail', sailBody, charcoal, {+ position: [0.48, 4.45, 0], rotation: [0, 0, -3], parent: root+ });+ const sailCap = await roundedBoxGeo(1.92, 0.12, 0.66, 0.055, { segments: 6, smooth: true });+ createPart('SailCap', sailCap, pale, {+ position: [0.46, 5.49, 0], rotation: [0, 0, -3], parent: root+ });++ const mastPositions = [+ ['AttackPeriscope', 0.05, 6.02, -0.08, 0.075, 0.98],+ ['SearchPeriscope', 0.68, 5.95, 0.12, 0.065, 0.78],+ ['SensorMast', -0.48, 5.87, 0.10, 0.055, 0.62]+ ];+ for (let i = 0; i < mastPositions.length; i++) {+ const m = mastPositions[i];+ createPart(m[0] + '_Stem', cylinderGeo(m[4], m[4], m[5], 20), i === 2 ? brass : charcoalSoft, {+ position: [m[1], m[2], m[3]], parent: root+ });+ createPart(m[0] + '_Collar', cylinderGeo(m[4] * 2.15, m[4] * 2.15, 0.13, 24), brass, {+ position: [m[1], m[2] - m[5] * 0.46, m[3]], parent: root+ });+ }+ createPart('AttackPeriscope_Head', cylinderGeo(0.082, 0.082, 0.34, 20), charcoalSoft, {+ position: [0.20, 6.46, -0.08], rotation: [0, 0, 90], parent: root+ });+ createPart('AttackPeriscope_Lens', cylinderGeo(0.055, 0.055, 0.025, 20), brass, {+ position: [0.375, 6.46, -0.08], rotation: [0, 0, 90], parent: root+ });+ createPart('SearchPeriscope_Head', cylinderGeo(0.072, 0.072, 0.28, 20), charcoalSoft, {+ position: [0.81, 6.31, 0.12], rotation: [0, 0, 90], parent: root+ });++ const hatchXs = [-3.15, -1.42, 2.60, 4.08];+ for (let i = 0; i < hatchXs.length; i++) {+ const x = hatchXs[i];+ const top = P.hullY + hullRadiusAt(x) * P.hullVerticalScale;+ createPart('DeckHatch_' + (i + 1), cylinderGeo(0.27, 0.27, 0.055, 32), charcoalSoft, {+ position: [x, top + 0.02, 0], parent: root+ });+ createPart('DeckHatchRing_' + (i + 1), torusGeo(0.27, 0.024, 8, 32), brass, {+ position: [x, top + 0.055, 0], rotation: [90, 0, 0], parent: root+ });+ createPart('DeckHatchDog_' + (i + 1), await roundedBoxGeo(0.28, 0.035, 0.055, 0.014, { segments: 4 }), brass, {+ position: [x, top + 0.085, 0], rotation: [0, i % 2 ? 35 : -35, 0], parent: root+ });+ }++ for (const side of [-1, 1]) {+ for (let i = 0; i < 3; i++) {+ const x = 4.25 + i * 0.48;+ const z = side * (hullRadiusAt(x) + 0.015);+ createPart((side > 0 ? 'Starboard' : 'Port') + '_BowPanel_' + (i + 1),+ cylinderGeo(0.12, 0.12, 0.025, 24), i === 1 ? brass : charcoalSoft, {+ position: [x, P.hullY + 0.12 - i * 0.10, z],+ rotation: [90, 0, 0], parent: root+ });+ }+ createPart((side > 0 ? 'Starboard' : 'Port') + '_SailPlaque',+ await roundedBoxGeo(0.78, 0.16, 0.035, 0.012, { segments: 5 }), brass, {+ position: [0.55, 4.48, side * 0.405], parent: root+ });+ }++ const topFin = prismXY([[-1.05, 0], [0.72, 0], [0.16, 1.62], [-0.72, 1.45]], 0.20);+ const bottomFin = prismXY([[-1.05, 0], [0.72, 0], [0.16, -0.72], [-0.74, -0.66]], 0.20);+ createPart('UpperTailFin', topFin, charcoal, {+ position: [-5.82, 3.10, 0], parent: root+ });+ createPart('LowerTailFin', bottomFin, lowerRed, {+ position: [-5.82, 1.24, 0], parent: root+ });++ const rightFin = prismXZ([[-1.05, 0], [0.72, 0], [0.14, 1.72], [-0.76, 1.46]], 0.18);+ const leftFin = prismXZ([[-1.05, 0], [0.72, 0], [0.14, -1.72], [-0.76, -1.46]], 0.18);+ createPart('StarboardTailFin', rightFin, charcoal, {+ position: [-5.82, P.hullY, 0.66], parent: root+ });+ createPart('PortTailFin', leftFin, charcoal, {+ position: [-5.82, P.hullY, -0.66], parent: root+ });++ const shroudX = -7.43;+ createPart('PropulsorShroudFront', torusGeo(0.82, 0.14, 12, 48), charcoalSoft, {+ position: [shroudX + 0.18, P.hullY, 0], rotation: [0, 90, 0],+ scale: [1, 0.94, 1], parent: root+ });+ createPart('PropulsorShroudRear', torusGeo(0.82, 0.11, 12, 48), dark, {+ position: [shroudX - 0.22, P.hullY, 0], rotation: [0, 90, 0],+ scale: [1, 0.94, 1], parent: root+ });+ const shroudBrace = await roundedBoxGeo(0.46, 0.08, 0.08, 0.025, { segments: 4 });+ for (let i = 0; i < 4; i++) {+ const a = i * Math.PI * 0.5;+ createPart('ShroudBrace_' + (i + 1), shroudBrace, charcoalSoft, {+ position: [shroudX - 0.02, P.hullY + 0.72 * Math.cos(a), 0.72 * Math.sin(a)],+ rotation: [a * 180 / Math.PI, 0, 0], parent: root+ });+ }+ createPart('PropulsorHub', cylinderGeo(0.18, 0.24, 0.64, 32), brass, {+ position: [shroudX - 0.02, P.hullY, 0], rotation: [0, 0, 90], parent: root+ });+ const blade = await roundedBoxGeo(0.22, 0.075, 0.56, 0.028, { segments: 5, smooth: true });+ for (let i = 0; i < 7; i++) {+ const a = i * Math.PI * 2 / 7;+ createPart('PropulsorBlade_' + (i + 1), blade, brass, {+ position: [shroudX - 0.12, P.hullY + 0.35 * Math.cos(a), 0.35 * Math.sin(a)],+ rotation: [a * 180 / Math.PI + 18, 18, 0], parent: root+ });+ }++ const base = await roundedBoxGeo(12.6, 0.28, 3.15, 0.12, { segments: 8, smooth: true });+ createPart('DisplayPlinth', base, baseMat, {+ position: [-0.10, 0.14, 0], parent: root+ });+ const foot = await roundedBoxGeo(0.72, 0.72, 1.30, 0.11, { segments: 7, smooth: true });+ const cradle = await roundedBoxGeo(0.54, 0.12, 1.82, 0.05, { segments: 6, smooth: true });+ for (const x of [-3.25, 3.05]) {+ createPart('DisplayStanchion_' + x, foot, dark, {+ position: [x, 0.58, 0], parent: root+ });+ createPart('BrassCradle_' + x, cradle, brass, {+ position: [x, 0.98, 0], parent: root+ });+ createPart('CradlePad_' + x, await roundedBoxGeo(0.62, 0.08, 1.55, 0.03, { segments: 4 }), rubber, {+ position: [x, 1.06, 0], parent: root+ });+ }+ const plaque = await roundedBoxGeo(2.45, 0.42, 0.09, 0.04, { segments: 6, smooth: true });+ createPart('ModelNamePlaque', plaque, brass, {+ position: [0.25, 0.31, 1.61], rotation: [-8, 0, 0], parent: root+ });+ createPart('PlaqueInset', await roundedBoxGeo(2.12, 0.24, 0.035, 0.014, { segments: 5 }), dark, {+ position: [0.25, 0.31, 1.665], rotation: [-8, 0, 0], parent: root+ });++ return root;+}\ No newline at end of filediff --git a/examples/demo-abyssal-crown-deep-ocean-submarine.provenance.json b/examples/demo-abyssal-crown-deep-ocean-submarine.provenance.jsonnew file mode 100644index 00000000..b349d28c--- /dev/null+++ b/examples/demo-abyssal-crown-deep-ocean-submarine.provenance.json@@ -0,0 +1,33 @@+{+ "sourceHash": "d67f971a1d0fe3aa2e7f183bde88e0c5a7fbd455f05a41a654890c59e3186b6e",+ "model": "Not independently recorded",+ "harness": "Recorded demo session",+ "authoredDate": "2026-09-08",+ "provenance": {+ "attribution": "Recorded demo session; model credit supplied only where the retained run identifies it.",+ "sourceAccess": "See retained demo run; no stronger isolation claim is made.",+ "humanIntervention": "Owner supplied direction; model-authored exported source preserved byte-for-byte.",+ "reviewFidelity": "Authoring feedback and shaded demo previews where available. Not a destination-runtime acceptance claim.",+ "poster": "Fresh shaded render of the exact gallery-built downloadable GLB. Camera-only offline capture; no geometry or material edits.",+ "evaluationGlbHash": "0d1869292cd96ddf941e227f48c0495ef334a74d5cfc53602aed87e77a10ad7e",+ "posterReceipt": {+ "sourceHash": "d67f971a1d0fe3aa2e7f183bde88e0c5a7fbd455f05a41a654890c59e3186b6e",+ "artifactHash": "f4e922442e3f5afb728563f57af24794c9377a1bc2c9092f24b37cd3d9a9704a",+ "imageHash": "304dfc49cfa065ef04450af38ddac11e826b9c9194b4ebe2c0c8e47f2ff011ae",+ "width": 1600,+ "height": 1000,+ "renderer": "ANGLE (NVIDIA, NVIDIA GeForce RTX 3070 (0x00002484) Direct3D11 vs_5_0 ps_5_0, D3D11)",+ "captureMethod": "Kiln studio stage, owned headless Chrome, original GLB materials",+ "cameraRecord": {+ "index": 10,+ "kind": "hero",+ "theta": 0.6747409422235526,+ "phi": 1.185083808592412,+ "radius": 27.952303351682353,+ "fixedSeconds": null,+ "wallTimeMs": 118.89999999850988+ },+ "geometryChanged": false+ }+ }+}diff --git a/examples/demo-argent-aircraft-carrier.kiln.js b/examples/demo-argent-aircraft-carrier.kiln.jsnew file mode 100644index 00000000..1d94b739--- /dev/null+++ b/examples/demo-argent-aircraft-carrier.kiln.js@@ -0,0 +1,136 @@+const meta = {name:'ARGENT CV-72 Aircraft Carrier',category:'vehicle',role:'vehicle'};+function build(){+ const root=createRoot('ARGENT_CV72');+ const D={deckY:4.65,length:34};+ const navy=gameMaterial(0x263f54,{roughness:.5,metalness:.35});+ const steel=gameMaterial(0x748892,{roughness:.48,metalness:.45});+ const light=gameMaterial(0xb3c1c7,{roughness:.55,metalness:.25});+ const dark=gameMaterial(0x171e25,{roughness:.83});+ const deckMat=gameMaterial(0x343b40,{roughness:.9});+ const white=gameMaterial(0xf2edce,{roughness:.7});+ const yellow=gameMaterial(0xe4b444,{roughness:.65});+ const red=gameMaterial(0xa44337,{roughness:.7});+ const glass=gameMaterial(0x123741,{roughness:.2,metalness:.55});+ const orange=gameMaterial(0xf57c22,{roughness:.6});+ function group(n,p=[0,0,0],parent=root){return createPivot(n,p,parent);}+ function box(n,w,h,d,x,y,z,m=steel,p=root,rot=[0,0,0]){return createPart(n,boxGeo(w,h,d),m,{position:[x,y,z],parent:p,rotation:rot});}+ function cyl(n,r,h,x,y,z,m=steel,p=root,rot=[0,0,0],r2=r){return createPart(n,cylinderGeo(r,r2,h,16),m,{position:[x,y,z],parent:p,rotation:rot});}+ function poly(n,pts,y,h,m,p=root){return createPart(n,loftProfiles([{profile:pts,frame:{origin:[0,y,0]}},{profile:pts,frame:{origin:[0,y+h,0]}}]),m,{parent:p});}+ function rod(n,a,b,r,m=steel,p=root){const av=new THREE.Vector3(...a),bv=new THREE.Vector3(...b);const mesh=createPart(n,cylinderGeo(r,r,av.distanceTo(bv),8),m,{parent:p});mesh.position.copy(av.add(bv).multiplyScalar(.5));mesh.quaternion.setFromUnitVectors(new THREE.Vector3(0,1,0),new THREE.Vector3(...b).sub(new THREE.Vector3(...a)).normalize());return mesh;}+ function line(n,x1,z1,x2,z2,w,m=white,y=4.846,p=root){let dx=x2-x1,dz=z2-z1;return box(n,Math.hypot(dx,dz),.012,w,(x1+x2)/2,y,(z1+z2)/2,m,p,[0,-Math.atan2(dz,dx)*180/Math.PI,0]);}+ const outline=[[-16,-2.65],[-12,-3.35],[7,-3.6],[12,-2.9],[15,-1.6],[16.7,0],[15,1.6],[12,2.9],[7,3.6],[-12,3.35],[-16,2.65]];+ const profiles=[{y:.15,sx:.9,sz:.54},{y:.6,sx:.97,sz:.75},{y:1.5,sx:1,sz:.9},{y:3.7,sx:1,sz:1},{y:4.55,sx:1,sz:1.01}];+ createPart('SculptedHull',loftProfiles(profiles.map(s=>({profile:outline.map(q=>[q[0]*s.sx,q[1]*s.sz]),frame:{origin:[0,s.y,0]}}))),navy,{parent:root});+ createPart('RedLowerHull',loftProfiles([{profile:outline.map(q=>[q[0]*.895,q[1]*.535]),frame:{origin:[0,.13,0]}},{profile:outline.map(q=>[q[0]*.97,q[1]*.755]),frame:{origin:[0,.63,0]}}]),red,{parent:root});+ const dp=[[-16.6,-4.35],[-13,-4.7],[-5,-5.6],[7,-5.6],[10.8,-3.9],[15.7,-3.4],[17.1,-1.4],[17.1,1.4],[15.7,3.4],[7,4.1],[-8,4.1],[-16.6,3.55]];+ poly('FlightDeckRim',dp,4.5,.22,steel);poly('FlightDeck',dp.map(q=>[q[0]*.995,q[1]*.995]),4.72,.11,deckMat);+ // Deliberately uncluttered landing lane angled away from starboard island.+ const lane={ax:-15.8,az:-.15,bx:9,bz:-3.65};+ for(const s of [-1,1])line('LandingLaneBoundary'+s,lane.ax,lane.az+s*1.05,lane.bx,lane.bz+s*1.05,.07);+ for(let i=0;i<15;i++){const t=i/15;let x=lane.ax+(lane.bx-lane.ax)*t,z=lane.az+(lane.bz-lane.az)*t;line('LandingCenterDash'+i,x,z,x+.7,z-.099,.10);}+ for(let i=0;i<4;i++){const x=-13+i*.85,z=lane.az+(x-lane.ax)*(lane.bz-lane.az)/(lane.bx-lane.ax);line('ArrestingCable'+i,x,z-1.0,x+.24,z+1.0,.035,steel,4.862);}+ for(const z of [-1.5,.8]){+ line('BowCatapultRail'+z,4,z,15.8,z,.075,steel);+ line('CatapultYellowGuide'+z,4,z+.18,15.3,z+.18,.04,yellow);+ box('CatapultShuttle'+z,.45,.04,.25,5,4.87,z,light);+ for(let i=0;i<4;i++)box('BowThreshold'+z+'_'+i,.7,.015,.12,15.25,4.849,z-.4+i*.25,white);+ }+ // Deck perimeter painted edge segments.+ for(let i=0;i<dp.length;i++){let a=dp[i],b=dp[(i+1)%dp.length];line('DeckEdgePaint'+i,a[0]*.98,a[1]*.97,b[0]*.98,b[1]*.97,.055,yellow);}+ // Flush deck lifts, recessed tracks, painted hazard corners.+ function lift(n,x,z,w,d){+ const g=group(n);+ box('LiftRecess',w+.18,.025,d+.18,x,4.837,z,dark,g);+ box('LiftSurface',w,.03,d,x,4.85,z,steel,g);+ for(const s of [-1,1]){line('LiftLongEdge'+s,x-w/2,z+s*d/2,x+w/2,z+s*d/2,.055,yellow,4.871,g);line('LiftShortEdge'+s,x+s*w/2,z-d/2,x+s*w/2,z+d/2,.055,yellow,4.871,g);}+ for(let i=0;i<6;i++)box('LiftPanelJoint'+i,.015,.012,d-.2,x-w/2+.2+i*(w-.4)/5,4.874,z,navy,g);+ }+ lift('AftStarboardAircraftElevator',-10.9,2.65,3.3,2.35);+ lift('ForwardStarboardAircraftElevator',7,2.8,2.8,2.0);+ lift('PortAircraftElevator',-5.5,-4.3,3.1,2.0);+ // Structural galleries and hull detail, leaving the pointed bow clear.+ for(const s of [-1,1]){+ for(let i=0;i<7;i++){let x=-13+i*3.5;+ box('Gallery_'+s+'_'+i,2.8,.14,.57,x,3.58,s*3.63,steel);+ box('GalleryShadow_'+s+'_'+i,2.65,.25,.07,x,3.86,s*3.46,dark);+ for(let j=0;j<4;j++)box('GalleryUpright_'+s+'_'+i+'_'+j,.06,.48,.08,x-1.15+j*.77,3.87,s*3.94,steel);+ rod('GalleryRailing_'+s+'_'+i,[x-1.4,4.1,s*3.94],[x+1.4,4.1,s*3.94],.025,light);+ poly('DeckBracket_'+s+'_'+i,[[x-.35,s*3.4],[x+.35,s*3.4],[x+.35,s*4.1]],3.12,.32,navy);+ }+ for(let i=0;i<13;i++){let x=-13+i*2.0;box('HullPanelSeam'+s+'_'+i,.022,1.45,.025,x,2.48,s*(Math.abs(x)>12?3.32:3.56),steel);}+ for(let i=0;i<8;i++)box('HullVent'+s+'_'+i,.48,.19,.025,-10+i*2.55,3.02,s*3.57,dark);+ for(let i=0;i<3;i++){let x=-9+i*6.5;box('LiferaftRack'+s+'_'+i,1.6,.12,.55,x,3.05,s*3.68,steel);for(let j=0;j<3;j++)cyl('LiferaftCanister'+s+'_'+i+'_'+j,.15,.45,x-.5+j*.5,3.23,s*3.75,light,root,[90,0,0]);}+ }+ // Hangar apertures at stern.+ for(const z of [-1.25,1.25]){box('SternHangarOpening'+z,.04,1.4,1.85,-16.015,3.2,z,dark);for(let i=0;i<6;i++)box('HangarShutterSlat'+z+'_'+i,.05,.075,1.7,-16.05,3.77-i*.12,z,steel);}+ box('SternServicePlatform',.8,.12,5,-16.3,2.36,0,steel);+ // Island superstructure.+ const island=group('Island',[0,4.84,2.7]);+ poly('IslandFoundation',[[-4,-.8],[2.8,-.8],[3.5,-.4],[3.5,.6],[-4,.6]],0,.65,navy,island);+ poly('IslandMainTower',[[-3.3,-.6],[2.5,-.6],[2.8,0],[2.4,.65],[-3.3,.65]],.65,1.65,steel,island);+ poly('IslandOrangeRecognitionBand',[[-3.32,-.62],[2.512,-.62],[2.825,0],[2.412,.67],[-3.32,.67]],1.65,.32,orange,island);+ poly('NavigationBridge',[[-1.8,-.85],[2.85,-.85],[3.25,-.4],[3.25,.65],[2.6,.95],[-1.8,.95]],2.1,.72,light,island);+ for(let i=0;i<9;i++)box('PortBridgeWindow'+i,.38,.3,.025,-1.5+i*.49,2.48,-.866,glass,island);+ for(let i=0;i<4;i++)box('ForwardBridgeWindow'+i,.025,.3,.23,3.262,2.48,-.29+i*.27,glass,island);+ for(let i=0;i<8;i++)box('StarboardBridgeWindow'+i,.38,.3,.025,-1.5+i*.5,2.48,.961,glass,island);+ poly('BridgeRoof',[[-1.94,-.99],[2.95,-.99],[3.42,-.44],[3.42,.73],[2.7,1.09],[-1.94,1.09]],2.83,.14,steel,island);+ box('UpperControlCabin',2.2,.65,1.2,.1,3.29,0,navy,island);+ for(let i=0;i<4;i++)box('UpperControlGlass'+i,.4,.29,.03,-.66+i*.51,3.34,-.614,glass,island);+ box('UpperControlRoof',2.45,.12,1.4,.1,3.66,0,light,island);+ box('ExhaustTrunk',1.2,1.2,1.0,-2.4,2.77,.02,navy,island);+ for(let i=0;i<5;i++)box('ExhaustGrille'+i,.075,.025,.85,-2.83+i*.21,3.38,.02,dark,island);+ const mast=group('MainRadarMast',[.1,3.73,0],island);+ for(const s of [-1,1])rod('MastLeg'+s,[-.42,0,s*.4],[0,2.8,s*.09],.065,steel,mast);+ for(let i=0;i<4;i++){let y=.35+i*.55;rod('MastCrossBrace'+i,[-.36,y,-.35],[0,y+.5,.25],.028,light,mast);}+ box('RadarPlatform',1.75,.09,1.35,0,1.9,0,steel,mast);+ cyl('RadarSpindle',.09,.55,0,2.18,0,steel,mast);+ box('LongRangeRadarArray',2.2,.72,.13,0,2.56,0,navy,mast,[0,22,0]);+ for(let i=0;i<8;i++)box('RadarArrayRib'+i,.025,.6,.04,-.93+i*.266,2.56,-.09,light,mast,[0,22,0]);+ cyl('TopAntenna',.025,1.05,0,3.08,0,light,mast);+ cyl('AftSensorMast',.065,2.6,-2.45,4.65,0,steel,island);+ box('AftSearchRadar',1.2,.34,.2,-2.45,5.96,0,light,island);+ for(const x of [-1.3,1.6]){cyl('CommsPedestal'+x,.14,.35,x,3.14,.54,steel,island);createPart('CommsRadome'+x,sphereGeo(.27,16,12),white,{position:[x,3.48,.54],parent:island});}+ // Small exterior ladders and access doors on tower.+ for(let i=0;i<10;i++)rod('IslandLadderRung'+i,[-3.32,.24+i*.23,-.65],[-2.98,.24+i*.23,-.65],.018,light,island);+ for(const x of [-3.32,-2.98])rod('IslandLadderRail'+x,[x,.1,-.65],[x,2.44,-.65],.025,light,island);+ box('IslandAccessDoor',.39,.68,.025,-1.6,.99,-.615,dark,island);+ // Four individually grouped twin-tail deck fighters; +X nose.+ function jet(n,x,z,angle){+ const j=group(n,[x,4.83,z]);j.rotation.y=angle*Math.PI/180;+ createPart('AerodynamicFuselage',loftProfiles([+ {profile:[[-.13,-.13],[.13,-.13],[.13,.13],[-.13,.13]],frame:{origin:[-1.1,.43,0],rotation:[0,0,-90]}},+ {profile:[[-.21,-.24],[.21,-.24],[.21,.24],[-.21,.24]],frame:{origin:[-.45,.43,0],rotation:[0,0,-90]}},+ {profile:[[-.13,-.19],[.13,-.19],[.13,.19],[-.13,.19]],frame:{origin:[.65,.43,0],rotation:[0,0,-90]}},+ {profile:[[-.015,-.025],[.015,-.025],[.015,.025],[-.015,.025]],frame:{origin:[1.35,.43,0],rotation:[0,0,-90]}}+ ]),orange,{parent:j});+ for(const s of [-1,1]){+ poly('SweptWing'+s,[[-.85,s*.16],[.4,s*.16],[-.44,s*1.07],[-.97,s*1.02]],.42,.055,orange,j);+ poly('Tailplane'+s,[[-1.12,s*.14],[-.62,s*.15],[-.95,s*.59],[-1.3,s*.54]],.48,.045,orange,j);+ // Swept, outward-canted twin stabilizers.+ const fg=new THREE.BufferGeometry();+ const v=[-1.09,.49,s*.20,-.57,.49,s*.20,-.90,1.04,s*.34,-1.12,1.04,s*.34];+ fg.setAttribute('position',new THREE.Float32BufferAttribute(v,3));fg.setIndex([0,1,2,0,2,3,2,1,0,3,2,0]);fg.computeVertexNormals();createPart('VerticalStabilizer'+s,fg,orange,{parent:j});+ cyl('EngineNozzle'+s,.102,.23,-1.11,.43,s*.13,dark,j,[0,0,90]);+ box('Intake'+s,.31,.14,.13,.03,.42,s*.23,dark,j);+ rod('MainLandingStrut'+s,[-.55,.12,s*.43],[-.55,.40,s*.43],.025,steel,j);+ cyl('MainWheel'+s,.10,.08,-.55,.1,s*.43,dark,j,[90,0,0]);+ box('WingOrangeTip'+s,.21,.012,.14,-.80,.486,s*.94,orange,j);+ }+ const canopy=createPart('SmokedCockpitCanopy',sphereGeo(1,16,10),glass,{position:[.53,.61,0],scale:[.43,.17,.145],parent:j});+ rod('NoseLandingStrut',[.77,.10,0],[.77,.37,0],.024,steel,j);+ cyl('NoseWheel',.08,.07,.77,.08,0,dark,j,[90,0,0]);+ box('CanopySpine',.025,.015,.29,.36,.73,0,orange,j);+ return j;+ }+ jet('Falcon_01',-13.2,2.15,-10);+ jet('Falcon_02',-8,2.0,-12);+ jet('Falcon_03',10.6,2.0,0);+ jet('Falcon_04',-1.0,-4.34,180);+ // Deck service tug beside island.+ const tug=group('DeckTractor',[-5.4,4.83,2.1]);box('TugBody',.9,.22,.55,0,.23,0,yellow,tug);box('TugCab',.35,.28,.46,-.2,.48,0,yellow,tug);box('TugWindow',.02,.18,.34,-.01,.49,0,glass,tug);+ for(const x of [-.3,.3])for(const z of [-.29,.29])cyl('TugWheel'+x+'_'+z,.13,.10,x,.13,z,dark,tug,[90,0,0]);+ // Deck tie-down sockets and stern approach lamps.+ for(let x=-14;x<14;x+=2)for(const z of [-3.3,1.1,3.3]){if(z===3.3&&x>-5&&x<5)continue;cyl('DeckTieDown'+x+'_'+z,.042,.014,x,4.848,z,light);}+ for(let i=0;i<7;i++)box('SternApproachLamp'+i,.09,.05,.12,-16.49,4.845,-1.0+i*.32,i%2?yellow:white);+ return root;+}\ No newline at end of filediff --git a/examples/demo-argent-aircraft-carrier.provenance.json b/examples/demo-argent-aircraft-carrier.provenance.jsonnew file mode 100644index 00000000..aec6e9ea--- /dev/null+++ b/examples/demo-argent-aircraft-carrier.provenance.json@@ -0,0 +1,54 @@+{+ "sourceHash": "9b6b3cae4e44cfec99e06a019cc83b56484004ab37132ed9848ddb0bdda447be",+ "model": "GPT-6 Astra",+ "harness": "ChatGPT Work",+ "authoredDate": "2026-09-09",+ "provenance": {+ "attribution": "Recorded demo session; model credit supplied only where the retained run identifies it.",+ "sourceAccess": "See retained demo run; no stronger isolation claim is made.",+ "humanIntervention": "Owner supplied direction; model-authored exported source preserved byte-for-byte.",+ "reviewFidelity": "Authoring feedback and shaded demo previews where available. Not a destination-runtime acceptance claim.",+ "poster": "Gallery GPU render of the exact downloadable GLB. Source, artifact, image hashes and camera settings are recorded alongside the poster.",+ "evaluationGlbHash": "b3e11ce683691a2c8ee91bcb5fe558e99ab9a22049ebd12495da68aa3f105905",+ "posterReceipt": {+ "captureIdentity": [+ "kiln.capture-producer.v1",+ "sha256:10f346ec6287c8d635dabe4668d72925080e6fe3d059dd7a9252f2694ce595c2",+ "44832275-6b15-4353-8fcb-ac1de3fda8e6",+ "dawn-d3d12:nvidia-geforce-rtx-3070:D3D12 driver version 32.0.16.1074"+ ],+ "sourceHash": "9b6b3cae4e44cfec99e06a019cc83b56484004ab37132ed9848ddb0bdda447be",+ "artifactHash": "d33a9f53b100ebc34cbe2ca0b857f069d49ec362fcf7574d5abee59f4615df92",+ "imageHash": "0354f2649037396ec1b1fa630365173c65343e2f1c93968f335cb043ed9c41f6",+ "width": 1024,+ "height": 1024,+ "camera": {+ "version": "kiln.camera.v1",+ "projection": "orthographic",+ "position": [+ 57.06580689704423,+ 30.905397769322562,+ 40.33606495667699+ ],+ "target": [+ 0.3886137355092504,+ 3.7003450517857712,+ 0.6620297436025075+ ],+ "up": [+ 0,+ 1,+ 0+ ],+ "aspect": 1,+ "near": 0.01,+ "far": 185.850211664565,+ "halfHeight": 13.561237602632227+ },+ "rendererId": "dawn-d3d12:nvidia-geforce-rtx-3070:D3D12 driver version 32.0.16.1074",+ "materialFaithful": true,+ "lightingPresetId": "gallery-studio-v1",+ "purpose": "Gallery poster generated from the exact downloadable GLB; separate from authoring feedback."+ }+ }+}diff --git a/examples/demo-art-deco-conservatory.kiln.js b/examples/demo-art-deco-conservatory.kiln.jsnew file mode 100644index 00000000..3f3723b7--- /dev/null+++ b/examples/demo-art-deco-conservatory.kiln.js@@ -0,0 +1,858 @@+const meta = {+ name: 'Art Deco Botanical Conservatory',+ category: 'architecture',+ role: 'building'+};++function build() {+ const root = createRoot('ArtDecoConservatory');++ // ==========================================+ // MATERIALS PALETTE (Art Deco & Botanical)+ // ==========================================+ const copper = gameMaterial(0xc87442, { metalness: 0.85, roughness: 0.32 });+ const copperDark = gameMaterial(0x8e4726, { metalness: 0.88, roughness: 0.38 });+ const copperPatina = gameMaterial(0x489688, { metalness: 0.55, roughness: 0.5 });+ const goldAccent = gameMaterial(0xdfa538, { metalness: 0.86, roughness: 0.28 });+ const glass = glassMaterial(0x8ee0d6, { opacity: 0.34, roughness: 0.12, metalness: 0.05 });++ const stonePaver = gameMaterial(0xe0d8cb, { roughness: 0.85, metalness: 0.05 });+ const stoneBase = gameMaterial(0xbaa793, { roughness: 0.9, metalness: 0.04 });+ const stoneTrim = gameMaterial(0xc8bea8, { roughness: 0.85, metalness: 0.04 });+ const soil = gameMaterial(0x302115, { roughness: 0.95 });++ const trunkMat = gameMaterial(0x6a4f38, { roughness: 0.88 });+ const palmGreen = gameMaterial(0x2d6f2e, { roughness: 0.65 });+ const deepGreen = gameMaterial(0x1e4e22, { roughness: 0.7 });+ const lightGreen = gameMaterial(0x428e30, { roughness: 0.6 });+ const vineGreen = gameMaterial(0x265f24, { roughness: 0.65 });+ const flowerPink = gameMaterial(0xe84a62, { roughness: 0.5 });+ const flowerGold = gameMaterial(0xf5a823, { roughness: 0.5 });+ const flowerWhite = gameMaterial(0xf2ede4, { roughness: 0.6 });++ // ==========================================+ // SHARED GEOMETRIES+ // ==========================================+ const potGeo = lathe([[0.15, 0], [0.38, 0.45], [0.32, 0.65], [0.42, 0.8], [0.42, 0.9]], 16);+ const cypressGeo = coneGeo(0.65, 2.8, 12);+ const bushBlobGeo = sphereGeo(0.5, 8, 6);+ const leafSpillGeo = sphereGeo(0.35, 7, 5);++ // ==========================================+ // 1. LOWER PODIUM & PLAZA (Tier 0: Y = 0 to 0.8m)+ // ==========================================+ const podiumGroup = createPivot('PodiumGroup', [0, 0, 0], root);++ // Base plinth: 18m wide (Z: -9 to +9) x 20m long (X: -10 to +10)+ createPart('PlinthBase', boxGeo(20.4, 0.2, 18.4), stoneBase, {+ position: [0, 0.1, 0],+ parent: podiumGroup+ });+ createPart('PlinthMain', boxGeo(20.0, 0.6, 18.0), stoneTrim, {+ position: [0, 0.5, 0],+ parent: podiumGroup+ });+ createPart('PlinthPaving', boxGeo(19.6, 0.08, 17.6), stonePaver, {+ position: [0, 0.84, 0],+ parent: podiumGroup+ });++ // Grand Front Staircase (Facing +X, from X = 9.8m to 12.6m, width 6.0m)+ const stairSteps = 5;+ const stairRise = 0.16;+ const stairRun = 0.56;+ for (let s = 0; s < stairSteps; s++) {+ const y = (stairSteps - 1 - s) * stairRise + stairRise / 2;+ const x = 10.0 + s * stairRun + stairRun / 2;+ createPart('StairStep_' + s, boxGeo(stairRun + 0.04, stairRise, 6.2), stonePaver, {+ position: [x, y, 0],+ parent: podiumGroup+ });+ }+ // Staircase cheek parapets flanking the front stairs (Z = ±3.3m)+ for (const side of [-1, 1]) {+ createPart('StairCheek_' + side, boxGeo(3.2, 1.1, 0.5), stoneTrim, {+ position: [11.2, 0.55, side * 3.35],+ parent: podiumGroup+ });+ createPart('StairCheekCap_' + side, boxGeo(3.3, 0.08, 0.56), copper, {+ position: [11.2, 1.14, side * 3.35],+ parent: podiumGroup+ });+ // Art Deco Pedestal Lanterns flanking the staircase+ createPart('StairLanternBase_' + side, boxGeo(0.44, 0.16, 0.44), copperDark, {+ position: [12.4, 1.26, side * 3.35],+ parent: podiumGroup+ });+ createPart('StairLanternGlass_' + side, cylinderGeo(0.18, 0.14, 0.38, 8), glass, {+ position: [12.4, 1.53, side * 3.35],+ parent: podiumGroup+ });+ createPart('StairLanternCap_' + side, coneGeo(0.24, 0.2, 8), copper, {+ position: [12.4, 1.82, side * 3.35],+ parent: podiumGroup+ });+ createPart('StairLanternFinial_' + side, sphereGeo(0.06, 6, 6), goldAccent, {+ position: [12.4, 1.96, side * 3.35],+ parent: podiumGroup+ });+ }++ // Front Garden Terrace Beds flanking the grand stairs (at X = 8.6m, Z = ±5.8m)+ for (const frontSide of [-1, 1]) {+ const fz = frontSide * 5.8;+ createPart('FrontBedParapet_' + frontSide, boxGeo(2.4, 0.6, 0.35), stoneTrim, {+ position: [9.4, 0.5, fz],+ parent: podiumGroup+ });+ createPart('FrontBedCap_' + frontSide, boxGeo(2.5, 0.06, 0.42), copper, {+ position: [9.4, 0.83, fz],+ parent: podiumGroup+ });+ createPart('FrontBedSoil_' + frontSide, boxGeo(2.2, 0.15, 2.6), soil, {+ position: [8.2, 0.75, fz],+ parent: podiumGroup+ });+ // Lush shrubs and tropical blooms in front beds+ createPart('FrontBush1_' + frontSide, bushBlobGeo, deepGreen, {+ position: [8.2, 1.05, fz - 0.5],+ scale: [1.1, 0.8, 1.1],+ parent: podiumGroup+ });+ createPart('FrontBush2_' + frontSide, bushBlobGeo, lightGreen, {+ position: [8.4, 1.1, fz + 0.5],+ scale: [1.0, 0.9, 1.0],+ parent: podiumGroup+ });+ createPart('FrontFlower_' + frontSide, sphereGeo(0.24, 6, 5), flowerPink, {+ position: [8.3, 1.35, fz],+ parent: podiumGroup+ });+ // Cascading vine over front wall+ createPart('FrontVine_' + frontSide, leafSpillGeo, vineGreen, {+ position: [9.55, 0.75, fz],+ scale: [0.8, 1.3, 1.2],+ parent: podiumGroup+ });+ }++ // 4 Stepped Art Deco Corner Pylons+ const cornerCoords = [+ [-9.2, -8.2], [-9.2, 8.2],+ [9.2, -8.2], [9.2, 8.2]+ ];+ cornerCoords.forEach(([cx, cz], idx) => {+ // Stepped plinth+ createPart('PylonBase_' + idx, boxGeo(1.6, 1.4, 1.6), stoneTrim, {+ position: [cx, 0.7, cz],+ parent: podiumGroup+ });+ // Fluted central shaft+ createPart('PylonShaft_' + idx, boxGeo(1.25, 0.8, 1.25), stonePaver, {+ position: [cx, 1.8, cz],+ parent: podiumGroup+ });+ // Tiered copper cap+ createPart('PylonCap1_' + idx, boxGeo(1.4, 0.1, 1.4), copper, {+ position: [cx, 2.25, cz],+ parent: podiumGroup+ });+ createPart('PylonCap2_' + idx, boxGeo(1.1, 0.12, 1.1), copperPatina, {+ position: [cx, 2.36, cz],+ parent: podiumGroup+ });+ // Fluted urn with floral bouquet on each pylon+ createPart('PylonUrn_' + idx, potGeo, copper, {+ position: [cx, 2.42, cz],+ parent: podiumGroup+ });+ createPart('PylonUrnSoil_' + idx, cylinderGeo(0.38, 0.38, 0.1, 12), soil, {+ position: [cx, 3.25, cz],+ parent: podiumGroup+ });+ // Spilling plants in urn+ for (let f = 0; f < 6; f++) {+ const ang = (f * Math.PI * 2) / 6;+ createPart('UrnFlower_' + idx + '_' + f, sphereGeo(0.18, 6, 5), (f % 2 === 0 ? flowerPink : flowerGold), {+ position: [cx + 0.28 * Math.cos(ang), 3.38, cz + 0.28 * Math.sin(ang)],+ parent: podiumGroup+ });+ createPart('UrnSpill_' + idx + '_' + f, leafSpillGeo, vineGreen, {+ position: [cx + 0.38 * Math.cos(ang), 3.15, cz + 0.38 * Math.sin(ang)],+ parent: podiumGroup+ });+ }+ });++ // ==========================================+ // 2. MID PROMENADE & PLANTED TERRACES (Tier 1: Y = 0.8 to 1.6m)+ // ==========================================+ const terraceGroup = createPivot('TerraceGroup', [0, 0, 0], root);++ // Raised terrace podium (X: -8 to +8, Z: -8 to +8, height 0.8m up to Y = 1.6m)+ createPart('TerracePodium', boxGeo(16.4, 0.76, 16.4), stoneTrim, {+ position: [0, 1.18, 0],+ parent: terraceGroup+ });+ createPart('TerraceFloor', boxGeo(16.0, 0.08, 16.0), stonePaver, {+ position: [0, 1.6, 0],+ parent: terraceGroup+ });++ // North & South Exterior Garden Terraces (Z = -7.2m to -4.6m and Z = +4.6m to +7.2m)+ for (const side of [-1, 1]) {+ const tz = side * 5.9;+ // Retaining planter box along exterior wings+ createPart('TerraceParapet_' + side, boxGeo(14.8, 0.7, 0.35), stoneTrim, {+ position: [0, 1.95, side * 7.6],+ parent: terraceGroup+ });+ createPart('TerraceParapetCap_' + side, boxGeo(15.0, 0.08, 0.42), copper, {+ position: [0, 2.34, side * 7.6],+ parent: terraceGroup+ });+ // Front and back retaining walls of side terraces+ createPart('TerraceWallFront_' + side, boxGeo(0.35, 0.7, 3.2), stoneTrim, {+ position: [7.3, 1.95, tz],+ parent: terraceGroup+ });+ createPart('TerraceWallFrontCap_' + side, boxGeo(0.42, 0.08, 3.3), copper, {+ position: [7.3, 2.34, tz],+ parent: terraceGroup+ });+ createPart('TerraceWallBack_' + side, boxGeo(0.35, 0.7, 3.2), stoneTrim, {+ position: [-7.3, 1.95, tz],+ parent: terraceGroup+ });+ createPart('TerraceWallBackCap_' + side, boxGeo(0.42, 0.08, 3.3), copper, {+ position: [-7.3, 2.34, tz],+ parent: terraceGroup+ });++ // Deep planter soil bed+ createPart('TerraceSoil_' + side, boxGeo(14.2, 0.25, 2.6), soil, {+ position: [0, 1.8, tz],+ parent: terraceGroup+ });++ // Cascading Vines Spilling Over Terrace Parapet+ for (let v = 0; v < 8; v++) {+ const vx = -6.0 + v * 1.7;+ // Clustered trailing foliage cascading down exterior wall+ createPart('VineTop_' + side + '_' + v, leafSpillGeo, vineGreen, {+ position: [vx, 2.32, side * 7.8],+ scale: [1.2, 0.8, 1.1],+ parent: terraceGroup+ });+ createPart('VineMid_' + side + '_' + v, leafSpillGeo, deepGreen, {+ position: [vx, 1.9, side * 7.85],+ scale: [0.9, 1.4, 0.8],+ parent: terraceGroup+ });+ createPart('VineLow_' + side + '_' + v, leafSpillGeo, vineGreen, {+ position: [vx, 1.35, side * 7.88],+ scale: [0.7, 1.3, 0.6],+ parent: terraceGroup+ });+ }++ // Dense Plantings in Terrace Beds:+ // Stately Palm Trees (2 per terrace)+ const palmPositions = [[-4.2, tz], [4.2, tz]];+ palmPositions.forEach(([px, pz], pIdx) => {+ // Curved ringed trunk+ const trunkPts = [+ [px, 1.9, pz],+ [px + 0.1, 2.9, pz + 0.05 * side],+ [px + 0.25, 4.0, pz + 0.15 * side],+ [px + 0.45, 5.2, pz + 0.3 * side]+ ];+ const trunkGeo = pipeAlongPath(trunkPts, 0.14, { radialSegments: 10 });+ createPart('PalmTrunk_' + side + '_' + pIdx, trunkGeo, trunkMat, { parent: terraceGroup });++ // Palm Crown: 12 radiating arching fronds+ const crownHead = [px + 0.45, 5.2, pz + 0.3 * side];+ const frondCount = 12;+ for (let f = 0; f < frondCount; f++) {+ const fAng = (f * Math.PI * 2) / frondCount;+ const frondPts = [+ [crownHead[0], crownHead[1], crownHead[2]],+ [crownHead[0] + 0.7 * Math.cos(fAng), crownHead[1] + 0.35, crownHead[2] + 0.7 * Math.sin(fAng)],+ [crownHead[0] + 1.5 * Math.cos(fAng), crownHead[1] + 0.2, crownHead[2] + 1.5 * Math.sin(fAng)],+ [crownHead[0] + 2.1 * Math.cos(fAng), crownHead[1] - 0.45, crownHead[2] + 2.1 * Math.sin(fAng)]+ ];+ const frondStemGeo = pipeAlongPath(frondPts, 0.032, { radialSegments: 6 });+ createPart('PalmFrond_' + side + '_' + pIdx + '_' + f, frondStemGeo, palmGreen, { parent: terraceGroup });+ // Cascading feathered leaflets along frond+ for (let leaf = 1; leaf <= 3; leaf++) {+ const frac = leaf / 3.5;+ const lx = crownHead[0] + (0.7 + frac * 1.3) * Math.cos(fAng);+ const ly = crownHead[1] + 0.3 - frac * 0.6;+ const lz = crownHead[2] + (0.7 + frac * 1.3) * Math.sin(fAng);+ createPart('PalmLeaflet_' + side + '_' + pIdx + '_' + f + '_' + leaf, boxGeo(0.18, 0.02, 0.75 - frac * 0.15), lightGreen, {+ position: [lx, ly, lz],+ rotation: [18 * Math.sin(fAng) + 12, (-fAng * 180) / Math.PI + (leaf % 2 === 0 ? 25 : -25), 20],+ parent: terraceGroup+ });+ }+ }+ });++ // Conical Cypress / Topiary Evergreens (3 per terrace)+ [-6.2, 0, 6.2].forEach((cx, cIdx) => {+ createPart('Cypress_' + side + '_' + cIdx, cypressGeo, deepGreen, {+ position: [cx, 1.9 + 1.4, tz],+ parent: terraceGroup+ });+ // Tiered copper ring base for topiary+ createPart('CypressRing_' + side + '_' + cIdx, torusGeo(0.68, 0.04, 6, 16), copper, {+ position: [cx, 1.95, tz],+ rotation: [90, 0, 0],+ parent: terraceGroup+ });+ });++ // Layered Tropical Bushes & Flowers between trees+ [-2.2, -1.1, 1.1, 2.2].forEach((bx, bIdx) => {+ createPart('Bush_' + side + '_' + bIdx, bushBlobGeo, (bIdx % 2 === 0 ? deepGreen : lightGreen), {+ position: [bx, 2.2, tz + (bIdx % 2 === 0 ? 0.3 : -0.3)],+ scale: [1.2, 1.0, 1.2],+ parent: terraceGroup+ });+ // Bright tropical blossoms dotted on the bushes+ createPart('Flowers_' + side + '_' + bIdx, sphereGeo(0.22, 6, 5), (bIdx % 3 === 0 ? flowerPink : (bIdx % 3 === 1 ? flowerGold : flowerWhite)), {+ position: [bx, 2.55, tz + (bIdx % 2 === 0 ? 0.3 : -0.3)],+ parent: terraceGroup+ });+ });+ }++ // Art Deco Copper Balustrades along Front & Back Terrace Walkways+ for (const fSide of [-1, 1]) {+ const bx = fSide * 7.5;+ // Top handrail+ createPart('BalustradeRail_' + fSide, boxGeo(0.1, 0.06, 9.2), copper, {+ position: [bx, 2.35, 0],+ parent: terraceGroup+ });+ // Bottom rail+ createPart('BalustradeBase_' + fSide, boxGeo(0.08, 0.04, 9.2), copperDark, {+ position: [bx, 1.72, 0],+ parent: terraceGroup+ });+ // Posts & Art Deco Geometric Balusters+ for (let p = -4; p <= 4; p++) {+ const bz = p * 1.1;+ createPart('BalustradePost_' + fSide + '_' + p, boxGeo(0.09, 0.65, 0.09), copper, {+ position: [bx, 2.02, bz],+ parent: terraceGroup+ });+ if (p < 4) {+ // Central vertical mullion connecting base and rail+ createPart('BalustradeMullion_' + fSide + '_' + p, boxGeo(0.05, 0.63, 0.05), copperDark, {+ position: [bx, 2.03, bz + 0.55],+ parent: terraceGroup+ });+ // Art Deco Diamond Medallion overlapping the central mullion+ createPart('BalustradeDiamond_' + fSide + '_' + p, boxGeo(0.07, 0.32, 0.32), goldAccent, {+ position: [bx, 2.03, bz + 0.55],+ rotation: [0, 0, 45],+ parent: terraceGroup+ });+ }+ }+ }++ // ==========================================+ // 3. MAIN CONSERVATORY PAVILION & WINGS (Y = 1.6m to 6.6m)+ // ==========================================+ const pavilionGroup = createPivot('PavilionGroup', [0, 0, 0], root);++ // Central Rotunda Base Wall / Sill (Octagonal, radius 4.3m, height 0.6m)+ const octSegments = 16;+ for (let i = 0; i < octSegments; i++) {+ const ang1 = (i * Math.PI * 2) / octSegments;+ const ang2 = ((i + 1) * Math.PI * 2) / octSegments;+ const midAng = (ang1 + ang2) / 2;+ const segWidth = 2 * 4.3 * Math.sin(Math.PI / octSegments);+ const rad = 4.3 * Math.cos(Math.PI / octSegments);+ const mx = rad * Math.cos(midAng);+ const mz = rad * Math.sin(midAng);+ const rotYDeg = (-midAng * 180) / Math.PI + 90;++ // Stone base panel under windows+ createPart('SillPanel_' + i, boxGeo(segWidth + 0.05, 0.6, 0.25), stoneTrim, {+ position: [mx, 1.9, mz],+ rotation: [0, rotYDeg, 0],+ parent: pavilionGroup+ });+ // Copper sill trim+ createPart('SillCopper_' + i, boxGeo(segWidth + 0.08, 0.06, 0.28), copper, {+ position: [mx, 2.22, mz],+ rotation: [0, rotYDeg, 0],+ parent: pavilionGroup+ });++ // Tall Glazed Windows (omit at front entrance door bay)+ const isDoorBay = (i === 0 || i === octSegments - 1);+ if (!isDoorBay) {+ createPart('WindowGlass_' + i, boxGeo(segWidth - 0.18, 3.8, 0.04), glass, {+ position: [mx, 4.15, mz],+ rotation: [0, rotYDeg, 0],+ parent: pavilionGroup+ });+ // Horizontal copper transoms dividing window panes+ createPart('WindowTransom1_' + i, boxGeo(segWidth, 0.05, 0.08), copper, {+ position: [mx, 3.4, mz],+ rotation: [0, rotYDeg, 0],+ parent: pavilionGroup+ });+ createPart('WindowTransom2_' + i, boxGeo(segWidth, 0.05, 0.08), copper, {+ position: [mx, 4.8, mz],+ rotation: [0, rotYDeg, 0],+ parent: pavilionGroup+ });+ }++ // Vertical Fluted Copper Columns / Mullions at each vertex+ const vx = 4.35 * Math.cos(ang1);+ const vz = 4.35 * Math.sin(ang1);+ createPart('RotundaMullion_' + i, boxGeo(0.2, 4.3, 0.2), copper, {+ position: [vx, 4.25, vz],+ rotation: [0, (-ang1 * 180) / Math.PI, 0],+ parent: pavilionGroup+ });+ // Tiered Art Deco Capital on column+ createPart('MullionCap1_' + i, boxGeo(0.28, 0.12, 0.28), copperDark, {+ position: [vx, 6.42, vz],+ rotation: [0, (-ang1 * 180) / Math.PI, 0],+ parent: pavilionGroup+ });+ createPart('MullionCap2_' + i, boxGeo(0.24, 0.08, 0.24), goldAccent, {+ position: [vx, 6.52, vz],+ rotation: [0, (-ang1 * 180) / Math.PI, 0],+ parent: pavilionGroup+ });+ }++ // Symmetrical East & West Glass Wings (Terraced glass galleries: Z = ±3.8m to ±6.8m, X = -2.8m to +2.8m)+ for (const side of [-1, 1]) {+ const wz = side * 5.3;+ // Wing end wall glass & frames+ createPart('WingGlassSide_' + side, boxGeo(5.2, 3.2, 0.04), glass, {+ position: [0, 3.4, side * 6.8],+ parent: pavilionGroup+ });+ // Wing mullions+ for (let wx = -2; wx <= 2; wx++) {+ createPart('WingMullion_' + side + '_' + wx, boxGeo(0.12, 3.2, 0.14), copper, {+ position: [wx * 1.2, 3.4, side * 6.8],+ parent: pavilionGroup+ });+ }+ // Sloped copper glass wing roof+ createPart('WingRoofGlass_' + side, boxGeo(5.4, 0.04, 2.8), glass, {+ position: [0, 5.2, side * 5.4],+ rotation: [side * 18, 0, 0],+ parent: pavilionGroup+ });+ // Roof copper rafters+ for (let rx = -2; rx <= 2; rx++) {+ createPart('WingRafter_' + side + '_' + rx, boxGeo(0.08, 0.12, 2.9), copper, {+ position: [rx * 1.2, 5.24, side * 5.4],+ rotation: [side * 18, 0, 0],+ parent: pavilionGroup+ });+ }+ // Wing ridge cornice+ createPart('WingCornice_' + side, boxGeo(5.6, 0.16, 0.22), copperDark, {+ position: [0, 5.65, side * 4.1],+ parent: pavilionGroup+ });+ }++ // ==========================================+ // 4. ART DECO GRAND ENTRANCE PORTAL (Facing +X)+ // ==========================================+ const portalGroup = createPivot('PortalGroup', [4.3, 1.6, 0], root);++ // Stepped Portal Jambs / Columns in Copper+ for (const pSide of [-1, 1]) {+ // Outer fluted pylon+ createPart('PortalPylonOuter_' + pSide, boxGeo(0.4, 4.4, 0.35), copper, {+ position: [0.15, 2.2, pSide * 1.6],+ parent: portalGroup+ });+ // Inner stepped jamb+ createPart('PortalPylonInner_' + pSide, boxGeo(0.35, 4.0, 0.25), copperDark, {+ position: [0.2, 2.0, pSide * 1.25],+ parent: portalGroup+ });+ // Art Deco Tiered Capital+ createPart('PortalCap_' + pSide, boxGeo(0.48, 0.18, 0.42), goldAccent, {+ position: [0.15, 4.45, pSide * 1.6],+ parent: portalGroup+ });+ }++ // Grand Tiered Entablature & Lintel+ createPart('PortalLintel1', boxGeo(0.42, 0.22, 3.5), copperDark, {+ position: [0.18, 4.0, 0],+ parent: portalGroup+ });+ createPart('PortalLintel2', boxGeo(0.48, 0.26, 3.8), copper, {+ position: [0.15, 4.3, 0],+ parent: portalGroup+ });+ createPart('PortalLintel3', boxGeo(0.54, 0.18, 4.0), copperPatina, {+ position: [0.12, 4.54, 0],+ parent: portalGroup+ });++ // Projecting Art Deco Marquee / Canopy+ createPart('CanopySlab', boxGeo(1.4, 0.12, 3.6), copper, {+ position: [0.8, 3.9, 0],+ parent: portalGroup+ });+ createPart('CanopyFascia', boxGeo(1.44, 0.08, 3.64), goldAccent, {+ position: [0.8, 3.98, 0],+ parent: portalGroup+ });++ // Radiant Art Deco Sunburst Pediment above Entrance+ // Central golden half-sun medallion+ createPart('SunburstMedallion', cylinderGeo(0.5, 0.5, 0.12, 16), goldAccent, {+ position: [0.22, 4.65, 0],+ rotation: [0, 0, 90],+ parent: portalGroup+ });+ // Radiating copper sun rays+ const sunRays = 9;+ for (let r = 0; r < sunRays; r++) {+ const rayAngDeg = -60 + r * 15;+ const rayRad = (rayAngDeg * Math.PI) / 180;+ createPart('SunRay_' + r, boxGeo(0.04, 0.75, 0.06), (r % 2 === 0 ? copper : goldAccent), {+ position: [0.24, 4.65 + 0.65 * Math.cos(rayRad), 0.65 * Math.sin(rayRad)],+ rotation: [0, 0, -rayAngDeg],+ parent: portalGroup+ });+ }++ // Glazed Double Doors with Art Deco Copper Grilles+ for (const dSide of [-1, 1]) {+ // Glass door leaf+ createPart('DoorGlass_' + dSide, boxGeo(0.06, 2.8, 0.85), glass, {+ position: [0.1, 1.4, dSide * 0.48],+ parent: portalGroup+ });+ // Copper door frame+ createPart('DoorFrameTop_' + dSide, boxGeo(0.09, 0.12, 0.92), copperDark, {+ position: [0.1, 2.8, dSide * 0.48],+ parent: portalGroup+ });+ createPart('DoorFrameBot_' + dSide, boxGeo(0.09, 0.28, 0.92), copperDark, {+ position: [0.1, 0.14, dSide * 0.48],+ parent: portalGroup+ });+ // Art Deco Geometric Grille (chevron & diagonal bars)+ createPart('DoorGrilleMid_' + dSide, boxGeo(0.08, 0.08, 0.85), goldAccent, {+ position: [0.11, 1.4, dSide * 0.48],+ parent: portalGroup+ });+ createPart('DoorGrilleBar1_' + dSide, boxGeo(0.05, 1.1, 0.04), copper, {+ position: [0.11, 2.0, dSide * 0.48 + 0.2],+ rotation: [22, 0, 0],+ parent: portalGroup+ });+ createPart('DoorGrilleBar2_' + dSide, boxGeo(0.05, 1.1, 0.04), copper, {+ position: [0.11, 2.0, dSide * 0.48 - 0.2],+ rotation: [-22, 0, 0],+ parent: portalGroup+ });+ // Sleek vertical copper push handle+ createPart('DoorHandle_' + dSide, cylinderGeo(0.025, 0.025, 0.7, 8), goldAccent, {+ position: [0.16, 1.35, dSide * 0.12],+ parent: portalGroup+ });+ }++ // ==========================================+ // 5. UPPER FRIEZE & CLERESTORY DRUM (Y = 6.4m to 7.5m)+ // ==========================================+ const drumGroup = createPivot('DrumGroup', [0, 0, 0], root);++ // Main Art Deco Entablature Frieze Rings (Hollow open rings so interior is visible!)+ createPart('MainFriezeBase', torusGeo(4.34, 0.1, 8, 32), copperDark, {+ position: [0, 6.55, 0],+ rotation: [90, 0, 0],+ parent: drumGroup+ });+ createPart('MainFriezePatina', torusGeo(4.35, 0.11, 8, 32), copperPatina, {+ position: [0, 6.72, 0],+ rotation: [90, 0, 0],+ parent: drumGroup+ });+ createPart('MainCornice', torusGeo(4.4, 0.12, 8, 32), copper, {+ position: [0, 6.88, 0],+ rotation: [90, 0, 0],+ parent: drumGroup+ });++ // Clerestory Drum: 16 perimeter posts and glass windows (completely hollow atrium inside!)+ for (let c = 0; c < 16; c++) {+ const cAng = (c * Math.PI * 2) / 16;+ const cx = 4.25 * Math.cos(cAng);+ const cz = 4.25 * Math.sin(cAng);+ const rotDeg = (-cAng * 180) / Math.PI + 90;+ // Structural copper post between clerestory windows+ createPart('ClerestoryPost_' + c, boxGeo(0.12, 0.6, 0.16), copperDark, {+ position: [cx, 7.22, cz],+ rotation: [0, rotDeg, 0],+ parent: drumGroup+ });+ // Arched clerestory window pane+ createPart('ClerestoryWindow_' + c, boxGeo(0.7, 0.44, 0.04), glass, {+ position: [cx, 7.22, cz],+ rotation: [0, rotDeg, 0],+ parent: drumGroup+ });+ createPart('ClerestoryArch_' + c, torusGeo(0.35, 0.03, 6, 12), copper, {+ position: [cx, 7.42, cz],+ rotation: [0, rotDeg, 0],+ parent: drumGroup+ });+ }++ // Stepped Dome Base Rings / Collars (Hollow open rings supporting the dome)+ createPart('DomeBaseRing1', torusGeo(4.3, 0.1, 8, 32), copper, {+ position: [0, 7.55, 0],+ rotation: [90, 0, 0],+ parent: drumGroup+ });+ createPart('DomeBaseRing2', torusGeo(4.22, 0.08, 8, 32), copperPatina, {+ position: [0, 7.66, 0],+ rotation: [90, 0, 0],+ parent: drumGroup+ });+ createPart('DomeBaseRing3', torusGeo(4.16, 0.06, 8, 32), goldAccent, {+ position: [0, 7.74, 0],+ rotation: [90, 0, 0],+ parent: drumGroup+ });++ // ==========================================+ // 6. THE RIBBED GLASS DOME (Y = 7.7m to 11.4m)+ // ==========================================+ const domeGroup = createPivot('DomeGroup', [0, 7.7, 0], root);++ const domeRadius = 4.15;+ const domeHeight = 3.65;++ // Translucent Glass Dome Shell+ const domeGlassGeo = parametricSurface((u, v) => {+ const phi = v * (Math.PI * 0.48);+ const r = domeRadius * Math.cos(phi);+ const y = domeHeight * Math.sin(phi);+ return [r * Math.cos(u), y, r * Math.sin(u)];+ }, { u: [0, Math.PI * 2], v: [0.03, 0.98], uSegments: 32, vSegments: 16 });++ createPart('DomeGlassShell', domeGlassGeo, glass, {+ position: [0, 0, 0],+ parent: domeGroup+ });++ // 16 Curved Copper Structural Meridian Ribs+ const ribCount = 16;+ const ribSteps = 16;+ const ribCurvePts = [];+ for (let s = 0; s <= ribSteps; s++) {+ const t = s / ribSteps;+ const phi = t * (Math.PI * 0.48);+ // Project 0.05m outward from the glass so the ribs stand out boldly+ const r = domeRadius * Math.cos(phi) + 0.05;+ const y = domeHeight * Math.sin(phi);+ ribCurvePts.push([r, y, 0]);+ }+ const ribBeamGeo = pipeAlongPath(ribCurvePts, 0.055, { radialSegments: 8 });++ for (let i = 0; i < ribCount; i++) {+ const ribDeg = (i * 360) / ribCount;+ // The structural arch rib+ createPart('DomeRib_' + i, ribBeamGeo, copper, {+ position: [0, 0, 0],+ rotation: [0, ribDeg, 0],+ parent: domeGroup+ });++ // Decorative Art Deco stepped copper corbel at the base of each rib+ const baseAng = (i * Math.PI * 2) / ribCount;+ createPart('RibCorbel_' + i, boxGeo(0.18, 0.28, 0.16), copperDark, {+ position: [4.24 * Math.cos(baseAng), 0.1, 4.24 * Math.sin(baseAng)],+ rotation: [0, (-baseAng * 180) / Math.PI, 0],+ parent: domeGroup+ });+ }++ // 3 Concentric Horizontal Copper Glazing Rings (Purlins)+ const ringParams = [+ { phiFrac: 0.24, tube: 0.045 },+ { phiFrac: 0.52, tube: 0.04 },+ { phiFrac: 0.78, tube: 0.035 }+ ];+ ringParams.forEach((rp, rIdx) => {+ const phi = rp.phiFrac * (Math.PI * 0.48);+ const r = domeRadius * Math.cos(phi) + 0.045;+ const y = domeHeight * Math.sin(phi);+ createPart('DomeRing_' + rIdx, torusGeo(r, rp.tube, 8, 32), copper, {+ position: [0, y, 0],+ rotation: [90, 0, 0],+ parent: domeGroup+ });+ });++ // ==========================================+ // 7. APEX LANTERN & ART DECO SPIRE (Y = 11.3m to 16.0m)+ // ==========================================+ const lanternGroup = createPivot('LanternGroup', [0, 7.7 + domeHeight * Math.sin(Math.PI * 0.48), 0], root);++ // Lantern Base Ring Collar+ createPart('LanternBaseCollar', cylinderGeo(1.05, 1.25, 0.16, 16), copperDark, {+ position: [0, 0.08, 0],+ parent: lanternGroup+ });++ // Octagonal Glazed Lantern Cupola (height 0.9m)+ createPart('LanternGlassCore', cylinderGeo(0.9, 0.9, 0.85, 16), glass, {+ position: [0, 0.56, 0],+ parent: lanternGroup+ });+ // 8 Vertical Copper Lantern Struts+ for (let l = 0; l < 8; l++) {+ const lAng = (l * Math.PI * 2) / 8;+ createPart('LanternStrut_' + l, boxGeo(0.1, 0.9, 0.12), copper, {+ position: [0.92 * Math.cos(lAng), 0.56, 0.92 * Math.sin(lAng)],+ rotation: [0, (-lAng * 180) / Math.PI, 0],+ parent: lanternGroup+ });+ }+ // Lantern Cornice+ createPart('LanternCornice', cylinderGeo(1.1, 0.98, 0.14, 16), copper, {+ position: [0, 1.05, 0],+ parent: lanternGroup+ });++ // Stepped Ziggurat Art Deco Crown (3 stepped copper tiers)+ createPart('CrownTier1', cylinderGeo(0.85, 1.02, 0.22, 16), copperPatina, {+ position: [0, 1.22, 0],+ parent: lanternGroup+ });+ createPart('CrownTier2', cylinderGeo(0.62, 0.82, 0.22, 16), copper, {+ position: [0, 1.42, 0],+ parent: lanternGroup+ });+ createPart('CrownTier3', cylinderGeo(0.42, 0.6, 0.22, 16), goldAccent, {+ position: [0, 1.62, 0],+ parent: lanternGroup+ });++ // 8 Radiating Art Deco Fin Blades / Sunburst Crown Crests (4 cardinal + 4 intercardinal)+ for (let k = 0; k < 8; k++) {+ const kDeg = k * 45;+ const isCardinal = (k % 2 === 0);+ createPart('SpireFin_' + k, boxGeo(0.04, isCardinal ? 0.95 : 0.7, isCardinal ? 0.72 : 0.52), (isCardinal ? copper : goldAccent), {+ position: [0, 1.8, 0],+ rotation: [0, kDeg, 0],+ parent: lanternGroup+ });+ }++ // Tapered Needle Spire (Reaching up to Y = 16.0m)+ createPart('SpireShaft', coneGeo(0.18, 2.2, 12), copper, {+ position: [0, 2.6, 0],+ parent: lanternGroup+ });+ createPart('SpireNeedle', coneGeo(0.04, 1.2, 8), goldAccent, {+ position: [0, 4.0, 0],+ parent: lanternGroup+ });+ createPart('SpireFinialOrb', sphereGeo(0.14, 8, 8), goldAccent, {+ position: [0, 4.65, 0],+ parent: lanternGroup+ });+ createPart('SpireTip', coneGeo(0.015, 0.5, 6), copper, {+ position: [0, 4.95, 0],+ parent: lanternGroup+ });++ // ==========================================+ // 8. INTERIOR BOTANICAL CONSERVATORY FEATURES (Visible through glass!)+ // ==========================================+ const interiorGroup = createPivot('InteriorGroup', [0, 1.6, 0], root);++ // Conservatory Interior Tiled Floor+ createPart('InteriorFloor', cylinderGeo(4.1, 4.1, 0.1, 24), stonePaver, {+ position: [0, 0.05, 0],+ parent: interiorGroup+ });++ // Central Raised Planter Bed (Circular with stepped copper rim)+ createPart('CentralPlanterWall', cylinderGeo(1.8, 1.9, 0.45, 20), stoneTrim, {+ position: [0, 0.25, 0],+ parent: interiorGroup+ });+ createPart('CentralPlanterRim', torusGeo(1.82, 0.06, 6, 24), copper, {+ position: [0, 0.48, 0],+ rotation: [90, 0, 0],+ parent: interiorGroup+ });+ createPart('CentralPlanterSoil', cylinderGeo(1.75, 1.75, 0.1, 20), soil, {+ position: [0, 0.42, 0],+ parent: interiorGroup+ });++ // Majestic Giant Interior Palm Tree (rising up into the glass dome!)+ const intTrunkPts = [+ [0, 0.45, 0],+ [0.15, 2.0, -0.1],+ [0.1, 4.2, 0.15],+ [-0.1, 6.2, 0.05]+ ];+ const intTrunkGeo = pipeAlongPath(intTrunkPts, 0.18, { radialSegments: 10 });+ createPart('InteriorTreeTrunk', intTrunkGeo, trunkMat, { parent: interiorGroup });++ // Spreading Tropical Palm Canopy under the dome+ const intHead = [-0.1, 6.2, 0.05];+ const intFrondCount = 14;+ for (let j = 0; j < intFrondCount; j++) {+ const jAng = (j * Math.PI * 2) / intFrondCount;+ const jPts = [+ [intHead[0], intHead[1], intHead[2]],+ [intHead[0] + 1.1 * Math.cos(jAng), intHead[1] + 0.6, intHead[2] + 1.1 * Math.sin(jAng)],+ [intHead[0] + 2.2 * Math.cos(jAng), intHead[1] + 0.3, intHead[2] + 2.2 * Math.sin(jAng)],+ [intHead[0] + 2.9 * Math.cos(jAng), intHead[1] - 0.7, intHead[2] + 2.9 * Math.sin(jAng)]+ ];+ const jFrondGeo = pipeAlongPath(jPts, 0.038, { radialSegments: 6 });+ createPart('InteriorFrond_' + j, jFrondGeo, palmGreen, { parent: interiorGroup });+ createPart('InteriorFrondLeaf_' + j, boxGeo(0.7, 0.04, 1.6), lightGreen, {+ position: [intHead[0] + 1.8 * Math.cos(jAng), intHead[1] + 0.35, intHead[2] + 1.8 * Math.sin(jAng)],+ rotation: [12 * Math.sin(jAng), (-jAng * 180) / Math.PI, 20],+ parent: interiorGroup+ });+ }++ // Understory Exotic Flora (Monsteras & Ferns) in Central Planter+ for (let u = 0; u < 6; u++) {+ const uAng = (u * Math.PI * 2) / 6;+ createPart('InteriorFern_' + u, sphereGeo(0.45, 6, 6), deepGreen, {+ position: [1.1 * Math.cos(uAng), 0.7, 1.1 * Math.sin(uAng)],+ scale: [1.2, 0.8, 1.2],+ parent: interiorGroup+ });+ createPart('InteriorOrchid_' + u, sphereGeo(0.18, 5, 5), (u % 2 === 0 ? flowerPink : flowerGold), {+ position: [1.1 * Math.cos(uAng), 0.95, 1.1 * Math.sin(uAng)],+ parent: interiorGroup+ });+ }++ return root;+}diff --git a/examples/demo-art-deco-conservatory.provenance.json b/examples/demo-art-deco-conservatory.provenance.jsonnew file mode 100644index 00000000..72c2dce2--- /dev/null+++ b/examples/demo-art-deco-conservatory.provenance.json@@ -0,0 +1,54 @@+{+ "sourceHash": "939586687895080c38d0683c75e370c9249fb7ddd9ecc17a791c0b4723f5a3d2",+ "model": "Gemini 3.8 Flash",+ "harness": "Antigravity CLI",+ "authoredDate": "2026-09-09",+ "provenance": {+ "attribution": "Recorded demo session; model credit supplied only where the retained run identifies it.",+ "sourceAccess": "See retained demo run; no stronger isolation claim is made.",+ "humanIntervention": "Owner supplied direction; model-authored exported source preserved byte-for-byte.",+ "reviewFidelity": "Authoring feedback and shaded demo previews where available. Not a destination-runtime acceptance claim.",+ "poster": "Gallery GPU render of the exact downloadable GLB. Source, artifact, image hashes and camera settings are recorded alongside the poster.",+ "evaluationGlbHash": "dd7a16fe454efe062a6d47148c034227436f43ded42e197c07e89cddbe86ad15",+ "posterReceipt": {+ "captureIdentity": [+ "kiln.capture-producer.v1",+ "sha256:10f346ec6287c8d635dabe4668d72925080e6fe3d059dd7a9252f2694ce595c2",+ "44832275-6b15-4353-8fcb-ac1de3fda8e6",+ "dawn-d3d12:nvidia-geforce-rtx-3070:D3D12 driver version 32.0.16.1074"+ ],+ "sourceHash": "939586687895080c38d0683c75e370c9249fb7ddd9ecc17a791c0b4723f5a3d2",+ "artifactHash": "fe283930b2e63b9f417dd48a9b4e5323ca154f9a13f5d18bcd0b9ba0f9095f87",+ "imageHash": "e026791d17694c00288e2109a79e110a3664f66ba4279fca84e8044af74998bb",+ "width": 1024,+ "height": 1024,+ "camera": {+ "version": "kiln.camera.v1",+ "projection": "orthographic",+ "position": [+ 53.081006527430674,+ 31.07001350765549,+ 37.15670456920146+ ],+ "target": [+ 1.517977746415971,+ 6.319759692768433,+ 1.0625844224911807+ ],+ "up": [+ 0,+ 1,+ 0+ ],+ "aspect": 1,+ "near": 0.01,+ "far": 169.0803527568002,+ "halfHeight": 14.992599233523269+ },+ "rendererId": "dawn-d3d12:nvidia-geforce-rtx-3070:D3D12 driver version 32.0.16.1074",+ "materialFaithful": true,+ "lightingPresetId": "gallery-studio-v1",+ "purpose": "Gallery poster generated from the exact downloadable GLB; separate from authoring feedback."+ }+ }+}diff --git a/examples/demo-battleship.kiln.js b/examples/demo-battleship.kiln.jsnew file mode 100644index 00000000..831b05fb--- /dev/null+++ b/examples/demo-battleship.kiln.js@@ -0,0 +1,987 @@+// Kiln Battleship: Detailed battleship with triple gun turrets and a wooden deck+const meta = {+ name: 'Battleship',+ category: 'vehicle',+ role: 'vehicle'+};++/**+ * Procedural Battleship Model+ * Dimensions: ~160m LOA, 24m Beam, 40m Masthead Height+ * Orientation: +X Forward (Bow), +Y Up, +Z Right (Starboard)+ */+async function build() {+ const root = createRoot('Battleship');++ // --- Materials ---+ const mats = {+ steelHull: gameMaterial(0x6c7986, { roughness: 0.65, metalness: 0.3 }),+ steelSuper: gameMaterial(0x82919e, { roughness: 0.55, metalness: 0.25 }),+ steelArmor: gameMaterial(0x56626d, { roughness: 0.6, metalness: 0.35 }),+ darkSteel: gameMaterial(0x2a2e33, { roughness: 0.45, metalness: 0.65 }),+ blackMetal: gameMaterial(0x16181a, { roughness: 0.8, metalness: 0.3 }),+ redHull: gameMaterial(0x862c24, { roughness: 0.72, metalness: 0.15 }),+ waterlineBoot: gameMaterial(0x1a1c1e, { roughness: 0.85, metalness: 0.2 }),+ woodDeck: gameMaterial(0xc49c6d, { roughness: 0.88, metalness: 0.04 }),+ woodMargin: gameMaterial(0x9e7344, { roughness: 0.9, metalness: 0.04 }),+ turretRoofRed: gameMaterial(0x8a1c1c, { roughness: 0.65, metalness: 0.25 }),+ canvasBag: gameMaterial(0xded7c8, { roughness: 0.95, metalness: 0.02 }),+ glass: gameMaterial(0x2b4557, { roughness: 0.12, metalness: 0.85 }),+ brass: gameMaterial(0xd4af37, { roughness: 0.32, metalness: 0.85 }),+ bronzeProp: gameMaterial(0xb07d42, { roughness: 0.35, metalness: 0.8 }),+ white: gameMaterial(0xe8ebed, { roughness: 0.5, metalness: 0.1 }),+ navyBlue: gameMaterial(0x2a3e50, { roughness: 0.45, metalness: 0.25 }),+ ensignRed: gameMaterial(0xb82626, { roughness: 0.7, metalness: 0.1 }),+ ensignWhite: gameMaterial(0xf0f0f0, { roughness: 0.7, metalness: 0.1 }),+ ensignBlue: gameMaterial(0x1e305e, { roughness: 0.7, metalness: 0.1 }),+ };++ // --- Hull Stations Profile ---+ const xStations = [+ -72, -70, -67, -63, -58, -52, -45, -38, -30, -22, -14, -6,+ 0, 6, 14, 22, 30, 38, 45, 52, 58, 64, 70, 75, 79, 83, 86, 88+ ];++ function getHullProfile(x) {+ let yd = 8.6;+ if (x < -38) {+ const t = (x - (-72)) / 34;+ yd = 8.0 + 0.6 * Math.sin(t * Math.PI / 2);+ } else if (x > 30) {+ const t = (x - 30) / 58;+ yd = 8.6 + 3.6 * Math.pow(t, 1.7);+ }++ let wd = 12.0;+ if (x < -30) {+ const t = (x - (-72)) / 42;+ wd = 0.6 + 11.4 * (3 * t * t - 2 * t * t * t);+ } else if (x > 30) {+ const t = (88 - x) / 58;+ wd = 0.25 + 11.75 * Math.pow(t, 1.35);+ }++ let wb = wd;+ if (x >= -35 && x <= 25) {+ wb = 12.4;+ } else if (x < -35) {+ const t = (x - (-72)) / 37;+ wb = Math.max(0.4, 0.5 + 11.9 * Math.pow(t, 1.2));+ } else if (x > 25) {+ const t = (88 - x) / 63;+ wb = Math.max(0.2, 0.2 + 12.2 * Math.pow(t, 1.5));+ }++ let yk = 0.5;+ if (x < -48) {+ const t = (x - (-48)) / (-24);+ yk = 0.5 + 4.2 * (t * t);+ } else if (x > 70) {+ const t = (x - 70) / 18;+ yk = 0.5 + 1.2 * (t * t);+ }++ return { yd, wd, wb, yk };+ }++ // --- 1. Lower Hull (Red Anti-Fouling Paint) ---+ {+ const positions = [];+ const indices = [];+ const numPts = 7;++ for (let i = 0; i < xStations.length; i++) {+ const x = xStations[i];+ const { yk, wb } = getHullProfile(x);+ positions.push(+ x, 4.0, -wb,+ x, yk + (4.0 - yk) * 0.7, -wb * 0.94,+ x, yk + (4.0 - yk) * 0.28, -wb * 0.65,+ x, yk, 0,+ x, yk + (4.0 - yk) * 0.28, wb * 0.65,+ x, yk + (4.0 - yk) * 0.7, wb * 0.94,+ x, 4.0, wb+ );+ }++ for (let i = 0; i < xStations.length - 1; i++) {+ const rowA = i * numPts;+ const rowB = (i + 1) * numPts;+ for (let p = 0; p < numPts - 1; p++) {+ const a0 = rowA + p;+ const a1 = rowA + p + 1;+ const b0 = rowB + p;+ const b1 = rowB + p + 1;+ indices.push(a0, b0, b1, a0, b1, a1);+ }+ }++ // Caps+ const s0 = 0;+ indices.push(s0, s0 + 1, s0 + 3, s0 + 1, s0 + 2, s0 + 3, s0 + 3, s0 + 4, s0 + 5, s0 + 3, s0 + 5, s0 + 6);+ const bEnd = (xStations.length - 1) * numPts;+ indices.push(bEnd + 3, bEnd + 1, bEnd, bEnd + 3, bEnd + 2, bEnd + 1, bEnd + 5, bEnd + 4, bEnd + 3, bEnd + 6, bEnd + 5, bEnd + 3);++ createPart('LowerHull', meshGeo({ positions, indices }), mats.redHull, { parent: root });+ }++ // --- 2. Waterline Boot-Topping Stripe (Dark Charcoal) ---+ {+ const positions = [];+ const indices = [];+ const numPts = 4;++ for (let i = 0; i < xStations.length; i++) {+ const x = xStations[i];+ const { wb } = getHullProfile(x);+ positions.push(+ x, 3.8, -wb * 0.99,+ x, 4.3, -wb,+ x, 3.8, wb * 0.99,+ x, 4.3, wb+ );+ }++ for (let i = 0; i < xStations.length - 1; i++) {+ const rowA = i * numPts;+ const rowB = (i + 1) * numPts;+ // Port:+ indices.push(rowA, rowA + 1, rowB + 1, rowA, rowB + 1, rowB);+ // Starboard:+ indices.push(rowA + 2, rowB + 2, rowB + 3, rowA + 2, rowB + 3, rowA + 3);+ }++ createPart('WaterlineStripe', meshGeo({ positions, indices }), mats.waterlineBoot, { parent: root });+ }++ // --- 3. Upper Hull (Naval Haze Gray) ---+ {+ const positions = [];+ const indices = [];+ const numPts = 8;++ for (let i = 0; i < xStations.length; i++) {+ const x = xStations[i];+ const { yd, wd, wb } = getHullProfile(x);+ const bulwarkH = x > 30 ? 1.1 : 0.8;+ positions.push(+ x, 4.3, -wb,+ x, 4.3 + (yd - 4.3) * 0.5, -(wb * 0.45 + wd * 0.55),+ x, yd, -wd,+ x, yd + bulwarkH, -wd,+ x, 4.3, wb,+ x, 4.3 + (yd - 4.3) * 0.5, (wb * 0.45 + wd * 0.55),+ x, yd, wd,+ x, yd + bulwarkH, wd+ );+ }++ for (let i = 0; i < xStations.length - 1; i++) {+ const rowA = i * numPts;+ const rowB = (i + 1) * numPts;+ for (let p = 0; p < 3; p++) {+ const a0 = rowA + p;+ const a1 = rowA + p + 1;+ const b0 = rowB + p;+ const b1 = rowB + p + 1;+ indices.push(a0, a1, b1, a0, b1, b0);+ }+ for (let p = 4; p < 7; p++) {+ const a0 = rowA + p;+ const a1 = rowA + p + 1;+ const b0 = rowB + p;+ const b1 = rowB + p + 1;+ indices.push(a0, b0, b1, a0, b1, a1);+ }+ }++ // Stern transom closure+ indices.push(+ 0, 4, 5, 0, 5, 1,+ 1, 5, 6, 1, 6, 2,+ 2, 6, 7, 2, 7, 3+ );++ createPart('UpperHull', meshGeo({ positions, indices }), mats.steelHull, { parent: root });+ }++ // --- 4. Main Wooden Deck (Teak Planking) ---+ {+ const positions = [];+ const indices = [];+ const zFracs = [-1.0, -0.75, -0.5, -0.25, 0.0, 0.25, 0.5, 0.75, 1.0];+ const numCols = zFracs.length;++ for (let i = 0; i < xStations.length; i++) {+ const x = xStations[i];+ const { yd, wd } = getHullProfile(x);+ for (let j = 0; j < numCols; j++) {+ const f = zFracs[j];+ const z = f * wd;+ const camber = 0.22 * (1.0 - f * f);+ positions.push(x, yd + camber, z);+ }+ }++ for (let i = 0; i < xStations.length - 1; i++) {+ const rowA = i * numCols;+ const rowB = (i + 1) * numCols;+ for (let j = 0; j < numCols - 1; j++) {+ const a0 = rowA + j;+ const a1 = rowA + j + 1;+ const b0 = rowB + j;+ const b1 = rowB + j + 1;+ indices.push(a0, a1, b1, a0, b1, b0);+ }+ }++ createPart('WoodenDeck', meshGeo({ positions, indices }), mats.woodDeck, { parent: root });+ }++ // --- 5. Main Armor Belt (Citadel Bulge) ---+ {+ createPart('ArmorBeltPort', boxGeo(72, 3.2, 0.4), mats.steelArmor, {+ position: [-2, 5.8, -12.35],+ parent: root+ });+ createPart('ArmorBeltStbd', boxGeo(72, 3.2, 0.4), mats.steelArmor, {+ position: [-2, 5.8, 12.35],+ parent: root+ });+ }++ // --- 6. Triple Gun Turret Generator ---+ function buildTripleTurret(name, cfg, parent) {+ const { x, yDeck, barbetteHeight, turretElevation, facingAngle } = cfg;+ const turretPivot = createPivot(name, [x, yDeck, 0], parent);++ // 1. Cylindrical Armored Barbette+ const barbetteRadius = 5.3;+ createPart(`${name}_Barbette`, cylinderGeo(barbetteRadius, barbetteRadius, barbetteHeight, 32), mats.steelArmor, {+ position: [0, barbetteHeight / 2, 0],+ parent: turretPivot+ });++ createPart(`${name}_BarbetteRing`, cylinderGeo(barbetteRadius + 0.35, barbetteRadius + 0.35, 0.2, 32), mats.steelSuper, {+ position: [0, 0.1, 0],+ parent: turretPivot+ });++ // 2. Rotating Turret Assembly+ const gunhousePivot = createPivot(`${name}_Gunhouse`, [0, barbetteHeight, 0], turretPivot);+ gunhousePivot.rotation.y = (facingAngle * Math.PI) / 180;++ createPart(`${name}_GunhouseBase`, boxGeo(11.2, 1.8, 8.8), mats.steelSuper, {+ position: [0.6, 0.9, 0],+ parent: gunhousePivot+ });++ createPart(`${name}_SlopedFrontArmor`, boxGeo(5.2, 1.8, 8.4), mats.steelSuper, {+ position: [3.8, 2.35, 0],+ rotation: [0, 0, -38],+ parent: gunhousePivot+ });++ createPart(`${name}_GunhouseRoof`, boxGeo(7.8, 1.2, 8.4), mats.turretRoofRed, {+ position: [-1.2, 2.65, 0],+ parent: gunhousePivot+ });++ createPart(`${name}_RearOverhang`, boxGeo(3.2, 1.4, 8.2), mats.steelArmor, {+ position: [-4.6, 1.6, 0],+ parent: gunhousePivot+ });++ createPart(`${name}_RangefinderBeam`, cylinderGeo(0.32, 0.32, 11.2, 16), mats.steelSuper, {+ position: [-3.8, 2.7, 0],+ rotation: [90, 0, 0],+ parent: gunhousePivot+ });+ createPart(`${name}_RangefinderEarPort`, boxGeo(0.9, 0.7, 0.8), mats.darkSteel, {+ position: [-3.8, 2.7, -5.6],+ parent: gunhousePivot+ });+ createPart(`${name}_RangefinderEarStbd`, boxGeo(0.9, 0.7, 0.8), mats.darkSteel, {+ position: [-3.8, 2.7, 5.6],+ parent: gunhousePivot+ });++ createPart(`${name}_PeriscopePort`, cylinderGeo(0.2, 0.2, 0.6, 12), mats.brass, {+ position: [-1.0, 3.4, -2.0],+ parent: gunhousePivot+ });+ createPart(`${name}_PeriscopeStbd`, cylinderGeo(0.2, 0.2, 0.6, 12), mats.brass, {+ position: [-1.0, 3.4, 2.0],+ parent: gunhousePivot+ });+ createPart(`${name}_VentCowl`, cylinderGeo(0.35, 0.25, 0.35, 12), mats.darkSteel, {+ position: [-2.6, 3.35, 0],+ parent: gunhousePivot+ });++ // 3. Three 16-inch Gun Barrels+ const barrelZ = [-2.4, 0.0, 2.4];+ const elevRad = (turretElevation * Math.PI) / 180;++ for (let b = 0; b < barrelZ.length; b++) {+ const bz = barrelZ[b];+ const gunMount = createPivot(`${name}_GunMount_${b}`, [4.2, 1.6, bz], gunhousePivot);+ gunMount.rotation.z = elevRad;++ createPart(`${name}_BlastBag_${b}`, cylinderXGeo(0.72, 0.82, 1.8, 16), mats.canvasBag, {+ position: [0.8, 0, 0],+ parent: gunMount+ });++ createPart(`${name}_SlideSleeve_${b}`, cylinderXGeo(0.52, 0.56, 4.4, 16), mats.steelSuper, {+ position: [3.4, 0, 0],+ parent: gunMount+ });++ createPart(`${name}_BarrelTube_${b}`, cylinderXGeo(0.34, 0.50, 11.5, 16), mats.darkSteel, {+ position: [11.2, 0, 0],+ parent: gunMount+ });++ createPart(`${name}_MuzzleRing_${b}`, cylinderXGeo(0.38, 0.38, 0.6, 16), mats.darkSteel, {+ position: [17.1, 0, 0],+ parent: gunMount+ });++ createPart(`${name}_MuzzleBore_${b}`, cylinderXGeo(0.22, 0.22, 0.25, 12), mats.blackMetal, {+ position: [17.3, 0, 0],+ parent: gunMount+ });+ }++ if (cfg.hasRoofAA) {+ createPart(`${name}_RoofAATub`, cylinderGeo(1.8, 1.8, 0.8, 16), mats.steelSuper, {+ position: [-0.6, 3.65, 0],+ parent: gunhousePivot+ });+ createPart(`${name}_RoofAAGuns`, boxGeo(2.4, 0.4, 0.9), mats.darkSteel, {+ position: [0.3, 3.8, 0],+ parent: gunhousePivot+ });+ }++ return turretPivot;+ }++ // --- 7. Main Armament: Triple Gun Turrets 1, 2, 3 ---+ buildTripleTurret('Turret_1', {+ x: 48,+ yDeck: 9.35,+ barbetteHeight: 0.9,+ turretElevation: 5,+ facingAngle: 0,+ hasRoofAA: false+ }, root);++ buildTripleTurret('Turret_2', {+ x: 31,+ yDeck: 8.75,+ barbetteHeight: 4.8,+ turretElevation: 7,+ facingAngle: 0,+ hasRoofAA: true+ }, root);++ buildTripleTurret('Turret_3', {+ x: -38,+ yDeck: 8.25,+ barbetteHeight: 1.1,+ turretElevation: 6,+ facingAngle: 180,+ hasRoofAA: true+ }, root);++ // --- 8. Forecastle Equipment & Details ---+ {+ createPart('BreakwaterPort', boxGeo(8.5, 1.2, 0.18), mats.steelSuper, {+ position: [59.0, 10.6, -3.4],+ rotation: [0, 36, 12],+ parent: root+ });+ createPart('BreakwaterStbd', boxGeo(8.5, 1.2, 0.18), mats.steelSuper, {+ position: [59.0, 10.6, 3.4],+ rotation: [0, -36, 12],+ parent: root+ });++ createPart('HawsePipePort', cylinderGeo(0.65, 0.65, 1.2, 12), mats.darkSteel, {+ position: [81.5, 11.2, -1.8],+ rotation: [45, 0, 30],+ parent: root+ });+ createPart('AnchorPortFluke', boxGeo(1.6, 1.4, 0.3), mats.darkSteel, {+ position: [81.2, 10.8, -1.9],+ rotation: [0, 15, 35],+ parent: root+ });+ createPart('HawsePipeStbd', cylinderGeo(0.65, 0.65, 1.2, 12), mats.darkSteel, {+ position: [81.5, 11.2, 1.8],+ rotation: [-45, 0, 30],+ parent: root+ });+ createPart('AnchorStbdFluke', boxGeo(1.6, 1.4, 0.3), mats.darkSteel, {+ position: [81.2, 10.8, 1.9],+ rotation: [0, -15, 35],+ parent: root+ });++ createPart('CapstanPort', cylinderGeo(0.85, 0.95, 1.4, 16), mats.darkSteel, {+ position: [74.0, 11.8, -2.0],+ parent: root+ });+ createPart('CapstanStbd', cylinderGeo(0.85, 0.95, 1.4, 16), mats.darkSteel, {+ position: [74.0, 11.8, 2.0],+ parent: root+ });+ createPart('CapstanHeadPort', cylinderGeo(0.5, 0.5, 0.25, 16), mats.brass, {+ position: [74.0, 12.55, -2.0],+ parent: root+ });+ createPart('CapstanHeadStbd', cylinderGeo(0.5, 0.5, 0.25, 16), mats.brass, {+ position: [74.0, 12.55, 2.0],+ parent: root+ });++ createPart('ChainPort', boxGeo(8.0, 0.16, 0.28), mats.darkSteel, {+ position: [77.5, 11.6, -1.9],+ rotation: [0, 2, 0],+ parent: root+ });+ createPart('ChainStbd', boxGeo(8.0, 0.16, 0.28), mats.darkSteel, {+ position: [77.5, 11.6, 1.9],+ rotation: [0, -2, 0],+ parent: root+ });++ createPart('Jackstaff', cylinderGeo(0.06, 0.12, 6.5, 8), mats.steelSuper, {+ position: [87.5, 15.5, 0],+ parent: root+ });+ }++ // --- 9. Superstructure & Bridge Tower ---+ {+ const superGroup = createPivot('Superstructure', [0, 0, 0], root);++ createPart('DeckhouseTier1', boxGeo(45, 3.8, 14.0), mats.steelSuper, {+ position: [-1.0, 10.6, 0],+ parent: superGroup+ });+ createPart('DeckhouseFwdRound', cylinderGeo(7.0, 7.0, 3.8, 24), mats.steelSuper, {+ position: [21.5, 10.6, 0],+ parent: superGroup+ });++ createPart('DeckhouseTier2', boxGeo(38, 3.2, 11.6), mats.steelSuper, {+ position: [-1.5, 14.1, 0],+ parent: superGroup+ });++ createPart('ConningTower', cylinderGeo(3.6, 3.9, 3.2, 24), mats.steelArmor, {+ position: [15.5, 17.2, 0],+ parent: superGroup+ });+ createPart('ConningSlits', cylinderGeo(3.7, 3.7, 0.35, 24), mats.blackMetal, {+ position: [15.5, 17.5, 0],+ parent: superGroup+ });++ createPart('NavBridgeHouse', boxGeo(6.8, 2.8, 8.2), mats.steelSuper, {+ position: [14.0, 20.1, 0],+ parent: superGroup+ });+ createPart('BridgeWindowsFwd', boxGeo(0.2, 1.1, 7.6), mats.glass, {+ position: [17.45, 20.3, 0],+ parent: superGroup+ });+ createPart('BridgeWindowsPort', boxGeo(4.2, 1.1, 0.2), mats.glass, {+ position: [15.2, 20.3, -4.15],+ parent: superGroup+ });+ createPart('BridgeWindowsStbd', boxGeo(4.2, 1.1, 0.2), mats.glass, {+ position: [15.2, 20.3, 4.15],+ parent: superGroup+ });++ createPart('BridgeWingPort', boxGeo(3.2, 2.2, 5.0), mats.steelSuper, {+ position: [14.0, 19.8, -6.6],+ parent: superGroup+ });+ createPart('BridgeWingStbd', boxGeo(3.2, 2.2, 5.0), mats.steelSuper, {+ position: [14.0, 19.8, 6.6],+ parent: superGroup+ });+ createPart('PelorusPort', cylinderGeo(0.18, 0.18, 1.0, 12), mats.brass, {+ position: [14.5, 21.4, -8.6],+ parent: superGroup+ });+ createPart('PelorusStbd', cylinderGeo(0.18, 0.18, 1.0, 12), mats.brass, {+ position: [14.5, 21.4, 8.6],+ parent: superGroup+ });++ createPart('CommandPlatform', boxGeo(5.2, 0.8, 6.4), mats.steelSuper, {+ position: [13.2, 21.8, 0],+ parent: superGroup+ });+ createPart('WindscreenRim', boxGeo(5.4, 0.9, 6.6), mats.brass, {+ position: [13.2, 22.5, 0],+ parent: superGroup+ });++ createPart('DirectorTowerPedestal', cylinderGeo(2.4, 2.8, 4.8, 16), mats.steelSuper, {+ position: [11.0, 24.6, 0],+ parent: superGroup+ });+ const fwdDirector = createPivot('Mk38DirectorFwd', [11.0, 26.9, 0], superGroup);+ createPart('DirectorHouse', boxGeo(3.2, 2.0, 3.4), mats.steelArmor, {+ position: [0, 1.0, 0],+ parent: fwdDirector+ });+ createPart('DirectorArm', cylinderGeo(0.35, 0.35, 9.2, 16), mats.steelSuper, {+ position: [0, 1.1, 0],+ rotation: [90, 0, 0],+ parent: fwdDirector+ });+ createPart('DirectorHoodPort', boxGeo(0.8, 0.7, 0.8), mats.darkSteel, {+ position: [0, 1.1, -4.6],+ parent: fwdDirector+ });+ createPart('DirectorHoodStbd', boxGeo(0.8, 0.7, 0.8), mats.darkSteel, {+ position: [0, 1.1, 4.6],+ parent: fwdDirector+ });+ createPart('RadarBracket', cylinderGeo(0.16, 0.16, 0.4, 8), mats.darkSteel, {+ position: [0.2, 2.0, 0],+ parent: fwdDirector+ });+ createPart('RadarMk8Mesh', boxGeo(1.8, 0.9, 3.2), mats.darkSteel, {+ position: [0.2, 2.35, 0],+ parent: fwdDirector+ });++ createPart('ForemastTrunk', cylinderGeo(0.35, 0.65, 14.0, 12), mats.steelSuper, {+ position: [8.5, 33.5, 0],+ parent: superGroup+ });+ createPart('TripodLegPort', cylinderGeo(0.22, 0.35, 11.5, 8), mats.steelSuper, {+ position: [6.8, 30.5, -2.4],+ rotation: [16, 0, 12],+ parent: superGroup+ });+ createPart('TripodLegStbd', cylinderGeo(0.22, 0.35, 11.5, 8), mats.steelSuper, {+ position: [6.8, 30.5, 2.4],+ rotation: [-16, 0, 12],+ parent: superGroup+ });+ createPart('LowerYardarm', cylinderGeo(0.12, 0.12, 13.5, 8), mats.steelSuper, {+ position: [8.5, 33.0, 0],+ rotation: [90, 0, 0],+ parent: superGroup+ });+ createPart('UpperYardarm', cylinderGeo(0.08, 0.08, 8.5, 8), mats.steelSuper, {+ position: [8.5, 36.8, 0],+ rotation: [90, 0, 0],+ parent: superGroup+ });+ createPart('SGRadarPlatform', cylinderGeo(1.2, 1.2, 0.2, 12), mats.steelSuper, {+ position: [8.5, 35.0, 0],+ parent: superGroup+ });+ createPart('SGRadarDish', cylinderGeo(0.6, 0.6, 0.3, 12), mats.darkSteel, {+ position: [8.5, 35.4, 0],+ rotation: [0, 30, 90],+ parent: superGroup+ });+ createPart('SCRadarAntenna', boxGeo(1.6, 2.4, 2.4), mats.darkSteel, {+ position: [8.5, 41.2, 0],+ parent: superGroup+ });+ }++ // --- 10. Smokestacks / Funnels & Machinery Casings ---+ {+ const f1Group = createPivot('Funnel_1', [4.5, 15.6, 0], root);+ f1Group.rotation.z = (-5 * Math.PI) / 180;++ createPart('Funnel1Body', cylinderGeo(2.4, 2.8, 7.8, 24), mats.steelSuper, {+ position: [0, 3.9, 0],+ scale: [1.35, 1.0, 0.85],+ parent: f1Group+ });+ createPart('Funnel1Cap', cylinderGeo(2.45, 2.45, 1.2, 24), mats.blackMetal, {+ position: [0, 7.8, 0],+ scale: [1.35, 1.0, 0.85],+ parent: f1Group+ });+ createPart('SteamPipe1', cylinderGeo(0.18, 0.18, 7.5, 8), mats.brass, {+ position: [3.3, 3.8, 0],+ parent: f1Group+ });++ const f2Group = createPivot('Funnel_2', [-7.5, 15.6, 0], root);+ f2Group.rotation.z = (-5 * Math.PI) / 180;++ createPart('Funnel2Body', cylinderGeo(2.3, 2.7, 7.4, 24), mats.steelSuper, {+ position: [0, 3.7, 0],+ scale: [1.35, 1.0, 0.85],+ parent: f2Group+ });+ createPart('Funnel2Cap', cylinderGeo(2.35, 2.35, 1.2, 24), mats.blackMetal, {+ position: [0, 7.4, 0],+ scale: [1.35, 1.0, 0.85],+ parent: f2Group+ });+ createPart('SteamPipe2', cylinderGeo(0.18, 0.18, 7.2, 8), mats.brass, {+ position: [3.2, 3.6, 0],+ parent: f2Group+ });++ createPart('SearchlightDeck', boxGeo(5.0, 0.8, 10.5), mats.steelSuper, {+ position: [-1.5, 17.2, 0],+ parent: root+ });+ const sPositions = [+ [-1.5, 17.6, -4.2],+ [-1.5, 17.6, 4.2],+ [-1.5, 17.6, -1.8],+ [-1.5, 17.6, 1.8]+ ];+ for (let s = 0; s < sPositions.length; s++) {+ const [sx, sy, sz] = sPositions[s];+ const sPivot = createPivot(`Searchlight_${s}`, [sx, sy, sz], root);+ createPart(`SearchlightPedestal_${s}`, cylinderGeo(0.2, 0.25, 0.7, 12), mats.steelSuper, {+ position: [0, 0.35, 0],+ parent: sPivot+ });+ createPart(`SearchlightDrum_${s}`, cylinderXGeo(0.6, 0.6, 0.8, 16), mats.brass, {+ position: [0, 0.85, 0],+ parent: sPivot+ });+ createPart(`SearchlightLens_${s}`, cylinderXGeo(0.52, 0.52, 0.15, 16), mats.glass, {+ position: [0.38, 0.85, 0],+ parent: sPivot+ });+ }++ const boatPositions = [+ [-1.5, 15.7, -6.8],+ [-1.5, 15.7, 6.8]+ ];+ for (let b = 0; b < boatPositions.length; b++) {+ const [bx, by, bz] = boatPositions[b];+ const boat = createPivot(`MotorLaunch_${b}`, [bx, by, bz], root);+ createPart(`LaunchHull_${b}`, boxGeo(9.5, 1.4, 2.8), mats.white, {+ position: [0, 0.7, 0],+ parent: boat+ });+ createPart(`LaunchCabin_${b}`, boxGeo(4.2, 1.1, 2.0), mats.woodMargin, {+ position: [-0.6, 1.7, 0],+ parent: boat+ });+ createPart(`LaunchChockFwd_${b}`, boxGeo(0.4, 0.5, 3.2), mats.steelSuper, {+ position: [2.5, 0.25, 0],+ parent: boat+ });+ createPart(`LaunchChockAft_${b}`, boxGeo(0.4, 0.5, 3.2), mats.steelSuper, {+ position: [-2.5, 0.25, 0],+ parent: boat+ });+ }++ const cranePivot = createPivot('MidshipsCrane', [-13.0, 15.6, 0], root);+ createPart('CranePillar', cylinderGeo(0.7, 0.85, 5.0, 16), mats.steelSuper, {+ position: [0, 2.5, 0],+ parent: cranePivot+ });+ createPart('MidshipsCraneBoom', boxGeo(11.0, 0.5, 0.6), mats.steelSuper, {+ position: [-4.5, 4.9, 0],+ rotation: [0, 0, 18],+ parent: cranePivot+ });+ }++ // --- 11. Secondary Battery: Twin 5-inch/38-Caliber Turrets ---+ {+ const secPositions = [+ { x: 10.0, z: 8.4, facing: 45 },+ { x: -1.5, z: 8.6, facing: 90 },+ { x: -13.0, z: 8.4, facing: 135 },+ { x: 10.0, z: -8.4, facing: -45 },+ { x: -1.5, z: -8.6, facing: -90 },+ { x: -13.0, z: -8.4, facing: -135 },+ ];++ for (let i = 0; i < secPositions.length; i++) {+ const { x, z, facing } = secPositions[i];+ const secPivot = createPivot(`SecTurret_${i}`, [x, 12.5, z], root);+ secPivot.rotation.y = (facing * Math.PI) / 180;++ createPart(`SecMountRing_${i}`, cylinderGeo(1.8, 1.8, 0.4, 16), mats.steelArmor, {+ position: [0, 0.2, 0],+ parent: secPivot+ });+ createPart(`SecGunhouse_${i}`, boxGeo(3.2, 1.8, 2.8), mats.steelSuper, {+ position: [0, 1.2, 0],+ parent: secPivot+ });+ createPart(`SecBarrelL_${i}`, cylinderXGeo(0.14, 0.18, 4.4, 12), mats.darkSteel, {+ position: [2.8, 1.3, -0.55],+ parent: secPivot+ });+ createPart(`SecBarrelR_${i}`, cylinderXGeo(0.14, 0.18, 4.4, 12), mats.darkSteel, {+ position: [2.8, 1.3, 0.55],+ parent: secPivot+ });+ }+ }++ // --- 12. Anti-Aircraft Batteries (40mm Bofors Quad Mounts) ---+ {+ const aaPositions = [+ { x: 23.0, y: 12.4, z: 7.2 },+ { x: 23.0, y: 12.4, z: -7.2 },+ { x: 4.5, y: 15.6, z: 7.5 },+ { x: 4.5, y: 15.6, z: -7.5 },+ { x: -20.0, y: 12.4, z: 5.6 },+ { x: -20.0, y: 12.4, z: -5.6 },+ ];++ for (let i = 0; i < aaPositions.length; i++) {+ const { x, y, z } = aaPositions[i];+ const aaTub = createPivot(`BoforsTub_${i}`, [x, y, z], root);+ createPart(`BoforsTubWall_${i}`, cylinderGeo(1.9, 1.9, 1.1, 16), mats.steelSuper, {+ position: [0, 0.55, 0],+ parent: aaTub+ });+ createPart(`BoforsCarriage_${i}`, boxGeo(1.2, 0.8, 1.1), mats.darkSteel, {+ position: [0, 0.9, 0],+ parent: aaTub+ });+ createPart(`BoforsBarrels_${i}`, boxGeo(2.6, 0.35, 0.8), mats.darkSteel, {+ position: [0.6, 1.2, 0],+ rotation: [0, 0, 15],+ parent: aaTub+ });+ }+ }++ // --- 13. Aft Superstructure, Mainmast & Secondary Director ---+ {+ const aftGroup = createPivot('AftSuperstructure', [-20.0, 12.4, 0], root);++ createPart('AftDeckhouse', boxGeo(8.5, 2.8, 7.8), mats.steelSuper, {+ position: [0, 1.4, 0],+ parent: aftGroup+ });++ const aftDir = createPivot('Mk38DirectorAft', [1.5, 2.8, 0], aftGroup);+ createPart('AftDirHouse', boxGeo(2.8, 1.8, 3.0), mats.steelArmor, {+ position: [0, 1.0, 0],+ parent: aftDir+ });+ createPart('AftDirArm', cylinderGeo(0.32, 0.32, 8.4, 16), mats.steelSuper, {+ position: [0, 1.1, 0],+ rotation: [90, 0, 0],+ parent: aftDir+ });++ createPart('MainmastTrunk', cylinderGeo(0.3, 0.5, 14.0, 12), mats.steelSuper, {+ position: [-2.8, 9.8, 0],+ parent: aftGroup+ });+ createPart('MainmastYardarm', cylinderGeo(0.09, 0.09, 9.5, 8), mats.steelSuper, {+ position: [-2.8, 13.2, 0],+ rotation: [90, 0, 0],+ parent: aftGroup+ });+ createPart('EnsignGaff', cylinderGeo(0.06, 0.08, 4.2, 8), mats.steelSuper, {+ position: [-4.2, 14.5, 0],+ rotation: [0, 0, -42],+ parent: aftGroup+ });+ }++ // --- 14. Fantail / Quarterdeck Equipment & Reconnaissance Floatplane ---+ {+ const catPivot = createPivot('AircraftCatapult', [-63.5, 8.1, 0], root);+ catPivot.rotation.y = (-50 * Math.PI) / 180;++ createPart('CatapultTurntable', cylinderGeo(1.8, 2.0, 0.8, 16), mats.steelArmor, {+ position: [0, 0.4, 0],+ parent: catPivot+ });+ createPart('LaunchRail', boxGeo(16.5, 0.8, 1.2), mats.steelSuper, {+ position: [3.5, 1.2, 0],+ parent: catPivot+ });++ const plane = createPivot('Floatplane', [2.5, 2.2, 0], catPivot);+ createPart('PlaneFuselage', boxGeo(6.8, 1.2, 1.2), mats.navyBlue, {+ position: [0, 0.6, 0],+ parent: plane+ });+ createPart('PlaneEngineCowl', cylinderXGeo(0.6, 0.6, 0.9, 16), mats.darkSteel, {+ position: [3.7, 0.6, 0],+ parent: plane+ });+ createPart('PlanePropeller', boxGeo(0.1, 1.8, 0.22), mats.blackMetal, {+ position: [4.2, 0.6, 0],+ parent: plane+ });+ createPart('PlaneCanopy', boxGeo(2.6, 0.6, 0.8), mats.glass, {+ position: [0.8, 1.35, 0],+ parent: plane+ });+ createPart('PlaneWings', boxGeo(1.6, 0.16, 10.5), mats.navyBlue, {+ position: [0.8, 0.65, 0],+ parent: plane+ });+ createPart('PlaneTailFin', boxGeo(1.1, 1.2, 0.12), mats.navyBlue, {+ position: [-3.0, 1.3, 0],+ parent: plane+ });+ createPart('PlaneTailPlane', boxGeo(0.9, 0.12, 3.2), mats.navyBlue, {+ position: [-3.0, 0.8, 0],+ parent: plane+ });+ createPart('MainFloat', boxGeo(6.2, 0.7, 1.0), mats.steelSuper, {+ position: [0.4, -0.65, 0],+ parent: plane+ });+ createPart('FloatStrutFwd', boxGeo(0.12, 0.8, 0.12), mats.darkSteel, {+ position: [1.8, -0.15, 0],+ parent: plane+ });+ createPart('FloatStrutAft', boxGeo(0.12, 0.8, 0.12), mats.darkSteel, {+ position: [-1.2, -0.15, 0],+ parent: plane+ });+ createPart('WingtipFloatL', boxGeo(1.2, 0.3, 0.35), mats.steelSuper, {+ position: [0.8, -0.2, -4.8],+ parent: plane+ });+ createPart('WingtipFloatR', boxGeo(1.2, 0.3, 0.35), mats.steelSuper, {+ position: [0.8, -0.2, 4.8],+ parent: plane+ });++ const sternCrane = createPivot('SternCrane', [-69.5, 8.0, 0], root);+ createPart('SternCraneBase', cylinderGeo(0.5, 0.65, 3.2, 12), mats.steelSuper, {+ position: [0, 1.6, 0],+ parent: sternCrane+ });+ createPart('SternCraneBoom', boxGeo(8.5, 0.35, 0.4), mats.steelSuper, {+ position: [2.5, 3.1, 0],+ rotation: [0, 0, -25],+ parent: sternCrane+ });++ const ensignStaff = createPivot('EnsignStaff', [-71.5, 8.0, 0], root);+ createPart('StaffPole', cylinderGeo(0.05, 0.09, 5.2, 8), mats.steelSuper, {+ position: [0, 2.6, 0],+ parent: ensignStaff+ });+ createPart('EnsignFlag', boxGeo(2.4, 1.4, 0.04), mats.ensignRed, {+ position: [-1.25, 4.2, 0.05],+ rotation: [0, 10, 0],+ parent: ensignStaff+ });++ const bollardX = [-48, -54, -60, -66];+ for (let b = 0; b < bollardX.length; b++) {+ const bx = bollardX[b];+ createPart(`BollardPort_${b}`, cylinderGeo(0.22, 0.22, 0.65, 8), mats.darkSteel, {+ position: [bx, 8.4, -9.5 + b * 1.5],+ parent: root+ });+ createPart(`BollardStbd_${b}`, cylinderGeo(0.22, 0.22, 0.65, 8), mats.darkSteel, {+ position: [bx, 8.4, 9.5 - b * 1.5],+ parent: root+ });+ }++ // Wooden Deck Companionways & Hatches+ createPart('FwdHatchCoaming', boxGeo(2.4, 0.45, 1.8), mats.woodMargin, {+ position: [67.0, 11.2, 0],+ parent: root+ });+ createPart('FwdHatchTop', boxGeo(2.2, 0.15, 1.6), mats.woodDeck, {+ position: [67.0, 11.45, 0],+ parent: root+ });+ createPart('FwdHatchBrass', boxGeo(0.2, 0.25, 1.2), mats.brass, {+ position: [67.0, 11.55, 0],+ parent: root+ });++ createPart('AftHatchCoaming', boxGeo(2.2, 0.4, 1.6), mats.woodMargin, {+ position: [-51.0, 8.35, 0],+ parent: root+ });+ createPart('AftHatchTop', boxGeo(2.0, 0.12, 1.4), mats.woodDeck, {+ position: [-51.0, 8.58, 0],+ parent: root+ });+ }++ // --- 15. Underwater Keel, Propellers & Rudders ---+ {+ createPart('BilgeKeelPort', boxGeo(48, 0.2, 1.1), mats.steelArmor, {+ position: [-2.0, 1.4, -11.6],+ rotation: [0, 0, 0],+ parent: root+ });+ createPart('BilgeKeelStbd', boxGeo(48, 0.2, 1.1), mats.steelArmor, {+ position: [-2.0, 1.4, 11.6],+ rotation: [0, 0, 0],+ parent: root+ });++ const shaftPositions = [+ { name: 'ShaftInPort', x: -54, y: 2.2, z: -2.8, rotZ: 3.5 },+ { name: 'ShaftInStbd', x: -54, y: 2.2, z: 2.8, rotZ: 3.5 },+ { name: 'ShaftOutPort', x: -51, y: 2.6, z: -5.6, rotZ: 5 },+ { name: 'ShaftOutStbd', x: -51, y: 2.6, z: 5.6, rotZ: 5 },+ ];++ for (let s = 0; s < shaftPositions.length; s++) {+ const { name, x, y, z, rotZ } = shaftPositions[s];+ createPart(name, cylinderXGeo(0.25, 0.25, 14.0, 12), mats.darkSteel, {+ position: [x, y, z],+ rotation: [0, 0, rotZ],+ parent: root+ });+ const screwX = x - 7.0;+ createPart(`${name}_Hub`, cylinderXGeo(0.55, 0.55, 1.2, 16), mats.bronzeProp, {+ position: [screwX, y - 0.35, z],+ parent: root+ });+ for (let blade = 0; blade < 3; blade++) {+ const bladePivot = createPivot(`${name}_Blade_${blade}`, [screwX, y - 0.35, z], root);+ bladePivot.rotation.x = (blade * 120 * Math.PI) / 180;+ createPart(`${name}_Blade_${blade}_Mesh`, boxGeo(0.12, 1.3, 0.42), mats.bronzeProp, {+ position: [0, 0.65, 0],+ rotation: [25, 0, 0],+ parent: bladePivot+ });+ }+ }++ createPart('RudderPort', boxGeo(4.2, 2.8, 0.35), mats.steelArmor, {+ position: [-65.0, 2.4, -2.6],+ parent: root+ });+ createPart('RudderStbd', boxGeo(4.2, 2.8, 0.35), mats.steelArmor, {+ position: [-65.0, 2.4, 2.6],+ parent: root+ });+ }++ return root;+}diff --git a/examples/demo-battleship.provenance.json b/examples/demo-battleship.provenance.jsonnew file mode 100644index 00000000..ea3bcef9--- /dev/null+++ b/examples/demo-battleship.provenance.json@@ -0,0 +1,33 @@+{+ "sourceHash": "6e1c9d1a85198c5e0f445e02caf4d46c01397c1ae61a66b8c72adcd64ead51c9",+ "model": "Gemini 3.8 Flash",+ "harness": "Antigravity CLI",+ "authoredDate": "2026-09-09",+ "provenance": {+ "attribution": "Recorded demo session; model credit supplied only where the retained run identifies it.",+ "sourceAccess": "See retained demo run; no stronger isolation claim is made.",+ "humanIntervention": "Owner supplied direction; model-authored exported source preserved byte-for-byte.",+ "reviewFidelity": "Authoring feedback and shaded demo previews where available. Not a destination-runtime acceptance claim.",+ "poster": "Fresh shaded render of the exact gallery-built downloadable GLB. Camera-only offline capture; no geometry or material edits.",+ "evaluationGlbHash": "38e8c865c06b4966fed90348b1da7ac59b2808b5427b7a39b0ba28d7faf94042",+ "posterReceipt": {+ "sourceHash": "6e1c9d1a85198c5e0f445e02caf4d46c01397c1ae61a66b8c72adcd64ead51c9",+ "artifactHash": "8c534037a89f2b976d3341dfcab529148c3c7b0ca843e92dc72a72409e47ade0",+ "imageHash": "b464b23bca50f37f1a550003ed95b45fe110b23d9547baa4103af45452dc2622",+ "width": 1600,+ "height": 1000,+ "renderer": "ANGLE (NVIDIA, NVIDIA GeForce RTX 3070 (0x00002484) Direct3D11 vs_5_0 ps_5_0, D3D11)",+ "captureMethod": "Kiln studio stage, owned headless Chrome, original GLB materials",+ "cameraRecord": {+ "index": 10,+ "kind": "hero",+ "theta": 0.6747409422235529,+ "phi": 1.185083808592412,+ "radius": 282.8421915775821,+ "fixedSeconds": null,+ "wallTimeMs": 122.59999999962747+ },+ "geometryChanged": false+ }+ }+}diff --git a/examples/demo-brass-orrery.kiln.js b/examples/demo-brass-orrery.kiln.jsnew file mode 100644index 00000000..3002d99c--- /dev/null+++ b/examples/demo-brass-orrery.kiln.js@@ -0,0 +1,768 @@+const meta = {+ name: 'Intricate Brass Orrery',+ category: 'prop',+ role: 'prop'+};++function build() {+ const root = createRoot('Orrery');++ // --- Materials ---+ // Rich Dark Walnut Wood (deep polished espresso walnut)+ const walnutMat = gameMaterial(0x28160b, { roughness: 0.60, metalness: 0.04 });++ // Polished antique brasses & metals+ const brightBrass = gameMaterial(0xd8b248, { metalness: 0.90, roughness: 0.20 });+ const antiqueBrass = gameMaterial(0xb89238, { metalness: 0.85, roughness: 0.32 });+ const deepBronze = gameMaterial(0x8c6b28, { metalness: 0.82, roughness: 0.38 });+ const steelMat = gameMaterial(0x8e98a0, { metalness: 0.92, roughness: 0.28 });++ // Celestial sphere materials+ const sunMat = gameMaterial(0xffcc33, {+ metalness: 0.85,+ roughness: 0.15,+ emissive: 0xffaa00,+ emissiveIntensity: 0.35+ });+ const mercuryMat = gameMaterial(0x7a7470, { metalness: 0.65, roughness: 0.35 });+ const venusMat = gameMaterial(0xe8d8b0, { metalness: 0.45, roughness: 0.25 });+ const earthMat = gameMaterial(0x1d559c, { metalness: 0.30, roughness: 0.35 });+ const moonMat = gameMaterial(0xdddddd, { metalness: 0.25, roughness: 0.45 });+ const marsMat = gameMaterial(0xb84224, { metalness: 0.45, roughness: 0.40 });+ const jupiterMat = gameMaterial(0xcc9652, { metalness: 0.35, roughness: 0.35 });+ const saturnMat = gameMaterial(0xd8be82, { metalness: 0.40, roughness: 0.30 });+ const saturnRingMat = gameMaterial(0xc8a44e, { metalness: 0.85, roughness: 0.25 });++ // ==========================================+ // 1. WALNUT BASE & INLAID HORIZON DIAL+ // ==========================================+ // Four turned bun feet with brass leveling pads+ const footAngles = [Math.PI * 0.25, Math.PI * 0.75, Math.PI * 1.25, Math.PI * 1.75];+ for (let i = 0; i < 4; i++) {+ const angle = footAngles[i];+ const fx = Math.cos(angle) * 0.20;+ const fz = Math.sin(angle) * 0.20;+ // Brass levelling disc+ createPart('FootBrassPad' + i, cylinderGeo(0.024, 0.024, 0.004, 16), antiqueBrass, {+ position: [fx, 0.002, fz],+ parent: root+ });+ // Walnut turned bun foot+ createPart('FootWalnut' + i, cylinderGeo(0.018, 0.024, 0.018, 16), walnutMat, {+ position: [fx, 0.013, fz],+ parent: root+ });+ // Brass collar trim ring+ createPart('FootCollar' + i, torusGeo(0.018, 0.002, 8, 16), brightBrass, {+ position: [fx, 0.022, fz],+ rotation: [90, 0, 0],+ parent: root+ });+ }++ // Stepped Walnut Plinth (lathed stepped profile)+ const plinthProfile = [+ [0, 0.015],+ [0.235, 0.015],+ [0.235, 0.030],+ [0.228, 0.040],+ [0.228, 0.065],+ [0.220, 0.076],+ [0.215, 0.088],+ [0, 0.088]+ ];+ const plinthGeo = lathe(plinthProfile, 48);+ createPart('WalnutPlinth', plinthGeo, walnutMat, { parent: root });++ // Lower brass moulding trim ring around plinth+ createPart('PlinthBrassTrim', torusGeo(0.235, 0.0026, 8, 48), antiqueBrass, {+ position: [0, 0.018, 0],+ rotation: [90, 0, 0],+ parent: root+ });++ // Inlaid Brass Calendar & Zodiac Horizon Ring (Y = 0.089)+ createPart('ZodiacRingPlate', cylinderGeo(0.212, 0.212, 0.002, 48), antiqueBrass, {+ position: [0, 0.089, 0],+ parent: root+ });+ createPart('ZodiacOuterBezel', torusGeo(0.212, 0.0025, 8, 48), brightBrass, {+ position: [0, 0.090, 0],+ rotation: [90, 0, 0],+ parent: root+ });+ createPart('ZodiacInnerBezel', torusGeo(0.160, 0.0025, 8, 48), brightBrass, {+ position: [0, 0.090, 0],+ rotation: [90, 0, 0],+ parent: root+ });++ // Engraved radial graduation ticks on the horizon ring+ for (let i = 0; i < 24; i++) {+ const rad = (i / 24) * Math.PI * 2;+ const isMajor = i % 2 === 0;+ const rStart = isMajor ? 0.165 : 0.175;+ const rEnd = 0.207;+ const x0 = Math.cos(rad) * rStart;+ const z0 = Math.sin(rad) * rStart;+ const x1 = Math.cos(rad) * rEnd;+ const z1 = Math.sin(rad) * rEnd;+ beamBetween('Tick' + i, [x0, 0.091, z0], [x1, 0.091, z1], isMajor ? 0.0012 : 0.0008, brightBrass, { parent: root });+ }++ // Maker's Brass Cartouche on front face of plinth (+X)+ createPart('MakersPlate', boxGeo(0.003, 0.022, 0.065), brightBrass, {+ position: [0.229, 0.052, 0],+ parent: root+ });+ // Etched inscription center on plaque+ createPart('MakersPlateInlay', boxGeo(0.0035, 0.014, 0.050), deepBronze, {+ position: [0.230, 0.052, 0],+ parent: root+ });+ // 12 Zodiac / calendar boss studs around horizon ring+ for (let z = 0; z < 12; z++) {+ const zrad = (z / 12) * Math.PI * 2;+ createPart('ZodiacStud' + z, sphereGeo(0.0022, 8, 6), brightBrass, {+ position: [Math.cos(zrad) * 0.186, 0.091, Math.sin(zrad) * 0.186],+ parent: root+ });+ }+ // 4 corner mounting rivets on plate+ const rivetOffsets = [+ [0.008, 0.026],+ [-0.008, 0.026],+ [0.008, -0.026],+ [-0.008, -0.026]+ ];+ for (let r = 0; r < 4; r++) {+ createPart('PlateRivet' + r, sphereGeo(0.0015, 6, 6), steelMat, {+ position: [0.231, 0.052 + rivetOffsets[r][0], rivetOffsets[r][1]],+ parent: root+ });+ }++ // ==========================================+ // 2. CENTRAL PEDESTAL & GEARBOX HOUSING+ // ==========================================+ // Central turned brass pedestal base+ createPart('PedestalBaseDisc', cylinderGeo(0.082, 0.092, 0.010, 32), antiqueBrass, {+ position: [0, 0.095, 0],+ parent: root+ });+ createPart('PedestalBead', torusGeo(0.075, 0.006, 10, 32), brightBrass, {+ position: [0, 0.103, 0],+ rotation: [90, 0, 0],+ parent: root+ });+ createPart('PedestalSpool', cylinderGeo(0.050, 0.072, 0.016, 32), antiqueBrass, {+ position: [0, 0.114, 0],+ parent: root+ });+ createPart('PedestalFlange', cylinderGeo(0.060, 0.050, 0.010, 32), brightBrass, {+ position: [0, 0.126, 0],+ parent: root+ });++ // Gearbox lower and upper circular plates+ createPart('LowerGearPlate', cylinderGeo(0.092, 0.092, 0.003, 36), brightBrass, {+ position: [0, 0.133, 0],+ parent: root+ });+ createPart('LowerPlateRim', torusGeo(0.092, 0.0025, 8, 36), antiqueBrass, {+ position: [0, 0.133, 0],+ rotation: [90, 0, 0],+ parent: root+ });++ // Pierced open upper gear plate (outer ring, hub & 4 viewing quadrants)+ createPart('UpperPlateRim', torusGeo(0.092, 0.003, 8, 36), brightBrass, {+ position: [0, 0.215, 0],+ rotation: [90, 0, 0],+ parent: root+ });+ createPart('UpperPlateHub', cylinderGeo(0.026, 0.026, 0.003, 24), brightBrass, {+ position: [0, 0.215, 0],+ parent: root+ });+ // 4 Cross-arms connecting hub to rim+ for (let a = 0; a < 4; a++) {+ const armAng = (a / 4) * Math.PI * 2;+ const ax = Math.cos(armAng) * 0.058;+ const az = Math.sin(armAng) * 0.058;+ createPart('UpperPlateSpoke' + a, boxGeo(0.064, 0.003, 0.008), antiqueBrass, {+ position: [ax, 0.215, az],+ rotation: [0, -armAng * (180 / Math.PI), 0],+ parent: root+ });+ }++ // 4 Turned Brass Baluster Pillars connecting lower and upper plates+ const pillarAngles = [Math.PI * 0.25, Math.PI * 0.75, Math.PI * 1.25, Math.PI * 1.75];+ for (let p = 0; p < 4; p++) {+ const ang = pillarAngles[p];+ const px = Math.cos(ang) * 0.078;+ const pz = Math.sin(ang) * 0.078;+ // Lower foot+ createPart('PillarFoot' + p, cylinderGeo(0.006, 0.007, 0.008, 12), antiqueBrass, {+ position: [px, 0.138, pz],+ parent: root+ });+ // Baluster mid section+ createPart('PillarBody' + p, cylinderGeo(0.004, 0.0065, 0.060, 12), brightBrass, {+ position: [px, 0.174, pz],+ parent: root+ });+ // Turned ring bead+ createPart('PillarRing' + p, torusGeo(0.006, 0.002, 8, 12), brightBrass, {+ position: [px, 0.174, pz],+ rotation: [90, 0, 0],+ parent: root+ });+ // Upper head+ createPart('PillarHead' + p, cylinderGeo(0.007, 0.006, 0.008, 12), antiqueBrass, {+ position: [px, 0.210, pz],+ parent: root+ });+ // Acorn nut finial on top of upper plate+ createPart('PillarAcorn' + p, coneGeo(0.004, 0.008, 12), brightBrass, {+ position: [px, 0.220, pz],+ parent: root+ });+ }++ // Central Vertical Fixed Spindle (Sun shaft)+ createPart('CentralSpindle', cylinderGeo(0.006, 0.006, 0.250, 16), steelMat, {+ position: [0, 0.255, 0],+ parent: root+ });++ // ==========================================+ // 3. HAND CRANK & DRIVE ARBOR (Animated)+ // ==========================================+ // Bearing block on front of lower plate+ createPart('CrankBearingBlock', boxGeo(0.015, 0.016, 0.018), antiqueBrass, {+ position: [0.088, 0.142, 0],+ parent: root+ });++ // Animated Crank Pivot+ const jointCrank = createPivot('Crank', [0.060, 0.142, 0], root);+ // Horizontal drive shaft (along X)+ createPart('CrankShaft', cylinderGeo(0.0035, 0.0035, 0.090, 12), steelMat, {+ position: [0.045, 0, 0],+ rotation: [0, 0, 90],+ parent: jointCrank+ });+ // Bevel gear on crank shaft meshing with idler pinion+ createPart('CrankBevelGear', gearGeo({+ teeth: 14,+ rootRadius: 0.012,+ tipRadius: 0.016,+ boreRadius: 0.0035,+ height: 0.006+ }), antiqueBrass, {+ position: [0.005, 0, 0],+ rotation: [0, 0, 90],+ parent: jointCrank+ });+ // Brass crank boss & curved crank arm at outer end (X = 0.090 relative to joint)+ createPart('CrankBoss', cylinderGeo(0.007, 0.007, 0.008, 12), brightBrass, {+ position: [0.090, 0, 0],+ rotation: [0, 0, 90],+ parent: jointCrank+ });+ const crankArmGeo = pipeAlongPath([+ [0.090, 0, 0],+ [0.093, 0, 0],+ [0.093, 0.036, 0],+ [0.098, 0.038, 0]+ ], 0.0028, { bendRadius: 0.008 });+ createPart('CrankArmBar', crankArmGeo, brightBrass, { parent: jointCrank });+ // Turned dark walnut crank handle knob+ createPart('CrankHandle', cylinderGeo(0.006, 0.008, 0.032, 12), walnutMat, {+ position: [0.114, 0.038, 0],+ rotation: [0, 0, 90],+ parent: jointCrank+ });+ createPart('CrankHandleCap', sphereGeo(0.004, 8, 8), brightBrass, {+ position: [0.131, 0.038, 0],+ parent: jointCrank+ });++ // ==========================================+ // 4. IDLER ARBORS & COUNTER-GEARS (Animated)+ // ==========================================+ // Primary Idler Shaft (Offset at [0.052, 0, 0.030])+ const jointIdler1 = createPivot('IdlerArbor1', [0.052, 0, 0.030], root);+ // Steel shaft+ createPart('Idler1Shaft', cylinderGeo(0.003, 0.003, 0.080, 12), steelMat, {+ position: [0, 0.174, 0],+ parent: jointIdler1+ });+ // Stacked counter-pinions on Idler 1+ const idlerPinionData = [+ { y: 0.142, teeth: 18, root: 0.024, tip: 0.029 },+ { y: 0.154, teeth: 16, root: 0.020, tip: 0.025 },+ { y: 0.166, teeth: 14, root: 0.017, tip: 0.022 },+ { y: 0.178, teeth: 12, root: 0.014, tip: 0.019 },+ { y: 0.190, teeth: 10, root: 0.011, tip: 0.016 },+ { y: 0.202, teeth: 8, root: 0.008, tip: 0.013 }+ ];+ for (let k = 0; k < idlerPinionData.length; k++) {+ const p = idlerPinionData[k];+ const g = gearGeo({+ teeth: p.teeth,+ rootRadius: p.root,+ tipRadius: p.tip,+ boreRadius: 0.003,+ height: 0.005+ });+ createPart('IdlerPinion' + k, g, deepBronze, {+ position: [0, p.y, 0],+ parent: jointIdler1+ });+ }++ // Secondary Idler / Flywheel Shaft (Offset at [-0.048, 0, -0.032])+ const jointIdler2 = createPivot('IdlerArbor2', [-0.048, 0, -0.032], root);+ createPart('Idler2Shaft', cylinderGeo(0.003, 0.003, 0.080, 12), steelMat, {+ position: [0, 0.174, 0],+ parent: jointIdler2+ });+ // Transfer spur gear+ createPart('TransferGear', gearGeo({+ teeth: 26,+ rootRadius: 0.032,+ tipRadius: 0.038,+ boreRadius: 0.003,+ height: 0.005+ }), antiqueBrass, {+ position: [0, 0.150, 0],+ parent: jointIdler2+ });+ // Four-spoked brass flywheel with rim weights+ createPart('FlywheelRim', torusGeo(0.038, 0.0028, 8, 24), brightBrass, {+ position: [0, 0.188, 0],+ rotation: [90, 0, 0],+ parent: jointIdler2+ });+ createPart('FlywheelHub', cylinderGeo(0.007, 0.007, 0.007, 12), brightBrass, {+ position: [0, 0.188, 0],+ parent: jointIdler2+ });+ // 4 spokes and counterweights+ for (let s = 0; s < 4; s++) {+ const sang = (s / 4) * Math.PI * 2;+ const sx = Math.cos(sang) * 0.019;+ const sz = Math.sin(sang) * 0.019;+ createPart('Spoke' + s, cylinderGeo(0.0014, 0.0014, 0.036, 8), brightBrass, {+ position: [sx, 0.188, sz],+ rotation: [0, -sang * (180 / Math.PI), 90],+ parent: jointIdler2+ });+ const wx = Math.cos(sang) * 0.032;+ const wz = Math.sin(sang) * 0.032;+ createPart('Weight' + s, cylinderGeo(0.004, 0.004, 0.006, 10), antiqueBrass, {+ position: [wx, 0.188, wz],+ parent: jointIdler2+ });+ }++ // ==========================================+ // 5. SUN (Center Top)+ // ==========================================+ // Fluted capital supporting sun spindle+ createPart('SunCapital', cylinderGeo(0.016, 0.010, 0.018, 20), brightBrass, {+ position: [0, 0.370, 0],+ parent: root+ });+ createPart('SunNeckBead', torusGeo(0.014, 0.0025, 8, 20), brightBrass, {+ position: [0, 0.380, 0],+ rotation: [90, 0, 0],+ parent: root+ });+ createPart('SunSupportPin', cylinderGeo(0.004, 0.004, 0.024, 12), antiqueBrass, {+ position: [0, 0.395, 0],+ parent: root+ });+ // The Golden Sun+ createPart('SunSphere', sphereGeo(0.034, 24, 16), sunMat, {+ position: [0, 0.420, 0],+ parent: root+ });+ // Decorative solar meridian ring halo & radiant sun rays+ createPart('SunHaloRing', torusGeo(0.046, 0.002, 8, 32), brightBrass, {+ position: [0, 0.420, 0],+ rotation: [25, 30, 0],+ parent: root+ });+ // 8 Radiant solar rays+ for (let sr = 0; sr < 8; sr++) {+ const srad = (sr / 8) * Math.PI * 2;+ const rx = Math.cos(srad) * 0.042;+ const ry = Math.sin(srad) * 0.042;+ createPart('SunRay' + sr, coneGeo(0.0022, 0.014, 8), brightBrass, {+ position: [rx, 0.420 + ry, 0],+ rotation: [0, 0, -srad * (180 / Math.PI) - 90],+ parent: root+ });+ }++ // ==========================================+ // 6. PLANETARY ARMS, GEARS & SPHERES+ // ==========================================++ // --- MERCURY ---+ const jointMercury = createPivot('Mercury', [0, 0, 0], root);+ // Mercury Drive Gear (inside clockwork cage)+ createPart('MercuryGear', gearGeo({+ teeth: 16,+ rootRadius: 0.023,+ tipRadius: 0.028,+ boreRadius: 0.007,+ height: 0.005+ }), antiqueBrass, {+ position: [0, 0.142, 0],+ parent: jointMercury+ });+ // Concentric sleeve collar above cage+ createPart('MercuryCollar', cylinderGeo(0.022, 0.022, 0.012, 20), brightBrass, {+ position: [0, 0.224, 0],+ parent: jointMercury+ });+ createPart('MercuryCollarBead', torusGeo(0.023, 0.002, 8, 20), antiqueBrass, {+ position: [0, 0.228, 0],+ rotation: [90, 0, 0],+ parent: jointMercury+ });+ // Swept brass support arm+ const mercuryArmGeo = pipeAlongPath([+ [0.022, 0.226, 0],+ [0.045, 0.228, 0],+ [0.082, 0.270, 0],+ [0.082, 0.370, 0]+ ], 0.0022, { bendRadius: 0.020 });+ createPart('MercuryArm', mercuryArmGeo, brightBrass, { parent: jointMercury });+ // Planet cup & sphere+ createPart('MercuryCup', cylinderGeo(0.005, 0.003, 0.006, 12), brightBrass, {+ position: [0.082, 0.372, 0],+ parent: jointMercury+ });+ createPart('MercurySphere', sphereGeo(0.007, 14, 10), mercuryMat, {+ position: [0.082, 0.380, 0],+ parent: jointMercury+ });++ // --- VENUS ---+ const jointVenus = createPivot('Venus', [0, 0, 0], root);+ // Venus Drive Gear+ createPart('VenusGear', gearGeo({+ teeth: 22,+ rootRadius: 0.032,+ tipRadius: 0.038,+ boreRadius: 0.008,+ height: 0.005+ }), antiqueBrass, {+ position: [0, 0.154, 0],+ parent: jointVenus+ });+ // Collar+ createPart('VenusCollar', cylinderGeo(0.020, 0.020, 0.012, 20), brightBrass, {+ position: [0, 0.242, 0],+ parent: jointVenus+ });+ createPart('VenusCollarBead', torusGeo(0.021, 0.002, 8, 20), antiqueBrass, {+ position: [0, 0.246, 0],+ rotation: [90, 0, 0],+ parent: jointVenus+ });+ // Swept brass arm+ const venusArmGeo = pipeAlongPath([+ [0.020, 0.244, 0],+ [0.065, 0.246, 0],+ [0.135, 0.290, 0],+ [0.135, 0.370, 0]+ ], 0.0025, { bendRadius: 0.025 });+ createPart('VenusArm', venusArmGeo, brightBrass, { parent: jointVenus });+ // Cup & sphere+ createPart('VenusCup', cylinderGeo(0.006, 0.004, 0.007, 12), brightBrass, {+ position: [0.135, 0.372, 0],+ parent: jointVenus+ });+ createPart('VenusSphere', sphereGeo(0.011, 16, 12), venusMat, {+ position: [0.135, 0.385, 0],+ parent: jointVenus+ });++ // --- EARTH & MOON ---+ const jointEarth = createPivot('Earth', [0, 0, 0], root);+ // Earth Drive Gear+ createPart('EarthGear', gearGeo({+ teeth: 30,+ rootRadius: 0.042,+ tipRadius: 0.048,+ boreRadius: 0.009,+ height: 0.005+ }), antiqueBrass, {+ position: [0, 0.166, 0],+ parent: jointEarth+ });+ // Collar+ createPart('EarthCollar', cylinderGeo(0.018, 0.018, 0.012, 20), brightBrass, {+ position: [0, 0.260, 0],+ parent: jointEarth+ });+ createPart('EarthCollarBead', torusGeo(0.019, 0.002, 8, 20), antiqueBrass, {+ position: [0, 0.264, 0],+ rotation: [90, 0, 0],+ parent: jointEarth+ });+ // Swept brass arm+ const earthArmGeo = pipeAlongPath([+ [0.018, 0.262, 0],+ [0.080, 0.264, 0],+ [0.198, 0.300, 0],+ [0.198, 0.364, 0]+ ], 0.0028, { bendRadius: 0.030 });+ createPart('EarthArm', earthArmGeo, brightBrass, { parent: jointEarth });+ // Earth platform bracket+ createPart('EarthPlatform', cylinderGeo(0.010, 0.010, 0.004, 16), brightBrass, {+ position: [0.198, 0.366, 0],+ parent: jointEarth+ });+ // Tilted polar brass axis pin (23.5° axial tilt)+ createPart('EarthPolarAxis', cylinderGeo(0.0016, 0.0016, 0.036, 8), steelMat, {+ position: [0.198, 0.384, 0],+ rotation: [0, 0, 23.5],+ parent: jointEarth+ });+ // Earth globe+ createPart('EarthSphere', sphereGeo(0.013, 18, 12), earthMat, {+ position: [0.198, 0.384, 0],+ parent: jointEarth+ });++ // Animated Moon Sub-mechanism+ const jointMoon = createPivot('Moon', [0.198, 0.384, 0], jointEarth);+ // Miniature Moon ring gear underneath Earth+ createPart('MoonDriveGear', gearGeo({+ teeth: 12,+ rootRadius: 0.006,+ tipRadius: 0.0085,+ boreRadius: 0.002,+ height: 0.002+ }), antiqueBrass, {+ position: [0, -0.012, 0],+ parent: jointMoon+ });+ // Curved brass wire arm for the Moon+ const moonWireGeo = pipeAlongPath([+ [0, -0.012, 0],+ [0.018, -0.010, 0],+ [0.028, 0, 0]+ ], 0.0012, { bendRadius: 0.006 });+ createPart('MoonArmWire', moonWireGeo, brightBrass, { parent: jointMoon });+ // Pearl Moon+ createPart('MoonSphere', sphereGeo(0.0042, 10, 8), moonMat, {+ position: [0.028, 0, 0],+ parent: jointMoon+ });++ // --- MARS ---+ const jointMars = createPivot('Mars', [0, 0, 0], root);+ // Mars Drive Gear+ createPart('MarsGear', gearGeo({+ teeth: 38,+ rootRadius: 0.050,+ tipRadius: 0.057,+ boreRadius: 0.010,+ height: 0.005+ }), antiqueBrass, {+ position: [0, 0.178, 0],+ parent: jointMars+ });+ // Collar+ createPart('MarsCollar', cylinderGeo(0.016, 0.016, 0.012, 20), brightBrass, {+ position: [0, 0.278, 0],+ parent: jointMars+ });+ createPart('MarsCollarBead', torusGeo(0.017, 0.002, 8, 20), antiqueBrass, {+ position: [0, 0.282, 0],+ rotation: [90, 0, 0],+ parent: jointMars+ });+ // Swept brass arm+ const marsArmGeo = pipeAlongPath([+ [0.016, 0.280, 0],+ [0.095, 0.282, 0],+ [0.262, 0.310, 0],+ [0.262, 0.368, 0]+ ], 0.0030, { bendRadius: 0.035 });+ createPart('MarsArm', marsArmGeo, brightBrass, { parent: jointMars });+ // Cup & sphere+ createPart('MarsCup', cylinderGeo(0.005, 0.0035, 0.006, 12), brightBrass, {+ position: [0.262, 0.370, 0],+ parent: jointMars+ });+ createPart('MarsSphere', sphereGeo(0.009, 16, 12), marsMat, {+ position: [0.262, 0.381, 0],+ parent: jointMars+ });++ // --- JUPITER ---+ const jointJupiter = createPivot('Jupiter', [0, 0, 0], root);+ // Jupiter Drive Gear+ createPart('JupiterGear', gearGeo({+ teeth: 46,+ rootRadius: 0.058,+ tipRadius: 0.065,+ boreRadius: 0.011,+ height: 0.005+ }), antiqueBrass, {+ position: [0, 0.190, 0],+ parent: jointJupiter+ });+ // Collar+ createPart('JupiterCollar', cylinderGeo(0.014, 0.014, 0.012, 20), brightBrass, {+ position: [0, 0.296, 0],+ parent: jointJupiter+ });+ createPart('JupiterCollarBead', torusGeo(0.015, 0.002, 8, 20), antiqueBrass, {+ position: [0, 0.300, 0],+ rotation: [90, 0, 0],+ parent: jointJupiter+ });+ // Swept brass arm+ const jupiterArmGeo = pipeAlongPath([+ [0.014, 0.298, 0],+ [0.115, 0.300, 0],+ [0.332, 0.320, 0],+ [0.332, 0.362, 0]+ ], 0.0034, { bendRadius: 0.040 });+ createPart('JupiterArm', jupiterArmGeo, brightBrass, { parent: jointJupiter });+ // Cup & large sphere+ createPart('JupiterCup', cylinderGeo(0.009, 0.006, 0.008, 16), brightBrass, {+ position: [0.332, 0.365, 0],+ parent: jointJupiter+ });+ createPart('JupiterSphere', sphereGeo(0.022, 22, 16), jupiterMat, {+ position: [0.332, 0.392, 0],+ parent: jointJupiter+ });+ // Galilean moons bracket & 4 moon pins+ createPart('JupiterMoonBar', cylinderGeo(0.001, 0.001, 0.076, 8), brightBrass, {+ position: [0.332, 0.392, 0],+ rotation: [90, 0, 0],+ parent: jointJupiter+ });+ const moonOffsets = [-0.035, -0.024, 0.024, 0.035];+ for (let m = 0; m < 4; m++) {+ createPart('GalileanMoon' + m, sphereGeo(0.0022, 8, 6), brightBrass, {+ position: [0.332, 0.392, moonOffsets[m]],+ parent: jointJupiter+ });+ }++ // --- SATURN ---+ const jointSaturn = createPivot('Saturn', [0, 0, 0], root);+ // Saturn Drive Gear+ createPart('SaturnGear', gearGeo({+ teeth: 54,+ rootRadius: 0.066,+ tipRadius: 0.073,+ boreRadius: 0.012,+ height: 0.005+ }), antiqueBrass, {+ position: [0, 0.202, 0],+ parent: jointSaturn+ });+ // Collar+ createPart('SaturnCollar', cylinderGeo(0.012, 0.012, 0.012, 20), brightBrass, {+ position: [0, 0.314, 0],+ parent: jointSaturn+ });+ createPart('SaturnCollarBead', torusGeo(0.013, 0.002, 8, 20), antiqueBrass, {+ position: [0, 0.318, 0],+ rotation: [90, 0, 0],+ parent: jointSaturn+ });+ // Swept brass arm+ const saturnArmGeo = pipeAlongPath([+ [0.012, 0.316, 0],+ [0.130, 0.318, 0],+ [0.412, 0.330, 0],+ [0.412, 0.362, 0]+ ], 0.0036, { bendRadius: 0.045 });+ createPart('SaturnArm', saturnArmGeo, brightBrass, { parent: jointSaturn });+ // Cup, sphere & ring+ createPart('SaturnCup', cylinderGeo(0.008, 0.005, 0.008, 16), brightBrass, {+ position: [0.412, 0.365, 0],+ parent: jointSaturn+ });+ createPart('SaturnSphere', sphereGeo(0.018, 20, 14), saturnMat, {+ position: [0.412, 0.390, 0],+ parent: jointSaturn+ });+ // Concentric tilted brass rings+ createPart('SaturnRingMain', torusGeo(0.030, 0.0020, 8, 36), saturnRingMat, {+ position: [0.412, 0.390, 0],+ rotation: [22, 0, 15],+ parent: jointSaturn+ });+ createPart('SaturnRingOuter', torusGeo(0.036, 0.0010, 8, 36), saturnRingMat, {+ position: [0.412, 0.390, 0],+ rotation: [22, 0, 15],+ parent: jointSaturn+ });+ // Celestial initial epoch (planets distributed aesthetically around the Sun)+ jointMercury.rotation.y = (45 * Math.PI) / 180;+ jointVenus.rotation.y = (130 * Math.PI) / 180;+ jointEarth.rotation.y = (220 * Math.PI) / 180;+ jointMars.rotation.y = (315 * Math.PI) / 180;+ jointJupiter.rotation.y = (80 * Math.PI) / 180;+ jointSaturn.rotation.y = (170 * Math.PI) / 180;++ return root;+}++// ==========================================+// 7. ANIMATION+// ==========================================+function makeSpinTrack(jointName, totalDuration, turns, axis = 'y', initialDeg = 0) {+ const stepsPerTurn = 4;+ const totalSteps = Math.max(4, Math.round(Math.abs(turns) * stepsPerTurn));+ const keyframes = [];+ for (let i = 0; i <= totalSteps; i++) {+ const fraction = i / totalSteps;+ const time = fraction * totalDuration;+ const deg = initialDeg + fraction * turns * 360;+ const rot = axis === 'y' ? [0, deg, 0] : axis === 'x' ? [deg, 0, 0] : [0, 0, deg];+ keyframes.push({ time, rotation: rot });+ }+ return rotationTrack(jointName, keyframes);+}++function animate(root) {+ const T = 24; // 24-second seamlessly looping clockwork cycle++ const tracks = [+ // Hand crank turns 24 times around X axis (1 turn/sec)+ makeSpinTrack('Joint_Crank', T, 24, 'x'),++ // Counter-gear idler arbors turn in sync with clockwork+ makeSpinTrack('Joint_IdlerArbor1', T, -12, 'y'),+ makeSpinTrack('Joint_IdlerArbor2', T, 24, 'y'),++ // Planetary orbits: harmonious integer/rational cycle counts with initial angles+ makeSpinTrack('Joint_Mercury', T, 8, 'y', 45), // Mercury completes 8 orbits+ makeSpinTrack('Joint_Venus', T, 4, 'y', 130), // Venus completes 4 orbits+ makeSpinTrack('Joint_Earth', T, 2, 'y', 220), // Earth completes 2 orbits+ makeSpinTrack('Joint_Moon', T, 24, 'y', 0), // Moon completes 24 orbits around Earth (12 per year)+ makeSpinTrack('Joint_Mars', T, 1, 'y', 315), // Mars completes 1 orbit+ makeSpinTrack('Joint_Jupiter', T, 0.5, 'y', 80), // Jupiter completes 0.5 orbit+ makeSpinTrack('Joint_Saturn', T, 0.25, 'y', 170) // Saturn completes 0.25 orbit+ ];++ return [createClip('OrreryMotion', T, tracks)];+}diff --git a/examples/demo-brass-orrery.provenance.json b/examples/demo-brass-orrery.provenance.jsonnew file mode 100644index 00000000..50f691c9--- /dev/null+++ b/examples/demo-brass-orrery.provenance.json@@ -0,0 +1,33 @@+{+ "sourceHash": "23d56283da476ff69c39397722ba17a78e4fc247bf4d60e384f5a4e2173ca79b",+ "model": "Gemini 3.8 Flash",+ "harness": "Antigravity CLI",+ "authoredDate": "2026-09-09",+ "provenance": {+ "attribution": "Recorded demo session; model credit supplied only where the retained run identifies it.",+ "sourceAccess": "See retained demo run; no stronger isolation claim is made.",+ "humanIntervention": "Owner supplied direction; model-authored exported source preserved byte-for-byte.",+ "reviewFidelity": "Authoring feedback and shaded demo previews where available. Not a destination-runtime acceptance claim.",+ "poster": "Fresh shaded render of the exact gallery-built downloadable GLB. Camera-only offline capture; no geometry or material edits.",+ "evaluationGlbHash": "2c3d19a0a1f3842184828a28207106306984391cf836786eae41065808caf3d2",+ "posterReceipt": {+ "sourceHash": "23d56283da476ff69c39397722ba17a78e4fc247bf4d60e384f5a4e2173ca79b",+ "artifactHash": "e16e1e065254ec4ef2292e54fbf5efd1d07e115bb7ae0cd77cceee5a3076566d",+ "imageHash": "02ab84736ab7d05c6388cf03910eacf5c19170c5661e4dba77fb6823a94b5d2e",+ "width": 1600,+ "height": 1000,+ "renderer": "ANGLE (NVIDIA, NVIDIA GeForce RTX 3070 (0x00002484) Direct3D11 vs_5_0 ps_5_0, D3D11)",+ "captureMethod": "Kiln studio stage, owned headless Chrome, original GLB materials",+ "cameraRecord": {+ "index": 10,+ "kind": "hero",+ "theta": 0.6747409422235526,+ "phi": 1.185083808592412,+ "radius": 1.7816177552160268,+ "fixedSeconds": null,+ "wallTimeMs": 124.5+ },+ "geometryChanged": false+ }+ }+}diff --git a/examples/demo-clockwork-dragonfly.kiln.js b/examples/demo-clockwork-dragonfly.kiln.jsnew file mode 100644index 00000000..5eef31b6--- /dev/null+++ b/examples/demo-clockwork-dragonfly.kiln.js@@ -0,0 +1,172 @@+const meta = { name: 'Mechanical Dragonfly', category: 'prop', role: 'prop' };++function build() {+ const root = createRoot('MechanicalDragonfly');++ // Materials+ const brass = gameMaterial(0xc9973f, { metalness: 0.9, roughness: 0.32 });+ const darkBrass = gameMaterial(0x7a5a28, { metalness: 0.85, roughness: 0.45 });+ const copper = gameMaterial(0xa66a3a, { metalness: 0.9, roughness: 0.35 });+ const darkSteel = gameMaterial(0x3a3f44, { metalness: 0.8, roughness: 0.5 });+ const emeraldGlass = glassMaterial(0x1fd47a, { opacity: 0.5, roughness: 0.15 });+ const emeraldSolid = gameMaterial(0x0fae5f, { metalness: 0.3, roughness: 0.3, emissive: 0x0a5c34, emissiveIntensity: 0.6 });+ const eyeMat = gameMaterial(0x0fd67c, { metalness: 0.2, roughness: 0.2, emissive: 0x0bd86e, emissiveIntensity: 0.9 });++ const bodyY = 0.6;++ // Thorax — main brass barrel along X+ createPart('Thorax', capsuleGeo(0.14, 0.28, 8), brass, {+ position: [0.15, bodyY, 0], rotation: [0, 0, 90], parent: root+ });+ // Thorax top housing / wing motor case+ createPart('WingCase', boxGeo(0.34, 0.1, 0.2), darkBrass, {+ position: [0.12, bodyY + 0.12, 0], parent: root+ });+ // Thorax belly plate+ createPart('BellyPlate', boxGeo(0.3, 0.04, 0.12), copper, {+ position: [0.15, bodyY - 0.13, 0], parent: root+ });+ // Thorax front collar+ createPart('Collar', torusGeo(0.11, 0.025, 8, 20), copper, {+ position: [0.34, bodyY, 0], rotation: [0, 90, 0], parent: root+ });++ // Head+ createPart('Head', sphereGeo(0.105, 16, 12), darkBrass, {+ position: [0.5, bodyY + 0.02, 0], parent: root+ });+ createPart('EyeR', sphereGeo(0.058, 14, 10), eyeMat, {+ position: [0.55, bodyY + 0.07, 0.07], parent: root+ });+ createPart('EyeL', sphereGeo(0.058, 14, 10), eyeMat, {+ position: [0.55, bodyY + 0.07, -0.07], parent: root+ });+ // Mandibles / snout+ createPart('Snout', cylinderGeo(0.035, 0.055, 0.12, 10), brass, {+ position: [0.6, bodyY - 0.01, 0], rotation: [0, 0, -90], parent: root+ });+ // Antennae+ beamBetween('AntennaR', [0.57, bodyY + 0.09, 0.03], [0.78, bodyY + 0.22, 0.1], 0.008, darkSteel, { parent: root });+ beamBetween('AntennaL', [0.57, bodyY + 0.09, -0.03], [0.78, bodyY + 0.22, -0.1], 0.008, darkSteel, { parent: root });+ createPart('AntennaTipR', sphereGeo(0.015, 8, 6), emeraldSolid, { position: [0.78, bodyY + 0.22, 0.1], parent: root });+ createPart('AntennaTipL', sphereGeo(0.015, 8, 6), emeraldSolid, { position: [0.78, bodyY + 0.22, -0.1], parent: root });++ // Abdomen — 6 tapering segments along -X+ const segX = [-0.08, -0.22, -0.36, -0.49, -0.61, -0.72];+ const segR = [0.095, 0.085, 0.073, 0.06, 0.047, 0.035];+ for (let i = 0; i < segX.length; i++) {+ const x = segX[i];+ const r = segR[i];+ createPart('AbdomenSeg' + i, cylinderGeo(r * 0.92, r, 0.14, 14), i % 2 === 0 ? brass : copper, {+ position: [x, bodyY - 0.01 - i * 0.008, 0], rotation: [0, 0, 90], parent: root+ });+ // segment ring+ createPart('AbdomenRing' + i, torusGeo(r, 0.012, 6, 18), darkBrass, {+ position: [x + 0.06, bodyY - 0.01 - i * 0.008, 0], rotation: [0, 90, 0], parent: root+ });+ }+ // Tail tip stinger+ createPart('TailTip', coneGeo(0.032, 0.12, 12), darkSteel, {+ position: [-0.83, bodyY - 0.06, 0], rotation: [0, 0, 90], parent: root+ });+ createPart('TailJewel', sphereGeo(0.022, 10, 8), emeraldSolid, {+ position: [-0.74, bodyY + 0.005, 0], parent: root+ });++ // Exposed brass gears on both flanks+ function sideGears(side) {+ const z = 0.14 * side;+ const pivMain = createPivot('GearR_Main_' + (side > 0 ? 'R' : 'L'), [0.14, bodyY, z], root);+ createPart('GearMain_' + (side > 0 ? 'R' : 'L'),+ gearGeo({ teeth: 18, rootRadius: 0.085, tipRadius: 0.105, boreRadius: 0.02, height: 0.03 }),+ brass, { rotation: [90, 0, 0], parent: pivMain });+ createPart('GearHub_' + (side > 0 ? 'R' : 'L'), cylinderGeo(0.022, 0.022, 0.055, 10), darkSteel, {+ rotation: [90, 0, 0], parent: pivMain+ });++ const pivA = createPivot('GearR_Aft_' + (side > 0 ? 'R' : 'L'), [-0.03, bodyY + 0.02, z], root);+ createPart('GearAft_' + (side > 0 ? 'R' : 'L'),+ gearGeo({ teeth: 14, rootRadius: 0.058, tipRadius: 0.072, boreRadius: 0.014, height: 0.028 }),+ copper, { rotation: [90, 0, 0], parent: pivA });++ const pivS = createPivot('GearR_Small_' + (side > 0 ? 'R' : 'L'), [0.28, bodyY - 0.02, z * 0.95], root);+ createPart('GearSmall_' + (side > 0 ? 'R' : 'L'),+ gearGeo({ teeth: 10, rootRadius: 0.038, tipRadius: 0.05, boreRadius: 0.01, height: 0.026 }),+ brass, { rotation: [90, 0, 0], parent: pivS });+ return { pivMain, pivA, pivS };+ }+ sideGears(1);+ sideGears(-1);++ // Emerald wings — 4 panels+ function makeWing(name, px, pz, span, rootChord, tipChord, sweep, mirror) {+ const pivot = createPivot(name, [px, bodyY + 0.17, pz], root);+ const geo = wingGeo({ span: span, rootChord: rootChord, tipChord: tipChord, sweep: sweep, thickness: 0.008, dihedral: 0.04 });+ // mirror left wings across Z+ const rot = mirror ? [180, 0, 0] : [0, 0, 0];+ createPart(name + 'Panel', geo, emeraldGlass, { rotation: rot, parent: pivot });+ // brass leading-edge spar + 2 veins lying on the panel top surface+ const dir = mirror ? -1 : 1;+ const leadRootX = 0.0, leadTipX = -sweep;+ beamBetween(name + 'Spar', [leadRootX, 0.008, 0.01 * dir], [leadTipX, 0.012, (span - 0.01) * dir], 0.009, brass, { parent: pivot });+ beamBetween(name + 'VeinA', [-rootChord * 0.3, 0.007, 0.08 * dir], [leadTipX - 0.03, 0.01, span * 0.8 * dir], 0.0045, darkBrass, { parent: pivot });+ beamBetween(name + 'VeinB', [-rootChord * 0.55, 0.007, 0.06 * dir], [leadTipX - 0.05, 0.01, span * 0.62 * dir], 0.0045, darkBrass, { parent: pivot });+ // rounded emerald tip cap with brass rim (broad rounded tip)+ const tipR = tipChord / 2;+ const tipCX = -sweep;+ const tipCZ = (span - tipR * 0.3) * dir;+ createPart(name + 'TipCap', cylinderGeo(tipR, tipR, 0.007, 20), emeraldGlass, {+ position: [tipCX, 0.009, tipCZ], parent: pivot+ });+ createPart(name + 'TipRim', torusGeo(tipR, 0.006, 6, 24), brass, {+ position: [tipCX, 0.009, tipCZ], rotation: [90, 0, 0], parent: pivot+ });+ // wing root cap+ createPart(name + 'Root', boxGeo(0.1, 0.025, 0.06), brass, {+ position: [0, 0, 0.02 * dir], parent: pivot+ });+ return pivot;+ }+ makeWing('WingFrontR', 0.22, 0.09, 0.68, 0.32, 0.2, 0.22, false);+ makeWing('WingFrontL', 0.22, -0.09, 0.68, 0.32, 0.2, 0.22, true);+ makeWing('WingRearR', 0.0, 0.09, 0.58, 0.28, 0.17, 0.18, false);+ makeWing('WingRearL', 0.0, -0.09, 0.58, 0.28, 0.17, 0.18, true);++ // Six brass legs down to ground+ function leg(name, hipX, side, kneeSpread, footSpread, hipY) {+ const hx = hipX, hz = 0.08 * side;+ const kx = hipX - 0.05, ky = 0.32, kz = (0.08 + kneeSpread) * side;+ const fx = hipX - 0.02, fy = 0.016, fz = (0.08 + footSpread) * side;+ beamBetween(name + 'Upper', [hx, hipY, hz], [kx, ky, kz], 0.014, brass, { parent: root });+ beamBetween(name + 'Lower', [kx, ky, kz], [fx, fy, fz], 0.01, darkBrass, { parent: root });+ createPart(name + 'Hip', sphereGeo(0.025, 10, 8), copper, { position: [hx, hipY, hz], parent: root });+ createPart(name + 'Knee', sphereGeo(0.018, 8, 6), copper, { position: [kx, ky, kz], parent: root });+ createPart(name + 'Foot', sphereGeo(0.016, 8, 6), darkSteel, { position: [fx, fy, fz], parent: root });+ }+ leg('LegFrontR', 0.3, 1, 0.12, 0.2, bodyY - 0.1);+ leg('LegFrontL', 0.3, -1, 0.12, 0.2, bodyY - 0.1);+ leg('LegMidR', 0.14, 1, 0.16, 0.26, bodyY - 0.12);+ leg('LegMidL', 0.14, -1, 0.16, 0.26, bodyY - 0.12);+ leg('LegRearR', -0.02, 1, 0.15, 0.24, bodyY - 0.11);+ leg('LegRearL', -0.02, -1, 0.15, 0.24, bodyY - 0.11);++ // Legs provide ground contact via feet near Y=0+ return root;+}++function animate(root) {+ return [+ createClip('GearSpin', 2, [+ rotationTrack('Joint_GearR_Main_R', [{ time: 0, rotation: [0, 0, 0] }, { time: 2, rotation: [0, 0, 360] }]),+ rotationTrack('Joint_GearR_Main_L', [{ time: 0, rotation: [0, 0, 0] }, { time: 2, rotation: [0, 0, -360] }]),+ rotationTrack('Joint_GearR_Aft_R', [{ time: 0, rotation: [0, 0, 0] }, { time: 2, rotation: [0, 0, -360] }]),+ rotationTrack('Joint_GearR_Aft_L', [{ time: 0, rotation: [0, 0, 0] }, { time: 2, rotation: [0, 0, 360] }]),+ ]),+ createClip('WingFlap', 1.2, [+ rotationTrack('Joint_WingFrontR', [{ time: 0, rotation: [0, 0, 0] }, { time: 0.3, rotation: [-18, 0, 0] }, { time: 0.6, rotation: [0, 0, 0] }, { time: 0.9, rotation: [-18, 0, 0] }, { time: 1.2, rotation: [0, 0, 0] }]),+ rotationTrack('Joint_WingFrontL', [{ time: 0, rotation: [0, 0, 0] }, { time: 0.3, rotation: [18, 0, 0] }, { time: 0.6, rotation: [0, 0, 0] }, { time: 0.9, rotation: [18, 0, 0] }, { time: 1.2, rotation: [0, 0, 0] }]),+ rotationTrack('Joint_WingRearR', [{ time: 0, rotation: [0, 0, 0] }, { time: 0.3, rotation: [-22, 0, 0] }, { time: 0.6, rotation: [0, 0, 0] }, { time: 0.9, rotation: [-22, 0, 0] }, { time: 1.2, rotation: [0, 0, 0] }]),+ rotationTrack('Joint_WingRearL', [{ time: 0, rotation: [0, 0, 0] }, { time: 0.3, rotation: [22, 0, 0] }, { time: 0.6, rotation: [0, 0, 0] }, { time: 0.9, rotation: [22, 0, 0] }, { time: 1.2, rotation: [0, 0, 0] }]),+ ])+ ];+}diff --git a/examples/demo-clockwork-dragonfly.provenance.json b/examples/demo-clockwork-dragonfly.provenance.jsonnew file mode 100644index 00000000..abf419dd--- /dev/null+++ b/examples/demo-clockwork-dragonfly.provenance.json@@ -0,0 +1,33 @@+{+ "sourceHash": "824ce3887151b2a551a7c1bd09a09924f9cb46bd6dd43b2606e2d1a3b7fc0317",+ "model": "Muse Spark 1.3",+ "harness": "OpenCode",+ "authoredDate": "2026-09-09",+ "provenance": {+ "attribution": "Recorded demo session; model credit supplied only where the retained run identifies it.",+ "sourceAccess": "See retained demo run; no stronger isolation claim is made.",+ "humanIntervention": "Owner supplied direction; model-authored exported source preserved byte-for-byte.",+ "reviewFidelity": "Authoring feedback and shaded demo previews where available. Not a destination-runtime acceptance claim.",+ "poster": "Fresh shaded render of the exact gallery-built downloadable GLB. Camera-only offline capture; no geometry or material edits.",+ "evaluationGlbHash": "f7f62ac18f198d3cf724c95a6be383586046b8fbd2961289b7f9723391d8a049",+ "posterReceipt": {+ "sourceHash": "824ce3887151b2a551a7c1bd09a09924f9cb46bd6dd43b2606e2d1a3b7fc0317",+ "artifactHash": "6b8a7efe196eb2513e65a6cb49909fb87670fec470c3a3a64222884c3a4d766b",+ "imageHash": "1e32c14fccb86fa3a6f3239a076ea18984b42f47df1035d354fea91f3486209f",+ "width": 1600,+ "height": 1000,+ "renderer": "ANGLE (NVIDIA, NVIDIA GeForce RTX 3070 (0x00002484) Direct3D11 vs_5_0 ps_5_0, D3D11)",+ "captureMethod": "Kiln studio stage, owned headless Chrome, original GLB materials",+ "cameraRecord": {+ "index": 10,+ "kind": "hero",+ "theta": 0.6747409422235527,+ "phi": 1.185083808592412,+ "radius": 4.48102394457924,+ "fixedSeconds": null,+ "wallTimeMs": 310.09999999962747+ },+ "geometryChanged": false+ }+ }+}diff --git a/examples/demo-dauntless-cv-08.kiln.js b/examples/demo-dauntless-cv-08.kiln.jsnew file mode 100644index 00000000..9e52b024--- /dev/null+++ b/examples/demo-dauntless-cv-08.kiln.js@@ -0,0 +1,184 @@+const meta = { name: 'DAUNTLESS CV-08', category: 'vehicle', role: 'vehicle' };+const P = { deckY:12, length:122, hullBeam:21, deckBeam:30 };+function build() {+ const root=createRoot('Dauntless_CV08');+ const mats={+ navy:gameMaterial(0x193950,{metalness:.35,roughness:.63}),+ edge:gameMaterial(0x365970,{metalness:.4,roughness:.54}),+ dark:gameMaterial(0x17232b,{metalness:.25,roughness:.8}),+ deck:gameMaterial(0x30373c,{metalness:.15,roughness:.9}),+ ivory:gameMaterial(0xf3e8cc,{roughness:.7}),+ orange:gameMaterial(0xed742a,{metalness:.18,roughness:.52}),+ safetyOrange:gameMaterial(0xff5f00,{metalness:.08,roughness:.55}),+ glass:gameMaterial(0x7cafb6,{metalness:.5,roughness:.26}),+ steel:gameMaterial(0x8b9da5,{metalness:.65,roughness:.48})+ };+ // Bake static surfaces into one mesh per material within each semantic assembly.+ function assembly(name,parent=root) {+ const g=new THREE.Group();g.name=name;parent.add(g);+ const buckets={};+ function add(geo,mat,pos=[0,0,0],rot=[0,0,0],scale=[1,1,1]){+ if(name.startsWith('Aircraft_') && mat==='orange') mat='safetyOrange';+ const own=geo.index?geo.toNonIndexed():geo.clone();+ const matrix=new THREE.Matrix4().compose(new THREE.Vector3(...pos),new THREE.Quaternion().setFromEuler(new THREE.Euler(...rot.map(v=>v*Math.PI/180))),new THREE.Vector3(...scale));+ own.applyMatrix4(matrix);+ if(!own.getAttribute('normal'))own.computeVertexNormals();+ (buckets[mat]||(buckets[mat]=[])).push(own);+ }+ function box(mat,size,pos,rot=[0,0,0]){add(boxGeo(...size),mat,pos,rot);}+ function cyl(mat,rt,rb,h,pos,rot=[0,0,0],seg=10){add(cylinderGeo(rt,rb,h,seg),mat,pos,rot);}+ function beam(mat,a,b,width){const va=new THREE.Vector3(...a),vb=new THREE.Vector3(...b);const d=vb.clone().sub(va);const geo=boxGeo(width,d.length(),width).clone();geo.applyQuaternion(new THREE.Quaternion().setFromUnitVectors(new THREE.Vector3(0,1,0),d.normalize()));add(geo,mat,va.add(vb).multiplyScalar(.5).toArray());}+ function plate(mat,outline,y,h){const s=new THREE.Shape();outline.forEach(([x,z],i)=>i?s.lineTo(x,-z):s.moveTo(x,-z));s.closePath();const geo=new THREE.ExtrudeGeometry(s,{depth:h,bevelEnabled:false,steps:1,curveSegments:1});geo.rotateX(-Math.PI/2);add(geo,mat,[0,y,0]);}+ function finish(){+ for(const key of Object.keys(buckets)){const geos=buckets[key],p=[],n=[],uv=[];+ for(const geo of geos){const pa=geo.getAttribute('position'),na=geo.getAttribute('normal'),ua=geo.getAttribute('uv');+ for(let i=0;i<pa.count;i++){p.push(pa.getX(i),pa.getY(i),pa.getZ(i));n.push(na.getX(i),na.getY(i),na.getZ(i));uv.push(ua?ua.getX(i):0,ua?ua.getY(i):0);}+ }+ const merged=new THREE.BufferGeometry();merged.setAttribute('position',new THREE.Float32BufferAttribute(p,3));merged.setAttribute('normal',new THREE.Float32BufferAttribute(n,3));merged.setAttribute('uv',new THREE.Float32BufferAttribute(uv,2));+ createPart(name+'_'+key,merged,mats[key],{parent:g});+ }return g;+ }+ return {g,add,box,cyl,beam,plate,finish};+ }+ const hullOutline=[[-56,-7],[-49,-10],[32,-10],[48,-8],[57,-3],[60,0],[57,3],[48,8],[32,10],[-49,10],[-56,7]];+ const hull=assembly('Pressure_Hull');+ const sections=[+ {profile:hullOutline.map(([x,z])=>[x*.90,z*.55]),frame:{origin:[0,0,0]}},+ {profile:hullOutline.map(([x,z])=>[x*.98,z*.83]),frame:{origin:[0,3,0]}},+ {profile:hullOutline,frame:{origin:[0,9.5,0]}},+ {profile:hullOutline.map(([x,z])=>[x,z*1.02]),frame:{origin:[0,11.8,0]}}+ ];+ hull.add(loftProfiles(sections),'navy');+ // Continuous chine and waterline ribbons.+ for(const [y,k,m] of [[2.5,.81,'dark'],[9.35,1,'edge']]){+ hull.add(loftProfiles([{profile:hullOutline.map(([x,z])=>[x*(y<3?.98:1),z*k]),frame:{origin:[0,y,0]}},{profile:hullOutline.map(([x,z])=>[x*(y<3?.982:1),z*(k+.005)]),frame:{origin:[0,y+.18,0]}}]),m);+ }+ hull.finish();+ const deckOutline=[[-59,-10],[-46,-16],[-15,-16],[4,-13],[43,-13],[58,-7],[61,4],[54,11],[28,13],[-47,13],[-59,9]];+ const deck=assembly('Flight_Deck');+ deck.plate('edge',deckOutline,11.7,.45);+ deck.plate('deck',deckOutline.map(([x,z])=>[x*.995,z*.985]),12.15,.22);+ // Rim strips follow the shaped perimeter.+ for(let i=0;i<deckOutline.length;i++){const a=deckOutline[i],b=deckOutline[(i+1)%deckOutline.length];deck.beam('steel',[a[0],12.18,a[1]],[b[0],12.18,b[1]],.16);}+ deck.finish();+ const paint=assembly('Deck_Markings');+ function line(a,b,w,mat='ivory',y=12.405){const dx=b[0]-a[0],dz=b[1]-a[1];paint.box(mat,[Math.hypot(dx,dz),.025,w],[(a[0]+b[0])/2,y,(a[1]+b[1])/2],[0,-Math.atan2(dz,dx)*180/Math.PI,0]);}+ // Angled landing lane, deliberately clear of the island and parked aircraft.+ const start=[-53,-2.5],end=[29,-7.9],dx=end[0]-start[0],dz=end[1]-start[1],len=Math.hypot(dx,dz),nx=-dz/len,nz=dx/len;+ for(const s of [-1,1])line([start[0]+nx*3.8*s,start[1]+nz*3.8*s],[end[0]+nx*3.8*s,end[1]+nz*3.8*s],.25);+ for(let d=3;d<len-2;d+=7){const a=[start[0]+dx*d/len,start[1]+dz*d/len],b=[start[0]+dx*(d+3)/len,start[1]+dz*(d+3)/len];line(a,b,.24);}+ for(let j=0;j<5;j++){let off=(j-2)*1.1;line([-51+nx*off,-2.63+nz*off],[-47+nx*off,-2.90+nz*off],.55);}+ for(const z of [0.4,5]){line([10,z],[51,z],.18);line([10,z+.6],[51,z+.6],.12,'steel');line([51,z-1],[53,z+.3],.24);line([53,z+.3],[51,z+1.6],.24);}+ for(const x of [-40,-36,-32,-28])line([x,-7],[x+.55,1],.13,'dark',12.445);+ for(const [x,z] of [[-42,8],[-28,8],[35,8],[-19,-12.6]]){+ line([x-4,z-2.3],[x+4,z-2.3],.12);line([x-4,z+2.3],[x+4,z+2.3],.12);+ for(const xx of [x-4,x+4])line([xx,z-2.3],[xx,z+2.3],.12);+ }+ // Large squared 08 on the bow, authored as geometry for texture-free portability.+ function digit(x,z,num){const bars={a:[0,-1.1,2.8,.3],b:[1.25,-.55,.3,1.1],c:[1.25,.55,.3,1.1],d:[0,1.1,2.8,.3],e:[-1.25,.55,.3,1.1],f:[-1.25,-.55,.3,1.1],g:[0,0,2.8,.3]};for(const k of (num===0?'abcdef':'abcdefg')){const q=bars[k];paint.box('ivory',[q[3],.03,q[2]],[x+q[1],12.43,z+q[0]]);}}+ digit(54,-2.5,0);digit(54,1.2,8);+ paint.finish();+ // Sponsons, under-deck cantilevers and side servicing bays.+ const sides=assembly('Hull_Sponsons_and_Service_Bays');+ for(const side of [-1,1]){+ for(const x of [-44,-29,-14,1,16,31]){+ sides.box('edge',[8,.65,2.0],[x,9.0,side*10.5]);+ sides.beam('navy',[x-3,6.5,side*9.7],[x-3,10.7,side*12.3],.55);+ sides.beam('navy',[x+3,6.5,side*9.7],[x+3,10.7,side*12.3],.55);+ sides.box('dark',[5,1.9,.10],[x,7.4,side*10.03]);+ for(let j=0;j<4;j++)sides.box('edge',[.16,1.7,.13],[x-1.8+j*1.2,7.4,side*10.11]);+ }+ for(const x of [-39,-19,8,26]){+ sides.box('steel',[2.4,.85,.7],[x,10.05,side*11.35]);+ sides.box('dark',[2.05,.14,.76],[x,10.05,side*11.37]);+ }+ }+ sides.box('dark',[.14,3.5,12],[-56.05,7.0,0]);+ for(const z of [-4,0,4])sides.box('edge',[.23,3.5,.2],[-56.14,7,z]);+ sides.finish();+ function lift(name,x,z,y){+ const a=assembly(name);a.box('edge',[9,.5,5.4],[x,y-.27,z]);a.box('deck',[8.7,.14,5.1],[x,y+.03,z]);+ for(const side of [-1,1])a.box('orange',[8.5,.035,.2],[x,y+.125,z+side*2.36]);+ for(let j=0;j<9;j++)a.box('ivory',[.3,.036,.5],[x-3.8+j*.95,y+.15,z+2.3],[0,-35,0]);+ for(const xx of [x-3.6,x+3.6]){a.box('dark',[.4,3,.5],[xx,y-1.6,z]);a.beam('edge',[xx,8.3,z>0?9:-10],[xx,y-.5,z],.4);}+ a.finish();+ }+ lift('Starboard_Lift_lowered',22,14.4,10.9);+ lift('Port_Lift_flush',-30,-16.6,12.38);+ const island=assembly('Island');+ const ip=[[-10,7.3],[8,7.3],[10,8.7],[9,11.9],[-10,11.9]];+ island.plate('navy',ip,12.4,5.5);+ island.plate('edge',[[-9,7],[7,7],[9,8.5],[8.3,12.2],[-9,12.2]],17.9,.5);+ island.plate('navy',[[-8,7.5],[6.5,7.5],[8,8.6],[7.4,11.7],[-8,11.7]],18.4,2.5);+ island.plate('dark',[[-7.5,7.32],[6.4,7.32],[8.15,8.5],[7.5,11.85],[-7.5,11.85]],19.25,1.0);+ island.plate('safetyOrange',[[-8.04,7.46],[6.52,7.46],[8.05,8.59],[7.44,11.74],[-8.04,11.74]],18.55,.65);+ for(let x=-6.5;x<6;x+=1.5){island.box('glass',[1.12,.67,.06],[x,19.8,7.27]);island.box('glass',[1.12,.67,.06],[x,19.8,11.9]);}+ island.box('glass',[.08,.65,2],[8.03,19.8,9.5],[0,-12,0]);+ island.plate('edge',[[-8.2,7],[7,7],[8.8,8.5],[8,12.2],[-8.2,12.2]],20.8,.5);+ island.box('navy',[7,2.0,3.2],[-1,22.3,9.7]);+ island.box('edge',[7.5,.35,3.7],[-1,23.4,9.7]);+ // Faceted exhaust stack with recessed dark mouth.+ island.cyl('edge',1.35,1.7,3.6,[-6,23.1,9.7],[0,0,0],4);+ island.cyl('dark',1.05,1.05,.15,[-6,24.95,9.7],[0,0,0],4);+ for(const x of [-7,-5,-3])island.box('dark',[1.3,.75,.08],[x,15.5,7.25]);+ island.box('steel',[1.0,2.0,.14],[6,14,7.22]);+ for(let y=13;y<18;y+=.55)island.box('steel',[.7,.10,.20],[-9.75,y,8.5]);+ for(const z of [7.1,12.1]){+ for(let x=-8;x<8;x+=2)island.box('steel',[.07,.85,.07],[x,21.72,z]);+ island.box('steel',[16,.07,.07],[0,22.1,z]);+ }+ island.finish();+ const radar=assembly('Radar_Masts');+ for(const x of [-1,2])for(const z of [8.7,10.7])radar.beam('steel',[x,23.55,z],[.5,29.0,9.7],.21);+ radar.box('edge',[4,.25,3.2],[.5,27.1,9.7]);+ radar.cyl('steel',.18,.24,4.2,[.5,29.1,9.7]);+ radar.box('dark',[.3,2.5,5.5],[.5,31.0,9.7],[0,-20,0]);+ for(let z=-2;z<=2;z++)radar.box('steel',[.35,2.45,.07],[.5,31,9.7+z],[0,-20,0]);+ for(let y=30;y<=32;y+=.65)radar.box('steel',[.36,.07,5.4],[.5,y,9.7],[0,-20,0]);+ radar.cyl('steel',.07,.12,5.2,[5.1,25.6,9.7]);+ radar.box('steel',[3.5,.12,.12],[5.1,27.2,9.7]);+ radar.add(sphereGeo(.7,12,8),'ivory',[5.1,24.0,9.7]);+ radar.cyl('steel',.05,.08,3,[-7.5,25.2,11]);+ radar.finish();+ // Four reusable parked aircraft assemblies, +X nose.+ function jet(name,x,z,heading){+ const a=assembly(name);+ a.g.position.set(x,12.46,z);a.g.rotation.y=heading*Math.PI/180;+ const rings=[[-3,.34],[-2,.55],[.6,.50],[2.2,.28],[3.7,.025]].map(([xx,r])=>({profile:Array.from({length:8},(_,i)=>[Math.cos(i*Math.PI/4)*r,Math.sin(i*Math.PI/4)*r]),frame:{origin:[xx,.85,0],rotation:[0,0,-90]}}));+ a.add(loftProfiles(rings),'orange');+ const wing=[[-2.0,-.35],[-2.3,-3.2],[-.7,-3.2],[1.4,-.4],[1.4,.4],[-.7,3.2],[-2.3,3.2],[-2.0,.35]];+ a.plate('orange',wing,.74,.15);+ for(const s of [-1,1]){+ a.box('ivory',[.65,.17,.55],[-1.45,.84,s*2.55],[0,20*s,0]);+ a.plate('orange',[[-3.1,s*.2],[-3.6,s*1.6],[-2.35,s*1.6],[-1.65,s*.25]],.85,.12);+ a.add(cylinderGeo(.23,.23,.35,10),'dark',[-3.1,.85,s*.23],[0,0,90]);+ a.box('steel',[.12,.43,.12],[-1.3,.36,s*.95]);+ a.cyl('dark',.22,.22,.16,[-1.3,.20,s*.95],[90,0,0],8);+ }+ const fin=new THREE.BufferGeometry();fin.setAttribute('position',new THREE.Float32BufferAttribute([-3,.85,-.07,-3,2.3,-.07,-1.6,.85,-.07,-3,.85,.07,-1.6,.85,.07,-3,2.3,.07],3));fin.computeVertexNormals();a.add(fin,'orange');+ a.add(sphereGeo(1,12,8),'glass',[.7,1.2,0],[0,0,0],[1.2,.40,.37]);+ a.box('steel',[.10,.4,.10],[2,.36,0]);a.cyl('dark',.19,.19,.17,[2,.19,0],[90,0,0],8);+ a.finish();+ }+ jet('Aircraft_A',-42,8,0);jet('Aircraft_B',-28,8,0);jet('Aircraft_C',35,8,0);jet('Aircraft_D',-19,-12.6,0);+ const fittings=assembly('Deck_Edge_Fittings');+ for(const s of [-1,1])for(const x of [-49,-38,-23,-9,7,33]){+ const z=s*(s<0&&x<-15?15.65:12.5);+ fittings.box('edge',[2.2,.35,1],[x,12.5,z]);+ for(const xx of [x-.65,x+.65])fittings.cyl('steel',.18,.18,.45,[xx,12.9,z]);+ }+ for(const [x,z] of [[-49,-11],[-47,12],[42,-11]]){+ fittings.cyl('edge',1.05,1.25,.75,[x,12.8,z],[],12);+ fittings.add(sphereGeo(.68,12,6),'ivory',[x,13.4,z]);+ }+ // Underwater stern: shafts, rudders and simple bronze-orange propellers.+ for(const z of [-4.4,4.4]){+ fittings.cyl('steel',.23,.23,7,[-53,1.65,z],[0,0,90]);+ fittings.cyl('orange',.65,.3,1,[-56.8,1.65,z],[0,0,90]);+ for(let i=0;i<4;i++)fittings.box('orange',[.14,2.9,.50],[-56.9,1.65,z],[i*45,0,0]);+ fittings.box('navy',[2.2,2.6,.3],[-58.5,1.4,z]);+ fittings.beam('navy',[-58.5,2.5,z],[-54.7,4.8,z],.5);+ }+ fittings.finish();+ return root;+}\ No newline at end of filediff --git a/examples/demo-dauntless-cv-08.provenance.json b/examples/demo-dauntless-cv-08.provenance.jsonnew file mode 100644index 00000000..a4621fcf--- /dev/null+++ b/examples/demo-dauntless-cv-08.provenance.json@@ -0,0 +1,33 @@+{+ "sourceHash": "898b76ec27eaa205897387b832de35a72d323dd468bad84510563452ee74505f",+ "model": "GPT-6 Astra",+ "harness": "ChatGPT Work",+ "authoredDate": "2026-09-08",+ "provenance": {+ "attribution": "Recorded demo session; model credit supplied only where the retained run identifies it.",+ "sourceAccess": "See retained demo run; no stronger isolation claim is made.",+ "humanIntervention": "Owner supplied direction; model-authored exported source preserved byte-for-byte.",+ "reviewFidelity": "Authoring feedback and shaded demo previews where available. Not a destination-runtime acceptance claim.",+ "poster": "Fresh shaded render of the exact gallery-built downloadable GLB. Camera-only offline capture; no geometry or material edits.",+ "evaluationGlbHash": "98af4ec344d438d015d07b99bbab4abe389ff445ed45c1b24cd2a4300ff3fa74",+ "posterReceipt": {+ "sourceHash": "898b76ec27eaa205897387b832de35a72d323dd468bad84510563452ee74505f",+ "artifactHash": "61166afc666fe8fd658c20f4918b8eefd7a76fc96883b61486f468936d0ef77b",+ "imageHash": "cd61c55ac023c85730c7f072f5fbedd61090b9f051e43df0c74b446da96a86cc",+ "width": 1600,+ "height": 1000,+ "renderer": "ANGLE (NVIDIA, NVIDIA GeForce RTX 3070 (0x00002484) Direct3D11 vs_5_0 ps_5_0, D3D11)",+ "captureMethod": "Kiln studio stage, owned headless Chrome, original GLB materials",+ "cameraRecord": {+ "index": 10,+ "kind": "hero",+ "theta": 0.6747409422235526,+ "phi": 1.185083808592412,+ "radius": 217.14680757459587,+ "fixedSeconds": null,+ "wallTimeMs": 116.79999999888241+ },+ "geometryChanged": false+ }+ }+}diff --git a/examples/demo-deep-sea-station.kiln.js b/examples/demo-deep-sea-station.kiln.jsnew file mode 100644index 00000000..a28e8975--- /dev/null+++ b/examples/demo-deep-sea-station.kiln.js@@ -0,0 +1,499 @@+const meta = {+ name: 'Deep-Sea Research Station',+ category: 'architecture',+ role: 'building'+};++function build() {+ const root = createRoot('DeepSeaStation');+ const d2r = (deg) => deg * Math.PI / 180;++ // --- Materials ---+ const hullWhite = gameMaterial(0xdce5ea, { roughness: 0.35, metalness: 0.3 });+ const hullDark = gameMaterial(0x1a232b, { roughness: 0.6, metalness: 0.7 });+ const frameworkDark = gameMaterial(0x12171d, { roughness: 0.7, metalness: 0.85 });+ const safetyYellow = gameMaterial(0xf4a900, { roughness: 0.35, metalness: 0.2 });+ const podFrameOrange = gameMaterial(0xf55a10, { roughness: 0.35, metalness: 0.2 });+ const jointBlack = gameMaterial(0x181a1e, { roughness: 0.8, metalness: 0.3 });+ const chromeMetal = gameMaterial(0xd4d8dc, { roughness: 0.15, metalness: 0.95 });+ const glass = glassMaterial(0x4dc0f5, { opacity: 0.32, roughness: 0.06, metalness: 0.1 });+ const floodLight = gameMaterial(0xffffff, { emissive: 0xffffff, emissiveIntensity: 3.5 });+ const cyanGlow = gameMaterial(0x00e5ff, { emissive: 0x00e5ff, emissiveIntensity: 2.5 });+ const amberBeacon = gameMaterial(0xff6600, { emissive: 0xff6600, emissiveIntensity: 2.2 });+ const interiorDeck = gameMaterial(0x242e38, { roughness: 0.85, metalness: 0.2 });+ const interiorPanel = gameMaterial(0x384754, { roughness: 0.5, metalness: 0.4 });+ const tankGas = gameMaterial(0xedf2f7, { roughness: 0.4, metalness: 0.2 });+ const tankStripe = gameMaterial(0x009e73, { roughness: 0.5, metalness: 0.2 });++ // ==========================================+ // 1. CENTRAL PRESSURE HULL & DOCKING CORE+ // ==========================================+ // Lower Machinery Ring+ createPart('Hull_LowerCollar', cylinderGeo(2.4, 2.3, 0.6, 24), frameworkDark, { position: [0, 2.2, 0], parent: root });+ createPart('Hull_MachineryBelt', cylinderGeo(2.5, 2.4, 1.2, 24), hullWhite, { position: [0, 3.1, 0], parent: root });++ // Mid Corridor Hub Belt+ createPart('Hull_MidBelt', cylinderGeo(2.65, 2.65, 0.6, 24), hullDark, { position: [0, 4.0, 0], parent: root });+ createPart('Hull_UpperSection', cylinderGeo(2.35, 2.55, 1.2, 24), hullWhite, { position: [0, 4.9, 0], parent: root });++ // Upper Taper & Observation Ring+ createPart('Hull_UpperTaper', cylinderGeo(1.8, 2.35, 1.0, 24), hullDark, { position: [0, 6.0, 0], parent: root });+ createPart('Hull_UpperDeckRim', cylinderGeo(1.95, 1.95, 0.25, 24), safetyYellow, { position: [0, 6.6, 0], parent: root });++ // Submersible Docking Hatch (Aft top)+ createPart('Docking_Collar', cylinderGeo(1.0, 1.1, 0.4, 18), hullDark, { position: [-0.4, 6.9, 0], parent: root });+ createPart('Docking_Hatch', cylinderGeo(0.9, 0.9, 0.1, 18), safetyYellow, { position: [-0.4, 7.15, 0], parent: root });+ createPart('Docking_LightFwd', sphereGeo(0.06, 8, 6), floodLight, { position: [0.5, 7.15, 0], parent: root });+ createPart('Docking_LightAft', sphereGeo(0.06, 8, 6), floodLight, { position: [-1.3, 7.15, 0], parent: root });+ createPart('Docking_LightStbd', sphereGeo(0.06, 8, 6), floodLight, { position: [-0.4, 7.15, 0.9], parent: root });+ createPart('Docking_LightPort', sphereGeo(0.06, 8, 6), floodLight, { position: [-0.4, 7.15, -0.9], parent: root });++ // Sensor & Communications Mast+ createPart('Mast_Base', cylinderGeo(0.2, 0.25, 0.3, 12), frameworkDark, { position: [0.6, 6.85, 0], parent: root });+ createPart('Mast_Pylon', cylinderGeo(0.1, 0.16, 2.2, 10), frameworkDark, { position: [0.6, 8.1, 0], parent: root });+ createPart('Mast_SonarDome', sphereGeo(0.4, 14, 10), hullDark, { position: [0.6, 9.3, 0], parent: root });+ createPart('Mast_AcousticBoom', cylinderGeo(0.04, 0.04, 1.3, 8), frameworkDark, { position: [0.6, 8.8, 0], rotation: [90, 0, 0], parent: root });+ createPart('Mast_TransducerL', cylinderGeo(0.08, 0.05, 0.18, 8), safetyYellow, { position: [0.6, 8.8, 0.65], rotation: [90, 0, 0], parent: root });+ createPart('Mast_TransducerR', cylinderGeo(0.08, 0.05, 0.18, 8), safetyYellow, { position: [0.6, 8.8, -0.65], rotation: [-90, 0, 0], parent: root });+ createPart('Mast_Beacon', sphereGeo(0.1, 10, 8), amberBeacon, { position: [0.6, 9.75, 0], parent: root });+ createPart('Mast_AntennaSpire', cylinderGeo(0.015, 0.03, 1.4, 6), chromeMetal, { position: [0.6, 10.5, 0], parent: root });++ // Aft Power Reactor / Engineering Pod (-X)+ createPart('Reactor_Corridor', cylinderGeo(0.7, 0.7, 1.2, 16), hullDark, { position: [-2.8, 3.8, 0], rotation: [0, 0, 90], parent: root });+ createPart('Reactor_Hull', cylinderGeo(1.35, 1.45, 1.8, 20), hullWhite, { position: [-4.2, 3.8, 0], rotation: [0, 0, 90], parent: root });+ createPart('Reactor_EndCap', sphereGeo(1.35, 16, 12), hullDark, { position: [-5.1, 3.8, 0], parent: root });+ createPart('Reactor_VaneTop', boxGeo(1.6, 0.4, 0.12), frameworkDark, { position: [-4.2, 4.7, 0], parent: root });+ createPart('Reactor_VaneStbd', boxGeo(1.6, 0.12, 0.4), frameworkDark, { position: [-4.2, 3.8, 1.5], parent: root });+ createPart('Reactor_VanePort', boxGeo(1.6, 0.12, 0.4), frameworkDark, { position: [-4.2, 3.8, -1.5], parent: root });++ // ==========================================+ // 2. SEAFLOOR ANCHORAGE & 4 LANDING LEGS+ // ==========================================+ const legAngles = [45, 135, 225, 315];+ for (let i = 0; i < 4; i++) {+ const deg = legAngles[i];+ const rad = d2r(deg);+ const cosA = Math.cos(rad);+ const sinA = Math.sin(rad);++ const fx = 5.0 * cosA;+ const fz = 5.0 * sinA;+ const fy = 0.1;++ const hx = 2.2 * cosA;+ const hz = 2.2 * sinA;+ const hy = 2.2;++ const prefix = 'Leg_' + deg;++ // Footpad resting on seabed (Y=0 to Y=0.2)+ createPart(prefix + '_Foot', cylinderGeo(0.8, 0.95, 0.2, 16), hullDark, { position: [fx, fy, fz], parent: root });+ createPart(prefix + '_BallastRing', cylinderGeo(0.65, 0.65, 0.15, 14), safetyYellow, { position: [fx, fy + 0.15, fz], parent: root });+ createPart(prefix + '_AnkleBall', sphereGeo(0.28, 12, 10), jointBlack, { position: [fx, fy + 0.32, fz], parent: root });++ // Telescoping heavy strut+ const midX = (fx + hx) * 0.5;+ const midY = (fy + 0.32 + hy) * 0.5;+ const midZ = (fz + hz) * 0.5;++ beamBetween(prefix + '_LowerStrut', [fx, fy + 0.32, fz], [midX, midY, midZ], 0.15, frameworkDark, { parent: root });+ beamBetween(prefix + '_ChromePiston', [fx * 0.4 + hx * 0.6, (fy + 0.32) * 0.4 + hy * 0.6, fz * 0.4 + hz * 0.6], [hx, hy, hz], 0.11, chromeMetal, { parent: root });+ beamBetween(prefix + '_UpperCollar', [midX, midY, midZ], [hx, hy, hz], 0.16, frameworkDark, { parent: root });++ // Diagonal knee brace to underbelly+ const kx = 0.8 * cosA;+ const kz = 0.8 * sinA;+ const ky = 1.9;+ beamBetween(prefix + '_KneeBrace', [midX, midY, midZ], [kx, ky, kz], 0.08, frameworkDark, { parent: root });+ }++ // Underside Gas / Life-Support Storage Tanks+ const tankAngles = [30, 90, 150, 210, 270, 330];+ for (let t = 0; t < tankAngles.length; t++) {+ const tRad = d2r(tankAngles[t]);+ const tx = 1.75 * Math.cos(tRad);+ const tz = 1.75 * Math.sin(tRad);+ createPart('Tank_' + t, capsuleGeo(0.22, 1.0, 8), tankGas, { position: [tx, 2.3, tz], parent: root });+ createPart('TankBand_' + t, cylinderGeo(0.23, 0.23, 0.25, 12), tankStripe, { position: [tx, 2.3, tz], parent: root });+ createPart('TankValve_' + t, cylinderGeo(0.07, 0.07, 0.12, 8), jointBlack, { position: [tx, 2.9, tz], parent: root });+ }++ // Maneuvering Station-Keeping Thrusters+ const thrusterAngles = [0, 90, 180, 270];+ for (let th = 0; th < 4; th++) {+ const a = d2r(thrusterAngles[th]);+ const thX = 2.8 * Math.cos(a);+ const thZ = 2.8 * Math.sin(a);+ const rotY = -thrusterAngles[th];++ beamBetween('ThPylon_' + th, [2.2 * Math.cos(a), 2.5, 2.2 * Math.sin(a)], [thX, 2.5, thZ], 0.12, frameworkDark, { parent: root });+ createPart('ThDuct_' + th, cylinderGeo(0.35, 0.35, 0.4, 14), safetyYellow, { position: [thX, 2.5, thZ], rotation: [90, rotY, 0], parent: root });+ createPart('ThCore_' + th, cylinderGeo(0.12, 0.12, 0.44, 10), jointBlack, { position: [thX, 2.5, thZ], rotation: [90, rotY, 0], parent: root });+ }++ // ==========================================+ // 3. GLASS HABITAT PODS WITH INTERIORS+ // ==========================================++ // Helper for Pod Corridors+ function buildCorridor(name, start, end) {+ beamBetween(name + '_Tube', start, end, 0.72, hullWhite, { parent: root });+ const mid = [(start[0] + end[0]) * 0.5, (start[1] + end[1]) * 0.5, (start[2] + end[2]) * 0.5];+ const dx = end[0] - start[0];+ const dz = end[2] - start[2];+ const angleY = Math.atan2(dz, dx) * 180 / Math.PI;++ createPart(name + '_Ring1', cylinderGeo(0.82, 0.82, 0.16, 18), hullDark, {+ position: [start[0] + dx * 0.35, start[1], start[2] + dz * 0.35],+ rotation: [0, -angleY, 90],+ parent: root+ });+ createPart(name + '_Ring2', cylinderGeo(0.82, 0.82, 0.16, 18), hullDark, {+ position: [start[0] + dx * 0.75, start[1], start[2] + dz * 0.75],+ rotation: [0, -angleY, 90],+ parent: root+ });++ // Subsea conduit piping along corridor underside+ const p1 = [start[0], start[1] - 0.75, start[2]];+ const p2 = [end[0], end[1] - 0.75, end[2]];+ const pipeGeo = pipeAlongPath([p1, p2], 0.05, { bendRadius: 0.1 });+ createPart(name + '_UnderPipe', pipeGeo, jointBlack, { parent: root });+ }++ // Pod 1: Forward Science / Deep Bio-Lab Pod+ buildCorridor('Corridor_Fwd', [2.3, 3.8, 0], [4.4, 3.8, 0]);+ const fwdPodCenter = [5.3, 3.8, 0];+ const podR = 1.55;++ // Glass Spheres+ createPart('Pod_Fwd_Glass', sphereGeo(podR, 24, 18), glass, { position: fwdPodCenter, parent: root });+ createPart('Pod_Fwd_EqFrame', torusGeo(podR + 0.02, 0.05, 8, 28), podFrameOrange, { position: fwdPodCenter, rotation: [90, 0, 0], parent: root });+ createPart('Pod_Fwd_MeridFrame1', torusGeo(podR + 0.02, 0.05, 8, 28), podFrameOrange, { position: fwdPodCenter, rotation: [0, 90, 0], parent: root });+ createPart('Pod_Fwd_MeridFrame2', torusGeo(podR + 0.02, 0.05, 8, 28), podFrameOrange, { position: fwdPodCenter, rotation: [0, 0, 0], parent: root });+ createPart('Pod_Fwd_NoseCap', cylinderGeo(0.18, 0.1, 0.16, 12), safetyYellow, { position: [fwdPodCenter[0] + podR, fwdPodCenter[1], fwdPodCenter[2]], rotation: [0, 0, -90], parent: root });+ createPart('Pod_Fwd_Beacon', sphereGeo(0.08, 8, 6), amberBeacon, { position: [fwdPodCenter[0] + podR + 0.14, fwdPodCenter[1], fwdPodCenter[2]], parent: root });++ // Forward Pod Interior+ createPart('Pod_Fwd_Floor', cylinderGeo(1.38, 1.38, 0.08, 20), interiorDeck, { position: [5.3, 3.0, 0], parent: root });+ createPart('Pod_Fwd_SpecimenTable', cylinderGeo(0.42, 0.42, 0.55, 12), interiorPanel, { position: [5.3, 3.32, 0], parent: root });+ createPart('Pod_Fwd_HoloSphere', sphereGeo(0.16, 12, 10), cyanGlow, { position: [5.3, 3.75, 0], parent: root });+ createPart('Pod_Fwd_ConsoleDesk', boxGeo(0.4, 0.7, 0.8), interiorPanel, { position: [5.9, 3.4, 0.4], parent: root });+ createPart('Pod_Fwd_ConsoleScreen', boxGeo(0.04, 0.35, 0.65), cyanGlow, { position: [5.7, 3.65, 0.4], parent: root });+ createPart('Pod_Fwd_Rack', boxGeo(0.35, 0.8, 0.7), interiorPanel, { position: [5.9, 3.45, -0.4], parent: root });++ // Pod 2: Starboard Habitat & Living Pod (+Z)+ buildCorridor('Corridor_Stbd', [0, 3.8, 2.3], [0, 3.8, 4.4]);+ const stbdPodCenter = [0, 3.8, 5.3];++ createPart('Pod_Stbd_Glass', sphereGeo(podR, 24, 18), glass, { position: stbdPodCenter, parent: root });+ createPart('Pod_Stbd_EqFrame', torusGeo(podR + 0.02, 0.05, 8, 28), podFrameOrange, { position: stbdPodCenter, rotation: [90, 0, 0], parent: root });+ createPart('Pod_Stbd_MeridFrame1', torusGeo(podR + 0.02, 0.05, 8, 28), podFrameOrange, { position: stbdPodCenter, rotation: [0, 0, 0], parent: root });+ createPart('Pod_Stbd_MeridFrame2', torusGeo(podR + 0.02, 0.05, 8, 28), podFrameOrange, { position: stbdPodCenter, rotation: [0, 90, 0], parent: root });+ createPart('Pod_Stbd_Cap', cylinderGeo(0.18, 0.1, 0.16, 12), safetyYellow, { position: [0, 3.8, 5.3 + podR], rotation: [90, 0, 0], parent: root });+ createPart('Pod_Stbd_Beacon', sphereGeo(0.08, 8, 6), amberBeacon, { position: [0, 3.8, 5.3 + podR + 0.14], parent: root });++ // Starboard Pod Interior+ createPart('Pod_Stbd_Floor', cylinderGeo(1.38, 1.38, 0.08, 20), interiorDeck, { position: [0, 3.0, 5.3], parent: root });+ createPart('Pod_Stbd_NavTable', cylinderGeo(0.45, 0.45, 0.55, 12), interiorPanel, { position: [0, 3.32, 5.3], parent: root });+ createPart('Pod_Stbd_NavDisplay', cylinderGeo(0.35, 0.35, 0.04, 12), cyanGlow, { position: [0, 3.62, 5.3], parent: root });+ createPart('Pod_Stbd_StationDesk', boxGeo(0.8, 0.7, 0.35), interiorPanel, { position: [0.4, 3.4, 5.9], parent: root });+ createPart('Pod_Stbd_StationScreen', boxGeo(0.65, 0.35, 0.04), cyanGlow, { position: [0.4, 3.65, 5.7], parent: root });++ // Pod 3: Port Oceanographic / Sensor Pod (-Z)+ buildCorridor('Corridor_Port', [0, 3.8, -2.3], [0, 3.8, -4.4]);+ const portPodCenter = [0, 3.8, -5.3];++ createPart('Pod_Port_Glass', sphereGeo(podR, 24, 18), glass, { position: portPodCenter, parent: root });+ createPart('Pod_Port_EqFrame', torusGeo(podR + 0.02, 0.05, 8, 28), podFrameOrange, { position: portPodCenter, rotation: [90, 0, 0], parent: root });+ createPart('Pod_Port_MeridFrame1', torusGeo(podR + 0.02, 0.05, 8, 28), podFrameOrange, { position: portPodCenter, rotation: [0, 0, 0], parent: root });+ createPart('Pod_Port_MeridFrame2', torusGeo(podR + 0.02, 0.05, 8, 28), podFrameOrange, { position: portPodCenter, rotation: [0, 90, 0], parent: root });+ createPart('Pod_Port_Cap', cylinderGeo(0.18, 0.1, 0.16, 12), safetyYellow, { position: [0, 3.8, -5.3 - podR], rotation: [-90, 0, 0], parent: root });+ createPart('Pod_Port_Beacon', sphereGeo(0.08, 8, 6), amberBeacon, { position: [0, 3.8, -5.3 - podR - 0.14], parent: root });++ // Port Pod Interior+ createPart('Pod_Port_Floor', cylinderGeo(1.38, 1.38, 0.08, 20), interiorDeck, { position: [0, 3.0, -5.3], parent: root });+ createPart('Pod_Port_Mainframe', boxGeo(0.7, 1.1, 0.4), interiorPanel, { position: [-0.3, 3.6, -5.9], parent: root });+ createPart('Pod_Port_ServerGlow', boxGeo(0.6, 0.9, 0.04), cyanGlow, { position: [-0.3, 3.6, -5.68], parent: root });+ createPart('Pod_Port_AnalysisDesk', boxGeo(0.8, 0.7, 0.35), interiorPanel, { position: [0.3, 3.4, -5.9], parent: root });++ // Pod 4: Top Command Vista Cupola+ createPart('Cupola_DeckRim', cylinderGeo(1.2, 1.25, 0.2, 20), hullDark, { position: [0, 6.7, 0], parent: root });+ createPart('Cupola_Glass', sphereGeo(1.1, 20, 14), glass, { position: [0, 6.85, 0], parent: root });+ createPart('Cupola_FrameArch1', torusGeo(1.12, 0.04, 8, 24), podFrameOrange, { position: [0, 6.85, 0], rotation: [0, 0, 0], parent: root });+ createPart('Cupola_FrameArch2', torusGeo(1.12, 0.04, 8, 24), podFrameOrange, { position: [0, 6.85, 0], rotation: [0, 90, 0], parent: root });+ createPart('Cupola_Floor', cylinderGeo(1.0, 1.0, 0.06, 18), interiorDeck, { position: [0, 6.75, 0], parent: root });+ createPart('Cupola_CommandOrb', sphereGeo(0.18, 12, 8), cyanGlow, { position: [0, 7.15, 0], parent: root });++ // ==========================================+ // 4. YELLOW ROBOTIC MANIPULATOR ARMS+ // ==========================================++ function buildArticulatedArm(armName, mountPos, yawDeg, pitch1Deg, pitch2Deg, pitch3Deg, rollDeg, gripClosed, hasScanner) {+ // 0. Reinforced Sponson Outrigger from Hull+ beamBetween(armName + '_Sponson', [2.1, 2.4, mountPos[2] * 0.65], mountPos, 0.18, frameworkDark, { parent: root });+ createPart(armName + '_BaseMount', cylinderGeo(0.42, 0.45, 0.25, 16), hullDark, {+ position: mountPos,+ parent: root+ });++ // 1. Shoulder Joint Pivot+ const shoulderPivot = createPivot(armName + '_ShoulderYaw', [mountPos[0], mountPos[1] + 0.16, mountPos[2]], root);+ shoulderPivot.rotation.y = d2r(yawDeg);++ // Turret Yoke & Rotary Table+ createPart(armName + '_YokeBase', cylinderGeo(0.38, 0.38, 0.12, 16), safetyYellow, {+ position: [0, 0.06, 0],+ parent: shoulderPivot+ });+ createPart(armName + '_YokeArmL', boxGeo(0.14, 0.55, 0.28), safetyYellow, {+ position: [0, 0.3, 0.22],+ parent: shoulderPivot+ });+ createPart(armName + '_YokeArmR', boxGeo(0.14, 0.55, 0.28), safetyYellow, {+ position: [0, 0.3, -0.22],+ parent: shoulderPivot+ });+ createPart(armName + '_ShoulderPin', cylinderGeo(0.13, 0.13, 0.52, 14), jointBlack, {+ position: [0, 0.48, 0],+ rotation: [90, 0, 0],+ parent: shoulderPivot+ });++ // 2. Shoulder Pitch Pivot+ const shoulderPitch = createPivot(armName + '_ShoulderPitch', [0, 0.48, 0], shoulderPivot);+ shoulderPitch.rotation.z = d2r(pitch1Deg);++ // Heavy Upper Arm Boom (length 2.3)+ const L1 = 2.3;+ createPart(armName + '_BoomMain', boxGeo(L1, 0.32, 0.3), safetyYellow, {+ position: [L1 * 0.5, 0, 0],+ parent: shoulderPitch+ });+ createPart(armName + '_BoomPlateT', boxGeo(L1 * 0.85, 0.04, 0.26), jointBlack, {+ position: [L1 * 0.5, 0.16, 0],+ parent: shoulderPitch+ });+ createPart(armName + '_BoomPlateB', boxGeo(L1 * 0.85, 0.04, 0.26), jointBlack, {+ position: [L1 * 0.5, -0.16, 0],+ parent: shoulderPitch+ });++ // Dual Hydraulic Lift Cylinders (Top and Bottom)+ createPart(armName + '_BoomHydrCylTop', cylinderGeo(0.06, 0.06, L1 * 0.55, 10), safetyYellow, {+ position: [L1 * 0.35, 0.24, 0],+ rotation: [0, 0, 90],+ parent: shoulderPitch+ });+ createPart(armName + '_BoomHydrRodTop', cylinderGeo(0.036, 0.036, L1 * 0.5, 10), chromeMetal, {+ position: [L1 * 0.75, 0.24, 0],+ rotation: [0, 0, 90],+ parent: shoulderPitch+ });++ // Hydraulic supply conduits along upper arm+ const upperHose = pipeAlongPath([[0, -0.22, 0.14], [L1 * 0.5, -0.24, 0.14], [L1 * 0.9, -0.22, 0.14]], 0.028, { bendRadius: 0.08 });+ createPart(armName + '_UpperHose', upperHose, jointBlack, { parent: shoulderPitch });++ // 3. Elbow Pitch Pivot+ const elbowPitch = createPivot(armName + '_ElbowPitch', [L1, 0, 0], shoulderPitch);+ elbowPitch.rotation.z = d2r(pitch2Deg);++ createPart(armName + '_ElbowHinge', cylinderGeo(0.15, 0.15, 0.38, 14), jointBlack, {+ position: [0, 0, 0],+ rotation: [90, 0, 0],+ parent: elbowPitch+ });++ // Forearm Boom (length 2.0)+ const L2 = 2.0;+ createPart(armName + '_ForearmMain', boxGeo(L2, 0.26, 0.26), safetyYellow, {+ position: [L2 * 0.5, 0, 0],+ parent: elbowPitch+ });+ // Hazard Stripes on forearm+ createPart(armName + '_HazardStripe1', boxGeo(0.22, 0.28, 0.28), jointBlack, {+ position: [L2 * 0.35, 0, 0],+ parent: elbowPitch+ });+ createPart(armName + '_HazardStripe2', boxGeo(0.22, 0.28, 0.28), jointBlack, {+ position: [L2 * 0.85, 0, 0],+ parent: elbowPitch+ });++ // Forearm Hydraulic Pitch Cylinder+ createPart(armName + '_ForeHydrCyl', cylinderGeo(0.05, 0.05, L2 * 0.5, 10), safetyYellow, {+ position: [L2 * 0.35, 0.2, 0],+ rotation: [0, 0, 90],+ parent: elbowPitch+ });+ createPart(armName + '_ForeHydrRod', cylinderGeo(0.03, 0.03, L2 * 0.45, 10), chromeMetal, {+ position: [L2 * 0.72, 0.2, 0],+ rotation: [0, 0, 90],+ parent: elbowPitch+ });++ // Flexible conduit hose on forearm+ const foreHose = pipeAlongPath([[0, -0.16, 0.12], [L2 * 0.5, -0.18, 0.12], [L2 * 0.9, -0.16, 0.12]], 0.025, { bendRadius: 0.06 });+ createPart(armName + '_ForeHose', foreHose, jointBlack, { parent: elbowPitch });++ // Arm-mounted Deep-Sea Heavy LED Work Spotlight+ createPart(armName + '_SpotHousing', cylinderGeo(0.09, 0.12, 0.22, 12), hullDark, {+ position: [L2 * 0.65, -0.22, 0],+ rotation: [0, 0, -90],+ parent: elbowPitch+ });+ createPart(armName + '_SpotLens', cylinderGeo(0.085, 0.085, 0.03, 12), floodLight, {+ position: [L2 * 0.65 + 0.12, -0.22, 0],+ rotation: [0, 0, -90],+ parent: elbowPitch+ });++ // 4. Wrist Assembly+ const wristPivot = createPivot(armName + '_Wrist', [L2, 0, 0], elbowPitch);+ wristPivot.rotation.x = d2r(rollDeg);+ wristPivot.rotation.z = d2r(pitch3Deg);++ createPart(armName + '_WristRotator', cylinderGeo(0.15, 0.15, 0.2, 14), safetyYellow, {+ position: [0.1, 0, 0],+ rotation: [0, 0, -90],+ parent: wristPivot+ });+ createPart(armName + '_WristFlange', cylinderGeo(0.17, 0.17, 0.06, 14), jointBlack, {+ position: [0.22, 0, 0],+ rotation: [0, 0, -90],+ parent: wristPivot+ });++ // 5. Tool / Manipulator End-Effector+ const clawBaseX = 0.25;++ if (hasScanner) {+ // Oceanographic Multispectral Scanner Tool Head+ createPart(armName + '_ScannerShaft', cylinderGeo(0.08, 0.08, 0.35, 12), chromeMetal, {+ position: [clawBaseX + 0.18, 0, 0],+ rotation: [0, 0, -90],+ parent: wristPivot+ });+ createPart(armName + '_ScannerHead', cylinderGeo(0.18, 0.14, 0.24, 14), safetyYellow, {+ position: [clawBaseX + 0.42, 0, 0],+ rotation: [0, 0, -90],+ parent: wristPivot+ });+ createPart(armName + '_ScannerLens', sphereGeo(0.12, 14, 10), cyanGlow, {+ position: [clawBaseX + 0.54, 0, 0],+ parent: wristPivot+ });+ createPart(armName + '_ScannerRing', torusGeo(0.19, 0.03, 8, 20), jointBlack, {+ position: [clawBaseX + 0.44, 0, 0],+ rotation: [0, 90, 0],+ parent: wristPivot+ });+ }++ // Heavy 3-Finger Articulated Gripper Claws+ const gripFactor = gripClosed ? 0.35 : 0.9;+ for (let f = 0; f < 3; f++) {+ const phi = (f * 120) * Math.PI / 180;+ const fy = Math.cos(phi) * 0.12;+ const fz = Math.sin(phi) * 0.12;++ // Base knuckle+ createPart(armName + '_FingerKnuckle_' + f, boxGeo(0.1, 0.06, 0.06), safetyYellow, {+ position: [clawBaseX + 0.05, fy, fz],+ parent: wristPivot+ });++ // Proximal heavy phalanx+ beamBetween(armName + '_FingerProx_' + f,+ [clawBaseX + 0.08, fy, fz],+ [clawBaseX + 0.28, fy * 1.15, fz * 1.15],+ 0.03, safetyYellow, { parent: wristPivot }+ );++ // Distal hardened chrome claw prong curved inward+ beamBetween(armName + '_FingerDist_' + f,+ [clawBaseX + 0.28, fy * 1.15, fz * 1.15],+ [clawBaseX + 0.48, fy * gripFactor, fz * gripFactor],+ 0.022, chromeMetal, { parent: wristPivot }+ );+ }+ }++ // Starboard Heavy Robotic Arm: Posed reaching down toward seabed mineral sample+ buildArticulatedArm('Arm_Stbd', [2.5, 2.5, 1.6], -20, -36, 46, -10, 22, true, false);++ // Port Heavy Robotic Arm: Posed hovering over forward specimen collection basket with active scanner+ buildArticulatedArm('Arm_Port', [2.5, 2.5, -1.6], 30, -18, 34, -16, -28, false, true);++ // ==========================================+ // 5. SEABED BENTHIC BASKET & WORKSTATION+ // ==========================================++ // Forward Specimen Collection Basket [4.1, 0.35, 0]+ createPart('Basket_Base', boxGeo(1.4, 0.08, 0.95), frameworkDark, { position: [4.1, 0.08, 0], parent: root });+ createPart('Basket_FrontRail', boxGeo(1.4, 0.05, 0.05), safetyYellow, { position: [4.1, 0.48, 0.47], parent: root });+ createPart('Basket_RearRail', boxGeo(1.4, 0.05, 0.05), safetyYellow, { position: [4.1, 0.48, -0.47], parent: root });+ createPart('Basket_LeftRail', boxGeo(0.05, 0.05, 0.95), safetyYellow, { position: [4.8, 0.48, 0], parent: root });+ createPart('Basket_RightRail', boxGeo(0.05, 0.05, 0.95), safetyYellow, { position: [3.4, 0.48, 0], parent: root });++ // Basket Corner Posts+ createPart('Basket_Post1', boxGeo(0.06, 0.4, 0.06), safetyYellow, { position: [4.77, 0.28, 0.44], parent: root });+ createPart('Basket_Post2', boxGeo(0.06, 0.4, 0.06), safetyYellow, { position: [4.77, 0.28, -0.44], parent: root });+ createPart('Basket_Post3', boxGeo(0.06, 0.4, 0.06), safetyYellow, { position: [3.43, 0.28, 0.44], parent: root });+ createPart('Basket_Post4', boxGeo(0.06, 0.4, 0.06), safetyYellow, { position: [3.43, 0.28, -0.44], parent: root });++ // Sturdy Deployment Support Struts Connecting Basket to Station Lower Hull+ beamBetween('Basket_StrutL', [2.3, 2.2, 0.6], [3.5, 0.45, 0.4], 0.08, frameworkDark, { parent: root });+ beamBetween('Basket_StrutR', [2.3, 2.2, -0.6], [3.5, 0.45, -0.4], 0.08, frameworkDark, { parent: root });++ // Core Sample Canisters inside Basket+ createPart('Canister_1', cylinderGeo(0.09, 0.09, 0.45, 12), chromeMetal, { position: [3.9, 0.32, 0.2], parent: root });+ createPart('Canister_1_Cap', cylinderGeo(0.095, 0.095, 0.07, 12), cyanGlow, { position: [3.9, 0.56, 0.2], parent: root });++ createPart('Canister_2', cylinderGeo(0.09, 0.09, 0.45, 12), safetyYellow, { position: [4.3, 0.32, 0.18], parent: root });+ createPart('Canister_2_Cap', cylinderGeo(0.095, 0.095, 0.07, 12), jointBlack, { position: [4.3, 0.56, 0.18], parent: root });++ createPart('Canister_3', cylinderGeo(0.09, 0.09, 0.45, 12), chromeMetal, { position: [3.8, 0.32, -0.2], parent: root });+ createPart('Canister_3_Cap', cylinderGeo(0.095, 0.095, 0.07, 12), amberBeacon, { position: [3.8, 0.56, -0.2], parent: root });++ // Seabed Hydrothermal Mineral Chimney Spire near Starboard Arm Claw+ createPart('Hydro_Mound', cylinderGeo(0.35, 0.55, 0.25, 12), frameworkDark, { position: [4.3, 0.125, 1.3], parent: root });+ createPart('Hydro_Spire', cylinderGeo(0.14, 0.28, 0.68, 12), hullDark, { position: [4.3, 0.57, 1.3], parent: root });+ createPart('Hydro_VentGlow', sphereGeo(0.09, 10, 8), amberBeacon, { position: [4.3, 0.92, 1.3], parent: root });++ // Oceanographic Subsea Sensor Tether Cable Connecting Chimney to Station Hull+ const hydroTether = pipeAlongPath([[2.2, 2.2, 1.2], [3.2, 0.3, 1.3], [4.3, 0.15, 1.3]], 0.035, { bendRadius: 0.15 });+ createPart('Hydro_SensorTether', hydroTether, jointBlack, { parent: root });++ // ==========================================+ // 6. EXTERIOR FLOODLIGHTS & UMBILICALS+ // ==========================================++ // Dual Forward Heavy LED Floodlight Pods aimed at seabed sampling+ createPart('Flood_FwdL_Bracket', boxGeo(0.1, 0.1, 0.2), frameworkDark, { position: [2.5, 3.2, 0.85], parent: root });+ createPart('Flood_FwdL_Housing', cylinderGeo(0.16, 0.22, 0.32, 12), hullDark, {+ position: [2.7, 3.1, 0.85],+ rotation: [-22, 15, 0],+ parent: root+ });+ createPart('Flood_FwdL_Lens', cylinderGeo(0.15, 0.15, 0.03, 12), floodLight, {+ position: [2.82, 3.05, 0.88],+ rotation: [-22, 15, 0],+ parent: root+ });++ createPart('Flood_FwdR_Bracket', boxGeo(0.1, 0.1, 0.2), frameworkDark, { position: [2.5, 3.2, -0.85], parent: root });+ createPart('Flood_FwdR_Housing', cylinderGeo(0.16, 0.22, 0.32, 12), hullDark, {+ position: [2.7, 3.1, -0.85],+ rotation: [-22, -15, 0],+ parent: root+ });+ createPart('Flood_FwdR_Lens', cylinderGeo(0.15, 0.15, 0.03, 12), floodLight, {+ position: [2.82, 3.05, -0.88],+ rotation: [-22, -15, 0],+ parent: root+ });++ return root;+}diff --git a/examples/demo-deep-sea-station.provenance.json b/examples/demo-deep-sea-station.provenance.jsonnew file mode 100644index 00000000..e9fcd721--- /dev/null+++ b/examples/demo-deep-sea-station.provenance.json@@ -0,0 +1,54 @@+{+ "sourceHash": "df6b76e688d9d5e6a23da05ed1fdac1a3d2975ca7f573ee00b0638e90edb27e8",+ "model": "Gemini 3.8 Flash",+ "harness": "Antigravity CLI",+ "authoredDate": "2026-09-09",+ "provenance": {+ "attribution": "Recorded demo session; model credit supplied only where the retained run identifies it.",+ "sourceAccess": "See retained demo run; no stronger isolation claim is made.",+ "humanIntervention": "Owner supplied direction; model-authored exported source preserved byte-for-byte.",+ "reviewFidelity": "Authoring feedback and shaded demo previews where available. Not a destination-runtime acceptance claim.",+ "poster": "Gallery GPU render of the exact downloadable GLB. Source, artifact, image hashes and camera settings are recorded alongside the poster.",+ "evaluationGlbHash": "88fbd13ab0430a7cc5f9da278d7f6f56dffa534c2eafae48c4eaa398ab226438",+ "posterReceipt": {+ "captureIdentity": [+ "kiln.capture-producer.v1",+ "sha256:10f346ec6287c8d635dabe4668d72925080e6fe3d059dd7a9252f2694ce595c2",+ "44832275-6b15-4353-8fcb-ac1de3fda8e6",+ "dawn-d3d12:nvidia-geforce-rtx-3070:D3D12 driver version 32.0.16.1074"+ ],+ "sourceHash": "df6b76e688d9d5e6a23da05ed1fdac1a3d2975ca7f573ee00b0638e90edb27e8",+ "artifactHash": "7ad135e644ccdd090fabe355dc68955fd8c8604f0e692d5c67e68c3d638eaa0b",+ "imageHash": "bb4fee4a1d0c870fa152e94a21f5618282a324293e940f318f62d4ae7715ba15",+ "width": 1024,+ "height": 1024,+ "camera": {+ "version": "kiln.camera.v1",+ "projection": "orthographic",+ "position": [+ 35.27249550360228,+ 21.106688794627004,+ 23.899890481837055+ ],+ "target": [+ 0.8993093385576207,+ 4.607559435405568,+ -0.1613398336942046+ ],+ "up": [+ 0,+ 1,+ 0+ ],+ "aspect": 1,+ "near": 0.01,+ "far": 112.71313147339413,+ "halfHeight": 7.3994633756043395+ },+ "rendererId": "dawn-d3d12:nvidia-geforce-rtx-3070:D3D12 driver version 32.0.16.1074",+ "materialFaithful": true,+ "lightingPresetId": "gallery-studio-v1",+ "purpose": "Gallery poster generated from the exact downloadable GLB; separate from authoring feedback."+ }+ }+}diff --git a/examples/demo-diesel-locomotive.kiln.js b/examples/demo-diesel-locomotive.kiln.jsnew file mode 100644index 00000000..6ff2e03f--- /dev/null+++ b/examples/demo-diesel-locomotive.kiln.js@@ -0,0 +1,196 @@+const meta = {name:"RCL 2406 — Red & Cream Diesel",category:"vehicle",role:"vehicle"};+function build(){+const root=createRoot("RCL_2406_Diesel");+const red=gameMaterial(0x173f2c,{metalness:.3,roughness:.36});+const brass=gameMaterial(0xb9954e,{metalness:.85,roughness:.26});+const cream=gameMaterial(0xf1dfb2,{metalness:.15,roughness:.44});+const dark=gameMaterial(0x242b30,{metalness:.6,roughness:.48});+const steel=gameMaterial(0x697278,{metalness:.85,roughness:.28});+const black=gameMaterial(0x10191f,{metalness:.25,roughness:.5});+const glass=gameMaterial(0x244650,{metalness:.55,roughness:.18});+const lamp=gameMaterial(0xffedba,{emissive:0xffd994,emissiveIntensity:.45,roughness:.2});+function box(n,w,h,d,x,y,z,m,p=root){return createPart(n,boxGeo(w,h,d),m,{position:[x,y,z],parent:p});}+function cyl(n,r,h,x,y,z,m,rot=[90,0,0],p=root,seg=32){return createPart(n,cylinderGeo(r,r,h,seg),m,{position:[x,y,z],rotation:rot,parent:p});}+function rod(n,a,b,r,m,p=root){+const av=new THREE.Vector3(...a),bv=new THREE.Vector3(...b),v=bv.clone().sub(av);+const ob=createPart(n,cylinderGeo(r,r,v.length(),10),m,{position:av.clone().add(bv).multiplyScalar(.5).toArray(),parent:p});+ob.quaternion.setFromUnitVectors(new THREE.Vector3(0,1,0),v.normalize());return ob;+}+function pipe(n,pts,r,m,p=root){+const curve=new THREE.CatmullRomCurve3(pts.map(a=>new THREE.Vector3(...a)));+return createPart(n,new THREE.TubeGeometry(curve,Math.max(12,pts.length*5),r,6,false),m,{parent:p});+}+function prism(n,x0,x1,profile,m,p=root){+const v=[],idx=[],N=profile.length; for(const x of [x0,x1])for(const yz of profile)v.push(x,yz[0],yz[1]);+for(let i=1;i<N-1;i++){idx.push(0,i+1,i);idx.push(N,N+i,N+i+1);}+for(let i=0;i<N;i++){let j=(i+1)%N;idx.push(i,j,N+j,i,N+j,N+i);}+const g=new THREE.BufferGeometry();g.setAttribute("position",new THREE.Float32BufferAttribute(v,3));g.setIndex(idx);g.computeVertexNormals();+return createPart(n,g,m,{parent:p});+}+box("Main_sill",16.2,.32,2.9,0,1.56,0,dark);+box("Red_walkway_edge",16.35,.13,3.06,0,1.79,0,red);+box("Walkway_tread",16.25,.065,3.02,0,1.89,0,dark);+prism("Long_hood",-7.25,2.65,[[1.94,-1.06],[3.65,-1.06],[3.91,-.82],[3.91,.82],[3.65,1.06],[1.94,1.06]],red);+for(const s of [-1,1]){+box("Cream_hood_band_"+s,9.91,.42,.028,-2.3,3.06,s*1.077,cream);+box("Lower_cream_pinstripe_"+s,9.91,.055,.028,-2.3,2.77,s*1.079,cream);+for(let i=0;i<10;i++){+const x=-6.78+i*.92;+box("Engine_access_seam_"+s+"_"+i,.018,.70,.018,x,2.34,s*1.079,black);+box("Panel_handle_"+s+"_"+i,.16,.035,.05,x+.38,2.45,s*1.096,steel);+box("Panel_hinge_"+s+"_"+i,.065,.12,.044,x+.06,2.25,s*1.09,dark);+}+for(let j=0;j<3;j++){+let x=-6.37+j*1.07;+box("Radiator_recess_"+s+"_"+j,.9,.59,.034,x,3.5,s*1.08,black);+for(let k=0;k<7;k++)box("Radiator_louver_"+s+"_"+j+"_"+k,.83,.028,.048,x,3.26+k*.073,s*1.108,steel);+}+for(let j=0;j<2;j++){+box("Intake_recess_"+s+"_"+j,.7,.52,.03,1+j*.83,3.52,s*1.08,black);+for(let k=0;k<7;k++)box("Intake_grille_"+s+"_"+j+"_"+k,.025,.46,.045,.73+j*.83+k*.09,3.52,s*1.1,dark);+}+}+prism("Cab_shell",2.65,4.85,[[1.95,-1.43],[3.94,-1.43],[4.38,-1.04],[4.38,1.04],[3.94,1.43],[1.95,1.43]],red);+prism("Cream_cab_roof",2.49,5.00,[[3.99,-1.50],[4.46,-1.08],[4.50,-.8],[4.50,.8],[4.46,1.08],[3.99,1.50]],cream);+for(const s of [-1,1]){+box("Cab_cream_waist_"+s,2.21,.42,.026,3.75,3.06,s*1.447,cream);+box("Cab_window_seal_"+s,1.56,.73,.038,3.77,3.7,s*1.451,black);+box("Cab_side_glass_"+s,1.43,.61,.044,3.77,3.7,s*1.478,glass);+box("Cab_window_mullion_"+s,.055,.65,.057,3.64,3.7,s*1.505,cream);+box("Cab_sill_"+s,1.65,.055,.095,3.77,3.30,s*1.48,cream);+box("Cab_door_seam_"+s,.72,.94,.02,3.92,2.44,s*1.45,dark);+box("Cab_door_panel_"+s,.68,.90,.025,3.92,2.44,s*1.464,red);+box("Cab_door_latch_"+s,.17,.045,.07,4.13,2.71,s*1.5,steel);+}+for(const end of [2.633,4.872]){+for(const s of [-1,1]){+box("Windshield_gasket_"+end+"_"+s,.04,.70,.96,end,3.75,s*.66,black);+box("Windshield_glass_"+end+"_"+s,.055,.58,.84,end+(end>4?.025:-.025),3.75,s*.66,glass);+rod("Wiper_"+end+"_"+s,[end+(end>4?.068:-.068),3.47,s*.35],[end+(end>4?.068:-.068),3.91,s*.8],.013,dark);+}+}+prism("Short_nose",4.84,7.25,[[1.91,-1.06],[2.79,-1.06],[3.02,-.81],[3.02,.81],[2.79,1.06],[1.91,1.06]],red);+for(const s of [-1,1])box("Nose_cream_band_"+s,2.35,.32,.025,6.075,2.66,s*1.078,cream);+box("Front_nose_cream_band",.026,.32,2.13,7.27,2.66,0,cream);+box("Rear_cream_band",.026,.42,2.13,-7.27,3.06,0,cream);+// Roof fans: rings, radial blades, grille bars.+for(let i=0;i<3;i++){+let x=-5.9+i*1.55;+cyl("Fan_shroud_"+i,.61,.11,x,3.96,0,dark,[0,0,0]);+cyl("Fan_recess_"+i,.52,.12,x,3.97,0,black,[0,0,0]);+cyl("Fan_hub_"+i,.11,.15,x,4.02,0,steel,[0,0,0],root,20);+for(let j=0;j<10;j++){+let a=j*Math.PI/5;rod("Fan_radial_grille_"+i+"_"+j,[x+Math.cos(a)*.1,4.053,Math.sin(a)*.1],[x+Math.cos(a)*.56,4.053,Math.sin(a)*.56],.015,steel);+}+for(const r of [.27,.44,.59]){+const t=createPart("Fan_cage_ring_"+i+"_"+r,new THREE.TorusGeometry(r,.014,6,40),steel,{position:[x,4.057,0],rotation:[90,0,0],parent:root});+}+}+box("Exhaust_plinth",.7,.15,.65,-.70,3.98,0,dark);+cyl("Exhaust_stack",.18,.37,-.70,4.18,0,dark,[0,0,0],root,20);+cyl("Exhaust_dark_mouth",.135,.008,-.70,4.37,0,black,[0,0,0],root,20);+for(const s of [-1,1]){+cyl("Horn_"+s,.095,.39,3.16,4.61,s*.25,cream,[0,0,90],root,16);+cyl("Horn_bell_"+s,.14,.035,3.36,4.61,s*.25,dark,[0,0,90],root,20);+rod("Horn_mount_"+s,[3.05,4.44,s*.25],[3.05,4.6,s*.25],.025,dark);+}+rod("Antenna",[4.2,4.47,.15],[4.2,4.94,.15],.014,steel);+// Underbody tank and separate air reservoirs.+prism("Fuel_tank",-2.30,2.05,[[.34,-.85],[.34,.85],[.50,1.13],[1.32,1.13],[1.4,.95],[1.4,-.95],[1.32,-1.13],[.50,-1.13]],dark);+for(const x of [-1.8,1.5])for(const s of [-1,1])box("Tank_strap_"+x+"_"+s,.13,.80,.035,x,.91,s*1.15,steel);+for(const s of [-1,1]){+cyl("Air_reservoir_"+s,.21,2.7,-.1,1.28,s*1.32,dark,[0,0,90]);+cyl("Fuel_cap_"+s,.11,.06,.65,1.19,s*1.19,steel);+pipe("Air_line_"+s,[[-2.6,1.30,s*1.37],[-1.8,1.48,s*1.37],[1.7,1.48,s*1.37],[2.65,1.20,s*1.37]],.032,steel);+}+// Six powered axles, flanges, recessed wheel faces, exposed truck frames.+for(const c of [-4.75,4.75]){+const truck=createPivot(c<0?"Rear_truck":"Front_truck",[c,0,0],root);+box("Truck_cross_bolster",1.1,.30,2.35,0,1.14,0,dark,truck);+cyl("Truck_pivot",.4,.26,0,1.40,0,steel,[0,0,0],truck);+for(const a of [-1.28,0,1.28]){+cyl("Axle_"+a,.125,2.41,a,.59,0,steel,[90,0,0],truck,20);+cyl("Traction_motor_"+a,.27,.96,a+.28,.72,0,dark,[90,0,0],truck,20);+for(const s of [-1,1]){+cyl("Wheel_tread_"+a+"_"+s,.59,.19,a,.59,s*.84,steel,[90,0,0],truck,48);+cyl("Wheel_flange_"+a+"_"+s,.635,.047,a,.59,s*.733,dark,[90,0,0],truck,48);+cyl("Wheel_dished_face_"+a+"_"+s,.46,.032,a,.59,s*.955,dark,[90,0,0],truck,40);+cyl("Wheel_hub_"+a+"_"+s,.20,.11,a,.59,s*1.008,steel,[90,0,0],truck,24);+cyl("Axle_box_round_"+a+"_"+s,.185,.23,a,.59,s*1.16,dark,[90,0,0],truck,24);+box("Axle_box_cover_"+a+"_"+s,.30,.29,.06,a,.59,s*1.31,steel,truck);+for(const dx of [-.10,.10])for(const dy of [-.095,.095])cyl("Axlebox_bolt",.026,.028,a+dx,.59+dy,s*1.358,dark,[90,0,0],truck,8);+for(const dx of [-.43,.43]){+box("Brake_shoe",.12,.32,.19,a+dx,.57,s*.91,dark,truck);+rod("Brake_hanger",[a+dx,.66,s*1.01],[a+dx*.87,1.03,s*1.02],.038,steel,truck);+}+}+}+for(const s of [-1,1]){+box("Truck_upper_frame_"+s,3.55,.18,.24,0,1.06,s*1.18,dark,truck);+box("Truck_lower_tie_"+s,3.22,.105,.16,0,.37,s*1.18,dark,truck);+for(const x of [-.66,.66]){+box("Spring_bottom_seat",.54,.09,.35,x,.64,s*1.2,steel,truck);+box("Spring_upper_seat",.54,.07,.35,x,1.05,s*1.2,steel,truck);+for(const dx of [-.14,.14]){+const pts=[];for(let k=0;k<=64;k++){let a=k/64*Math.PI*12;pts.push([x+dx+.082*Math.cos(a),.70+k/64*.28,s*1.2+.082*Math.sin(a)]);}+pipe("Suspension_coil",pts,.023,steel,truck);+}+rod("Suspension_diagonal",[x-.24,.43,s*1.23],[x+.22,.93,s*1.23],.055,dark,truck);+}+rod("Brake_pull_rod",[-1.69,.79,s*1.37],[1.69,.79,s*1.37],.03,steel,truck);+for(const ax of [-1.28,0,1.28])rod("Brake_cross_link",[ax+.38,.91,s*1.02],[ax+.38,.79,s*1.37],.035,steel,truck);+cyl("Brake_cylinder",.115,.46,.62,1.20,s*1.19,dark,[0,0,90],truck,16);+for(const x of [-1.7,1.7])rod("Frame_end_taper",[x,1.06,s*1.18],[x*.90,.38,s*1.18],.08,dark,truck);+}+}+// End pilots, knuckle couplers, hoses and steps.+for(const e of [-1,1]){+box("Pilot_beam_"+e,.23,.64,2.88,e*8.13,1.16,0,red);+prism("Pilot_plow_"+e,e*8.13-.16,e*8.13+.16,[[.28,-1.30],[.28,1.30],[.94,1.43],[.94,-1.43]],dark);+box("Coupler_shank_"+e,.67,.19,.24,e*8.51,.94,0,steel);+box("Coupler_head_"+e,.30,.28,.40,e*8.85,.96,0,dark);+box("Coupler_knuckle_"+e,.18,.27,.16,e*8.99,.96,.17,steel);+for(const s of [-1,1]){+pipe("Brake_hose_"+e+"_"+s,[[e*8.3,1.28,s*.49],[e*8.53,.99,s*.55],[e*8.49,.56,s*.61],[e*8.30,.58,s*.65]],.042,black);+box("End_marker_housing_"+e+"_"+s,.1,.16,.18,e*7.32,2.23,s*.79,dark);+cyl("End_marker_lens_"+e+"_"+s,.06,.045,e*7.39,2.23,s*.79,lamp,[0,0,90],root,16);+for(let i=0;i<4;i++){+box("Entry_step_"+e+"_"+s,.59,.09,.40,e*(7.63+.07*i),.52+i*.35,s*1.28,steel);+}+rod("Step_outer_stringer_"+e+"_"+s,[e*7.9,.44,s*1.49],[e*7.6,1.88,s*1.49],.047,dark);+}+for(const y of [2.92,3.17]){+cyl("Headlight_bezel_"+e+"_"+y,.135,.09,e*(e>0?4.94:7.34),e>0?y+.89:y+.33,0,steel,[0,0,90]);+cyl("Headlight_lens_"+e+"_"+y,.102,.10,e*(e>0?4.97:7.37),e>0?y+.89:y+.33,0,lamp,[0,0,90]);+}+}+// Safety rails: side walkways and end returns.+for(const s of [-1,1]){+for(const range of [[-7.85,2.5],[5.1,7.9]]){+rod("Cream_top_handrail",[range[0],2.79,s*1.43],[range[1],2.79,s*1.43],.032,brass);+const count=Math.ceil((range[1]-range[0])/1.4);+for(let i=0;i<=count;i++){+let x=range[0]+(range[1]-range[0])*i/count;+rod("Handrail_stanchion",[x,1.91,s*1.43],[x,2.79,s*1.43],.028,brass);+box("Stanchion_foot",.09,.10,.09,x,1.96,s*1.43,dark);+}+}+for(const e of [-1,1]){+rod("End_handrail",[e*7.91,2.79,s*1.43],[e*7.91,2.79,s*.40],.032,brass);+rod("End_gate_upright",[e*7.91,1.93,s*.4],[e*7.91,2.79,s*.4],.03,brass);+}+}+// Crisp geometry-based road numbers.+const glyphs={"2":[0,1,6,4,3],"4":[5,6,1,2],"0":[0,1,2,3,4,5],"6":[0,5,6,4,3,2]};+function number(s){+const str="2406",sz=.30,base=-1.43;+for(let i=0;i<4;i++){let x=base+i*.39;for(const a of glyphs[str[i]]){+const xy=[[0,.2],[.1,.1],[.1,-.1],[0,-.2],[-.1,-.1],[-.1,.1],[0,0]][a];+box("Road_number_"+s+"_"+i+"_"+a,a===0||a===3||a===6?.19:.038,a===0||a===3||a===6?.035:.18,.018,x+xy[0],3.48+xy[1],s*1.087,cream);+}}+}+number(-1);number(1);+const nameCounts={};root.traverse(o=>{const n=o.name||"Part";nameCounts[n]=(nameCounts[n]||0)+1;if(nameCounts[n]>1)o.name=n+"_"+nameCounts[n];});+root.position.y=.045;+return root;+}\ No newline at end of filediff --git a/examples/demo-diesel-locomotive.provenance.json b/examples/demo-diesel-locomotive.provenance.jsonnew file mode 100644index 00000000..ec0a80be--- /dev/null+++ b/examples/demo-diesel-locomotive.provenance.json@@ -0,0 +1,54 @@+{+ "sourceHash": "483aef3d91f13d831e9c964dcd059957ee26b4c230b92cf2feb26d684e548378",+ "model": "GPT-6 Astra",+ "harness": "ChatGPT Work",+ "authoredDate": "2026-09-09",+ "provenance": {+ "attribution": "Recorded demo session; model credit supplied only where the retained run identifies it.",+ "sourceAccess": "See retained demo run; no stronger isolation claim is made.",+ "humanIntervention": "Owner supplied direction; model-authored exported source preserved byte-for-byte.",+ "reviewFidelity": "Authoring feedback and shaded demo previews where available. Not a destination-runtime acceptance claim.",+ "poster": "Gallery GPU render of the exact downloadable GLB. Source, artifact, image hashes and camera settings are recorded alongside the poster.",+ "evaluationGlbHash": "a7b0358ed65288a49b6cd010f4d4a5155cb2b38453637fb9eb1f645f83d28641",+ "posterReceipt": {+ "captureIdentity": [+ "kiln.capture-producer.v1",+ "sha256:10f346ec6287c8d635dabe4668d72925080e6fe3d059dd7a9252f2694ce595c2",+ "44832275-6b15-4353-8fcb-ac1de3fda8e6",+ "dawn-d3d12:nvidia-geforce-rtx-3070:D3D12 driver version 32.0.16.1074"+ ],+ "sourceHash": "483aef3d91f13d831e9c964dcd059957ee26b4c230b92cf2feb26d684e548378",+ "artifactHash": "ef8dc0e9f79e844a821b100d6d8179e9968433dd1ea586d0097543f52cf9e005",+ "imageHash": "46d42224eeab3807c6ab7e0d6eab4cf2907e669eb1ef6b1c46fc0e76cc165a0b",+ "width": 1024,+ "height": 1024,+ "camera": {+ "version": "kiln.camera.v1",+ "projection": "orthographic",+ "position": [+ 29.25508602592375,+ 15.960803762776607,+ 20.478560218146622+ ],+ "target": [+ 0.16018717529982987,+ 1.9952523144771264,+ 0.11213102270988089+ ],+ "up": [+ 0,+ 1,+ 0+ ],+ "aspect": 1,+ "near": 0.01,+ "far": 95.40509697324467,+ "halfHeight": 6.654457140245812+ },+ "rendererId": "dawn-d3d12:nvidia-geforce-rtx-3070:D3D12 driver version 32.0.16.1074",+ "materialFaithful": true,+ "lightingPresetId": "gallery-studio-v1",+ "purpose": "Gallery poster generated from the exact downloadable GLB; separate from authoring feedback."+ }+ }+}diff --git a/examples/demo-floating-observatory.kiln.js b/examples/demo-floating-observatory.kiln.jsnew file mode 100644index 00000000..91b1fdb7--- /dev/null+++ b/examples/demo-floating-observatory.kiln.js@@ -0,0 +1,208 @@+const meta = {name:'AETHER REACH — Floating Observatory',category:'environment',role:'poi'};+function build(){+ const root=createRoot('AetherReach');+ const P={ground:4.05,towerX:-0.55,deck:7.45,steps:42,turn:Math.PI*2.15};+ const stone=gameMaterial(0xd3c9ab,{roughness:0.86});+ const trim=gameMaterial(0xeee0bc,{roughness:0.72});+ const rockM=[0x394652,0x45545e,0x52616b,0x657078].map(c=>gameMaterial(c,{roughness:1,flatShading:true}));+ const grass=gameMaterial(0x557b65,{roughness:1});+ const moss=gameMaterial(0x789273,{roughness:1});+ const teal=gameMaterial(0x276b70,{metalness:0.5,roughness:0.43});+ const brass=gameMaterial(0xc99b4e,{metalness:0.78,roughness:0.25});+ const darkBrass=gameMaterial(0x806138,{metalness:0.7,roughness:0.42});+ const dark=gameMaterial(0x23363d,{roughness:0.6});+ const wood=gameMaterial(0x795942,{roughness:0.85});+ const glass=gameMaterial(0x358a9a,{metalness:0.5,roughness:0.16,emissive:0x123e50,emissiveIntensity:0.28});+ const crystal=gameMaterial(0xb16af0,{metalness:0.18,roughness:0.28,emissive:0x9738ed,emissiveIntensity:1.65});+ function part(n,g,m,p=[0,0,0],par=root){return createPart(n,g,m,{position:p,parent:par});}+ function group(n,p=[0,0,0],par=root){const g=new THREE.Group();g.name=n;g.position.set(...p);par.add(g);return g;}+ function cyl(n,r1,r2,h,m,p,par=root){return part(n,new THREE.CylinderGeometry(r1,r2,h,32),m,p,par);}+ function rod(n,a,b,r,m,par=root){const v=new THREE.Vector3(...a),w=new THREE.Vector3(...b);const d=w.clone().sub(v);const o=part(n,new THREE.CylinderGeometry(r,r,d.length(),8),m,v.add(w).multiplyScalar(0.5).toArray(),par);o.quaternion.setFromUnitVectors(new THREE.Vector3(0,1,0),d.normalize());return o;}+ function curve(n,pts,r,m,par=root){return part(n,new THREE.TubeGeometry(new THREE.CatmullRomCurve3(pts.map(p=>new THREE.Vector3(...p))),Math.max(12,pts.length*2),r,6,false),m,[0,0,0],par);}+ function ring(n,r,t,y,m,par=root){const o=part(n,new THREE.TorusGeometry(r,t,8,72),m,[0,y,0],par);o.rotation.x=Math.PI/2;return o;}+ function sector(n,ri,ro,a,b,y,h,m,par=root){+ const vs=[],ids=[],N=6;+ for(let k=0;k<2;k++)for(let r of [ri,ro])for(let j=0;j<=N;j++){const t=a+(b-a)*j/N;vs.push(r*Math.cos(t),y+k*h,r*Math.sin(t));}+ const L=N+1;function quad(a,b,c,d){ids.push(a,b,c,a,c,d);}+ for(let j=0;j<N;j++){quad(j,j+1,L+j+1,L+j);quad(2*L+j,3*L+j,3*L+j+1,2*L+j+1);quad(j,2*L+j,2*L+j+1,j+1);quad(L+j,L+j+1,3*L+j+1,3*L+j);}+ quad(0,L,3*L,2*L);quad(N,2*L+N,3*L+N,L+N);+ return part(n,meshGeo({positions:vs,indices:ids}),m,[0,0,0],par);+ }+ // A deterministic, jagged inverted mountain. Each belt shares its boundary.+ const island=group('FloatingIsland');+ const count=15;+ const rings=[{y:0.12,r:0.18,dx:0.5,dz:0.1},{y:1.2,r:1.5,dx:0.3,dz:0.1},{y:2.6,r:3.05,dx:0.1,dz:0},{y:3.65,r:4.25,dx:0,dz:0},{y:4.02,r:4.05,dx:0,dz:0}];+ const vertices=rings.map((q,k)=>Array.from({length:count},(_,i)=>{const a=i/count*Math.PI*2;const f=1+0.11*Math.sin(i*7.13)+0.055*Math.cos(i*3.8);return [q.dx+q.r*f*Math.cos(a),q.y+(k===4?0:0.19*Math.sin(i*2.31+k)),q.dz+q.r*f*Math.sin(a)*0.88];}));+ for(let k=0;k<rings.length-1;k++){+ let v=[],idx=[];for(let i=0;i<count;i++){let j=(i+1)%count;let p=[vertices[k][i],vertices[k+1][i],vertices[k+1][j],vertices[k][j]];let o=v.length/3;v.push(...p.flat());idx.push(o,o+1,o+2,o,o+2,o+3);}+ const geo=meshGeo({positions:v,indices:idx}).toNonIndexed();geo.computeVertexNormals();part('CragBelt_'+k,geo,rockM[k], [0,0,0],island);+ }+ const capV=[0,4.025,0,...vertices[4].flat()],capI=[];+ for(let i=0;i<count;i++)capI.push(0,1+(i+1)%count,1+i);+ part('MeadowCrown',meshGeo({positions:capV,indices:capI}),grass,[0,0,0],island);+ for(let i=0;i<9;i++){+ const a=i*2.399,r=2.5+(i%3)*0.4;+ const o=part('RimStone_'+i,new THREE.DodecahedronGeometry(0.35+(i%3)*0.13,0),rockM[i%4],[Math.cos(a)*r,3.97,Math.sin(a)*r*0.9],island);o.scale.set(1.3,0.65,1);o.rotation.y=a;+ }+ const crystalCore=gameMaterial(0xe0afff,{metalness:0.1,roughness:0.28,emissive:0xbb62ff,emissiveIntensity:2.3});+ const crystalShade=gameMaterial(0x743bb8,{metalness:0.2,roughness:0.35,emissive:0x7621d1,emissiveIntensity:0.85});+ const gems=group('GlowingPurpleCrystalClusters',[0,0,0],island);+ function shard(n,top,bottom,r,m){+ const delta=new THREE.Vector3(...top).sub(new THREE.Vector3(...bottom)),len=delta.length(),vs=[],ids=[];+ const profiles=[[0,0.01],[0.26,r],[len*0.82,r*0.9],[len,r*0.3]];+ for(const q of profiles)for(let j=0;j<6;j++){const a=j*Math.PI/3;vs.push(Math.cos(a)*q[1],q[0],Math.sin(a)*q[1]);}+ for(let k=0;k<3;k++)for(let j=0;j<6;j++){const a=k*6+j,b=k*6+(j+1)%6;ids.push(a,b,b+6,a,b+6,a+6);}+ for(let j=1;j<5;j++){ids.push(0,j+1,j);ids.push(18,18+j,19+j);}+ const o=part(n,meshGeo({positions:vs,indices:ids}).toNonIndexed(),m,bottom,gems);+ o.quaternion.setFromUnitVectors(new THREE.Vector3(0,1,0),delta.normalize());+ }+ for(let i=0;i<7;i++){+ const a=i*2.4,r=2.45+(i%3)*0.26,y=2.95+(i%3)*0.17;+ const top=[Math.cos(a)*r,y,Math.sin(a)*r*0.88];+ const tip=[Math.cos(a)*(r+0.25),y-1.85-(i%3)*0.32,Math.sin(a)*(r+0.25)*0.88];+ shard('AmethystMain_'+i,top,tip,0.25+(i%2)*0.08,crystal);+ for(let j of [-1,1]){+ const b=a+j*0.17,rt=r+0.17;+ shard('AmethystCompanion_'+i+'_'+j,[Math.cos(b)*rt,y-0.02,Math.sin(b)*rt*0.88],+ [Math.cos(b)*(rt+0.24),y-1.12-0.2*(i%2),Math.sin(b)*(rt+0.24)*0.88],0.15,j===1?crystalCore:crystalShade);+ }+ }+ for(let i=0;i<3;i++){+ const a=[0.1,2.8,4.7][i],r=4.6;+ const o=part('DriftingSatellite_'+i,new THREE.DodecahedronGeometry(0.45+i*0.09,0),rockM[1],[Math.cos(a)*r,2.5-i*0.6,Math.sin(a)*r*0.85]);o.scale.set(1,1.4,0.8);o.rotation.set(0.3,i,0.4);+ }+ const tower=group('ObservatoryTower',[P.towerX,0,0]);+ cyl('Foundation',1.4,1.55,0.24,rockM[2],[0,P.ground+0.1,0],tower);+ cyl('MasonryCore',1.03,1.12,3.13,stone,[0,5.73,0],tower);+ for(let row=0;row<7;row++){+ ring('CourseJoint_'+row,1.08,0.016,4.37+row*0.41,darkBrass,tower);+ for(let j=0;j<12;j++){const a=(j+(row%2)*0.5)/12*Math.PI*2;rod('MasonrySeam_'+row+'_'+j,[1.082*Math.cos(a),4.39+row*0.41,1.082*Math.sin(a)],[1.082*Math.cos(a),4.76+row*0.41,1.082*Math.sin(a)],0.009,darkBrass,tower);}+ }+ // Narrow brass-framed windows on the tower.+ for(let i=0;i<4;i++){+ const a=i*Math.PI/2+0.3,g=group('TowerWindow_'+i,[1.085*Math.cos(a),5.65,1.085*Math.sin(a)],tower);g.rotation.y=Math.PI/2-a;+ part('WindowFrame_'+i,new THREE.BoxGeometry(0.36,0.85,0.085),brass,[0,0,0],g);+ part('WindowGlass_'+i,new THREE.BoxGeometry(0.27,0.71,0.095),dark,[0,0,0.008],g);+ rod('WindowMullion_'+i,[0,-0.36,0.065],[0,0.36,0.065],0.018,brass,g);+ }+ const stairs=group('SpiralStaircase',[P.towerX,0,0]);+ const start=-Math.PI/2,stepRise=(P.deck-P.ground)/P.steps;+ for(let i=0;i<P.steps;i++){+ const a=start+i*P.turn/P.steps,b=start+(i+1)*P.turn/P.steps;+ const y=P.ground+i*stepRise;+ sector('StoneTread_'+String(i+1).padStart(2,'0'),1.12,2.03,a,b-0.012,y,0.095,trim,stairs);+ sector('BrassTreadNosing_'+i,1.14,2.025,b-0.04,b-0.015,y+0.096,0.012,darkBrass,stairs);+ const mid=(a+b)/2;+ if(i%2===0)rod('StairBaluster_'+i,[2.01*Math.cos(mid),y+0.1,2.01*Math.sin(mid)],[2.01*Math.cos(mid),y+0.9,2.01*Math.sin(mid)],0.025,brass,stairs);+ }+ let rail=[],stringer=[];+ for(let i=0;i<=168;i++){let f=i/168,a=start+f*P.turn;rail.push([2.01*Math.cos(a),P.ground+f*(P.deck-P.ground)+0.87,2.01*Math.sin(a)]);stringer.push([1.91*Math.cos(a),P.ground+f*(P.deck-P.ground)-0.06,1.91*Math.sin(a)]);}+ curve('ContinuousSpiralHandrail',rail,0.045,brass,stairs);+ curve('SpiralOuterStringer',stringer,0.065,teal,stairs);+ cyl('TerraceCentralDais',1.12,1.12,0.18,trim,[0,P.deck-0.02,0],tower);+ cyl('TerraceDaisSurface',1.12,1.12,0.045,wood,[0,P.deck+0.09,0],tower);+ const exit=start+P.turn;+ for(let k=0;k<20;k++){+ const a=exit+(3.1+Math.PI*2-exit)*k/20,b=exit+(3.1+Math.PI*2-exit)*(k+1)/20;+ sector('TerraceSlabPanel_'+k,1.1,2.12,a,b,P.deck-0.11,0.18,trim,tower);+ sector('TerraceDeckPanel_'+k,1.1,2.05,a,b,P.deck+0.068,0.045,wood,tower);+ }+ const innerRail=[];+ for(let k=0;k<=36;k++){const a=3.1+(exit-3.1)*k/36;innerRail.push([1.1*Math.cos(a),P.deck+0.78,1.1*Math.sin(a)]);if(k%6===0)rod('StairwellDaisPost_'+k,[1.1*Math.cos(a),P.deck+0.12,1.1*Math.sin(a)],[1.1*Math.cos(a),P.deck+0.78,1.1*Math.sin(a)],0.023,brass,tower);}+ curve('StairwellDaisGuard',innerRail,0.035,brass,tower);+ ring('TerraceBrassRim',2.1,0.045,P.deck+0.075,brass,tower);+ // Roof is an open half-dome, leaving the instrument visible from the front.+ const roof=group('OpenObservatoryDome',[0,P.deck+0.18,0],tower);+ const dome=part('PatinatedCopperHalfDome',new THREE.SphereGeometry(1.98,32,16,-Math.PI/2,Math.PI,0,Math.PI/2),teal,[0,0,0],roof);+ dome.material.side=THREE.DoubleSide;+ for(let j=0;j<=8;j++){+ const phi=-Math.PI/2+j*Math.PI/8,pts=[];+ for(let k=0;k<=24;k++){const t=k/24*Math.PI/2;pts.push([-2*Math.cos(phi)*Math.sin(t),2*Math.cos(t),2*Math.sin(phi)*Math.sin(t)]);}+ curve('DomeMeridian_'+j,pts,0.024,brass,roof);+ }+ const rim=[];for(let i=0;i<=48;i++){const a=Math.PI/2+i/48*Math.PI;rim.push([1.99*Math.cos(a),0,1.99*Math.sin(a)]);}curve('DomeLowerRim',rim,0.065,brass,roof);+ cyl('DomeFinialFoot',0.16,0.2,0.12,brass,[0,2.05,0],roof);+ part('DomeFinial',new THREE.SphereGeometry(0.11,12,8),brass,[0,2.2,0],roof);+ // Partial terrace guard, with a gap where the last stair arrives.+ for(let j=0;j<18;j++){+ const a=-1.32+j*2.64/17;if(a> -1.17&&a< -0.78)continue;+ rod('TerraceBaluster_'+j,[2.035*Math.cos(a),P.deck+0.12,2.035*Math.sin(a)],[2.035*Math.cos(a),P.deck+0.69,2.035*Math.sin(a)],0.026,brass,tower);+ }+ for(const interval of [[-1.42,-1.19],[-0.76,1.42]]){const pts=[];for(let k=0;k<=30;k++){const a=interval[0]+(interval[1]-interval[0])*k/30;pts.push([2.035*Math.cos(a),P.deck+0.7,2.035*Math.sin(a)]);}curve('TerraceGuard_'+interval[0],pts,0.042,brass,tower);}+ const telescope=group('BrassTelescope',[0.18,P.deck+0.12,0],tower);+ cyl('AzimuthBase',0.52,0.64,0.13,darkBrass,[0,0.08,0],telescope);+ cyl('AzimuthDial',0.54,0.54,0.08,brass,[0,0.18,0],telescope);+ cyl('TelescopePier',0.18,0.28,0.88,teal,[0,0.64,0],telescope);+ for(let z of [-0.36,0.36]){rod('MountFork_'+z,[0,0.87,z],[0,1.18,z],0.07,brass,telescope);}+ rod('ElevationAxle',[0,1.18,-0.5],[0,1.18,0.5],0.085,darkBrass,telescope);+ const tube=group('TiltingOpticalTube',[0,1.18,0],telescope);tube.rotation.z=0.43;+ function barrel(n,x,len,r1,r2,m){const o=cyl(n,r1,r2,len,m,[x,0,0],tube);o.rotation.z=-Math.PI/2;return o;}+ barrel('BrassMainBarrel',0.14,2.22,0.27,0.21,brass);+ barrel('ForwardDewShield',1.39,0.52,0.36,0.29,brass);+ barrel('ObjectiveDarkRecess',1.654,0.01,0.305,0.305,dark);+ barrel('ObjectiveBlueLens',1.662,0.009,0.26,0.26,glass);+ barrel('RearFocuser',-1.11,0.36,0.13,0.17,darkBrass);+ barrel('Eyepiece',-1.38,0.18,0.095,0.095,brass);+ barrel('Eyecup',-1.49,0.07,0.11,0.11,dark);+ for(let x of [-0.78,0.04,0.79,1.16,1.62]){const o=part('BarrelCollar_'+x,new THREE.TorusGeometry(x>1?0.345:0.27,0.032,8,40),darkBrass,[x,0,0],tube);o.rotation.y=Math.PI/2;}+ rod('FinderBracketA',[-0.3,0.2,0],[-0.3,0.43,0],0.035,brass,tube);+ rod('FinderBracketB',[0.35,0.2,0],[0.35,0.43,0],0.035,brass,tube);+ const finder=cyl('FinderScope',0.075,0.075,0.95,brass,[0.08,0.44,0],tube);finder.rotation.z=-Math.PI/2;+ const wheel=part('ElevationHandwheel',new THREE.TorusGeometry(0.21,0.024,8,32),brass,[0,1.18,0.54],telescope);+ for(let i=0;i<4;i++){const a=i*Math.PI/2;rod('HandwheelSpoke_'+i,[0,1.18,0.54],[Math.cos(a)*0.2,1.18+Math.sin(a)*0.2,0.54],0.016,brass,telescope);}+ // Entrance path, low plant clumps, and warm beacon lanterns.+ for(let i=0;i<7;i++){const a=-Math.PI/2-0.36+i*0.075,r=3.6-i*0.23;const o=cyl('ApproachPaver_'+i,0.3,0.34,0.08,stone,[P.towerX+Math.cos(a)*r,4.07,Math.sin(a)*r]);o.scale.z=0.72;o.rotation.y=a;}+ for(let i=0;i<12;i++){+ const a=i*2.399,r=2.75+(i%3)*0.32;+ for(let j=0;j<3;j++){const o=part('GrassTuft_'+i+'_'+j,new THREE.ConeGeometry(0.09,0.34+j*0.08,4),j%2?moss:grass,[Math.cos(a)*r+j*0.08,4.18,Math.sin(a)*r*0.85]);o.rotation.z=(j-1)*0.3;}+ }+ for(let i=0;i<2;i++){+ const x=1.75,z=i?1.95:-2.05;const g=group('BeaconLantern_'+i,[x,4.07,z]);+ cyl('BeaconFoot_'+i,0.19,0.28,0.12,darkBrass,[0,0.06,0],g);+ rod('BeaconPost_'+i,[0,0.1,0],[0,0.89,0],0.055,brass,g);+ cyl('BeaconLight_'+i,0.12,0.12,0.28,gameMaterial(0xffd68b,{emissive:0xffab45,emissiveIntensity:0.7}),[0,1.02,0],g);+ part('BeaconCap_'+i,new THREE.ConeGeometry(0.23,0.17,8),teal,[0,1.25,0],g);+ }+ // Spring-fed waterfall: a shallow pool joins a continuous fluted curtain.+ const water=gameMaterial(0x42c6df,{metalness:0.15,roughness:0.22,emissive:0x0c556d,emissiveIntensity:0.22});+ const waterLight=gameMaterial(0xa0eeef,{roughness:0.3,emissive:0x398ca3,emissiveIntensity:0.3});+ const foam=gameMaterial(0xe5fcf8,{roughness:0.65,emissive:0x77b5cc,emissiveIntensity:0.2});+ const falls=group('IslandWaterfall');+ const pool=cyl('SpringPool',0.68,0.65,0.055,water,[2.18,4.073,0.65],falls);pool.scale.z=0.7;+ const course=new THREE.CatmullRomCurve3([+ new THREE.Vector3(2.18,4.11,0.65),new THREE.Vector3(2.85,4.105,0.92),+ new THREE.Vector3(3.55,4.1,1.19),new THREE.Vector3(4.03,4.055,1.34),+ new THREE.Vector3(4.37,3.73,1.46),new THREE.Vector3(4.51,2.8,1.51),+ new THREE.Vector3(4.63,1.5,1.55),new THREE.Vector3(4.76,0.15,1.59),+ new THREE.Vector3(4.85,-1.1,1.62)+ ]);+ const side=new THREE.Vector3(-0.316,0,0.949);+ function waterPoint(t,u){const c=course.getPoint(t),tan=course.getTangent(t).normalize();+ const normal=new THREE.Vector3().crossVectors(side,tan).normalize();+ const width=(0.79+0.12*Math.sin(t*Math.PI))*(1-0.43*Math.pow(t,5));+ c.addScaledVector(side,u*width).addScaledVector(normal,0.018*Math.sin(t*52+u*16)+0.012*Math.sin(t*24-u*35));+ return c;+ }+ const wv=[],wi=[],rows=90,cols=12;+ for(let i=0;i<=rows;i++)for(let j=0;j<=cols;j++){wv.push(...waterPoint(i/rows,j/cols-0.5).toArray());}+ for(let i=0;i<rows;i++)for(let j=0;j<cols;j++){const a=i*(cols+1)+j,b=a+cols+1;wi.push(a,a+1,b+1,a,b+1,b);}+ water.side=THREE.DoubleSide;+ part('ContinuousWaterCurtain',meshGeo({positions:wv,indices:wi}),water,[0,0,0],falls);+ for(let j=0;j<7;j++){const pts=[];const begin=j%2?0.25:0.06,end=0.89+0.015*(j%4);+ for(let k=0;k<=62;k++){const t=begin+(end-begin)*k/62,p=waterPoint(t,(j-3)*0.136);+ const n=new THREE.Vector3().crossVectors(side,course.getTangent(t)).normalize();p.addScaledVector(n,0.019);pts.push(p.toArray());}+ curve('WhitewaterRibbon_'+j,pts,j%3===0?0.023:0.012,j%3===0?foam:waterLight,falls);+ }+ for(let i=0;i<9;i++){+ const t=0.36+0.045*Math.sin(i*2.3),p=waterPoint(t,(i-4)*0.12);+ const o=part('SpillLipFoam_'+i,new THREE.IcosahedronGeometry(0.065+(i%3)*0.018,1),foam,p.toArray(),falls);o.scale.set(1.2,0.48,1);+ }+ for(let i=0;i<14;i++){+ const t=0.57+(i%7)*0.067,p=waterPoint(t,(i%2?1:-1)*(0.6+0.06*(i%3)));+ p.y-=0.08*(i%3);+ const o=part('WaterfallSprayDroplet_'+i,new THREE.IcosahedronGeometry(0.035+(i%3)*0.015,1),i%3?waterLight:foam,p.toArray(),falls);o.scale.y=1.8;+ }+ for(let i=0;i<6;i++){const a=1.25+i*0.68;+ const o=part('SpringBankStone_'+i,new THREE.DodecahedronGeometry(0.14+(i%2)*0.035,0),rockM[2],[2.18+Math.cos(a)*0.67,4.1,0.65+Math.sin(a)*0.48],falls);o.scale.y=0.65;}+ return root;+}\ No newline at end of filediff --git a/examples/demo-floating-observatory.provenance.json b/examples/demo-floating-observatory.provenance.jsonnew file mode 100644index 00000000..b4ccaf57--- /dev/null+++ b/examples/demo-floating-observatory.provenance.json@@ -0,0 +1,54 @@+{+ "sourceHash": "331508e4cd10ff4c9329fc3b5adfea6a9e346424cf53bfa48ee185d170bcdb68",+ "model": "GPT-6 Astra",+ "harness": "ChatGPT Work",+ "authoredDate": "2026-09-09",+ "provenance": {+ "attribution": "Recorded demo session; model credit supplied only where the retained run identifies it.",+ "sourceAccess": "See retained demo run; no stronger isolation claim is made.",+ "humanIntervention": "Owner supplied direction; model-authored exported source preserved byte-for-byte.",+ "reviewFidelity": "Authoring feedback and shaded demo previews where available. Not a destination-runtime acceptance claim.",+ "poster": "Gallery GPU render of the exact downloadable GLB. Source, artifact, image hashes and camera settings are recorded alongside the poster.",+ "evaluationGlbHash": "69a12844992a22c8567407a7081700d93fb8a5ab711412cd58005a80d2b4a20d",+ "posterReceipt": {+ "captureIdentity": [+ "kiln.capture-producer.v1",+ "sha256:10f346ec6287c8d635dabe4668d72925080e6fe3d059dd7a9252f2694ce595c2",+ "44832275-6b15-4353-8fcb-ac1de3fda8e6",+ "dawn-d3d12:nvidia-geforce-rtx-3070:D3D12 driver version 32.0.16.1074"+ ],+ "sourceHash": "331508e4cd10ff4c9329fc3b5adfea6a9e346424cf53bfa48ee185d170bcdb68",+ "artifactHash": "719e74b5adcbfc4cbeea8e6fe8a8c66da17992e4f40dacfbd301a7728ad7256c",+ "imageHash": "689c7a16947bc05113adeba69f7870e47c9d0fb344df0a44a900340be381b1a1",+ "width": 1024,+ "height": 1024,+ "camera": {+ "version": "kiln.camera.v1",+ "projection": "orthographic",+ "position": [+ 26.601194231782966,+ 16.357877422376035,+ 18.857499361632435+ ],+ "target": [+ -0.06345497744625134,+ 3.558845801946009,+ 0.1922449151719859+ ],+ "up": [+ 0,+ 1,+ 0+ ],+ "aspect": 1,+ "near": 0.01,+ "far": 87.43606419204005,+ "halfHeight": 6.868151089189696+ },+ "rendererId": "dawn-d3d12:nvidia-geforce-rtx-3070:D3D12 driver version 32.0.16.1074",+ "materialFaithful": true,+ "lightingPresetId": "gallery-studio-v1",+ "purpose": "Gallery poster generated from the exact downloadable GLB; separate from authoring feedback."+ }+ }+}diff --git a/examples/demo-greywatch-stylized-aircraft-carrier.kiln.js b/examples/demo-greywatch-stylized-aircraft-carrier.kiln.jsnew file mode 100644index 00000000..37b2bfc0--- /dev/null+++ b/examples/demo-greywatch-stylized-aircraft-carrier.kiln.js@@ -0,0 +1,332 @@++const meta = {+ name: 'Greywatch Stylized Aircraft Carrier',+ category: 'vehicle',+ role: 'vehicle'+};++function hullGeometry() {+ const stations = [+ { x: -10.6, w: 1.65, top: 2.08, shoulder: 1.62, bottom: 0.72 },+ { x: -9.2, w: 2.55, top: 2.12, shoulder: 1.55, bottom: 0.48 },+ { x: -5.8, w: 2.92, top: 2.14, shoulder: 1.48, bottom: 0.34 },+ { x: 0.0, w: 3.02, top: 2.16, shoulder: 1.44, bottom: 0.28 },+ { x: 5.5, w: 2.72, top: 2.12, shoulder: 1.50, bottom: 0.42 },+ { x: 8.6, w: 1.72, top: 2.02, shoulder: 1.52, bottom: 0.62 },+ { x: 10.5, w: 0.22, top: 1.72, shoulder: 1.38, bottom: 0.92 }+ ];+ const positions = [];+ const indices = [];+ for (const s of stations) {+ const w = s.w;+ const ring = [+ [s.x, s.top, -w * 0.82],+ [s.x, s.top, w * 0.82],+ [s.x, s.shoulder, w],+ [s.x, s.bottom + 0.32, w * 0.68],+ [s.x, s.bottom, w * 0.24],+ [s.x, s.bottom, -w * 0.24],+ [s.x, s.bottom + 0.32, -w * 0.68],+ [s.x, s.shoulder, -w]+ ];+ for (const p of ring) positions.push(...p);+ }+ const n = 8;+ for (let i = 0; i < stations.length - 1; i++) {+ for (let j = 0; j < n; j++) {+ const a = i * n + j;+ const b = i * n + (j + 1) % n;+ const c = (i + 1) * n + (j + 1) % n;+ const d = (i + 1) * n + j;+ indices.push(a, b, c, a, c, d);+ }+ }+ for (let j = 1; j < n - 1; j++) indices.push(0, j, j + 1);+ const last = (stations.length - 1) * n;+ for (let j = 1; j < n - 1; j++) indices.push(last, last + j + 1, last + j);+ return meshGeo({ positions, indices });+}++function addStrip(parent, name, length, width, position, rotationY, material, height) {+ return createPart(name, boxGeo(length, height || 0.025, width), material, {+ position, rotation: [0, rotationY || 0, 0], parent+ });+}++function addRail(parent, name, x, z, len, alongX, material, y) {+ const rail = createPart(name, cylinderGeo(0.022, 0.022, len, 8), material, {+ position: [x, y || 2.72, z],+ rotation: alongX ? [0, 0, 90] : [90, 0, 0],+ parent+ });+ return rail;+}++function addJet(parent, id, x, z, heading, mats, wingGeo) {+ const jet = createPivot('Jet_' + id, [x, 2.55, z], parent);+ jet.rotation.y = heading * Math.PI / 180;++ createPart('Jet_' + id + '_Fuselage', cylinderGeo(0.09, 0.12, 0.88, 10), mats.jet, {+ position: [0, 0.10, 0], rotation: [0, 0, -90], parent: jet+ });+ createPart('Jet_' + id + '_Nose', cylinderGeo(0.0, 0.09, 0.34, 10), mats.jetLight, {+ position: [0.61, 0.10, 0], rotation: [0, 0, -90], parent: jet+ });+ createPart('Jet_' + id + '_TailBody', cylinderGeo(0.095, 0.07, 0.28, 10), mats.jet, {+ position: [-0.56, 0.10, 0], rotation: [0, 0, -90], parent: jet+ });+ createPart('Jet_' + id + '_Cockpit', sphereGeo(0.12, 10, 6), mats.glass, {+ position: [0.22, 0.19, 0], scale: [1.45, 0.62, 0.62], parent: jet+ });+ createPart('Jet_' + id + '_InnerWings', wingGeo, mats.jet, {+ position: [-0.04, 0.10, 0], parent: jet+ });+ createPart('Jet_' + id + '_FoldedWingPort', boxGeo(0.34, 0.045, 0.30), mats.jetLight, {+ position: [-0.09, 0.22, -0.39], rotation: [-68, 0, -8], parent: jet+ });+ createPart('Jet_' + id + '_FoldedWingStarboard', boxGeo(0.34, 0.045, 0.30), mats.jetLight, {+ position: [-0.09, 0.22, 0.39], rotation: [68, 0, 8], parent: jet+ });+ createPart('Jet_' + id + '_PortTailplane', boxGeo(0.28, 0.035, 0.24), mats.jetLight, {+ position: [-0.49, 0.12, -0.16], rotation: [0, 8, 0], parent: jet+ });+ createPart('Jet_' + id + '_StarboardTailplane', boxGeo(0.28, 0.035, 0.24), mats.jetLight, {+ position: [-0.49, 0.12, 0.16], rotation: [0, -8, 0], parent: jet+ });+ createPart('Jet_' + id + '_TailFin', boxGeo(0.24, 0.22, 0.035), mats.jetLight, {+ position: [-0.47, 0.23, 0], rotation: [0, 0, -20], parent: jet+ });+ createPart('Jet_' + id + '_NoseWheel', cylinderGeo(0.035, 0.035, 0.035, 8), mats.rubber, {+ position: [0.34, -0.045, 0], rotation: [90, 0, 0], parent: jet+ });+ createPart('Jet_' + id + '_PortWheel', cylinderGeo(0.042, 0.042, 0.035, 8), mats.rubber, {+ position: [-0.15, -0.055, -0.17], rotation: [90, 0, 0], parent: jet+ });+ createPart('Jet_' + id + '_StarboardWheel', cylinderGeo(0.042, 0.042, 0.035, 8), mats.rubber, {+ position: [-0.15, -0.055, 0.17], rotation: [90, 0, 0], parent: jet+ });+}++async function build() {+ const root = createRoot('Greywatch_Carrier');++ const hullMat = gameMaterial(0x59636b, { metalness: 0.55, roughness: 0.62 });+ const hullDark = gameMaterial(0x30383e, { metalness: 0.62, roughness: 0.58 });+ const hullLight = gameMaterial(0x77838b, { metalness: 0.42, roughness: 0.68 });+ const deckMat = gameMaterial(0x24292d, { metalness: 0.35, roughness: 0.82 });+ const deckPanel = gameMaterial(0x3d464b, { metalness: 0.44, roughness: 0.73 });+ const white = gameMaterial(0xd7d9d3, { roughness: 0.72 });+ const yellow = gameMaterial(0xd2a72a, { metalness: 0.12, roughness: 0.72 });+ const red = gameMaterial(0x9f3e32, { roughness: 0.74 });+ const glass = gameMaterial(0x15252c, { metalness: 0.35, roughness: 0.22 });+ const black = gameMaterial(0x111416, { metalness: 0.3, roughness: 0.68 });+ const copper = gameMaterial(0x7a5534, { metalness: 0.55, roughness: 0.62 });+ const jet = gameMaterial(0x9ca6a7, { metalness: 0.45, roughness: 0.58 });+ const jetLight = gameMaterial(0xc2c6c2, { metalness: 0.32, roughness: 0.62 });+ const rubber = gameMaterial(0x111315, { roughness: 0.92 });++ createPart('Main_Hull', hullGeometry(), hullMat, { parent: root });++ const deckOutline = [+ [-10.5, -2.20], [-9.9, -3.05], [-4.8, -3.34], [2.5, -3.16],+ [8.8, -2.72], [10.6, -1.25], [10.2, 2.20], [6.8, 2.72],+ [-5.4, 3.18], [-10.4, 2.52]+ ];+ const deckGeo = await extrudeProfile(deckOutline, {+ depth: 0.30, axis: 'y', center: true, bevel: 0.07, bevelStyle: 'chamfer'+ });+ createPart('Angled_Flight_Deck', deckGeo, deckMat, {+ position: [0, 2.31, 0], parent: root+ });++ createPart('Hull_Port_Rub_Rail', boxGeo(16.5, 0.16, 0.16), hullDark, {+ position: [-0.8, 1.55, -2.90], parent: root+ });+ createPart('Hull_Starboard_Rub_Rail', boxGeo(15.8, 0.16, 0.16), hullDark, {+ position: [-0.2, 1.55, 2.92], parent: root+ });+ createPart('Bow_Breakwater', boxGeo(1.7, 0.24, 2.45), hullLight, {+ position: [8.25, 2.60, 0.0], rotation: [0, -3, 0], parent: root+ });+ createPart('Bow_Breakwater_DarkFace', boxGeo(0.09, 0.22, 2.25), hullDark, {+ position: [7.38, 2.60, 0.0], rotation: [0, -3, 0], parent: root+ });++ for (let i = 0; i < 10; i++) {+ createPart('Port_Hangar_Vent_' + i, boxGeo(0.46, 0.20, 0.045), black, {+ position: [-6.2 + i * 1.15, 1.42, -2.83], parent: root+ });+ }+ for (let i = 0; i < 8; i++) {+ createPart('Starboard_Hangar_Vent_' + i, boxGeo(0.42, 0.18, 0.045), black, {+ position: [-5.2 + i * 1.28, 1.40, 2.86], parent: root+ });+ }++ addStrip(root, 'Landing_Zone_Port_Edge', 12.9, 0.085, [-2.25, 2.485, -1.63], -8, white, 0.025);+ addStrip(root, 'Landing_Zone_Starboard_Edge', 12.9, 0.085, [-2.03, 2.485, 0.03], -8, white, 0.025);+ for (let i = 0; i < 12; i++) {+ addStrip(root, 'Landing_Center_Dash_' + i, 0.58, 0.095,+ [-7.15 + i * 0.86, 2.49, -0.87 + i * -0.12], -8, white, 0.028);+ }++ addStrip(root, 'Bow_Catapult_Line_Port', 8.9, 0.055, [4.4, 2.49, -0.82], 0, white, 0.025);+ addStrip(root, 'Bow_Catapult_Line_Starboard', 8.7, 0.055, [4.35, 2.49, 0.72], 0, white, 0.025);+ for (const z of [-1.10, -0.54, 0.43, 1.00]) {+ addStrip(root, 'Bow_Service_Line_' + String(z), 4.9, 0.045, [6.1, 2.488, z], 0, yellow, 0.022);+ }++ addStrip(root, 'Port_Deck_Safety_Line', 15.5, 0.075, [-1.4, 2.49, -2.82], -1.5, yellow, 0.025);+ addStrip(root, 'Starboard_Deck_Safety_Line', 14.2, 0.075, [-0.6, 2.49, 2.62], -1.5, yellow, 0.025);+ addStrip(root, 'Stern_Service_Crossline', 0.075, 4.9, [-8.95, 2.49, 0.05], 0, yellow, 0.025);++ const elevatorData = [+ { id: 'Aft_Starboard', x: -5.9, z: 3.18, sx: 2.05, sz: 1.35 },+ { id: 'Forward_Starboard', x: 4.85, z: 2.86, sx: 1.95, sz: 1.18 },+ { id: 'Aft_Port', x: -6.95, z: -3.24, sx: 1.70, sz: 1.10 }+ ];+ for (const e of elevatorData) {+ createPart('Elevator_' + e.id, boxGeo(e.sx, 0.16, e.sz), deckPanel, {+ position: [e.x, 2.39, e.z], parent: root+ });+ addStrip(root, 'Elevator_' + e.id + '_LongMark_A', e.sx * 0.88, 0.045,+ [e.x, 2.485, e.z - e.sz * 0.38], 0, yellow, 0.025);+ addStrip(root, 'Elevator_' + e.id + '_LongMark_B', e.sx * 0.88, 0.045,+ [e.x, 2.485, e.z + e.sz * 0.38], 0, yellow, 0.025);+ addStrip(root, 'Elevator_' + e.id + '_EndMark_A', 0.045, e.sz * 0.76,+ [e.x - e.sx * 0.44, 2.485, e.z], 0, yellow, 0.025);+ addStrip(root, 'Elevator_' + e.id + '_EndMark_B', 0.045, e.sz * 0.76,+ [e.x + e.sx * 0.44, 2.485, e.z], 0, yellow, 0.025);+ }++ const island = createPivot('Island_Superstructure', [1.75, 2.50, 1.95], root);+ createPart('Island_Armored_Base', await roundedBoxGeo(2.35, 0.72, 1.28, 0.09, { style: 'chamfer' }), hullMat, {+ position: [0, 0.36, 0], parent: island+ });+ createPart('Island_Mid_Block', await roundedBoxGeo(1.78, 0.72, 1.13, 0.08, { style: 'chamfer' }), hullLight, {+ position: [0.16, 1.02, 0], parent: island+ });+ createPart('Island_Bridge', await roundedBoxGeo(2.25, 0.62, 1.34, 0.08, { style: 'chamfer' }), hullMat, {+ position: [0.03, 1.64, -0.02], parent: island+ });+ createPart('Island_Bridge_Front_Windows', boxGeo(0.055, 0.25, 0.90), glass, {+ position: [1.175, 1.69, -0.02], parent: island+ });+ createPart('Island_Bridge_Port_Windows', boxGeo(1.58, 0.22, 0.05), glass, {+ position: [0.03, 1.69, -0.705], parent: island+ });+ createPart('Island_Bridge_Starboard_Windows', boxGeo(1.58, 0.22, 0.05), glass, {+ position: [0.03, 1.69, 0.665], parent: island+ });+ for (let i = 0; i < 5; i++) {+ createPart('Bridge_Window_Mullion_Port_' + i, boxGeo(0.035, 0.27, 0.065), hullDark, {+ position: [-0.60 + i * 0.31, 1.69, -0.735], parent: island+ });+ createPart('Bridge_Window_Mullion_Starboard_' + i, boxGeo(0.035, 0.27, 0.065), hullDark, {+ position: [-0.60 + i * 0.31, 1.69, 0.695], parent: island+ });+ }++ createPart('Island_Funnel', cylinderGeo(0.30, 0.40, 1.38, 10), hullDark, {+ position: [-0.42, 2.55, 0.25], rotation: [0, 0, -7], parent: island+ });+ createPart('Island_Funnel_Cap', cylinderGeo(0.35, 0.35, 0.14, 10), black, {+ position: [-0.50, 3.24, 0.25], rotation: [0, 0, -7], parent: island+ });+ createPart('Island_Mast_Lower', cylinderGeo(0.095, 0.13, 1.55, 10), hullLight, {+ position: [0.42, 2.73, -0.12], parent: island+ });+ createPart('Island_Mast_Upper', cylinderGeo(0.045, 0.085, 1.35, 10), hullLight, {+ position: [0.42, 4.05, -0.12], parent: island+ });+ createPart('Radar_Array_Lower', boxGeo(0.20, 0.78, 1.40), hullDark, {+ position: [0.46, 3.25, -0.10], rotation: [0, 0, 8], parent: island+ });+ createPart('Radar_Array_Face', boxGeo(0.055, 0.62, 1.18), glass, {+ position: [0.575, 3.25, -0.10], rotation: [0, 0, 8], parent: island+ });+ createPart('Radar_Top_Bar', boxGeo(1.20, 0.10, 0.10), hullLight, {+ position: [0.42, 4.66, -0.12], parent: island+ });+ createPart('Radar_Top_Panel', boxGeo(0.16, 0.48, 1.05), hullDark, {+ position: [0.42, 4.42, -0.12], rotation: [0, 0, -5], parent: island+ });+ createPart('Radar_Top_Face', boxGeo(0.045, 0.38, 0.88), glass, {+ position: [0.515, 4.42, -0.12], rotation: [0, 0, -5], parent: island+ });+ for (const z of [-0.62, 0.38]) {+ createPart('Yardarm_Antenna_' + String(z), cylinderGeo(0.025, 0.025, 0.85, 7), hullLight, {+ position: [0.42, 4.75, z], parent: island+ });+ }+ createPart('Mast_Top_Red_Light', sphereGeo(0.07, 10, 6), red, {+ position: [0.42, 4.78, -0.12], parent: island+ });++ createPart('Island_Deck_Crane_Post', cylinderGeo(0.075, 0.095, 0.86, 8), yellow, {+ position: [-1.35, 0.62, 0.55], parent: island+ });+ createPart('Island_Deck_Crane_Boom', boxGeo(0.90, 0.07, 0.07), yellow, {+ position: [-0.94, 1.03, 0.55], rotation: [0, 0, -18], parent: island+ });++ for (const side of [-1, 1]) {+ const z = side * 3.18;+ for (let i = 0; i < 8; i++) {+ const x = -7.7 + i * 1.95;+ addRail(root, (side < 0 ? 'Port' : 'Starboard') + '_SafetyRail_' + i,+ x, z, 1.55, true, hullLight, 2.70);+ createPart((side < 0 ? 'Port' : 'Starboard') + '_RailPost_' + i,+ cylinderGeo(0.022, 0.022, 0.35, 7), hullLight, {+ position: [x - 0.72, 2.60, z], parent: root+ });+ }+ }++ for (const x of [-7.8, -2.9, 6.5]) {+ const sponson = createPivot('Defensive_Sponson_' + String(x), [x, 2.15, 3.25], root);+ createPart('Sponson_Platform_' + String(x), cylinderGeo(0.38, 0.42, 0.16, 12), hullDark, {+ position: [0, 0.10, 0], parent: sponson+ });+ createPart('Sponson_Turret_' + String(x), sphereGeo(0.25, 10, 6), hullLight, {+ position: [0, 0.30, 0], scale: [1.2, 0.68, 1.0], parent: sponson+ });+ createPart('Sponson_Barrel_' + String(x), cylinderGeo(0.025, 0.035, 0.55, 8), black, {+ position: [0.25, 0.34, 0], rotation: [0, 0, -90], parent: sponson+ });+ }++ const wingGeo = await extrudeProfile(+ [[-0.38, -0.33], [0.22, -0.32], [0.34, 0], [0.22, 0.32], [-0.38, 0.33], [-0.23, 0]],+ { depth: 0.055, axis: 'y', center: true, bevel: 0.018, bevelStyle: 'chamfer' }+ );+ const jetMats = { jet, jetLight, glass, rubber };+ addJet(root, '01', -5.0, 1.55, 5, jetMats, wingGeo);+ addJet(root, '02', -3.35, 1.42, 5, jetMats, wingGeo);+ addJet(root, '03', -5.95, 0.15, 7, jetMats, wingGeo);+ addJet(root, '04', 4.75, -1.72, 0, jetMats, wingGeo);+ addJet(root, '05', 6.35, -1.70, 0, jetMats, wingGeo);++ const tow = createPivot('Deck_Tow_Tractor', [-1.55, 2.53, 2.20], root);+ createPart('Tow_Tractor_Body', await roundedBoxGeo(0.82, 0.26, 0.48, 0.06, { style: 'chamfer' }), yellow, {+ position: [0, 0.14, 0], parent: tow+ });+ createPart('Tow_Tractor_Cab', boxGeo(0.28, 0.30, 0.38), hullDark, {+ position: [-0.16, 0.34, 0], parent: tow+ });+ for (const x of [-0.26, 0.26]) {+ for (const z of [-0.25, 0.25]) {+ createPart('Tow_Wheel_' + String(x) + '_' + String(z), cylinderGeo(0.10, 0.10, 0.07, 10), rubber, {+ position: [x, 0.07, z], rotation: [90, 0, 0], parent: tow+ });+ }+ }++ for (let i = 0; i < 7; i++) {+ createPart('Aft_Tie_Down_' + i, torusGeo(0.055, 0.012, 6, 10), copper, {+ position: [-8.2 + i * 0.55, 2.47, 1.20], rotation: [90, 0, 0], parent: root+ });+ }++ return root;+}diff --git a/examples/demo-greywatch-stylized-aircraft-carrier.provenance.json b/examples/demo-greywatch-stylized-aircraft-carrier.provenance.jsonnew file mode 100644index 00000000..eab3efdd--- /dev/null+++ b/examples/demo-greywatch-stylized-aircraft-carrier.provenance.json@@ -0,0 +1,33 @@+{+ "sourceHash": "93780997b03cd0e6f68308eddd7113fb2234c52ba079f45dda365d65b519e18e",+ "model": "Not independently recorded",+ "harness": "Recorded demo session",+ "authoredDate": "2026-09-08",+ "provenance": {+ "attribution": "Recorded demo session; model credit supplied only where the retained run identifies it.",+ "sourceAccess": "See retained demo run; no stronger isolation claim is made.",+ "humanIntervention": "Owner supplied direction; model-authored exported source preserved byte-for-byte.",+ "reviewFidelity": "Authoring feedback and shaded demo previews where available. Not a destination-runtime acceptance claim.",+ "poster": "Fresh shaded render of the exact gallery-built downloadable GLB. Camera-only offline capture; no geometry or material edits.",+ "evaluationGlbHash": "873091560f76bd8c5c0f4eaedc3998e3b7344ba35b466e7c96f005e1262952f1",+ "posterReceipt": {+ "sourceHash": "93780997b03cd0e6f68308eddd7113fb2234c52ba079f45dda365d65b519e18e",+ "artifactHash": "5f3c3d042708179a00d856252be6bd5e4e4919de295a13b34119cae6b74b76f2",+ "imageHash": "c175f4657c27cdce771e6ed65e9d746659f0d71c9bb99dafcba1ac28dafc8bd0",+ "width": 1600,+ "height": 1000,+ "renderer": "ANGLE (NVIDIA, NVIDIA GeForce RTX 3070 (0x00002484) Direct3D11 vs_5_0 ps_5_0, D3D11)",+ "captureMethod": "Kiln studio stage, owned headless Chrome, original GLB materials",+ "cameraRecord": {+ "index": 10,+ "kind": "hero",+ "theta": 0.6747409422235527,+ "phi": 1.1850838085924118,+ "radius": 39.82522887000571,+ "fixedSeconds": null,+ "wallTimeMs": 129.60000000149012+ },+ "geometryChanged": false+ }+ }+}diff --git a/examples/demo-noctilus-nuclear-submarine.kiln.js b/examples/demo-noctilus-nuclear-submarine.kiln.jsnew file mode 100644index 00000000..d0f8c628--- /dev/null+++ b/examples/demo-noctilus-nuclear-submarine.kiln.js@@ -0,0 +1,121 @@+const meta = { name: 'NOCTILUS - Nuclear Submarine', category: 'vehicle', role: 'vehicle' };+const P = { hullY: 3.15, showCradle: true, hullSegments: 128, radialSegments: 64 };+async function build() {+ const root=createRoot('NOCTILUS');+ const sub=createPivot('Submarine',[0,0,0],root);+ const navy=gameMaterial(0x11283f,{metalness:0.55,roughness:0.3,flatShading:false});+ const sailmat=gameMaterial(0x19354c,{metalness:0.5,roughness:0.32,flatShading:false});+ const dark=gameMaterial(0x07131e,{metalness:0.25,roughness:0.5,flatShading:false});+ const seam=gameMaterial(0x253e50,{metalness:0.45,roughness:0.4,flatShading:false});+ const brass=gameMaterial(0xbc914a,{metalness:0.82,roughness:0.25,flatShading:false});+ const steel=gameMaterial(0x7b909a,{metalness:0.8,roughness:0.26,flatShading:false});+ const glass=gameMaterial(0x387486,{metalness:0.65,roughness:0.13,flatShading:false});+ const ivory=gameMaterial(0xd3cfb4,{metalness:0.2,roughness:0.5});+ const add=(n,g,m,pos=[0,0,0],rot=[0,0,0],parent=sub)=>createPart(n,g,m,{position:pos,rotation:rot,parent});+ const stations=[[-12,0.17],[-11,0.36],[-9.5,0.8],[-7.5,1.38],[-5,1.85],[-2,2.1],[2,2.2],[6,2.18],[9,2.02],[11,1.64],[12.5,1.03],[13.25,0.44],[13.45,0]];+ const curve=new THREE.CatmullRomCurve3(stations.map(s=>new THREE.Vector3(s[1],s[0],0)),false,'centripetal');+ const points=curve.getPoints(P.hullSegments).map(v=>new THREE.Vector2(Math.max(0,v.x),v.y));+ add('Midnight_Teardrop_Hull',new THREE.LatheGeometry(points,P.radialSegments),navy,[0,P.hullY,0],[0,0,-90]);+ function radius(x) { for(let i=0;i<points.length-1;i++) if(x>=points[i].y&&x<=points[i+1].y){let t=(x-points[i].y)/(points[i+1].y-points[i].y);return points[i].x*(1-t)+points[i+1].x*t;} return 0.2; }+ function line(n,pts,r,mat,parent=sub){const c=new THREE.CatmullRomCurve3(pts.map(p=>new THREE.Vector3(...p)));return add(n,new THREE.TubeGeometry(c,Math.max(8,pts.length*3),r,5,false),mat,[0,0,0],[0,0,0],parent);}+ for(const x of [-9.4,-5.4,0,6.8,10.7])add('Hull_Circumferential_Seam_'+x,new THREE.TorusGeometry(radius(x)+0.003,0.012,5,64),seam,[x,P.hullY,0],[0,90,0]);+ for(const a of [-0.62,0.62,2.35,3.93]){+ let pts=[];for(let x=-9;x<=10;x+=0.5){let r=radius(x)+0.004;pts.push([x,P.hullY+r*Math.cos(a),r*Math.sin(a)]);}+ line('Longitudinal_Panel_Seam_'+a,pts,0.009,seam);+ }+ // Blended, swept sail: matching airfoil sections preserve a soft rounded leading edge.+ const sail=createPivot('Sail_Assembly',[0,0,0],sub);+ function foil(cx,len,width){let p=[];for(let i=0;i<48;i++){let a=i/48*Math.PI*2;p.push([cx+len*0.5*Math.cos(a),width*0.5*Math.sin(a)*(0.88+0.12*Math.cos(a))]);}return p;}+ const sailSections=[+ [4.85,2.15,5.5,1.65],[5.35,2.1,4.8,1.25],[5.7,2.04,4.6,1.11],+ [7.9,1.68,4.02,0.98],[8.32,1.55,3.76,0.91],[8.44,1.54,3.55,0.82]];+ add('Streamlined_Sail',loftProfiles(sailSections.map(s=>({profile:foil(s[1],s[2],s[3]),frame:{origin:[0,s[0],0]}}))),sailmat,[0,0,0],[0,0,0],sail);+ add('Sail_Crown',loftProfiles([{profile:foil(1.54,3.55,0.83),frame:{origin:[0,8.43,0]}},{profile:foil(1.52,3.41,0.76),frame:{origin:[0,8.51,0]}}]),dark,[0,0,0],[0,0,0],sail);+ for(const side of [-1,1]){+ for(let i=0;i<6;i++)add('Sail_Vent_'+side+'_'+i,await roundedBoxGeo(0.13,0.36,0.025,0.012),dark,[0.65+i*0.25,6.02,side*0.515],[0,0,0],sail);+ line('Sail_Service_Panel_'+side,[[0.12,6.55,side*0.44],[0.03,7.58,side*0.43],[0.87,7.75,side*0.46],[0.98,6.55,side*0.49],[0.12,6.55,side*0.44]],0.012,seam,sail);+ add('Sail_Ivory_Insignia_'+side,await roundedBoxGeo(0.7,0.09,0.025,0.009),ivory,[2.02,7.43,side*0.467],[0,0,0],sail);+ add('Sail_Brass_Badge_'+side,cylinderGeo(0.105,0.105,0.026,24),brass,[2.61,7.43,side*0.41],[90,0,0],sail);+ }+ // Stretch the sail shell 40% about its original foot; carry the masts upward without stretching them.+ const sailHeightFactor=1.4, sailFootY=4.85;+ const mastRise=(8.51-sailFootY)*(sailHeightFactor-1);+ const shellParts=sail.children.slice();+ const tallShell=createPivot('Tall_Sail_Shell',[0,sailFootY*(1-sailHeightFactor),0],sail);+ tallShell.scale.y=sailHeightFactor;+ shellParts.forEach(part=>tallShell.add(part));+ const polishedBrass=gameMaterial(0xc79b50,{metalness:0.92,roughness:0.14,flatShading:false});+ const masts=[{x:2.45,h:2.65,r:0.075},{x:1.55,h:2.1,r:0.10},{x:0.62,h:1.48,r:0.135}];+ for(let i=0;i<masts.length;i++){+ const m=masts[i],bottom=8.49+mastRise;+ add('Mast_Deck_Boot_'+i,cylinderGeo(m.r*1.7,m.r*2,0.16,24),dark,[m.x,bottom+0.05,0],[0,0,0],sail);+ add('Polished_Brass_Mast_Base_Collar_'+i,cylinderGeo(m.r*1.75,m.r*1.95,0.23,40),polishedBrass,[m.x,bottom+0.22,0],[0,0,0],sail);+ add('Polished_Brass_Collar_Flange_'+i,cylinderGeo(m.r*2.12,m.r*2.12,0.055,40),polishedBrass,[m.x,bottom+0.135,0],[0,0,0],sail);+ add('Raised_Sensor_Mast_'+i,cylinderGeo(m.r,m.r,m.h,20),steel,[m.x,bottom+m.h/2,0],[0,0,0],sail);+ add('Mast_Brass_Collar_'+i,cylinderGeo(m.r*1.3,m.r*1.3,0.09,24),brass,[m.x,bottom+m.h*0.52,0],[0,0,0],sail);+ if(i<2){+ add('Periscope_Elbow_'+i,await roundedBoxGeo(0.35,0.2,0.19,0.07),navy,[m.x+0.09,bottom+m.h,0],[0,0,0],sail);+ add('Periscope_Lens_'+i,cylinderGeo(0.065,0.065,0.015,20),glass,[m.x+0.274,bottom+m.h,0],[0,0,90],sail);+ }else{+ add('Electronic_Sensor_Head',await roundedBoxGeo(0.32,0.64,0.32,0.08),navy,[m.x,bottom+m.h,0],[0,0,0],sail);+ add('Electronic_Sensor_Band',await roundedBoxGeo(0.325,0.13,0.325,0.055),glass,[m.x,bottom+m.h+0.08,0],[0,0,0],sail);+ }+ }+ // Airfoil planes along local Y, rotated into each radial direction.+ function plane(name,x,rStart,rEnd,chord,tipChord,angle){+ const prof=(c,t)=>{let p=[];for(let i=0;i<24;i++){let a=i/24*Math.PI*2;p.push([c/2*Math.cos(a),t/2*Math.sin(a)]);}return p;};+ const g=loftProfiles([+ {profile:prof(chord,0.24),frame:{origin:[x,rStart,0]}},+ {profile:prof(chord*0.82,0.18),frame:{origin:[x-0.25,rStart+(rEnd-rStart)*0.64,0]}},+ {profile:prof(tipChord,0.065),frame:{origin:[x-0.57,rEnd,0]}}+ ]);+ add(name,g,navy,[0,P.hullY,0],[angle,0,0]);+ const rad=angle*Math.PI/180;+ line(name+'_Control_Hinge',[[x-chord*0.3,P.hullY+(rStart+0.12)*Math.cos(rad),(rStart+0.12)*Math.sin(rad)],[x-0.57-tipChord*0.22,P.hullY+(rEnd-0.1)*Math.cos(rad),(rEnd-0.1)*Math.sin(rad)]],0.012,seam);+ }+ plane('Port_Bow_Diving_Plane',7.1,1.8,3.55,2.1,0.86,-90);+ plane('Starboard_Bow_Diving_Plane',7.1,1.8,3.55,2.1,0.86,90);+ for(let i=0;i<4;i++)plane('Cruciform_Stern_Plane_'+i,-9.3,0.36,i===2?2.62:2.92,2.7,1.05,i*90);+ // Flush dorsal equipment, carefully spaced instead of surface clutter.+ for(const x of [-4.7,-1.7,7.7]){+ const y=P.hullY+radius(x);+ add('Hatch_Recess_'+x,cylinderGeo(0.43,0.43,0.035,40),dark,[x,y+0.012,0]);+ add('Hatch_Cover_'+x,cylinderGeo(0.355,0.355,0.055,40),sailmat,[x,y+0.04,0]);+ add('Hatch_Center_'+x,cylinderGeo(0.105,0.105,0.023,24),brass,[x,y+0.082,0]);+ for(const side of [-1,1])add('Hatch_Hinge_'+x+'_'+side,await roundedBoxGeo(0.16,0.08,0.12,0.025),steel,[x+0.3,y+0.05,side*0.2]);+ }+ for(let i=0;i<10;i++)for(const side of [-1,1]){+ const x=-6.7+i*0.38,r=radius(x);+ add('Aft_Deck_FreeFlood_Vent_'+side+'_'+i,await roundedBoxGeo(0.21,0.035,0.1,0.015),dark,[x,P.hullY+r*0.966+0.015,side*r*0.259],[side*15,0,0]);+ }+ // Swept seven-blade propeller, separate hierarchy.+ const prop=createPivot('Brass_Propeller',[-12.43,P.hullY,0],sub);+ add('Propeller_Shaft',cylinderGeo(0.14,0.14,0.88,32),steel,[-12.16,P.hullY,0],[0,0,90]);+ add('Propeller_Hub',cylinderGeo(0.28,0.17,0.7,40),brass,[0,0,0],[0,0,90],prop);+ for(let b=0;b<7;b++){+ const sections=[[0.2,0,0,0.3],[0.53,-0.03,0.12,0.65],[1.02,-0.14,0.38,0.84],[1.48,-0.31,0.63,0.64],[1.71,-0.36,0.69,0.16]];+ const profiles=sections.map(s=>{const p=[];for(let j=0;j<20;j++){const a=j/20*Math.PI*2;const chord=s[3]*0.5*Math.cos(a);p.push([s[1]+chord*0.48+0.035*Math.sin(a),s[2]+chord]);}return {profile:p,frame:{origin:[0,s[0],0]}};});+ add('Swept_Brass_Blade_'+b,loftProfiles(profiles),brass,[0,0,0],[b*360/7,0,0],prop);+ }+ add('Propeller_Aft_Cap',new THREE.SphereGeometry(0.19,24,16),brass,[-0.36,0,0],[0,0,0],prop);+ if(P.showCradle){+ const stand=createPivot('Removable_Display_Cradle',[0,0,0],root);+ const base=gameMaterial(0x17212a,{metalness:0.5,roughness:0.33,flatShading:false});+ const rubber=gameMaterial(0x0a1016,{roughness:0.85,flatShading:false});+ add('Cradle_Plinth',await roundedBoxGeo(18,0.22,5.4,0.1),base,[0,0.11,0],[0,0,0],stand);+ for(const x of [-5,5]){+ add('Cradle_Foot_'+x,await roundedBoxGeo(0.85,0.24,4.3,0.1),base,[x,0.32,0],[0,0,0],stand);+ const r=radius(x);+ for(const side of [-1,1]){+ const z=side*r*0.62,top=P.hullY-r*Math.sqrt(1-0.62*0.62);+ add('Cradle_Support_'+x+'_'+side,await roundedBoxGeo(0.55,top-0.42,0.55,0.07),base,[x,(top+0.42)/2,z],[0,0,0],stand);+ add('Cradle_Rubber_Pad_'+x+'_'+side,await roundedBoxGeo(0.72,0.12,0.56,0.04),rubber,[x,top,z],[side*-38,0,0],stand);+ add('Cradle_Brass_Fastener_'+x+'_'+side,cylinderGeo(0.085,0.085,0.025,20),brass,[x,0.455,side*1.9],[0,0,0],stand);+ }+ }+ add('Cradle_Nameplate',await roundedBoxGeo(2.8,0.025,0.46,0.012),brass,[0,0.233,2.08],[0,0,0],stand);+ for(let i=0;i<5;i++)add('Nameplate_Engraving_'+i,await roundedBoxGeo(0.08+i*0.035,0.009,0.18,0.004),dark,[-0.5+i*0.25,0.25,2.08],[0,0,0],stand);+ }+ root.traverse(node=>{if(node.isMesh && node.geometry.getAttribute('normal')) node.geometry.normalizeNormals();});+ return root;+}\ No newline at end of filediff --git a/examples/demo-noctilus-nuclear-submarine.provenance.json b/examples/demo-noctilus-nuclear-submarine.provenance.jsonnew file mode 100644index 00000000..084e14ae--- /dev/null+++ b/examples/demo-noctilus-nuclear-submarine.provenance.json@@ -0,0 +1,54 @@+{+ "sourceHash": "21a393a9ad078a8d3d8c7a8b24bbaf97d3ad8a15c3637c7400419d85a04b2237",+ "model": "GPT-6 Astra",+ "harness": "ChatGPT Work",+ "authoredDate": "2026-09-08",+ "provenance": {+ "attribution": "Recorded demo session; model credit supplied only where the retained run identifies it.",+ "sourceAccess": "See retained demo run; no stronger isolation claim is made.",+ "humanIntervention": "Owner supplied direction; model-authored exported source preserved byte-for-byte.",+ "reviewFidelity": "Authoring feedback and shaded demo previews where available. Not a destination-runtime acceptance claim.",+ "poster": "Gallery GPU render of the exact downloadable GLB. Source, artifact, image hashes and camera settings are recorded alongside the poster.",+ "evaluationGlbHash": "221ccbcb69da6a5bf615e28cc51383afa3c55c5c9a7ce60dace4c657a1b73adf",+ "posterReceipt": {+ "captureIdentity": [+ "kiln.capture-producer.v1",+ "sha256:10f346ec6287c8d635dabe4668d72925080e6fe3d059dd7a9252f2694ce595c2",+ "44832275-6b15-4353-8fcb-ac1de3fda8e6",+ "dawn-d3d12:nvidia-geforce-rtx-3070:D3D12 driver version 32.0.16.1074"+ ],+ "sourceHash": "21a393a9ad078a8d3d8c7a8b24bbaf97d3ad8a15c3637c7400419d85a04b2237",+ "artifactHash": "a4ce6e5aac57c91a9cb00e85a2a7304d84a841e5d710a97d1129a975e68a4eaa",+ "imageHash": "3a7c507038d756b14396dd4958a92801b85b48352db2d7621c7eddc13938bd12",+ "width": 1024,+ "height": 1024,+ "camera": {+ "version": "kiln.camera.v1",+ "projection": "orthographic",+ "position": [+ 46.509468054283104,+ 26.6675927248062,+ 33.03361338689476+ ],+ "target": [+ 0.5030265135419516,+ 4.584500785250452,+ 0.8291043083759633+ ],+ "up": [+ 0,+ 1,+ 0+ ],+ "aspect": 1,+ "near": 0.01,+ "far": 150.85974483441782,+ "halfHeight": 9.429091361660745+ },+ "rendererId": "dawn-d3d12:nvidia-geforce-rtx-3070:D3D12 driver version 32.0.16.1074",+ "materialFaithful": true,+ "lightingPresetId": "gallery-studio-v1",+ "purpose": "Gallery poster generated from the exact downloadable GLB; separate from authoring feedback."+ }+ }+}diff --git a/examples/demo-ocean-salvage-tug.kiln.js b/examples/demo-ocean-salvage-tug.kiln.jsnew file mode 100644index 00000000..bd9d897a--- /dev/null+++ b/examples/demo-ocean-salvage-tug.kiln.js@@ -0,0 +1,325 @@+const meta = { name: 'Ocean salvage tug', category: 'vehicle', role: 'vehicle' };++// Dimensions in metres. +X forward, +Y up, +Z starboard.+// Stylized ocean salvage tug: navy hull, cream cabin/bulwark, safety-orange+// working deck trim, A-frame, winch and funnel. Keel at Y=0 (drydock sit).++const NAVY = 0x1e3a5c;+const CREAM = 0xf2e8d5;+const ORANGE = 0xff5a1f;+const RUBBER = 0x1b1b1e;+const STEEL = 0x3a4148;+const DARKSTEEL = 0x23272d;+const WINDOW = 0x22394e;+const DECKFORE = 0xe4d9c2;+const CABLE = 0x22262b;++// Plan-view outline of the hull (X forward, Z starboard), ordered+// stern-port -> bow -> stern-starboard so the loop closes across the transom.+function hullOutline(beamScale) {+ const pts = [+ [-2.4, -1.05],+ [-0.6, -1.15],+ [1.4, -0.85],+ [2.5, 0.0],+ [1.4, 0.85],+ [-0.6, 1.15],+ [-2.4, 1.05],+ ];+ return pts.map(([x, z]) => [x, z * beamScale]);+}++/** Vertical tire fender hung against the hull side. */+function tireFender(name, pos, parent, mats) {+ createPart(name, torusGeo(0.17, 0.065, 10, 20), mats.rubber, {+ position: pos, parent,+ });+}++/** Pair of bollard posts with a top plate. */+function bollard(name, x, z, deckY, parent, mats) {+ const g = createPivot(name, [x, deckY, z], parent);+ createPart('PostA', cylinderGeo(0.05, 0.06, 0.28, 12), mats.steel, {+ position: [-0.09, 0.14, 0], parent: g,+ });+ createPart('PostB', cylinderGeo(0.05, 0.06, 0.28, 12), mats.steel, {+ position: [0.09, 0.14, 0], parent: g,+ });+ createPart('TopPlate', boxGeo(0.3, 0.05, 0.12), mats.steel, {+ position: [0, 0.3, 0], parent: g,+ });+ return g;+}++function build() {+ const root = createRoot('SalvageTug');++ const mats = {+ navy: gameMaterial(NAVY),+ cream: gameMaterial(CREAM),+ orange: gameMaterial(ORANGE),+ rubber: gameMaterial(RUBBER),+ steel: gameMaterial(STEEL),+ dark: gameMaterial(DARKSTEEL),+ window: gameMaterial(WINDOW),+ deckFore: gameMaterial(DECKFORE),+ cable: gameMaterial(CABLE),+ };++ // ---- Hull: loft three plan sections (keel -> waterline -> deck edge) ----+ const hullGeo = loftProfiles([+ { profile: hullOutline(0.72), frame: { origin: [0, 0.15, 0], rotation: [0, 0, 0] } },+ { profile: hullOutline(0.92), frame: { origin: [0, 0.55, 0], rotation: [0, 0, 0] } },+ { profile: hullOutline(1.0), frame: { origin: [0, 1.05, 0], rotation: [0, 0, 0] } },+ ]);+ createPart('Hull', hullGeo, mats.navy, { parent: root });++ // Waterline boot stripe (thin loft band just above the waterline).+ // Kept slightly proud of the hull surface to avoid z-fighting.+ const stripeGeo = loftProfiles([+ { profile: hullOutline(0.945), frame: { origin: [0, 0.64, 0], rotation: [0, 0, 0] } },+ { profile: hullOutline(0.965), frame: { origin: [0, 0.76, 0], rotation: [0, 0, 0] } },+ ]);+ createPart('BootStripe', stripeGeo, mats.orange, { parent: root });++ // ---- Decks ----+ // Aft working deck (safety orange) and foredeck (cream).+ createPart('WorkingDeck', boxGeo(2.9, 0.07, 1.86), mats.orange, {+ position: [-0.95, 1.09, 0], parent: root,+ });+ createPart('ForeDeck', boxGeo(1.7, 0.07, 1.5), mats.deckFore, {+ position: [1.35, 1.09, 0], parent: root,+ });+ // Deck anti-slip strips.+ for (let i = 0; i < 4; i++) {+ createPart('DeckStrip' + i, boxGeo(2.5, 0.02, 0.05), mats.dark, {+ position: [-0.95, 1.13, -0.6 + i * 0.4], parent: root,+ });+ }++ // ---- Bulwark (cream) with orange cap rail ----+ const bulwarkH = 0.42;+ const bulwarkY = 1.05 + bulwarkH / 2;+ // Straight side walls.+ createPart('BulwarkPort', boxGeo(3.0, bulwarkH, 0.08), mats.cream, {+ position: [-0.9, bulwarkY, -1.06], parent: root,+ });+ createPart('BulwarkStbd', boxGeo(3.0, bulwarkH, 0.08), mats.cream, {+ position: [-0.9, bulwarkY, 1.06], parent: root,+ });+ // Transom wall.+ createPart('BulwarkTransom', boxGeo(0.08, bulwarkH, 2.2), mats.cream, {+ position: [-2.38, bulwarkY, 0], parent: root,+ });+ // Angled bow walls (port/starboard).+ createPart('BulwarkBowPort', boxGeo(1.5, bulwarkH, 0.08), mats.cream, {+ position: [1.55, bulwarkY, -0.78], rotation: [0, -28, 0], parent: root,+ });+ createPart('BulwarkBowStbd', boxGeo(1.5, bulwarkH, 0.08), mats.cream, {+ position: [1.55, bulwarkY, 0.78], rotation: [0, 28, 0], parent: root,+ });+ // Orange cap rail on top of each wall.+ const capY = 1.05 + bulwarkH + 0.03;+ createPart('CapPort', boxGeo(3.0, 0.06, 0.12), mats.orange, {+ position: [-0.9, capY, -1.06], parent: root,+ });+ createPart('CapStbd', boxGeo(3.0, 0.06, 0.12), mats.orange, {+ position: [-0.9, capY, 1.06], parent: root,+ });+ createPart('CapTransom', boxGeo(0.12, 0.06, 2.2), mats.orange, {+ position: [-2.38, capY, 0], parent: root,+ });+ createPart('CapBowPort', boxGeo(1.5, 0.06, 0.12), mats.orange, {+ position: [1.55, capY, -0.78], rotation: [0, -28, 0], parent: root,+ });+ createPart('CapBowStbd', boxGeo(1.5, 0.06, 0.12), mats.orange, {+ position: [1.55, capY, 0.78], rotation: [0, 28, 0], parent: root,+ });++ // ---- Rubber fenders ----+ // Vertical side fenders (cylinders) + hanging tire fenders (torus).+ const fenderX = [-1.9, -0.9, 0.1];+ for (let i = 0; i < fenderX.length; i++) {+ createPart('FenderPort' + i, cylinderGeo(0.11, 0.11, 0.55, 14), mats.rubber, {+ position: [fenderX[i], 0.82, -1.13], parent: root,+ });+ createPart('FenderStbd' + i, cylinderGeo(0.11, 0.11, 0.55, 14), mats.rubber, {+ position: [fenderX[i], 0.82, 1.13], parent: root,+ });+ }+ tireFender('TirePortA', [-1.4, 0.95, -1.2], root, mats);+ tireFender('TirePortB', [-0.4, 0.95, -1.22], root, mats);+ tireFender('TireStbdA', [-1.4, 0.95, 1.2], root, mats);+ tireFender('TireStbdB', [-0.4, 0.95, 1.22], root, mats);+ // Bow stem fender.+ createPart('StemFender', cylinderGeo(0.1, 0.1, 0.7, 12), mats.rubber, {+ position: [2.5, 0.82, 0], parent: root,+ });+ // Stern push fender (horizontal log across transom).+ createPart('SternFender', cylinderGeo(0.13, 0.13, 1.9, 14), mats.rubber, {+ position: [-2.5, 0.85, 0], rotation: [90, 0, 0], parent: root,+ });++ // ---- Cabin block (cream) with navy roof ----+ createPart('CabinBase', boxGeo(1.5, 0.95, 1.5), mats.cream, {+ position: [0.55, 1.6, 0], parent: root,+ });+ createPart('Wheelhouse', boxGeo(1.3, 0.75, 1.35), mats.cream, {+ position: [0.55, 2.45, 0], parent: root,+ });+ createPart('CabinRoof', boxGeo(1.55, 0.1, 1.6), mats.navy, {+ position: [0.55, 2.88, 0], parent: root,+ });+ // Window band (dark) around wheelhouse + front windshields.+ createPart('WindowBand', boxGeo(1.32, 0.3, 1.37), mats.window, {+ position: [0.55, 2.55, 0], parent: root,+ });+ // Mullions to break the band into windows (cream posts).+ for (let i = -1; i <= 1; i++) {+ createPart('MullionFront' + i, boxGeo(0.06, 0.32, 0.06), mats.cream, {+ position: [1.22, 2.55, i * 0.4], parent: root,+ });+ }+ // Cabin door (aft face) + portholes.+ createPart('CabinDoor', boxGeo(0.06, 0.7, 0.4), mats.navy, {+ position: [-0.23, 1.6, 0.3], parent: root,+ });+ for (let i = 0; i < 2; i++) {+ createPart('PortholePort' + i, cylinderGeo(0.09, 0.09, 0.06, 16), mats.navy, {+ position: [0.2 + i * 0.5, 1.65, -0.76], rotation: [90, 0, 0], parent: root,+ });+ createPart('PortholeStbd' + i, cylinderGeo(0.09, 0.09, 0.06, 16), mats.navy, {+ position: [0.2 + i * 0.5, 1.65, 0.76], rotation: [90, 0, 0], parent: root,+ });+ }+ // Orange cabin trim stripe.+ createPart('CabinStripe', boxGeo(1.52, 0.1, 1.52), mats.orange, {+ position: [0.55, 2.02, 0], parent: root,+ });++ // ---- Funnel (safety orange with dark cap) ----+ createPart('Funnel', cylinderGeo(0.28, 0.34, 0.7, 18), mats.orange, {+ position: [-0.55, 2.35, 0], parent: root,+ });+ createPart('FunnelCap', cylinderGeo(0.29, 0.29, 0.14, 18), mats.dark, {+ position: [-0.55, 2.75, 0], parent: root,+ });++ // ---- Mast + radar + lights ----+ createPart('Mast', cylinderGeo(0.05, 0.07, 1.1, 10), mats.steel, {+ position: [0.55, 3.45, 0], parent: root,+ });+ createPart('RadarPedestal', cylinderGeo(0.09, 0.11, 0.16, 12), mats.cream, {+ position: [0.55, 3.1, 0], parent: root,+ });+ // Radar scanner bar (stylized, static forward pose).+ createPart('RadarBar', boxGeo(0.16, 0.07, 0.85), mats.cream, {+ position: [0.55, 3.24, 0], parent: root,+ });+ createPart('RadarDome', sphereGeo(0.11, 16, 12), mats.cream, {+ position: [0.15, 3.0, 0], parent: root,+ });+ // Navigation lights: port red-ish? Keep palette: small cream masthead + orange stern.+ createPart('MastheadLight', sphereGeo(0.05, 10, 8), mats.orange, {+ position: [0.55, 4.02, 0], parent: root,+ });++ // ---- Towing winch drum on working deck ----+ const winch = createPivot('Winch', [-1.15, 1.12, 0], root);+ createPart('WinchBaseL', boxGeo(0.7, 0.18, 0.12), mats.steel, {+ position: [0, 0.09, -0.55], parent: winch,+ });+ createPart('WinchBaseR', boxGeo(0.7, 0.18, 0.12), mats.steel, {+ position: [0, 0.09, 0.55], parent: winch,+ });+ createPart('WinchFrameL', boxGeo(0.12, 0.55, 0.1), mats.orange, {+ position: [-0.25, 0.4, -0.55], parent: winch,+ });+ createPart('WinchFrameR', boxGeo(0.12, 0.55, 0.1), mats.orange, {+ position: [-0.25, 0.4, 0.55], parent: winch,+ });+ createPart('Drum', cylinderGeo(0.26, 0.26, 0.95, 20), mats.dark, {+ position: [-0.25, 0.55, 0], rotation: [90, 0, 0], parent: winch,+ });+ // Wound cable wrap (slightly larger, cable color) + flange discs.+ createPart('CableWrap', cylinderGeo(0.29, 0.29, 0.6, 20), mats.cable, {+ position: [-0.25, 0.55, 0], rotation: [90, 0, 0], parent: winch,+ });+ createPart('FlangeL', cylinderGeo(0.4, 0.4, 0.06, 20), mats.orange, {+ position: [-0.25, 0.55, -0.5], rotation: [90, 0, 0], parent: winch,+ });+ createPart('FlangeR', cylinderGeo(0.4, 0.4, 0.06, 20), mats.orange, {+ position: [-0.25, 0.55, 0.5], rotation: [90, 0, 0], parent: winch,+ });+ // Orange cable drum guards: side frames standing clear of the flanges.+ createPart('DrumGuardLegFL', boxGeo(0.08, 0.9, 0.08), mats.orange, {+ position: [-0.55, 0.45, -0.62], parent: winch,+ });+ createPart('DrumGuardLegRL', boxGeo(0.08, 0.9, 0.08), mats.orange, {+ position: [0.05, 0.45, -0.62], parent: winch,+ });+ createPart('DrumGuardLegFR', boxGeo(0.08, 0.9, 0.08), mats.orange, {+ position: [-0.55, 0.45, 0.62], parent: winch,+ });+ createPart('DrumGuardLegRR', boxGeo(0.08, 0.9, 0.08), mats.orange, {+ position: [0.05, 0.45, 0.62], parent: winch,+ });+ createPart('DrumGuardTopL', boxGeo(0.68, 0.08, 0.08), mats.orange, {+ position: [-0.25, 0.92, -0.62], parent: winch,+ });+ createPart('DrumGuardTopR', boxGeo(0.68, 0.08, 0.08), mats.orange, {+ position: [-0.25, 0.92, 0.62], parent: winch,+ });+ // Tow cable running aft off the drum toward the stern roller.+ createPart('TowCable', cylinderGeo(0.025, 0.025, 1.3, 8), mats.cable, {+ position: [-0.95, 0.5, 0], rotation: [0, 0, 78], parent: winch,+ });++ // Stern roller for the tow wire.+ createPart('SternRoller', cylinderGeo(0.09, 0.09, 0.7, 12), mats.steel, {+ position: [-2.25, 1.2, 0], rotation: [90, 0, 0], parent: root,+ });++ // ---- A-frame crane (safety orange) over the stern ----+ // Feet sit on the aft deck at the transom so the hook hangs over the water.+ const frameX = -2.3;+ // Legs lean inward in Z; feet at deck, apexes high and close together.+ createPart('AFrameLegPort', cylinderGeo(0.07, 0.09, 2.3, 12), mats.orange, {+ position: [frameX, 2.2, -0.68], rotation: [20, 0, 0], parent: root,+ });+ createPart('AFrameLegStbd', cylinderGeo(0.07, 0.09, 2.3, 12), mats.orange, {+ position: [frameX, 2.2, 0.68], rotation: [-20, 0, 0], parent: root,+ });+ // Crossbeam between apexes + top pulley block.+ createPart('AFrameBeam', cylinderGeo(0.07, 0.07, 0.75, 12), mats.orange, {+ position: [frameX, 3.28, 0], rotation: [90, 0, 0], parent: root,+ });+ createPart('CraneBlock', boxGeo(0.18, 0.24, 0.14), mats.dark, {+ position: [frameX, 3.08, 0], parent: root,+ });+ // Hook cable + hook (hanging aft of the transom, under the block).+ createPart('HookCable', cylinderGeo(0.02, 0.02, 1.2, 8), mats.cable, {+ position: [frameX - 0.05, 2.36, 0], parent: root,+ });+ createPart('Hook', torusGeo(0.09, 0.03, 8, 16), mats.steel, {+ position: [frameX - 0.05, 1.7, 0], parent: root,+ });++ // ---- Deck fittings ----+ bollard('BollardSternPort', -2.0, -0.75, 1.12, root, mats);+ bollard('BollardSternStbd', -2.0, 0.75, 1.12, root, mats);+ bollard('BollardBowPort', 1.9, -0.5, 1.12, root, mats);+ bollard('BollardBowStbd', 1.9, 0.5, 1.12, root, mats);+ // Foredeck hatch + vent.+ createPart('ForeHatch', boxGeo(0.6, 0.18, 0.6), mats.steel, {+ position: [1.35, 1.2, 0], parent: root,+ });+ createPart('Vent', cylinderGeo(0.09, 0.11, 0.4, 12), mats.orange, {+ position: [0.0, 1.5, -0.6], parent: root,+ });+ createPart('VentHead', sphereGeo(0.11, 12, 8), mats.orange, {+ position: [0.0, 1.72, -0.6], parent: root,+ });++ return root;+}diff --git a/examples/demo-ocean-salvage-tug.provenance.json b/examples/demo-ocean-salvage-tug.provenance.jsonnew file mode 100644index 00000000..f8e88ec9--- /dev/null+++ b/examples/demo-ocean-salvage-tug.provenance.json@@ -0,0 +1,33 @@+{+ "sourceHash": "c79b655b05918d92494477304821eeadaa590c8865d100ab2a15a28396f7eb03",+ "model": "Muse Spark 1.3",+ "harness": "OpenCode",+ "authoredDate": "2026-09-08",+ "provenance": {+ "attribution": "Recorded demo session; model credit supplied only where the retained run identifies it.",+ "sourceAccess": "See retained demo run; no stronger isolation claim is made.",+ "humanIntervention": "Owner supplied direction; model-authored exported source preserved byte-for-byte.",+ "reviewFidelity": "Authoring feedback and shaded demo previews where available. Not a destination-runtime acceptance claim.",+ "poster": "Fresh shaded render of the exact gallery-built downloadable GLB. Camera-only offline capture; no geometry or material edits.",+ "evaluationGlbHash": "d5da63efbf238025d7f2781a6a81dceccb7d7682fbc76a1b28890f88a8684bd5",+ "posterReceipt": {+ "sourceHash": "c79b655b05918d92494477304821eeadaa590c8865d100ab2a15a28396f7eb03",+ "artifactHash": "d4f19a888e4f7c71dc8ac6e5a2c0b6ae263d7bc65e29764dbad631577422d00d",+ "imageHash": "f7a180b2d62f2e46610473cf4509737d9a62416d65b8254bf64c1714b2e79802",+ "width": 1600,+ "height": 1000,+ "renderer": "ANGLE (NVIDIA, NVIDIA GeForce RTX 3070 (0x00002484) Direct3D11 vs_5_0 ps_5_0, D3D11)",+ "captureMethod": "Kiln studio stage, owned headless Chrome, original GLB materials",+ "cameraRecord": {+ "index": 10,+ "kind": "hero",+ "theta": 0.6747409422235526,+ "phi": 1.185083808592412,+ "radius": 12.167761679203373,+ "fixedSeconds": null,+ "wallTimeMs": 118.09999999962747+ },+ "geometryChanged": false+ }+ }+}diff --git a/examples/demo-resolute-polar-fleet-flagship.kiln.js b/examples/demo-resolute-polar-fleet-flagship.kiln.jsnew file mode 100644index 00000000..f481862c--- /dev/null+++ b/examples/demo-resolute-polar-fleet-flagship.kiln.js@@ -0,0 +1,212 @@+// RESOLUTE / polar fleet flagship. Original procedural design, metres, +X bow.+const meta = { name: 'Resolute — Polar Fleet Flagship', category: 'vehicle', role: 'vehicle' };+const DESIGN = { length: 32, beam: 6.6, deckY: 2.8, mastHeight: 9.5, radarWidth: 3.2, railHeight: 0.40 };+function build() {+ const root = createRoot('Resolute');+ const navy = gameMaterial(0x243e53,{roughness:0.65,metalness:0.25});+ const blue = gameMaterial(0x496779,{roughness:0.6,metalness:0.2});+ const ivory = gameMaterial(0xd5d7c8,{roughness:0.68});+ const teak = gameMaterial(0xb7824c,{roughness:0.95});+ const seam = gameMaterial(0x795738,{roughness:1});+ const brass = gameMaterial(0xd8ac55,{metalness:0.65,roughness:0.35});+ const red = gameMaterial(0x963e39,{roughness:0.8});+ const black = gameMaterial(0x172631,{roughness:0.8});+ const glass = gameMaterial(0x4fc4cb,{metalness:0.25,roughness:0.2});+ const white = gameMaterial(0xf0e7cc,{roughness:0.7});+ const orange = gameMaterial(0xdd7947,{roughness:0.8});+ const part=(n,g,m,p=[0,0,0],r=[0,0,0],parent=root)=>createPart(n,g,m,{position:p,rotation:r,parent});+ const box=(n,s,p,m,r=[0,0,0],parent=root)=>part(n,boxGeo(...s),m,p,r,parent);+ function rod(n,a,b,r,m,parent=root) {+ const va=new THREE.Vector3(...a), vb=new THREE.Vector3(...b),d=vb.clone().sub(va);+ const o=part(n,cylinderGeo(r,r,d.length(),8),m,va.clone().add(vb).multiplyScalar(.5).toArray(),[0,0,0],parent);+ o.quaternion.setFromUnitVectors(new THREE.Vector3(0,1,0),d.normalize()); return o;+ }+ // Convex waterline outline sampled along deliberately asymmetric bow/stern stations.+ const stations=[[-16,.15],[-15,1.5],[-13,2.55],[-10,3.1],[-6,3.3],[2,3.3],[7,3.05],[11,2.4],[14,1.3],[16,.06]];+ const outline=stations.map(s=>[s[0],s[1]]).concat(stations.slice().reverse().map(s=>[s[0],-s[1]]));+ function shell(n,rings,m) {+ const p=[],idx=[],N=outline.length;+ for(const [y,sx,sz] of rings) for(const [x,z] of outline)p.push(x*sx,y,z*sz);+ for(let k=0;k<rings.length-1;k++)for(let i=0;i<N;i++){+ const j=(i+1)%N,a=k*N+i,b=k*N+j,c=(k+1)*N+i,d=(k+1)*N+j;idx.push(a,b,c,b,d,c);+ }+ // Outline ordering is clockwise in XZ; its cap orientation is +Y.+ const bot=p.length/3;p.push(0,rings[0][0],0);const top=p.length/3;p.push(0,rings[rings.length-1][0],0);+ for(let i=0;i<N;i++){let j=(i+1)%N;idx.push(bot,j,i);let k=(rings.length-1)*N;idx.push(top,k+i,k+j);}+ return part(n,meshGeo({positions:p,indices:idx}),m);+ }+ shell('Red antifouling carved keel',[[0,.88,.42],[.45,.96,.70],[1.15,1,.94]],red);+ shell('Boot stripe',[[1.15,1,.94],[1.35,1,.96]],black);+ shell('Armoured flared hull',[[1.35,1,.96],[2.35,1,1],[2.77,1,1]],navy);+ shell('Ivory sheer stripe',[[2.56,1.001,1.006],[2.68,1.001,1.006]],ivory);+ shell('Teak main deck',[[2.77,.994,.982],[2.82,.994,.982]],teak);+ // Plank seams follow vessel length but stop at the narrowing bow and stern.+ for(let z=-2.8;z<=2.81;z+=.22){+ let xs=stations.filter(s=>s[1]>Math.abs(z)+.08).map(s=>s[0]);+ if(xs.length>1)box('Deck plank seam '+z.toFixed(2),[Math.max(...xs)-Math.min(...xs),.008,.018],[(Math.max(...xs)+Math.min(...xs))/2,2.827,z],seam);+ }+ // A perimeter handrail composed from station-to-station rails, with vertical stanchions.+ for(let i=0;i<outline.length;i++){+ let a=outline[i],b=outline[(i+1)%outline.length];+ let dist=Math.hypot(b[0]-a[0],b[1]-a[1]),count=Math.ceil(dist/.8);+ for(let t=0;t<count;t++){+ let x=(a[0]+(b[0]-a[0])*t/count)*.985,z=(a[1]+(b[1]-a[1])*t/count)*.96;+ rod('Rail stanchion '+i+'-'+t,[x,2.83,z],[x,2.83+DESIGN.railHeight,z],.022,ivory);+ }+ for(const h of [.19,DESIGN.railHeight])rod('Continuous safety rail '+i+'-'+h,[a[0]*.985,2.83+h,a[1]*.96],[b[0]*.985,2.83+h,b[1]*.96],.018,ivory);+ }+ // Scuttles track the hull stations so they remain mounted along the tapered sides.+ function hullWidth(x) {+ for(let i=0;i<stations.length-1;i++)if(x>=stations[i][0]&&x<=stations[i+1][0]){+ const a=stations[i],b=stations[i+1];return a[1]+(b[1]-a[1])*(x-a[0])/(b[0]-a[0]);+ }+ return .06;+ }+ for(const s of [-1,1])for(let x=-11;x<=10;x+=1.05){+ const z=s*(hullWidth(x)*.9972+.012);+ const yaw=-s*Math.atan((hullWidth(x+.01)-hullWidth(x-.01))/.02)*180/Math.PI;+ part('Brass scuttle '+s+' '+x,torusGeo(.095,.024,6,12),brass,[x,2.28,z],[0,yaw,0]);+ part('Dark scuttle glass '+s+' '+x,cylinderGeo(.078,.078,.018,12),black,[x,2.28,z],[90,yaw,0]);+ }+ // Fleet hull registry 07 is editable solid geometry, with no external font or texture.+ const digits=[[[0,0],[0,.48],[.26,.48],[.26,0],[0,0]],[[0,.48],[.26,.48],[.08,0]]];+ for(const s of [-1,1])for(let d=0;d<2;d++)for(let i=0;i<digits[d].length-1;i++){+ const a=digits[d][i],b=digits[d][i+1];+ rod('Hull registry 07 '+s+' '+d+' '+i,[1.15+s*(a[0]+d*.4),1.74+a[1],s*3.31],[1.15+s*(b[0]+d*.4),1.74+b[1],s*3.31],.027,ivory);+ }+ // Turret assembly in its own local coordinate frame. Articulated pivot retained for edits.+ function turret(n,x,y,dir,scale=1){+ const g=createPivot(n,[x,y,0],root);g.rotation.y=dir*Math.PI/180;+ part(n+' barbette',cylinderGeo(1.1*scale,1.2*scale,.4*scale,16),blue,[0,.2*scale,0],[0,0,0],g);+ // Faceted armour geometry with sloping cheeks; independent turret roof.+ const shape=[[-1.05,-.97],[-1.05,.97],[.65,1.02],[1.12,.65],[1.12,-.65],[.65,-1.02]];+ const pts=[],inds=[];+ for(const [yy,fac] of [[.38,1],[1.2,.82]])for(const [xx,zz] of shape)pts.push(xx*scale*fac,yy*scale,zz*scale*fac);+ for(let i=0;i<6;i++){let j=(i+1)%6;inds.push(i,j,6+i,j,6+j,6+i);}+ for(let i=1;i<5;i++){inds.push(0,i+1,i,6,6+i,6+i+1);}+ part(n+' angled gunhouse',meshGeo({positions:pts,indices:inds}),ivory,[0,0,0],[0,0,0],g);+ box(n+' roof plate',[1.42*scale,.08*scale,1.4*scale],[-.1*scale,1.24*scale,0],blue,[0,0,0],g);+ for(const z of [-.57,0,.57]){+ part(n+' gun mantlet '+z,cylinderGeo(.2*scale,.2*scale,.5*scale,12),navy,[.9*scale,.75*scale,z*scale],[0,0,90],g);+ rod(n+' barrel '+z,[1*scale,.75*scale,z*scale],[4.1*scale,1.02*scale,z*scale],.108*scale,blue,g);+ rod(n+' reinforced breech '+z,[1*scale,.75*scale,z*scale],[2*scale,.837*scale,z*scale],.145*scale,navy,g);+ part(n+' black muzzle '+z,cylinderGeo(.08*scale,.08*scale,.03*scale,12),black,[4.12*scale,1.022*scale,z*scale],[0,0,95],g);+ }+ box(n+' rangefinder',[.25*scale,.22*scale,2.15*scale],[-.45*scale,1.37*scale,0],brass,[0,0,0],g);+ }+ turret('A forward battery',8.3,2.84,0);+ box('B raised battery platform',[3.4,.62,3.7],[3.9,3.13,0],navy);+ turret('B superfiring battery',4.0,3.45,0,.91);+ turret('Y stern battery',-10.2,2.84,180);+ // Long central citadel, stepped bridge and glazed observation deck.+ box('Citadel lower deck',[11.6,.9,3.5],[-2,3.28,0],blue);+ box('Citadel teak roof',[11.8,.1,3.7],[-2,3.78,0],teak);+ box('Bridge lower block',[3.2,1.25,2.7],[.85,4.43,0],ivory);+ box('Bridge middle deck rim',[3.8,.16,3.25],[.85,5.13,0],brass);+ box('Bridge panoramic dark band',[2.8,.65,2.55],[.85,5.53,0],black);+ box('Bridge roof overhang',[3.25,.18,2.95],[.85,5.94,0],ivory);+ for(const s of [-1,1])for(let x=-.25;x<=1.96;x+=.43)box('Bridge side glazing '+s+' '+x,[.32,.42,.03],[x,5.55,s*1.285],glass);+ for(let z=-1;z<=1.01;z+=.4)box('Forward bridge glazing '+z,[.03,.42,.29],[2.27,5.55,z],glass);+ box('Conning tower',[1.3,.83,1.45],[.55,6.43,0],blue);+ part('Director turntable',cylinderGeo(.7,.7,.18,16),brass,[.55,6.93,0]);+ box('Optical director',[.7,.45,1.2],[.55,7.24,0],ivory);+ box('Director rangefinder',[.22,.23,2.1],[.6,7.4,0],navy);+ for(const s of [-1,1]){+ box('Bridge wing '+s,[1.6,.15,1.2],[.5,5.04,s*1.75],blue);+ box('Wing screen '+s,[1.7,.4,.08],[.5,5.3,s*2.31],ivory);+ // stairway with clear readable risers+ for(let i=0;i<8;i++)box('Citadel access step '+s+' '+i,[.25,.1,.55],[2.55-i*.15,2.88+i*.12,s*2.0],ivory);+ }+ // Paired raked funnels, dark mouths and horizontal brass collars.+ for(const x of [-2.4,-5.7]){+ box('Funnel plinth '+x,[1.9,.34,1.85],[x,3.99,0],navy);+ part('Raked funnel '+x,cylinderGeo(.66,.86,1.85,8),ivory,[x-.12,5.05,0],[0,0,-8]);+ part('Funnel brass collar '+x,cylinderGeo(.68,.70,.16,8),brass,[x-.23,5.59,0],[0,0,-8]);+ part('Funnel soot cap '+x,cylinderGeo(.70,.7,.35,8),navy,[x-.26,5.91,0],[0,0,-8]);+ part('Funnel dark opening '+x,cylinderGeo(.56,.56,.025,8),black,[x-.285,6.088,0],[0,0,-8]);+ for(let i=0;i<6;i++)box('Funnel intake louvre '+x+' '+i,[.8,.055,.04],[x,4.25+i*.13,.78],black);+ }+ // Revised naval mast with braced radar, signal halyards, and triangulated support.+ rod('Main mast',[-1.25,5.9,0],[-1.25,DESIGN.mastHeight,0],.075,navy);+ rod('Mast port brace',[-2.1,3.83,-1.1],[-1.25,7.8,0],.06,ivory);+ rod('Mast starboard brace',[-2.1,3.83,1.1],[-1.25,7.8,0],.06,ivory);+ rod('Signal yard',[-1.25,7.8,-1.8],[-1.25,7.8,1.8],.045,brass);+ // Solid radar panel replaced with an open framed array below.+ // Open trussed radar and signal structure: revised silhouette and visible supports.+ const rh=DESIGN.mastHeight, rw=DESIGN.radarWidth;+ for(const z of [-rw/2,rw/2])rod('Radar vertical frame '+z,[-1.25,rh-.52,z],[-1.25,rh+.52,z],.045,brass);+ for(const y of [rh-.52,rh+.52])rod('Radar horizontal frame '+y,[-1.25,y,-rw/2],[-1.25,y,rw/2],.045,brass);+ for(let j=0;j<=8;j++){+ const z=-rw/2+j*rw/8;+ rod('Radar grid vertical '+j,[-1.25,rh-.5,z],[-1.25,rh+.5,z],.019,blue);+ }+ for(let j=1;j<4;j++)rod('Radar grid horizontal '+j,[-1.25,rh-.52+j*.26,-rw/2],[-1.25,rh-.52+j*.26,rw/2],.022,blue);+ rod('Radar diagonal brace L',[-1.25,rh-.52,-rw/2],[-1.25,rh+.52,0],.026,ivory);+ rod('Radar diagonal brace R',[-1.25,rh+.52,0],[-1.25,rh-.52,rw/2],.026,ivory);+ part('Radar rotator bearing',cylinderGeo(.22,.28,.26,12),brass,[-1.25,rh-.65,0]);+ for(let i=0;i<4;i++){+ const y=6.1+i*.58,w=.53*(1-i*.17),wn=.53*(1-(i+1)*.17);+ for(const s of [-1,1]){+ rod('Mast lattice leg '+s+' '+i,[-1.25,y,s*w],[-1.25,y+.58,s*wn],.044,navy);+ rod('Mast lattice cross '+s+' '+i,[-1.25,y,s*w],[-1.25,y+.58,-s*wn],.025,ivory);+ }+ }+ for(const s of [-1,1]){+ rod('Mast tension rigging '+s,[-1.25,8.6,0],[-5.0,3.83,s*1.45],.012,black);+ rod('Signal halyard '+s,[-1.25,7.8,s*1.6],[-1.25,5.5,s*1.6],.012,brass);+ for(let i=0;i<3;i++){+ box('Signal flag '+s+' '+i,[.025,.28,.4],[-1.25,7.25-i*.43,s*1.4],i===1?glass:red);+ box('Signal flag stripe '+s+' '+i,[.028,.07,.4],[-1.25,7.25-i*.43,s*1.4],white);+ }+ }+ // Observation roof railing emphasizes the stepped bridge as an occupied structure.+ for(const s of [-1,1]){+ for(let x=-.6;x<2.4;x+=.45)rod('Bridge roof stanchion '+s+' '+x,[x,6.03,s*1.35],[x,6.35,s*1.35],.02,navy);+ rod('Bridge roof handrail '+s,[-.6,6.35,s*1.35],[2.3,6.35,s*1.35],.025,brass);+ }+ // Deck crane amidships aft, with an open triangular boom and suspended hook.+ part('Crane slewing base',cylinderGeo(.3,.4,.45,12),navy,[-7.7,4.02,0]);+ rod('Crane mast',[-7.7,4.1,0],[-7.7,5.55,0],.07,brass);+ rod('Crane boom upper',[-7.7,5.55,0],[-9.0,5.4,1.4],.055,brass);+ rod('Crane boom lower',[-7.7,4.75,0],[-9.0,5.4,1.4],.045,brass);+ rod('Crane hanging cable',[-9,5.4,1.4],[-9,4.35,1.4],.017,black);+ part('Crane hook',torusGeo(.09,.025,6,12),brass,[-9,4.27,1.4]);+ // Davit-carried lifeboats, secondary twin mounts and ventilators.+ for(const s of [-1,1]){+ for(const x of [-3.6,-6.2]){+ const boat=part('Lifeboat hull '+s+' '+x,cylinderGeo(.5,.28,2.25,8),ivory,[x,4.22,s*2.17],[0,0,90]);boat.scale.z=.55;+ box('Lifeboat dark cockpit '+s+' '+x,[1.5,.1,.46],[x,4.5,s*2.17],navy);+ for(const xx of [x-.65,x+.65]){rod('Boat davit upright '+s+' '+xx,[xx,3.75,s*1.5],[xx,4.9,s*1.5],.05,brass);rod('Boat davit arm '+s+' '+xx,[xx,4.9,s*1.5],[xx,4.9,s*2.2],.05,brass);rod('Boat sling '+s+' '+xx,[xx,4.9,s*2.2],[xx,4.45,s*2.2],.018,black);}+ }+ for(const x of [-8,-.8,6.0]){+ part('Secondary pedestal '+s+' '+x,cylinderGeo(.43,.5,.42,12),navy,[x,3.03,s*2.2]);+ box('Secondary shield '+s+' '+x,[.72,.55,.8],[x,3.42,s*2.2],ivory);+ for(const dx of [-.19,.19])rod('Secondary barrel '+s+' '+x+' '+dx,[x+dx,3.43,s*2.3],[x+dx,3.85,s*3.6],.047,blue);+ }+ for(const x of [-12,-9,10,12]){+ part('Mooring bollard '+s+' '+x,cylinderGeo(.09,.12,.27,8),navy,[x,2.96,s*1.1]);+ box('Bollard cap '+s+' '+x,[.3,.06,.19],[x,3.12,s*1.1],brass);+ }+ for(const x of [-5,-3,-1]){+ box('Hull armour applique '+s+' '+x,[1.5,.42,.11],[x,1.96,s*3.31],blue);+ part('Life ring '+s+' '+x,torusGeo(.18,.045,8,16),orange,[x,3.4,s*1.78]);+ }+ }+ // Foredeck anchor gear: winches, chain links and starboard anchor silhouette.+ for(const s of [-1,1]){+ part('Anchor capstan '+s,cylinderGeo(.25,.32,.3,12),blue,[12,2.99,s*.65]);+ for(let i=0;i<12;i++)part('Anchor chain link '+s+' '+i,torusGeo(.07,.018,6,10),black,[12.25+i*.145,2.84,s*(.65+i*.015)],[90,i%2*60,0]);+ rod('Anchor shank '+s,[13.8,2.38,s*1.5],[13.8,1.62,s*1.55],.05,brass);+ rod('Anchor crossbar '+s,[13.48,2.16,s*1.51],[14.12,2.16,s*1.51],.045,brass);+ rod('Anchor fluke L '+s,[13.8,1.62,s*1.55],[13.45,1.9,s*1.55],.055,brass);+ rod('Anchor fluke R '+s,[13.8,1.62,s*1.55],[14.15,1.9,s*1.55],.055,brass);+ }+ // Stern aircraft-free working deck with winch and crane.+ part('Stern winch',cylinderGeo(.3,.3,.65,12),blue,[-13.1,3.08,0],[90,0,0]);+ rod('Stern flagstaff',[-14.7,2.83,0],[-14.7,4.7,0],.035,brass);+ box('Fleet pennant',[.02,.44,.8],[-14.7,4.43,.42],red);+ box('Pennant ivory stripe',[.024,.12,.8],[-14.7,4.43,.42],ivory);+ // Shared dimensions scale the entire assembly and preserve all attachment relationships.+ root.scale.set(DESIGN.length/32,DESIGN.deckY/2.8,DESIGN.beam/6.6);+ return root;+}diff --git a/examples/demo-resolute-polar-fleet-flagship.provenance.json b/examples/demo-resolute-polar-fleet-flagship.provenance.jsonnew file mode 100644index 00000000..91f862b2--- /dev/null+++ b/examples/demo-resolute-polar-fleet-flagship.provenance.json@@ -0,0 +1,54 @@+{+ "sourceHash": "23e70f4f899e07478b5392505a13446b77ae382962fbcb9e8c9ac794ddbc5c70",+ "model": "Not independently recorded",+ "harness": "Recorded demo session",+ "authoredDate": "2026-09-08",+ "provenance": {+ "attribution": "Recorded demo session; model credit supplied only where the retained run identifies it.",+ "sourceAccess": "See retained demo run; no stronger isolation claim is made.",+ "humanIntervention": "Owner supplied direction; model-authored exported source preserved byte-for-byte.",+ "reviewFidelity": "Authoring feedback and shaded demo previews where available. Not a destination-runtime acceptance claim.",+ "poster": "Gallery GPU render of the exact downloadable GLB. Source, artifact, image hashes and camera settings are recorded alongside the poster.",+ "evaluationGlbHash": "98635224ad680869f73487e73450d02c3dbb6c51651e91f1394da1a56e913088",+ "posterReceipt": {+ "captureIdentity": [+ "kiln.capture-producer.v1",+ "sha256:10f346ec6287c8d635dabe4668d72925080e6fe3d059dd7a9252f2694ce595c2",+ "44832275-6b15-4353-8fcb-ac1de3fda8e6",+ "dawn-d3d12:nvidia-geforce-rtx-3070:D3D12 driver version 32.0.16.1074"+ ],+ "sourceHash": "23e70f4f899e07478b5392505a13446b77ae382962fbcb9e8c9ac794ddbc5c70",+ "artifactHash": "fe33b80bfe154eff8ebb2e68c2a190c66065f49628e0a3d87565566cea122cf3",+ "imageHash": "10aef199f5f8c0b50009219501e3abdd78e24223930c373126bca5b19069d21a",+ "width": 1024,+ "height": 1024,+ "camera": {+ "version": "kiln.camera.v1",+ "projection": "orthographic",+ "position": [+ 52.77781367726672,+ 28.534180567339824,+ 37.1987710018026+ ],+ "target": [+ 0.407574168767243,+ 3.3964656032600713,+ 0.5396033458529658+ ],+ "up": [+ 0,+ 1,+ 0+ ],+ "aspect": 1,+ "near": 0.01,+ "far": 171.72727784593408,+ "halfHeight": 10.795037537140981+ },+ "rendererId": "dawn-d3d12:nvidia-geforce-rtx-3070:D3D12 driver version 32.0.16.1074",+ "materialFaithful": true,+ "lightingPresetId": "gallery-studio-v1",+ "purpose": "Gallery poster generated from the exact downloadable GLB; separate from authoring feedback."+ }+ }+}diff --git a/examples/demo-solar-sail-courier.kiln.js b/examples/demo-solar-sail-courier.kiln.jsnew file mode 100644index 00000000..9b624efb--- /dev/null+++ b/examples/demo-solar-sail-courier.kiln.js@@ -0,0 +1,318 @@+const meta = {+ name: 'Solar sail courier',+ category: 'vehicle',+ role: 'vehicle',+};++function makeFoilFacet(positions, indices) {+ const doubleIndices = [...indices];+ for (let i = 0; i < indices.length; i += 3) {+ doubleIndices.push(indices[i], indices[i + 2], indices[i + 1]);+ }+ return meshGeo({ positions, indices: doubleIndices });+}++async function build() {+ const root = createRoot('SolarCourier');++ // Materials palette+ const ivoryHull = gameMaterial(0xf6f3ea, { roughness: 0.28, metalness: 0.08 });+ const ivoryDarkTrim = gameMaterial(0x23272e, { roughness: 0.5, metalness: 0.6 });+ const copperSail = gameMaterial(0xd97543, { roughness: 0.22, metalness: 0.92 });+ const goldSail = gameMaterial(0xf5be38, { roughness: 0.18, metalness: 0.95 });+ const carbonSpar = gameMaterial(0x181a1f, { roughness: 0.45, metalness: 0.3 });+ const titaniumFitting = gameMaterial(0x9da7b3, { roughness: 0.3, metalness: 0.85 });+ const amberSensor = gameMaterial(0xff9911, { emissive: 0xff7700, emissiveIntensity: 0.85, roughness: 0.15 });+ const cyanBeacon = gameMaterial(0x38e1b0, { emissive: 0x12b886, emissiveIntensity: 1.0 });+ const plasmaBlue = gameMaterial(0x66d9e8, { emissive: 0x339af0, emissiveIntensity: 1.2 });+ const solarCellDark = gameMaterial(0x162130, { roughness: 0.2, metalness: 0.7 });++ // -------------------------------------------------------------+ // 1. COMPACT IVORY CARGO POD+ // -------------------------------------------------------------+ const podCenter = [0, 1.38, 0];+ const podBody = createPivot('PodBody', podCenter, root);++ // Main Cargo Bay Capsule+ const mainHullGeo = await roundedBoxGeo(1.3, 0.58, 0.68, 0.09);+ createPart('MainHull', mainHullGeo, ivoryHull, { position: [0, 0, 0], parent: podBody });++ // Dorsal Equipment Spine Fairing+ const spineGeo = await roundedBoxGeo(1.4, 0.12, 0.38, 0.04);+ createPart('DorsalSpine', spineGeo, ivoryHull, { position: [0.05, 0.32, 0], parent: podBody });++ // Photovoltaic power strip on spine+ createPart('SolarStrip', boxGeo(1.1, 0.015, 0.22), solarCellDark, { position: [0.05, 0.39, 0], parent: podBody });++ // High-gain communications dish & mast+ createPart('CommMast', cylinderGeo(0.018, 0.018, 0.14, 8), titaniumFitting, { position: [0.35, 0.45, 0], parent: podBody });+ createPart('CommDish', coneGeo(0.12, 0.05, 16), goldSail, { position: [0.38, 0.54, 0], rotation: [0, 0, -45], parent: podBody });+ createPart('CommFeed', cylinderGeo(0.006, 0.006, 0.08, 6), titaniumFitting, { position: [0.42, 0.58, 0], rotation: [0, 0, -45], parent: podBody });++ // Lateral Cargo Access Hatches (Port & Starboard)+ for (const side of [-1, 1]) {+ const zPos = side * 0.345;+ createPart(`CargoDoor_${side > 0 ? 'Stbd' : 'Port'}`, boxGeo(0.65, 0.36, 0.02), ivoryDarkTrim, { position: [-0.05, 0, zPos], parent: podBody });+ createPart(`CargoLatchA_${side > 0 ? 'Stbd' : 'Port'}`, boxGeo(0.04, 0.08, 0.03), titaniumFitting, { position: [-0.32, 0, zPos + side * 0.01], parent: podBody });+ createPart(`CargoLatchB_${side > 0 ? 'Stbd' : 'Port'}`, boxGeo(0.04, 0.08, 0.03), titaniumFitting, { position: [0.22, 0, zPos + side * 0.01], parent: podBody });+ createPart(`StatusLight_${side > 0 ? 'Stbd' : 'Port'}`, boxGeo(0.55, 0.025, 0.02), cyanBeacon, { position: [-0.05, 0.16, zPos + side * 0.012], parent: podBody });+ }++ // Fore Avionics & Sensor Nose Module+ const noseCowlGeo = await roundedBoxGeo(0.44, 0.52, 0.60, 0.07);+ createPart('NoseCowl', noseCowlGeo, ivoryHull, { position: [0.72, 0, 0], parent: podBody });++ // Aerodynamic nose cap+ createPart('NoseCap', cylinderXGeo(0.24, 0.09, 0.28, 16), ivoryHull, { position: [0.98, 0, 0], parent: podBody });++ // Optical LIDAR / Navigation Sensor Eye+ createPart('SensorHousing', cylinderXGeo(0.12, 0.12, 0.08, 16), ivoryDarkTrim, { position: [1.08, 0, 0], parent: podBody });+ createPart('SensorLens', sphereGeo(0.09, 16, 12), amberSensor, { position: [1.11, 0, 0], parent: podBody });++ // Twin Star-Tracker Pods on upper nose+ for (const side of [-1, 1]) {+ createPart(`StarTracker_${side > 0 ? 'R' : 'L'}`, cylinderGeo(0.035, 0.04, 0.1, 8), ivoryDarkTrim, { position: [0.78, 0.25, side * 0.18], rotation: [side * 20, 0, 0], parent: podBody });+ createPart(`TrackerLens_${side > 0 ? 'R' : 'L'}`, sphereGeo(0.03, 8, 6), amberSensor, { position: [0.78, 0.3, side * 0.2], parent: podBody });+ }++ // Forward RCS Thruster Quads+ for (const side of [-1, 1]) {+ const sideKey = side > 0 ? 'R' : 'L';+ const rcsBase = createPivot(`RCS_Fwd_${sideKey}`, [0.82, 0, side * 0.32], podBody);+ createPart(`RcsHub_${sideKey}`, sphereGeo(0.035, 8, 6), titaniumFitting, { parent: rcsBase });+ createPart(`RcsNozzle_Up_${sideKey}`, coneGeo(0.02, 0.04, 8), titaniumFitting, { position: [0, 0.04, 0], parent: rcsBase });+ createPart(`RcsNozzle_Dn_${sideKey}`, coneGeo(0.02, 0.04, 8), titaniumFitting, { position: [0, -0.04, 0], rotation: [180, 0, 0], parent: rcsBase });+ createPart(`RcsNozzle_Out_${sideKey}`, coneGeo(0.02, 0.04, 8), titaniumFitting, { position: [0, 0, side * 0.04], rotation: [0, 0, side * 90], parent: rcsBase });+ }++ // Aft Service & Propulsion Collar+ const aftTaperGeo = cylinderXGeo(0.33, 0.27, 0.45, 16);+ createPart('AftHullTaper', aftTaperGeo, ivoryHull, { position: [-0.75, 0, 0], parent: podBody });++ // Sail Deployment Collar Ring+ createPart('DeploymentCollar', torusGeo(0.42, 0.045, 12, 24), titaniumFitting, { position: [-0.55, 0, 0], rotation: [0, 90, 0], parent: podBody });+ createPart('CollarCore', cylinderXGeo(0.38, 0.38, 0.14, 16), ivoryDarkTrim, { position: [-0.55, 0, 0], parent: podBody });++ // Main Ion Engine Bell & Grapple Ring+ createPart('EngineShroud', cylinderXGeo(0.26, 0.22, 0.22, 16), ivoryDarkTrim, { position: [-1.02, 0, 0], parent: podBody });+ createPart('IonEngineBell', cylinderXGeo(0.14, 0.24, 0.28, 16), titaniumFitting, { position: [-1.16, 0, 0], parent: podBody });+ createPart('IonNozzleRim', torusGeo(0.24, 0.015, 10, 20), titaniumFitting, { position: [-1.30, 0, 0], rotation: [0, 90, 0], parent: podBody });+ createPart('IonPlasmaCore', sphereGeo(0.12, 12, 8), plasmaBlue, { position: [-1.12, 0, 0], parent: podBody });+ createPart('DockingRing', torusGeo(0.25, 0.025, 10, 20), titaniumFitting, { position: [-0.94, 0, 0], rotation: [0, 90, 0], parent: podBody });++ // Retractable Landing Struts (touching ground at Y=0)+ const landingLegs = [+ { name: 'Leg_FL', top: [0.45, -0.22, -0.32], foot: [0.65, -1.36, -0.52] },+ { name: 'Leg_FR', top: [0.45, -0.22, 0.32], foot: [0.65, -1.36, 0.52] },+ { name: 'Leg_RL', top: [-0.45, -0.22, -0.32], foot: [-0.65, -1.36, -0.52] },+ { name: 'Leg_RR', top: [-0.45, -0.22, 0.32], foot: [-0.65, -1.36, 0.52] },+ ];+ for (const leg of landingLegs) {+ beamBetween(leg.name, leg.top, leg.foot, 0.022, titaniumFitting, { parent: podBody });+ createPart(`${leg.name}_Foot`, boxGeo(0.22, 0.035, 0.12), titaniumFitting, { position: [leg.foot[0], leg.foot[1] + 0.018, leg.foot[2]], parent: podBody });+ }++ // -------------------------------------------------------------+ // 2. DELICATE STRUCTURAL SPARS (4 Radial Booms)+ // -------------------------------------------------------------+ const sparAngles = [45, 135, 225, 315];+ for (let k = 0; k < 4; k++) {+ const angleDeg = sparAngles[k];+ const angleRad = (angleDeg * Math.PI) / 180;++ // Fixed base mount for spar k on the deployment collar+ const sparMount = createPivot(`SparMount_${k}`, [-0.55, 0, 0], podBody);+ sparMount.rotation.x = angleRad;++ // Gimbal mounting bracket on collar+ createPart(`GimbalBracket_${k}`, boxGeo(0.14, 0.12, 0.14), titaniumFitting, { position: [0, 0.44, 0], parent: sparMount });++ // Articulated Root Hinge: Joint_SparRoot_k+ // Initial folded pose: rotated back along pod hull (rotation.z = -78 deg)+ const sparRoot = createPivot(`SparRoot_${k}`, [0, 0.44, 0], sparMount);+ sparRoot.rotation.z = (-78 * Math.PI) / 180;++ // Hinge pin+ createPart(`HingePin_${k}`, cylinderZGeo(0.024, 0.024, 0.14, 10), titaniumFitting, { parent: sparRoot });++ // Inner Spar Truss: twin carbon chords and diagonal lattice lacing+ const chordLen = 2.1;+ createPart(`ChordA_${k}`, cylinderGeo(0.016, 0.016, chordLen, 8), carbonSpar, { position: [0, chordLen / 2, -0.035], parent: sparRoot });+ createPart(`ChordB_${k}`, cylinderGeo(0.016, 0.016, chordLen, 8), carbonSpar, { position: [0, chordLen / 2, 0.035], parent: sparRoot });++ // Cross-truss battens along inner spar+ for (let s = 1; s <= 5; s++) {+ const yBatten = s * 0.35;+ createPart(`Batten_${k}_${s}`, boxGeo(0.018, 0.014, 0.08), titaniumFitting, { position: [0, yBatten, 0], parent: sparRoot });+ beamBetween(`Brace_${k}_${s}`, [0, yBatten - 0.16, -0.035], [0, yBatten + 0.16, 0.035], 0.007, titaniumFitting, { parent: sparRoot });+ }++ // Articulated Elbow Hinge: Joint_SparElbow_k at tip of inner spar (Y = 2.1)+ // Initial folded pose: folded back along inner spar (rotation.z = +152 deg)+ const sparElbow = createPivot(`SparElbow_${k}`, [0, chordLen, 0], sparRoot);+ sparElbow.rotation.z = (152 * Math.PI) / 180;++ // Elbow knuckle & spreader strut+ createPart(`ElbowKnuckle_${k}`, boxGeo(0.08, 0.12, 0.09), titaniumFitting, { parent: sparElbow });+ createPart(`SpreaderStrut_${k}`, cylinderGeo(0.008, 0.008, 0.18, 6), titaniumFitting, { position: [0, 0.05, 0.1], rotation: [90, 0, 0], parent: sparElbow });+ createPart(`SpreaderPulley_${k}`, torusGeo(0.022, 0.006, 8, 12), goldSail, { position: [0, 0.05, 0.19], parent: sparElbow });++ // Outer Spar Boom: tapered carbon lattice boom+ const outerLen = 2.3;+ createPart(`OuterBoom_${k}`, cylinderGeo(0.012, 0.02, outerLen, 8), carbonSpar, { position: [0, outerLen / 2, 0], parent: sparElbow });++ // Outer Spar Battens+ for (let s = 1; s <= 4; s++) {+ const yOut = s * 0.45;+ createPart(`OuterBatten_${k}_${s}`, boxGeo(0.014, 0.012, 0.045), titaniumFitting, { position: [0, yOut, 0], parent: sparElbow });+ }++ // Spar Tip Assembly at Y = outerLen+ const sparTip = createPivot(`SparTip_${k}`, [0, outerLen, 0], sparElbow);+ createPart(`TipFitting_${k}`, boxGeo(0.05, 0.08, 0.05), titaniumFitting, { parent: sparTip });+ createPart(`TipTensioner_${k}`, torusGeo(0.025, 0.006, 8, 12), goldSail, { position: [0, 0.04, 0], parent: sparTip });+ createPart(`TipBeacon_${k}`, sphereGeo(0.022, 8, 6), cyanBeacon, { position: [0, 0.07, 0], parent: sparTip });++ // -------------------------------------------------------------+ // 3. FOLDED COPPER-AND-GOLD SAILS (Dual-Wing Origami Facets)+ // -------------------------------------------------------------+ // Inner Sail Package: Joint_SailFold_k_Inner attached to sparRoot+ const sailInner = createPivot(`SailFold_${k}_Inner`, [0, 0, 0], sparRoot);+ sailInner.rotation.x = (60 * Math.PI) / 180;+ sailInner.rotation.z = (-32 * Math.PI) / 180;+ sailInner.scale.set(0.12, 0.95, 0.12);++ // Starboard Wing (towards +Z)+ createPart(`Sail_Cu_InnerA_${k}`, makeFoilFacet([+ 0, 0.15, 0,+ 0, 1.1, 0,+ -0.05, 0.85, 0.65,+ -0.03, 0.2, 0.25+ ], [0, 1, 2, 0, 2, 3]), copperSail, { parent: sailInner });++ createPart(`Sail_Au_InnerA_${k}`, makeFoilFacet([+ 0, 1.1, 0,+ 0, 2.05, 0,+ -0.08, 1.6, 1.35,+ -0.05, 0.85, 0.65+ ], [0, 1, 2, 0, 2, 3]), goldSail, { parent: sailInner });++ // Port Wing (towards -Z)+ createPart(`Sail_Cu_InnerB_${k}`, makeFoilFacet([+ 0, 0.15, 0,+ 0, 1.1, 0,+ -0.05, 0.85, -0.65,+ -0.03, 0.2, -0.25+ ], [0, 1, 2, 0, 2, 3]), copperSail, { parent: sailInner });++ createPart(`Sail_Au_InnerB_${k}`, makeFoilFacet([+ 0, 1.1, 0,+ 0, 2.05, 0,+ -0.08, 1.6, -1.35,+ -0.05, 0.85, -0.65+ ], [0, 1, 2, 0, 2, 3]), goldSail, { parent: sailInner });++ // Outer Sail Package: Joint_SailFold_k_Outer attached to sparElbow+ const sailOuter = createPivot(`SailFold_${k}_Outer`, [0, 0, 0], sparElbow);+ sailOuter.rotation.x = (-55 * Math.PI) / 180;+ sailOuter.rotation.z = (30 * Math.PI) / 180;+ sailOuter.scale.set(0.12, 0.95, 0.12);++ // Outer Starboard Wing (towards +Z)+ createPart(`Sail_Cu_OuterA_${k}`, makeFoilFacet([+ 0, 0.02, 0,+ 0, 1.15, 0,+ -0.10, 0.85, 1.85,+ -0.08, 0.02, 1.35+ ], [0, 1, 2, 0, 2, 3]), copperSail, { parent: sailOuter });++ createPart(`Sail_Au_OuterA_${k}`, makeFoilFacet([+ 0, 1.15, 0,+ 0, 2.25, 0,+ -0.12, 1.75, 2.45,+ -0.10, 0.85, 1.85+ ], [0, 1, 2, 0, 2, 3]), goldSail, { parent: sailOuter });++ beamBetween(`SailEdgeA_${k}`, [0, 2.25, 0], [-0.12, 1.75, 2.45], 0.007, carbonSpar, { parent: sailOuter });++ // Outer Port Wing (towards -Z)+ createPart(`Sail_Cu_OuterB_${k}`, makeFoilFacet([+ 0, 0.02, 0,+ 0, 1.15, 0,+ -0.10, 0.85, -1.85,+ -0.08, 0.02, -1.35+ ], [0, 1, 2, 0, 2, 3]), copperSail, { parent: sailOuter });++ createPart(`Sail_Au_OuterB_${k}`, makeFoilFacet([+ 0, 1.15, 0,+ 0, 2.25, 0,+ -0.12, 1.75, -2.45,+ -0.10, 0.85, -1.85+ ], [0, 1, 2, 0, 2, 3]), goldSail, { parent: sailOuter });++ beamBetween(`SailEdgeB_${k}`, [0, 2.25, 0], [-0.12, 1.75, -2.45], 0.007, carbonSpar, { parent: sailOuter });+ }++ return root;+}++function animate(root) {+ const tracks = [];+ const duration = 3.6;++ for (let k = 0; k < 4; k++) {+ // 1. Root Spar Rotation Track: sweeps outward from folded (-78 deg) to deployed (0 deg)+ tracks.push(rotationTrack(`Joint_SparRoot_${k}`, [+ { time: 0.0, rotation: [0, 0, -78] },+ { time: 0.8, rotation: [0, 0, -65] },+ { time: 2.0, rotation: [0, 0, -20] },+ { time: 2.8, rotation: [0, 0, 0] },+ { time: 3.2, rotation: [0, 0, 0.8] },+ { time: 3.6, rotation: [0, 0, 0] },+ ]));++ // 2. Elbow Spar Rotation Track: unfolds from folded (+152 deg) to straight (0 deg)+ tracks.push(rotationTrack(`Joint_SparElbow_${k}`, [+ { time: 0.0, rotation: [0, 0, 152] },+ { time: 0.6, rotation: [0, 0, 145] },+ { time: 1.8, rotation: [0, 0, 45] },+ { time: 2.8, rotation: [0, 0, 0] },+ { time: 3.2, rotation: [0, 0, -0.6] },+ { time: 3.6, rotation: [0, 0, 0] },+ ]));++ // 3. Inner Sail Package: expands from folded accordion pleat to full taut membrane+ tracks.push(rotationTrack(`Joint_SailFold_${k}_Inner`, [+ { time: 0.0, rotation: [60, 0, -32] },+ { time: 1.0, rotation: [42, 0, -20] },+ { time: 2.0, rotation: [18, 0, -8] },+ { time: 2.8, rotation: [0, 0, 0] },+ { time: 3.6, rotation: [0, 0, 0] },+ ]));+ tracks.push(scaleTrack(`Joint_SailFold_${k}_Inner`, [+ { time: 0.0, scale: [0.12, 0.95, 0.12] },+ { time: 1.0, scale: [0.35, 0.97, 0.35] },+ { time: 2.0, scale: [0.72, 1.0, 0.72] },+ { time: 2.8, scale: [1.0, 1.0, 1.0] },+ { time: 3.6, scale: [1.0, 1.0, 1.0] },+ ]));++ // 4. Outer Sail Package: unfurls outwards to full radial span+ tracks.push(rotationTrack(`Joint_SailFold_${k}_Outer`, [+ { time: 0.0, rotation: [-55, 0, 30] },+ { time: 1.0, rotation: [-38, 0, 18] },+ { time: 2.0, rotation: [-16, 0, 6] },+ { time: 2.8, rotation: [0, 0, 0] },+ { time: 3.6, rotation: [0, 0, 0] },+ ]));+ tracks.push(scaleTrack(`Joint_SailFold_${k}_Outer`, [+ { time: 0.0, scale: [0.12, 0.95, 0.12] },+ { time: 1.0, scale: [0.35, 0.97, 0.35] },+ { time: 2.0, scale: [0.72, 1.0, 0.72] },+ { time: 2.8, scale: [1.0, 1.0, 1.0] },+ { time: 3.6, scale: [1.0, 1.0, 1.0] },+ ]));+ }++ return [createClip('Deploy', duration, tracks)];+}diff --git a/examples/demo-solar-sail-courier.provenance.json b/examples/demo-solar-sail-courier.provenance.jsonnew file mode 100644index 00000000..a588c139--- /dev/null+++ b/examples/demo-solar-sail-courier.provenance.json@@ -0,0 +1,33 @@+{+ "sourceHash": "aeb05750d6b48e52dc56f9e068c41cb897bcaa5159380b60e52748ca22bd6e66",+ "model": "Gemini 3.8 Flash",+ "harness": "Antigravity CLI",+ "authoredDate": "2026-09-09",+ "provenance": {+ "attribution": "Recorded demo session; model credit supplied only where the retained run identifies it.",+ "sourceAccess": "See retained demo run; no stronger isolation claim is made.",+ "humanIntervention": "Owner supplied direction; model-authored exported source preserved byte-for-byte.",+ "reviewFidelity": "Authoring feedback and shaded demo previews where available. Not a destination-runtime acceptance claim.",+ "poster": "Fresh shaded render of the exact gallery-built downloadable GLB. Camera-only offline capture; no geometry or material edits.",+ "evaluationGlbHash": "247553ffcd8898d00f51bacf298bc3965bfbc8c90a9bca89f72ab8a1af920273",+ "posterReceipt": {+ "sourceHash": "aeb05750d6b48e52dc56f9e068c41cb897bcaa5159380b60e52748ca22bd6e66",+ "artifactHash": "e097fe0ee7dc46727628e26c425a262d57980a0138528b840f8881486565e341",+ "imageHash": "32c48e7d4a095a69df135d1822995644b662abcc0016a3ab338cd2c2ac3bdf11",+ "width": 1600,+ "height": 1000,+ "renderer": "ANGLE (NVIDIA, NVIDIA GeForce RTX 3070 (0x00002484) Direct3D11 vs_5_0 ps_5_0, D3D11)",+ "captureMethod": "Kiln studio stage, owned headless Chrome, original GLB materials",+ "cameraRecord": {+ "index": 10,+ "kind": "hero",+ "theta": 0.6747409422235527,+ "phi": 1.185083808592412,+ "radius": 8.035866351324646,+ "fixedSeconds": null,+ "wallTimeMs": 121.5+ },+ "geometryChanged": false+ }+ }+}diff --git a/examples/demo-umbra-submarine.kiln.js b/examples/demo-umbra-submarine.kiln.jsnew file mode 100644index 00000000..b2249897--- /dev/null+++ b/examples/demo-umbra-submarine.kiln.js@@ -0,0 +1,153 @@+const meta = {name:'UMBRA SSN - Nuclear Submarine',category:'vehicle',role:'vehicle'};+function build(){+ const root=createRoot('UMBRA_SSN');+ const P={cy:6.2, radius:5.5, sailTop:21.5};+ // Game LOD: named source parts remain editable; export batches static geometry.+ const Q={hullLength:64,hullHalf:24,foil:16,cylinder:12,sphereWidth:20,sphereHeight:12,batchStatic:true,triangleLimit:20000};+ const hull=gameMaterial(0x202b32,{metalness:.45,roughness:.43,flatShading:false});+ const lower=gameMaterial(0x182126,{metalness:.35,roughness:.53,flatShading:false});+ const panel=gameMaterial(0x303d44,{metalness:.5,roughness:.44,flatShading:false});+ const seam=gameMaterial(0x111a1e,{roughness:.7,flatShading:false});+ const edge=gameMaterial(0x60717a,{metalness:.7,roughness:.32,flatShading:false});+ const bronze=gameMaterial(0x9d7640,{metalness:.82,roughness:.3,flatShading:false});+ const glass=gameMaterial(0x17383f,{metalness:.55,roughness:.16,flatShading:false});+ const ivory=gameMaterial(0xc5c9bd,{roughness:.65});+ const add=(n,g,m,p=[0,0,0],r=[0,0,0],parent=root)=>createPart(n,g,m,{position:p,rotation:r,parent});+ const box=(n,s,m,p,r)=>add(n,new THREE.BoxGeometry(...s),m,p,r);+ const cyl=(n,rt,rb,h,m,p,r)=>add(n,new THREE.CylinderGeometry(rt,rb,h,rt<.1?6:Q.cylinder),m,p,r);+ const sphere=(n,s,m,p)=>createPart(n,new THREE.SphereGeometry(1,Q.sphereWidth,Q.sphereHeight),m,{position:p,scale:s,parent:root});+ const line=(n,pts,r,m)=>add(n,new THREE.TubeGeometry(new THREE.CatmullRomCurve3(pts.map(p=>new THREE.Vector3(...p))),Math.max(6,Math.min(24,pts.length*2)),r,4,false),m);+ const stations=[[-55,0.35],[-52,.65],[-49,1.3],[-45,2.15],[-39,3.25],[-31,4.55],[-22,5.23],[-12,5.47],[0,5.5],[20,5.5],[34,5.44],[43,4.95],[49,3.95],[53,2.5],[55,.15]];+ const curve=new THREE.CatmullRomCurve3(stations.map(p=>new THREE.Vector3(p[0],p[1],0)),false,'centripetal');+ const samples=curve.getPoints(Q.hullLength);+ // Adjacent upper/lower surfaces eliminate the hidden duplicate underside.+ const geo=new THREE.LatheGeometry(samples.map(p=>new THREE.Vector2(p.y,p.x)),Q.hullHalf,Math.PI,Math.PI);+ geo.rotateZ(-Math.PI/2);+ add('Pressure_Hull',geo,hull,[0,P.cy,0]);+ function radius(x){let a=samples[0];for(const b of samples){if(b.x>=x){const t=(x-a.x)/(b.x-a.x||1);return a.y+(b.y-a.y)*t;}a=b;}return a.y;}+ // Lower half meets the upper half at the equator.+ const low=new THREE.LatheGeometry(samples.map(p=>new THREE.Vector2(p.y,p.x)),Q.hullHalf,0,Math.PI);+ low.rotateZ(-Math.PI/2);add('Lower_Hull_Coating',low,lower,[0,P.cy,0]);+ // Fine circumferential joints, deliberately darker than the hull.+ [-39,-30,-18,-5,8,27,38,45].forEach((x,i)=>add('Hull_Expansion_Seam_'+i,new THREE.TorusGeometry(radius(x)+.008,.027,3,Q.hullHalf*2),seam,[x,P.cy,0],[0,90,0]));+ function foil(chord,width,cx=0){const p=[];const N=Q.foil;for(let i=0;i<=N;i++){let t=i/N;let z=5*width*(.2969*Math.sqrt(t)-.126*t-.3516*t*t+.2843*t*t*t-.1036*t*t*t*t);p.push([cx+chord/2-chord*t,z]);}for(let i=N-1;i>0;i--){let t=i/N;let z=5*width*(.2969*Math.sqrt(t)-.126*t-.3516*t*t+.2843*t*t*t-.1036*t*t*t*t);p.push([cx+chord/2-chord*t,-z]);}return p;}+ add('Dorsal_Casing',loftProfiles([{profile:foil(69,4.1),frame:{origin:[4,10.8,0]}},{profile:foil(68,3.6),frame:{origin:[4,11.55,0]}}]),hull);+ add('Tall_Streamlined_Sail',loftProfiles([+ {profile:foil(18,4.9),frame:{origin:[13,10.8,0]}},+ {profile:foil(16.8,4.3),frame:{origin:[13.2,13,0]}},+ {profile:foil(15.3,3.8),frame:{origin:[13.7,P.sailTop-.45,0]}},+ {profile:foil(14.7,3.5),frame:{origin:[13.65,P.sailTop,0]}}]),panel);+ add('Sail_Crown',loftProfiles([{profile:foil(14.8,3.55),frame:{origin:[13.65,21.43,0]}},{profile:foil(14.5,3.4),frame:{origin:[13.65,21.63,0]}}]),hull);+ // Hydroplanes have a thick leading edge, tapered tips and swept trailing geometry.+ function fin(name,x,y,z,span,chord,rot){+ const f=loftProfiles([{profile:foil(chord,1.05),frame:{origin:[0,0,0]}},{profile:foil(chord*.9,.72,-.5),frame:{origin:[0,span*.62,0]}},{profile:foil(chord*.49,.23,-1.05),frame:{origin:[0,span,0]}}]);+ add(name,f,hull,[x,y,z],[rot,0,0]);+ }+ fin('Stern_Upper_Rudder',-45,6.2,0,9.5,10.5,0);+ fin('Stern_Lower_Rudder',-45,6.2,0,6.1,10.5,180);+ fin('Stern_Starboard_Plane',-45,6.2,0,10.4,10.8,90);+ fin('Stern_Port_Plane',-45,6.2,0,10.4,10.8,-90);+ fin('Sail_Starboard_Plane',15,15.1,1.5,6,5.8,90);+ fin('Sail_Port_Plane',15,15.1,-1.5,6,5.8,-90);+ for(const s of [-1,1]){+ line('Stern_Control_Hinge_'+s,[[-48,6.22,s*3],[-48.8,6.22,s*6.5],[-49.05,6.22,s*9.5]],.042,seam);+ line('Rudder_Hinge_'+s,[[-48,6.2+s*2.1,0],[-48.7,6.2+s*5.5,0]],.045,seam);+ // Bridge optics and inspection panels.+ for(let j=0;j<4;j++)box('Sail_Optical_Window_'+s+'_'+j,[.74,.42,.05],glass,[17.4-j*.94,20.45,s*(.94+j*.1)]);+ line('Sail_Service_Seam_'+s,[[8.3,13.3,s*.8],[8.7,18.8,s*.78],[9,20.6,s*.76]],.025,seam);+ for(let j=0;j<6;j++)box('Sail_Vent_'+s+'_'+j,[.65,.075,.045],seam,[9.4,14.1+j*.23,s*1.54]);+ // Aft free-flood vent bank.+ for(let j=0;j<12;j++){const x=-22+j*.91;const z=s*3.1;const y=P.cy+Math.sqrt(radius(x)*radius(x)-z*z);+ box('Flood_Vent_'+s+'_'+j,[.51,.042,.28],seam,[x,y+.025,z],[s*34,0,0]);}+ }+ // Concentric escape hatches, bolts, grab handles and deck access panels.+ function hatch(name,x,z,r){+ const y=11.57;+ cyl(name+'_Recess',r+.14,r+.14,.07,seam,[x,y,z]);+ cyl(name+'_Rim',r,r,.1,edge,[x,y+.06,z]);+ cyl(name+'_Lid',r*.86,r*.86,.11,hull,[x,y+.14,z]);+ for(let i=0;i<8;i++){const a=i*Math.PI/4;cyl(name+'_Bolt_'+i,.055,.055,.045,bronze,[x+Math.cos(a)*r*.91,y+.15,z+Math.sin(a)*r*.91]);}+ line(name+'_Handle',[[x-.25,y+.16,z],[x-.25,y+.4,z],[x+.25,y+.4,z],[x+.25,y+.16,z]],.045,edge);+ }+ hatch('Forward_Escape_Hatch',29,0,.97);hatch('Aft_Escape_Hatch',-15,0,.85);+ for(let j=0;j<6;j++){const x=-5-j*2.9;box('Deck_Access_Recess_'+j,[2.2,.055,1.45],seam,[x,11.57,0]);box('Deck_Access_Lid_'+j,[2.08,.06,1.33],panel,[x,11.61,0]);}+ // Telescoping sensor package.+ function mast(name,x,z,h,r){+ cyl(name+'_Boot',r*1.65,r*1.9,.38,hull,[x,21.73,z]);+ cyl(name+'_Brass_Collar',r*1.5,r*1.5,.16,bronze,[x,21.98,z]);+ cyl(name+'_Stem',r,r,h,edge,[x,22+h/2,z]);+ cyl(name+'_Black_Sleeve',r*1.04,r*1.04,h*.31,hull,[x,22+h*.25,z]);+ return 22+h;+ }+ let y=mast('Search_Periscope',17,0,5.3,.16);+ box('Periscope_Head',[.72,.4,.42],hull,[17.16,y,0]);+ box('Periscope_Lens',[.026,.21,.25],glass,[17.535,y,0]);+ y=mast('Optronic_Mast',13.5,.14,4.15,.25);+ cyl('Optronic_Head',.38,.35,.84,hull,[13.5,y+.24,.14]);+ box('Optronic_Lens',[.025,.32,.3],glass,[13.88,y+.25,.14]);+ y=mast('Radar_Mast',10.2,0,2.5,.22);+ box('Radar_Array',[2.3,.4,.54],panel,[10.2,y+.1,0]);+ mast('Radio_Antenna',8.3,0,4.0,.075);+ // Low-profile bridge hatch.+ cyl('Bridge_Hatch_Rim',.65,.65,.11,seam,[18.3,21.69,0]);+ cyl('Bridge_Hatch',.52,.52,.12,panel,[18.3,21.77,0]);+ // Seven curved, skewed bronze propeller blades, on an aft shaft.+ cyl('Propeller_Shaft',.39,.39,3.8,edge,[-55.25,6.2,0],[0,0,90]);+ sphere('Propeller_Hub',[1.75,.77,.77],bronze,[-57,6.2,0]);+ for(let i=0;i<7;i++){+ const blade=loftProfiles([+ {profile:foil(1.1,.23),frame:{origin:[0,.55,0],rotation:[0,20,0]}},+ {profile:foil(2.5,.19),frame:{origin:[-.3,2,0],rotation:[0,36,0]}},+ {profile:foil(2.2,.13),frame:{origin:[-.75,3.4,0],rotation:[0,53,0]}},+ {profile:foil(.55,.07),frame:{origin:[-1.3,4.1,0],rotation:[0,63,0]}}]);+ add('Skewed_Propeller_Blade_'+i,blade,bronze,[-56.9,6.2,0],[i*360/7,0,0]);+ }+ // Bow sonar boundary and conformal flank sensor fairings.+ add('Sonar_Cap_Seam',new THREE.TorusGeometry(radius(43)+.023,.045,3,Q.hullHalf*2),seam,[43,6.2,0],[0,90,0]);+ for(const s of [-1,1]){+ sphere('Flank_Array_'+s,[13,.37,.12],panel,[8,6.6,s*5.47]);+ for(let j=0;j<5;j++)box('Draft_Marking_'+s+'_'+j,[.5,.1,.03],ivory,[38,6+j*.42,s*(radius(38)-.02-j*.015)]);+ // Small forward torpedo shutter outlines.+ for(const offset of [-.65,.65]){+ const pts=[];for(let i=0;i<=32;i++){const a=i*Math.PI/16;const x=45+2.3*Math.cos(a), yy=6.2+offset+.48*Math.sin(a);const zz=s*Math.sqrt(Math.max(.1,radius(x)*radius(x)-(yy-6.2)*(yy-6.2)));pts.push([x,yy,zz+s*.02]);}line('Bow_Shutter_'+s+'_'+offset,pts,.035,seam);+ }+ }+ // Keep only triangles needed for the visible exterior; budget includes every mesh.+ if(Q.batchStatic){+ root.updateMatrixWorld(true);+ const groups=new Map(), original=[];+ root.traverse(m=>{+ if(!m.isMesh)return;+ original.push(m);+ const rotating=/Skewed_Propeller_Blade|Propeller_Hub/.test(m.name);+ const key=(rotating?'Propeller_':'Static_')+m.material.uuid;+ if(!groups.has(key))groups.set(key,{material:m.material,rotating,positions:[],normals:[],uvs:[],indices:[],names:[]});+ const b=groups.get(key),g=m.geometry.clone().applyMatrix4(m.matrixWorld);+ const p=g.getAttribute('position'),n=g.getAttribute('normal'),uv=g.getAttribute('uv'),base=b.positions.length/3;+ for(let i=0;i<p.count;i++){+ b.positions.push(p.getX(i)+(rotating?56.9:0),p.getY(i)-(rotating?6.2:0),p.getZ(i));+ b.normals.push(n.getX(i),n.getY(i),n.getZ(i));+ b.uvs.push(uv?uv.getX(i):0,uv?uv.getY(i):0);+ }+ if(g.index){for(let i=0;i<g.index.count;i++)b.indices.push(base+g.index.getX(i));}+ else{for(let i=0;i<p.count;i++)b.indices.push(base+i);}+ b.names.push(m.name);+ g.dispose();+ });+ original.forEach(m=>m.parent.remove(m));+ let groupIndex=0;+ groups.forEach(b=>{+ const g=new THREE.BufferGeometry();+ g.setAttribute('position',new THREE.Float32BufferAttribute(b.positions,3));+ g.setAttribute('normal',new THREE.Float32BufferAttribute(b.normals,3));+ g.setAttribute('uv',new THREE.Float32BufferAttribute(b.uvs,2));+ g.setIndex(b.indices);+ const m=add(b.rotating?'Propeller_Assembly':'Static_Material_Batch_'+groupIndex++,g,b.material,b.rotating?[-56.9,6.2,0]:[0,0,0]);+ m.userData.sourceParts=b.names;+ });+ }+ let triangles=0;+ root.traverse(m=>{if(m.isMesh)triangles+=(m.geometry.index?m.geometry.index.count:m.geometry.getAttribute('position').count)/3;});+ if(triangles>=Q.triangleLimit)throw new Error('Game triangle budget exceeded: '+triangles);+ return root;+}\ No newline at end of filediff --git a/examples/demo-umbra-submarine.provenance.json b/examples/demo-umbra-submarine.provenance.jsonnew file mode 100644index 00000000..7d573823--- /dev/null+++ b/examples/demo-umbra-submarine.provenance.json@@ -0,0 +1,33 @@+{+ "sourceHash": "7d13398e5457d8acfad423430be3af6bd33d4fb83d939854593cc4c60a80b0a0",+ "model": "GPT-6 Astra",+ "harness": "ChatGPT Work",+ "authoredDate": "2026-09-09",+ "provenance": {+ "attribution": "Recorded demo session; model credit supplied only where the retained run identifies it.",+ "sourceAccess": "See retained demo run; no stronger isolation claim is made.",+ "humanIntervention": "Owner supplied direction; model-authored exported source preserved byte-for-byte.",+ "reviewFidelity": "Authoring feedback and shaded demo previews where available. Not a destination-runtime acceptance claim.",+ "poster": "Fresh shaded render of the exact gallery-built downloadable GLB. Camera-only offline capture; no geometry or material edits.",+ "evaluationGlbHash": "79609a11b2f6b999f204f80b84ac4d264bf73c43d48329923ba82c3900bf944c",+ "posterReceipt": {+ "sourceHash": "7d13398e5457d8acfad423430be3af6bd33d4fb83d939854593cc4c60a80b0a0",+ "artifactHash": "f03756fccb19f8bd050d8e5318df74298cf56d664eb86e6fdcd7e22c42e1227b",+ "imageHash": "ebcbfc847d47f72d34d7f54d8379ad0b8fc58707b651dbc64ba560e00be988a3",+ "width": 1600,+ "height": 1000,+ "renderer": "ANGLE (NVIDIA, NVIDIA GeForce RTX 3070 (0x00002484) Direct3D11 vs_5_0 ps_5_0, D3D11)",+ "captureMethod": "Kiln studio stage, owned headless Chrome, original GLB materials",+ "cameraRecord": {+ "index": 10,+ "kind": "hero",+ "theta": 0.6747409422235526,+ "phi": 1.185083808592412,+ "radius": 201.1578277238332,+ "fixedSeconds": null,+ "wallTimeMs": 117+ },+ "geometryChanged": false+ }+ }+}diff --git a/examples/demo-unfolding-dragonfly.provenance.json b/examples/demo-unfolding-dragonfly.provenance.jsonnew file mode 100644index 00000000..00cbd857--- /dev/null+++ b/examples/demo-unfolding-dragonfly.provenance.json@@ -0,0 +1,54 @@+{+ "sourceHash": "ebb4e45d66b43fdbaad8d90290e005921bcca87a8712638b34ed344d8e70bd48",+ "model": "Gemini 3.8 Flash",+ "harness": "Antigravity CLI",+ "authoredDate": "2026-09-09",+ "provenance": {+ "attribution": "Recorded demo session; model credit supplied only where the retained run identifies it.",+ "sourceAccess": "See retained demo run; no stronger isolation claim is made.",+ "humanIntervention": "Owner supplied direction; model-authored exported source preserved byte-for-byte.",+ "reviewFidelity": "Authoring feedback and shaded demo previews where available. Not a destination-runtime acceptance claim.",+ "poster": "Gallery GPU render of the exact downloadable GLB. Source, artifact, image hashes and camera settings are recorded alongside the poster.",+ "evaluationGlbHash": "4fc612c3d0278fe0d76789377781cc2b5562e5c49a01c03a9e4c2bab9d9e11d7",+ "posterReceipt": {+ "captureIdentity": [+ "kiln.capture-producer.v1",+ "sha256:10f346ec6287c8d635dabe4668d72925080e6fe3d059dd7a9252f2694ce595c2",+ "44832275-6b15-4353-8fcb-ac1de3fda8e6",+ "dawn-d3d12:nvidia-geforce-rtx-3070:D3D12 driver version 32.0.16.1074"+ ],+ "sourceHash": "ebb4e45d66b43fdbaad8d90290e005921bcca87a8712638b34ed344d8e70bd48",+ "artifactHash": "3cf5b2575a573c8cb6935aa7ccfabc0f057cefbb4ecbcf0200ca23381e4b9b35",+ "imageHash": "584f921062436f5e8a923e7e5e55bdcbe4fc66e3f7adb4ac30e97a91466f8947",+ "width": 1024,+ "height": 1024,+ "camera": {+ "version": "kiln.camera.v1",+ "projection": "orthographic",+ "position": [+ 1.712416527445197,+ 0.9358418349805682,+ 1.1732105817119083+ ],+ "target": [+ -0.05957723589097617,+ 0.085284828579205,+ -0.06718505262341269+ ],+ "up": [+ 0,+ 1,+ 0+ ],+ "aspect": 1,+ "near": 0.01,+ "far": 5.8105456112780764,+ "halfHeight": 0.3748391176879038+ },+ "rendererId": "dawn-d3d12:nvidia-geforce-rtx-3070:D3D12 driver version 32.0.16.1074",+ "materialFaithful": true,+ "lightingPresetId": "gallery-studio-v1",+ "purpose": "Gallery poster generated from the exact downloadable GLB; separate from authoring feedback."+ }+ }+}diff --git a/examples/demo-vintage-typewriter.kiln.js b/examples/demo-vintage-typewriter.kiln.jsnew file mode 100644index 00000000..5d6539d3--- /dev/null+++ b/examples/demo-vintage-typewriter.kiln.js@@ -0,0 +1,149 @@+const meta = { name: 'Vintage Typewriter', category: 'prop', role: 'prop' };++async function build() {+ const root = createRoot('VintageTypewriter');++ const iron = gameMaterial(0x7c1d1d, { metalness: 0.35, roughness: 0.42 });+ const ironLight = gameMaterial(0x932222, { metalness: 0.35, roughness: 0.38 });+ const brass = gameMaterial(0xc9972f, { metalness: 0.9, roughness: 0.32 });+ const brassDark = gameMaterial(0x8f6a1f, { metalness: 0.85, roughness: 0.45 });+ const ivory = gameMaterial(0xf4ecd8, { metalness: 0.05, roughness: 0.45 });+ const ivoryDim = gameMaterial(0xe8dcc0, { metalness: 0.05, roughness: 0.55 });+ const rubber = gameMaterial(0x111114, { metalness: 0.1, roughness: 0.85 });+ const steel = gameMaterial(0x9aa0a8, { metalness: 0.9, roughness: 0.35 });+ const paperMat = gameMaterial(0xf7f4ea, { metalness: 0.0, roughness: 0.9 });+ const wood = gameMaterial(0x4a2f1c, { metalness: 0.0, roughness: 0.7 });+ const inkBlack = gameMaterial(0x0c0c0e, { metalness: 0.2, roughness: 0.7 });++ // --- Feet + wooden base ---+ const footGeo = cylinderGeo(0.018, 0.022, 0.02, 12);+ const footPos = [[0.15, 0.01, 0.16], [0.15, 0.01, -0.16], [-0.15, 0.01, 0.16], [-0.15, 0.01, -0.16]];+ for (let i = 0; i < 4; i++) {+ createPart('Foot' + i, footGeo, rubber, { position: footPos[i], parent: root });+ }+ const baseBoard = await roundedBoxGeo(0.38, 0.035, 0.42, 0.01, { style: 'round' });+ createPart('BaseBoard', baseBoard, wood, { position: [0, 0.037, 0], parent: root });+ const baseTrim = await roundedBoxGeo(0.385, 0.012, 0.425, 0.005, { style: 'chamfer' });+ createPart('BaseTrim', baseTrim, brassDark, { position: [0, 0.058, 0], parent: root });++ // --- Lower body ---+ const lowerBody = await roundedBoxGeo(0.30, 0.10, 0.34, 0.02, { style: 'round' });+ createPart('LowerBody', lowerBody, iron, { position: [0.02, 0.115, 0], parent: root });++ // Front brass maker plate+ const frontPlate = await roundedBoxGeo(0.01, 0.03, 0.20, 0.004, { style: 'chamfer' });+ createPart('FrontPlate', frontPlate, brass, { position: [0.172, 0.10, 0], parent: root });++ // Sloped top housing (rear of keys)+ const topHousing = await roundedBoxGeo(0.16, 0.07, 0.32, 0.02, { style: 'round' });+ createPart('TopHousing', topHousing, iron, { position: [-0.04, 0.185, 0], rotation: [0, 0, -8], parent: root });++ // Ribbon cover strip+ const ribbonCover = await roundedBoxGeo(0.06, 0.02, 0.28, 0.008, { style: 'round' });+ createPart('RibbonCover', ribbonCover, ironLight, { position: [-0.03, 0.225, 0], parent: root });++ // --- Ribbon spools ---+ const spoolGeo = cylinderGeo(0.028, 0.028, 0.014, 20);+ const spoolHubGeo = cylinderGeo(0.008, 0.008, 0.022, 12);+ const spoolZ = [0.085, -0.085];+ for (let i = 0; i < 2; i++) {+ createPart('Spool' + i, spoolGeo, inkBlack, { position: [-0.03, 0.242, spoolZ[i]], parent: root });+ createPart('SpoolHub' + i, spoolHubGeo, brass, { position: [-0.03, 0.245, spoolZ[i]], parent: root });+ }++ // --- Type-bar basket (fan of levers converging to center) ---+ for (let i = -5; i <= 5; i++) {+ const t = i / 5;+ const sx = 0.0 + Math.abs(t) * 0.01;+ const sz = t * 0.11;+ const ex = -0.075;+ const ez = t * 0.02;+ beamBetween('TypeBar' + (i + 5), [sx, 0.21, sz], [ex, 0.245, ez], 0.0022, steel, { parent: root });+ }+ // Center guide+ const guideGeo = boxGeo(0.02, 0.03, 0.02);+ createPart('TypeGuide', guideGeo, brassDark, { position: [-0.075, 0.25, 0], parent: root });++ // --- Round ivory keys ---+ const brassRingGeo = cylinderGeo(0.0165, 0.0175, 0.010, 20);+ const ivoryTopGeo = cylinderGeo(0.0135, 0.0145, 0.009, 20);+ const keyStemGeo = cylinderGeo(0.0035, 0.0035, 0.035, 8);++ let keyIndex = 0;+ function makeKey(px, py, pz, ivoryMat) {+ const id = keyIndex++;+ createPart('KeyStem' + id, keyStemGeo, steel, { position: [px, py - 0.02, pz], rotation: [0, 0, -18], parent: root });+ createPart('KeyRing' + id, brassRingGeo, brass, { position: [px, py, pz], rotation: [0, 0, -18], parent: root });+ createPart('KeyTop' + id, ivoryTopGeo, ivoryMat, { position: [px + 0.003, py + 0.007, pz], rotation: [0, 0, -18], parent: root });+ }++ const rows = [+ { x: 0.125, y: 0.180, n: 10, w: 0.29 },+ { x: 0.09, y: 0.196, n: 9, w: 0.265 },+ { x: 0.055, y: 0.212, n: 9, w: 0.265 },+ { x: 0.02, y: 0.228, n: 8, w: 0.24 },+ ];+ for (let r = 0; r < rows.length; r++) {+ const row = rows[r];+ for (let k = 0; k < row.n; k++) {+ const z = row.n === 1 ? 0 : -row.w / 2 + (row.w * k) / (row.n - 1);+ const mat = (r + k) % 7 === 3 ? ivoryDim : ivory;+ makeKey(row.x, row.y, z, mat);+ }+ }++ // Space bar - long ivory bar in front+ const spaceBar = await roundedBoxGeo(0.025, 0.012, 0.16, 0.005, { style: 'round' });+ createPart('SpaceBar', spaceBar, ivory, { position: [0.155, 0.172, 0], rotation: [0, 0, -12], parent: root });+ const spaceTrim = await roundedBoxGeo(0.028, 0.005, 0.165, 0.002, { style: 'chamfer' });+ createPart('SpaceTrim', spaceTrim, brass, { position: [0.153, 0.165, 0], rotation: [0, 0, -12], parent: root });++ // --- Carriage: side frames ---+ const sideGeo = boxGeo(0.09, 0.07, 0.015);+ createPart('CarriageSideR', sideGeo, iron, { position: [-0.10, 0.235, 0.185], parent: root });+ createPart('CarriageSideL', sideGeo, iron, { position: [-0.10, 0.235, -0.185], parent: root });+ // Brass side caps+ const sideCapGeo = cylinderZGeo(0.012, 0.012, 0.018, 12);+ createPart('SideCapR', sideCapGeo, brass, { position: [-0.10, 0.25, 0.195], parent: root });+ createPart('SideCapL', sideCapGeo, brass, { position: [-0.10, 0.25, -0.195], parent: root });++ // Carriage rail (steel bar in front of platen)+ const railGeo = cylinderZGeo(0.008, 0.008, 0.40, 12);+ createPart('CarriageRail', railGeo, steel, { position: [-0.055, 0.235, 0], parent: root });++ // --- Platen (paper roller) ---+ const platenGeo = cylinderZGeo(0.028, 0.028, 0.37, 24);+ createPart('Platen', platenGeo, rubber, { position: [-0.115, 0.275, 0], parent: root });+ const axleGeo = cylinderZGeo(0.006, 0.006, 0.44, 10);+ createPart('PlatenAxle', axleGeo, steel, { position: [-0.115, 0.275, 0], parent: root });++ // Brass platen knobs+ const knobGeo = cylinderZGeo(0.020, 0.020, 0.022, 16);+ const knobCapGeo = sphereGeo(0.012, 12, 8);+ createPart('KnobR', knobGeo, brass, { position: [-0.115, 0.275, 0.205], parent: root });+ createPart('KnobL', knobGeo, brass, { position: [-0.115, 0.275, -0.205], parent: root });+ createPart('KnobCapR', knobCapGeo, brassDark, { position: [-0.115, 0.275, 0.219], parent: root });+ createPart('KnobCapL', knobCapGeo, brassDark, { position: [-0.115, 0.275, -0.219], parent: root });++ // Paper bail bar + rollers+ const bailGeo = cylinderZGeo(0.004, 0.004, 0.34, 8);+ createPart('PaperBail', bailGeo, steel, { position: [-0.095, 0.29, 0], parent: root });+ const bailRollerGeo = cylinderZGeo(0.007, 0.007, 0.02, 10);+ createPart('BailRoller1', bailRollerGeo, rubber, { position: [-0.095, 0.29, 0.08], parent: root });+ createPart('BailRoller2', bailRollerGeo, rubber, { position: [-0.095, 0.29, -0.08], parent: root });++ // --- Paper sheet ---+ const paperGeo = boxGeo(0.004, 0.24, 0.24);+ createPart('Paper', paperGeo, paperMat, { position: [-0.135, 0.38, 0], rotation: [0, 0, 8], parent: root });++ // --- Return lever (brass, left side) ---+ beamBetween('ReturnArm', [-0.115, 0.28, -0.20], [-0.05, 0.33, -0.24], 0.006, brass, { parent: root });+ const leverHandleGeo = sphereGeo(0.013, 12, 8);+ createPart('ReturnHandle', leverHandleGeo, wood, { position: [-0.05, 0.33, -0.24], parent: root });++ // Paper guide+ const guidePlate = boxGeo(0.002, 0.06, 0.26);+ createPart('PaperGuide', guidePlate, steel, { position: [-0.098, 0.295, 0], rotation: [0, 0, 10], parent: root });++ return root;+}diff --git a/examples/demo-vintage-typewriter.provenance.json b/examples/demo-vintage-typewriter.provenance.jsonnew file mode 100644index 00000000..7c7e3a9c--- /dev/null+++ b/examples/demo-vintage-typewriter.provenance.json@@ -0,0 +1,54 @@+{+ "sourceHash": "6059425d4eca5dda33c6d958d4208da3eda9684d8e841d54aeee47c5a2794dc3",+ "model": "Muse Spark 1.3",+ "harness": "OpenCode",+ "authoredDate": "2026-09-09",+ "provenance": {+ "attribution": "Recorded demo session; model credit supplied only where the retained run identifies it.",+ "sourceAccess": "See retained demo run; no stronger isolation claim is made.",+ "humanIntervention": "Owner supplied direction; model-authored exported source preserved byte-for-byte.",+ "reviewFidelity": "Authoring feedback and shaded demo previews where available. Not a destination-runtime acceptance claim.",+ "poster": "Gallery GPU render of the exact downloadable GLB. Source, artifact, image hashes and camera settings are recorded alongside the poster.",+ "evaluationGlbHash": "bc24fbf12ace2cfc3901ec03c55633df4dc88077401e5d1ae5d0e284e8ed7422",+ "posterReceipt": {+ "captureIdentity": [+ "kiln.capture-producer.v1",+ "sha256:10f346ec6287c8d635dabe4668d72925080e6fe3d059dd7a9252f2694ce595c2",+ "44832275-6b15-4353-8fcb-ac1de3fda8e6",+ "dawn-d3d12:nvidia-geforce-rtx-3070:D3D12 driver version 32.0.16.1074"+ ],+ "sourceHash": "6059425d4eca5dda33c6d958d4208da3eda9684d8e841d54aeee47c5a2794dc3",+ "artifactHash": "5753caafe26f8307a11046788cc4c22fad1d61901f82629b50e005de96cdca1e",+ "imageHash": "5e3f26f53fff877770c98592e85d8558bf0208f1a050704e3d0270953e455eee",+ "width": 1024,+ "height": 1024,+ "camera": {+ "version": "kiln.camera.v1",+ "projection": "orthographic",+ "position": [+ 1.5227055286508444,+ 0.9719493213991193,+ 1.0658938700555909+ ],+ "target": [+ -0.002102881678808622,+ 0.24004128444088574,+ -0.0014720171751660214+ ],+ "up": [+ 0,+ 1,+ 0+ ],+ "aspect": 1,+ "near": 0.01,+ "far": 5,+ "halfHeight": 0.3482058242537484+ },+ "rendererId": "dawn-d3d12:nvidia-geforce-rtx-3070:D3D12 driver version 32.0.16.1074",+ "materialFaithful": true,+ "lightingPresetId": "gallery-studio-v1",+ "purpose": "Gallery poster generated from the exact downloadable GLB; separate from authoring feedback."+ }+ }+}diff --git a/examples/renders/demo-argent-aircraft-carrier.json b/examples/renders/demo-argent-aircraft-carrier.jsonnew file mode 100644index 00000000..aebef314--- /dev/null+++ b/examples/renders/demo-argent-aircraft-carrier.json@@ -0,0 +1,40 @@+{+ "captureIdentity": [+ "kiln.capture-producer.v1",+ "sha256:10f346ec6287c8d635dabe4668d72925080e6fe3d059dd7a9252f2694ce595c2",+ "44832275-6b15-4353-8fcb-ac1de3fda8e6",+ "dawn-d3d12:nvidia-geforce-rtx-3070:D3D12 driver version 32.0.16.1074"+ ],+ "sourceHash": "9b6b3cae4e44cfec99e06a019cc83b56484004ab37132ed9848ddb0bdda447be",+ "artifactHash": "d33a9f53b100ebc34cbe2ca0b857f069d49ec362fcf7574d5abee59f4615df92",+ "imageHash": "0354f2649037396ec1b1fa630365173c65343e2f1c93968f335cb043ed9c41f6",+ "width": 1024,+ "height": 1024,+ "camera": {+ "version": "kiln.camera.v1",+ "projection": "orthographic",+ "position": [+ 57.06580689704423,+ 30.905397769322562,+ 40.33606495667699+ ],+ "target": [+ 0.3886137355092504,+ 3.7003450517857712,+ 0.6620297436025075+ ],+ "up": [+ 0,+ 1,+ 0+ ],+ "aspect": 1,+ "near": 0.01,+ "far": 185.850211664565,+ "halfHeight": 13.561237602632227+ },+ "rendererId": "dawn-d3d12:nvidia-geforce-rtx-3070:D3D12 driver version 32.0.16.1074",+ "materialFaithful": true,+ "lightingPresetId": "gallery-studio-v1",+ "purpose": "Gallery poster generated from the exact downloadable GLB; separate from authoring feedback."+}diff --git a/examples/renders/demo-art-deco-conservatory.json b/examples/renders/demo-art-deco-conservatory.jsonnew file mode 100644index 00000000..c6c1151a--- /dev/null+++ b/examples/renders/demo-art-deco-conservatory.json@@ -0,0 +1,40 @@+{+ "captureIdentity": [+ "kiln.capture-producer.v1",+ "sha256:10f346ec6287c8d635dabe4668d72925080e6fe3d059dd7a9252f2694ce595c2",+ "44832275-6b15-4353-8fcb-ac1de3fda8e6",+ "dawn-d3d12:nvidia-geforce-rtx-3070:D3D12 driver version 32.0.16.1074"+ ],+ "sourceHash": "939586687895080c38d0683c75e370c9249fb7ddd9ecc17a791c0b4723f5a3d2",+ "artifactHash": "fe283930b2e63b9f417dd48a9b4e5323ca154f9a13f5d18bcd0b9ba0f9095f87",+ "imageHash": "e026791d17694c00288e2109a79e110a3664f66ba4279fca84e8044af74998bb",+ "width": 1024,+ "height": 1024,+ "camera": {+ "version": "kiln.camera.v1",+ "projection": "orthographic",+ "position": [+ 53.081006527430674,+ 31.07001350765549,+ 37.15670456920146+ ],+ "target": [+ 1.517977746415971,+ 6.319759692768433,+ 1.0625844224911807+ ],+ "up": [+ 0,+ 1,+ 0+ ],+ "aspect": 1,+ "near": 0.01,+ "far": 169.0803527568002,+ "halfHeight": 14.992599233523269+ },+ "rendererId": "dawn-d3d12:nvidia-geforce-rtx-3070:D3D12 driver version 32.0.16.1074",+ "materialFaithful": true,+ "lightingPresetId": "gallery-studio-v1",+ "purpose": "Gallery poster generated from the exact downloadable GLB; separate from authoring feedback."+}diff --git a/examples/renders/demo-deep-sea-station.json b/examples/renders/demo-deep-sea-station.jsonnew file mode 100644index 00000000..0e5379a3--- /dev/null+++ b/examples/renders/demo-deep-sea-station.json@@ -0,0 +1,40 @@+{+ "captureIdentity": [+ "kiln.capture-producer.v1",+ "sha256:10f346ec6287c8d635dabe4668d72925080e6fe3d059dd7a9252f2694ce595c2",+ "44832275-6b15-4353-8fcb-ac1de3fda8e6",+ "dawn-d3d12:nvidia-geforce-rtx-3070:D3D12 driver version 32.0.16.1074"+ ],+ "sourceHash": "df6b76e688d9d5e6a23da05ed1fdac1a3d2975ca7f573ee00b0638e90edb27e8",+ "artifactHash": "7ad135e644ccdd090fabe355dc68955fd8c8604f0e692d5c67e68c3d638eaa0b",+ "imageHash": "bb4fee4a1d0c870fa152e94a21f5618282a324293e940f318f62d4ae7715ba15",+ "width": 1024,+ "height": 1024,+ "camera": {+ "version": "kiln.camera.v1",+ "projection": "orthographic",+ "position": [+ 35.27249550360228,+ 21.106688794627004,+ 23.899890481837055+ ],+ "target": [+ 0.8993093385576207,+ 4.607559435405568,+ -0.1613398336942046+ ],+ "up": [+ 0,+ 1,+ 0+ ],+ "aspect": 1,+ "near": 0.01,+ "far": 112.71313147339413,+ "halfHeight": 7.3994633756043395+ },+ "rendererId": "dawn-d3d12:nvidia-geforce-rtx-3070:D3D12 driver version 32.0.16.1074",+ "materialFaithful": true,+ "lightingPresetId": "gallery-studio-v1",+ "purpose": "Gallery poster generated from the exact downloadable GLB; separate from authoring feedback."+}diff --git a/examples/renders/demo-diesel-locomotive.json b/examples/renders/demo-diesel-locomotive.jsonnew file mode 100644index 00000000..1ed2cf14--- /dev/null+++ b/examples/renders/demo-diesel-locomotive.json@@ -0,0 +1,40 @@+{+ "captureIdentity": [+ "kiln.capture-producer.v1",+ "sha256:10f346ec6287c8d635dabe4668d72925080e6fe3d059dd7a9252f2694ce595c2",+ "44832275-6b15-4353-8fcb-ac1de3fda8e6",+ "dawn-d3d12:nvidia-geforce-rtx-3070:D3D12 driver version 32.0.16.1074"+ ],+ "sourceHash": "483aef3d91f13d831e9c964dcd059957ee26b4c230b92cf2feb26d684e548378",+ "artifactHash": "ef8dc0e9f79e844a821b100d6d8179e9968433dd1ea586d0097543f52cf9e005",+ "imageHash": "46d42224eeab3807c6ab7e0d6eab4cf2907e669eb1ef6b1c46fc0e76cc165a0b",+ "width": 1024,+ "height": 1024,+ "camera": {+ "version": "kiln.camera.v1",+ "projection": "orthographic",+ "position": [+ 29.25508602592375,+ 15.960803762776607,+ 20.478560218146622+ ],+ "target": [+ 0.16018717529982987,+ 1.9952523144771264,+ 0.11213102270988089+ ],+ "up": [+ 0,+ 1,+ 0+ ],+ "aspect": 1,+ "near": 0.01,+ "far": 95.40509697324467,+ "halfHeight": 6.654457140245812+ },+ "rendererId": "dawn-d3d12:nvidia-geforce-rtx-3070:D3D12 driver version 32.0.16.1074",+ "materialFaithful": true,+ "lightingPresetId": "gallery-studio-v1",+ "purpose": "Gallery poster generated from the exact downloadable GLB; separate from authoring feedback."+}diff --git a/examples/renders/demo-floating-observatory.json b/examples/renders/demo-floating-observatory.jsonnew file mode 100644index 00000000..24078653--- /dev/null+++ b/examples/renders/demo-floating-observatory.json@@ -0,0 +1,40 @@+{+ "captureIdentity": [+ "kiln.capture-producer.v1",+ "sha256:10f346ec6287c8d635dabe4668d72925080e6fe3d059dd7a9252f2694ce595c2",+ "44832275-6b15-4353-8fcb-ac1de3fda8e6",+ "dawn-d3d12:nvidia-geforce-rtx-3070:D3D12 driver version 32.0.16.1074"+ ],+ "sourceHash": "331508e4cd10ff4c9329fc3b5adfea6a9e346424cf53bfa48ee185d170bcdb68",+ "artifactHash": "719e74b5adcbfc4cbeea8e6fe8a8c66da17992e4f40dacfbd301a7728ad7256c",+ "imageHash": "689c7a16947bc05113adeba69f7870e47c9d0fb344df0a44a900340be381b1a1",+ "width": 1024,+ "height": 1024,+ "camera": {+ "version": "kiln.camera.v1",+ "projection": "orthographic",+ "position": [+ 26.601194231782966,+ 16.357877422376035,+ 18.857499361632435+ ],+ "target": [+ -0.06345497744625134,+ 3.558845801946009,+ 0.1922449151719859+ ],+ "up": [+ 0,+ 1,+ 0+ ],+ "aspect": 1,+ "near": 0.01,+ "far": 87.43606419204005,+ "halfHeight": 6.868151089189696+ },+ "rendererId": "dawn-d3d12:nvidia-geforce-rtx-3070:D3D12 driver version 32.0.16.1074",+ "materialFaithful": true,+ "lightingPresetId": "gallery-studio-v1",+ "purpose": "Gallery poster generated from the exact downloadable GLB; separate from authoring feedback."+}diff --git a/examples/renders/demo-noctilus-nuclear-submarine.json b/examples/renders/demo-noctilus-nuclear-submarine.jsonnew file mode 100644index 00000000..c35e6c4b--- /dev/null+++ b/examples/renders/demo-noctilus-nuclear-submarine.json@@ -0,0 +1,40 @@+{+ "captureIdentity": [+ "kiln.capture-producer.v1",+ "sha256:10f346ec6287c8d635dabe4668d72925080e6fe3d059dd7a9252f2694ce595c2",+ "44832275-6b15-4353-8fcb-ac1de3fda8e6",+ "dawn-d3d12:nvidia-geforce-rtx-3070:D3D12 driver version 32.0.16.1074"+ ],+ "sourceHash": "21a393a9ad078a8d3d8c7a8b24bbaf97d3ad8a15c3637c7400419d85a04b2237",+ "artifactHash": "a4ce6e5aac57c91a9cb00e85a2a7304d84a841e5d710a97d1129a975e68a4eaa",+ "imageHash": "3a7c507038d756b14396dd4958a92801b85b48352db2d7621c7eddc13938bd12",+ "width": 1024,+ "height": 1024,+ "camera": {+ "version": "kiln.camera.v1",+ "projection": "orthographic",+ "position": [+ 46.509468054283104,+ 26.6675927248062,+ 33.03361338689476+ ],+ "target": [+ 0.5030265135419516,+ 4.584500785250452,+ 0.8291043083759633+ ],+ "up": [+ 0,+ 1,+ 0+ ],+ "aspect": 1,+ "near": 0.01,+ "far": 150.85974483441782,+ "halfHeight": 9.429091361660745+ },+ "rendererId": "dawn-d3d12:nvidia-geforce-rtx-3070:D3D12 driver version 32.0.16.1074",+ "materialFaithful": true,+ "lightingPresetId": "gallery-studio-v1",+ "purpose": "Gallery poster generated from the exact downloadable GLB; separate from authoring feedback."+}diff --git a/examples/renders/demo-resolute-polar-fleet-flagship.json b/examples/renders/demo-resolute-polar-fleet-flagship.jsonnew file mode 100644index 00000000..0f074b5c--- /dev/null+++ b/examples/renders/demo-resolute-polar-fleet-flagship.json@@ -0,0 +1,40 @@+{+ "captureIdentity": [+ "kiln.capture-producer.v1",+ "sha256:10f346ec6287c8d635dabe4668d72925080e6fe3d059dd7a9252f2694ce595c2",+ "44832275-6b15-4353-8fcb-ac1de3fda8e6",+ "dawn-d3d12:nvidia-geforce-rtx-3070:D3D12 driver version 32.0.16.1074"+ ],+ "sourceHash": "23e70f4f899e07478b5392505a13446b77ae382962fbcb9e8c9ac794ddbc5c70",+ "artifactHash": "fe33b80bfe154eff8ebb2e68c2a190c66065f49628e0a3d87565566cea122cf3",+ "imageHash": "10aef199f5f8c0b50009219501e3abdd78e24223930c373126bca5b19069d21a",+ "width": 1024,+ "height": 1024,+ "camera": {+ "version": "kiln.camera.v1",+ "projection": "orthographic",+ "position": [+ 52.77781367726672,+ 28.534180567339824,+ 37.1987710018026+ ],+ "target": [+ 0.407574168767243,+ 3.3964656032600713,+ 0.5396033458529658+ ],+ "up": [+ 0,+ 1,+ 0+ ],+ "aspect": 1,+ "near": 0.01,+ "far": 171.72727784593408,+ "halfHeight": 10.795037537140981+ },+ "rendererId": "dawn-d3d12:nvidia-geforce-rtx-3070:D3D12 driver version 32.0.16.1074",+ "materialFaithful": true,+ "lightingPresetId": "gallery-studio-v1",+ "purpose": "Gallery poster generated from the exact downloadable GLB; separate from authoring feedback."+}diff --git a/examples/renders/demo-unfolding-dragonfly.json b/examples/renders/demo-unfolding-dragonfly.jsonnew file mode 100644index 00000000..954f2c04--- /dev/null+++ b/examples/renders/demo-unfolding-dragonfly.json@@ -0,0 +1,40 @@+{+ "captureIdentity": [+ "kiln.capture-producer.v1",+ "sha256:10f346ec6287c8d635dabe4668d72925080e6fe3d059dd7a9252f2694ce595c2",+ "44832275-6b15-4353-8fcb-ac1de3fda8e6",+ "dawn-d3d12:nvidia-geforce-rtx-3070:D3D12 driver version 32.0.16.1074"+ ],+ "sourceHash": "ebb4e45d66b43fdbaad8d90290e005921bcca87a8712638b34ed344d8e70bd48",+ "artifactHash": "3cf5b2575a573c8cb6935aa7ccfabc0f057cefbb4ecbcf0200ca23381e4b9b35",+ "imageHash": "584f921062436f5e8a923e7e5e55bdcbe4fc66e3f7adb4ac30e97a91466f8947",+ "width": 1024,+ "height": 1024,+ "camera": {+ "version": "kiln.camera.v1",+ "projection": "orthographic",+ "position": [+ 1.712416527445197,+ 0.9358418349805682,+ 1.1732105817119083+ ],+ "target": [+ -0.05957723589097617,+ 0.085284828579205,+ -0.06718505262341269+ ],+ "up": [+ 0,+ 1,+ 0+ ],+ "aspect": 1,+ "near": 0.01,+ "far": 5.8105456112780764,+ "halfHeight": 0.3748391176879038+ },+ "rendererId": "dawn-d3d12:nvidia-geforce-rtx-3070:D3D12 driver version 32.0.16.1074",+ "materialFaithful": true,+ "lightingPresetId": "gallery-studio-v1",+ "purpose": "Gallery poster generated from the exact downloadable GLB; separate from authoring feedback."+}diff --git a/examples/renders/demo-vintage-typewriter.json b/examples/renders/demo-vintage-typewriter.jsonnew file mode 100644index 00000000..4a95c20d--- /dev/null+++ b/examples/renders/demo-vintage-typewriter.json@@ -0,0 +1,40 @@+{+ "captureIdentity": [+ "kiln.capture-producer.v1",+ "sha256:10f346ec6287c8d635dabe4668d72925080e6fe3d059dd7a9252f2694ce595c2",+ "44832275-6b15-4353-8fcb-ac1de3fda8e6",+ "dawn-d3d12:nvidia-geforce-rtx-3070:D3D12 driver version 32.0.16.1074"+ ],+ "sourceHash": "6059425d4eca5dda33c6d958d4208da3eda9684d8e841d54aeee47c5a2794dc3",+ "artifactHash": "5753caafe26f8307a11046788cc4c22fad1d61901f82629b50e005de96cdca1e",+ "imageHash": "5e3f26f53fff877770c98592e85d8558bf0208f1a050704e3d0270953e455eee",+ "width": 1024,+ "height": 1024,+ "camera": {+ "version": "kiln.camera.v1",+ "projection": "orthographic",+ "position": [+ 1.5227055286508444,+ 0.9719493213991193,+ 1.0658938700555909+ ],+ "target": [+ -0.002102881678808622,+ 0.24004128444088574,+ -0.0014720171751660214+ ],+ "up": [+ 0,+ 1,+ 0+ ],+ "aspect": 1,+ "near": 0.01,+ "far": 5,+ "halfHeight": 0.3482058242537484+ },+ "rendererId": "dawn-d3d12:nvidia-geforce-rtx-3070:D3D12 driver version 32.0.16.1074",+ "materialFaithful": true,+ "lightingPresetId": "gallery-studio-v1",+ "purpose": "Gallery poster generated from the exact downloadable GLB; separate from authoring feedback."+}diff --git a/site/examples/history/demo-abyssal-crown-deep-ocean-submarine/history.json b/site/examples/history/demo-abyssal-crown-deep-ocean-submarine/history.jsonnew file mode 100644index 00000000..8962f1fe--- /dev/null+++ b/site/examples/history/demo-abyssal-crown-deep-ocean-submarine/history.json@@ -0,0 +1,22 @@+{+ "version": 1,+ "brief": {+ "kind": "recorded",+ "text": "Refined submarine with a 40% taller command sail and three prominent brass periscope collars."+ },+ "currentSourceHash": "d67f971a1d0fe3aa2e7f183bde88e0c5a7fbd455f05a41a654890c59e3186b6e",+ "revisions": [+ {+ "file": "revision-1.kiln.js",+ "title": "Saved revision 1",+ "description": "A premium stylized deep-ocean submarine scale model with a long two-tone pressure hull, command sail, raised periscopes, cruciform tail, shrouded propulsor, display plinth, and brass detailing.",+ "sourceHash": "fe8b0eebf96514ddf3c33a89523dfc358c8d4431efe6d7f62326295feef68f6d"+ },+ {+ "file": "revision-2.kiln.js",+ "title": "Saved revision 2",+ "description": "Refined submarine with a 40% taller command sail and three prominent brass periscope collars.",+ "sourceHash": "d67f971a1d0fe3aa2e7f183bde88e0c5a7fbd455f05a41a654890c59e3186b6e"+ }+ ]+}diff --git a/site/examples/history/demo-abyssal-crown-deep-ocean-submarine/revision-1.kiln.js b/site/examples/history/demo-abyssal-crown-deep-ocean-submarine/revision-1.kiln.jsnew file mode 100644index 00000000..b4a3051e--- /dev/null+++ b/site/examples/history/demo-abyssal-crown-deep-ocean-submarine/revision-1.kiln.js@@ -0,0 +1,292 @@+const meta = {+ name: 'Abyssal Crown Deep-Ocean Submarine',+ category: 'vehicle',+ role: 'vehicle'+};++const P = {+ hullY: 2.18,+ hullVerticalScale: 0.88,+ stations: [+ [-7.15, 0.10], [-6.92, 0.52], [-6.35, 1.10], [-5.25, 1.48],+ [-3.20, 1.70], [-0.60, 1.80], [2.35, 1.82], [4.25, 1.67],+ [5.65, 1.30], [6.55, 0.72], [6.98, 0.16], [7.06, 0.06]+ ]+};++function ownedGeo(positions, indices, uvs) {+ return meshGeo({ positions, indices, uvs });+}++function hullHalfGeo(upper) {+ const positions = [], indices = [], uvs = [];+ const rings = P.stations.length;+ const around = 28;+ const a0 = upper ? -Math.PI * 0.5 : Math.PI * 0.5;+ const a1 = upper ? Math.PI * 0.5 : Math.PI * 1.5;+ for (let i = 0; i < rings; i++) {+ const x = P.stations[i][0];+ const r = P.stations[i][1];+ for (let j = 0; j <= around; j++) {+ const t = j / around;+ const a = a0 + (a1 - a0) * t;+ positions.push(x, r * P.hullVerticalScale * Math.cos(a), r * Math.sin(a));+ uvs.push(i / (rings - 1), t);+ }+ }+ const row = around + 1;+ for (let i = 0; i < rings - 1; i++) {+ for (let j = 0; j < around; j++) {+ const a = i * row + j, b = (i + 1) * row + j;+ const c = a + 1, d = b + 1;+ indices.push(a, c, b, b, c, d);+ }+ }+ return ownedGeo(positions, indices, uvs);+}++function hullRadiusAt(x) {+ const s = P.stations;+ if (x <= s[0][0]) return s[0][1];+ if (x >= s[s.length - 1][0]) return s[s.length - 1][1];+ for (let i = 0; i < s.length - 1; i++) {+ if (x >= s[i][0] && x <= s[i + 1][0]) {+ const t = (x - s[i][0]) / (s[i + 1][0] - s[i][0]);+ return s[i][1] * (1 - t) + s[i + 1][1] * t;+ }+ }+ return 1;+}++function waterlineBandGeo(thetaCenter) {+ const positions = [], indices = [], uvs = [];+ const rows = 4;+ const halfAngle = 0.025;+ for (let i = 0; i < P.stations.length; i++) {+ const x = P.stations[i][0];+ const r = P.stations[i][1] + 0.014;+ for (let j = 0; j < rows; j++) {+ const t = j / (rows - 1);+ const a = thetaCenter - halfAngle + 2 * halfAngle * t;+ positions.push(x, r * P.hullVerticalScale * Math.cos(a), r * Math.sin(a));+ uvs.push(i / (P.stations.length - 1), t);+ }+ }+ for (let i = 0; i < P.stations.length - 1; i++) {+ for (let j = 0; j < rows - 1; j++) {+ const a = i * rows + j, b = (i + 1) * rows + j;+ const c = a + 1, d = b + 1;+ indices.push(a, c, b, b, c, d);+ }+ }+ return ownedGeo(positions, indices, uvs);+}++function prismXY(points, depth) {+ const p = [], idx = [], n = points.length;+ for (let side = -1; side <= 1; side += 2) {+ for (const q of points) p.push(q[0], q[1], side * depth * 0.5);+ }+ for (let i = 1; i < n - 1; i++) {+ idx.push(0, i + 1, i);+ idx.push(n, n + i, n + i + 1);+ }+ for (let i = 0; i < n; i++) {+ const k = (i + 1) % n;+ idx.push(i, k, n + i, k, n + k, n + i);+ }+ return ownedGeo(p, idx);+}++function prismXZ(points, height) {+ const p = [], idx = [], n = points.length;+ for (let side = -1; side <= 1; side += 2) {+ for (const q of points) p.push(q[0], side * height * 0.5, q[1]);+ }+ for (let i = 1; i < n - 1; i++) {+ idx.push(0, i, i + 1);+ idx.push(n, n + i + 1, n + i);+ }+ for (let i = 0; i < n; i++) {+ const k = (i + 1) % n;+ idx.push(i, n + i, k, k, n + i, n + k);+ }+ return ownedGeo(p, idx);+}++async function build() {+ const root = createRoot('AbyssalCrown_Submarine');++ const charcoal = gameMaterial(0x182228, { metalness: 0.72, roughness: 0.30 });+ const charcoalSoft = gameMaterial(0x26343a, { metalness: 0.62, roughness: 0.38 });+ const lowerRed = gameMaterial(0x66161d, { metalness: 0.48, roughness: 0.38 });+ const pale = gameMaterial(0xd9d5c2, { metalness: 0.35, roughness: 0.34 });+ const brass = gameMaterial(0xb8893f, { metalness: 0.88, roughness: 0.23 });+ const dark = gameMaterial(0x090e11, { metalness: 0.78, roughness: 0.29 });+ const rubber = gameMaterial(0x121619, { metalness: 0.12, roughness: 0.70 });+ const baseMat = gameMaterial(0x101518, { metalness: 0.60, roughness: 0.32 });++ createPart('UpperPressureHull', hullHalfGeo(true), charcoal, {+ position: [0, P.hullY, 0], parent: root+ });+ createPart('LowerPressureHull', hullHalfGeo(false), lowerRed, {+ position: [0, P.hullY, 0], parent: root+ });+ createPart('Waterline_Starboard', waterlineBandGeo(Math.PI * 0.5), pale, {+ position: [0, P.hullY, 0], parent: root+ });+ createPart('Waterline_Port', waterlineBandGeo(-Math.PI * 0.5), pale, {+ position: [0, P.hullY, 0], parent: root+ });++ const seamXs = [-4.65, -2.35, 0.15, 2.65, 4.65];+ for (let i = 0; i < seamXs.length; i++) {+ const x = seamXs[i], r = hullRadiusAt(x) + 0.018;+ createPart('PressureRing_' + (i + 1), torusGeo(r, 0.018, 8, 48), charcoalSoft, {+ position: [x, P.hullY, 0], rotation: [0, 90, 0],+ scale: [1, P.hullVerticalScale, 1], parent: root+ });+ }++ const sailFairing = sphereGeo(1, 48, 24);+ createPart('SailBaseFairing', sailFairing, charcoalSoft, {+ position: [0.55, 3.47, 0], scale: [1.72, 0.46, 0.70], parent: root+ });+ const sailBody = await roundedBoxGeo(2.55, 1.48, 0.78, 0.20, { segments: 8, smooth: true });+ createPart('CommandSail', sailBody, charcoal, {+ position: [0.48, 4.15, 0], rotation: [0, 0, -3], parent: root+ });+ const sailCap = await roundedBoxGeo(1.92, 0.12, 0.66, 0.055, { segments: 6, smooth: true });+ createPart('SailCap', sailCap, pale, {+ position: [0.46, 4.90, 0], rotation: [0, 0, -3], parent: root+ });++ const mastPositions = [+ ['AttackPeriscope', 0.05, 5.43, -0.08, 0.075, 0.98],+ ['SearchPeriscope', 0.68, 5.36, 0.12, 0.065, 0.78],+ ['SensorMast', -0.48, 5.28, 0.10, 0.055, 0.62]+ ];+ for (let i = 0; i < mastPositions.length; i++) {+ const m = mastPositions[i];+ createPart(m[0] + '_Stem', cylinderGeo(m[4], m[4], m[5], 20), i === 2 ? brass : charcoalSoft, {+ position: [m[1], m[2], m[3]], parent: root+ });+ createPart(m[0] + '_Collar', cylinderGeo(m[4] * 1.5, m[4] * 1.5, 0.07, 20), brass, {+ position: [m[1], m[2] - m[5] * 0.46, m[3]], parent: root+ });+ }+ createPart('AttackPeriscope_Head', cylinderGeo(0.082, 0.082, 0.34, 20), charcoalSoft, {+ position: [0.20, 5.87, -0.08], rotation: [0, 0, 90], parent: root+ });+ createPart('AttackPeriscope_Lens', cylinderGeo(0.055, 0.055, 0.025, 20), brass, {+ position: [0.375, 5.87, -0.08], rotation: [0, 0, 90], parent: root+ });+ createPart('SearchPeriscope_Head', cylinderGeo(0.072, 0.072, 0.28, 20), charcoalSoft, {+ position: [0.81, 5.72, 0.12], rotation: [0, 0, 90], parent: root+ });++ const hatchXs = [-3.15, -1.42, 2.60, 4.08];+ for (let i = 0; i < hatchXs.length; i++) {+ const x = hatchXs[i];+ const top = P.hullY + hullRadiusAt(x) * P.hullVerticalScale;+ createPart('DeckHatch_' + (i + 1), cylinderGeo(0.27, 0.27, 0.055, 32), charcoalSoft, {+ position: [x, top + 0.02, 0], parent: root+ });+ createPart('DeckHatchRing_' + (i + 1), torusGeo(0.27, 0.024, 8, 32), brass, {+ position: [x, top + 0.055, 0], rotation: [90, 0, 0], parent: root+ });+ createPart('DeckHatchDog_' + (i + 1), await roundedBoxGeo(0.28, 0.035, 0.055, 0.014, { segments: 4 }), brass, {+ position: [x, top + 0.085, 0], rotation: [0, i % 2 ? 35 : -35, 0], parent: root+ });+ }++ for (const side of [-1, 1]) {+ for (let i = 0; i < 3; i++) {+ const x = 4.25 + i * 0.48;+ const z = side * (hullRadiusAt(x) + 0.015);+ createPart((side > 0 ? 'Starboard' : 'Port') + '_BowPanel_' + (i + 1),+ cylinderGeo(0.12, 0.12, 0.025, 24), i === 1 ? brass : charcoalSoft, {+ position: [x, P.hullY + 0.12 - i * 0.10, z],+ rotation: [90, 0, 0], parent: root+ });+ }+ createPart((side > 0 ? 'Starboard' : 'Port') + '_SailPlaque',+ await roundedBoxGeo(0.78, 0.16, 0.035, 0.012, { segments: 5 }), brass, {+ position: [0.55, 4.20, side * 0.405], parent: root+ });+ }++ const topFin = prismXY([[-1.05, 0], [0.72, 0], [0.16, 1.62], [-0.72, 1.45]], 0.20);+ const bottomFin = prismXY([[-1.05, 0], [0.72, 0], [0.16, -0.72], [-0.74, -0.66]], 0.20);+ createPart('UpperTailFin', topFin, charcoal, {+ position: [-5.82, 3.10, 0], parent: root+ });+ createPart('LowerTailFin', bottomFin, lowerRed, {+ position: [-5.82, 1.24, 0], parent: root+ });++ const rightFin = prismXZ([[-1.05, 0], [0.72, 0], [0.14, 1.72], [-0.76, 1.46]], 0.18);+ const leftFin = prismXZ([[-1.05, 0], [0.72, 0], [0.14, -1.72], [-0.76, -1.46]], 0.18);+ createPart('StarboardTailFin', rightFin, charcoal, {+ position: [-5.82, P.hullY, 0.66], parent: root+ });+ createPart('PortTailFin', leftFin, charcoal, {+ position: [-5.82, P.hullY, -0.66], parent: root+ });++ const shroudX = -7.43;+ createPart('PropulsorShroudFront', torusGeo(0.82, 0.14, 12, 48), charcoalSoft, {+ position: [shroudX + 0.18, P.hullY, 0], rotation: [0, 90, 0],+ scale: [1, 0.94, 1], parent: root+ });+ createPart('PropulsorShroudRear', torusGeo(0.82, 0.11, 12, 48), dark, {+ position: [shroudX - 0.22, P.hullY, 0], rotation: [0, 90, 0],+ scale: [1, 0.94, 1], parent: root+ });+ const shroudBrace = await roundedBoxGeo(0.46, 0.08, 0.08, 0.025, { segments: 4 });+ for (let i = 0; i < 4; i++) {+ const a = i * Math.PI * 0.5;+ createPart('ShroudBrace_' + (i + 1), shroudBrace, charcoalSoft, {+ position: [shroudX - 0.02, P.hullY + 0.72 * Math.cos(a), 0.72 * Math.sin(a)],+ rotation: [a * 180 / Math.PI, 0, 0], parent: root+ });+ }+ createPart('PropulsorHub', cylinderGeo(0.18, 0.24, 0.64, 32), brass, {+ position: [shroudX - 0.02, P.hullY, 0], rotation: [0, 0, 90], parent: root+ });+ const blade = await roundedBoxGeo(0.22, 0.075, 0.56, 0.028, { segments: 5, smooth: true });+ for (let i = 0; i < 7; i++) {+ const a = i * Math.PI * 2 / 7;+ createPart('PropulsorBlade_' + (i + 1), blade, brass, {+ position: [shroudX - 0.12, P.hullY + 0.35 * Math.cos(a), 0.35 * Math.sin(a)],+ rotation: [a * 180 / Math.PI + 18, 18, 0], parent: root+ });+ }++ const base = await roundedBoxGeo(12.6, 0.28, 3.15, 0.12, { segments: 8, smooth: true });+ createPart('DisplayPlinth', base, baseMat, {+ position: [-0.10, 0.14, 0], parent: root+ });+ const foot = await roundedBoxGeo(0.72, 0.72, 1.30, 0.11, { segments: 7, smooth: true });+ const cradle = await roundedBoxGeo(0.54, 0.12, 1.82, 0.05, { segments: 6, smooth: true });+ for (const x of [-3.25, 3.05]) {+ createPart('DisplayStanchion_' + x, foot, dark, {+ position: [x, 0.58, 0], parent: root+ });+ createPart('BrassCradle_' + x, cradle, brass, {+ position: [x, 0.98, 0], parent: root+ });+ createPart('CradlePad_' + x, await roundedBoxGeo(0.62, 0.08, 1.55, 0.03, { segments: 4 }), rubber, {+ position: [x, 1.06, 0], parent: root+ });+ }+ const plaque = await roundedBoxGeo(2.45, 0.42, 0.09, 0.04, { segments: 6, smooth: true });+ createPart('ModelNamePlaque', plaque, brass, {+ position: [0.25, 0.31, 1.61], rotation: [-8, 0, 0], parent: root+ });+ createPart('PlaqueInset', await roundedBoxGeo(2.12, 0.24, 0.035, 0.014, { segments: 5 }), dark, {+ position: [0.25, 0.31, 1.665], rotation: [-8, 0, 0], parent: root+ });++ return root;+}\ No newline at end of filediff --git a/site/examples/history/demo-abyssal-crown-deep-ocean-submarine/revision-2.kiln.js b/site/examples/history/demo-abyssal-crown-deep-ocean-submarine/revision-2.kiln.jsnew file mode 100644index 00000000..98bd3dd9--- /dev/null+++ b/site/examples/history/demo-abyssal-crown-deep-ocean-submarine/revision-2.kiln.js@@ -0,0 +1,292 @@+const meta = {+ name: 'Abyssal Crown Deep-Ocean Submarine',+ category: 'vehicle',+ role: 'vehicle'+};++const P = {+ hullY: 2.18,+ hullVerticalScale: 0.88,+ stations: [+ [-7.15, 0.10], [-6.92, 0.52], [-6.35, 1.10], [-5.25, 1.48],+ [-3.20, 1.70], [-0.60, 1.80], [2.35, 1.82], [4.25, 1.67],+ [5.65, 1.30], [6.55, 0.72], [6.98, 0.16], [7.06, 0.06]+ ]+};++function ownedGeo(positions, indices, uvs) {+ return meshGeo({ positions, indices, uvs });+}++function hullHalfGeo(upper) {+ const positions = [], indices = [], uvs = [];+ const rings = P.stations.length;+ const around = 28;+ const a0 = upper ? -Math.PI * 0.5 : Math.PI * 0.5;+ const a1 = upper ? Math.PI * 0.5 : Math.PI * 1.5;+ for (let i = 0; i < rings; i++) {+ const x = P.stations[i][0];+ const r = P.stations[i][1];+ for (let j = 0; j <= around; j++) {+ const t = j / around;+ const a = a0 + (a1 - a0) * t;+ positions.push(x, r * P.hullVerticalScale * Math.cos(a), r * Math.sin(a));+ uvs.push(i / (rings - 1), t);+ }+ }+ const row = around + 1;+ for (let i = 0; i < rings - 1; i++) {+ for (let j = 0; j < around; j++) {+ const a = i * row + j, b = (i + 1) * row + j;+ const c = a + 1, d = b + 1;+ indices.push(a, c, b, b, c, d);+ }+ }+ return ownedGeo(positions, indices, uvs);+}++function hullRadiusAt(x) {+ const s = P.stations;+ if (x <= s[0][0]) return s[0][1];+ if (x >= s[s.length - 1][0]) return s[s.length - 1][1];+ for (let i = 0; i < s.length - 1; i++) {+ if (x >= s[i][0] && x <= s[i + 1][0]) {+ const t = (x - s[i][0]) / (s[i + 1][0] - s[i][0]);+ return s[i][1] * (1 - t) + s[i + 1][1] * t;+ }+ }+ return 1;+}++function waterlineBandGeo(thetaCenter) {+ const positions = [], indices = [], uvs = [];+ const rows = 4;+ const halfAngle = 0.025;+ for (let i = 0; i < P.stations.length; i++) {+ const x = P.stations[i][0];+ const r = P.stations[i][1] + 0.014;+ for (let j = 0; j < rows; j++) {+ const t = j / (rows - 1);+ const a = thetaCenter - halfAngle + 2 * halfAngle * t;+ positions.push(x, r * P.hullVerticalScale * Math.cos(a), r * Math.sin(a));+ uvs.push(i / (P.stations.length - 1), t);+ }+ }+ for (let i = 0; i < P.stations.length - 1; i++) {+ for (let j = 0; j < rows - 1; j++) {+ const a = i * rows + j, b = (i + 1) * rows + j;+ const c = a + 1, d = b + 1;+ indices.push(a, c, b, b, c, d);+ }+ }+ return ownedGeo(positions, indices, uvs);+}++function prismXY(points, depth) {+ const p = [], idx = [], n = points.length;+ for (let side = -1; side <= 1; side += 2) {+ for (const q of points) p.push(q[0], q[1], side * depth * 0.5);+ }+ for (let i = 1; i < n - 1; i++) {+ idx.push(0, i + 1, i);+ idx.push(n, n + i, n + i + 1);+ }+ for (let i = 0; i < n; i++) {+ const k = (i + 1) % n;+ idx.push(i, k, n + i, k, n + k, n + i);+ }+ return ownedGeo(p, idx);+}++function prismXZ(points, height) {+ const p = [], idx = [], n = points.length;+ for (let side = -1; side <= 1; side += 2) {+ for (const q of points) p.push(q[0], side * height * 0.5, q[1]);+ }+ for (let i = 1; i < n - 1; i++) {+ idx.push(0, i, i + 1);+ idx.push(n, n + i + 1, n + i);+ }+ for (let i = 0; i < n; i++) {+ const k = (i + 1) % n;+ idx.push(i, n + i, k, k, n + i, n + k);+ }+ return ownedGeo(p, idx);+}++async function build() {+ const root = createRoot('AbyssalCrown_Submarine');++ const charcoal = gameMaterial(0x182228, { metalness: 0.72, roughness: 0.30 });+ const charcoalSoft = gameMaterial(0x26343a, { metalness: 0.62, roughness: 0.38 });+ const lowerRed = gameMaterial(0x66161d, { metalness: 0.48, roughness: 0.38 });+ const pale = gameMaterial(0xd9d5c2, { metalness: 0.35, roughness: 0.34 });+ const brass = gameMaterial(0xb8893f, { metalness: 0.88, roughness: 0.23 });+ const dark = gameMaterial(0x090e11, { metalness: 0.78, roughness: 0.29 });+ const rubber = gameMaterial(0x121619, { metalness: 0.12, roughness: 0.70 });+ const baseMat = gameMaterial(0x101518, { metalness: 0.60, roughness: 0.32 });++ createPart('UpperPressureHull', hullHalfGeo(true), charcoal, {+ position: [0, P.hullY, 0], parent: root+ });+ createPart('LowerPressureHull', hullHalfGeo(false), lowerRed, {+ position: [0, P.hullY, 0], parent: root+ });+ createPart('Waterline_Starboard', waterlineBandGeo(Math.PI * 0.5), pale, {+ position: [0, P.hullY, 0], parent: root+ });+ createPart('Waterline_Port', waterlineBandGeo(-Math.PI * 0.5), pale, {+ position: [0, P.hullY, 0], parent: root+ });++ const seamXs = [-4.65, -2.35, 0.15, 2.65, 4.65];+ for (let i = 0; i < seamXs.length; i++) {+ const x = seamXs[i], r = hullRadiusAt(x) + 0.018;+ createPart('PressureRing_' + (i + 1), torusGeo(r, 0.018, 8, 48), charcoalSoft, {+ position: [x, P.hullY, 0], rotation: [0, 90, 0],+ scale: [1, P.hullVerticalScale, 1], parent: root+ });+ }++ const sailFairing = sphereGeo(1, 48, 24);+ createPart('SailBaseFairing', sailFairing, charcoalSoft, {+ position: [0.55, 3.47, 0], scale: [1.72, 0.46, 0.70], parent: root+ });+ const sailBody = await roundedBoxGeo(2.55, 2.07, 0.78, 0.20, { segments: 8, smooth: true });+ createPart('CommandSail', sailBody, charcoal, {+ position: [0.48, 4.45, 0], rotation: [0, 0, -3], parent: root+ });+ const sailCap = await roundedBoxGeo(1.92, 0.12, 0.66, 0.055, { segments: 6, smooth: true });+ createPart('SailCap', sailCap, pale, {+ position: [0.46, 5.49, 0], rotation: [0, 0, -3], parent: root+ });++ const mastPositions = [+ ['AttackPeriscope', 0.05, 6.02, -0.08, 0.075, 0.98],+ ['SearchPeriscope', 0.68, 5.95, 0.12, 0.065, 0.78],+ ['SensorMast', -0.48, 5.87, 0.10, 0.055, 0.62]+ ];+ for (let i = 0; i < mastPositions.length; i++) {+ const m = mastPositions[i];+ createPart(m[0] + '_Stem', cylinderGeo(m[4], m[4], m[5], 20), i === 2 ? brass : charcoalSoft, {+ position: [m[1], m[2], m[3]], parent: root+ });+ createPart(m[0] + '_Collar', cylinderGeo(m[4] * 2.15, m[4] * 2.15, 0.13, 24), brass, {+ position: [m[1], m[2] - m[5] * 0.46, m[3]], parent: root+ });+ }+ createPart('AttackPeriscope_Head', cylinderGeo(0.082, 0.082, 0.34, 20), charcoalSoft, {+ position: [0.20, 6.46, -0.08], rotation: [0, 0, 90], parent: root+ });+ createPart('AttackPeriscope_Lens', cylinderGeo(0.055, 0.055, 0.025, 20), brass, {+ position: [0.375, 6.46, -0.08], rotation: [0, 0, 90], parent: root+ });+ createPart('SearchPeriscope_Head', cylinderGeo(0.072, 0.072, 0.28, 20), charcoalSoft, {+ position: [0.81, 6.31, 0.12], rotation: [0, 0, 90], parent: root+ });++ const hatchXs = [-3.15, -1.42, 2.60, 4.08];+ for (let i = 0; i < hatchXs.length; i++) {+ const x = hatchXs[i];+ const top = P.hullY + hullRadiusAt(x) * P.hullVerticalScale;+ createPart('DeckHatch_' + (i + 1), cylinderGeo(0.27, 0.27, 0.055, 32), charcoalSoft, {+ position: [x, top + 0.02, 0], parent: root+ });+ createPart('DeckHatchRing_' + (i + 1), torusGeo(0.27, 0.024, 8, 32), brass, {+ position: [x, top + 0.055, 0], rotation: [90, 0, 0], parent: root+ });+ createPart('DeckHatchDog_' + (i + 1), await roundedBoxGeo(0.28, 0.035, 0.055, 0.014, { segments: 4 }), brass, {+ position: [x, top + 0.085, 0], rotation: [0, i % 2 ? 35 : -35, 0], parent: root+ });+ }++ for (const side of [-1, 1]) {+ for (let i = 0; i < 3; i++) {+ const x = 4.25 + i * 0.48;+ const z = side * (hullRadiusAt(x) + 0.015);+ createPart((side > 0 ? 'Starboard' : 'Port') + '_BowPanel_' + (i + 1),+ cylinderGeo(0.12, 0.12, 0.025, 24), i === 1 ? brass : charcoalSoft, {+ position: [x, P.hullY + 0.12 - i * 0.10, z],+ rotation: [90, 0, 0], parent: root+ });+ }+ createPart((side > 0 ? 'Starboard' : 'Port') + '_SailPlaque',+ await roundedBoxGeo(0.78, 0.16, 0.035, 0.012, { segments: 5 }), brass, {+ position: [0.55, 4.48, side * 0.405], parent: root+ });+ }++ const topFin = prismXY([[-1.05, 0], [0.72, 0], [0.16, 1.62], [-0.72, 1.45]], 0.20);+ const bottomFin = prismXY([[-1.05, 0], [0.72, 0], [0.16, -0.72], [-0.74, -0.66]], 0.20);+ createPart('UpperTailFin', topFin, charcoal, {+ position: [-5.82, 3.10, 0], parent: root+ });+ createPart('LowerTailFin', bottomFin, lowerRed, {+ position: [-5.82, 1.24, 0], parent: root+ });++ const rightFin = prismXZ([[-1.05, 0], [0.72, 0], [0.14, 1.72], [-0.76, 1.46]], 0.18);+ const leftFin = prismXZ([[-1.05, 0], [0.72, 0], [0.14, -1.72], [-0.76, -1.46]], 0.18);+ createPart('StarboardTailFin', rightFin, charcoal, {+ position: [-5.82, P.hullY, 0.66], parent: root+ });+ createPart('PortTailFin', leftFin, charcoal, {+ position: [-5.82, P.hullY, -0.66], parent: root+ });++ const shroudX = -7.43;+ createPart('PropulsorShroudFront', torusGeo(0.82, 0.14, 12, 48), charcoalSoft, {+ position: [shroudX + 0.18, P.hullY, 0], rotation: [0, 90, 0],+ scale: [1, 0.94, 1], parent: root+ });+ createPart('PropulsorShroudRear', torusGeo(0.82, 0.11, 12, 48), dark, {+ position: [shroudX - 0.22, P.hullY, 0], rotation: [0, 90, 0],+ scale: [1, 0.94, 1], parent: root+ });+ const shroudBrace = await roundedBoxGeo(0.46, 0.08, 0.08, 0.025, { segments: 4 });+ for (let i = 0; i < 4; i++) {+ const a = i * Math.PI * 0.5;+ createPart('ShroudBrace_' + (i + 1), shroudBrace, charcoalSoft, {+ position: [shroudX - 0.02, P.hullY + 0.72 * Math.cos(a), 0.72 * Math.sin(a)],+ rotation: [a * 180 / Math.PI, 0, 0], parent: root+ });+ }+ createPart('PropulsorHub', cylinderGeo(0.18, 0.24, 0.64, 32), brass, {+ position: [shroudX - 0.02, P.hullY, 0], rotation: [0, 0, 90], parent: root+ });+ const blade = await roundedBoxGeo(0.22, 0.075, 0.56, 0.028, { segments: 5, smooth: true });+ for (let i = 0; i < 7; i++) {+ const a = i * Math.PI * 2 / 7;+ createPart('PropulsorBlade_' + (i + 1), blade, brass, {+ position: [shroudX - 0.12, P.hullY + 0.35 * Math.cos(a), 0.35 * Math.sin(a)],+ rotation: [a * 180 / Math.PI + 18, 18, 0], parent: root+ });+ }++ const base = await roundedBoxGeo(12.6, 0.28, 3.15, 0.12, { segments: 8, smooth: true });+ createPart('DisplayPlinth', base, baseMat, {+ position: [-0.10, 0.14, 0], parent: root+ });+ const foot = await roundedBoxGeo(0.72, 0.72, 1.30, 0.11, { segments: 7, smooth: true });+ const cradle = await roundedBoxGeo(0.54, 0.12, 1.82, 0.05, { segments: 6, smooth: true });+ for (const x of [-3.25, 3.05]) {+ createPart('DisplayStanchion_' + x, foot, dark, {+ position: [x, 0.58, 0], parent: root+ });+ createPart('BrassCradle_' + x, cradle, brass, {+ position: [x, 0.98, 0], parent: root+ });+ createPart('CradlePad_' + x, await roundedBoxGeo(0.62, 0.08, 1.55, 0.03, { segments: 4 }), rubber, {+ position: [x, 1.06, 0], parent: root+ });+ }+ const plaque = await roundedBoxGeo(2.45, 0.42, 0.09, 0.04, { segments: 6, smooth: true });+ createPart('ModelNamePlaque', plaque, brass, {+ position: [0.25, 0.31, 1.61], rotation: [-8, 0, 0], parent: root+ });+ createPart('PlaqueInset', await roundedBoxGeo(2.12, 0.24, 0.035, 0.014, { segments: 5 }), dark, {+ position: [0.25, 0.31, 1.665], rotation: [-8, 0, 0], parent: root+ });++ return root;+}\ No newline at end of filediff --git a/site/examples/history/demo-argent-aircraft-carrier/history.json b/site/examples/history/demo-argent-aircraft-carrier/history.jsonnew file mode 100644index 00000000..a6021afe--- /dev/null+++ b/site/examples/history/demo-argent-aircraft-carrier/history.json@@ -0,0 +1,22 @@+{+ "version": 1,+ "brief": {+ "kind": "recorded",+ "text": "Make the jets orange and add an orange stripe to the island."+ },+ "currentSourceHash": "9b6b3cae4e44cfec99e06a019cc83b56484004ab37132ed9848ddb0bdda447be",+ "revisions": [+ {+ "file": "revision-1.kiln.js",+ "title": "Saved revision 1",+ "description": "Create a detailed aircraft carrier with a few jets on the flight deck.",+ "sourceHash": "a850f8dcbad0c01195b2bcfbc019b71fa0b74102e0be3c1596527324f75c3969"+ },+ {+ "file": "revision-2.kiln.js",+ "title": "Saved revision 2",+ "description": "Make the jets orange and add an orange stripe to the island.",+ "sourceHash": "9b6b3cae4e44cfec99e06a019cc83b56484004ab37132ed9848ddb0bdda447be"+ }+ ]+}diff --git a/site/examples/history/demo-argent-aircraft-carrier/revision-1.kiln.js b/site/examples/history/demo-argent-aircraft-carrier/revision-1.kiln.jsnew file mode 100644index 00000000..25cde768--- /dev/null+++ b/site/examples/history/demo-argent-aircraft-carrier/revision-1.kiln.js@@ -0,0 +1,136 @@+const meta = {name:'ARGENT CV-72 Aircraft Carrier',category:'vehicle',role:'vehicle'};+function build(){+ const root=createRoot('ARGENT_CV72');+ const D={deckY:4.65,length:34};+ const navy=gameMaterial(0x263f54,{roughness:.5,metalness:.35});+ const steel=gameMaterial(0x748892,{roughness:.48,metalness:.45});+ const light=gameMaterial(0xb3c1c7,{roughness:.55,metalness:.25});+ const dark=gameMaterial(0x171e25,{roughness:.83});+ const deckMat=gameMaterial(0x343b40,{roughness:.9});+ const white=gameMaterial(0xf2edce,{roughness:.7});+ const yellow=gameMaterial(0xe4b444,{roughness:.65});+ const red=gameMaterial(0xa44337,{roughness:.7});+ const glass=gameMaterial(0x123741,{roughness:.2,metalness:.55});+ const orange=gameMaterial(0xd46b35,{roughness:.6});+ function group(n,p=[0,0,0],parent=root){return createPivot(n,p,parent);}+ function box(n,w,h,d,x,y,z,m=steel,p=root,rot=[0,0,0]){return createPart(n,boxGeo(w,h,d),m,{position:[x,y,z],parent:p,rotation:rot});}+ function cyl(n,r,h,x,y,z,m=steel,p=root,rot=[0,0,0],r2=r){return createPart(n,cylinderGeo(r,r2,h,16),m,{position:[x,y,z],parent:p,rotation:rot});}+ function poly(n,pts,y,h,m,p=root){return createPart(n,loftProfiles([{profile:pts,frame:{origin:[0,y,0]}},{profile:pts,frame:{origin:[0,y+h,0]}}]),m,{parent:p});}+ function rod(n,a,b,r,m=steel,p=root){const av=new THREE.Vector3(...a),bv=new THREE.Vector3(...b);const mesh=createPart(n,cylinderGeo(r,r,av.distanceTo(bv),8),m,{parent:p});mesh.position.copy(av.add(bv).multiplyScalar(.5));mesh.quaternion.setFromUnitVectors(new THREE.Vector3(0,1,0),new THREE.Vector3(...b).sub(new THREE.Vector3(...a)).normalize());return mesh;}+ function line(n,x1,z1,x2,z2,w,m=white,y=4.846,p=root){let dx=x2-x1,dz=z2-z1;return box(n,Math.hypot(dx,dz),.012,w,(x1+x2)/2,y,(z1+z2)/2,m,p,[0,-Math.atan2(dz,dx)*180/Math.PI,0]);}+ const outline=[[-16,-2.65],[-12,-3.35],[7,-3.6],[12,-2.9],[15,-1.6],[16.7,0],[15,1.6],[12,2.9],[7,3.6],[-12,3.35],[-16,2.65]];+ const profiles=[{y:.15,sx:.9,sz:.54},{y:.6,sx:.97,sz:.75},{y:1.5,sx:1,sz:.9},{y:3.7,sx:1,sz:1},{y:4.55,sx:1,sz:1.01}];+ createPart('SculptedHull',loftProfiles(profiles.map(s=>({profile:outline.map(q=>[q[0]*s.sx,q[1]*s.sz]),frame:{origin:[0,s.y,0]}}))),navy,{parent:root});+ createPart('RedLowerHull',loftProfiles([{profile:outline.map(q=>[q[0]*.895,q[1]*.535]),frame:{origin:[0,.13,0]}},{profile:outline.map(q=>[q[0]*.97,q[1]*.755]),frame:{origin:[0,.63,0]}}]),red,{parent:root});+ const dp=[[-16.6,-4.35],[-13,-4.7],[-5,-5.6],[7,-5.6],[10.8,-3.9],[15.7,-3.4],[17.1,-1.4],[17.1,1.4],[15.7,3.4],[7,4.1],[-8,4.1],[-16.6,3.55]];+ poly('FlightDeckRim',dp,4.5,.22,steel);poly('FlightDeck',dp.map(q=>[q[0]*.995,q[1]*.995]),4.72,.11,deckMat);+ // Deliberately uncluttered landing lane angled away from starboard island.+ const lane={ax:-15.8,az:-.15,bx:9,bz:-3.65};+ for(const s of [-1,1])line('LandingLaneBoundary'+s,lane.ax,lane.az+s*1.05,lane.bx,lane.bz+s*1.05,.07);+ for(let i=0;i<15;i++){const t=i/15;let x=lane.ax+(lane.bx-lane.ax)*t,z=lane.az+(lane.bz-lane.az)*t;line('LandingCenterDash'+i,x,z,x+.7,z-.099,.10);}+ for(let i=0;i<4;i++){const x=-13+i*.85,z=lane.az+(x-lane.ax)*(lane.bz-lane.az)/(lane.bx-lane.ax);line('ArrestingCable'+i,x,z-1.0,x+.24,z+1.0,.035,steel,4.862);}+ for(const z of [-1.5,.8]){+ line('BowCatapultRail'+z,4,z,15.8,z,.075,steel);+ line('CatapultYellowGuide'+z,4,z+.18,15.3,z+.18,.04,yellow);+ box('CatapultShuttle'+z,.45,.04,.25,5,4.87,z,light);+ for(let i=0;i<4;i++)box('BowThreshold'+z+'_'+i,.7,.015,.12,15.25,4.849,z-.4+i*.25,white);+ }+ // Deck perimeter painted edge segments.+ for(let i=0;i<dp.length;i++){let a=dp[i],b=dp[(i+1)%dp.length];line('DeckEdgePaint'+i,a[0]*.98,a[1]*.97,b[0]*.98,b[1]*.97,.055,yellow);}+ // Flush deck lifts, recessed tracks, painted hazard corners.+ function lift(n,x,z,w,d){+ const g=group(n);+ box('LiftRecess',w+.18,.025,d+.18,x,4.837,z,dark,g);+ box('LiftSurface',w,.03,d,x,4.85,z,steel,g);+ for(const s of [-1,1]){line('LiftLongEdge'+s,x-w/2,z+s*d/2,x+w/2,z+s*d/2,.055,yellow,4.871,g);line('LiftShortEdge'+s,x+s*w/2,z-d/2,x+s*w/2,z+d/2,.055,yellow,4.871,g);}+ for(let i=0;i<6;i++)box('LiftPanelJoint'+i,.015,.012,d-.2,x-w/2+.2+i*(w-.4)/5,4.874,z,navy,g);+ }+ lift('AftStarboardAircraftElevator',-10.9,2.65,3.3,2.35);+ lift('ForwardStarboardAircraftElevator',7,2.8,2.8,2.0);+ lift('PortAircraftElevator',-5.5,-4.3,3.1,2.0);+ // Structural galleries and hull detail, leaving the pointed bow clear.+ for(const s of [-1,1]){+ for(let i=0;i<7;i++){let x=-13+i*3.5;+ box('Gallery_'+s+'_'+i,2.8,.14,.57,x,3.58,s*3.63,steel);+ box('GalleryShadow_'+s+'_'+i,2.65,.25,.07,x,3.86,s*3.46,dark);+ for(let j=0;j<4;j++)box('GalleryUpright_'+s+'_'+i+'_'+j,.06,.48,.08,x-1.15+j*.77,3.87,s*3.94,steel);+ rod('GalleryRailing_'+s+'_'+i,[x-1.4,4.1,s*3.94],[x+1.4,4.1,s*3.94],.025,light);+ poly('DeckBracket_'+s+'_'+i,[[x-.35,s*3.4],[x+.35,s*3.4],[x+.35,s*4.1]],3.12,.32,navy);+ }+ for(let i=0;i<13;i++){let x=-13+i*2.0;box('HullPanelSeam'+s+'_'+i,.022,1.45,.025,x,2.48,s*(Math.abs(x)>12?3.32:3.56),steel);}+ for(let i=0;i<8;i++)box('HullVent'+s+'_'+i,.48,.19,.025,-10+i*2.55,3.02,s*3.57,dark);+ for(let i=0;i<3;i++){let x=-9+i*6.5;box('LiferaftRack'+s+'_'+i,1.6,.12,.55,x,3.05,s*3.68,steel);for(let j=0;j<3;j++)cyl('LiferaftCanister'+s+'_'+i+'_'+j,.15,.45,x-.5+j*.5,3.23,s*3.75,light,root,[90,0,0]);}+ }+ // Hangar apertures at stern.+ for(const z of [-1.25,1.25]){box('SternHangarOpening'+z,.04,1.4,1.85,-16.015,3.2,z,dark);for(let i=0;i<6;i++)box('HangarShutterSlat'+z+'_'+i,.05,.075,1.7,-16.05,3.77-i*.12,z,steel);}+ box('SternServicePlatform',.8,.12,5,-16.3,2.36,0,steel);+ // Island superstructure.+ const island=group('Island',[0,4.84,2.7]);+ poly('IslandFoundation',[[-4,-.8],[2.8,-.8],[3.5,-.4],[3.5,.6],[-4,.6]],0,.65,navy,island);+ poly('IslandMainTower',[[-3.3,-.6],[2.5,-.6],[2.8,0],[2.4,.65],[-3.3,.65]],.65,1.65,steel,island);+ box('IslandOrangeRecognitionBand',5.7,.18,1.32,-.3,1.7,0,orange,island);+ poly('NavigationBridge',[[-1.8,-.85],[2.85,-.85],[3.25,-.4],[3.25,.65],[2.6,.95],[-1.8,.95]],2.1,.72,light,island);+ for(let i=0;i<9;i++)box('PortBridgeWindow'+i,.38,.3,.025,-1.5+i*.49,2.48,-.866,glass,island);+ for(let i=0;i<4;i++)box('ForwardBridgeWindow'+i,.025,.3,.23,3.262,2.48,-.29+i*.27,glass,island);+ for(let i=0;i<8;i++)box('StarboardBridgeWindow'+i,.38,.3,.025,-1.5+i*.5,2.48,.961,glass,island);+ poly('BridgeRoof',[[-1.94,-.99],[2.95,-.99],[3.42,-.44],[3.42,.73],[2.7,1.09],[-1.94,1.09]],2.83,.14,steel,island);+ box('UpperControlCabin',2.2,.65,1.2,.1,3.29,0,navy,island);+ for(let i=0;i<4;i++)box('UpperControlGlass'+i,.4,.29,.03,-.66+i*.51,3.34,-.614,glass,island);+ box('UpperControlRoof',2.45,.12,1.4,.1,3.66,0,light,island);+ box('ExhaustTrunk',1.2,1.2,1.0,-2.4,2.77,.02,navy,island);+ for(let i=0;i<5;i++)box('ExhaustGrille'+i,.075,.025,.85,-2.83+i*.21,3.38,.02,dark,island);+ const mast=group('MainRadarMast',[.1,3.73,0],island);+ for(const s of [-1,1])rod('MastLeg'+s,[-.42,0,s*.4],[0,2.8,s*.09],.065,steel,mast);+ for(let i=0;i<4;i++){let y=.35+i*.55;rod('MastCrossBrace'+i,[-.36,y,-.35],[0,y+.5,.25],.028,light,mast);}+ box('RadarPlatform',1.75,.09,1.35,0,1.9,0,steel,mast);+ cyl('RadarSpindle',.09,.55,0,2.18,0,steel,mast);+ box('LongRangeRadarArray',2.2,.72,.13,0,2.56,0,navy,mast,[0,22,0]);+ for(let i=0;i<8;i++)box('RadarArrayRib'+i,.025,.6,.04,-.93+i*.266,2.56,-.09,light,mast,[0,22,0]);+ cyl('TopAntenna',.025,1.05,0,3.08,0,light,mast);+ cyl('AftSensorMast',.065,2.6,-2.45,4.65,0,steel,island);+ box('AftSearchRadar',1.2,.34,.2,-2.45,5.96,0,light,island);+ for(const x of [-1.3,1.6]){cyl('CommsPedestal'+x,.14,.35,x,3.14,.54,steel,island);createPart('CommsRadome'+x,sphereGeo(.27,16,12),white,{position:[x,3.48,.54],parent:island});}+ // Small exterior ladders and access doors on tower.+ for(let i=0;i<10;i++)rod('IslandLadderRung'+i,[-3.32,.24+i*.23,-.65],[-2.98,.24+i*.23,-.65],.018,light,island);+ for(const x of [-3.32,-2.98])rod('IslandLadderRail'+x,[x,.1,-.65],[x,2.44,-.65],.025,light,island);+ box('IslandAccessDoor',.39,.68,.025,-1.6,.99,-.615,dark,island);+ // Four individually grouped twin-tail deck fighters; +X nose.+ function jet(n,x,z,angle){+ const j=group(n,[x,4.83,z]);j.rotation.y=angle*Math.PI/180;+ createPart('AerodynamicFuselage',loftProfiles([+ {profile:[[-.13,-.13],[.13,-.13],[.13,.13],[-.13,.13]],frame:{origin:[-1.1,.43,0],rotation:[0,0,-90]}},+ {profile:[[-.21,-.24],[.21,-.24],[.21,.24],[-.21,.24]],frame:{origin:[-.45,.43,0],rotation:[0,0,-90]}},+ {profile:[[-.13,-.19],[.13,-.19],[.13,.19],[-.13,.19]],frame:{origin:[.65,.43,0],rotation:[0,0,-90]}},+ {profile:[[-.015,-.025],[.015,-.025],[.015,.025],[-.015,.025]],frame:{origin:[1.35,.43,0],rotation:[0,0,-90]}}+ ]),light,{parent:j});+ for(const s of [-1,1]){+ poly('SweptWing'+s,[[-.85,s*.16],[.4,s*.16],[-.44,s*1.07],[-.97,s*1.02]],.42,.055,steel,j);+ poly('Tailplane'+s,[[-1.12,s*.14],[-.62,s*.15],[-.95,s*.59],[-1.3,s*.54]],.48,.045,light,j);+ // Swept, outward-canted twin stabilizers.+ const fg=new THREE.BufferGeometry();+ const v=[-1.09,.49,s*.20,-.57,.49,s*.20,-.90,1.04,s*.34,-1.12,1.04,s*.34];+ fg.setAttribute('position',new THREE.Float32BufferAttribute(v,3));fg.setIndex([0,1,2,0,2,3,2,1,0,3,2,0]);fg.computeVertexNormals();createPart('VerticalStabilizer'+s,fg,navy,{parent:j});+ cyl('EngineNozzle'+s,.102,.23,-1.11,.43,s*.13,dark,j,[0,0,90]);+ box('Intake'+s,.31,.14,.13,.03,.42,s*.23,dark,j);+ rod('MainLandingStrut'+s,[-.55,.12,s*.43],[-.55,.40,s*.43],.025,steel,j);+ cyl('MainWheel'+s,.10,.08,-.55,.1,s*.43,dark,j,[90,0,0]);+ box('WingOrangeTip'+s,.21,.012,.14,-.80,.486,s*.94,orange,j);+ }+ const canopy=createPart('SmokedCockpitCanopy',sphereGeo(1,16,10),glass,{position:[.53,.61,0],scale:[.43,.17,.145],parent:j});+ rod('NoseLandingStrut',[.77,.10,0],[.77,.37,0],.024,steel,j);+ cyl('NoseWheel',.08,.07,.77,.08,0,dark,j,[90,0,0]);+ box('CanopySpine',.025,.015,.29,.36,.73,0,steel,j);+ return j;+ }+ jet('Falcon_01',-13.2,2.15,-10);+ jet('Falcon_02',-8,2.0,-12);+ jet('Falcon_03',10.6,2.0,0);+ jet('Falcon_04',-1.0,-4.34,180);+ // Deck service tug beside island.+ const tug=group('DeckTractor',[-5.4,4.83,2.1]);box('TugBody',.9,.22,.55,0,.23,0,yellow,tug);box('TugCab',.35,.28,.46,-.2,.48,0,yellow,tug);box('TugWindow',.02,.18,.34,-.01,.49,0,glass,tug);+ for(const x of [-.3,.3])for(const z of [-.29,.29])cyl('TugWheel'+x+'_'+z,.13,.10,x,.13,z,dark,tug,[90,0,0]);+ // Deck tie-down sockets and stern approach lamps.+ for(let x=-14;x<14;x+=2)for(const z of [-3.3,1.1,3.3]){if(z===3.3&&x>-5&&x<5)continue;cyl('DeckTieDown'+x+'_'+z,.042,.014,x,4.848,z,light);}+ for(let i=0;i<7;i++)box('SternApproachLamp'+i,.09,.05,.12,-16.49,4.845,-1.0+i*.32,i%2?yellow:white);+ return root;+}\ No newline at end of filediff --git a/site/examples/history/demo-argent-aircraft-carrier/revision-2.kiln.js b/site/examples/history/demo-argent-aircraft-carrier/revision-2.kiln.jsnew file mode 100644index 00000000..1d94b739--- /dev/null+++ b/site/examples/history/demo-argent-aircraft-carrier/revision-2.kiln.js@@ -0,0 +1,136 @@+const meta = {name:'ARGENT CV-72 Aircraft Carrier',category:'vehicle',role:'vehicle'};+function build(){+ const root=createRoot('ARGENT_CV72');+ const D={deckY:4.65,length:34};+ const navy=gameMaterial(0x263f54,{roughness:.5,metalness:.35});+ const steel=gameMaterial(0x748892,{roughness:.48,metalness:.45});+ const light=gameMaterial(0xb3c1c7,{roughness:.55,metalness:.25});+ const dark=gameMaterial(0x171e25,{roughness:.83});+ const deckMat=gameMaterial(0x343b40,{roughness:.9});+ const white=gameMaterial(0xf2edce,{roughness:.7});+ const yellow=gameMaterial(0xe4b444,{roughness:.65});+ const red=gameMaterial(0xa44337,{roughness:.7});+ const glass=gameMaterial(0x123741,{roughness:.2,metalness:.55});+ const orange=gameMaterial(0xf57c22,{roughness:.6});+ function group(n,p=[0,0,0],parent=root){return createPivot(n,p,parent);}+ function box(n,w,h,d,x,y,z,m=steel,p=root,rot=[0,0,0]){return createPart(n,boxGeo(w,h,d),m,{position:[x,y,z],parent:p,rotation:rot});}+ function cyl(n,r,h,x,y,z,m=steel,p=root,rot=[0,0,0],r2=r){return createPart(n,cylinderGeo(r,r2,h,16),m,{position:[x,y,z],parent:p,rotation:rot});}+ function poly(n,pts,y,h,m,p=root){return createPart(n,loftProfiles([{profile:pts,frame:{origin:[0,y,0]}},{profile:pts,frame:{origin:[0,y+h,0]}}]),m,{parent:p});}+ function rod(n,a,b,r,m=steel,p=root){const av=new THREE.Vector3(...a),bv=new THREE.Vector3(...b);const mesh=createPart(n,cylinderGeo(r,r,av.distanceTo(bv),8),m,{parent:p});mesh.position.copy(av.add(bv).multiplyScalar(.5));mesh.quaternion.setFromUnitVectors(new THREE.Vector3(0,1,0),new THREE.Vector3(...b).sub(new THREE.Vector3(...a)).normalize());return mesh;}+ function line(n,x1,z1,x2,z2,w,m=white,y=4.846,p=root){let dx=x2-x1,dz=z2-z1;return box(n,Math.hypot(dx,dz),.012,w,(x1+x2)/2,y,(z1+z2)/2,m,p,[0,-Math.atan2(dz,dx)*180/Math.PI,0]);}+ const outline=[[-16,-2.65],[-12,-3.35],[7,-3.6],[12,-2.9],[15,-1.6],[16.7,0],[15,1.6],[12,2.9],[7,3.6],[-12,3.35],[-16,2.65]];+ const profiles=[{y:.15,sx:.9,sz:.54},{y:.6,sx:.97,sz:.75},{y:1.5,sx:1,sz:.9},{y:3.7,sx:1,sz:1},{y:4.55,sx:1,sz:1.01}];+ createPart('SculptedHull',loftProfiles(profiles.map(s=>({profile:outline.map(q=>[q[0]*s.sx,q[1]*s.sz]),frame:{origin:[0,s.y,0]}}))),navy,{parent:root});+ createPart('RedLowerHull',loftProfiles([{profile:outline.map(q=>[q[0]*.895,q[1]*.535]),frame:{origin:[0,.13,0]}},{profile:outline.map(q=>[q[0]*.97,q[1]*.755]),frame:{origin:[0,.63,0]}}]),red,{parent:root});+ const dp=[[-16.6,-4.35],[-13,-4.7],[-5,-5.6],[7,-5.6],[10.8,-3.9],[15.7,-3.4],[17.1,-1.4],[17.1,1.4],[15.7,3.4],[7,4.1],[-8,4.1],[-16.6,3.55]];+ poly('FlightDeckRim',dp,4.5,.22,steel);poly('FlightDeck',dp.map(q=>[q[0]*.995,q[1]*.995]),4.72,.11,deckMat);+ // Deliberately uncluttered landing lane angled away from starboard island.+ const lane={ax:-15.8,az:-.15,bx:9,bz:-3.65};+ for(const s of [-1,1])line('LandingLaneBoundary'+s,lane.ax,lane.az+s*1.05,lane.bx,lane.bz+s*1.05,.07);+ for(let i=0;i<15;i++){const t=i/15;let x=lane.ax+(lane.bx-lane.ax)*t,z=lane.az+(lane.bz-lane.az)*t;line('LandingCenterDash'+i,x,z,x+.7,z-.099,.10);}+ for(let i=0;i<4;i++){const x=-13+i*.85,z=lane.az+(x-lane.ax)*(lane.bz-lane.az)/(lane.bx-lane.ax);line('ArrestingCable'+i,x,z-1.0,x+.24,z+1.0,.035,steel,4.862);}+ for(const z of [-1.5,.8]){+ line('BowCatapultRail'+z,4,z,15.8,z,.075,steel);+ line('CatapultYellowGuide'+z,4,z+.18,15.3,z+.18,.04,yellow);+ box('CatapultShuttle'+z,.45,.04,.25,5,4.87,z,light);+ for(let i=0;i<4;i++)box('BowThreshold'+z+'_'+i,.7,.015,.12,15.25,4.849,z-.4+i*.25,white);+ }+ // Deck perimeter painted edge segments.+ for(let i=0;i<dp.length;i++){let a=dp[i],b=dp[(i+1)%dp.length];line('DeckEdgePaint'+i,a[0]*.98,a[1]*.97,b[0]*.98,b[1]*.97,.055,yellow);}+ // Flush deck lifts, recessed tracks, painted hazard corners.+ function lift(n,x,z,w,d){+ const g=group(n);+ box('LiftRecess',w+.18,.025,d+.18,x,4.837,z,dark,g);+ box('LiftSurface',w,.03,d,x,4.85,z,steel,g);+ for(const s of [-1,1]){line('LiftLongEdge'+s,x-w/2,z+s*d/2,x+w/2,z+s*d/2,.055,yellow,4.871,g);line('LiftShortEdge'+s,x+s*w/2,z-d/2,x+s*w/2,z+d/2,.055,yellow,4.871,g);}+ for(let i=0;i<6;i++)box('LiftPanelJoint'+i,.015,.012,d-.2,x-w/2+.2+i*(w-.4)/5,4.874,z,navy,g);+ }+ lift('AftStarboardAircraftElevator',-10.9,2.65,3.3,2.35);+ lift('ForwardStarboardAircraftElevator',7,2.8,2.8,2.0);+ lift('PortAircraftElevator',-5.5,-4.3,3.1,2.0);+ // Structural galleries and hull detail, leaving the pointed bow clear.+ for(const s of [-1,1]){+ for(let i=0;i<7;i++){let x=-13+i*3.5;+ box('Gallery_'+s+'_'+i,2.8,.14,.57,x,3.58,s*3.63,steel);+ box('GalleryShadow_'+s+'_'+i,2.65,.25,.07,x,3.86,s*3.46,dark);+ for(let j=0;j<4;j++)box('GalleryUpright_'+s+'_'+i+'_'+j,.06,.48,.08,x-1.15+j*.77,3.87,s*3.94,steel);+ rod('GalleryRailing_'+s+'_'+i,[x-1.4,4.1,s*3.94],[x+1.4,4.1,s*3.94],.025,light);+ poly('DeckBracket_'+s+'_'+i,[[x-.35,s*3.4],[x+.35,s*3.4],[x+.35,s*4.1]],3.12,.32,navy);+ }+ for(let i=0;i<13;i++){let x=-13+i*2.0;box('HullPanelSeam'+s+'_'+i,.022,1.45,.025,x,2.48,s*(Math.abs(x)>12?3.32:3.56),steel);}+ for(let i=0;i<8;i++)box('HullVent'+s+'_'+i,.48,.19,.025,-10+i*2.55,3.02,s*3.57,dark);+ for(let i=0;i<3;i++){let x=-9+i*6.5;box('LiferaftRack'+s+'_'+i,1.6,.12,.55,x,3.05,s*3.68,steel);for(let j=0;j<3;j++)cyl('LiferaftCanister'+s+'_'+i+'_'+j,.15,.45,x-.5+j*.5,3.23,s*3.75,light,root,[90,0,0]);}+ }+ // Hangar apertures at stern.+ for(const z of [-1.25,1.25]){box('SternHangarOpening'+z,.04,1.4,1.85,-16.015,3.2,z,dark);for(let i=0;i<6;i++)box('HangarShutterSlat'+z+'_'+i,.05,.075,1.7,-16.05,3.77-i*.12,z,steel);}+ box('SternServicePlatform',.8,.12,5,-16.3,2.36,0,steel);+ // Island superstructure.+ const island=group('Island',[0,4.84,2.7]);+ poly('IslandFoundation',[[-4,-.8],[2.8,-.8],[3.5,-.4],[3.5,.6],[-4,.6]],0,.65,navy,island);+ poly('IslandMainTower',[[-3.3,-.6],[2.5,-.6],[2.8,0],[2.4,.65],[-3.3,.65]],.65,1.65,steel,island);+ poly('IslandOrangeRecognitionBand',[[-3.32,-.62],[2.512,-.62],[2.825,0],[2.412,.67],[-3.32,.67]],1.65,.32,orange,island);+ poly('NavigationBridge',[[-1.8,-.85],[2.85,-.85],[3.25,-.4],[3.25,.65],[2.6,.95],[-1.8,.95]],2.1,.72,light,island);+ for(let i=0;i<9;i++)box('PortBridgeWindow'+i,.38,.3,.025,-1.5+i*.49,2.48,-.866,glass,island);+ for(let i=0;i<4;i++)box('ForwardBridgeWindow'+i,.025,.3,.23,3.262,2.48,-.29+i*.27,glass,island);+ for(let i=0;i<8;i++)box('StarboardBridgeWindow'+i,.38,.3,.025,-1.5+i*.5,2.48,.961,glass,island);+ poly('BridgeRoof',[[-1.94,-.99],[2.95,-.99],[3.42,-.44],[3.42,.73],[2.7,1.09],[-1.94,1.09]],2.83,.14,steel,island);+ box('UpperControlCabin',2.2,.65,1.2,.1,3.29,0,navy,island);+ for(let i=0;i<4;i++)box('UpperControlGlass'+i,.4,.29,.03,-.66+i*.51,3.34,-.614,glass,island);+ box('UpperControlRoof',2.45,.12,1.4,.1,3.66,0,light,island);+ box('ExhaustTrunk',1.2,1.2,1.0,-2.4,2.77,.02,navy,island);+ for(let i=0;i<5;i++)box('ExhaustGrille'+i,.075,.025,.85,-2.83+i*.21,3.38,.02,dark,island);+ const mast=group('MainRadarMast',[.1,3.73,0],island);+ for(const s of [-1,1])rod('MastLeg'+s,[-.42,0,s*.4],[0,2.8,s*.09],.065,steel,mast);+ for(let i=0;i<4;i++){let y=.35+i*.55;rod('MastCrossBrace'+i,[-.36,y,-.35],[0,y+.5,.25],.028,light,mast);}+ box('RadarPlatform',1.75,.09,1.35,0,1.9,0,steel,mast);+ cyl('RadarSpindle',.09,.55,0,2.18,0,steel,mast);+ box('LongRangeRadarArray',2.2,.72,.13,0,2.56,0,navy,mast,[0,22,0]);+ for(let i=0;i<8;i++)box('RadarArrayRib'+i,.025,.6,.04,-.93+i*.266,2.56,-.09,light,mast,[0,22,0]);+ cyl('TopAntenna',.025,1.05,0,3.08,0,light,mast);+ cyl('AftSensorMast',.065,2.6,-2.45,4.65,0,steel,island);+ box('AftSearchRadar',1.2,.34,.2,-2.45,5.96,0,light,island);+ for(const x of [-1.3,1.6]){cyl('CommsPedestal'+x,.14,.35,x,3.14,.54,steel,island);createPart('CommsRadome'+x,sphereGeo(.27,16,12),white,{position:[x,3.48,.54],parent:island});}+ // Small exterior ladders and access doors on tower.+ for(let i=0;i<10;i++)rod('IslandLadderRung'+i,[-3.32,.24+i*.23,-.65],[-2.98,.24+i*.23,-.65],.018,light,island);+ for(const x of [-3.32,-2.98])rod('IslandLadderRail'+x,[x,.1,-.65],[x,2.44,-.65],.025,light,island);+ box('IslandAccessDoor',.39,.68,.025,-1.6,.99,-.615,dark,island);+ // Four individually grouped twin-tail deck fighters; +X nose.+ function jet(n,x,z,angle){+ const j=group(n,[x,4.83,z]);j.rotation.y=angle*Math.PI/180;+ createPart('AerodynamicFuselage',loftProfiles([+ {profile:[[-.13,-.13],[.13,-.13],[.13,.13],[-.13,.13]],frame:{origin:[-1.1,.43,0],rotation:[0,0,-90]}},+ {profile:[[-.21,-.24],[.21,-.24],[.21,.24],[-.21,.24]],frame:{origin:[-.45,.43,0],rotation:[0,0,-90]}},+ {profile:[[-.13,-.19],[.13,-.19],[.13,.19],[-.13,.19]],frame:{origin:[.65,.43,0],rotation:[0,0,-90]}},+ {profile:[[-.015,-.025],[.015,-.025],[.015,.025],[-.015,.025]],frame:{origin:[1.35,.43,0],rotation:[0,0,-90]}}+ ]),orange,{parent:j});+ for(const s of [-1,1]){+ poly('SweptWing'+s,[[-.85,s*.16],[.4,s*.16],[-.44,s*1.07],[-.97,s*1.02]],.42,.055,orange,j);+ poly('Tailplane'+s,[[-1.12,s*.14],[-.62,s*.15],[-.95,s*.59],[-1.3,s*.54]],.48,.045,orange,j);+ // Swept, outward-canted twin stabilizers.+ const fg=new THREE.BufferGeometry();+ const v=[-1.09,.49,s*.20,-.57,.49,s*.20,-.90,1.04,s*.34,-1.12,1.04,s*.34];+ fg.setAttribute('position',new THREE.Float32BufferAttribute(v,3));fg.setIndex([0,1,2,0,2,3,2,1,0,3,2,0]);fg.computeVertexNormals();createPart('VerticalStabilizer'+s,fg,orange,{parent:j});+ cyl('EngineNozzle'+s,.102,.23,-1.11,.43,s*.13,dark,j,[0,0,90]);+ box('Intake'+s,.31,.14,.13,.03,.42,s*.23,dark,j);+ rod('MainLandingStrut'+s,[-.55,.12,s*.43],[-.55,.40,s*.43],.025,steel,j);+ cyl('MainWheel'+s,.10,.08,-.55,.1,s*.43,dark,j,[90,0,0]);+ box('WingOrangeTip'+s,.21,.012,.14,-.80,.486,s*.94,orange,j);+ }+ const canopy=createPart('SmokedCockpitCanopy',sphereGeo(1,16,10),glass,{position:[.53,.61,0],scale:[.43,.17,.145],parent:j});+ rod('NoseLandingStrut',[.77,.10,0],[.77,.37,0],.024,steel,j);+ cyl('NoseWheel',.08,.07,.77,.08,0,dark,j,[90,0,0]);+ box('CanopySpine',.025,.015,.29,.36,.73,0,orange,j);+ return j;+ }+ jet('Falcon_01',-13.2,2.15,-10);+ jet('Falcon_02',-8,2.0,-12);+ jet('Falcon_03',10.6,2.0,0);+ jet('Falcon_04',-1.0,-4.34,180);+ // Deck service tug beside island.+ const tug=group('DeckTractor',[-5.4,4.83,2.1]);box('TugBody',.9,.22,.55,0,.23,0,yellow,tug);box('TugCab',.35,.28,.46,-.2,.48,0,yellow,tug);box('TugWindow',.02,.18,.34,-.01,.49,0,glass,tug);+ for(const x of [-.3,.3])for(const z of [-.29,.29])cyl('TugWheel'+x+'_'+z,.13,.10,x,.13,z,dark,tug,[90,0,0]);+ // Deck tie-down sockets and stern approach lamps.+ for(let x=-14;x<14;x+=2)for(const z of [-3.3,1.1,3.3]){if(z===3.3&&x>-5&&x<5)continue;cyl('DeckTieDown'+x+'_'+z,.042,.014,x,4.848,z,light);}+ for(let i=0;i<7;i++)box('SternApproachLamp'+i,.09,.05,.12,-16.49,4.845,-1.0+i*.32,i%2?yellow:white);+ return root;+}\ No newline at end of filediff --git a/site/examples/history/demo-art-deco-conservatory/history.json b/site/examples/history/demo-art-deco-conservatory/history.jsonnew file mode 100644index 00000000..3ee398d9--- /dev/null+++ b/site/examples/history/demo-art-deco-conservatory/history.json@@ -0,0 +1,16 @@+{+ "version": 1,+ "brief": {+ "kind": "recorded",+ "text": "Art Deco botanical conservatory with a ribbed glass dome, copper framing, and lush planted terraces."+ },+ "currentSourceHash": "939586687895080c38d0683c75e370c9249fb7ddd9ecc17a791c0b4723f5a3d2",+ "revisions": [+ {+ "file": "revision-1.kiln.js",+ "title": "Saved revision 1",+ "description": "Art Deco botanical conservatory with a ribbed glass dome, copper framing, and lush planted terraces.",+ "sourceHash": "939586687895080c38d0683c75e370c9249fb7ddd9ecc17a791c0b4723f5a3d2"+ }+ ]+}diff --git a/site/examples/history/demo-art-deco-conservatory/revision-1.kiln.js b/site/examples/history/demo-art-deco-conservatory/revision-1.kiln.jsnew file mode 100644index 00000000..3f3723b7--- /dev/null+++ b/site/examples/history/demo-art-deco-conservatory/revision-1.kiln.js@@ -0,0 +1,858 @@+const meta = {+ name: 'Art Deco Botanical Conservatory',+ category: 'architecture',+ role: 'building'+};++function build() {+ const root = createRoot('ArtDecoConservatory');++ // ==========================================+ // MATERIALS PALETTE (Art Deco & Botanical)+ // ==========================================+ const copper = gameMaterial(0xc87442, { metalness: 0.85, roughness: 0.32 });+ const copperDark = gameMaterial(0x8e4726, { metalness: 0.88, roughness: 0.38 });+ const copperPatina = gameMaterial(0x489688, { metalness: 0.55, roughness: 0.5 });+ const goldAccent = gameMaterial(0xdfa538, { metalness: 0.86, roughness: 0.28 });+ const glass = glassMaterial(0x8ee0d6, { opacity: 0.34, roughness: 0.12, metalness: 0.05 });++ const stonePaver = gameMaterial(0xe0d8cb, { roughness: 0.85, metalness: 0.05 });+ const stoneBase = gameMaterial(0xbaa793, { roughness: 0.9, metalness: 0.04 });+ const stoneTrim = gameMaterial(0xc8bea8, { roughness: 0.85, metalness: 0.04 });+ const soil = gameMaterial(0x302115, { roughness: 0.95 });++ const trunkMat = gameMaterial(0x6a4f38, { roughness: 0.88 });+ const palmGreen = gameMaterial(0x2d6f2e, { roughness: 0.65 });+ const deepGreen = gameMaterial(0x1e4e22, { roughness: 0.7 });+ const lightGreen = gameMaterial(0x428e30, { roughness: 0.6 });+ const vineGreen = gameMaterial(0x265f24, { roughness: 0.65 });+ const flowerPink = gameMaterial(0xe84a62, { roughness: 0.5 });+ const flowerGold = gameMaterial(0xf5a823, { roughness: 0.5 });+ const flowerWhite = gameMaterial(0xf2ede4, { roughness: 0.6 });++ // ==========================================+ // SHARED GEOMETRIES+ // ==========================================+ const potGeo = lathe([[0.15, 0], [0.38, 0.45], [0.32, 0.65], [0.42, 0.8], [0.42, 0.9]], 16);+ const cypressGeo = coneGeo(0.65, 2.8, 12);+ const bushBlobGeo = sphereGeo(0.5, 8, 6);+ const leafSpillGeo = sphereGeo(0.35, 7, 5);++ // ==========================================+ // 1. LOWER PODIUM & PLAZA (Tier 0: Y = 0 to 0.8m)+ // ==========================================+ const podiumGroup = createPivot('PodiumGroup', [0, 0, 0], root);++ // Base plinth: 18m wide (Z: -9 to +9) x 20m long (X: -10 to +10)+ createPart('PlinthBase', boxGeo(20.4, 0.2, 18.4), stoneBase, {+ position: [0, 0.1, 0],+ parent: podiumGroup+ });+ createPart('PlinthMain', boxGeo(20.0, 0.6, 18.0), stoneTrim, {+ position: [0, 0.5, 0],+ parent: podiumGroup+ });+ createPart('PlinthPaving', boxGeo(19.6, 0.08, 17.6), stonePaver, {+ position: [0, 0.84, 0],+ parent: podiumGroup+ });++ // Grand Front Staircase (Facing +X, from X = 9.8m to 12.6m, width 6.0m)+ const stairSteps = 5;+ const stairRise = 0.16;+ const stairRun = 0.56;+ for (let s = 0; s < stairSteps; s++) {+ const y = (stairSteps - 1 - s) * stairRise + stairRise / 2;+ const x = 10.0 + s * stairRun + stairRun / 2;+ createPart('StairStep_' + s, boxGeo(stairRun + 0.04, stairRise, 6.2), stonePaver, {+ position: [x, y, 0],+ parent: podiumGroup+ });+ }+ // Staircase cheek parapets flanking the front stairs (Z = ±3.3m)+ for (const side of [-1, 1]) {+ createPart('StairCheek_' + side, boxGeo(3.2, 1.1, 0.5), stoneTrim, {+ position: [11.2, 0.55, side * 3.35],+ parent: podiumGroup+ });+ createPart('StairCheekCap_' + side, boxGeo(3.3, 0.08, 0.56), copper, {+ position: [11.2, 1.14, side * 3.35],+ parent: podiumGroup+ });+ // Art Deco Pedestal Lanterns flanking the staircase+ createPart('StairLanternBase_' + side, boxGeo(0.44, 0.16, 0.44), copperDark, {+ position: [12.4, 1.26, side * 3.35],+ parent: podiumGroup+ });+ createPart('StairLanternGlass_' + side, cylinderGeo(0.18, 0.14, 0.38, 8), glass, {+ position: [12.4, 1.53, side * 3.35],+ parent: podiumGroup+ });+ createPart('StairLanternCap_' + side, coneGeo(0.24, 0.2, 8), copper, {+ position: [12.4, 1.82, side * 3.35],+ parent: podiumGroup+ });+ createPart('StairLanternFinial_' + side, sphereGeo(0.06, 6, 6), goldAccent, {+ position: [12.4, 1.96, side * 3.35],+ parent: podiumGroup+ });+ }++ // Front Garden Terrace Beds flanking the grand stairs (at X = 8.6m, Z = ±5.8m)+ for (const frontSide of [-1, 1]) {+ const fz = frontSide * 5.8;+ createPart('FrontBedParapet_' + frontSide, boxGeo(2.4, 0.6, 0.35), stoneTrim, {+ position: [9.4, 0.5, fz],+ parent: podiumGroup+ });+ createPart('FrontBedCap_' + frontSide, boxGeo(2.5, 0.06, 0.42), copper, {+ position: [9.4, 0.83, fz],+ parent: podiumGroup+ });+ createPart('FrontBedSoil_' + frontSide, boxGeo(2.2, 0.15, 2.6), soil, {+ position: [8.2, 0.75, fz],+ parent: podiumGroup+ });+ // Lush shrubs and tropical blooms in front beds+ createPart('FrontBush1_' + frontSide, bushBlobGeo, deepGreen, {+ position: [8.2, 1.05, fz - 0.5],+ scale: [1.1, 0.8, 1.1],+ parent: podiumGroup+ });+ createPart('FrontBush2_' + frontSide, bushBlobGeo, lightGreen, {+ position: [8.4, 1.1, fz + 0.5],+ scale: [1.0, 0.9, 1.0],+ parent: podiumGroup+ });+ createPart('FrontFlower_' + frontSide, sphereGeo(0.24, 6, 5), flowerPink, {+ position: [8.3, 1.35, fz],+ parent: podiumGroup+ });+ // Cascading vine over front wall+ createPart('FrontVine_' + frontSide, leafSpillGeo, vineGreen, {+ position: [9.55, 0.75, fz],+ scale: [0.8, 1.3, 1.2],+ parent: podiumGroup+ });+ }++ // 4 Stepped Art Deco Corner Pylons+ const cornerCoords = [+ [-9.2, -8.2], [-9.2, 8.2],+ [9.2, -8.2], [9.2, 8.2]+ ];+ cornerCoords.forEach(([cx, cz], idx) => {+ // Stepped plinth+ createPart('PylonBase_' + idx, boxGeo(1.6, 1.4, 1.6), stoneTrim, {+ position: [cx, 0.7, cz],+ parent: podiumGroup+ });+ // Fluted central shaft+ createPart('PylonShaft_' + idx, boxGeo(1.25, 0.8, 1.25), stonePaver, {+ position: [cx, 1.8, cz],+ parent: podiumGroup+ });+ // Tiered copper cap+ createPart('PylonCap1_' + idx, boxGeo(1.4, 0.1, 1.4), copper, {+ position: [cx, 2.25, cz],+ parent: podiumGroup+ });+ createPart('PylonCap2_' + idx, boxGeo(1.1, 0.12, 1.1), copperPatina, {+ position: [cx, 2.36, cz],+ parent: podiumGroup+ });+ // Fluted urn with floral bouquet on each pylon+ createPart('PylonUrn_' + idx, potGeo, copper, {+ position: [cx, 2.42, cz],+ parent: podiumGroup+ });+ createPart('PylonUrnSoil_' + idx, cylinderGeo(0.38, 0.38, 0.1, 12), soil, {+ position: [cx, 3.25, cz],+ parent: podiumGroup+ });+ // Spilling plants in urn+ for (let f = 0; f < 6; f++) {+ const ang = (f * Math.PI * 2) / 6;+ createPart('UrnFlower_' + idx + '_' + f, sphereGeo(0.18, 6, 5), (f % 2 === 0 ? flowerPink : flowerGold), {+ position: [cx + 0.28 * Math.cos(ang), 3.38, cz + 0.28 * Math.sin(ang)],+ parent: podiumGroup+ });+ createPart('UrnSpill_' + idx + '_' + f, leafSpillGeo, vineGreen, {+ position: [cx + 0.38 * Math.cos(ang), 3.15, cz + 0.38 * Math.sin(ang)],+ parent: podiumGroup+ });+ }+ });++ // ==========================================+ // 2. MID PROMENADE & PLANTED TERRACES (Tier 1: Y = 0.8 to 1.6m)+ // ==========================================+ const terraceGroup = createPivot('TerraceGroup', [0, 0, 0], root);++ // Raised terrace podium (X: -8 to +8, Z: -8 to +8, height 0.8m up to Y = 1.6m)+ createPart('TerracePodium', boxGeo(16.4, 0.76, 16.4), stoneTrim, {+ position: [0, 1.18, 0],+ parent: terraceGroup+ });+ createPart('TerraceFloor', boxGeo(16.0, 0.08, 16.0), stonePaver, {+ position: [0, 1.6, 0],+ parent: terraceGroup+ });++ // North & South Exterior Garden Terraces (Z = -7.2m to -4.6m and Z = +4.6m to +7.2m)+ for (const side of [-1, 1]) {+ const tz = side * 5.9;+ // Retaining planter box along exterior wings+ createPart('TerraceParapet_' + side, boxGeo(14.8, 0.7, 0.35), stoneTrim, {+ position: [0, 1.95, side * 7.6],+ parent: terraceGroup+ });+ createPart('TerraceParapetCap_' + side, boxGeo(15.0, 0.08, 0.42), copper, {+ position: [0, 2.34, side * 7.6],+ parent: terraceGroup+ });+ // Front and back retaining walls of side terraces+ createPart('TerraceWallFront_' + side, boxGeo(0.35, 0.7, 3.2), stoneTrim, {+ position: [7.3, 1.95, tz],+ parent: terraceGroup+ });+ createPart('TerraceWallFrontCap_' + side, boxGeo(0.42, 0.08, 3.3), copper, {+ position: [7.3, 2.34, tz],+ parent: terraceGroup+ });+ createPart('TerraceWallBack_' + side, boxGeo(0.35, 0.7, 3.2), stoneTrim, {+ position: [-7.3, 1.95, tz],+ parent: terraceGroup+ });+ createPart('TerraceWallBackCap_' + side, boxGeo(0.42, 0.08, 3.3), copper, {+ position: [-7.3, 2.34, tz],+ parent: terraceGroup+ });++ // Deep planter soil bed+ createPart('TerraceSoil_' + side, boxGeo(14.2, 0.25, 2.6), soil, {+ position: [0, 1.8, tz],+ parent: terraceGroup+ });++ // Cascading Vines Spilling Over Terrace Parapet+ for (let v = 0; v < 8; v++) {+ const vx = -6.0 + v * 1.7;+ // Clustered trailing foliage cascading down exterior wall+ createPart('VineTop_' + side + '_' + v, leafSpillGeo, vineGreen, {+ position: [vx, 2.32, side * 7.8],+ scale: [1.2, 0.8, 1.1],+ parent: terraceGroup+ });+ createPart('VineMid_' + side + '_' + v, leafSpillGeo, deepGreen, {+ position: [vx, 1.9, side * 7.85],+ scale: [0.9, 1.4, 0.8],+ parent: terraceGroup+ });+ createPart('VineLow_' + side + '_' + v, leafSpillGeo, vineGreen, {+ position: [vx, 1.35, side * 7.88],+ scale: [0.7, 1.3, 0.6],+ parent: terraceGroup+ });+ }++ // Dense Plantings in Terrace Beds:+ // Stately Palm Trees (2 per terrace)+ const palmPositions = [[-4.2, tz], [4.2, tz]];+ palmPositions.forEach(([px, pz], pIdx) => {+ // Curved ringed trunk+ const trunkPts = [+ [px, 1.9, pz],+ [px + 0.1, 2.9, pz + 0.05 * side],+ [px + 0.25, 4.0, pz + 0.15 * side],+ [px + 0.45, 5.2, pz + 0.3 * side]+ ];+ const trunkGeo = pipeAlongPath(trunkPts, 0.14, { radialSegments: 10 });+ createPart('PalmTrunk_' + side + '_' + pIdx, trunkGeo, trunkMat, { parent: terraceGroup });++ // Palm Crown: 12 radiating arching fronds+ const crownHead = [px + 0.45, 5.2, pz + 0.3 * side];+ const frondCount = 12;+ for (let f = 0; f < frondCount; f++) {+ const fAng = (f * Math.PI * 2) / frondCount;+ const frondPts = [+ [crownHead[0], crownHead[1], crownHead[2]],+ [crownHead[0] + 0.7 * Math.cos(fAng), crownHead[1] + 0.35, crownHead[2] + 0.7 * Math.sin(fAng)],+ [crownHead[0] + 1.5 * Math.cos(fAng), crownHead[1] + 0.2, crownHead[2] + 1.5 * Math.sin(fAng)],+ [crownHead[0] + 2.1 * Math.cos(fAng), crownHead[1] - 0.45, crownHead[2] + 2.1 * Math.sin(fAng)]+ ];+ const frondStemGeo = pipeAlongPath(frondPts, 0.032, { radialSegments: 6 });+ createPart('PalmFrond_' + side + '_' + pIdx + '_' + f, frondStemGeo, palmGreen, { parent: terraceGroup });+ // Cascading feathered leaflets along frond+ for (let leaf = 1; leaf <= 3; leaf++) {+ const frac = leaf / 3.5;+ const lx = crownHead[0] + (0.7 + frac * 1.3) * Math.cos(fAng);+ const ly = crownHead[1] + 0.3 - frac * 0.6;+ const lz = crownHead[2] + (0.7 + frac * 1.3) * Math.sin(fAng);+ createPart('PalmLeaflet_' + side + '_' + pIdx + '_' + f + '_' + leaf, boxGeo(0.18, 0.02, 0.75 - frac * 0.15), lightGreen, {+ position: [lx, ly, lz],+ rotation: [18 * Math.sin(fAng) + 12, (-fAng * 180) / Math.PI + (leaf % 2 === 0 ? 25 : -25), 20],+ parent: terraceGroup+ });+ }+ }+ });++ // Conical Cypress / Topiary Evergreens (3 per terrace)+ [-6.2, 0, 6.2].forEach((cx, cIdx) => {+ createPart('Cypress_' + side + '_' + cIdx, cypressGeo, deepGreen, {+ position: [cx, 1.9 + 1.4, tz],+ parent: terraceGroup+ });+ // Tiered copper ring base for topiary+ createPart('CypressRing_' + side + '_' + cIdx, torusGeo(0.68, 0.04, 6, 16), copper, {+ position: [cx, 1.95, tz],+ rotation: [90, 0, 0],+ parent: terraceGroup+ });+ });++ // Layered Tropical Bushes & Flowers between trees+ [-2.2, -1.1, 1.1, 2.2].forEach((bx, bIdx) => {+ createPart('Bush_' + side + '_' + bIdx, bushBlobGeo, (bIdx % 2 === 0 ? deepGreen : lightGreen), {+ position: [bx, 2.2, tz + (bIdx % 2 === 0 ? 0.3 : -0.3)],+ scale: [1.2, 1.0, 1.2],+ parent: terraceGroup+ });+ // Bright tropical blossoms dotted on the bushes+ createPart('Flowers_' + side + '_' + bIdx, sphereGeo(0.22, 6, 5), (bIdx % 3 === 0 ? flowerPink : (bIdx % 3 === 1 ? flowerGold : flowerWhite)), {+ position: [bx, 2.55, tz + (bIdx % 2 === 0 ? 0.3 : -0.3)],+ parent: terraceGroup+ });+ });+ }++ // Art Deco Copper Balustrades along Front & Back Terrace Walkways+ for (const fSide of [-1, 1]) {+ const bx = fSide * 7.5;+ // Top handrail+ createPart('BalustradeRail_' + fSide, boxGeo(0.1, 0.06, 9.2), copper, {+ position: [bx, 2.35, 0],+ parent: terraceGroup+ });+ // Bottom rail+ createPart('BalustradeBase_' + fSide, boxGeo(0.08, 0.04, 9.2), copperDark, {+ position: [bx, 1.72, 0],+ parent: terraceGroup+ });+ // Posts & Art Deco Geometric Balusters+ for (let p = -4; p <= 4; p++) {+ const bz = p * 1.1;+ createPart('BalustradePost_' + fSide + '_' + p, boxGeo(0.09, 0.65, 0.09), copper, {+ position: [bx, 2.02, bz],+ parent: terraceGroup+ });+ if (p < 4) {+ // Central vertical mullion connecting base and rail+ createPart('BalustradeMullion_' + fSide + '_' + p, boxGeo(0.05, 0.63, 0.05), copperDark, {+ position: [bx, 2.03, bz + 0.55],+ parent: terraceGroup+ });+ // Art Deco Diamond Medallion overlapping the central mullion+ createPart('BalustradeDiamond_' + fSide + '_' + p, boxGeo(0.07, 0.32, 0.32), goldAccent, {+ position: [bx, 2.03, bz + 0.55],+ rotation: [0, 0, 45],+ parent: terraceGroup+ });+ }+ }+ }++ // ==========================================+ // 3. MAIN CONSERVATORY PAVILION & WINGS (Y = 1.6m to 6.6m)+ // ==========================================+ const pavilionGroup = createPivot('PavilionGroup', [0, 0, 0], root);++ // Central Rotunda Base Wall / Sill (Octagonal, radius 4.3m, height 0.6m)+ const octSegments = 16;+ for (let i = 0; i < octSegments; i++) {+ const ang1 = (i * Math.PI * 2) / octSegments;+ const ang2 = ((i + 1) * Math.PI * 2) / octSegments;+ const midAng = (ang1 + ang2) / 2;+ const segWidth = 2 * 4.3 * Math.sin(Math.PI / octSegments);+ const rad = 4.3 * Math.cos(Math.PI / octSegments);+ const mx = rad * Math.cos(midAng);+ const mz = rad * Math.sin(midAng);+ const rotYDeg = (-midAng * 180) / Math.PI + 90;++ // Stone base panel under windows+ createPart('SillPanel_' + i, boxGeo(segWidth + 0.05, 0.6, 0.25), stoneTrim, {+ position: [mx, 1.9, mz],+ rotation: [0, rotYDeg, 0],+ parent: pavilionGroup+ });+ // Copper sill trim+ createPart('SillCopper_' + i, boxGeo(segWidth + 0.08, 0.06, 0.28), copper, {+ position: [mx, 2.22, mz],+ rotation: [0, rotYDeg, 0],+ parent: pavilionGroup+ });++ // Tall Glazed Windows (omit at front entrance door bay)+ const isDoorBay = (i === 0 || i === octSegments - 1);+ if (!isDoorBay) {+ createPart('WindowGlass_' + i, boxGeo(segWidth - 0.18, 3.8, 0.04), glass, {+ position: [mx, 4.15, mz],+ rotation: [0, rotYDeg, 0],+ parent: pavilionGroup+ });+ // Horizontal copper transoms dividing window panes+ createPart('WindowTransom1_' + i, boxGeo(segWidth, 0.05, 0.08), copper, {+ position: [mx, 3.4, mz],+ rotation: [0, rotYDeg, 0],+ parent: pavilionGroup+ });+ createPart('WindowTransom2_' + i, boxGeo(segWidth, 0.05, 0.08), copper, {+ position: [mx, 4.8, mz],+ rotation: [0, rotYDeg, 0],+ parent: pavilionGroup+ });+ }++ // Vertical Fluted Copper Columns / Mullions at each vertex+ const vx = 4.35 * Math.cos(ang1);+ const vz = 4.35 * Math.sin(ang1);+ createPart('RotundaMullion_' + i, boxGeo(0.2, 4.3, 0.2), copper, {+ position: [vx, 4.25, vz],+ rotation: [0, (-ang1 * 180) / Math.PI, 0],+ parent: pavilionGroup+ });+ // Tiered Art Deco Capital on column+ createPart('MullionCap1_' + i, boxGeo(0.28, 0.12, 0.28), copperDark, {+ position: [vx, 6.42, vz],+ rotation: [0, (-ang1 * 180) / Math.PI, 0],+ parent: pavilionGroup+ });+ createPart('MullionCap2_' + i, boxGeo(0.24, 0.08, 0.24), goldAccent, {+ position: [vx, 6.52, vz],+ rotation: [0, (-ang1 * 180) / Math.PI, 0],+ parent: pavilionGroup+ });+ }++ // Symmetrical East & West Glass Wings (Terraced glass galleries: Z = ±3.8m to ±6.8m, X = -2.8m to +2.8m)+ for (const side of [-1, 1]) {+ const wz = side * 5.3;+ // Wing end wall glass & frames+ createPart('WingGlassSide_' + side, boxGeo(5.2, 3.2, 0.04), glass, {+ position: [0, 3.4, side * 6.8],+ parent: pavilionGroup+ });+ // Wing mullions+ for (let wx = -2; wx <= 2; wx++) {+ createPart('WingMullion_' + side + '_' + wx, boxGeo(0.12, 3.2, 0.14), copper, {+ position: [wx * 1.2, 3.4, side * 6.8],+ parent: pavilionGroup+ });+ }+ // Sloped copper glass wing roof+ createPart('WingRoofGlass_' + side, boxGeo(5.4, 0.04, 2.8), glass, {+ position: [0, 5.2, side * 5.4],+ rotation: [side * 18, 0, 0],+ parent: pavilionGroup+ });+ // Roof copper rafters+ for (let rx = -2; rx <= 2; rx++) {+ createPart('WingRafter_' + side + '_' + rx, boxGeo(0.08, 0.12, 2.9), copper, {+ position: [rx * 1.2, 5.24, side * 5.4],+ rotation: [side * 18, 0, 0],+ parent: pavilionGroup+ });+ }+ // Wing ridge cornice+ createPart('WingCornice_' + side, boxGeo(5.6, 0.16, 0.22), copperDark, {+ position: [0, 5.65, side * 4.1],+ parent: pavilionGroup+ });+ }++ // ==========================================+ // 4. ART DECO GRAND ENTRANCE PORTAL (Facing +X)+ // ==========================================+ const portalGroup = createPivot('PortalGroup', [4.3, 1.6, 0], root);++ // Stepped Portal Jambs / Columns in Copper+ for (const pSide of [-1, 1]) {+ // Outer fluted pylon+ createPart('PortalPylonOuter_' + pSide, boxGeo(0.4, 4.4, 0.35), copper, {+ position: [0.15, 2.2, pSide * 1.6],+ parent: portalGroup+ });+ // Inner stepped jamb+ createPart('PortalPylonInner_' + pSide, boxGeo(0.35, 4.0, 0.25), copperDark, {+ position: [0.2, 2.0, pSide * 1.25],+ parent: portalGroup+ });+ // Art Deco Tiered Capital+ createPart('PortalCap_' + pSide, boxGeo(0.48, 0.18, 0.42), goldAccent, {+ position: [0.15, 4.45, pSide * 1.6],+ parent: portalGroup+ });+ }++ // Grand Tiered Entablature & Lintel+ createPart('PortalLintel1', boxGeo(0.42, 0.22, 3.5), copperDark, {+ position: [0.18, 4.0, 0],+ parent: portalGroup+ });+ createPart('PortalLintel2', boxGeo(0.48, 0.26, 3.8), copper, {+ position: [0.15, 4.3, 0],+ parent: portalGroup+ });+ createPart('PortalLintel3', boxGeo(0.54, 0.18, 4.0), copperPatina, {+ position: [0.12, 4.54, 0],+ parent: portalGroup+ });++ // Projecting Art Deco Marquee / Canopy+ createPart('CanopySlab', boxGeo(1.4, 0.12, 3.6), copper, {+ position: [0.8, 3.9, 0],+ parent: portalGroup+ });+ createPart('CanopyFascia', boxGeo(1.44, 0.08, 3.64), goldAccent, {+ position: [0.8, 3.98, 0],+ parent: portalGroup+ });++ // Radiant Art Deco Sunburst Pediment above Entrance+ // Central golden half-sun medallion+ createPart('SunburstMedallion', cylinderGeo(0.5, 0.5, 0.12, 16), goldAccent, {+ position: [0.22, 4.65, 0],+ rotation: [0, 0, 90],+ parent: portalGroup+ });+ // Radiating copper sun rays+ const sunRays = 9;+ for (let r = 0; r < sunRays; r++) {+ const rayAngDeg = -60 + r * 15;+ const rayRad = (rayAngDeg * Math.PI) / 180;+ createPart('SunRay_' + r, boxGeo(0.04, 0.75, 0.06), (r % 2 === 0 ? copper : goldAccent), {+ position: [0.24, 4.65 + 0.65 * Math.cos(rayRad), 0.65 * Math.sin(rayRad)],+ rotation: [0, 0, -rayAngDeg],+ parent: portalGroup+ });+ }++ // Glazed Double Doors with Art Deco Copper Grilles+ for (const dSide of [-1, 1]) {+ // Glass door leaf+ createPart('DoorGlass_' + dSide, boxGeo(0.06, 2.8, 0.85), glass, {+ position: [0.1, 1.4, dSide * 0.48],+ parent: portalGroup+ });+ // Copper door frame+ createPart('DoorFrameTop_' + dSide, boxGeo(0.09, 0.12, 0.92), copperDark, {+ position: [0.1, 2.8, dSide * 0.48],+ parent: portalGroup+ });+ createPart('DoorFrameBot_' + dSide, boxGeo(0.09, 0.28, 0.92), copperDark, {+ position: [0.1, 0.14, dSide * 0.48],+ parent: portalGroup+ });+ // Art Deco Geometric Grille (chevron & diagonal bars)+ createPart('DoorGrilleMid_' + dSide, boxGeo(0.08, 0.08, 0.85), goldAccent, {+ position: [0.11, 1.4, dSide * 0.48],+ parent: portalGroup+ });+ createPart('DoorGrilleBar1_' + dSide, boxGeo(0.05, 1.1, 0.04), copper, {+ position: [0.11, 2.0, dSide * 0.48 + 0.2],+ rotation: [22, 0, 0],+ parent: portalGroup+ });+ createPart('DoorGrilleBar2_' + dSide, boxGeo(0.05, 1.1, 0.04), copper, {+ position: [0.11, 2.0, dSide * 0.48 - 0.2],+ rotation: [-22, 0, 0],+ parent: portalGroup+ });+ // Sleek vertical copper push handle+ createPart('DoorHandle_' + dSide, cylinderGeo(0.025, 0.025, 0.7, 8), goldAccent, {+ position: [0.16, 1.35, dSide * 0.12],+ parent: portalGroup+ });+ }++ // ==========================================+ // 5. UPPER FRIEZE & CLERESTORY DRUM (Y = 6.4m to 7.5m)+ // ==========================================+ const drumGroup = createPivot('DrumGroup', [0, 0, 0], root);++ // Main Art Deco Entablature Frieze Rings (Hollow open rings so interior is visible!)+ createPart('MainFriezeBase', torusGeo(4.34, 0.1, 8, 32), copperDark, {+ position: [0, 6.55, 0],+ rotation: [90, 0, 0],+ parent: drumGroup+ });+ createPart('MainFriezePatina', torusGeo(4.35, 0.11, 8, 32), copperPatina, {+ position: [0, 6.72, 0],+ rotation: [90, 0, 0],+ parent: drumGroup+ });+ createPart('MainCornice', torusGeo(4.4, 0.12, 8, 32), copper, {+ position: [0, 6.88, 0],+ rotation: [90, 0, 0],+ parent: drumGroup+ });++ // Clerestory Drum: 16 perimeter posts and glass windows (completely hollow atrium inside!)+ for (let c = 0; c < 16; c++) {+ const cAng = (c * Math.PI * 2) / 16;+ const cx = 4.25 * Math.cos(cAng);+ const cz = 4.25 * Math.sin(cAng);+ const rotDeg = (-cAng * 180) / Math.PI + 90;+ // Structural copper post between clerestory windows+ createPart('ClerestoryPost_' + c, boxGeo(0.12, 0.6, 0.16), copperDark, {+ position: [cx, 7.22, cz],+ rotation: [0, rotDeg, 0],+ parent: drumGroup+ });+ // Arched clerestory window pane+ createPart('ClerestoryWindow_' + c, boxGeo(0.7, 0.44, 0.04), glass, {+ position: [cx, 7.22, cz],+ rotation: [0, rotDeg, 0],+ parent: drumGroup+ });+ createPart('ClerestoryArch_' + c, torusGeo(0.35, 0.03, 6, 12), copper, {+ position: [cx, 7.42, cz],+ rotation: [0, rotDeg, 0],+ parent: drumGroup+ });+ }++ // Stepped Dome Base Rings / Collars (Hollow open rings supporting the dome)+ createPart('DomeBaseRing1', torusGeo(4.3, 0.1, 8, 32), copper, {+ position: [0, 7.55, 0],+ rotation: [90, 0, 0],+ parent: drumGroup+ });+ createPart('DomeBaseRing2', torusGeo(4.22, 0.08, 8, 32), copperPatina, {+ position: [0, 7.66, 0],+ rotation: [90, 0, 0],+ parent: drumGroup+ });+ createPart('DomeBaseRing3', torusGeo(4.16, 0.06, 8, 32), goldAccent, {+ position: [0, 7.74, 0],+ rotation: [90, 0, 0],+ parent: drumGroup+ });++ // ==========================================+ // 6. THE RIBBED GLASS DOME (Y = 7.7m to 11.4m)+ // ==========================================+ const domeGroup = createPivot('DomeGroup', [0, 7.7, 0], root);++ const domeRadius = 4.15;+ const domeHeight = 3.65;++ // Translucent Glass Dome Shell+ const domeGlassGeo = parametricSurface((u, v) => {+ const phi = v * (Math.PI * 0.48);+ const r = domeRadius * Math.cos(phi);+ const y = domeHeight * Math.sin(phi);+ return [r * Math.cos(u), y, r * Math.sin(u)];+ }, { u: [0, Math.PI * 2], v: [0.03, 0.98], uSegments: 32, vSegments: 16 });++ createPart('DomeGlassShell', domeGlassGeo, glass, {+ position: [0, 0, 0],+ parent: domeGroup+ });++ // 16 Curved Copper Structural Meridian Ribs+ const ribCount = 16;+ const ribSteps = 16;+ const ribCurvePts = [];+ for (let s = 0; s <= ribSteps; s++) {+ const t = s / ribSteps;+ const phi = t * (Math.PI * 0.48);+ // Project 0.05m outward from the glass so the ribs stand out boldly+ const r = domeRadius * Math.cos(phi) + 0.05;+ const y = domeHeight * Math.sin(phi);+ ribCurvePts.push([r, y, 0]);+ }+ const ribBeamGeo = pipeAlongPath(ribCurvePts, 0.055, { radialSegments: 8 });++ for (let i = 0; i < ribCount; i++) {+ const ribDeg = (i * 360) / ribCount;+ // The structural arch rib+ createPart('DomeRib_' + i, ribBeamGeo, copper, {+ position: [0, 0, 0],+ rotation: [0, ribDeg, 0],+ parent: domeGroup+ });++ // Decorative Art Deco stepped copper corbel at the base of each rib+ const baseAng = (i * Math.PI * 2) / ribCount;+ createPart('RibCorbel_' + i, boxGeo(0.18, 0.28, 0.16), copperDark, {+ position: [4.24 * Math.cos(baseAng), 0.1, 4.24 * Math.sin(baseAng)],+ rotation: [0, (-baseAng * 180) / Math.PI, 0],+ parent: domeGroup+ });+ }++ // 3 Concentric Horizontal Copper Glazing Rings (Purlins)+ const ringParams = [+ { phiFrac: 0.24, tube: 0.045 },+ { phiFrac: 0.52, tube: 0.04 },+ { phiFrac: 0.78, tube: 0.035 }+ ];+ ringParams.forEach((rp, rIdx) => {+ const phi = rp.phiFrac * (Math.PI * 0.48);+ const r = domeRadius * Math.cos(phi) + 0.045;+ const y = domeHeight * Math.sin(phi);+ createPart('DomeRing_' + rIdx, torusGeo(r, rp.tube, 8, 32), copper, {+ position: [0, y, 0],+ rotation: [90, 0, 0],+ parent: domeGroup+ });+ });++ // ==========================================+ // 7. APEX LANTERN & ART DECO SPIRE (Y = 11.3m to 16.0m)+ // ==========================================+ const lanternGroup = createPivot('LanternGroup', [0, 7.7 + domeHeight * Math.sin(Math.PI * 0.48), 0], root);++ // Lantern Base Ring Collar+ createPart('LanternBaseCollar', cylinderGeo(1.05, 1.25, 0.16, 16), copperDark, {+ position: [0, 0.08, 0],+ parent: lanternGroup+ });++ // Octagonal Glazed Lantern Cupola (height 0.9m)+ createPart('LanternGlassCore', cylinderGeo(0.9, 0.9, 0.85, 16), glass, {+ position: [0, 0.56, 0],+ parent: lanternGroup+ });+ // 8 Vertical Copper Lantern Struts+ for (let l = 0; l < 8; l++) {+ const lAng = (l * Math.PI * 2) / 8;+ createPart('LanternStrut_' + l, boxGeo(0.1, 0.9, 0.12), copper, {+ position: [0.92 * Math.cos(lAng), 0.56, 0.92 * Math.sin(lAng)],+ rotation: [0, (-lAng * 180) / Math.PI, 0],+ parent: lanternGroup+ });+ }+ // Lantern Cornice+ createPart('LanternCornice', cylinderGeo(1.1, 0.98, 0.14, 16), copper, {+ position: [0, 1.05, 0],+ parent: lanternGroup+ });++ // Stepped Ziggurat Art Deco Crown (3 stepped copper tiers)+ createPart('CrownTier1', cylinderGeo(0.85, 1.02, 0.22, 16), copperPatina, {+ position: [0, 1.22, 0],+ parent: lanternGroup+ });+ createPart('CrownTier2', cylinderGeo(0.62, 0.82, 0.22, 16), copper, {+ position: [0, 1.42, 0],+ parent: lanternGroup+ });+ createPart('CrownTier3', cylinderGeo(0.42, 0.6, 0.22, 16), goldAccent, {+ position: [0, 1.62, 0],+ parent: lanternGroup+ });++ // 8 Radiating Art Deco Fin Blades / Sunburst Crown Crests (4 cardinal + 4 intercardinal)+ for (let k = 0; k < 8; k++) {+ const kDeg = k * 45;+ const isCardinal = (k % 2 === 0);+ createPart('SpireFin_' + k, boxGeo(0.04, isCardinal ? 0.95 : 0.7, isCardinal ? 0.72 : 0.52), (isCardinal ? copper : goldAccent), {+ position: [0, 1.8, 0],+ rotation: [0, kDeg, 0],+ parent: lanternGroup+ });+ }++ // Tapered Needle Spire (Reaching up to Y = 16.0m)+ createPart('SpireShaft', coneGeo(0.18, 2.2, 12), copper, {+ position: [0, 2.6, 0],+ parent: lanternGroup+ });+ createPart('SpireNeedle', coneGeo(0.04, 1.2, 8), goldAccent, {+ position: [0, 4.0, 0],+ parent: lanternGroup+ });+ createPart('SpireFinialOrb', sphereGeo(0.14, 8, 8), goldAccent, {+ position: [0, 4.65, 0],+ parent: lanternGroup+ });+ createPart('SpireTip', coneGeo(0.015, 0.5, 6), copper, {+ position: [0, 4.95, 0],+ parent: lanternGroup+ });++ // ==========================================+ // 8. INTERIOR BOTANICAL CONSERVATORY FEATURES (Visible through glass!)+ // ==========================================+ const interiorGroup = createPivot('InteriorGroup', [0, 1.6, 0], root);++ // Conservatory Interior Tiled Floor+ createPart('InteriorFloor', cylinderGeo(4.1, 4.1, 0.1, 24), stonePaver, {+ position: [0, 0.05, 0],+ parent: interiorGroup+ });++ // Central Raised Planter Bed (Circular with stepped copper rim)+ createPart('CentralPlanterWall', cylinderGeo(1.8, 1.9, 0.45, 20), stoneTrim, {+ position: [0, 0.25, 0],+ parent: interiorGroup+ });+ createPart('CentralPlanterRim', torusGeo(1.82, 0.06, 6, 24), copper, {+ position: [0, 0.48, 0],+ rotation: [90, 0, 0],+ parent: interiorGroup+ });+ createPart('CentralPlanterSoil', cylinderGeo(1.75, 1.75, 0.1, 20), soil, {+ position: [0, 0.42, 0],+ parent: interiorGroup+ });++ // Majestic Giant Interior Palm Tree (rising up into the glass dome!)+ const intTrunkPts = [+ [0, 0.45, 0],+ [0.15, 2.0, -0.1],+ [0.1, 4.2, 0.15],+ [-0.1, 6.2, 0.05]+ ];+ const intTrunkGeo = pipeAlongPath(intTrunkPts, 0.18, { radialSegments: 10 });+ createPart('InteriorTreeTrunk', intTrunkGeo, trunkMat, { parent: interiorGroup });++ // Spreading Tropical Palm Canopy under the dome+ const intHead = [-0.1, 6.2, 0.05];+ const intFrondCount = 14;+ for (let j = 0; j < intFrondCount; j++) {+ const jAng = (j * Math.PI * 2) / intFrondCount;+ const jPts = [+ [intHead[0], intHead[1], intHead[2]],+ [intHead[0] + 1.1 * Math.cos(jAng), intHead[1] + 0.6, intHead[2] + 1.1 * Math.sin(jAng)],+ [intHead[0] + 2.2 * Math.cos(jAng), intHead[1] + 0.3, intHead[2] + 2.2 * Math.sin(jAng)],+ [intHead[0] + 2.9 * Math.cos(jAng), intHead[1] - 0.7, intHead[2] + 2.9 * Math.sin(jAng)]+ ];+ const jFrondGeo = pipeAlongPath(jPts, 0.038, { radialSegments: 6 });+ createPart('InteriorFrond_' + j, jFrondGeo, palmGreen, { parent: interiorGroup });+ createPart('InteriorFrondLeaf_' + j, boxGeo(0.7, 0.04, 1.6), lightGreen, {+ position: [intHead[0] + 1.8 * Math.cos(jAng), intHead[1] + 0.35, intHead[2] + 1.8 * Math.sin(jAng)],+ rotation: [12 * Math.sin(jAng), (-jAng * 180) / Math.PI, 20],+ parent: interiorGroup+ });+ }++ // Understory Exotic Flora (Monsteras & Ferns) in Central Planter+ for (let u = 0; u < 6; u++) {+ const uAng = (u * Math.PI * 2) / 6;+ createPart('InteriorFern_' + u, sphereGeo(0.45, 6, 6), deepGreen, {+ position: [1.1 * Math.cos(uAng), 0.7, 1.1 * Math.sin(uAng)],+ scale: [1.2, 0.8, 1.2],+ parent: interiorGroup+ });+ createPart('InteriorOrchid_' + u, sphereGeo(0.18, 5, 5), (u % 2 === 0 ? flowerPink : flowerGold), {+ position: [1.1 * Math.cos(uAng), 0.95, 1.1 * Math.sin(uAng)],+ parent: interiorGroup+ });+ }++ return root;+}diff --git a/site/examples/history/demo-battleship/history.json b/site/examples/history/demo-battleship/history.jsonnew file mode 100644index 00000000..4303504a--- /dev/null+++ b/site/examples/history/demo-battleship/history.json@@ -0,0 +1,22 @@+{+ "version": 1,+ "brief": {+ "kind": "recorded",+ "text": "Turret roofs painted dark red."+ },+ "currentSourceHash": "6e1c9d1a85198c5e0f445e02caf4d46c01397c1ae61a66b8c72adcd64ead51c9",+ "revisions": [+ {+ "file": "revision-1.kiln.js",+ "title": "Saved revision 1",+ "description": "Detailed naval battleship featuring three heavy triple gun turrets in a 2-forward 1-aft superfiring configuration, rich teak wooden deck, multi-tiered armored bridge tower, raked smokestacks, secondary 5-inch twin batteries, AA gun tubs, and a stern aircraft catapult with reconnaissance floatplane.",+ "sourceHash": "a4da647790cc17b8cfbfc183dfd41d5d5657391f41d78c73bf6a3078e942cc3a"+ },+ {+ "file": "revision-2.kiln.js",+ "title": "Saved revision 2",+ "description": "Turret roofs painted dark red.",+ "sourceHash": "6e1c9d1a85198c5e0f445e02caf4d46c01397c1ae61a66b8c72adcd64ead51c9"+ }+ ]+}diff --git a/site/examples/history/demo-battleship/revision-1.kiln.js b/site/examples/history/demo-battleship/revision-1.kiln.jsnew file mode 100644index 00000000..4cc8f56c--- /dev/null+++ b/site/examples/history/demo-battleship/revision-1.kiln.js@@ -0,0 +1,986 @@+// Kiln Battleship: Detailed battleship with triple gun turrets and a wooden deck+const meta = {+ name: 'Battleship',+ category: 'vehicle',+ role: 'vehicle'+};++/**+ * Procedural Battleship Model+ * Dimensions: ~160m LOA, 24m Beam, 40m Masthead Height+ * Orientation: +X Forward (Bow), +Y Up, +Z Right (Starboard)+ */+async function build() {+ const root = createRoot('Battleship');++ // --- Materials ---+ const mats = {+ steelHull: gameMaterial(0x6c7986, { roughness: 0.65, metalness: 0.3 }),+ steelSuper: gameMaterial(0x82919e, { roughness: 0.55, metalness: 0.25 }),+ steelArmor: gameMaterial(0x56626d, { roughness: 0.6, metalness: 0.35 }),+ darkSteel: gameMaterial(0x2a2e33, { roughness: 0.45, metalness: 0.65 }),+ blackMetal: gameMaterial(0x16181a, { roughness: 0.8, metalness: 0.3 }),+ redHull: gameMaterial(0x862c24, { roughness: 0.72, metalness: 0.15 }),+ waterlineBoot: gameMaterial(0x1a1c1e, { roughness: 0.85, metalness: 0.2 }),+ woodDeck: gameMaterial(0xc49c6d, { roughness: 0.88, metalness: 0.04 }),+ woodMargin: gameMaterial(0x9e7344, { roughness: 0.9, metalness: 0.04 }),+ canvasBag: gameMaterial(0xded7c8, { roughness: 0.95, metalness: 0.02 }),+ glass: gameMaterial(0x2b4557, { roughness: 0.12, metalness: 0.85 }),+ brass: gameMaterial(0xd4af37, { roughness: 0.32, metalness: 0.85 }),+ bronzeProp: gameMaterial(0xb07d42, { roughness: 0.35, metalness: 0.8 }),+ white: gameMaterial(0xe8ebed, { roughness: 0.5, metalness: 0.1 }),+ navyBlue: gameMaterial(0x2a3e50, { roughness: 0.45, metalness: 0.25 }),+ ensignRed: gameMaterial(0xb82626, { roughness: 0.7, metalness: 0.1 }),+ ensignWhite: gameMaterial(0xf0f0f0, { roughness: 0.7, metalness: 0.1 }),+ ensignBlue: gameMaterial(0x1e305e, { roughness: 0.7, metalness: 0.1 }),+ };++ // --- Hull Stations Profile ---+ const xStations = [+ -72, -70, -67, -63, -58, -52, -45, -38, -30, -22, -14, -6,+ 0, 6, 14, 22, 30, 38, 45, 52, 58, 64, 70, 75, 79, 83, 86, 88+ ];++ function getHullProfile(x) {+ let yd = 8.6;+ if (x < -38) {+ const t = (x - (-72)) / 34;+ yd = 8.0 + 0.6 * Math.sin(t * Math.PI / 2);+ } else if (x > 30) {+ const t = (x - 30) / 58;+ yd = 8.6 + 3.6 * Math.pow(t, 1.7);+ }++ let wd = 12.0;+ if (x < -30) {+ const t = (x - (-72)) / 42;+ wd = 0.6 + 11.4 * (3 * t * t - 2 * t * t * t);+ } else if (x > 30) {+ const t = (88 - x) / 58;+ wd = 0.25 + 11.75 * Math.pow(t, 1.35);+ }++ let wb = wd;+ if (x >= -35 && x <= 25) {+ wb = 12.4;+ } else if (x < -35) {+ const t = (x - (-72)) / 37;+ wb = Math.max(0.4, 0.5 + 11.9 * Math.pow(t, 1.2));+ } else if (x > 25) {+ const t = (88 - x) / 63;+ wb = Math.max(0.2, 0.2 + 12.2 * Math.pow(t, 1.5));+ }++ let yk = 0.5;+ if (x < -48) {+ const t = (x - (-48)) / (-24);+ yk = 0.5 + 4.2 * (t * t);+ } else if (x > 70) {+ const t = (x - 70) / 18;+ yk = 0.5 + 1.2 * (t * t);+ }++ return { yd, wd, wb, yk };+ }++ // --- 1. Lower Hull (Red Anti-Fouling Paint) ---+ {+ const positions = [];+ const indices = [];+ const numPts = 7;++ for (let i = 0; i < xStations.length; i++) {+ const x = xStations[i];+ const { yk, wb } = getHullProfile(x);+ positions.push(+ x, 4.0, -wb,+ x, yk + (4.0 - yk) * 0.7, -wb * 0.94,+ x, yk + (4.0 - yk) * 0.28, -wb * 0.65,+ x, yk, 0,+ x, yk + (4.0 - yk) * 0.28, wb * 0.65,+ x, yk + (4.0 - yk) * 0.7, wb * 0.94,+ x, 4.0, wb+ );+ }++ for (let i = 0; i < xStations.length - 1; i++) {+ const rowA = i * numPts;+ const rowB = (i + 1) * numPts;+ for (let p = 0; p < numPts - 1; p++) {+ const a0 = rowA + p;+ const a1 = rowA + p + 1;+ const b0 = rowB + p;+ const b1 = rowB + p + 1;+ indices.push(a0, b0, b1, a0, b1, a1);+ }+ }++ // Caps+ const s0 = 0;+ indices.push(s0, s0 + 1, s0 + 3, s0 + 1, s0 + 2, s0 + 3, s0 + 3, s0 + 4, s0 + 5, s0 + 3, s0 + 5, s0 + 6);+ const bEnd = (xStations.length - 1) * numPts;+ indices.push(bEnd + 3, bEnd + 1, bEnd, bEnd + 3, bEnd + 2, bEnd + 1, bEnd + 5, bEnd + 4, bEnd + 3, bEnd + 6, bEnd + 5, bEnd + 3);++ createPart('LowerHull', meshGeo({ positions, indices }), mats.redHull, { parent: root });+ }++ // --- 2. Waterline Boot-Topping Stripe (Dark Charcoal) ---+ {+ const positions = [];+ const indices = [];+ const numPts = 4;++ for (let i = 0; i < xStations.length; i++) {+ const x = xStations[i];+ const { wb } = getHullProfile(x);+ positions.push(+ x, 3.8, -wb * 0.99,+ x, 4.3, -wb,+ x, 3.8, wb * 0.99,+ x, 4.3, wb+ );+ }++ for (let i = 0; i < xStations.length - 1; i++) {+ const rowA = i * numPts;+ const rowB = (i + 1) * numPts;+ // Port:+ indices.push(rowA, rowA + 1, rowB + 1, rowA, rowB + 1, rowB);+ // Starboard:+ indices.push(rowA + 2, rowB + 2, rowB + 3, rowA + 2, rowB + 3, rowA + 3);+ }++ createPart('WaterlineStripe', meshGeo({ positions, indices }), mats.waterlineBoot, { parent: root });+ }++ // --- 3. Upper Hull (Naval Haze Gray) ---+ {+ const positions = [];+ const indices = [];+ const numPts = 8;++ for (let i = 0; i < xStations.length; i++) {+ const x = xStations[i];+ const { yd, wd, wb } = getHullProfile(x);+ const bulwarkH = x > 30 ? 1.1 : 0.8;+ positions.push(+ x, 4.3, -wb,+ x, 4.3 + (yd - 4.3) * 0.5, -(wb * 0.45 + wd * 0.55),+ x, yd, -wd,+ x, yd + bulwarkH, -wd,+ x, 4.3, wb,+ x, 4.3 + (yd - 4.3) * 0.5, (wb * 0.45 + wd * 0.55),+ x, yd, wd,+ x, yd + bulwarkH, wd+ );+ }++ for (let i = 0; i < xStations.length - 1; i++) {+ const rowA = i * numPts;+ const rowB = (i + 1) * numPts;+ for (let p = 0; p < 3; p++) {+ const a0 = rowA + p;+ const a1 = rowA + p + 1;+ const b0 = rowB + p;+ const b1 = rowB + p + 1;+ indices.push(a0, a1, b1, a0, b1, b0);+ }+ for (let p = 4; p < 7; p++) {+ const a0 = rowA + p;+ const a1 = rowA + p + 1;+ const b0 = rowB + p;+ const b1 = rowB + p + 1;+ indices.push(a0, b0, b1, a0, b1, a1);+ }+ }++ // Stern transom closure+ indices.push(+ 0, 4, 5, 0, 5, 1,+ 1, 5, 6, 1, 6, 2,+ 2, 6, 7, 2, 7, 3+ );++ createPart('UpperHull', meshGeo({ positions, indices }), mats.steelHull, { parent: root });+ }++ // --- 4. Main Wooden Deck (Teak Planking) ---+ {+ const positions = [];+ const indices = [];+ const zFracs = [-1.0, -0.75, -0.5, -0.25, 0.0, 0.25, 0.5, 0.75, 1.0];+ const numCols = zFracs.length;++ for (let i = 0; i < xStations.length; i++) {+ const x = xStations[i];+ const { yd, wd } = getHullProfile(x);+ for (let j = 0; j < numCols; j++) {+ const f = zFracs[j];+ const z = f * wd;+ const camber = 0.22 * (1.0 - f * f);+ positions.push(x, yd + camber, z);+ }+ }++ for (let i = 0; i < xStations.length - 1; i++) {+ const rowA = i * numCols;+ const rowB = (i + 1) * numCols;+ for (let j = 0; j < numCols - 1; j++) {+ const a0 = rowA + j;+ const a1 = rowA + j + 1;+ const b0 = rowB + j;+ const b1 = rowB + j + 1;+ indices.push(a0, a1, b1, a0, b1, b0);+ }+ }++ createPart('WoodenDeck', meshGeo({ positions, indices }), mats.woodDeck, { parent: root });+ }++ // --- 5. Main Armor Belt (Citadel Bulge) ---+ {+ createPart('ArmorBeltPort', boxGeo(72, 3.2, 0.4), mats.steelArmor, {+ position: [-2, 5.8, -12.35],+ parent: root+ });+ createPart('ArmorBeltStbd', boxGeo(72, 3.2, 0.4), mats.steelArmor, {+ position: [-2, 5.8, 12.35],+ parent: root+ });+ }++ // --- 6. Triple Gun Turret Generator ---+ function buildTripleTurret(name, cfg, parent) {+ const { x, yDeck, barbetteHeight, turretElevation, facingAngle } = cfg;+ const turretPivot = createPivot(name, [x, yDeck, 0], parent);++ // 1. Cylindrical Armored Barbette+ const barbetteRadius = 5.3;+ createPart(`${name}_Barbette`, cylinderGeo(barbetteRadius, barbetteRadius, barbetteHeight, 32), mats.steelArmor, {+ position: [0, barbetteHeight / 2, 0],+ parent: turretPivot+ });++ createPart(`${name}_BarbetteRing`, cylinderGeo(barbetteRadius + 0.35, barbetteRadius + 0.35, 0.2, 32), mats.steelSuper, {+ position: [0, 0.1, 0],+ parent: turretPivot+ });++ // 2. Rotating Turret Assembly+ const gunhousePivot = createPivot(`${name}_Gunhouse`, [0, barbetteHeight, 0], turretPivot);+ gunhousePivot.rotation.y = (facingAngle * Math.PI) / 180;++ createPart(`${name}_GunhouseBase`, boxGeo(11.2, 1.8, 8.8), mats.steelSuper, {+ position: [0.6, 0.9, 0],+ parent: gunhousePivot+ });++ createPart(`${name}_SlopedFrontArmor`, boxGeo(5.2, 1.8, 8.4), mats.steelSuper, {+ position: [3.8, 2.35, 0],+ rotation: [0, 0, -38],+ parent: gunhousePivot+ });++ createPart(`${name}_GunhouseRoof`, boxGeo(7.8, 1.2, 8.4), mats.steelSuper, {+ position: [-1.2, 2.65, 0],+ parent: gunhousePivot+ });++ createPart(`${name}_RearOverhang`, boxGeo(3.2, 1.4, 8.2), mats.steelArmor, {+ position: [-4.6, 1.6, 0],+ parent: gunhousePivot+ });++ createPart(`${name}_RangefinderBeam`, cylinderGeo(0.32, 0.32, 11.2, 16), mats.steelSuper, {+ position: [-3.8, 2.7, 0],+ rotation: [90, 0, 0],+ parent: gunhousePivot+ });+ createPart(`${name}_RangefinderEarPort`, boxGeo(0.9, 0.7, 0.8), mats.darkSteel, {+ position: [-3.8, 2.7, -5.6],+ parent: gunhousePivot+ });+ createPart(`${name}_RangefinderEarStbd`, boxGeo(0.9, 0.7, 0.8), mats.darkSteel, {+ position: [-3.8, 2.7, 5.6],+ parent: gunhousePivot+ });++ createPart(`${name}_PeriscopePort`, cylinderGeo(0.2, 0.2, 0.6, 12), mats.brass, {+ position: [-1.0, 3.4, -2.0],+ parent: gunhousePivot+ });+ createPart(`${name}_PeriscopeStbd`, cylinderGeo(0.2, 0.2, 0.6, 12), mats.brass, {+ position: [-1.0, 3.4, 2.0],+ parent: gunhousePivot+ });+ createPart(`${name}_VentCowl`, cylinderGeo(0.35, 0.25, 0.35, 12), mats.darkSteel, {+ position: [-2.6, 3.35, 0],+ parent: gunhousePivot+ });++ // 3. Three 16-inch Gun Barrels+ const barrelZ = [-2.4, 0.0, 2.4];+ const elevRad = (turretElevation * Math.PI) / 180;++ for (let b = 0; b < barrelZ.length; b++) {+ const bz = barrelZ[b];+ const gunMount = createPivot(`${name}_GunMount_${b}`, [4.2, 1.6, bz], gunhousePivot);+ gunMount.rotation.z = elevRad;++ createPart(`${name}_BlastBag_${b}`, cylinderXGeo(0.72, 0.82, 1.8, 16), mats.canvasBag, {+ position: [0.8, 0, 0],+ parent: gunMount+ });++ createPart(`${name}_SlideSleeve_${b}`, cylinderXGeo(0.52, 0.56, 4.4, 16), mats.steelSuper, {+ position: [3.4, 0, 0],+ parent: gunMount+ });++ createPart(`${name}_BarrelTube_${b}`, cylinderXGeo(0.34, 0.50, 11.5, 16), mats.darkSteel, {+ position: [11.2, 0, 0],+ parent: gunMount+ });++ createPart(`${name}_MuzzleRing_${b}`, cylinderXGeo(0.38, 0.38, 0.6, 16), mats.darkSteel, {+ position: [17.1, 0, 0],+ parent: gunMount+ });++ createPart(`${name}_MuzzleBore_${b}`, cylinderXGeo(0.22, 0.22, 0.25, 12), mats.blackMetal, {+ position: [17.3, 0, 0],+ parent: gunMount+ });+ }++ if (cfg.hasRoofAA) {+ createPart(`${name}_RoofAATub`, cylinderGeo(1.8, 1.8, 0.8, 16), mats.steelSuper, {+ position: [-0.6, 3.65, 0],+ parent: gunhousePivot+ });+ createPart(`${name}_RoofAAGuns`, boxGeo(2.4, 0.4, 0.9), mats.darkSteel, {+ position: [0.3, 3.8, 0],+ parent: gunhousePivot+ });+ }++ return turretPivot;+ }++ // --- 7. Main Armament: Triple Gun Turrets 1, 2, 3 ---+ buildTripleTurret('Turret_1', {+ x: 48,+ yDeck: 9.35,+ barbetteHeight: 0.9,+ turretElevation: 5,+ facingAngle: 0,+ hasRoofAA: false+ }, root);++ buildTripleTurret('Turret_2', {+ x: 31,+ yDeck: 8.75,+ barbetteHeight: 4.8,+ turretElevation: 7,+ facingAngle: 0,+ hasRoofAA: true+ }, root);++ buildTripleTurret('Turret_3', {+ x: -38,+ yDeck: 8.25,+ barbetteHeight: 1.1,+ turretElevation: 6,+ facingAngle: 180,+ hasRoofAA: true+ }, root);++ // --- 8. Forecastle Equipment & Details ---+ {+ createPart('BreakwaterPort', boxGeo(8.5, 1.2, 0.18), mats.steelSuper, {+ position: [59.0, 10.6, -3.4],+ rotation: [0, 36, 12],+ parent: root+ });+ createPart('BreakwaterStbd', boxGeo(8.5, 1.2, 0.18), mats.steelSuper, {+ position: [59.0, 10.6, 3.4],+ rotation: [0, -36, 12],+ parent: root+ });++ createPart('HawsePipePort', cylinderGeo(0.65, 0.65, 1.2, 12), mats.darkSteel, {+ position: [81.5, 11.2, -1.8],+ rotation: [45, 0, 30],+ parent: root+ });+ createPart('AnchorPortFluke', boxGeo(1.6, 1.4, 0.3), mats.darkSteel, {+ position: [81.2, 10.8, -1.9],+ rotation: [0, 15, 35],+ parent: root+ });+ createPart('HawsePipeStbd', cylinderGeo(0.65, 0.65, 1.2, 12), mats.darkSteel, {+ position: [81.5, 11.2, 1.8],+ rotation: [-45, 0, 30],+ parent: root+ });+ createPart('AnchorStbdFluke', boxGeo(1.6, 1.4, 0.3), mats.darkSteel, {+ position: [81.2, 10.8, 1.9],+ rotation: [0, -15, 35],+ parent: root+ });++ createPart('CapstanPort', cylinderGeo(0.85, 0.95, 1.4, 16), mats.darkSteel, {+ position: [74.0, 11.8, -2.0],+ parent: root+ });+ createPart('CapstanStbd', cylinderGeo(0.85, 0.95, 1.4, 16), mats.darkSteel, {+ position: [74.0, 11.8, 2.0],+ parent: root+ });+ createPart('CapstanHeadPort', cylinderGeo(0.5, 0.5, 0.25, 16), mats.brass, {+ position: [74.0, 12.55, -2.0],+ parent: root+ });+ createPart('CapstanHeadStbd', cylinderGeo(0.5, 0.5, 0.25, 16), mats.brass, {+ position: [74.0, 12.55, 2.0],+ parent: root+ });++ createPart('ChainPort', boxGeo(8.0, 0.16, 0.28), mats.darkSteel, {+ position: [77.5, 11.6, -1.9],+ rotation: [0, 2, 0],+ parent: root+ });+ createPart('ChainStbd', boxGeo(8.0, 0.16, 0.28), mats.darkSteel, {+ position: [77.5, 11.6, 1.9],+ rotation: [0, -2, 0],+ parent: root+ });++ createPart('Jackstaff', cylinderGeo(0.06, 0.12, 6.5, 8), mats.steelSuper, {+ position: [87.5, 15.5, 0],+ parent: root+ });+ }++ // --- 9. Superstructure & Bridge Tower ---+ {+ const superGroup = createPivot('Superstructure', [0, 0, 0], root);++ createPart('DeckhouseTier1', boxGeo(45, 3.8, 14.0), mats.steelSuper, {+ position: [-1.0, 10.6, 0],+ parent: superGroup+ });+ createPart('DeckhouseFwdRound', cylinderGeo(7.0, 7.0, 3.8, 24), mats.steelSuper, {+ position: [21.5, 10.6, 0],+ parent: superGroup+ });++ createPart('DeckhouseTier2', boxGeo(38, 3.2, 11.6), mats.steelSuper, {+ position: [-1.5, 14.1, 0],+ parent: superGroup+ });++ createPart('ConningTower', cylinderGeo(3.6, 3.9, 3.2, 24), mats.steelArmor, {+ position: [15.5, 17.2, 0],+ parent: superGroup+ });+ createPart('ConningSlits', cylinderGeo(3.7, 3.7, 0.35, 24), mats.blackMetal, {+ position: [15.5, 17.5, 0],+ parent: superGroup+ });++ createPart('NavBridgeHouse', boxGeo(6.8, 2.8, 8.2), mats.steelSuper, {+ position: [14.0, 20.1, 0],+ parent: superGroup+ });+ createPart('BridgeWindowsFwd', boxGeo(0.2, 1.1, 7.6), mats.glass, {+ position: [17.45, 20.3, 0],+ parent: superGroup+ });+ createPart('BridgeWindowsPort', boxGeo(4.2, 1.1, 0.2), mats.glass, {+ position: [15.2, 20.3, -4.15],+ parent: superGroup+ });+ createPart('BridgeWindowsStbd', boxGeo(4.2, 1.1, 0.2), mats.glass, {+ position: [15.2, 20.3, 4.15],+ parent: superGroup+ });++ createPart('BridgeWingPort', boxGeo(3.2, 2.2, 5.0), mats.steelSuper, {+ position: [14.0, 19.8, -6.6],+ parent: superGroup+ });+ createPart('BridgeWingStbd', boxGeo(3.2, 2.2, 5.0), mats.steelSuper, {+ position: [14.0, 19.8, 6.6],+ parent: superGroup+ });+ createPart('PelorusPort', cylinderGeo(0.18, 0.18, 1.0, 12), mats.brass, {+ position: [14.5, 21.4, -8.6],+ parent: superGroup+ });+ createPart('PelorusStbd', cylinderGeo(0.18, 0.18, 1.0, 12), mats.brass, {+ position: [14.5, 21.4, 8.6],+ parent: superGroup+ });++ createPart('CommandPlatform', boxGeo(5.2, 0.8, 6.4), mats.steelSuper, {+ position: [13.2, 21.8, 0],+ parent: superGroup+ });+ createPart('WindscreenRim', boxGeo(5.4, 0.9, 6.6), mats.brass, {+ position: [13.2, 22.5, 0],+ parent: superGroup+ });++ createPart('DirectorTowerPedestal', cylinderGeo(2.4, 2.8, 4.8, 16), mats.steelSuper, {+ position: [11.0, 24.6, 0],+ parent: superGroup+ });+ const fwdDirector = createPivot('Mk38DirectorFwd', [11.0, 26.9, 0], superGroup);+ createPart('DirectorHouse', boxGeo(3.2, 2.0, 3.4), mats.steelArmor, {+ position: [0, 1.0, 0],+ parent: fwdDirector+ });+ createPart('DirectorArm', cylinderGeo(0.35, 0.35, 9.2, 16), mats.steelSuper, {+ position: [0, 1.1, 0],+ rotation: [90, 0, 0],+ parent: fwdDirector+ });+ createPart('DirectorHoodPort', boxGeo(0.8, 0.7, 0.8), mats.darkSteel, {+ position: [0, 1.1, -4.6],+ parent: fwdDirector+ });+ createPart('DirectorHoodStbd', boxGeo(0.8, 0.7, 0.8), mats.darkSteel, {+ position: [0, 1.1, 4.6],+ parent: fwdDirector+ });+ createPart('RadarBracket', cylinderGeo(0.16, 0.16, 0.4, 8), mats.darkSteel, {+ position: [0.2, 2.0, 0],+ parent: fwdDirector+ });+ createPart('RadarMk8Mesh', boxGeo(1.8, 0.9, 3.2), mats.darkSteel, {+ position: [0.2, 2.35, 0],+ parent: fwdDirector+ });++ createPart('ForemastTrunk', cylinderGeo(0.35, 0.65, 14.0, 12), mats.steelSuper, {+ position: [8.5, 33.5, 0],+ parent: superGroup+ });+ createPart('TripodLegPort', cylinderGeo(0.22, 0.35, 11.5, 8), mats.steelSuper, {+ position: [6.8, 30.5, -2.4],+ rotation: [16, 0, 12],+ parent: superGroup+ });+ createPart('TripodLegStbd', cylinderGeo(0.22, 0.35, 11.5, 8), mats.steelSuper, {+ position: [6.8, 30.5, 2.4],+ rotation: [-16, 0, 12],+ parent: superGroup+ });+ createPart('LowerYardarm', cylinderGeo(0.12, 0.12, 13.5, 8), mats.steelSuper, {+ position: [8.5, 33.0, 0],+ rotation: [90, 0, 0],+ parent: superGroup+ });+ createPart('UpperYardarm', cylinderGeo(0.08, 0.08, 8.5, 8), mats.steelSuper, {+ position: [8.5, 36.8, 0],+ rotation: [90, 0, 0],+ parent: superGroup+ });+ createPart('SGRadarPlatform', cylinderGeo(1.2, 1.2, 0.2, 12), mats.steelSuper, {+ position: [8.5, 35.0, 0],+ parent: superGroup+ });+ createPart('SGRadarDish', cylinderGeo(0.6, 0.6, 0.3, 12), mats.darkSteel, {+ position: [8.5, 35.4, 0],+ rotation: [0, 30, 90],+ parent: superGroup+ });+ createPart('SCRadarAntenna', boxGeo(1.6, 2.4, 2.4), mats.darkSteel, {+ position: [8.5, 41.2, 0],+ parent: superGroup+ });+ }++ // --- 10. Smokestacks / Funnels & Machinery Casings ---+ {+ const f1Group = createPivot('Funnel_1', [4.5, 15.6, 0], root);+ f1Group.rotation.z = (-5 * Math.PI) / 180;++ createPart('Funnel1Body', cylinderGeo(2.4, 2.8, 7.8, 24), mats.steelSuper, {+ position: [0, 3.9, 0],+ scale: [1.35, 1.0, 0.85],+ parent: f1Group+ });+ createPart('Funnel1Cap', cylinderGeo(2.45, 2.45, 1.2, 24), mats.blackMetal, {+ position: [0, 7.8, 0],+ scale: [1.35, 1.0, 0.85],+ parent: f1Group+ });+ createPart('SteamPipe1', cylinderGeo(0.18, 0.18, 7.5, 8), mats.brass, {+ position: [3.3, 3.8, 0],+ parent: f1Group+ });++ const f2Group = createPivot('Funnel_2', [-7.5, 15.6, 0], root);+ f2Group.rotation.z = (-5 * Math.PI) / 180;++ createPart('Funnel2Body', cylinderGeo(2.3, 2.7, 7.4, 24), mats.steelSuper, {+ position: [0, 3.7, 0],+ scale: [1.35, 1.0, 0.85],+ parent: f2Group+ });+ createPart('Funnel2Cap', cylinderGeo(2.35, 2.35, 1.2, 24), mats.blackMetal, {+ position: [0, 7.4, 0],+ scale: [1.35, 1.0, 0.85],+ parent: f2Group+ });+ createPart('SteamPipe2', cylinderGeo(0.18, 0.18, 7.2, 8), mats.brass, {+ position: [3.2, 3.6, 0],+ parent: f2Group+ });++ createPart('SearchlightDeck', boxGeo(5.0, 0.8, 10.5), mats.steelSuper, {+ position: [-1.5, 17.2, 0],+ parent: root+ });+ const sPositions = [+ [-1.5, 17.6, -4.2],+ [-1.5, 17.6, 4.2],+ [-1.5, 17.6, -1.8],+ [-1.5, 17.6, 1.8]+ ];+ for (let s = 0; s < sPositions.length; s++) {+ const [sx, sy, sz] = sPositions[s];+ const sPivot = createPivot(`Searchlight_${s}`, [sx, sy, sz], root);+ createPart(`SearchlightPedestal_${s}`, cylinderGeo(0.2, 0.25, 0.7, 12), mats.steelSuper, {+ position: [0, 0.35, 0],+ parent: sPivot+ });+ createPart(`SearchlightDrum_${s}`, cylinderXGeo(0.6, 0.6, 0.8, 16), mats.brass, {+ position: [0, 0.85, 0],+ parent: sPivot+ });+ createPart(`SearchlightLens_${s}`, cylinderXGeo(0.52, 0.52, 0.15, 16), mats.glass, {+ position: [0.38, 0.85, 0],+ parent: sPivot+ });+ }++ const boatPositions = [+ [-1.5, 15.7, -6.8],+ [-1.5, 15.7, 6.8]+ ];+ for (let b = 0; b < boatPositions.length; b++) {+ const [bx, by, bz] = boatPositions[b];+ const boat = createPivot(`MotorLaunch_${b}`, [bx, by, bz], root);+ createPart(`LaunchHull_${b}`, boxGeo(9.5, 1.4, 2.8), mats.white, {+ position: [0, 0.7, 0],+ parent: boat+ });+ createPart(`LaunchCabin_${b}`, boxGeo(4.2, 1.1, 2.0), mats.woodMargin, {+ position: [-0.6, 1.7, 0],+ parent: boat+ });+ createPart(`LaunchChockFwd_${b}`, boxGeo(0.4, 0.5, 3.2), mats.steelSuper, {+ position: [2.5, 0.25, 0],+ parent: boat+ });+ createPart(`LaunchChockAft_${b}`, boxGeo(0.4, 0.5, 3.2), mats.steelSuper, {+ position: [-2.5, 0.25, 0],+ parent: boat+ });+ }++ const cranePivot = createPivot('MidshipsCrane', [-13.0, 15.6, 0], root);+ createPart('CranePillar', cylinderGeo(0.7, 0.85, 5.0, 16), mats.steelSuper, {+ position: [0, 2.5, 0],+ parent: cranePivot+ });+ createPart('MidshipsCraneBoom', boxGeo(11.0, 0.5, 0.6), mats.steelSuper, {+ position: [-4.5, 4.9, 0],+ rotation: [0, 0, 18],+ parent: cranePivot+ });+ }++ // --- 11. Secondary Battery: Twin 5-inch/38-Caliber Turrets ---+ {+ const secPositions = [+ { x: 10.0, z: 8.4, facing: 45 },+ { x: -1.5, z: 8.6, facing: 90 },+ { x: -13.0, z: 8.4, facing: 135 },+ { x: 10.0, z: -8.4, facing: -45 },+ { x: -1.5, z: -8.6, facing: -90 },+ { x: -13.0, z: -8.4, facing: -135 },+ ];++ for (let i = 0; i < secPositions.length; i++) {+ const { x, z, facing } = secPositions[i];+ const secPivot = createPivot(`SecTurret_${i}`, [x, 12.5, z], root);+ secPivot.rotation.y = (facing * Math.PI) / 180;++ createPart(`SecMountRing_${i}`, cylinderGeo(1.8, 1.8, 0.4, 16), mats.steelArmor, {+ position: [0, 0.2, 0],+ parent: secPivot+ });+ createPart(`SecGunhouse_${i}`, boxGeo(3.2, 1.8, 2.8), mats.steelSuper, {+ position: [0, 1.2, 0],+ parent: secPivot+ });+ createPart(`SecBarrelL_${i}`, cylinderXGeo(0.14, 0.18, 4.4, 12), mats.darkSteel, {+ position: [2.8, 1.3, -0.55],+ parent: secPivot+ });+ createPart(`SecBarrelR_${i}`, cylinderXGeo(0.14, 0.18, 4.4, 12), mats.darkSteel, {+ position: [2.8, 1.3, 0.55],+ parent: secPivot+ });+ }+ }++ // --- 12. Anti-Aircraft Batteries (40mm Bofors Quad Mounts) ---+ {+ const aaPositions = [+ { x: 23.0, y: 12.4, z: 7.2 },+ { x: 23.0, y: 12.4, z: -7.2 },+ { x: 4.5, y: 15.6, z: 7.5 },+ { x: 4.5, y: 15.6, z: -7.5 },+ { x: -20.0, y: 12.4, z: 5.6 },+ { x: -20.0, y: 12.4, z: -5.6 },+ ];++ for (let i = 0; i < aaPositions.length; i++) {+ const { x, y, z } = aaPositions[i];+ const aaTub = createPivot(`BoforsTub_${i}`, [x, y, z], root);+ createPart(`BoforsTubWall_${i}`, cylinderGeo(1.9, 1.9, 1.1, 16), mats.steelSuper, {+ position: [0, 0.55, 0],+ parent: aaTub+ });+ createPart(`BoforsCarriage_${i}`, boxGeo(1.2, 0.8, 1.1), mats.darkSteel, {+ position: [0, 0.9, 0],+ parent: aaTub+ });+ createPart(`BoforsBarrels_${i}`, boxGeo(2.6, 0.35, 0.8), mats.darkSteel, {+ position: [0.6, 1.2, 0],+ rotation: [0, 0, 15],+ parent: aaTub+ });+ }+ }++ // --- 13. Aft Superstructure, Mainmast & Secondary Director ---+ {+ const aftGroup = createPivot('AftSuperstructure', [-20.0, 12.4, 0], root);++ createPart('AftDeckhouse', boxGeo(8.5, 2.8, 7.8), mats.steelSuper, {+ position: [0, 1.4, 0],+ parent: aftGroup+ });++ const aftDir = createPivot('Mk38DirectorAft', [1.5, 2.8, 0], aftGroup);+ createPart('AftDirHouse', boxGeo(2.8, 1.8, 3.0), mats.steelArmor, {+ position: [0, 1.0, 0],+ parent: aftDir+ });+ createPart('AftDirArm', cylinderGeo(0.32, 0.32, 8.4, 16), mats.steelSuper, {+ position: [0, 1.1, 0],+ rotation: [90, 0, 0],+ parent: aftDir+ });++ createPart('MainmastTrunk', cylinderGeo(0.3, 0.5, 14.0, 12), mats.steelSuper, {+ position: [-2.8, 9.8, 0],+ parent: aftGroup+ });+ createPart('MainmastYardarm', cylinderGeo(0.09, 0.09, 9.5, 8), mats.steelSuper, {+ position: [-2.8, 13.2, 0],+ rotation: [90, 0, 0],+ parent: aftGroup+ });+ createPart('EnsignGaff', cylinderGeo(0.06, 0.08, 4.2, 8), mats.steelSuper, {+ position: [-4.2, 14.5, 0],+ rotation: [0, 0, -42],+ parent: aftGroup+ });+ }++ // --- 14. Fantail / Quarterdeck Equipment & Reconnaissance Floatplane ---+ {+ const catPivot = createPivot('AircraftCatapult', [-63.5, 8.1, 0], root);+ catPivot.rotation.y = (-50 * Math.PI) / 180;++ createPart('CatapultTurntable', cylinderGeo(1.8, 2.0, 0.8, 16), mats.steelArmor, {+ position: [0, 0.4, 0],+ parent: catPivot+ });+ createPart('LaunchRail', boxGeo(16.5, 0.8, 1.2), mats.steelSuper, {+ position: [3.5, 1.2, 0],+ parent: catPivot+ });++ const plane = createPivot('Floatplane', [2.5, 2.2, 0], catPivot);+ createPart('PlaneFuselage', boxGeo(6.8, 1.2, 1.2), mats.navyBlue, {+ position: [0, 0.6, 0],+ parent: plane+ });+ createPart('PlaneEngineCowl', cylinderXGeo(0.6, 0.6, 0.9, 16), mats.darkSteel, {+ position: [3.7, 0.6, 0],+ parent: plane+ });+ createPart('PlanePropeller', boxGeo(0.1, 1.8, 0.22), mats.blackMetal, {+ position: [4.2, 0.6, 0],+ parent: plane+ });+ createPart('PlaneCanopy', boxGeo(2.6, 0.6, 0.8), mats.glass, {+ position: [0.8, 1.35, 0],+ parent: plane+ });+ createPart('PlaneWings', boxGeo(1.6, 0.16, 10.5), mats.navyBlue, {+ position: [0.8, 0.65, 0],+ parent: plane+ });+ createPart('PlaneTailFin', boxGeo(1.1, 1.2, 0.12), mats.navyBlue, {+ position: [-3.0, 1.3, 0],+ parent: plane+ });+ createPart('PlaneTailPlane', boxGeo(0.9, 0.12, 3.2), mats.navyBlue, {+ position: [-3.0, 0.8, 0],+ parent: plane+ });+ createPart('MainFloat', boxGeo(6.2, 0.7, 1.0), mats.steelSuper, {+ position: [0.4, -0.65, 0],+ parent: plane+ });+ createPart('FloatStrutFwd', boxGeo(0.12, 0.8, 0.12), mats.darkSteel, {+ position: [1.8, -0.15, 0],+ parent: plane+ });+ createPart('FloatStrutAft', boxGeo(0.12, 0.8, 0.12), mats.darkSteel, {+ position: [-1.2, -0.15, 0],+ parent: plane+ });+ createPart('WingtipFloatL', boxGeo(1.2, 0.3, 0.35), mats.steelSuper, {+ position: [0.8, -0.2, -4.8],+ parent: plane+ });+ createPart('WingtipFloatR', boxGeo(1.2, 0.3, 0.35), mats.steelSuper, {+ position: [0.8, -0.2, 4.8],+ parent: plane+ });++ const sternCrane = createPivot('SternCrane', [-69.5, 8.0, 0], root);+ createPart('SternCraneBase', cylinderGeo(0.5, 0.65, 3.2, 12), mats.steelSuper, {+ position: [0, 1.6, 0],+ parent: sternCrane+ });+ createPart('SternCraneBoom', boxGeo(8.5, 0.35, 0.4), mats.steelSuper, {+ position: [2.5, 3.1, 0],+ rotation: [0, 0, -25],+ parent: sternCrane+ });++ const ensignStaff = createPivot('EnsignStaff', [-71.5, 8.0, 0], root);+ createPart('StaffPole', cylinderGeo(0.05, 0.09, 5.2, 8), mats.steelSuper, {+ position: [0, 2.6, 0],+ parent: ensignStaff+ });+ createPart('EnsignFlag', boxGeo(2.4, 1.4, 0.04), mats.ensignRed, {+ position: [-1.25, 4.2, 0.05],+ rotation: [0, 10, 0],+ parent: ensignStaff+ });++ const bollardX = [-48, -54, -60, -66];+ for (let b = 0; b < bollardX.length; b++) {+ const bx = bollardX[b];+ createPart(`BollardPort_${b}`, cylinderGeo(0.22, 0.22, 0.65, 8), mats.darkSteel, {+ position: [bx, 8.4, -9.5 + b * 1.5],+ parent: root+ });+ createPart(`BollardStbd_${b}`, cylinderGeo(0.22, 0.22, 0.65, 8), mats.darkSteel, {+ position: [bx, 8.4, 9.5 - b * 1.5],+ parent: root+ });+ }++ // Wooden Deck Companionways & Hatches+ createPart('FwdHatchCoaming', boxGeo(2.4, 0.45, 1.8), mats.woodMargin, {+ position: [67.0, 11.2, 0],+ parent: root+ });+ createPart('FwdHatchTop', boxGeo(2.2, 0.15, 1.6), mats.woodDeck, {+ position: [67.0, 11.45, 0],+ parent: root+ });+ createPart('FwdHatchBrass', boxGeo(0.2, 0.25, 1.2), mats.brass, {+ position: [67.0, 11.55, 0],+ parent: root+ });++ createPart('AftHatchCoaming', boxGeo(2.2, 0.4, 1.6), mats.woodMargin, {+ position: [-51.0, 8.35, 0],+ parent: root+ });+ createPart('AftHatchTop', boxGeo(2.0, 0.12, 1.4), mats.woodDeck, {+ position: [-51.0, 8.58, 0],+ parent: root+ });+ }++ // --- 15. Underwater Keel, Propellers & Rudders ---+ {+ createPart('BilgeKeelPort', boxGeo(48, 0.2, 1.1), mats.steelArmor, {+ position: [-2.0, 1.4, -11.6],+ rotation: [0, 0, 0],+ parent: root+ });+ createPart('BilgeKeelStbd', boxGeo(48, 0.2, 1.1), mats.steelArmor, {+ position: [-2.0, 1.4, 11.6],+ rotation: [0, 0, 0],+ parent: root+ });++ const shaftPositions = [+ { name: 'ShaftInPort', x: -54, y: 2.2, z: -2.8, rotZ: 3.5 },+ { name: 'ShaftInStbd', x: -54, y: 2.2, z: 2.8, rotZ: 3.5 },+ { name: 'ShaftOutPort', x: -51, y: 2.6, z: -5.6, rotZ: 5 },+ { name: 'ShaftOutStbd', x: -51, y: 2.6, z: 5.6, rotZ: 5 },+ ];++ for (let s = 0; s < shaftPositions.length; s++) {+ const { name, x, y, z, rotZ } = shaftPositions[s];+ createPart(name, cylinderXGeo(0.25, 0.25, 14.0, 12), mats.darkSteel, {+ position: [x, y, z],+ rotation: [0, 0, rotZ],+ parent: root+ });+ const screwX = x - 7.0;+ createPart(`${name}_Hub`, cylinderXGeo(0.55, 0.55, 1.2, 16), mats.bronzeProp, {+ position: [screwX, y - 0.35, z],+ parent: root+ });+ for (let blade = 0; blade < 3; blade++) {+ const bladePivot = createPivot(`${name}_Blade_${blade}`, [screwX, y - 0.35, z], root);+ bladePivot.rotation.x = (blade * 120 * Math.PI) / 180;+ createPart(`${name}_Blade_${blade}_Mesh`, boxGeo(0.12, 1.3, 0.42), mats.bronzeProp, {+ position: [0, 0.65, 0],+ rotation: [25, 0, 0],+ parent: bladePivot+ });+ }+ }++ createPart('RudderPort', boxGeo(4.2, 2.8, 0.35), mats.steelArmor, {+ position: [-65.0, 2.4, -2.6],+ parent: root+ });+ createPart('RudderStbd', boxGeo(4.2, 2.8, 0.35), mats.steelArmor, {+ position: [-65.0, 2.4, 2.6],+ parent: root+ });+ }++ return root;+}diff --git a/site/examples/history/demo-battleship/revision-2.kiln.js b/site/examples/history/demo-battleship/revision-2.kiln.jsnew file mode 100644index 00000000..831b05fb--- /dev/null+++ b/site/examples/history/demo-battleship/revision-2.kiln.js@@ -0,0 +1,987 @@+// Kiln Battleship: Detailed battleship with triple gun turrets and a wooden deck+const meta = {+ name: 'Battleship',+ category: 'vehicle',+ role: 'vehicle'+};++/**+ * Procedural Battleship Model+ * Dimensions: ~160m LOA, 24m Beam, 40m Masthead Height+ * Orientation: +X Forward (Bow), +Y Up, +Z Right (Starboard)+ */+async function build() {+ const root = createRoot('Battleship');++ // --- Materials ---+ const mats = {+ steelHull: gameMaterial(0x6c7986, { roughness: 0.65, metalness: 0.3 }),+ steelSuper: gameMaterial(0x82919e, { roughness: 0.55, metalness: 0.25 }),+ steelArmor: gameMaterial(0x56626d, { roughness: 0.6, metalness: 0.35 }),+ darkSteel: gameMaterial(0x2a2e33, { roughness: 0.45, metalness: 0.65 }),+ blackMetal: gameMaterial(0x16181a, { roughness: 0.8, metalness: 0.3 }),+ redHull: gameMaterial(0x862c24, { roughness: 0.72, metalness: 0.15 }),+ waterlineBoot: gameMaterial(0x1a1c1e, { roughness: 0.85, metalness: 0.2 }),+ woodDeck: gameMaterial(0xc49c6d, { roughness: 0.88, metalness: 0.04 }),+ woodMargin: gameMaterial(0x9e7344, { roughness: 0.9, metalness: 0.04 }),+ turretRoofRed: gameMaterial(0x8a1c1c, { roughness: 0.65, metalness: 0.25 }),+ canvasBag: gameMaterial(0xded7c8, { roughness: 0.95, metalness: 0.02 }),+ glass: gameMaterial(0x2b4557, { roughness: 0.12, metalness: 0.85 }),+ brass: gameMaterial(0xd4af37, { roughness: 0.32, metalness: 0.85 }),+ bronzeProp: gameMaterial(0xb07d42, { roughness: 0.35, metalness: 0.8 }),+ white: gameMaterial(0xe8ebed, { roughness: 0.5, metalness: 0.1 }),+ navyBlue: gameMaterial(0x2a3e50, { roughness: 0.45, metalness: 0.25 }),+ ensignRed: gameMaterial(0xb82626, { roughness: 0.7, metalness: 0.1 }),+ ensignWhite: gameMaterial(0xf0f0f0, { roughness: 0.7, metalness: 0.1 }),+ ensignBlue: gameMaterial(0x1e305e, { roughness: 0.7, metalness: 0.1 }),+ };++ // --- Hull Stations Profile ---+ const xStations = [+ -72, -70, -67, -63, -58, -52, -45, -38, -30, -22, -14, -6,+ 0, 6, 14, 22, 30, 38, 45, 52, 58, 64, 70, 75, 79, 83, 86, 88+ ];++ function getHullProfile(x) {+ let yd = 8.6;+ if (x < -38) {+ const t = (x - (-72)) / 34;+ yd = 8.0 + 0.6 * Math.sin(t * Math.PI / 2);+ } else if (x > 30) {+ const t = (x - 30) / 58;+ yd = 8.6 + 3.6 * Math.pow(t, 1.7);+ }++ let wd = 12.0;+ if (x < -30) {+ const t = (x - (-72)) / 42;+ wd = 0.6 + 11.4 * (3 * t * t - 2 * t * t * t);+ } else if (x > 30) {+ const t = (88 - x) / 58;+ wd = 0.25 + 11.75 * Math.pow(t, 1.35);+ }++ let wb = wd;+ if (x >= -35 && x <= 25) {+ wb = 12.4;+ } else if (x < -35) {+ const t = (x - (-72)) / 37;+ wb = Math.max(0.4, 0.5 + 11.9 * Math.pow(t, 1.2));+ } else if (x > 25) {+ const t = (88 - x) / 63;+ wb = Math.max(0.2, 0.2 + 12.2 * Math.pow(t, 1.5));+ }++ let yk = 0.5;+ if (x < -48) {+ const t = (x - (-48)) / (-24);+ yk = 0.5 + 4.2 * (t * t);+ } else if (x > 70) {+ const t = (x - 70) / 18;+ yk = 0.5 + 1.2 * (t * t);+ }++ return { yd, wd, wb, yk };+ }++ // --- 1. Lower Hull (Red Anti-Fouling Paint) ---+ {+ const positions = [];+ const indices = [];+ const numPts = 7;++ for (let i = 0; i < xStations.length; i++) {+ const x = xStations[i];+ const { yk, wb } = getHullProfile(x);+ positions.push(+ x, 4.0, -wb,+ x, yk + (4.0 - yk) * 0.7, -wb * 0.94,+ x, yk + (4.0 - yk) * 0.28, -wb * 0.65,+ x, yk, 0,+ x, yk + (4.0 - yk) * 0.28, wb * 0.65,+ x, yk + (4.0 - yk) * 0.7, wb * 0.94,+ x, 4.0, wb+ );+ }++ for (let i = 0; i < xStations.length - 1; i++) {+ const rowA = i * numPts;+ const rowB = (i + 1) * numPts;+ for (let p = 0; p < numPts - 1; p++) {+ const a0 = rowA + p;+ const a1 = rowA + p + 1;+ const b0 = rowB + p;+ const b1 = rowB + p + 1;+ indices.push(a0, b0, b1, a0, b1, a1);+ }+ }++ // Caps+ const s0 = 0;+ indices.push(s0, s0 + 1, s0 + 3, s0 + 1, s0 + 2, s0 + 3, s0 + 3, s0 + 4, s0 + 5, s0 + 3, s0 + 5, s0 + 6);+ const bEnd = (xStations.length - 1) * numPts;+ indices.push(bEnd + 3, bEnd + 1, bEnd, bEnd + 3, bEnd + 2, bEnd + 1, bEnd + 5, bEnd + 4, bEnd + 3, bEnd + 6, bEnd + 5, bEnd + 3);++ createPart('LowerHull', meshGeo({ positions, indices }), mats.redHull, { parent: root });+ }++ // --- 2. Waterline Boot-Topping Stripe (Dark Charcoal) ---+ {+ const positions = [];+ const indices = [];+ const numPts = 4;++ for (let i = 0; i < xStations.length; i++) {+ const x = xStations[i];+ const { wb } = getHullProfile(x);+ positions.push(+ x, 3.8, -wb * 0.99,+ x, 4.3, -wb,+ x, 3.8, wb * 0.99,+ x, 4.3, wb+ );+ }++ for (let i = 0; i < xStations.length - 1; i++) {+ const rowA = i * numPts;+ const rowB = (i + 1) * numPts;+ // Port:+ indices.push(rowA, rowA + 1, rowB + 1, rowA, rowB + 1, rowB);+ // Starboard:+ indices.push(rowA + 2, rowB + 2, rowB + 3, rowA + 2, rowB + 3, rowA + 3);+ }++ createPart('WaterlineStripe', meshGeo({ positions, indices }), mats.waterlineBoot, { parent: root });+ }++ // --- 3. Upper Hull (Naval Haze Gray) ---+ {+ const positions = [];+ const indices = [];+ const numPts = 8;++ for (let i = 0; i < xStations.length; i++) {+ const x = xStations[i];+ const { yd, wd, wb } = getHullProfile(x);+ const bulwarkH = x > 30 ? 1.1 : 0.8;+ positions.push(+ x, 4.3, -wb,+ x, 4.3 + (yd - 4.3) * 0.5, -(wb * 0.45 + wd * 0.55),+ x, yd, -wd,+ x, yd + bulwarkH, -wd,+ x, 4.3, wb,+ x, 4.3 + (yd - 4.3) * 0.5, (wb * 0.45 + wd * 0.55),+ x, yd, wd,+ x, yd + bulwarkH, wd+ );+ }++ for (let i = 0; i < xStations.length - 1; i++) {+ const rowA = i * numPts;+ const rowB = (i + 1) * numPts;+ for (let p = 0; p < 3; p++) {+ const a0 = rowA + p;+ const a1 = rowA + p + 1;+ const b0 = rowB + p;+ const b1 = rowB + p + 1;+ indices.push(a0, a1, b1, a0, b1, b0);+ }+ for (let p = 4; p < 7; p++) {+ const a0 = rowA + p;+ const a1 = rowA + p + 1;+ const b0 = rowB + p;+ const b1 = rowB + p + 1;+ indices.push(a0, b0, b1, a0, b1, a1);+ }+ }++ // Stern transom closure+ indices.push(+ 0, 4, 5, 0, 5, 1,+ 1, 5, 6, 1, 6, 2,+ 2, 6, 7, 2, 7, 3+ );++ createPart('UpperHull', meshGeo({ positions, indices }), mats.steelHull, { parent: root });+ }++ // --- 4. Main Wooden Deck (Teak Planking) ---+ {+ const positions = [];+ const indices = [];+ const zFracs = [-1.0, -0.75, -0.5, -0.25, 0.0, 0.25, 0.5, 0.75, 1.0];+ const numCols = zFracs.length;++ for (let i = 0; i < xStations.length; i++) {+ const x = xStations[i];+ const { yd, wd } = getHullProfile(x);+ for (let j = 0; j < numCols; j++) {+ const f = zFracs[j];+ const z = f * wd;+ const camber = 0.22 * (1.0 - f * f);+ positions.push(x, yd + camber, z);+ }+ }++ for (let i = 0; i < xStations.length - 1; i++) {+ const rowA = i * numCols;+ const rowB = (i + 1) * numCols;+ for (let j = 0; j < numCols - 1; j++) {+ const a0 = rowA + j;+ const a1 = rowA + j + 1;+ const b0 = rowB + j;+ const b1 = rowB + j + 1;+ indices.push(a0, a1, b1, a0, b1, b0);+ }+ }++ createPart('WoodenDeck', meshGeo({ positions, indices }), mats.woodDeck, { parent: root });+ }++ // --- 5. Main Armor Belt (Citadel Bulge) ---+ {+ createPart('ArmorBeltPort', boxGeo(72, 3.2, 0.4), mats.steelArmor, {+ position: [-2, 5.8, -12.35],+ parent: root+ });+ createPart('ArmorBeltStbd', boxGeo(72, 3.2, 0.4), mats.steelArmor, {+ position: [-2, 5.8, 12.35],+ parent: root+ });+ }++ // --- 6. Triple Gun Turret Generator ---+ function buildTripleTurret(name, cfg, parent) {+ const { x, yDeck, barbetteHeight, turretElevation, facingAngle } = cfg;+ const turretPivot = createPivot(name, [x, yDeck, 0], parent);++ // 1. Cylindrical Armored Barbette+ const barbetteRadius = 5.3;+ createPart(`${name}_Barbette`, cylinderGeo(barbetteRadius, barbetteRadius, barbetteHeight, 32), mats.steelArmor, {+ position: [0, barbetteHeight / 2, 0],+ parent: turretPivot+ });++ createPart(`${name}_BarbetteRing`, cylinderGeo(barbetteRadius + 0.35, barbetteRadius + 0.35, 0.2, 32), mats.steelSuper, {+ position: [0, 0.1, 0],+ parent: turretPivot+ });++ // 2. Rotating Turret Assembly+ const gunhousePivot = createPivot(`${name}_Gunhouse`, [0, barbetteHeight, 0], turretPivot);+ gunhousePivot.rotation.y = (facingAngle * Math.PI) / 180;++ createPart(`${name}_GunhouseBase`, boxGeo(11.2, 1.8, 8.8), mats.steelSuper, {+ position: [0.6, 0.9, 0],+ parent: gunhousePivot+ });++ createPart(`${name}_SlopedFrontArmor`, boxGeo(5.2, 1.8, 8.4), mats.steelSuper, {+ position: [3.8, 2.35, 0],+ rotation: [0, 0, -38],+ parent: gunhousePivot+ });++ createPart(`${name}_GunhouseRoof`, boxGeo(7.8, 1.2, 8.4), mats.turretRoofRed, {+ position: [-1.2, 2.65, 0],+ parent: gunhousePivot+ });++ createPart(`${name}_RearOverhang`, boxGeo(3.2, 1.4, 8.2), mats.steelArmor, {+ position: [-4.6, 1.6, 0],+ parent: gunhousePivot+ });++ createPart(`${name}_RangefinderBeam`, cylinderGeo(0.32, 0.32, 11.2, 16), mats.steelSuper, {+ position: [-3.8, 2.7, 0],+ rotation: [90, 0, 0],+ parent: gunhousePivot+ });+ createPart(`${name}_RangefinderEarPort`, boxGeo(0.9, 0.7, 0.8), mats.darkSteel, {+ position: [-3.8, 2.7, -5.6],+ parent: gunhousePivot+ });+ createPart(`${name}_RangefinderEarStbd`, boxGeo(0.9, 0.7, 0.8), mats.darkSteel, {+ position: [-3.8, 2.7, 5.6],+ parent: gunhousePivot+ });++ createPart(`${name}_PeriscopePort`, cylinderGeo(0.2, 0.2, 0.6, 12), mats.brass, {+ position: [-1.0, 3.4, -2.0],+ parent: gunhousePivot+ });+ createPart(`${name}_PeriscopeStbd`, cylinderGeo(0.2, 0.2, 0.6, 12), mats.brass, {+ position: [-1.0, 3.4, 2.0],+ parent: gunhousePivot+ });+ createPart(`${name}_VentCowl`, cylinderGeo(0.35, 0.25, 0.35, 12), mats.darkSteel, {+ position: [-2.6, 3.35, 0],+ parent: gunhousePivot+ });++ // 3. Three 16-inch Gun Barrels+ const barrelZ = [-2.4, 0.0, 2.4];+ const elevRad = (turretElevation * Math.PI) / 180;++ for (let b = 0; b < barrelZ.length; b++) {+ const bz = barrelZ[b];+ const gunMount = createPivot(`${name}_GunMount_${b}`, [4.2, 1.6, bz], gunhousePivot);+ gunMount.rotation.z = elevRad;++ createPart(`${name}_BlastBag_${b}`, cylinderXGeo(0.72, 0.82, 1.8, 16), mats.canvasBag, {+ position: [0.8, 0, 0],+ parent: gunMount+ });++ createPart(`${name}_SlideSleeve_${b}`, cylinderXGeo(0.52, 0.56, 4.4, 16), mats.steelSuper, {+ position: [3.4, 0, 0],+ parent: gunMount+ });++ createPart(`${name}_BarrelTube_${b}`, cylinderXGeo(0.34, 0.50, 11.5, 16), mats.darkSteel, {+ position: [11.2, 0, 0],+ parent: gunMount+ });++ createPart(`${name}_MuzzleRing_${b}`, cylinderXGeo(0.38, 0.38, 0.6, 16), mats.darkSteel, {+ position: [17.1, 0, 0],+ parent: gunMount+ });++ createPart(`${name}_MuzzleBore_${b}`, cylinderXGeo(0.22, 0.22, 0.25, 12), mats.blackMetal, {+ position: [17.3, 0, 0],+ parent: gunMount+ });+ }++ if (cfg.hasRoofAA) {+ createPart(`${name}_RoofAATub`, cylinderGeo(1.8, 1.8, 0.8, 16), mats.steelSuper, {+ position: [-0.6, 3.65, 0],+ parent: gunhousePivot+ });+ createPart(`${name}_RoofAAGuns`, boxGeo(2.4, 0.4, 0.9), mats.darkSteel, {+ position: [0.3, 3.8, 0],+ parent: gunhousePivot+ });+ }++ return turretPivot;+ }++ // --- 7. Main Armament: Triple Gun Turrets 1, 2, 3 ---+ buildTripleTurret('Turret_1', {+ x: 48,+ yDeck: 9.35,+ barbetteHeight: 0.9,+ turretElevation: 5,+ facingAngle: 0,+ hasRoofAA: false+ }, root);++ buildTripleTurret('Turret_2', {+ x: 31,+ yDeck: 8.75,+ barbetteHeight: 4.8,+ turretElevation: 7,+ facingAngle: 0,+ hasRoofAA: true+ }, root);++ buildTripleTurret('Turret_3', {+ x: -38,+ yDeck: 8.25,+ barbetteHeight: 1.1,+ turretElevation: 6,+ facingAngle: 180,+ hasRoofAA: true+ }, root);++ // --- 8. Forecastle Equipment & Details ---+ {+ createPart('BreakwaterPort', boxGeo(8.5, 1.2, 0.18), mats.steelSuper, {+ position: [59.0, 10.6, -3.4],+ rotation: [0, 36, 12],+ parent: root+ });+ createPart('BreakwaterStbd', boxGeo(8.5, 1.2, 0.18), mats.steelSuper, {+ position: [59.0, 10.6, 3.4],+ rotation: [0, -36, 12],+ parent: root+ });++ createPart('HawsePipePort', cylinderGeo(0.65, 0.65, 1.2, 12), mats.darkSteel, {+ position: [81.5, 11.2, -1.8],+ rotation: [45, 0, 30],+ parent: root+ });+ createPart('AnchorPortFluke', boxGeo(1.6, 1.4, 0.3), mats.darkSteel, {+ position: [81.2, 10.8, -1.9],+ rotation: [0, 15, 35],+ parent: root+ });+ createPart('HawsePipeStbd', cylinderGeo(0.65, 0.65, 1.2, 12), mats.darkSteel, {+ position: [81.5, 11.2, 1.8],+ rotation: [-45, 0, 30],+ parent: root+ });+ createPart('AnchorStbdFluke', boxGeo(1.6, 1.4, 0.3), mats.darkSteel, {+ position: [81.2, 10.8, 1.9],+ rotation: [0, -15, 35],+ parent: root+ });++ createPart('CapstanPort', cylinderGeo(0.85, 0.95, 1.4, 16), mats.darkSteel, {+ position: [74.0, 11.8, -2.0],+ parent: root+ });+ createPart('CapstanStbd', cylinderGeo(0.85, 0.95, 1.4, 16), mats.darkSteel, {+ position: [74.0, 11.8, 2.0],+ parent: root+ });+ createPart('CapstanHeadPort', cylinderGeo(0.5, 0.5, 0.25, 16), mats.brass, {+ position: [74.0, 12.55, -2.0],+ parent: root+ });+ createPart('CapstanHeadStbd', cylinderGeo(0.5, 0.5, 0.25, 16), mats.brass, {+ position: [74.0, 12.55, 2.0],+ parent: root+ });++ createPart('ChainPort', boxGeo(8.0, 0.16, 0.28), mats.darkSteel, {+ position: [77.5, 11.6, -1.9],+ rotation: [0, 2, 0],+ parent: root+ });+ createPart('ChainStbd', boxGeo(8.0, 0.16, 0.28), mats.darkSteel, {+ position: [77.5, 11.6, 1.9],+ rotation: [0, -2, 0],+ parent: root+ });++ createPart('Jackstaff', cylinderGeo(0.06, 0.12, 6.5, 8), mats.steelSuper, {+ position: [87.5, 15.5, 0],+ parent: root+ });+ }++ // --- 9. Superstructure & Bridge Tower ---+ {+ const superGroup = createPivot('Superstructure', [0, 0, 0], root);++ createPart('DeckhouseTier1', boxGeo(45, 3.8, 14.0), mats.steelSuper, {+ position: [-1.0, 10.6, 0],+ parent: superGroup+ });+ createPart('DeckhouseFwdRound', cylinderGeo(7.0, 7.0, 3.8, 24), mats.steelSuper, {+ position: [21.5, 10.6, 0],+ parent: superGroup+ });++ createPart('DeckhouseTier2', boxGeo(38, 3.2, 11.6), mats.steelSuper, {+ position: [-1.5, 14.1, 0],+ parent: superGroup+ });++ createPart('ConningTower', cylinderGeo(3.6, 3.9, 3.2, 24), mats.steelArmor, {+ position: [15.5, 17.2, 0],+ parent: superGroup+ });+ createPart('ConningSlits', cylinderGeo(3.7, 3.7, 0.35, 24), mats.blackMetal, {+ position: [15.5, 17.5, 0],+ parent: superGroup+ });++ createPart('NavBridgeHouse', boxGeo(6.8, 2.8, 8.2), mats.steelSuper, {+ position: [14.0, 20.1, 0],+ parent: superGroup+ });+ createPart('BridgeWindowsFwd', boxGeo(0.2, 1.1, 7.6), mats.glass, {+ position: [17.45, 20.3, 0],+ parent: superGroup+ });+ createPart('BridgeWindowsPort', boxGeo(4.2, 1.1, 0.2), mats.glass, {+ position: [15.2, 20.3, -4.15],+ parent: superGroup+ });+ createPart('BridgeWindowsStbd', boxGeo(4.2, 1.1, 0.2), mats.glass, {+ position: [15.2, 20.3, 4.15],+ parent: superGroup+ });++ createPart('BridgeWingPort', boxGeo(3.2, 2.2, 5.0), mats.steelSuper, {+ position: [14.0, 19.8, -6.6],+ parent: superGroup+ });+ createPart('BridgeWingStbd', boxGeo(3.2, 2.2, 5.0), mats.steelSuper, {+ position: [14.0, 19.8, 6.6],+ parent: superGroup+ });+ createPart('PelorusPort', cylinderGeo(0.18, 0.18, 1.0, 12), mats.brass, {+ position: [14.5, 21.4, -8.6],+ parent: superGroup+ });+ createPart('PelorusStbd', cylinderGeo(0.18, 0.18, 1.0, 12), mats.brass, {+ position: [14.5, 21.4, 8.6],+ parent: superGroup+ });++ createPart('CommandPlatform', boxGeo(5.2, 0.8, 6.4), mats.steelSuper, {+ position: [13.2, 21.8, 0],+ parent: superGroup+ });+ createPart('WindscreenRim', boxGeo(5.4, 0.9, 6.6), mats.brass, {+ position: [13.2, 22.5, 0],+ parent: superGroup+ });++ createPart('DirectorTowerPedestal', cylinderGeo(2.4, 2.8, 4.8, 16), mats.steelSuper, {+ position: [11.0, 24.6, 0],+ parent: superGroup+ });+ const fwdDirector = createPivot('Mk38DirectorFwd', [11.0, 26.9, 0], superGroup);+ createPart('DirectorHouse', boxGeo(3.2, 2.0, 3.4), mats.steelArmor, {+ position: [0, 1.0, 0],+ parent: fwdDirector+ });+ createPart('DirectorArm', cylinderGeo(0.35, 0.35, 9.2, 16), mats.steelSuper, {+ position: [0, 1.1, 0],+ rotation: [90, 0, 0],+ parent: fwdDirector+ });+ createPart('DirectorHoodPort', boxGeo(0.8, 0.7, 0.8), mats.darkSteel, {+ position: [0, 1.1, -4.6],+ parent: fwdDirector+ });+ createPart('DirectorHoodStbd', boxGeo(0.8, 0.7, 0.8), mats.darkSteel, {+ position: [0, 1.1, 4.6],+ parent: fwdDirector+ });+ createPart('RadarBracket', cylinderGeo(0.16, 0.16, 0.4, 8), mats.darkSteel, {+ position: [0.2, 2.0, 0],+ parent: fwdDirector+ });+ createPart('RadarMk8Mesh', boxGeo(1.8, 0.9, 3.2), mats.darkSteel, {+ position: [0.2, 2.35, 0],+ parent: fwdDirector+ });++ createPart('ForemastTrunk', cylinderGeo(0.35, 0.65, 14.0, 12), mats.steelSuper, {+ position: [8.5, 33.5, 0],+ parent: superGroup+ });+ createPart('TripodLegPort', cylinderGeo(0.22, 0.35, 11.5, 8), mats.steelSuper, {+ position: [6.8, 30.5, -2.4],+ rotation: [16, 0, 12],+ parent: superGroup+ });+ createPart('TripodLegStbd', cylinderGeo(0.22, 0.35, 11.5, 8), mats.steelSuper, {+ position: [6.8, 30.5, 2.4],+ rotation: [-16, 0, 12],+ parent: superGroup+ });+ createPart('LowerYardarm', cylinderGeo(0.12, 0.12, 13.5, 8), mats.steelSuper, {+ position: [8.5, 33.0, 0],+ rotation: [90, 0, 0],+ parent: superGroup+ });+ createPart('UpperYardarm', cylinderGeo(0.08, 0.08, 8.5, 8), mats.steelSuper, {+ position: [8.5, 36.8, 0],+ rotation: [90, 0, 0],+ parent: superGroup+ });+ createPart('SGRadarPlatform', cylinderGeo(1.2, 1.2, 0.2, 12), mats.steelSuper, {+ position: [8.5, 35.0, 0],+ parent: superGroup+ });+ createPart('SGRadarDish', cylinderGeo(0.6, 0.6, 0.3, 12), mats.darkSteel, {+ position: [8.5, 35.4, 0],+ rotation: [0, 30, 90],+ parent: superGroup+ });+ createPart('SCRadarAntenna', boxGeo(1.6, 2.4, 2.4), mats.darkSteel, {+ position: [8.5, 41.2, 0],+ parent: superGroup+ });+ }++ // --- 10. Smokestacks / Funnels & Machinery Casings ---+ {+ const f1Group = createPivot('Funnel_1', [4.5, 15.6, 0], root);+ f1Group.rotation.z = (-5 * Math.PI) / 180;++ createPart('Funnel1Body', cylinderGeo(2.4, 2.8, 7.8, 24), mats.steelSuper, {+ position: [0, 3.9, 0],+ scale: [1.35, 1.0, 0.85],+ parent: f1Group+ });+ createPart('Funnel1Cap', cylinderGeo(2.45, 2.45, 1.2, 24), mats.blackMetal, {+ position: [0, 7.8, 0],+ scale: [1.35, 1.0, 0.85],+ parent: f1Group+ });+ createPart('SteamPipe1', cylinderGeo(0.18, 0.18, 7.5, 8), mats.brass, {+ position: [3.3, 3.8, 0],+ parent: f1Group+ });++ const f2Group = createPivot('Funnel_2', [-7.5, 15.6, 0], root);+ f2Group.rotation.z = (-5 * Math.PI) / 180;++ createPart('Funnel2Body', cylinderGeo(2.3, 2.7, 7.4, 24), mats.steelSuper, {+ position: [0, 3.7, 0],+ scale: [1.35, 1.0, 0.85],+ parent: f2Group+ });+ createPart('Funnel2Cap', cylinderGeo(2.35, 2.35, 1.2, 24), mats.blackMetal, {+ position: [0, 7.4, 0],+ scale: [1.35, 1.0, 0.85],+ parent: f2Group+ });+ createPart('SteamPipe2', cylinderGeo(0.18, 0.18, 7.2, 8), mats.brass, {+ position: [3.2, 3.6, 0],+ parent: f2Group+ });++ createPart('SearchlightDeck', boxGeo(5.0, 0.8, 10.5), mats.steelSuper, {+ position: [-1.5, 17.2, 0],+ parent: root+ });+ const sPositions = [+ [-1.5, 17.6, -4.2],+ [-1.5, 17.6, 4.2],+ [-1.5, 17.6, -1.8],+ [-1.5, 17.6, 1.8]+ ];+ for (let s = 0; s < sPositions.length; s++) {+ const [sx, sy, sz] = sPositions[s];+ const sPivot = createPivot(`Searchlight_${s}`, [sx, sy, sz], root);+ createPart(`SearchlightPedestal_${s}`, cylinderGeo(0.2, 0.25, 0.7, 12), mats.steelSuper, {+ position: [0, 0.35, 0],+ parent: sPivot+ });+ createPart(`SearchlightDrum_${s}`, cylinderXGeo(0.6, 0.6, 0.8, 16), mats.brass, {+ position: [0, 0.85, 0],+ parent: sPivot+ });+ createPart(`SearchlightLens_${s}`, cylinderXGeo(0.52, 0.52, 0.15, 16), mats.glass, {+ position: [0.38, 0.85, 0],+ parent: sPivot+ });+ }++ const boatPositions = [+ [-1.5, 15.7, -6.8],+ [-1.5, 15.7, 6.8]+ ];+ for (let b = 0; b < boatPositions.length; b++) {+ const [bx, by, bz] = boatPositions[b];+ const boat = createPivot(`MotorLaunch_${b}`, [bx, by, bz], root);+ createPart(`LaunchHull_${b}`, boxGeo(9.5, 1.4, 2.8), mats.white, {+ position: [0, 0.7, 0],+ parent: boat+ });+ createPart(`LaunchCabin_${b}`, boxGeo(4.2, 1.1, 2.0), mats.woodMargin, {+ position: [-0.6, 1.7, 0],+ parent: boat+ });+ createPart(`LaunchChockFwd_${b}`, boxGeo(0.4, 0.5, 3.2), mats.steelSuper, {+ position: [2.5, 0.25, 0],+ parent: boat+ });+ createPart(`LaunchChockAft_${b}`, boxGeo(0.4, 0.5, 3.2), mats.steelSuper, {+ position: [-2.5, 0.25, 0],+ parent: boat+ });+ }++ const cranePivot = createPivot('MidshipsCrane', [-13.0, 15.6, 0], root);+ createPart('CranePillar', cylinderGeo(0.7, 0.85, 5.0, 16), mats.steelSuper, {+ position: [0, 2.5, 0],+ parent: cranePivot+ });+ createPart('MidshipsCraneBoom', boxGeo(11.0, 0.5, 0.6), mats.steelSuper, {+ position: [-4.5, 4.9, 0],+ rotation: [0, 0, 18],+ parent: cranePivot+ });+ }++ // --- 11. Secondary Battery: Twin 5-inch/38-Caliber Turrets ---+ {+ const secPositions = [+ { x: 10.0, z: 8.4, facing: 45 },+ { x: -1.5, z: 8.6, facing: 90 },+ { x: -13.0, z: 8.4, facing: 135 },+ { x: 10.0, z: -8.4, facing: -45 },+ { x: -1.5, z: -8.6, facing: -90 },+ { x: -13.0, z: -8.4, facing: -135 },+ ];++ for (let i = 0; i < secPositions.length; i++) {+ const { x, z, facing } = secPositions[i];+ const secPivot = createPivot(`SecTurret_${i}`, [x, 12.5, z], root);+ secPivot.rotation.y = (facing * Math.PI) / 180;++ createPart(`SecMountRing_${i}`, cylinderGeo(1.8, 1.8, 0.4, 16), mats.steelArmor, {+ position: [0, 0.2, 0],+ parent: secPivot+ });+ createPart(`SecGunhouse_${i}`, boxGeo(3.2, 1.8, 2.8), mats.steelSuper, {+ position: [0, 1.2, 0],+ parent: secPivot+ });+ createPart(`SecBarrelL_${i}`, cylinderXGeo(0.14, 0.18, 4.4, 12), mats.darkSteel, {+ position: [2.8, 1.3, -0.55],+ parent: secPivot+ });+ createPart(`SecBarrelR_${i}`, cylinderXGeo(0.14, 0.18, 4.4, 12), mats.darkSteel, {+ position: [2.8, 1.3, 0.55],+ parent: secPivot+ });+ }+ }++ // --- 12. Anti-Aircraft Batteries (40mm Bofors Quad Mounts) ---+ {+ const aaPositions = [+ { x: 23.0, y: 12.4, z: 7.2 },+ { x: 23.0, y: 12.4, z: -7.2 },+ { x: 4.5, y: 15.6, z: 7.5 },+ { x: 4.5, y: 15.6, z: -7.5 },+ { x: -20.0, y: 12.4, z: 5.6 },+ { x: -20.0, y: 12.4, z: -5.6 },+ ];++ for (let i = 0; i < aaPositions.length; i++) {+ const { x, y, z } = aaPositions[i];+ const aaTub = createPivot(`BoforsTub_${i}`, [x, y, z], root);+ createPart(`BoforsTubWall_${i}`, cylinderGeo(1.9, 1.9, 1.1, 16), mats.steelSuper, {+ position: [0, 0.55, 0],+ parent: aaTub+ });+ createPart(`BoforsCarriage_${i}`, boxGeo(1.2, 0.8, 1.1), mats.darkSteel, {+ position: [0, 0.9, 0],+ parent: aaTub+ });+ createPart(`BoforsBarrels_${i}`, boxGeo(2.6, 0.35, 0.8), mats.darkSteel, {+ position: [0.6, 1.2, 0],+ rotation: [0, 0, 15],+ parent: aaTub+ });+ }+ }++ // --- 13. Aft Superstructure, Mainmast & Secondary Director ---+ {+ const aftGroup = createPivot('AftSuperstructure', [-20.0, 12.4, 0], root);++ createPart('AftDeckhouse', boxGeo(8.5, 2.8, 7.8), mats.steelSuper, {+ position: [0, 1.4, 0],+ parent: aftGroup+ });++ const aftDir = createPivot('Mk38DirectorAft', [1.5, 2.8, 0], aftGroup);+ createPart('AftDirHouse', boxGeo(2.8, 1.8, 3.0), mats.steelArmor, {+ position: [0, 1.0, 0],+ parent: aftDir+ });+ createPart('AftDirArm', cylinderGeo(0.32, 0.32, 8.4, 16), mats.steelSuper, {+ position: [0, 1.1, 0],+ rotation: [90, 0, 0],+ parent: aftDir+ });++ createPart('MainmastTrunk', cylinderGeo(0.3, 0.5, 14.0, 12), mats.steelSuper, {+ position: [-2.8, 9.8, 0],+ parent: aftGroup+ });+ createPart('MainmastYardarm', cylinderGeo(0.09, 0.09, 9.5, 8), mats.steelSuper, {+ position: [-2.8, 13.2, 0],+ rotation: [90, 0, 0],+ parent: aftGroup+ });+ createPart('EnsignGaff', cylinderGeo(0.06, 0.08, 4.2, 8), mats.steelSuper, {+ position: [-4.2, 14.5, 0],+ rotation: [0, 0, -42],+ parent: aftGroup+ });+ }++ // --- 14. Fantail / Quarterdeck Equipment & Reconnaissance Floatplane ---+ {+ const catPivot = createPivot('AircraftCatapult', [-63.5, 8.1, 0], root);+ catPivot.rotation.y = (-50 * Math.PI) / 180;++ createPart('CatapultTurntable', cylinderGeo(1.8, 2.0, 0.8, 16), mats.steelArmor, {+ position: [0, 0.4, 0],+ parent: catPivot+ });+ createPart('LaunchRail', boxGeo(16.5, 0.8, 1.2), mats.steelSuper, {+ position: [3.5, 1.2, 0],+ parent: catPivot+ });++ const plane = createPivot('Floatplane', [2.5, 2.2, 0], catPivot);+ createPart('PlaneFuselage', boxGeo(6.8, 1.2, 1.2), mats.navyBlue, {+ position: [0, 0.6, 0],+ parent: plane+ });+ createPart('PlaneEngineCowl', cylinderXGeo(0.6, 0.6, 0.9, 16), mats.darkSteel, {+ position: [3.7, 0.6, 0],+ parent: plane+ });+ createPart('PlanePropeller', boxGeo(0.1, 1.8, 0.22), mats.blackMetal, {+ position: [4.2, 0.6, 0],+ parent: plane+ });+ createPart('PlaneCanopy', boxGeo(2.6, 0.6, 0.8), mats.glass, {+ position: [0.8, 1.35, 0],+ parent: plane+ });+ createPart('PlaneWings', boxGeo(1.6, 0.16, 10.5), mats.navyBlue, {+ position: [0.8, 0.65, 0],+ parent: plane+ });+ createPart('PlaneTailFin', boxGeo(1.1, 1.2, 0.12), mats.navyBlue, {+ position: [-3.0, 1.3, 0],+ parent: plane+ });+ createPart('PlaneTailPlane', boxGeo(0.9, 0.12, 3.2), mats.navyBlue, {+ position: [-3.0, 0.8, 0],+ parent: plane+ });+ createPart('MainFloat', boxGeo(6.2, 0.7, 1.0), mats.steelSuper, {+ position: [0.4, -0.65, 0],+ parent: plane+ });+ createPart('FloatStrutFwd', boxGeo(0.12, 0.8, 0.12), mats.darkSteel, {+ position: [1.8, -0.15, 0],+ parent: plane+ });+ createPart('FloatStrutAft', boxGeo(0.12, 0.8, 0.12), mats.darkSteel, {+ position: [-1.2, -0.15, 0],+ parent: plane+ });+ createPart('WingtipFloatL', boxGeo(1.2, 0.3, 0.35), mats.steelSuper, {+ position: [0.8, -0.2, -4.8],+ parent: plane+ });+ createPart('WingtipFloatR', boxGeo(1.2, 0.3, 0.35), mats.steelSuper, {+ position: [0.8, -0.2, 4.8],+ parent: plane+ });++ const sternCrane = createPivot('SternCrane', [-69.5, 8.0, 0], root);+ createPart('SternCraneBase', cylinderGeo(0.5, 0.65, 3.2, 12), mats.steelSuper, {+ position: [0, 1.6, 0],+ parent: sternCrane+ });+ createPart('SternCraneBoom', boxGeo(8.5, 0.35, 0.4), mats.steelSuper, {+ position: [2.5, 3.1, 0],+ rotation: [0, 0, -25],+ parent: sternCrane+ });++ const ensignStaff = createPivot('EnsignStaff', [-71.5, 8.0, 0], root);+ createPart('StaffPole', cylinderGeo(0.05, 0.09, 5.2, 8), mats.steelSuper, {+ position: [0, 2.6, 0],+ parent: ensignStaff+ });+ createPart('EnsignFlag', boxGeo(2.4, 1.4, 0.04), mats.ensignRed, {+ position: [-1.25, 4.2, 0.05],+ rotation: [0, 10, 0],+ parent: ensignStaff+ });++ const bollardX = [-48, -54, -60, -66];+ for (let b = 0; b < bollardX.length; b++) {+ const bx = bollardX[b];+ createPart(`BollardPort_${b}`, cylinderGeo(0.22, 0.22, 0.65, 8), mats.darkSteel, {+ position: [bx, 8.4, -9.5 + b * 1.5],+ parent: root+ });+ createPart(`BollardStbd_${b}`, cylinderGeo(0.22, 0.22, 0.65, 8), mats.darkSteel, {+ position: [bx, 8.4, 9.5 - b * 1.5],+ parent: root+ });+ }++ // Wooden Deck Companionways & Hatches+ createPart('FwdHatchCoaming', boxGeo(2.4, 0.45, 1.8), mats.woodMargin, {+ position: [67.0, 11.2, 0],+ parent: root+ });+ createPart('FwdHatchTop', boxGeo(2.2, 0.15, 1.6), mats.woodDeck, {+ position: [67.0, 11.45, 0],+ parent: root+ });+ createPart('FwdHatchBrass', boxGeo(0.2, 0.25, 1.2), mats.brass, {+ position: [67.0, 11.55, 0],+ parent: root+ });++ createPart('AftHatchCoaming', boxGeo(2.2, 0.4, 1.6), mats.woodMargin, {+ position: [-51.0, 8.35, 0],+ parent: root+ });+ createPart('AftHatchTop', boxGeo(2.0, 0.12, 1.4), mats.woodDeck, {+ position: [-51.0, 8.58, 0],+ parent: root+ });+ }++ // --- 15. Underwater Keel, Propellers & Rudders ---+ {+ createPart('BilgeKeelPort', boxGeo(48, 0.2, 1.1), mats.steelArmor, {+ position: [-2.0, 1.4, -11.6],+ rotation: [0, 0, 0],+ parent: root+ });+ createPart('BilgeKeelStbd', boxGeo(48, 0.2, 1.1), mats.steelArmor, {+ position: [-2.0, 1.4, 11.6],+ rotation: [0, 0, 0],+ parent: root+ });++ const shaftPositions = [+ { name: 'ShaftInPort', x: -54, y: 2.2, z: -2.8, rotZ: 3.5 },+ { name: 'ShaftInStbd', x: -54, y: 2.2, z: 2.8, rotZ: 3.5 },+ { name: 'ShaftOutPort', x: -51, y: 2.6, z: -5.6, rotZ: 5 },+ { name: 'ShaftOutStbd', x: -51, y: 2.6, z: 5.6, rotZ: 5 },+ ];++ for (let s = 0; s < shaftPositions.length; s++) {+ const { name, x, y, z, rotZ } = shaftPositions[s];+ createPart(name, cylinderXGeo(0.25, 0.25, 14.0, 12), mats.darkSteel, {+ position: [x, y, z],+ rotation: [0, 0, rotZ],+ parent: root+ });+ const screwX = x - 7.0;+ createPart(`${name}_Hub`, cylinderXGeo(0.55, 0.55, 1.2, 16), mats.bronzeProp, {+ position: [screwX, y - 0.35, z],+ parent: root+ });+ for (let blade = 0; blade < 3; blade++) {+ const bladePivot = createPivot(`${name}_Blade_${blade}`, [screwX, y - 0.35, z], root);+ bladePivot.rotation.x = (blade * 120 * Math.PI) / 180;+ createPart(`${name}_Blade_${blade}_Mesh`, boxGeo(0.12, 1.3, 0.42), mats.bronzeProp, {+ position: [0, 0.65, 0],+ rotation: [25, 0, 0],+ parent: bladePivot+ });+ }+ }++ createPart('RudderPort', boxGeo(4.2, 2.8, 0.35), mats.steelArmor, {+ position: [-65.0, 2.4, -2.6],+ parent: root+ });+ createPart('RudderStbd', boxGeo(4.2, 2.8, 0.35), mats.steelArmor, {+ position: [-65.0, 2.4, 2.6],+ parent: root+ });+ }++ return root;+}diff --git a/site/examples/history/demo-brass-orrery/history.json b/site/examples/history/demo-brass-orrery/history.jsonnew file mode 100644index 00000000..91df020d--- /dev/null+++ b/site/examples/history/demo-brass-orrery/history.json@@ -0,0 +1,16 @@+{+ "version": 1,+ "brief": {+ "kind": "recorded",+ "text": "An intricate 18th-century brass orrery on a dark walnut base, with visible interlocking clockwork gears, an animated hand crank, and six revolving planetary spheres (Mercury, Venus, Earth with orbiting Moon, Mars, Jupiter with Galilean moons, and Saturn with rings) orbiting a radiant central Sun."+ },+ "currentSourceHash": "23d56283da476ff69c39397722ba17a78e4fc247bf4d60e384f5a4e2173ca79b",+ "revisions": [+ {+ "file": "revision-1.kiln.js",+ "title": "Saved revision 1",+ "description": "An intricate 18th-century brass orrery on a dark walnut base, with visible interlocking clockwork gears, an animated hand crank, and six revolving planetary spheres (Mercury, Venus, Earth with orbiting Moon, Mars, Jupiter with Galilean moons, and Saturn with rings) orbiting a radiant central Sun.",+ "sourceHash": "23d56283da476ff69c39397722ba17a78e4fc247bf4d60e384f5a4e2173ca79b"+ }+ ]+}diff --git a/site/examples/history/demo-brass-orrery/revision-1.kiln.js b/site/examples/history/demo-brass-orrery/revision-1.kiln.jsnew file mode 100644index 00000000..3002d99c--- /dev/null+++ b/site/examples/history/demo-brass-orrery/revision-1.kiln.js@@ -0,0 +1,768 @@+const meta = {+ name: 'Intricate Brass Orrery',+ category: 'prop',+ role: 'prop'+};++function build() {+ const root = createRoot('Orrery');++ // --- Materials ---+ // Rich Dark Walnut Wood (deep polished espresso walnut)+ const walnutMat = gameMaterial(0x28160b, { roughness: 0.60, metalness: 0.04 });++ // Polished antique brasses & metals+ const brightBrass = gameMaterial(0xd8b248, { metalness: 0.90, roughness: 0.20 });+ const antiqueBrass = gameMaterial(0xb89238, { metalness: 0.85, roughness: 0.32 });+ const deepBronze = gameMaterial(0x8c6b28, { metalness: 0.82, roughness: 0.38 });+ const steelMat = gameMaterial(0x8e98a0, { metalness: 0.92, roughness: 0.28 });++ // Celestial sphere materials+ const sunMat = gameMaterial(0xffcc33, {+ metalness: 0.85,+ roughness: 0.15,+ emissive: 0xffaa00,+ emissiveIntensity: 0.35+ });+ const mercuryMat = gameMaterial(0x7a7470, { metalness: 0.65, roughness: 0.35 });+ const venusMat = gameMaterial(0xe8d8b0, { metalness: 0.45, roughness: 0.25 });+ const earthMat = gameMaterial(0x1d559c, { metalness: 0.30, roughness: 0.35 });+ const moonMat = gameMaterial(0xdddddd, { metalness: 0.25, roughness: 0.45 });+ const marsMat = gameMaterial(0xb84224, { metalness: 0.45, roughness: 0.40 });+ const jupiterMat = gameMaterial(0xcc9652, { metalness: 0.35, roughness: 0.35 });+ const saturnMat = gameMaterial(0xd8be82, { metalness: 0.40, roughness: 0.30 });+ const saturnRingMat = gameMaterial(0xc8a44e, { metalness: 0.85, roughness: 0.25 });++ // ==========================================+ // 1. WALNUT BASE & INLAID HORIZON DIAL+ // ==========================================+ // Four turned bun feet with brass leveling pads+ const footAngles = [Math.PI * 0.25, Math.PI * 0.75, Math.PI * 1.25, Math.PI * 1.75];+ for (let i = 0; i < 4; i++) {+ const angle = footAngles[i];+ const fx = Math.cos(angle) * 0.20;+ const fz = Math.sin(angle) * 0.20;+ // Brass levelling disc+ createPart('FootBrassPad' + i, cylinderGeo(0.024, 0.024, 0.004, 16), antiqueBrass, {+ position: [fx, 0.002, fz],+ parent: root+ });+ // Walnut turned bun foot+ createPart('FootWalnut' + i, cylinderGeo(0.018, 0.024, 0.018, 16), walnutMat, {+ position: [fx, 0.013, fz],+ parent: root+ });+ // Brass collar trim ring+ createPart('FootCollar' + i, torusGeo(0.018, 0.002, 8, 16), brightBrass, {+ position: [fx, 0.022, fz],+ rotation: [90, 0, 0],+ parent: root+ });+ }++ // Stepped Walnut Plinth (lathed stepped profile)+ const plinthProfile = [+ [0, 0.015],+ [0.235, 0.015],+ [0.235, 0.030],+ [0.228, 0.040],+ [0.228, 0.065],+ [0.220, 0.076],+ [0.215, 0.088],+ [0, 0.088]+ ];+ const plinthGeo = lathe(plinthProfile, 48);+ createPart('WalnutPlinth', plinthGeo, walnutMat, { parent: root });++ // Lower brass moulding trim ring around plinth+ createPart('PlinthBrassTrim', torusGeo(0.235, 0.0026, 8, 48), antiqueBrass, {+ position: [0, 0.018, 0],+ rotation: [90, 0, 0],+ parent: root+ });++ // Inlaid Brass Calendar & Zodiac Horizon Ring (Y = 0.089)+ createPart('ZodiacRingPlate', cylinderGeo(0.212, 0.212, 0.002, 48), antiqueBrass, {+ position: [0, 0.089, 0],+ parent: root+ });+ createPart('ZodiacOuterBezel', torusGeo(0.212, 0.0025, 8, 48), brightBrass, {+ position: [0, 0.090, 0],+ rotation: [90, 0, 0],+ parent: root+ });+ createPart('ZodiacInnerBezel', torusGeo(0.160, 0.0025, 8, 48), brightBrass, {+ position: [0, 0.090, 0],+ rotation: [90, 0, 0],+ parent: root+ });++ // Engraved radial graduation ticks on the horizon ring+ for (let i = 0; i < 24; i++) {+ const rad = (i / 24) * Math.PI * 2;+ const isMajor = i % 2 === 0;+ const rStart = isMajor ? 0.165 : 0.175;+ const rEnd = 0.207;+ const x0 = Math.cos(rad) * rStart;+ const z0 = Math.sin(rad) * rStart;+ const x1 = Math.cos(rad) * rEnd;+ const z1 = Math.sin(rad) * rEnd;+ beamBetween('Tick' + i, [x0, 0.091, z0], [x1, 0.091, z1], isMajor ? 0.0012 : 0.0008, brightBrass, { parent: root });+ }++ // Maker's Brass Cartouche on front face of plinth (+X)+ createPart('MakersPlate', boxGeo(0.003, 0.022, 0.065), brightBrass, {+ position: [0.229, 0.052, 0],+ parent: root+ });+ // Etched inscription center on plaque+ createPart('MakersPlateInlay', boxGeo(0.0035, 0.014, 0.050), deepBronze, {+ position: [0.230, 0.052, 0],+ parent: root+ });+ // 12 Zodiac / calendar boss studs around horizon ring+ for (let z = 0; z < 12; z++) {+ const zrad = (z / 12) * Math.PI * 2;+ createPart('ZodiacStud' + z, sphereGeo(0.0022, 8, 6), brightBrass, {+ position: [Math.cos(zrad) * 0.186, 0.091, Math.sin(zrad) * 0.186],+ parent: root+ });+ }+ // 4 corner mounting rivets on plate+ const rivetOffsets = [+ [0.008, 0.026],+ [-0.008, 0.026],+ [0.008, -0.026],+ [-0.008, -0.026]+ ];+ for (let r = 0; r < 4; r++) {+ createPart('PlateRivet' + r, sphereGeo(0.0015, 6, 6), steelMat, {+ position: [0.231, 0.052 + rivetOffsets[r][0], rivetOffsets[r][1]],+ parent: root+ });+ }++ // ==========================================+ // 2. CENTRAL PEDESTAL & GEARBOX HOUSING+ // ==========================================+ // Central turned brass pedestal base+ createPart('PedestalBaseDisc', cylinderGeo(0.082, 0.092, 0.010, 32), antiqueBrass, {+ position: [0, 0.095, 0],+ parent: root+ });+ createPart('PedestalBead', torusGeo(0.075, 0.006, 10, 32), brightBrass, {+ position: [0, 0.103, 0],+ rotation: [90, 0, 0],+ parent: root+ });+ createPart('PedestalSpool', cylinderGeo(0.050, 0.072, 0.016, 32), antiqueBrass, {+ position: [0, 0.114, 0],+ parent: root+ });+ createPart('PedestalFlange', cylinderGeo(0.060, 0.050, 0.010, 32), brightBrass, {+ position: [0, 0.126, 0],+ parent: root+ });++ // Gearbox lower and upper circular plates+ createPart('LowerGearPlate', cylinderGeo(0.092, 0.092, 0.003, 36), brightBrass, {+ position: [0, 0.133, 0],+ parent: root+ });+ createPart('LowerPlateRim', torusGeo(0.092, 0.0025, 8, 36), antiqueBrass, {+ position: [0, 0.133, 0],+ rotation: [90, 0, 0],+ parent: root+ });++ // Pierced open upper gear plate (outer ring, hub & 4 viewing quadrants)+ createPart('UpperPlateRim', torusGeo(0.092, 0.003, 8, 36), brightBrass, {+ position: [0, 0.215, 0],+ rotation: [90, 0, 0],+ parent: root+ });+ createPart('UpperPlateHub', cylinderGeo(0.026, 0.026, 0.003, 24), brightBrass, {+ position: [0, 0.215, 0],+ parent: root+ });+ // 4 Cross-arms connecting hub to rim+ for (let a = 0; a < 4; a++) {+ const armAng = (a / 4) * Math.PI * 2;+ const ax = Math.cos(armAng) * 0.058;+ const az = Math.sin(armAng) * 0.058;+ createPart('UpperPlateSpoke' + a, boxGeo(0.064, 0.003, 0.008), antiqueBrass, {+ position: [ax, 0.215, az],+ rotation: [0, -armAng * (180 / Math.PI), 0],+ parent: root+ });+ }++ // 4 Turned Brass Baluster Pillars connecting lower and upper plates+ const pillarAngles = [Math.PI * 0.25, Math.PI * 0.75, Math.PI * 1.25, Math.PI * 1.75];+ for (let p = 0; p < 4; p++) {+ const ang = pillarAngles[p];+ const px = Math.cos(ang) * 0.078;+ const pz = Math.sin(ang) * 0.078;+ // Lower foot+ createPart('PillarFoot' + p, cylinderGeo(0.006, 0.007, 0.008, 12), antiqueBrass, {+ position: [px, 0.138, pz],+ parent: root+ });+ // Baluster mid section+ createPart('PillarBody' + p, cylinderGeo(0.004, 0.0065, 0.060, 12), brightBrass, {+ position: [px, 0.174, pz],+ parent: root+ });+ // Turned ring bead+ createPart('PillarRing' + p, torusGeo(0.006, 0.002, 8, 12), brightBrass, {+ position: [px, 0.174, pz],+ rotation: [90, 0, 0],+ parent: root+ });+ // Upper head+ createPart('PillarHead' + p, cylinderGeo(0.007, 0.006, 0.008, 12), antiqueBrass, {+ position: [px, 0.210, pz],+ parent: root+ });+ // Acorn nut finial on top of upper plate+ createPart('PillarAcorn' + p, coneGeo(0.004, 0.008, 12), brightBrass, {+ position: [px, 0.220, pz],+ parent: root+ });+ }++ // Central Vertical Fixed Spindle (Sun shaft)+ createPart('CentralSpindle', cylinderGeo(0.006, 0.006, 0.250, 16), steelMat, {+ position: [0, 0.255, 0],+ parent: root+ });++ // ==========================================+ // 3. HAND CRANK & DRIVE ARBOR (Animated)+ // ==========================================+ // Bearing block on front of lower plate+ createPart('CrankBearingBlock', boxGeo(0.015, 0.016, 0.018), antiqueBrass, {+ position: [0.088, 0.142, 0],+ parent: root+ });++ // Animated Crank Pivot+ const jointCrank = createPivot('Crank', [0.060, 0.142, 0], root);+ // Horizontal drive shaft (along X)+ createPart('CrankShaft', cylinderGeo(0.0035, 0.0035, 0.090, 12), steelMat, {+ position: [0.045, 0, 0],+ rotation: [0, 0, 90],+ parent: jointCrank+ });+ // Bevel gear on crank shaft meshing with idler pinion+ createPart('CrankBevelGear', gearGeo({+ teeth: 14,+ rootRadius: 0.012,+ tipRadius: 0.016,+ boreRadius: 0.0035,+ height: 0.006+ }), antiqueBrass, {+ position: [0.005, 0, 0],+ rotation: [0, 0, 90],+ parent: jointCrank+ });+ // Brass crank boss & curved crank arm at outer end (X = 0.090 relative to joint)+ createPart('CrankBoss', cylinderGeo(0.007, 0.007, 0.008, 12), brightBrass, {+ position: [0.090, 0, 0],+ rotation: [0, 0, 90],+ parent: jointCrank+ });+ const crankArmGeo = pipeAlongPath([+ [0.090, 0, 0],+ [0.093, 0, 0],+ [0.093, 0.036, 0],+ [0.098, 0.038, 0]+ ], 0.0028, { bendRadius: 0.008 });+ createPart('CrankArmBar', crankArmGeo, brightBrass, { parent: jointCrank });+ // Turned dark walnut crank handle knob+ createPart('CrankHandle', cylinderGeo(0.006, 0.008, 0.032, 12), walnutMat, {+ position: [0.114, 0.038, 0],+ rotation: [0, 0, 90],+ parent: jointCrank+ });+ createPart('CrankHandleCap', sphereGeo(0.004, 8, 8), brightBrass, {+ position: [0.131, 0.038, 0],+ parent: jointCrank+ });++ // ==========================================+ // 4. IDLER ARBORS & COUNTER-GEARS (Animated)+ // ==========================================+ // Primary Idler Shaft (Offset at [0.052, 0, 0.030])+ const jointIdler1 = createPivot('IdlerArbor1', [0.052, 0, 0.030], root);+ // Steel shaft+ createPart('Idler1Shaft', cylinderGeo(0.003, 0.003, 0.080, 12), steelMat, {+ position: [0, 0.174, 0],+ parent: jointIdler1+ });+ // Stacked counter-pinions on Idler 1+ const idlerPinionData = [+ { y: 0.142, teeth: 18, root: 0.024, tip: 0.029 },+ { y: 0.154, teeth: 16, root: 0.020, tip: 0.025 },+ { y: 0.166, teeth: 14, root: 0.017, tip: 0.022 },+ { y: 0.178, teeth: 12, root: 0.014, tip: 0.019 },+ { y: 0.190, teeth: 10, root: 0.011, tip: 0.016 },+ { y: 0.202, teeth: 8, root: 0.008, tip: 0.013 }+ ];+ for (let k = 0; k < idlerPinionData.length; k++) {+ const p = idlerPinionData[k];+ const g = gearGeo({+ teeth: p.teeth,+ rootRadius: p.root,+ tipRadius: p.tip,+ boreRadius: 0.003,+ height: 0.005+ });+ createPart('IdlerPinion' + k, g, deepBronze, {+ position: [0, p.y, 0],+ parent: jointIdler1+ });+ }++ // Secondary Idler / Flywheel Shaft (Offset at [-0.048, 0, -0.032])+ const jointIdler2 = createPivot('IdlerArbor2', [-0.048, 0, -0.032], root);+ createPart('Idler2Shaft', cylinderGeo(0.003, 0.003, 0.080, 12), steelMat, {+ position: [0, 0.174, 0],+ parent: jointIdler2+ });+ // Transfer spur gear+ createPart('TransferGear', gearGeo({+ teeth: 26,+ rootRadius: 0.032,+ tipRadius: 0.038,+ boreRadius: 0.003,+ height: 0.005+ }), antiqueBrass, {+ position: [0, 0.150, 0],+ parent: jointIdler2+ });+ // Four-spoked brass flywheel with rim weights+ createPart('FlywheelRim', torusGeo(0.038, 0.0028, 8, 24), brightBrass, {+ position: [0, 0.188, 0],+ rotation: [90, 0, 0],+ parent: jointIdler2+ });+ createPart('FlywheelHub', cylinderGeo(0.007, 0.007, 0.007, 12), brightBrass, {+ position: [0, 0.188, 0],+ parent: jointIdler2+ });+ // 4 spokes and counterweights+ for (let s = 0; s < 4; s++) {+ const sang = (s / 4) * Math.PI * 2;+ const sx = Math.cos(sang) * 0.019;+ const sz = Math.sin(sang) * 0.019;+ createPart('Spoke' + s, cylinderGeo(0.0014, 0.0014, 0.036, 8), brightBrass, {+ position: [sx, 0.188, sz],+ rotation: [0, -sang * (180 / Math.PI), 90],+ parent: jointIdler2+ });+ const wx = Math.cos(sang) * 0.032;+ const wz = Math.sin(sang) * 0.032;+ createPart('Weight' + s, cylinderGeo(0.004, 0.004, 0.006, 10), antiqueBrass, {+ position: [wx, 0.188, wz],+ parent: jointIdler2+ });+ }++ // ==========================================+ // 5. SUN (Center Top)+ // ==========================================+ // Fluted capital supporting sun spindle+ createPart('SunCapital', cylinderGeo(0.016, 0.010, 0.018, 20), brightBrass, {+ position: [0, 0.370, 0],+ parent: root+ });+ createPart('SunNeckBead', torusGeo(0.014, 0.0025, 8, 20), brightBrass, {+ position: [0, 0.380, 0],+ rotation: [90, 0, 0],+ parent: root+ });+ createPart('SunSupportPin', cylinderGeo(0.004, 0.004, 0.024, 12), antiqueBrass, {+ position: [0, 0.395, 0],+ parent: root+ });+ // The Golden Sun+ createPart('SunSphere', sphereGeo(0.034, 24, 16), sunMat, {+ position: [0, 0.420, 0],+ parent: root+ });+ // Decorative solar meridian ring halo & radiant sun rays+ createPart('SunHaloRing', torusGeo(0.046, 0.002, 8, 32), brightBrass, {+ position: [0, 0.420, 0],+ rotation: [25, 30, 0],+ parent: root+ });+ // 8 Radiant solar rays+ for (let sr = 0; sr < 8; sr++) {+ const srad = (sr / 8) * Math.PI * 2;+ const rx = Math.cos(srad) * 0.042;+ const ry = Math.sin(srad) * 0.042;+ createPart('SunRay' + sr, coneGeo(0.0022, 0.014, 8), brightBrass, {+ position: [rx, 0.420 + ry, 0],+ rotation: [0, 0, -srad * (180 / Math.PI) - 90],+ parent: root+ });+ }++ // ==========================================+ // 6. PLANETARY ARMS, GEARS & SPHERES+ // ==========================================++ // --- MERCURY ---+ const jointMercury = createPivot('Mercury', [0, 0, 0], root);+ // Mercury Drive Gear (inside clockwork cage)+ createPart('MercuryGear', gearGeo({+ teeth: 16,+ rootRadius: 0.023,+ tipRadius: 0.028,+ boreRadius: 0.007,+ height: 0.005+ }), antiqueBrass, {+ position: [0, 0.142, 0],+ parent: jointMercury+ });+ // Concentric sleeve collar above cage+ createPart('MercuryCollar', cylinderGeo(0.022, 0.022, 0.012, 20), brightBrass, {+ position: [0, 0.224, 0],+ parent: jointMercury+ });+ createPart('MercuryCollarBead', torusGeo(0.023, 0.002, 8, 20), antiqueBrass, {+ position: [0, 0.228, 0],+ rotation: [90, 0, 0],+ parent: jointMercury+ });+ // Swept brass support arm+ const mercuryArmGeo = pipeAlongPath([+ [0.022, 0.226, 0],+ [0.045, 0.228, 0],+ [0.082, 0.270, 0],+ [0.082, 0.370, 0]+ ], 0.0022, { bendRadius: 0.020 });+ createPart('MercuryArm', mercuryArmGeo, brightBrass, { parent: jointMercury });+ // Planet cup & sphere+ createPart('MercuryCup', cylinderGeo(0.005, 0.003, 0.006, 12), brightBrass, {+ position: [0.082, 0.372, 0],+ parent: jointMercury+ });+ createPart('MercurySphere', sphereGeo(0.007, 14, 10), mercuryMat, {+ position: [0.082, 0.380, 0],+ parent: jointMercury+ });++ // --- VENUS ---+ const jointVenus = createPivot('Venus', [0, 0, 0], root);+ // Venus Drive Gear+ createPart('VenusGear', gearGeo({+ teeth: 22,+ rootRadius: 0.032,+ tipRadius: 0.038,+ boreRadius: 0.008,+ height: 0.005+ }), antiqueBrass, {+ position: [0, 0.154, 0],+ parent: jointVenus+ });+ // Collar+ createPart('VenusCollar', cylinderGeo(0.020, 0.020, 0.012, 20), brightBrass, {+ position: [0, 0.242, 0],+ parent: jointVenus+ });+ createPart('VenusCollarBead', torusGeo(0.021, 0.002, 8, 20), antiqueBrass, {+ position: [0, 0.246, 0],+ rotation: [90, 0, 0],+ parent: jointVenus+ });+ // Swept brass arm+ const venusArmGeo = pipeAlongPath([+ [0.020, 0.244, 0],+ [0.065, 0.246, 0],+ [0.135, 0.290, 0],+ [0.135, 0.370, 0]+ ], 0.0025, { bendRadius: 0.025 });+ createPart('VenusArm', venusArmGeo, brightBrass, { parent: jointVenus });+ // Cup & sphere+ createPart('VenusCup', cylinderGeo(0.006, 0.004, 0.007, 12), brightBrass, {+ position: [0.135, 0.372, 0],+ parent: jointVenus+ });+ createPart('VenusSphere', sphereGeo(0.011, 16, 12), venusMat, {+ position: [0.135, 0.385, 0],+ parent: jointVenus+ });++ // --- EARTH & MOON ---+ const jointEarth = createPivot('Earth', [0, 0, 0], root);+ // Earth Drive Gear+ createPart('EarthGear', gearGeo({+ teeth: 30,+ rootRadius: 0.042,+ tipRadius: 0.048,+ boreRadius: 0.009,+ height: 0.005+ }), antiqueBrass, {+ position: [0, 0.166, 0],+ parent: jointEarth+ });+ // Collar+ createPart('EarthCollar', cylinderGeo(0.018, 0.018, 0.012, 20), brightBrass, {+ position: [0, 0.260, 0],+ parent: jointEarth+ });+ createPart('EarthCollarBead', torusGeo(0.019, 0.002, 8, 20), antiqueBrass, {+ position: [0, 0.264, 0],+ rotation: [90, 0, 0],+ parent: jointEarth+ });+ // Swept brass arm+ const earthArmGeo = pipeAlongPath([+ [0.018, 0.262, 0],+ [0.080, 0.264, 0],+ [0.198, 0.300, 0],+ [0.198, 0.364, 0]+ ], 0.0028, { bendRadius: 0.030 });+ createPart('EarthArm', earthArmGeo, brightBrass, { parent: jointEarth });+ // Earth platform bracket+ createPart('EarthPlatform', cylinderGeo(0.010, 0.010, 0.004, 16), brightBrass, {+ position: [0.198, 0.366, 0],+ parent: jointEarth+ });+ // Tilted polar brass axis pin (23.5° axial tilt)+ createPart('EarthPolarAxis', cylinderGeo(0.0016, 0.0016, 0.036, 8), steelMat, {+ position: [0.198, 0.384, 0],+ rotation: [0, 0, 23.5],+ parent: jointEarth+ });+ // Earth globe+ createPart('EarthSphere', sphereGeo(0.013, 18, 12), earthMat, {+ position: [0.198, 0.384, 0],+ parent: jointEarth+ });++ // Animated Moon Sub-mechanism+ const jointMoon = createPivot('Moon', [0.198, 0.384, 0], jointEarth);+ // Miniature Moon ring gear underneath Earth+ createPart('MoonDriveGear', gearGeo({+ teeth: 12,+ rootRadius: 0.006,+ tipRadius: 0.0085,+ boreRadius: 0.002,+ height: 0.002+ }), antiqueBrass, {+ position: [0, -0.012, 0],+ parent: jointMoon+ });+ // Curved brass wire arm for the Moon+ const moonWireGeo = pipeAlongPath([+ [0, -0.012, 0],+ [0.018, -0.010, 0],+ [0.028, 0, 0]+ ], 0.0012, { bendRadius: 0.006 });+ createPart('MoonArmWire', moonWireGeo, brightBrass, { parent: jointMoon });+ // Pearl Moon+ createPart('MoonSphere', sphereGeo(0.0042, 10, 8), moonMat, {+ position: [0.028, 0, 0],+ parent: jointMoon+ });++ // --- MARS ---+ const jointMars = createPivot('Mars', [0, 0, 0], root);+ // Mars Drive Gear+ createPart('MarsGear', gearGeo({+ teeth: 38,+ rootRadius: 0.050,+ tipRadius: 0.057,+ boreRadius: 0.010,+ height: 0.005+ }), antiqueBrass, {+ position: [0, 0.178, 0],+ parent: jointMars+ });+ // Collar+ createPart('MarsCollar', cylinderGeo(0.016, 0.016, 0.012, 20), brightBrass, {+ position: [0, 0.278, 0],+ parent: jointMars+ });+ createPart('MarsCollarBead', torusGeo(0.017, 0.002, 8, 20), antiqueBrass, {+ position: [0, 0.282, 0],+ rotation: [90, 0, 0],+ parent: jointMars+ });+ // Swept brass arm+ const marsArmGeo = pipeAlongPath([+ [0.016, 0.280, 0],+ [0.095, 0.282, 0],+ [0.262, 0.310, 0],+ [0.262, 0.368, 0]+ ], 0.0030, { bendRadius: 0.035 });+ createPart('MarsArm', marsArmGeo, brightBrass, { parent: jointMars });+ // Cup & sphere+ createPart('MarsCup', cylinderGeo(0.005, 0.0035, 0.006, 12), brightBrass, {+ position: [0.262, 0.370, 0],+ parent: jointMars+ });+ createPart('MarsSphere', sphereGeo(0.009, 16, 12), marsMat, {+ position: [0.262, 0.381, 0],+ parent: jointMars+ });++ // --- JUPITER ---+ const jointJupiter = createPivot('Jupiter', [0, 0, 0], root);+ // Jupiter Drive Gear+ createPart('JupiterGear', gearGeo({+ teeth: 46,+ rootRadius: 0.058,+ tipRadius: 0.065,+ boreRadius: 0.011,+ height: 0.005+ }), antiqueBrass, {+ position: [0, 0.190, 0],+ parent: jointJupiter+ });+ // Collar+ createPart('JupiterCollar', cylinderGeo(0.014, 0.014, 0.012, 20), brightBrass, {+ position: [0, 0.296, 0],+ parent: jointJupiter+ });+ createPart('JupiterCollarBead', torusGeo(0.015, 0.002, 8, 20), antiqueBrass, {+ position: [0, 0.300, 0],+ rotation: [90, 0, 0],+ parent: jointJupiter+ });+ // Swept brass arm+ const jupiterArmGeo = pipeAlongPath([+ [0.014, 0.298, 0],+ [0.115, 0.300, 0],+ [0.332, 0.320, 0],+ [0.332, 0.362, 0]+ ], 0.0034, { bendRadius: 0.040 });+ createPart('JupiterArm', jupiterArmGeo, brightBrass, { parent: jointJupiter });+ // Cup & large sphere+ createPart('JupiterCup', cylinderGeo(0.009, 0.006, 0.008, 16), brightBrass, {+ position: [0.332, 0.365, 0],+ parent: jointJupiter+ });+ createPart('JupiterSphere', sphereGeo(0.022, 22, 16), jupiterMat, {+ position: [0.332, 0.392, 0],+ parent: jointJupiter+ });+ // Galilean moons bracket & 4 moon pins+ createPart('JupiterMoonBar', cylinderGeo(0.001, 0.001, 0.076, 8), brightBrass, {+ position: [0.332, 0.392, 0],+ rotation: [90, 0, 0],+ parent: jointJupiter+ });+ const moonOffsets = [-0.035, -0.024, 0.024, 0.035];+ for (let m = 0; m < 4; m++) {+ createPart('GalileanMoon' + m, sphereGeo(0.0022, 8, 6), brightBrass, {+ position: [0.332, 0.392, moonOffsets[m]],+ parent: jointJupiter+ });+ }++ // --- SATURN ---+ const jointSaturn = createPivot('Saturn', [0, 0, 0], root);+ // Saturn Drive Gear+ createPart('SaturnGear', gearGeo({+ teeth: 54,+ rootRadius: 0.066,+ tipRadius: 0.073,+ boreRadius: 0.012,+ height: 0.005+ }), antiqueBrass, {+ position: [0, 0.202, 0],+ parent: jointSaturn+ });+ // Collar+ createPart('SaturnCollar', cylinderGeo(0.012, 0.012, 0.012, 20), brightBrass, {+ position: [0, 0.314, 0],+ parent: jointSaturn+ });+ createPart('SaturnCollarBead', torusGeo(0.013, 0.002, 8, 20), antiqueBrass, {+ position: [0, 0.318, 0],+ rotation: [90, 0, 0],+ parent: jointSaturn+ });+ // Swept brass arm+ const saturnArmGeo = pipeAlongPath([+ [0.012, 0.316, 0],+ [0.130, 0.318, 0],+ [0.412, 0.330, 0],+ [0.412, 0.362, 0]+ ], 0.0036, { bendRadius: 0.045 });+ createPart('SaturnArm', saturnArmGeo, brightBrass, { parent: jointSaturn });+ // Cup, sphere & ring+ createPart('SaturnCup', cylinderGeo(0.008, 0.005, 0.008, 16), brightBrass, {+ position: [0.412, 0.365, 0],+ parent: jointSaturn+ });+ createPart('SaturnSphere', sphereGeo(0.018, 20, 14), saturnMat, {+ position: [0.412, 0.390, 0],+ parent: jointSaturn+ });+ // Concentric tilted brass rings+ createPart('SaturnRingMain', torusGeo(0.030, 0.0020, 8, 36), saturnRingMat, {+ position: [0.412, 0.390, 0],+ rotation: [22, 0, 15],+ parent: jointSaturn+ });+ createPart('SaturnRingOuter', torusGeo(0.036, 0.0010, 8, 36), saturnRingMat, {+ position: [0.412, 0.390, 0],+ rotation: [22, 0, 15],+ parent: jointSaturn+ });+ // Celestial initial epoch (planets distributed aesthetically around the Sun)+ jointMercury.rotation.y = (45 * Math.PI) / 180;+ jointVenus.rotation.y = (130 * Math.PI) / 180;+ jointEarth.rotation.y = (220 * Math.PI) / 180;+ jointMars.rotation.y = (315 * Math.PI) / 180;+ jointJupiter.rotation.y = (80 * Math.PI) / 180;+ jointSaturn.rotation.y = (170 * Math.PI) / 180;++ return root;+}++// ==========================================+// 7. ANIMATION+// ==========================================+function makeSpinTrack(jointName, totalDuration, turns, axis = 'y', initialDeg = 0) {+ const stepsPerTurn = 4;+ const totalSteps = Math.max(4, Math.round(Math.abs(turns) * stepsPerTurn));+ const keyframes = [];+ for (let i = 0; i <= totalSteps; i++) {+ const fraction = i / totalSteps;+ const time = fraction * totalDuration;+ const deg = initialDeg + fraction * turns * 360;+ const rot = axis === 'y' ? [0, deg, 0] : axis === 'x' ? [deg, 0, 0] : [0, 0, deg];+ keyframes.push({ time, rotation: rot });+ }+ return rotationTrack(jointName, keyframes);+}++function animate(root) {+ const T = 24; // 24-second seamlessly looping clockwork cycle++ const tracks = [+ // Hand crank turns 24 times around X axis (1 turn/sec)+ makeSpinTrack('Joint_Crank', T, 24, 'x'),++ // Counter-gear idler arbors turn in sync with clockwork+ makeSpinTrack('Joint_IdlerArbor1', T, -12, 'y'),+ makeSpinTrack('Joint_IdlerArbor2', T, 24, 'y'),++ // Planetary orbits: harmonious integer/rational cycle counts with initial angles+ makeSpinTrack('Joint_Mercury', T, 8, 'y', 45), // Mercury completes 8 orbits+ makeSpinTrack('Joint_Venus', T, 4, 'y', 130), // Venus completes 4 orbits+ makeSpinTrack('Joint_Earth', T, 2, 'y', 220), // Earth completes 2 orbits+ makeSpinTrack('Joint_Moon', T, 24, 'y', 0), // Moon completes 24 orbits around Earth (12 per year)+ makeSpinTrack('Joint_Mars', T, 1, 'y', 315), // Mars completes 1 orbit+ makeSpinTrack('Joint_Jupiter', T, 0.5, 'y', 80), // Jupiter completes 0.5 orbit+ makeSpinTrack('Joint_Saturn', T, 0.25, 'y', 170) // Saturn completes 0.25 orbit+ ];++ return [createClip('OrreryMotion', T, tracks)];+}diff --git a/site/examples/history/demo-clockwork-dragonfly/history.json b/site/examples/history/demo-clockwork-dragonfly/history.jsonnew file mode 100644index 00000000..b05e7df0--- /dev/null+++ b/site/examples/history/demo-clockwork-dragonfly/history.json@@ -0,0 +1,22 @@+{+ "version": 1,+ "brief": {+ "kind": "recorded",+ "text": "Broader emerald wings with rounded brass-rimmed tips"+ },+ "currentSourceHash": "824ce3887151b2a551a7c1bd09a09924f9cb46bd6dd43b2606e2d1a3b7fc0317",+ "revisions": [+ {+ "file": "revision-1.kiln.js",+ "title": "Saved revision 1",+ "description": "Mechanical dragonfly with emerald wings and brass gears",+ "sourceHash": "4ea377d1003135e677483730e90b47c8bcdc79d842832985d971dabcf3fa6207"+ },+ {+ "file": "revision-2.kiln.js",+ "title": "Saved revision 2",+ "description": "Broader emerald wings with rounded brass-rimmed tips",+ "sourceHash": "824ce3887151b2a551a7c1bd09a09924f9cb46bd6dd43b2606e2d1a3b7fc0317"+ }+ ]+}diff --git a/site/examples/history/demo-clockwork-dragonfly/revision-1.kiln.js b/site/examples/history/demo-clockwork-dragonfly/revision-1.kiln.jsnew file mode 100644index 00000000..21cb6b52--- /dev/null+++ b/site/examples/history/demo-clockwork-dragonfly/revision-1.kiln.js@@ -0,0 +1,163 @@+const meta = { name: 'Mechanical Dragonfly', category: 'prop', role: 'prop' };++function build() {+ const root = createRoot('MechanicalDragonfly');++ // Materials+ const brass = gameMaterial(0xc9973f, { metalness: 0.9, roughness: 0.32 });+ const darkBrass = gameMaterial(0x7a5a28, { metalness: 0.85, roughness: 0.45 });+ const copper = gameMaterial(0xa66a3a, { metalness: 0.9, roughness: 0.35 });+ const darkSteel = gameMaterial(0x3a3f44, { metalness: 0.8, roughness: 0.5 });+ const emeraldGlass = glassMaterial(0x1fd47a, { opacity: 0.5, roughness: 0.15 });+ const emeraldSolid = gameMaterial(0x0fae5f, { metalness: 0.3, roughness: 0.3, emissive: 0x0a5c34, emissiveIntensity: 0.6 });+ const eyeMat = gameMaterial(0x0fd67c, { metalness: 0.2, roughness: 0.2, emissive: 0x0bd86e, emissiveIntensity: 0.9 });++ const bodyY = 0.6;++ // Thorax — main brass barrel along X+ createPart('Thorax', capsuleGeo(0.14, 0.28, 8), brass, {+ position: [0.15, bodyY, 0], rotation: [0, 0, 90], parent: root+ });+ // Thorax top housing / wing motor case+ createPart('WingCase', boxGeo(0.34, 0.1, 0.2), darkBrass, {+ position: [0.12, bodyY + 0.12, 0], parent: root+ });+ // Thorax belly plate+ createPart('BellyPlate', boxGeo(0.3, 0.04, 0.12), copper, {+ position: [0.15, bodyY - 0.13, 0], parent: root+ });+ // Thorax front collar+ createPart('Collar', torusGeo(0.11, 0.025, 8, 20), copper, {+ position: [0.34, bodyY, 0], rotation: [0, 90, 0], parent: root+ });++ // Head+ createPart('Head', sphereGeo(0.105, 16, 12), darkBrass, {+ position: [0.5, bodyY + 0.02, 0], parent: root+ });+ createPart('EyeR', sphereGeo(0.058, 14, 10), eyeMat, {+ position: [0.55, bodyY + 0.07, 0.07], parent: root+ });+ createPart('EyeL', sphereGeo(0.058, 14, 10), eyeMat, {+ position: [0.55, bodyY + 0.07, -0.07], parent: root+ });+ // Mandibles / snout+ createPart('Snout', cylinderGeo(0.035, 0.055, 0.12, 10), brass, {+ position: [0.6, bodyY - 0.01, 0], rotation: [0, 0, -90], parent: root+ });+ // Antennae+ beamBetween('AntennaR', [0.57, bodyY + 0.09, 0.03], [0.78, bodyY + 0.22, 0.1], 0.008, darkSteel, { parent: root });+ beamBetween('AntennaL', [0.57, bodyY + 0.09, -0.03], [0.78, bodyY + 0.22, -0.1], 0.008, darkSteel, { parent: root });+ createPart('AntennaTipR', sphereGeo(0.015, 8, 6), emeraldSolid, { position: [0.78, bodyY + 0.22, 0.1], parent: root });+ createPart('AntennaTipL', sphereGeo(0.015, 8, 6), emeraldSolid, { position: [0.78, bodyY + 0.22, -0.1], parent: root });++ // Abdomen — 6 tapering segments along -X+ const segX = [-0.08, -0.22, -0.36, -0.49, -0.61, -0.72];+ const segR = [0.095, 0.085, 0.073, 0.06, 0.047, 0.035];+ for (let i = 0; i < segX.length; i++) {+ const x = segX[i];+ const r = segR[i];+ createPart('AbdomenSeg' + i, cylinderGeo(r * 0.92, r, 0.14, 14), i % 2 === 0 ? brass : copper, {+ position: [x, bodyY - 0.01 - i * 0.008, 0], rotation: [0, 0, 90], parent: root+ });+ // segment ring+ createPart('AbdomenRing' + i, torusGeo(r, 0.012, 6, 18), darkBrass, {+ position: [x + 0.06, bodyY - 0.01 - i * 0.008, 0], rotation: [0, 90, 0], parent: root+ });+ }+ // Tail tip stinger+ createPart('TailTip', coneGeo(0.032, 0.12, 12), darkSteel, {+ position: [-0.83, bodyY - 0.06, 0], rotation: [0, 0, 90], parent: root+ });+ createPart('TailJewel', sphereGeo(0.022, 10, 8), emeraldSolid, {+ position: [-0.74, bodyY + 0.005, 0], parent: root+ });++ // Exposed brass gears on both flanks+ function sideGears(side) {+ const z = 0.14 * side;+ const pivMain = createPivot('GearR_Main_' + (side > 0 ? 'R' : 'L'), [0.14, bodyY, z], root);+ createPart('GearMain_' + (side > 0 ? 'R' : 'L'),+ gearGeo({ teeth: 18, rootRadius: 0.085, tipRadius: 0.105, boreRadius: 0.02, height: 0.03 }),+ brass, { rotation: [90, 0, 0], parent: pivMain });+ createPart('GearHub_' + (side > 0 ? 'R' : 'L'), cylinderGeo(0.022, 0.022, 0.055, 10), darkSteel, {+ rotation: [90, 0, 0], parent: pivMain+ });++ const pivA = createPivot('GearR_Aft_' + (side > 0 ? 'R' : 'L'), [-0.03, bodyY + 0.02, z], root);+ createPart('GearAft_' + (side > 0 ? 'R' : 'L'),+ gearGeo({ teeth: 14, rootRadius: 0.058, tipRadius: 0.072, boreRadius: 0.014, height: 0.028 }),+ copper, { rotation: [90, 0, 0], parent: pivA });++ const pivS = createPivot('GearR_Small_' + (side > 0 ? 'R' : 'L'), [0.28, bodyY - 0.02, z * 0.95], root);+ createPart('GearSmall_' + (side > 0 ? 'R' : 'L'),+ gearGeo({ teeth: 10, rootRadius: 0.038, tipRadius: 0.05, boreRadius: 0.01, height: 0.026 }),+ brass, { rotation: [90, 0, 0], parent: pivS });+ return { pivMain, pivA, pivS };+ }+ sideGears(1);+ sideGears(-1);++ // Emerald wings — 4 panels+ function makeWing(name, px, pz, span, rootChord, tipChord, sweep, mirror) {+ const pivot = createPivot(name, [px, bodyY + 0.17, pz], root);+ const geo = wingGeo({ span: span, rootChord: rootChord, tipChord: tipChord, sweep: sweep, thickness: 0.008, dihedral: 0.04 });+ // mirror left wings across Z+ const rot = mirror ? [180, 0, 0] : [0, 0, 0];+ createPart(name + 'Panel', geo, emeraldGlass, { rotation: rot, parent: pivot });+ // brass leading-edge spar + 2 veins (right side coords; mirrored via pivot rotation)+ // brass leading-edge spar + 2 veins lying on the panel top surface+ const dir = mirror ? -1 : 1;+ const leadRootX = 0.0, leadTipX = -sweep;+ beamBetween(name + 'Spar', [leadRootX, 0.008, 0.01 * dir], [leadTipX, 0.012, (span - 0.01) * dir], 0.009, brass, { parent: pivot });+ beamBetween(name + 'VeinA', [-rootChord * 0.3, 0.007, 0.08 * dir], [leadTipX - 0.03, 0.01, span * 0.8 * dir], 0.0045, darkBrass, { parent: pivot });+ beamBetween(name + 'VeinB', [-rootChord * 0.55, 0.007, 0.06 * dir], [leadTipX - 0.05, 0.01, span * 0.62 * dir], 0.0045, darkBrass, { parent: pivot });+ // wing root cap+ createPart(name + 'Root', boxGeo(0.1, 0.025, 0.06), brass, {+ position: [0, 0, 0.02 * dir], parent: pivot+ });+ return pivot;+ }+ makeWing('WingFrontR', 0.22, 0.09, 0.68, 0.22, 0.08, 0.22, false);+ makeWing('WingFrontL', 0.22, -0.09, 0.68, 0.22, 0.08, 0.22, true);+ makeWing('WingRearR', 0.0, 0.09, 0.58, 0.18, 0.07, 0.18, false);+ makeWing('WingRearL', 0.0, -0.09, 0.58, 0.18, 0.07, 0.18, true);++ // Six brass legs down to ground+ function leg(name, hipX, side, kneeSpread, footSpread, hipY) {+ const hx = hipX, hz = 0.08 * side;+ const kx = hipX - 0.05, ky = 0.32, kz = (0.08 + kneeSpread) * side;+ const fx = hipX - 0.02, fy = 0.016, fz = (0.08 + footSpread) * side;+ beamBetween(name + 'Upper', [hx, hipY, hz], [kx, ky, kz], 0.014, brass, { parent: root });+ beamBetween(name + 'Lower', [kx, ky, kz], [fx, fy, fz], 0.01, darkBrass, { parent: root });+ createPart(name + 'Hip', sphereGeo(0.025, 10, 8), copper, { position: [hx, hipY, hz], parent: root });+ createPart(name + 'Knee', sphereGeo(0.018, 8, 6), copper, { position: [kx, ky, kz], parent: root });+ createPart(name + 'Foot', sphereGeo(0.016, 8, 6), darkSteel, { position: [fx, fy, fz], parent: root });+ }+ leg('LegFrontR', 0.3, 1, 0.12, 0.2, bodyY - 0.1);+ leg('LegFrontL', 0.3, -1, 0.12, 0.2, bodyY - 0.1);+ leg('LegMidR', 0.14, 1, 0.16, 0.26, bodyY - 0.12);+ leg('LegMidL', 0.14, -1, 0.16, 0.26, bodyY - 0.12);+ leg('LegRearR', -0.02, 1, 0.15, 0.24, bodyY - 0.11);+ leg('LegRearL', -0.02, -1, 0.15, 0.24, bodyY - 0.11);++ // Legs provide ground contact via feet near Y=0+ return root;+}++function animate(root) {+ return [+ createClip('GearSpin', 2, [+ rotationTrack('Joint_GearR_Main_R', [{ time: 0, rotation: [0, 0, 0] }, { time: 2, rotation: [0, 0, 360] }]),+ rotationTrack('Joint_GearR_Main_L', [{ time: 0, rotation: [0, 0, 0] }, { time: 2, rotation: [0, 0, -360] }]),+ rotationTrack('Joint_GearR_Aft_R', [{ time: 0, rotation: [0, 0, 0] }, { time: 2, rotation: [0, 0, -360] }]),+ rotationTrack('Joint_GearR_Aft_L', [{ time: 0, rotation: [0, 0, 0] }, { time: 2, rotation: [0, 0, 360] }]),+ ]),+ createClip('WingFlap', 1.2, [+ rotationTrack('Joint_WingFrontR', [{ time: 0, rotation: [0, 0, 0] }, { time: 0.3, rotation: [-18, 0, 0] }, { time: 0.6, rotation: [0, 0, 0] }, { time: 0.9, rotation: [-18, 0, 0] }, { time: 1.2, rotation: [0, 0, 0] }]),+ rotationTrack('Joint_WingFrontL', [{ time: 0, rotation: [0, 0, 0] }, { time: 0.3, rotation: [18, 0, 0] }, { time: 0.6, rotation: [0, 0, 0] }, { time: 0.9, rotation: [18, 0, 0] }, { time: 1.2, rotation: [0, 0, 0] }]),+ rotationTrack('Joint_WingRearR', [{ time: 0, rotation: [0, 0, 0] }, { time: 0.3, rotation: [-22, 0, 0] }, { time: 0.6, rotation: [0, 0, 0] }, { time: 0.9, rotation: [-22, 0, 0] }, { time: 1.2, rotation: [0, 0, 0] }]),+ rotationTrack('Joint_WingRearL', [{ time: 0, rotation: [0, 0, 0] }, { time: 0.3, rotation: [22, 0, 0] }, { time: 0.6, rotation: [0, 0, 0] }, { time: 0.9, rotation: [22, 0, 0] }, { time: 1.2, rotation: [0, 0, 0] }]),+ ])+ ];+}diff --git a/site/examples/history/demo-clockwork-dragonfly/revision-2.kiln.js b/site/examples/history/demo-clockwork-dragonfly/revision-2.kiln.jsnew file mode 100644index 00000000..5eef31b6--- /dev/null+++ b/site/examples/history/demo-clockwork-dragonfly/revision-2.kiln.js@@ -0,0 +1,172 @@+const meta = { name: 'Mechanical Dragonfly', category: 'prop', role: 'prop' };++function build() {+ const root = createRoot('MechanicalDragonfly');++ // Materials+ const brass = gameMaterial(0xc9973f, { metalness: 0.9, roughness: 0.32 });+ const darkBrass = gameMaterial(0x7a5a28, { metalness: 0.85, roughness: 0.45 });+ const copper = gameMaterial(0xa66a3a, { metalness: 0.9, roughness: 0.35 });+ const darkSteel = gameMaterial(0x3a3f44, { metalness: 0.8, roughness: 0.5 });+ const emeraldGlass = glassMaterial(0x1fd47a, { opacity: 0.5, roughness: 0.15 });+ const emeraldSolid = gameMaterial(0x0fae5f, { metalness: 0.3, roughness: 0.3, emissive: 0x0a5c34, emissiveIntensity: 0.6 });+ const eyeMat = gameMaterial(0x0fd67c, { metalness: 0.2, roughness: 0.2, emissive: 0x0bd86e, emissiveIntensity: 0.9 });++ const bodyY = 0.6;++ // Thorax — main brass barrel along X+ createPart('Thorax', capsuleGeo(0.14, 0.28, 8), brass, {+ position: [0.15, bodyY, 0], rotation: [0, 0, 90], parent: root+ });+ // Thorax top housing / wing motor case+ createPart('WingCase', boxGeo(0.34, 0.1, 0.2), darkBrass, {+ position: [0.12, bodyY + 0.12, 0], parent: root+ });+ // Thorax belly plate+ createPart('BellyPlate', boxGeo(0.3, 0.04, 0.12), copper, {+ position: [0.15, bodyY - 0.13, 0], parent: root+ });+ // Thorax front collar+ createPart('Collar', torusGeo(0.11, 0.025, 8, 20), copper, {+ position: [0.34, bodyY, 0], rotation: [0, 90, 0], parent: root+ });++ // Head+ createPart('Head', sphereGeo(0.105, 16, 12), darkBrass, {+ position: [0.5, bodyY + 0.02, 0], parent: root+ });+ createPart('EyeR', sphereGeo(0.058, 14, 10), eyeMat, {+ position: [0.55, bodyY + 0.07, 0.07], parent: root+ });+ createPart('EyeL', sphereGeo(0.058, 14, 10), eyeMat, {+ position: [0.55, bodyY + 0.07, -0.07], parent: root+ });+ // Mandibles / snout+ createPart('Snout', cylinderGeo(0.035, 0.055, 0.12, 10), brass, {+ position: [0.6, bodyY - 0.01, 0], rotation: [0, 0, -90], parent: root+ });+ // Antennae+ beamBetween('AntennaR', [0.57, bodyY + 0.09, 0.03], [0.78, bodyY + 0.22, 0.1], 0.008, darkSteel, { parent: root });+ beamBetween('AntennaL', [0.57, bodyY + 0.09, -0.03], [0.78, bodyY + 0.22, -0.1], 0.008, darkSteel, { parent: root });+ createPart('AntennaTipR', sphereGeo(0.015, 8, 6), emeraldSolid, { position: [0.78, bodyY + 0.22, 0.1], parent: root });+ createPart('AntennaTipL', sphereGeo(0.015, 8, 6), emeraldSolid, { position: [0.78, bodyY + 0.22, -0.1], parent: root });++ // Abdomen — 6 tapering segments along -X+ const segX = [-0.08, -0.22, -0.36, -0.49, -0.61, -0.72];+ const segR = [0.095, 0.085, 0.073, 0.06, 0.047, 0.035];+ for (let i = 0; i < segX.length; i++) {+ const x = segX[i];+ const r = segR[i];+ createPart('AbdomenSeg' + i, cylinderGeo(r * 0.92, r, 0.14, 14), i % 2 === 0 ? brass : copper, {+ position: [x, bodyY - 0.01 - i * 0.008, 0], rotation: [0, 0, 90], parent: root+ });+ // segment ring+ createPart('AbdomenRing' + i, torusGeo(r, 0.012, 6, 18), darkBrass, {+ position: [x + 0.06, bodyY - 0.01 - i * 0.008, 0], rotation: [0, 90, 0], parent: root+ });+ }+ // Tail tip stinger+ createPart('TailTip', coneGeo(0.032, 0.12, 12), darkSteel, {+ position: [-0.83, bodyY - 0.06, 0], rotation: [0, 0, 90], parent: root+ });+ createPart('TailJewel', sphereGeo(0.022, 10, 8), emeraldSolid, {+ position: [-0.74, bodyY + 0.005, 0], parent: root+ });++ // Exposed brass gears on both flanks+ function sideGears(side) {+ const z = 0.14 * side;+ const pivMain = createPivot('GearR_Main_' + (side > 0 ? 'R' : 'L'), [0.14, bodyY, z], root);+ createPart('GearMain_' + (side > 0 ? 'R' : 'L'),+ gearGeo({ teeth: 18, rootRadius: 0.085, tipRadius: 0.105, boreRadius: 0.02, height: 0.03 }),+ brass, { rotation: [90, 0, 0], parent: pivMain });+ createPart('GearHub_' + (side > 0 ? 'R' : 'L'), cylinderGeo(0.022, 0.022, 0.055, 10), darkSteel, {+ rotation: [90, 0, 0], parent: pivMain+ });++ const pivA = createPivot('GearR_Aft_' + (side > 0 ? 'R' : 'L'), [-0.03, bodyY + 0.02, z], root);+ createPart('GearAft_' + (side > 0 ? 'R' : 'L'),+ gearGeo({ teeth: 14, rootRadius: 0.058, tipRadius: 0.072, boreRadius: 0.014, height: 0.028 }),+ copper, { rotation: [90, 0, 0], parent: pivA });++ const pivS = createPivot('GearR_Small_' + (side > 0 ? 'R' : 'L'), [0.28, bodyY - 0.02, z * 0.95], root);+ createPart('GearSmall_' + (side > 0 ? 'R' : 'L'),+ gearGeo({ teeth: 10, rootRadius: 0.038, tipRadius: 0.05, boreRadius: 0.01, height: 0.026 }),+ brass, { rotation: [90, 0, 0], parent: pivS });+ return { pivMain, pivA, pivS };+ }+ sideGears(1);+ sideGears(-1);++ // Emerald wings — 4 panels+ function makeWing(name, px, pz, span, rootChord, tipChord, sweep, mirror) {+ const pivot = createPivot(name, [px, bodyY + 0.17, pz], root);+ const geo = wingGeo({ span: span, rootChord: rootChord, tipChord: tipChord, sweep: sweep, thickness: 0.008, dihedral: 0.04 });+ // mirror left wings across Z+ const rot = mirror ? [180, 0, 0] : [0, 0, 0];+ createPart(name + 'Panel', geo, emeraldGlass, { rotation: rot, parent: pivot });+ // brass leading-edge spar + 2 veins lying on the panel top surface+ const dir = mirror ? -1 : 1;+ const leadRootX = 0.0, leadTipX = -sweep;+ beamBetween(name + 'Spar', [leadRootX, 0.008, 0.01 * dir], [leadTipX, 0.012, (span - 0.01) * dir], 0.009, brass, { parent: pivot });+ beamBetween(name + 'VeinA', [-rootChord * 0.3, 0.007, 0.08 * dir], [leadTipX - 0.03, 0.01, span * 0.8 * dir], 0.0045, darkBrass, { parent: pivot });+ beamBetween(name + 'VeinB', [-rootChord * 0.55, 0.007, 0.06 * dir], [leadTipX - 0.05, 0.01, span * 0.62 * dir], 0.0045, darkBrass, { parent: pivot });+ // rounded emerald tip cap with brass rim (broad rounded tip)+ const tipR = tipChord / 2;+ const tipCX = -sweep;+ const tipCZ = (span - tipR * 0.3) * dir;+ createPart(name + 'TipCap', cylinderGeo(tipR, tipR, 0.007, 20), emeraldGlass, {+ position: [tipCX, 0.009, tipCZ], parent: pivot+ });+ createPart(name + 'TipRim', torusGeo(tipR, 0.006, 6, 24), brass, {+ position: [tipCX, 0.009, tipCZ], rotation: [90, 0, 0], parent: pivot+ });+ // wing root cap+ createPart(name + 'Root', boxGeo(0.1, 0.025, 0.06), brass, {+ position: [0, 0, 0.02 * dir], parent: pivot+ });+ return pivot;+ }+ makeWing('WingFrontR', 0.22, 0.09, 0.68, 0.32, 0.2, 0.22, false);+ makeWing('WingFrontL', 0.22, -0.09, 0.68, 0.32, 0.2, 0.22, true);+ makeWing('WingRearR', 0.0, 0.09, 0.58, 0.28, 0.17, 0.18, false);+ makeWing('WingRearL', 0.0, -0.09, 0.58, 0.28, 0.17, 0.18, true);++ // Six brass legs down to ground+ function leg(name, hipX, side, kneeSpread, footSpread, hipY) {+ const hx = hipX, hz = 0.08 * side;+ const kx = hipX - 0.05, ky = 0.32, kz = (0.08 + kneeSpread) * side;+ const fx = hipX - 0.02, fy = 0.016, fz = (0.08 + footSpread) * side;+ beamBetween(name + 'Upper', [hx, hipY, hz], [kx, ky, kz], 0.014, brass, { parent: root });+ beamBetween(name + 'Lower', [kx, ky, kz], [fx, fy, fz], 0.01, darkBrass, { parent: root });+ createPart(name + 'Hip', sphereGeo(0.025, 10, 8), copper, { position: [hx, hipY, hz], parent: root });+ createPart(name + 'Knee', sphereGeo(0.018, 8, 6), copper, { position: [kx, ky, kz], parent: root });+ createPart(name + 'Foot', sphereGeo(0.016, 8, 6), darkSteel, { position: [fx, fy, fz], parent: root });+ }+ leg('LegFrontR', 0.3, 1, 0.12, 0.2, bodyY - 0.1);+ leg('LegFrontL', 0.3, -1, 0.12, 0.2, bodyY - 0.1);+ leg('LegMidR', 0.14, 1, 0.16, 0.26, bodyY - 0.12);+ leg('LegMidL', 0.14, -1, 0.16, 0.26, bodyY - 0.12);+ leg('LegRearR', -0.02, 1, 0.15, 0.24, bodyY - 0.11);+ leg('LegRearL', -0.02, -1, 0.15, 0.24, bodyY - 0.11);++ // Legs provide ground contact via feet near Y=0+ return root;+}++function animate(root) {+ return [+ createClip('GearSpin', 2, [+ rotationTrack('Joint_GearR_Main_R', [{ time: 0, rotation: [0, 0, 0] }, { time: 2, rotation: [0, 0, 360] }]),+ rotationTrack('Joint_GearR_Main_L', [{ time: 0, rotation: [0, 0, 0] }, { time: 2, rotation: [0, 0, -360] }]),+ rotationTrack('Joint_GearR_Aft_R', [{ time: 0, rotation: [0, 0, 0] }, { time: 2, rotation: [0, 0, -360] }]),+ rotationTrack('Joint_GearR_Aft_L', [{ time: 0, rotation: [0, 0, 0] }, { time: 2, rotation: [0, 0, 360] }]),+ ]),+ createClip('WingFlap', 1.2, [+ rotationTrack('Joint_WingFrontR', [{ time: 0, rotation: [0, 0, 0] }, { time: 0.3, rotation: [-18, 0, 0] }, { time: 0.6, rotation: [0, 0, 0] }, { time: 0.9, rotation: [-18, 0, 0] }, { time: 1.2, rotation: [0, 0, 0] }]),+ rotationTrack('Joint_WingFrontL', [{ time: 0, rotation: [0, 0, 0] }, { time: 0.3, rotation: [18, 0, 0] }, { time: 0.6, rotation: [0, 0, 0] }, { time: 0.9, rotation: [18, 0, 0] }, { time: 1.2, rotation: [0, 0, 0] }]),+ rotationTrack('Joint_WingRearR', [{ time: 0, rotation: [0, 0, 0] }, { time: 0.3, rotation: [-22, 0, 0] }, { time: 0.6, rotation: [0, 0, 0] }, { time: 0.9, rotation: [-22, 0, 0] }, { time: 1.2, rotation: [0, 0, 0] }]),+ rotationTrack('Joint_WingRearL', [{ time: 0, rotation: [0, 0, 0] }, { time: 0.3, rotation: [22, 0, 0] }, { time: 0.6, rotation: [0, 0, 0] }, { time: 0.9, rotation: [22, 0, 0] }, { time: 1.2, rotation: [0, 0, 0] }]),+ ])+ ];+}diff --git a/site/examples/history/demo-dauntless-cv-08/history.json b/site/examples/history/demo-dauntless-cv-08/history.jsonnew file mode 100644index 00000000..d4a42661--- /dev/null+++ b/site/examples/history/demo-dauntless-cv-08/history.json@@ -0,0 +1,22 @@+{+ "version": 1,+ "brief": {+ "kind": "recorded",+ "text": "Refine the four aircraft to bright safety orange and add a bold matching horizontal stripe beneath the bridge windows. Preserve hull, deck layout and runway markings."+ },+ "currentSourceHash": "898b76ec27eaa205897387b832de35a72d323dd468bad84510563452ee74505f",+ "revisions": [+ {+ "file": "revision-1.kiln.js",+ "title": "Saved revision 1",+ "description": "A striking game-ready stylized aircraft carrier with a long navy-blue hull, broad charcoal deck, crisp ivory runway markings, offset radar island, deck-edge lifts, and orange aircraft.",+ "sourceHash": "5af337b25115e07b6b94725d0b18635b56884ba0fe135df50d8fb2b428effcd3"+ },+ {+ "file": "revision-2.kiln.js",+ "title": "Saved revision 2",+ "description": "Refine the four aircraft to bright safety orange and add a bold matching horizontal stripe beneath the bridge windows. Preserve hull, deck layout and runway markings.",+ "sourceHash": "898b76ec27eaa205897387b832de35a72d323dd468bad84510563452ee74505f"+ }+ ]+}diff --git a/site/examples/history/demo-dauntless-cv-08/revision-1.kiln.js b/site/examples/history/demo-dauntless-cv-08/revision-1.kiln.jsnew file mode 100644index 00000000..7dbdbf1b--- /dev/null+++ b/site/examples/history/demo-dauntless-cv-08/revision-1.kiln.js@@ -0,0 +1,181 @@+const meta = { name: 'DAUNTLESS CV-08', category: 'vehicle', role: 'vehicle' };+const P = { deckY:12, length:122, hullBeam:21, deckBeam:30 };+function build() {+ const root=createRoot('Dauntless_CV08');+ const mats={+ navy:gameMaterial(0x193950,{metalness:.35,roughness:.63}),+ edge:gameMaterial(0x365970,{metalness:.4,roughness:.54}),+ dark:gameMaterial(0x17232b,{metalness:.25,roughness:.8}),+ deck:gameMaterial(0x30373c,{metalness:.15,roughness:.9}),+ ivory:gameMaterial(0xf3e8cc,{roughness:.7}),+ orange:gameMaterial(0xed742a,{metalness:.18,roughness:.52}),+ glass:gameMaterial(0x7cafb6,{metalness:.5,roughness:.26}),+ steel:gameMaterial(0x8b9da5,{metalness:.65,roughness:.48})+ };+ // Bake static surfaces into one mesh per material within each semantic assembly.+ function assembly(name,parent=root) {+ const g=new THREE.Group();g.name=name;parent.add(g);+ const buckets={};+ function add(geo,mat,pos=[0,0,0],rot=[0,0,0],scale=[1,1,1]){+ const own=geo.index?geo.toNonIndexed():geo.clone();+ const matrix=new THREE.Matrix4().compose(new THREE.Vector3(...pos),new THREE.Quaternion().setFromEuler(new THREE.Euler(...rot.map(v=>v*Math.PI/180))),new THREE.Vector3(...scale));+ own.applyMatrix4(matrix);+ if(!own.getAttribute('normal'))own.computeVertexNormals();+ (buckets[mat]||(buckets[mat]=[])).push(own);+ }+ function box(mat,size,pos,rot=[0,0,0]){add(boxGeo(...size),mat,pos,rot);}+ function cyl(mat,rt,rb,h,pos,rot=[0,0,0],seg=10){add(cylinderGeo(rt,rb,h,seg),mat,pos,rot);}+ function beam(mat,a,b,width){const va=new THREE.Vector3(...a),vb=new THREE.Vector3(...b);const d=vb.clone().sub(va);const geo=boxGeo(width,d.length(),width).clone();geo.applyQuaternion(new THREE.Quaternion().setFromUnitVectors(new THREE.Vector3(0,1,0),d.normalize()));add(geo,mat,va.add(vb).multiplyScalar(.5).toArray());}+ function plate(mat,outline,y,h){const s=new THREE.Shape();outline.forEach(([x,z],i)=>i?s.lineTo(x,-z):s.moveTo(x,-z));s.closePath();const geo=new THREE.ExtrudeGeometry(s,{depth:h,bevelEnabled:false,steps:1,curveSegments:1});geo.rotateX(-Math.PI/2);add(geo,mat,[0,y,0]);}+ function finish(){+ for(const key of Object.keys(buckets)){const geos=buckets[key],p=[],n=[],uv=[];+ for(const geo of geos){const pa=geo.getAttribute('position'),na=geo.getAttribute('normal'),ua=geo.getAttribute('uv');+ for(let i=0;i<pa.count;i++){p.push(pa.getX(i),pa.getY(i),pa.getZ(i));n.push(na.getX(i),na.getY(i),na.getZ(i));uv.push(ua?ua.getX(i):0,ua?ua.getY(i):0);}+ }+ const merged=new THREE.BufferGeometry();merged.setAttribute('position',new THREE.Float32BufferAttribute(p,3));merged.setAttribute('normal',new THREE.Float32BufferAttribute(n,3));merged.setAttribute('uv',new THREE.Float32BufferAttribute(uv,2));+ createPart(name+'_'+key,merged,mats[key],{parent:g});+ }return g;+ }+ return {g,add,box,cyl,beam,plate,finish};+ }+ const hullOutline=[[-56,-7],[-49,-10],[32,-10],[48,-8],[57,-3],[60,0],[57,3],[48,8],[32,10],[-49,10],[-56,7]];+ const hull=assembly('Pressure_Hull');+ const sections=[+ {profile:hullOutline.map(([x,z])=>[x*.90,z*.55]),frame:{origin:[0,0,0]}},+ {profile:hullOutline.map(([x,z])=>[x*.98,z*.83]),frame:{origin:[0,3,0]}},+ {profile:hullOutline,frame:{origin:[0,9.5,0]}},+ {profile:hullOutline.map(([x,z])=>[x,z*1.02]),frame:{origin:[0,11.8,0]}}+ ];+ hull.add(loftProfiles(sections),'navy');+ // Continuous chine and waterline ribbons.+ for(const [y,k,m] of [[2.5,.81,'dark'],[9.35,1,'edge']]){+ hull.add(loftProfiles([{profile:hullOutline.map(([x,z])=>[x*(y<3?.98:1),z*k]),frame:{origin:[0,y,0]}},{profile:hullOutline.map(([x,z])=>[x*(y<3?.982:1),z*(k+.005)]),frame:{origin:[0,y+.18,0]}}]),m);+ }+ hull.finish();+ const deckOutline=[[-59,-10],[-46,-16],[-15,-16],[4,-13],[43,-13],[58,-7],[61,4],[54,11],[28,13],[-47,13],[-59,9]];+ const deck=assembly('Flight_Deck');+ deck.plate('edge',deckOutline,11.7,.45);+ deck.plate('deck',deckOutline.map(([x,z])=>[x*.995,z*.985]),12.15,.22);+ // Rim strips follow the shaped perimeter.+ for(let i=0;i<deckOutline.length;i++){const a=deckOutline[i],b=deckOutline[(i+1)%deckOutline.length];deck.beam('steel',[a[0],12.18,a[1]],[b[0],12.18,b[1]],.16);}+ deck.finish();+ const paint=assembly('Deck_Markings');+ function line(a,b,w,mat='ivory',y=12.405){const dx=b[0]-a[0],dz=b[1]-a[1];paint.box(mat,[Math.hypot(dx,dz),.025,w],[(a[0]+b[0])/2,y,(a[1]+b[1])/2],[0,-Math.atan2(dz,dx)*180/Math.PI,0]);}+ // Angled landing lane, deliberately clear of the island and parked aircraft.+ const start=[-53,-2.5],end=[29,-7.9],dx=end[0]-start[0],dz=end[1]-start[1],len=Math.hypot(dx,dz),nx=-dz/len,nz=dx/len;+ for(const s of [-1,1])line([start[0]+nx*3.8*s,start[1]+nz*3.8*s],[end[0]+nx*3.8*s,end[1]+nz*3.8*s],.25);+ for(let d=3;d<len-2;d+=7){const a=[start[0]+dx*d/len,start[1]+dz*d/len],b=[start[0]+dx*(d+3)/len,start[1]+dz*(d+3)/len];line(a,b,.24);}+ for(let j=0;j<5;j++){let off=(j-2)*1.1;line([-51+nx*off,-2.63+nz*off],[-47+nx*off,-2.90+nz*off],.55);}+ for(const z of [0.4,5]){line([10,z],[51,z],.18);line([10,z+.6],[51,z+.6],.12,'steel');line([51,z-1],[53,z+.3],.24);line([53,z+.3],[51,z+1.6],.24);}+ for(const x of [-40,-36,-32,-28])line([x,-7],[x+.55,1],.13,'dark',12.445);+ for(const [x,z] of [[-42,8],[-28,8],[35,8],[-19,-12.6]]){+ line([x-4,z-2.3],[x+4,z-2.3],.12);line([x-4,z+2.3],[x+4,z+2.3],.12);+ for(const xx of [x-4,x+4])line([xx,z-2.3],[xx,z+2.3],.12);+ }+ // Large squared 08 on the bow, authored as geometry for texture-free portability.+ function digit(x,z,num){const bars={a:[0,-1.1,2.8,.3],b:[1.25,-.55,.3,1.1],c:[1.25,.55,.3,1.1],d:[0,1.1,2.8,.3],e:[-1.25,.55,.3,1.1],f:[-1.25,-.55,.3,1.1],g:[0,0,2.8,.3]};for(const k of (num===0?'abcdef':'abcdefg')){const q=bars[k];paint.box('ivory',[q[3],.03,q[2]],[x+q[1],12.43,z+q[0]]);}}+ digit(54,-2.5,0);digit(54,1.2,8);+ paint.finish();+ // Sponsons, under-deck cantilevers and side servicing bays.+ const sides=assembly('Hull_Sponsons_and_Service_Bays');+ for(const side of [-1,1]){+ for(const x of [-44,-29,-14,1,16,31]){+ sides.box('edge',[8,.65,2.0],[x,9.0,side*10.5]);+ sides.beam('navy',[x-3,6.5,side*9.7],[x-3,10.7,side*12.3],.55);+ sides.beam('navy',[x+3,6.5,side*9.7],[x+3,10.7,side*12.3],.55);+ sides.box('dark',[5,1.9,.10],[x,7.4,side*10.03]);+ for(let j=0;j<4;j++)sides.box('edge',[.16,1.7,.13],[x-1.8+j*1.2,7.4,side*10.11]);+ }+ for(const x of [-39,-19,8,26]){+ sides.box('steel',[2.4,.85,.7],[x,10.05,side*11.35]);+ sides.box('dark',[2.05,.14,.76],[x,10.05,side*11.37]);+ }+ }+ sides.box('dark',[.14,3.5,12],[-56.05,7.0,0]);+ for(const z of [-4,0,4])sides.box('edge',[.23,3.5,.2],[-56.14,7,z]);+ sides.finish();+ function lift(name,x,z,y){+ const a=assembly(name);a.box('edge',[9,.5,5.4],[x,y-.27,z]);a.box('deck',[8.7,.14,5.1],[x,y+.03,z]);+ for(const side of [-1,1])a.box('orange',[8.5,.035,.2],[x,y+.125,z+side*2.36]);+ for(let j=0;j<9;j++)a.box('ivory',[.3,.036,.5],[x-3.8+j*.95,y+.15,z+2.3],[0,-35,0]);+ for(const xx of [x-3.6,x+3.6]){a.box('dark',[.4,3,.5],[xx,y-1.6,z]);a.beam('edge',[xx,8.3,z>0?9:-10],[xx,y-.5,z],.4);}+ a.finish();+ }+ lift('Starboard_Lift_lowered',22,14.4,10.9);+ lift('Port_Lift_flush',-30,-16.6,12.38);+ const island=assembly('Island');+ const ip=[[-10,7.3],[8,7.3],[10,8.7],[9,11.9],[-10,11.9]];+ island.plate('navy',ip,12.4,5.5);+ island.plate('edge',[[-9,7],[7,7],[9,8.5],[8.3,12.2],[-9,12.2]],17.9,.5);+ island.plate('navy',[[-8,7.5],[6.5,7.5],[8,8.6],[7.4,11.7],[-8,11.7]],18.4,2.5);+ island.plate('dark',[[-7.5,7.32],[6.4,7.32],[8.15,8.5],[7.5,11.85],[-7.5,11.85]],19.25,1.0);+ for(let x=-6.5;x<6;x+=1.5){island.box('glass',[1.12,.67,.06],[x,19.8,7.27]);island.box('glass',[1.12,.67,.06],[x,19.8,11.9]);}+ island.box('glass',[.08,.65,2],[8.03,19.8,9.5],[0,-12,0]);+ island.plate('edge',[[-8.2,7],[7,7],[8.8,8.5],[8,12.2],[-8.2,12.2]],20.8,.5);+ island.box('navy',[7,2.0,3.2],[-1,22.3,9.7]);+ island.box('edge',[7.5,.35,3.7],[-1,23.4,9.7]);+ // Faceted exhaust stack with recessed dark mouth.+ island.cyl('edge',1.35,1.7,3.6,[-6,23.1,9.7],[0,0,0],4);+ island.cyl('dark',1.05,1.05,.15,[-6,24.95,9.7],[0,0,0],4);+ for(const x of [-7,-5,-3])island.box('dark',[1.3,.75,.08],[x,15.5,7.25]);+ island.box('steel',[1.0,2.0,.14],[6,14,7.22]);+ for(let y=13;y<18;y+=.55)island.box('steel',[.7,.10,.20],[-9.75,y,8.5]);+ for(const z of [7.1,12.1]){+ for(let x=-8;x<8;x+=2)island.box('steel',[.07,.85,.07],[x,21.72,z]);+ island.box('steel',[16,.07,.07],[0,22.1,z]);+ }+ island.finish();+ const radar=assembly('Radar_Masts');+ for(const x of [-1,2])for(const z of [8.7,10.7])radar.beam('steel',[x,23.55,z],[.5,29.0,9.7],.21);+ radar.box('edge',[4,.25,3.2],[.5,27.1,9.7]);+ radar.cyl('steel',.18,.24,4.2,[.5,29.1,9.7]);+ radar.box('dark',[.3,2.5,5.5],[.5,31.0,9.7],[0,-20,0]);+ for(let z=-2;z<=2;z++)radar.box('steel',[.35,2.45,.07],[.5,31,9.7+z],[0,-20,0]);+ for(let y=30;y<=32;y+=.65)radar.box('steel',[.36,.07,5.4],[.5,y,9.7],[0,-20,0]);+ radar.cyl('steel',.07,.12,5.2,[5.1,25.6,9.7]);+ radar.box('steel',[3.5,.12,.12],[5.1,27.2,9.7]);+ radar.add(sphereGeo(.7,12,8),'ivory',[5.1,24.0,9.7]);+ radar.cyl('steel',.05,.08,3,[-7.5,25.2,11]);+ radar.finish();+ // Four reusable parked aircraft assemblies, +X nose.+ function jet(name,x,z,heading){+ const a=assembly(name);+ a.g.position.set(x,12.46,z);a.g.rotation.y=heading*Math.PI/180;+ const rings=[[-3,.34],[-2,.55],[.6,.50],[2.2,.28],[3.7,.025]].map(([xx,r])=>({profile:Array.from({length:8},(_,i)=>[Math.cos(i*Math.PI/4)*r,Math.sin(i*Math.PI/4)*r]),frame:{origin:[xx,.85,0],rotation:[0,0,-90]}}));+ a.add(loftProfiles(rings),'orange');+ const wing=[[-2.0,-.35],[-2.3,-3.2],[-.7,-3.2],[1.4,-.4],[1.4,.4],[-.7,3.2],[-2.3,3.2],[-2.0,.35]];+ a.plate('orange',wing,.74,.15);+ for(const s of [-1,1]){+ a.box('ivory',[.65,.17,.55],[-1.45,.84,s*2.55],[0,20*s,0]);+ a.plate('orange',[[-3.1,s*.2],[-3.6,s*1.6],[-2.35,s*1.6],[-1.65,s*.25]],.85,.12);+ a.add(cylinderGeo(.23,.23,.35,10),'dark',[-3.1,.85,s*.23],[0,0,90]);+ a.box('steel',[.12,.43,.12],[-1.3,.36,s*.95]);+ a.cyl('dark',.22,.22,.16,[-1.3,.20,s*.95],[90,0,0],8);+ }+ const fin=new THREE.BufferGeometry();fin.setAttribute('position',new THREE.Float32BufferAttribute([-3,.85,-.07,-3,2.3,-.07,-1.6,.85,-.07,-3,.85,.07,-1.6,.85,.07,-3,2.3,.07],3));fin.computeVertexNormals();a.add(fin,'orange');+ a.add(sphereGeo(1,12,8),'glass',[.7,1.2,0],[0,0,0],[1.2,.40,.37]);+ a.box('steel',[.10,.4,.10],[2,.36,0]);a.cyl('dark',.19,.19,.17,[2,.19,0],[90,0,0],8);+ a.finish();+ }+ jet('Aircraft_A',-42,8,0);jet('Aircraft_B',-28,8,0);jet('Aircraft_C',35,8,0);jet('Aircraft_D',-19,-12.6,0);+ const fittings=assembly('Deck_Edge_Fittings');+ for(const s of [-1,1])for(const x of [-49,-38,-23,-9,7,33]){+ const z=s*(s<0&&x<-15?15.65:12.5);+ fittings.box('edge',[2.2,.35,1],[x,12.5,z]);+ for(const xx of [x-.65,x+.65])fittings.cyl('steel',.18,.18,.45,[xx,12.9,z]);+ }+ for(const [x,z] of [[-49,-11],[-47,12],[42,-11]]){+ fittings.cyl('edge',1.05,1.25,.75,[x,12.8,z],[],12);+ fittings.add(sphereGeo(.68,12,6),'ivory',[x,13.4,z]);+ }+ // Underwater stern: shafts, rudders and simple bronze-orange propellers.+ for(const z of [-4.4,4.4]){+ fittings.cyl('steel',.23,.23,7,[-53,1.65,z],[0,0,90]);+ fittings.cyl('orange',.65,.3,1,[-56.8,1.65,z],[0,0,90]);+ for(let i=0;i<4;i++)fittings.box('orange',[.14,2.9,.50],[-56.9,1.65,z],[i*45,0,0]);+ fittings.box('navy',[2.2,2.6,.3],[-58.5,1.4,z]);+ fittings.beam('navy',[-58.5,2.5,z],[-54.7,4.8,z],.5);+ }+ fittings.finish();+ return root;+}\ No newline at end of filediff --git a/site/examples/history/demo-dauntless-cv-08/revision-2.kiln.js b/site/examples/history/demo-dauntless-cv-08/revision-2.kiln.jsnew file mode 100644index 00000000..9e52b024--- /dev/null+++ b/site/examples/history/demo-dauntless-cv-08/revision-2.kiln.js@@ -0,0 +1,184 @@+const meta = { name: 'DAUNTLESS CV-08', category: 'vehicle', role: 'vehicle' };+const P = { deckY:12, length:122, hullBeam:21, deckBeam:30 };+function build() {+ const root=createRoot('Dauntless_CV08');+ const mats={+ navy:gameMaterial(0x193950,{metalness:.35,roughness:.63}),+ edge:gameMaterial(0x365970,{metalness:.4,roughness:.54}),+ dark:gameMaterial(0x17232b,{metalness:.25,roughness:.8}),+ deck:gameMaterial(0x30373c,{metalness:.15,roughness:.9}),+ ivory:gameMaterial(0xf3e8cc,{roughness:.7}),+ orange:gameMaterial(0xed742a,{metalness:.18,roughness:.52}),+ safetyOrange:gameMaterial(0xff5f00,{metalness:.08,roughness:.55}),+ glass:gameMaterial(0x7cafb6,{metalness:.5,roughness:.26}),+ steel:gameMaterial(0x8b9da5,{metalness:.65,roughness:.48})+ };+ // Bake static surfaces into one mesh per material within each semantic assembly.+ function assembly(name,parent=root) {+ const g=new THREE.Group();g.name=name;parent.add(g);+ const buckets={};+ function add(geo,mat,pos=[0,0,0],rot=[0,0,0],scale=[1,1,1]){+ if(name.startsWith('Aircraft_') && mat==='orange') mat='safetyOrange';+ const own=geo.index?geo.toNonIndexed():geo.clone();+ const matrix=new THREE.Matrix4().compose(new THREE.Vector3(...pos),new THREE.Quaternion().setFromEuler(new THREE.Euler(...rot.map(v=>v*Math.PI/180))),new THREE.Vector3(...scale));+ own.applyMatrix4(matrix);+ if(!own.getAttribute('normal'))own.computeVertexNormals();+ (buckets[mat]||(buckets[mat]=[])).push(own);+ }+ function box(mat,size,pos,rot=[0,0,0]){add(boxGeo(...size),mat,pos,rot);}+ function cyl(mat,rt,rb,h,pos,rot=[0,0,0],seg=10){add(cylinderGeo(rt,rb,h,seg),mat,pos,rot);}+ function beam(mat,a,b,width){const va=new THREE.Vector3(...a),vb=new THREE.Vector3(...b);const d=vb.clone().sub(va);const geo=boxGeo(width,d.length(),width).clone();geo.applyQuaternion(new THREE.Quaternion().setFromUnitVectors(new THREE.Vector3(0,1,0),d.normalize()));add(geo,mat,va.add(vb).multiplyScalar(.5).toArray());}+ function plate(mat,outline,y,h){const s=new THREE.Shape();outline.forEach(([x,z],i)=>i?s.lineTo(x,-z):s.moveTo(x,-z));s.closePath();const geo=new THREE.ExtrudeGeometry(s,{depth:h,bevelEnabled:false,steps:1,curveSegments:1});geo.rotateX(-Math.PI/2);add(geo,mat,[0,y,0]);}+ function finish(){+ for(const key of Object.keys(buckets)){const geos=buckets[key],p=[],n=[],uv=[];+ for(const geo of geos){const pa=geo.getAttribute('position'),na=geo.getAttribute('normal'),ua=geo.getAttribute('uv');+ for(let i=0;i<pa.count;i++){p.push(pa.getX(i),pa.getY(i),pa.getZ(i));n.push(na.getX(i),na.getY(i),na.getZ(i));uv.push(ua?ua.getX(i):0,ua?ua.getY(i):0);}+ }+ const merged=new THREE.BufferGeometry();merged.setAttribute('position',new THREE.Float32BufferAttribute(p,3));merged.setAttribute('normal',new THREE.Float32BufferAttribute(n,3));merged.setAttribute('uv',new THREE.Float32BufferAttribute(uv,2));+ createPart(name+'_'+key,merged,mats[key],{parent:g});+ }return g;+ }+ return {g,add,box,cyl,beam,plate,finish};+ }+ const hullOutline=[[-56,-7],[-49,-10],[32,-10],[48,-8],[57,-3],[60,0],[57,3],[48,8],[32,10],[-49,10],[-56,7]];+ const hull=assembly('Pressure_Hull');+ const sections=[+ {profile:hullOutline.map(([x,z])=>[x*.90,z*.55]),frame:{origin:[0,0,0]}},+ {profile:hullOutline.map(([x,z])=>[x*.98,z*.83]),frame:{origin:[0,3,0]}},+ {profile:hullOutline,frame:{origin:[0,9.5,0]}},+ {profile:hullOutline.map(([x,z])=>[x,z*1.02]),frame:{origin:[0,11.8,0]}}+ ];+ hull.add(loftProfiles(sections),'navy');+ // Continuous chine and waterline ribbons.+ for(const [y,k,m] of [[2.5,.81,'dark'],[9.35,1,'edge']]){+ hull.add(loftProfiles([{profile:hullOutline.map(([x,z])=>[x*(y<3?.98:1),z*k]),frame:{origin:[0,y,0]}},{profile:hullOutline.map(([x,z])=>[x*(y<3?.982:1),z*(k+.005)]),frame:{origin:[0,y+.18,0]}}]),m);+ }+ hull.finish();+ const deckOutline=[[-59,-10],[-46,-16],[-15,-16],[4,-13],[43,-13],[58,-7],[61,4],[54,11],[28,13],[-47,13],[-59,9]];+ const deck=assembly('Flight_Deck');+ deck.plate('edge',deckOutline,11.7,.45);+ deck.plate('deck',deckOutline.map(([x,z])=>[x*.995,z*.985]),12.15,.22);+ // Rim strips follow the shaped perimeter.+ for(let i=0;i<deckOutline.length;i++){const a=deckOutline[i],b=deckOutline[(i+1)%deckOutline.length];deck.beam('steel',[a[0],12.18,a[1]],[b[0],12.18,b[1]],.16);}+ deck.finish();+ const paint=assembly('Deck_Markings');+ function line(a,b,w,mat='ivory',y=12.405){const dx=b[0]-a[0],dz=b[1]-a[1];paint.box(mat,[Math.hypot(dx,dz),.025,w],[(a[0]+b[0])/2,y,(a[1]+b[1])/2],[0,-Math.atan2(dz,dx)*180/Math.PI,0]);}+ // Angled landing lane, deliberately clear of the island and parked aircraft.+ const start=[-53,-2.5],end=[29,-7.9],dx=end[0]-start[0],dz=end[1]-start[1],len=Math.hypot(dx,dz),nx=-dz/len,nz=dx/len;+ for(const s of [-1,1])line([start[0]+nx*3.8*s,start[1]+nz*3.8*s],[end[0]+nx*3.8*s,end[1]+nz*3.8*s],.25);+ for(let d=3;d<len-2;d+=7){const a=[start[0]+dx*d/len,start[1]+dz*d/len],b=[start[0]+dx*(d+3)/len,start[1]+dz*(d+3)/len];line(a,b,.24);}+ for(let j=0;j<5;j++){let off=(j-2)*1.1;line([-51+nx*off,-2.63+nz*off],[-47+nx*off,-2.90+nz*off],.55);}+ for(const z of [0.4,5]){line([10,z],[51,z],.18);line([10,z+.6],[51,z+.6],.12,'steel');line([51,z-1],[53,z+.3],.24);line([53,z+.3],[51,z+1.6],.24);}+ for(const x of [-40,-36,-32,-28])line([x,-7],[x+.55,1],.13,'dark',12.445);+ for(const [x,z] of [[-42,8],[-28,8],[35,8],[-19,-12.6]]){+ line([x-4,z-2.3],[x+4,z-2.3],.12);line([x-4,z+2.3],[x+4,z+2.3],.12);+ for(const xx of [x-4,x+4])line([xx,z-2.3],[xx,z+2.3],.12);+ }+ // Large squared 08 on the bow, authored as geometry for texture-free portability.+ function digit(x,z,num){const bars={a:[0,-1.1,2.8,.3],b:[1.25,-.55,.3,1.1],c:[1.25,.55,.3,1.1],d:[0,1.1,2.8,.3],e:[-1.25,.55,.3,1.1],f:[-1.25,-.55,.3,1.1],g:[0,0,2.8,.3]};for(const k of (num===0?'abcdef':'abcdefg')){const q=bars[k];paint.box('ivory',[q[3],.03,q[2]],[x+q[1],12.43,z+q[0]]);}}+ digit(54,-2.5,0);digit(54,1.2,8);+ paint.finish();+ // Sponsons, under-deck cantilevers and side servicing bays.+ const sides=assembly('Hull_Sponsons_and_Service_Bays');+ for(const side of [-1,1]){+ for(const x of [-44,-29,-14,1,16,31]){+ sides.box('edge',[8,.65,2.0],[x,9.0,side*10.5]);+ sides.beam('navy',[x-3,6.5,side*9.7],[x-3,10.7,side*12.3],.55);+ sides.beam('navy',[x+3,6.5,side*9.7],[x+3,10.7,side*12.3],.55);+ sides.box('dark',[5,1.9,.10],[x,7.4,side*10.03]);+ for(let j=0;j<4;j++)sides.box('edge',[.16,1.7,.13],[x-1.8+j*1.2,7.4,side*10.11]);+ }+ for(const x of [-39,-19,8,26]){+ sides.box('steel',[2.4,.85,.7],[x,10.05,side*11.35]);+ sides.box('dark',[2.05,.14,.76],[x,10.05,side*11.37]);+ }+ }+ sides.box('dark',[.14,3.5,12],[-56.05,7.0,0]);+ for(const z of [-4,0,4])sides.box('edge',[.23,3.5,.2],[-56.14,7,z]);+ sides.finish();+ function lift(name,x,z,y){+ const a=assembly(name);a.box('edge',[9,.5,5.4],[x,y-.27,z]);a.box('deck',[8.7,.14,5.1],[x,y+.03,z]);+ for(const side of [-1,1])a.box('orange',[8.5,.035,.2],[x,y+.125,z+side*2.36]);+ for(let j=0;j<9;j++)a.box('ivory',[.3,.036,.5],[x-3.8+j*.95,y+.15,z+2.3],[0,-35,0]);+ for(const xx of [x-3.6,x+3.6]){a.box('dark',[.4,3,.5],[xx,y-1.6,z]);a.beam('edge',[xx,8.3,z>0?9:-10],[xx,y-.5,z],.4);}+ a.finish();+ }+ lift('Starboard_Lift_lowered',22,14.4,10.9);+ lift('Port_Lift_flush',-30,-16.6,12.38);+ const island=assembly('Island');+ const ip=[[-10,7.3],[8,7.3],[10,8.7],[9,11.9],[-10,11.9]];+ island.plate('navy',ip,12.4,5.5);+ island.plate('edge',[[-9,7],[7,7],[9,8.5],[8.3,12.2],[-9,12.2]],17.9,.5);+ island.plate('navy',[[-8,7.5],[6.5,7.5],[8,8.6],[7.4,11.7],[-8,11.7]],18.4,2.5);+ island.plate('dark',[[-7.5,7.32],[6.4,7.32],[8.15,8.5],[7.5,11.85],[-7.5,11.85]],19.25,1.0);+ island.plate('safetyOrange',[[-8.04,7.46],[6.52,7.46],[8.05,8.59],[7.44,11.74],[-8.04,11.74]],18.55,.65);+ for(let x=-6.5;x<6;x+=1.5){island.box('glass',[1.12,.67,.06],[x,19.8,7.27]);island.box('glass',[1.12,.67,.06],[x,19.8,11.9]);}+ island.box('glass',[.08,.65,2],[8.03,19.8,9.5],[0,-12,0]);+ island.plate('edge',[[-8.2,7],[7,7],[8.8,8.5],[8,12.2],[-8.2,12.2]],20.8,.5);+ island.box('navy',[7,2.0,3.2],[-1,22.3,9.7]);+ island.box('edge',[7.5,.35,3.7],[-1,23.4,9.7]);+ // Faceted exhaust stack with recessed dark mouth.+ island.cyl('edge',1.35,1.7,3.6,[-6,23.1,9.7],[0,0,0],4);+ island.cyl('dark',1.05,1.05,.15,[-6,24.95,9.7],[0,0,0],4);+ for(const x of [-7,-5,-3])island.box('dark',[1.3,.75,.08],[x,15.5,7.25]);+ island.box('steel',[1.0,2.0,.14],[6,14,7.22]);+ for(let y=13;y<18;y+=.55)island.box('steel',[.7,.10,.20],[-9.75,y,8.5]);+ for(const z of [7.1,12.1]){+ for(let x=-8;x<8;x+=2)island.box('steel',[.07,.85,.07],[x,21.72,z]);+ island.box('steel',[16,.07,.07],[0,22.1,z]);+ }+ island.finish();+ const radar=assembly('Radar_Masts');+ for(const x of [-1,2])for(const z of [8.7,10.7])radar.beam('steel',[x,23.55,z],[.5,29.0,9.7],.21);+ radar.box('edge',[4,.25,3.2],[.5,27.1,9.7]);+ radar.cyl('steel',.18,.24,4.2,[.5,29.1,9.7]);+ radar.box('dark',[.3,2.5,5.5],[.5,31.0,9.7],[0,-20,0]);+ for(let z=-2;z<=2;z++)radar.box('steel',[.35,2.45,.07],[.5,31,9.7+z],[0,-20,0]);+ for(let y=30;y<=32;y+=.65)radar.box('steel',[.36,.07,5.4],[.5,y,9.7],[0,-20,0]);+ radar.cyl('steel',.07,.12,5.2,[5.1,25.6,9.7]);+ radar.box('steel',[3.5,.12,.12],[5.1,27.2,9.7]);+ radar.add(sphereGeo(.7,12,8),'ivory',[5.1,24.0,9.7]);+ radar.cyl('steel',.05,.08,3,[-7.5,25.2,11]);+ radar.finish();+ // Four reusable parked aircraft assemblies, +X nose.+ function jet(name,x,z,heading){+ const a=assembly(name);+ a.g.position.set(x,12.46,z);a.g.rotation.y=heading*Math.PI/180;+ const rings=[[-3,.34],[-2,.55],[.6,.50],[2.2,.28],[3.7,.025]].map(([xx,r])=>({profile:Array.from({length:8},(_,i)=>[Math.cos(i*Math.PI/4)*r,Math.sin(i*Math.PI/4)*r]),frame:{origin:[xx,.85,0],rotation:[0,0,-90]}}));+ a.add(loftProfiles(rings),'orange');+ const wing=[[-2.0,-.35],[-2.3,-3.2],[-.7,-3.2],[1.4,-.4],[1.4,.4],[-.7,3.2],[-2.3,3.2],[-2.0,.35]];+ a.plate('orange',wing,.74,.15);+ for(const s of [-1,1]){+ a.box('ivory',[.65,.17,.55],[-1.45,.84,s*2.55],[0,20*s,0]);+ a.plate('orange',[[-3.1,s*.2],[-3.6,s*1.6],[-2.35,s*1.6],[-1.65,s*.25]],.85,.12);+ a.add(cylinderGeo(.23,.23,.35,10),'dark',[-3.1,.85,s*.23],[0,0,90]);+ a.box('steel',[.12,.43,.12],[-1.3,.36,s*.95]);+ a.cyl('dark',.22,.22,.16,[-1.3,.20,s*.95],[90,0,0],8);+ }+ const fin=new THREE.BufferGeometry();fin.setAttribute('position',new THREE.Float32BufferAttribute([-3,.85,-.07,-3,2.3,-.07,-1.6,.85,-.07,-3,.85,.07,-1.6,.85,.07,-3,2.3,.07],3));fin.computeVertexNormals();a.add(fin,'orange');+ a.add(sphereGeo(1,12,8),'glass',[.7,1.2,0],[0,0,0],[1.2,.40,.37]);+ a.box('steel',[.10,.4,.10],[2,.36,0]);a.cyl('dark',.19,.19,.17,[2,.19,0],[90,0,0],8);+ a.finish();+ }+ jet('Aircraft_A',-42,8,0);jet('Aircraft_B',-28,8,0);jet('Aircraft_C',35,8,0);jet('Aircraft_D',-19,-12.6,0);+ const fittings=assembly('Deck_Edge_Fittings');+ for(const s of [-1,1])for(const x of [-49,-38,-23,-9,7,33]){+ const z=s*(s<0&&x<-15?15.65:12.5);+ fittings.box('edge',[2.2,.35,1],[x,12.5,z]);+ for(const xx of [x-.65,x+.65])fittings.cyl('steel',.18,.18,.45,[xx,12.9,z]);+ }+ for(const [x,z] of [[-49,-11],[-47,12],[42,-11]]){+ fittings.cyl('edge',1.05,1.25,.75,[x,12.8,z],[],12);+ fittings.add(sphereGeo(.68,12,6),'ivory',[x,13.4,z]);+ }+ // Underwater stern: shafts, rudders and simple bronze-orange propellers.+ for(const z of [-4.4,4.4]){+ fittings.cyl('steel',.23,.23,7,[-53,1.65,z],[0,0,90]);+ fittings.cyl('orange',.65,.3,1,[-56.8,1.65,z],[0,0,90]);+ for(let i=0;i<4;i++)fittings.box('orange',[.14,2.9,.50],[-56.9,1.65,z],[i*45,0,0]);+ fittings.box('navy',[2.2,2.6,.3],[-58.5,1.4,z]);+ fittings.beam('navy',[-58.5,2.5,z],[-54.7,4.8,z],.5);+ }+ fittings.finish();+ return root;+}\ No newline at end of filediff --git a/site/examples/history/demo-deep-sea-station/history.json b/site/examples/history/demo-deep-sea-station/history.jsonnew file mode 100644index 00000000..49cde553--- /dev/null+++ b/site/examples/history/demo-deep-sea-station/history.json@@ -0,0 +1,22 @@+{+ "version": 1,+ "brief": {+ "kind": "recorded",+ "text": "Deep-sea research station with safety orange habitat pod frames, glass habitat pods, and yellow robotic arms."+ },+ "currentSourceHash": "df6b76e688d9d5e6a23da05ed1fdac1a3d2975ca7f573ee00b0638e90edb27e8",+ "revisions": [+ {+ "file": "revision-1.kiln.js",+ "title": "Saved revision 1",+ "description": "Deep-sea benthic research station featuring pressurized glass habitat pods, dual high-visibility yellow articulated robotic manipulator arms, 4-point seabed landing legs, sample collection basket, and life-support systems.",+ "sourceHash": "e97067e161facb990414aa10e0efc58f34c23321cf8b8f2776172963971ce200"+ },+ {+ "file": "revision-2.kiln.js",+ "title": "Saved revision 2",+ "description": "Deep-sea research station with safety orange habitat pod frames, glass habitat pods, and yellow robotic arms.",+ "sourceHash": "df6b76e688d9d5e6a23da05ed1fdac1a3d2975ca7f573ee00b0638e90edb27e8"+ }+ ]+}diff --git a/site/examples/history/demo-deep-sea-station/revision-1.kiln.js b/site/examples/history/demo-deep-sea-station/revision-1.kiln.jsnew file mode 100644index 00000000..53da9694--- /dev/null+++ b/site/examples/history/demo-deep-sea-station/revision-1.kiln.js@@ -0,0 +1,498 @@+const meta = {+ name: 'Deep-Sea Research Station',+ category: 'architecture',+ role: 'building'+};++function build() {+ const root = createRoot('DeepSeaStation');+ const d2r = (deg) => deg * Math.PI / 180;++ // --- Materials ---+ const hullWhite = gameMaterial(0xdce5ea, { roughness: 0.35, metalness: 0.3 });+ const hullDark = gameMaterial(0x1a232b, { roughness: 0.6, metalness: 0.7 });+ const frameworkDark = gameMaterial(0x12171d, { roughness: 0.7, metalness: 0.85 });+ const safetyYellow = gameMaterial(0xf4a900, { roughness: 0.35, metalness: 0.2 });+ const jointBlack = gameMaterial(0x181a1e, { roughness: 0.8, metalness: 0.3 });+ const chromeMetal = gameMaterial(0xd4d8dc, { roughness: 0.15, metalness: 0.95 });+ const glass = glassMaterial(0x4dc0f5, { opacity: 0.32, roughness: 0.06, metalness: 0.1 });+ const floodLight = gameMaterial(0xffffff, { emissive: 0xffffff, emissiveIntensity: 3.5 });+ const cyanGlow = gameMaterial(0x00e5ff, { emissive: 0x00e5ff, emissiveIntensity: 2.5 });+ const amberBeacon = gameMaterial(0xff6600, { emissive: 0xff6600, emissiveIntensity: 2.2 });+ const interiorDeck = gameMaterial(0x242e38, { roughness: 0.85, metalness: 0.2 });+ const interiorPanel = gameMaterial(0x384754, { roughness: 0.5, metalness: 0.4 });+ const tankGas = gameMaterial(0xedf2f7, { roughness: 0.4, metalness: 0.2 });+ const tankStripe = gameMaterial(0x009e73, { roughness: 0.5, metalness: 0.2 });++ // ==========================================+ // 1. CENTRAL PRESSURE HULL & DOCKING CORE+ // ==========================================+ // Lower Machinery Ring+ createPart('Hull_LowerCollar', cylinderGeo(2.4, 2.3, 0.6, 24), frameworkDark, { position: [0, 2.2, 0], parent: root });+ createPart('Hull_MachineryBelt', cylinderGeo(2.5, 2.4, 1.2, 24), hullWhite, { position: [0, 3.1, 0], parent: root });++ // Mid Corridor Hub Belt+ createPart('Hull_MidBelt', cylinderGeo(2.65, 2.65, 0.6, 24), hullDark, { position: [0, 4.0, 0], parent: root });+ createPart('Hull_UpperSection', cylinderGeo(2.35, 2.55, 1.2, 24), hullWhite, { position: [0, 4.9, 0], parent: root });++ // Upper Taper & Observation Ring+ createPart('Hull_UpperTaper', cylinderGeo(1.8, 2.35, 1.0, 24), hullDark, { position: [0, 6.0, 0], parent: root });+ createPart('Hull_UpperDeckRim', cylinderGeo(1.95, 1.95, 0.25, 24), safetyYellow, { position: [0, 6.6, 0], parent: root });++ // Submersible Docking Hatch (Aft top)+ createPart('Docking_Collar', cylinderGeo(1.0, 1.1, 0.4, 18), hullDark, { position: [-0.4, 6.9, 0], parent: root });+ createPart('Docking_Hatch', cylinderGeo(0.9, 0.9, 0.1, 18), safetyYellow, { position: [-0.4, 7.15, 0], parent: root });+ createPart('Docking_LightFwd', sphereGeo(0.06, 8, 6), floodLight, { position: [0.5, 7.15, 0], parent: root });+ createPart('Docking_LightAft', sphereGeo(0.06, 8, 6), floodLight, { position: [-1.3, 7.15, 0], parent: root });+ createPart('Docking_LightStbd', sphereGeo(0.06, 8, 6), floodLight, { position: [-0.4, 7.15, 0.9], parent: root });+ createPart('Docking_LightPort', sphereGeo(0.06, 8, 6), floodLight, { position: [-0.4, 7.15, -0.9], parent: root });++ // Sensor & Communications Mast+ createPart('Mast_Base', cylinderGeo(0.2, 0.25, 0.3, 12), frameworkDark, { position: [0.6, 6.85, 0], parent: root });+ createPart('Mast_Pylon', cylinderGeo(0.1, 0.16, 2.2, 10), frameworkDark, { position: [0.6, 8.1, 0], parent: root });+ createPart('Mast_SonarDome', sphereGeo(0.4, 14, 10), hullDark, { position: [0.6, 9.3, 0], parent: root });+ createPart('Mast_AcousticBoom', cylinderGeo(0.04, 0.04, 1.3, 8), frameworkDark, { position: [0.6, 8.8, 0], rotation: [90, 0, 0], parent: root });+ createPart('Mast_TransducerL', cylinderGeo(0.08, 0.05, 0.18, 8), safetyYellow, { position: [0.6, 8.8, 0.65], rotation: [90, 0, 0], parent: root });+ createPart('Mast_TransducerR', cylinderGeo(0.08, 0.05, 0.18, 8), safetyYellow, { position: [0.6, 8.8, -0.65], rotation: [-90, 0, 0], parent: root });+ createPart('Mast_Beacon', sphereGeo(0.1, 10, 8), amberBeacon, { position: [0.6, 9.75, 0], parent: root });+ createPart('Mast_AntennaSpire', cylinderGeo(0.015, 0.03, 1.4, 6), chromeMetal, { position: [0.6, 10.5, 0], parent: root });++ // Aft Power Reactor / Engineering Pod (-X)+ createPart('Reactor_Corridor', cylinderGeo(0.7, 0.7, 1.2, 16), hullDark, { position: [-2.8, 3.8, 0], rotation: [0, 0, 90], parent: root });+ createPart('Reactor_Hull', cylinderGeo(1.35, 1.45, 1.8, 20), hullWhite, { position: [-4.2, 3.8, 0], rotation: [0, 0, 90], parent: root });+ createPart('Reactor_EndCap', sphereGeo(1.35, 16, 12), hullDark, { position: [-5.1, 3.8, 0], parent: root });+ createPart('Reactor_VaneTop', boxGeo(1.6, 0.4, 0.12), frameworkDark, { position: [-4.2, 4.7, 0], parent: root });+ createPart('Reactor_VaneStbd', boxGeo(1.6, 0.12, 0.4), frameworkDark, { position: [-4.2, 3.8, 1.5], parent: root });+ createPart('Reactor_VanePort', boxGeo(1.6, 0.12, 0.4), frameworkDark, { position: [-4.2, 3.8, -1.5], parent: root });++ // ==========================================+ // 2. SEAFLOOR ANCHORAGE & 4 LANDING LEGS+ // ==========================================+ const legAngles = [45, 135, 225, 315];+ for (let i = 0; i < 4; i++) {+ const deg = legAngles[i];+ const rad = d2r(deg);+ const cosA = Math.cos(rad);+ const sinA = Math.sin(rad);++ const fx = 5.0 * cosA;+ const fz = 5.0 * sinA;+ const fy = 0.1;++ const hx = 2.2 * cosA;+ const hz = 2.2 * sinA;+ const hy = 2.2;++ const prefix = 'Leg_' + deg;++ // Footpad resting on seabed (Y=0 to Y=0.2)+ createPart(prefix + '_Foot', cylinderGeo(0.8, 0.95, 0.2, 16), hullDark, { position: [fx, fy, fz], parent: root });+ createPart(prefix + '_BallastRing', cylinderGeo(0.65, 0.65, 0.15, 14), safetyYellow, { position: [fx, fy + 0.15, fz], parent: root });+ createPart(prefix + '_AnkleBall', sphereGeo(0.28, 12, 10), jointBlack, { position: [fx, fy + 0.32, fz], parent: root });++ // Telescoping heavy strut+ const midX = (fx + hx) * 0.5;+ const midY = (fy + 0.32 + hy) * 0.5;+ const midZ = (fz + hz) * 0.5;++ beamBetween(prefix + '_LowerStrut', [fx, fy + 0.32, fz], [midX, midY, midZ], 0.15, frameworkDark, { parent: root });+ beamBetween(prefix + '_ChromePiston', [fx * 0.4 + hx * 0.6, (fy + 0.32) * 0.4 + hy * 0.6, fz * 0.4 + hz * 0.6], [hx, hy, hz], 0.11, chromeMetal, { parent: root });+ beamBetween(prefix + '_UpperCollar', [midX, midY, midZ], [hx, hy, hz], 0.16, frameworkDark, { parent: root });++ // Diagonal knee brace to underbelly+ const kx = 0.8 * cosA;+ const kz = 0.8 * sinA;+ const ky = 1.9;+ beamBetween(prefix + '_KneeBrace', [midX, midY, midZ], [kx, ky, kz], 0.08, frameworkDark, { parent: root });+ }++ // Underside Gas / Life-Support Storage Tanks+ const tankAngles = [30, 90, 150, 210, 270, 330];+ for (let t = 0; t < tankAngles.length; t++) {+ const tRad = d2r(tankAngles[t]);+ const tx = 1.75 * Math.cos(tRad);+ const tz = 1.75 * Math.sin(tRad);+ createPart('Tank_' + t, capsuleGeo(0.22, 1.0, 8), tankGas, { position: [tx, 2.3, tz], parent: root });+ createPart('TankBand_' + t, cylinderGeo(0.23, 0.23, 0.25, 12), tankStripe, { position: [tx, 2.3, tz], parent: root });+ createPart('TankValve_' + t, cylinderGeo(0.07, 0.07, 0.12, 8), jointBlack, { position: [tx, 2.9, tz], parent: root });+ }++ // Maneuvering Station-Keeping Thrusters+ const thrusterAngles = [0, 90, 180, 270];+ for (let th = 0; th < 4; th++) {+ const a = d2r(thrusterAngles[th]);+ const thX = 2.8 * Math.cos(a);+ const thZ = 2.8 * Math.sin(a);+ const rotY = -thrusterAngles[th];++ beamBetween('ThPylon_' + th, [2.2 * Math.cos(a), 2.5, 2.2 * Math.sin(a)], [thX, 2.5, thZ], 0.12, frameworkDark, { parent: root });+ createPart('ThDuct_' + th, cylinderGeo(0.35, 0.35, 0.4, 14), safetyYellow, { position: [thX, 2.5, thZ], rotation: [90, rotY, 0], parent: root });+ createPart('ThCore_' + th, cylinderGeo(0.12, 0.12, 0.44, 10), jointBlack, { position: [thX, 2.5, thZ], rotation: [90, rotY, 0], parent: root });+ }++ // ==========================================+ // 3. GLASS HABITAT PODS WITH INTERIORS+ // ==========================================++ // Helper for Pod Corridors+ function buildCorridor(name, start, end) {+ beamBetween(name + '_Tube', start, end, 0.72, hullWhite, { parent: root });+ const mid = [(start[0] + end[0]) * 0.5, (start[1] + end[1]) * 0.5, (start[2] + end[2]) * 0.5];+ const dx = end[0] - start[0];+ const dz = end[2] - start[2];+ const angleY = Math.atan2(dz, dx) * 180 / Math.PI;++ createPart(name + '_Ring1', cylinderGeo(0.82, 0.82, 0.16, 18), hullDark, {+ position: [start[0] + dx * 0.35, start[1], start[2] + dz * 0.35],+ rotation: [0, -angleY, 90],+ parent: root+ });+ createPart(name + '_Ring2', cylinderGeo(0.82, 0.82, 0.16, 18), hullDark, {+ position: [start[0] + dx * 0.75, start[1], start[2] + dz * 0.75],+ rotation: [0, -angleY, 90],+ parent: root+ });++ // Subsea conduit piping along corridor underside+ const p1 = [start[0], start[1] - 0.75, start[2]];+ const p2 = [end[0], end[1] - 0.75, end[2]];+ const pipeGeo = pipeAlongPath([p1, p2], 0.05, { bendRadius: 0.1 });+ createPart(name + '_UnderPipe', pipeGeo, jointBlack, { parent: root });+ }++ // Pod 1: Forward Science / Deep Bio-Lab Pod+ buildCorridor('Corridor_Fwd', [2.3, 3.8, 0], [4.4, 3.8, 0]);+ const fwdPodCenter = [5.3, 3.8, 0];+ const podR = 1.55;++ // Glass Spheres+ createPart('Pod_Fwd_Glass', sphereGeo(podR, 24, 18), glass, { position: fwdPodCenter, parent: root });+ createPart('Pod_Fwd_EqFrame', torusGeo(podR + 0.02, 0.05, 8, 28), hullDark, { position: fwdPodCenter, rotation: [90, 0, 0], parent: root });+ createPart('Pod_Fwd_MeridFrame1', torusGeo(podR + 0.02, 0.05, 8, 28), hullDark, { position: fwdPodCenter, rotation: [0, 90, 0], parent: root });+ createPart('Pod_Fwd_MeridFrame2', torusGeo(podR + 0.02, 0.05, 8, 28), hullDark, { position: fwdPodCenter, rotation: [0, 0, 0], parent: root });+ createPart('Pod_Fwd_NoseCap', cylinderGeo(0.18, 0.1, 0.16, 12), safetyYellow, { position: [fwdPodCenter[0] + podR, fwdPodCenter[1], fwdPodCenter[2]], rotation: [0, 0, -90], parent: root });+ createPart('Pod_Fwd_Beacon', sphereGeo(0.08, 8, 6), amberBeacon, { position: [fwdPodCenter[0] + podR + 0.14, fwdPodCenter[1], fwdPodCenter[2]], parent: root });++ // Forward Pod Interior+ createPart('Pod_Fwd_Floor', cylinderGeo(1.38, 1.38, 0.08, 20), interiorDeck, { position: [5.3, 3.0, 0], parent: root });+ createPart('Pod_Fwd_SpecimenTable', cylinderGeo(0.42, 0.42, 0.55, 12), interiorPanel, { position: [5.3, 3.32, 0], parent: root });+ createPart('Pod_Fwd_HoloSphere', sphereGeo(0.16, 12, 10), cyanGlow, { position: [5.3, 3.75, 0], parent: root });+ createPart('Pod_Fwd_ConsoleDesk', boxGeo(0.4, 0.7, 0.8), interiorPanel, { position: [5.9, 3.4, 0.4], parent: root });+ createPart('Pod_Fwd_ConsoleScreen', boxGeo(0.04, 0.35, 0.65), cyanGlow, { position: [5.7, 3.65, 0.4], parent: root });+ createPart('Pod_Fwd_Rack', boxGeo(0.35, 0.8, 0.7), interiorPanel, { position: [5.9, 3.45, -0.4], parent: root });++ // Pod 2: Starboard Habitat & Living Pod (+Z)+ buildCorridor('Corridor_Stbd', [0, 3.8, 2.3], [0, 3.8, 4.4]);+ const stbdPodCenter = [0, 3.8, 5.3];++ createPart('Pod_Stbd_Glass', sphereGeo(podR, 24, 18), glass, { position: stbdPodCenter, parent: root });+ createPart('Pod_Stbd_EqFrame', torusGeo(podR + 0.02, 0.05, 8, 28), hullDark, { position: stbdPodCenter, rotation: [90, 0, 0], parent: root });+ createPart('Pod_Stbd_MeridFrame1', torusGeo(podR + 0.02, 0.05, 8, 28), hullDark, { position: stbdPodCenter, rotation: [0, 0, 0], parent: root });+ createPart('Pod_Stbd_MeridFrame2', torusGeo(podR + 0.02, 0.05, 8, 28), hullDark, { position: stbdPodCenter, rotation: [0, 90, 0], parent: root });+ createPart('Pod_Stbd_Cap', cylinderGeo(0.18, 0.1, 0.16, 12), safetyYellow, { position: [0, 3.8, 5.3 + podR], rotation: [90, 0, 0], parent: root });+ createPart('Pod_Stbd_Beacon', sphereGeo(0.08, 8, 6), amberBeacon, { position: [0, 3.8, 5.3 + podR + 0.14], parent: root });++ // Starboard Pod Interior+ createPart('Pod_Stbd_Floor', cylinderGeo(1.38, 1.38, 0.08, 20), interiorDeck, { position: [0, 3.0, 5.3], parent: root });+ createPart('Pod_Stbd_NavTable', cylinderGeo(0.45, 0.45, 0.55, 12), interiorPanel, { position: [0, 3.32, 5.3], parent: root });+ createPart('Pod_Stbd_NavDisplay', cylinderGeo(0.35, 0.35, 0.04, 12), cyanGlow, { position: [0, 3.62, 5.3], parent: root });+ createPart('Pod_Stbd_StationDesk', boxGeo(0.8, 0.7, 0.35), interiorPanel, { position: [0.4, 3.4, 5.9], parent: root });+ createPart('Pod_Stbd_StationScreen', boxGeo(0.65, 0.35, 0.04), cyanGlow, { position: [0.4, 3.65, 5.7], parent: root });++ // Pod 3: Port Oceanographic / Sensor Pod (-Z)+ buildCorridor('Corridor_Port', [0, 3.8, -2.3], [0, 3.8, -4.4]);+ const portPodCenter = [0, 3.8, -5.3];++ createPart('Pod_Port_Glass', sphereGeo(podR, 24, 18), glass, { position: portPodCenter, parent: root });+ createPart('Pod_Port_EqFrame', torusGeo(podR + 0.02, 0.05, 8, 28), hullDark, { position: portPodCenter, rotation: [90, 0, 0], parent: root });+ createPart('Pod_Port_MeridFrame1', torusGeo(podR + 0.02, 0.05, 8, 28), hullDark, { position: portPodCenter, rotation: [0, 0, 0], parent: root });+ createPart('Pod_Port_MeridFrame2', torusGeo(podR + 0.02, 0.05, 8, 28), hullDark, { position: portPodCenter, rotation: [0, 90, 0], parent: root });+ createPart('Pod_Port_Cap', cylinderGeo(0.18, 0.1, 0.16, 12), safetyYellow, { position: [0, 3.8, -5.3 - podR], rotation: [-90, 0, 0], parent: root });+ createPart('Pod_Port_Beacon', sphereGeo(0.08, 8, 6), amberBeacon, { position: [0, 3.8, -5.3 - podR - 0.14], parent: root });++ // Port Pod Interior+ createPart('Pod_Port_Floor', cylinderGeo(1.38, 1.38, 0.08, 20), interiorDeck, { position: [0, 3.0, -5.3], parent: root });+ createPart('Pod_Port_Mainframe', boxGeo(0.7, 1.1, 0.4), interiorPanel, { position: [-0.3, 3.6, -5.9], parent: root });+ createPart('Pod_Port_ServerGlow', boxGeo(0.6, 0.9, 0.04), cyanGlow, { position: [-0.3, 3.6, -5.68], parent: root });+ createPart('Pod_Port_AnalysisDesk', boxGeo(0.8, 0.7, 0.35), interiorPanel, { position: [0.3, 3.4, -5.9], parent: root });++ // Pod 4: Top Command Vista Cupola+ createPart('Cupola_DeckRim', cylinderGeo(1.2, 1.25, 0.2, 20), hullDark, { position: [0, 6.7, 0], parent: root });+ createPart('Cupola_Glass', sphereGeo(1.1, 20, 14), glass, { position: [0, 6.85, 0], parent: root });+ createPart('Cupola_FrameArch1', torusGeo(1.12, 0.04, 8, 24), hullDark, { position: [0, 6.85, 0], rotation: [0, 0, 0], parent: root });+ createPart('Cupola_FrameArch2', torusGeo(1.12, 0.04, 8, 24), hullDark, { position: [0, 6.85, 0], rotation: [0, 90, 0], parent: root });+ createPart('Cupola_Floor', cylinderGeo(1.0, 1.0, 0.06, 18), interiorDeck, { position: [0, 6.75, 0], parent: root });+ createPart('Cupola_CommandOrb', sphereGeo(0.18, 12, 8), cyanGlow, { position: [0, 7.15, 0], parent: root });++ // ==========================================+ // 4. YELLOW ROBOTIC MANIPULATOR ARMS+ // ==========================================++ function buildArticulatedArm(armName, mountPos, yawDeg, pitch1Deg, pitch2Deg, pitch3Deg, rollDeg, gripClosed, hasScanner) {+ // 0. Reinforced Sponson Outrigger from Hull+ beamBetween(armName + '_Sponson', [2.1, 2.4, mountPos[2] * 0.65], mountPos, 0.18, frameworkDark, { parent: root });+ createPart(armName + '_BaseMount', cylinderGeo(0.42, 0.45, 0.25, 16), hullDark, {+ position: mountPos,+ parent: root+ });++ // 1. Shoulder Joint Pivot+ const shoulderPivot = createPivot(armName + '_ShoulderYaw', [mountPos[0], mountPos[1] + 0.16, mountPos[2]], root);+ shoulderPivot.rotation.y = d2r(yawDeg);++ // Turret Yoke & Rotary Table+ createPart(armName + '_YokeBase', cylinderGeo(0.38, 0.38, 0.12, 16), safetyYellow, {+ position: [0, 0.06, 0],+ parent: shoulderPivot+ });+ createPart(armName + '_YokeArmL', boxGeo(0.14, 0.55, 0.28), safetyYellow, {+ position: [0, 0.3, 0.22],+ parent: shoulderPivot+ });+ createPart(armName + '_YokeArmR', boxGeo(0.14, 0.55, 0.28), safetyYellow, {+ position: [0, 0.3, -0.22],+ parent: shoulderPivot+ });+ createPart(armName + '_ShoulderPin', cylinderGeo(0.13, 0.13, 0.52, 14), jointBlack, {+ position: [0, 0.48, 0],+ rotation: [90, 0, 0],+ parent: shoulderPivot+ });++ // 2. Shoulder Pitch Pivot+ const shoulderPitch = createPivot(armName + '_ShoulderPitch', [0, 0.48, 0], shoulderPivot);+ shoulderPitch.rotation.z = d2r(pitch1Deg);++ // Heavy Upper Arm Boom (length 2.3)+ const L1 = 2.3;+ createPart(armName + '_BoomMain', boxGeo(L1, 0.32, 0.3), safetyYellow, {+ position: [L1 * 0.5, 0, 0],+ parent: shoulderPitch+ });+ createPart(armName + '_BoomPlateT', boxGeo(L1 * 0.85, 0.04, 0.26), jointBlack, {+ position: [L1 * 0.5, 0.16, 0],+ parent: shoulderPitch+ });+ createPart(armName + '_BoomPlateB', boxGeo(L1 * 0.85, 0.04, 0.26), jointBlack, {+ position: [L1 * 0.5, -0.16, 0],+ parent: shoulderPitch+ });++ // Dual Hydraulic Lift Cylinders (Top and Bottom)+ createPart(armName + '_BoomHydrCylTop', cylinderGeo(0.06, 0.06, L1 * 0.55, 10), safetyYellow, {+ position: [L1 * 0.35, 0.24, 0],+ rotation: [0, 0, 90],+ parent: shoulderPitch+ });+ createPart(armName + '_BoomHydrRodTop', cylinderGeo(0.036, 0.036, L1 * 0.5, 10), chromeMetal, {+ position: [L1 * 0.75, 0.24, 0],+ rotation: [0, 0, 90],+ parent: shoulderPitch+ });++ // Hydraulic supply conduits along upper arm+ const upperHose = pipeAlongPath([[0, -0.22, 0.14], [L1 * 0.5, -0.24, 0.14], [L1 * 0.9, -0.22, 0.14]], 0.028, { bendRadius: 0.08 });+ createPart(armName + '_UpperHose', upperHose, jointBlack, { parent: shoulderPitch });++ // 3. Elbow Pitch Pivot+ const elbowPitch = createPivot(armName + '_ElbowPitch', [L1, 0, 0], shoulderPitch);+ elbowPitch.rotation.z = d2r(pitch2Deg);++ createPart(armName + '_ElbowHinge', cylinderGeo(0.15, 0.15, 0.38, 14), jointBlack, {+ position: [0, 0, 0],+ rotation: [90, 0, 0],+ parent: elbowPitch+ });++ // Forearm Boom (length 2.0)+ const L2 = 2.0;+ createPart(armName + '_ForearmMain', boxGeo(L2, 0.26, 0.26), safetyYellow, {+ position: [L2 * 0.5, 0, 0],+ parent: elbowPitch+ });+ // Hazard Stripes on forearm+ createPart(armName + '_HazardStripe1', boxGeo(0.22, 0.28, 0.28), jointBlack, {+ position: [L2 * 0.35, 0, 0],+ parent: elbowPitch+ });+ createPart(armName + '_HazardStripe2', boxGeo(0.22, 0.28, 0.28), jointBlack, {+ position: [L2 * 0.85, 0, 0],+ parent: elbowPitch+ });++ // Forearm Hydraulic Pitch Cylinder+ createPart(armName + '_ForeHydrCyl', cylinderGeo(0.05, 0.05, L2 * 0.5, 10), safetyYellow, {+ position: [L2 * 0.35, 0.2, 0],+ rotation: [0, 0, 90],+ parent: elbowPitch+ });+ createPart(armName + '_ForeHydrRod', cylinderGeo(0.03, 0.03, L2 * 0.45, 10), chromeMetal, {+ position: [L2 * 0.72, 0.2, 0],+ rotation: [0, 0, 90],+ parent: elbowPitch+ });++ // Flexible conduit hose on forearm+ const foreHose = pipeAlongPath([[0, -0.16, 0.12], [L2 * 0.5, -0.18, 0.12], [L2 * 0.9, -0.16, 0.12]], 0.025, { bendRadius: 0.06 });+ createPart(armName + '_ForeHose', foreHose, jointBlack, { parent: elbowPitch });++ // Arm-mounted Deep-Sea Heavy LED Work Spotlight+ createPart(armName + '_SpotHousing', cylinderGeo(0.09, 0.12, 0.22, 12), hullDark, {+ position: [L2 * 0.65, -0.22, 0],+ rotation: [0, 0, -90],+ parent: elbowPitch+ });+ createPart(armName + '_SpotLens', cylinderGeo(0.085, 0.085, 0.03, 12), floodLight, {+ position: [L2 * 0.65 + 0.12, -0.22, 0],+ rotation: [0, 0, -90],+ parent: elbowPitch+ });++ // 4. Wrist Assembly+ const wristPivot = createPivot(armName + '_Wrist', [L2, 0, 0], elbowPitch);+ wristPivot.rotation.x = d2r(rollDeg);+ wristPivot.rotation.z = d2r(pitch3Deg);++ createPart(armName + '_WristRotator', cylinderGeo(0.15, 0.15, 0.2, 14), safetyYellow, {+ position: [0.1, 0, 0],+ rotation: [0, 0, -90],+ parent: wristPivot+ });+ createPart(armName + '_WristFlange', cylinderGeo(0.17, 0.17, 0.06, 14), jointBlack, {+ position: [0.22, 0, 0],+ rotation: [0, 0, -90],+ parent: wristPivot+ });++ // 5. Tool / Manipulator End-Effector+ const clawBaseX = 0.25;++ if (hasScanner) {+ // Oceanographic Multispectral Scanner Tool Head+ createPart(armName + '_ScannerShaft', cylinderGeo(0.08, 0.08, 0.35, 12), chromeMetal, {+ position: [clawBaseX + 0.18, 0, 0],+ rotation: [0, 0, -90],+ parent: wristPivot+ });+ createPart(armName + '_ScannerHead', cylinderGeo(0.18, 0.14, 0.24, 14), safetyYellow, {+ position: [clawBaseX + 0.42, 0, 0],+ rotation: [0, 0, -90],+ parent: wristPivot+ });+ createPart(armName + '_ScannerLens', sphereGeo(0.12, 14, 10), cyanGlow, {+ position: [clawBaseX + 0.54, 0, 0],+ parent: wristPivot+ });+ createPart(armName + '_ScannerRing', torusGeo(0.19, 0.03, 8, 20), jointBlack, {+ position: [clawBaseX + 0.44, 0, 0],+ rotation: [0, 90, 0],+ parent: wristPivot+ });+ }++ // Heavy 3-Finger Articulated Gripper Claws+ const gripFactor = gripClosed ? 0.35 : 0.9;+ for (let f = 0; f < 3; f++) {+ const phi = (f * 120) * Math.PI / 180;+ const fy = Math.cos(phi) * 0.12;+ const fz = Math.sin(phi) * 0.12;++ // Base knuckle+ createPart(armName + '_FingerKnuckle_' + f, boxGeo(0.1, 0.06, 0.06), safetyYellow, {+ position: [clawBaseX + 0.05, fy, fz],+ parent: wristPivot+ });++ // Proximal heavy phalanx+ beamBetween(armName + '_FingerProx_' + f,+ [clawBaseX + 0.08, fy, fz],+ [clawBaseX + 0.28, fy * 1.15, fz * 1.15],+ 0.03, safetyYellow, { parent: wristPivot }+ );++ // Distal hardened chrome claw prong curved inward+ beamBetween(armName + '_FingerDist_' + f,+ [clawBaseX + 0.28, fy * 1.15, fz * 1.15],+ [clawBaseX + 0.48, fy * gripFactor, fz * gripFactor],+ 0.022, chromeMetal, { parent: wristPivot }+ );+ }+ }++ // Starboard Heavy Robotic Arm: Posed reaching down toward seabed mineral sample+ buildArticulatedArm('Arm_Stbd', [2.5, 2.5, 1.6], -20, -36, 46, -10, 22, true, false);++ // Port Heavy Robotic Arm: Posed hovering over forward specimen collection basket with active scanner+ buildArticulatedArm('Arm_Port', [2.5, 2.5, -1.6], 30, -18, 34, -16, -28, false, true);++ // ==========================================+ // 5. SEABED BENTHIC BASKET & WORKSTATION+ // ==========================================++ // Forward Specimen Collection Basket [4.1, 0.35, 0]+ createPart('Basket_Base', boxGeo(1.4, 0.08, 0.95), frameworkDark, { position: [4.1, 0.08, 0], parent: root });+ createPart('Basket_FrontRail', boxGeo(1.4, 0.05, 0.05), safetyYellow, { position: [4.1, 0.48, 0.47], parent: root });+ createPart('Basket_RearRail', boxGeo(1.4, 0.05, 0.05), safetyYellow, { position: [4.1, 0.48, -0.47], parent: root });+ createPart('Basket_LeftRail', boxGeo(0.05, 0.05, 0.95), safetyYellow, { position: [4.8, 0.48, 0], parent: root });+ createPart('Basket_RightRail', boxGeo(0.05, 0.05, 0.95), safetyYellow, { position: [3.4, 0.48, 0], parent: root });++ // Basket Corner Posts+ createPart('Basket_Post1', boxGeo(0.06, 0.4, 0.06), safetyYellow, { position: [4.77, 0.28, 0.44], parent: root });+ createPart('Basket_Post2', boxGeo(0.06, 0.4, 0.06), safetyYellow, { position: [4.77, 0.28, -0.44], parent: root });+ createPart('Basket_Post3', boxGeo(0.06, 0.4, 0.06), safetyYellow, { position: [3.43, 0.28, 0.44], parent: root });+ createPart('Basket_Post4', boxGeo(0.06, 0.4, 0.06), safetyYellow, { position: [3.43, 0.28, -0.44], parent: root });++ // Sturdy Deployment Support Struts Connecting Basket to Station Lower Hull+ beamBetween('Basket_StrutL', [2.3, 2.2, 0.6], [3.5, 0.45, 0.4], 0.08, frameworkDark, { parent: root });+ beamBetween('Basket_StrutR', [2.3, 2.2, -0.6], [3.5, 0.45, -0.4], 0.08, frameworkDark, { parent: root });++ // Core Sample Canisters inside Basket+ createPart('Canister_1', cylinderGeo(0.09, 0.09, 0.45, 12), chromeMetal, { position: [3.9, 0.32, 0.2], parent: root });+ createPart('Canister_1_Cap', cylinderGeo(0.095, 0.095, 0.07, 12), cyanGlow, { position: [3.9, 0.56, 0.2], parent: root });++ createPart('Canister_2', cylinderGeo(0.09, 0.09, 0.45, 12), safetyYellow, { position: [4.3, 0.32, 0.18], parent: root });+ createPart('Canister_2_Cap', cylinderGeo(0.095, 0.095, 0.07, 12), jointBlack, { position: [4.3, 0.56, 0.18], parent: root });++ createPart('Canister_3', cylinderGeo(0.09, 0.09, 0.45, 12), chromeMetal, { position: [3.8, 0.32, -0.2], parent: root });+ createPart('Canister_3_Cap', cylinderGeo(0.095, 0.095, 0.07, 12), amberBeacon, { position: [3.8, 0.56, -0.2], parent: root });++ // Seabed Hydrothermal Mineral Chimney Spire near Starboard Arm Claw+ createPart('Hydro_Mound', cylinderGeo(0.35, 0.55, 0.25, 12), frameworkDark, { position: [4.3, 0.125, 1.3], parent: root });+ createPart('Hydro_Spire', cylinderGeo(0.14, 0.28, 0.68, 12), hullDark, { position: [4.3, 0.57, 1.3], parent: root });+ createPart('Hydro_VentGlow', sphereGeo(0.09, 10, 8), amberBeacon, { position: [4.3, 0.92, 1.3], parent: root });++ // Oceanographic Subsea Sensor Tether Cable Connecting Chimney to Station Hull+ const hydroTether = pipeAlongPath([[2.2, 2.2, 1.2], [3.2, 0.3, 1.3], [4.3, 0.15, 1.3]], 0.035, { bendRadius: 0.15 });+ createPart('Hydro_SensorTether', hydroTether, jointBlack, { parent: root });++ // ==========================================+ // 6. EXTERIOR FLOODLIGHTS & UMBILICALS+ // ==========================================++ // Dual Forward Heavy LED Floodlight Pods aimed at seabed sampling+ createPart('Flood_FwdL_Bracket', boxGeo(0.1, 0.1, 0.2), frameworkDark, { position: [2.5, 3.2, 0.85], parent: root });+ createPart('Flood_FwdL_Housing', cylinderGeo(0.16, 0.22, 0.32, 12), hullDark, {+ position: [2.7, 3.1, 0.85],+ rotation: [-22, 15, 0],+ parent: root+ });+ createPart('Flood_FwdL_Lens', cylinderGeo(0.15, 0.15, 0.03, 12), floodLight, {+ position: [2.82, 3.05, 0.88],+ rotation: [-22, 15, 0],+ parent: root+ });++ createPart('Flood_FwdR_Bracket', boxGeo(0.1, 0.1, 0.2), frameworkDark, { position: [2.5, 3.2, -0.85], parent: root });+ createPart('Flood_FwdR_Housing', cylinderGeo(0.16, 0.22, 0.32, 12), hullDark, {+ position: [2.7, 3.1, -0.85],+ rotation: [-22, -15, 0],+ parent: root+ });+ createPart('Flood_FwdR_Lens', cylinderGeo(0.15, 0.15, 0.03, 12), floodLight, {+ position: [2.82, 3.05, -0.88],+ rotation: [-22, -15, 0],+ parent: root+ });++ return root;+}diff --git a/site/examples/history/demo-deep-sea-station/revision-2.kiln.js b/site/examples/history/demo-deep-sea-station/revision-2.kiln.jsnew file mode 100644index 00000000..a28e8975--- /dev/null+++ b/site/examples/history/demo-deep-sea-station/revision-2.kiln.js@@ -0,0 +1,499 @@+const meta = {+ name: 'Deep-Sea Research Station',+ category: 'architecture',+ role: 'building'+};++function build() {+ const root = createRoot('DeepSeaStation');+ const d2r = (deg) => deg * Math.PI / 180;++ // --- Materials ---+ const hullWhite = gameMaterial(0xdce5ea, { roughness: 0.35, metalness: 0.3 });+ const hullDark = gameMaterial(0x1a232b, { roughness: 0.6, metalness: 0.7 });+ const frameworkDark = gameMaterial(0x12171d, { roughness: 0.7, metalness: 0.85 });+ const safetyYellow = gameMaterial(0xf4a900, { roughness: 0.35, metalness: 0.2 });+ const podFrameOrange = gameMaterial(0xf55a10, { roughness: 0.35, metalness: 0.2 });+ const jointBlack = gameMaterial(0x181a1e, { roughness: 0.8, metalness: 0.3 });+ const chromeMetal = gameMaterial(0xd4d8dc, { roughness: 0.15, metalness: 0.95 });+ const glass = glassMaterial(0x4dc0f5, { opacity: 0.32, roughness: 0.06, metalness: 0.1 });+ const floodLight = gameMaterial(0xffffff, { emissive: 0xffffff, emissiveIntensity: 3.5 });+ const cyanGlow = gameMaterial(0x00e5ff, { emissive: 0x00e5ff, emissiveIntensity: 2.5 });+ const amberBeacon = gameMaterial(0xff6600, { emissive: 0xff6600, emissiveIntensity: 2.2 });+ const interiorDeck = gameMaterial(0x242e38, { roughness: 0.85, metalness: 0.2 });+ const interiorPanel = gameMaterial(0x384754, { roughness: 0.5, metalness: 0.4 });+ const tankGas = gameMaterial(0xedf2f7, { roughness: 0.4, metalness: 0.2 });+ const tankStripe = gameMaterial(0x009e73, { roughness: 0.5, metalness: 0.2 });++ // ==========================================+ // 1. CENTRAL PRESSURE HULL & DOCKING CORE+ // ==========================================+ // Lower Machinery Ring+ createPart('Hull_LowerCollar', cylinderGeo(2.4, 2.3, 0.6, 24), frameworkDark, { position: [0, 2.2, 0], parent: root });+ createPart('Hull_MachineryBelt', cylinderGeo(2.5, 2.4, 1.2, 24), hullWhite, { position: [0, 3.1, 0], parent: root });++ // Mid Corridor Hub Belt+ createPart('Hull_MidBelt', cylinderGeo(2.65, 2.65, 0.6, 24), hullDark, { position: [0, 4.0, 0], parent: root });+ createPart('Hull_UpperSection', cylinderGeo(2.35, 2.55, 1.2, 24), hullWhite, { position: [0, 4.9, 0], parent: root });++ // Upper Taper & Observation Ring+ createPart('Hull_UpperTaper', cylinderGeo(1.8, 2.35, 1.0, 24), hullDark, { position: [0, 6.0, 0], parent: root });+ createPart('Hull_UpperDeckRim', cylinderGeo(1.95, 1.95, 0.25, 24), safetyYellow, { position: [0, 6.6, 0], parent: root });++ // Submersible Docking Hatch (Aft top)+ createPart('Docking_Collar', cylinderGeo(1.0, 1.1, 0.4, 18), hullDark, { position: [-0.4, 6.9, 0], parent: root });+ createPart('Docking_Hatch', cylinderGeo(0.9, 0.9, 0.1, 18), safetyYellow, { position: [-0.4, 7.15, 0], parent: root });+ createPart('Docking_LightFwd', sphereGeo(0.06, 8, 6), floodLight, { position: [0.5, 7.15, 0], parent: root });+ createPart('Docking_LightAft', sphereGeo(0.06, 8, 6), floodLight, { position: [-1.3, 7.15, 0], parent: root });+ createPart('Docking_LightStbd', sphereGeo(0.06, 8, 6), floodLight, { position: [-0.4, 7.15, 0.9], parent: root });+ createPart('Docking_LightPort', sphereGeo(0.06, 8, 6), floodLight, { position: [-0.4, 7.15, -0.9], parent: root });++ // Sensor & Communications Mast+ createPart('Mast_Base', cylinderGeo(0.2, 0.25, 0.3, 12), frameworkDark, { position: [0.6, 6.85, 0], parent: root });+ createPart('Mast_Pylon', cylinderGeo(0.1, 0.16, 2.2, 10), frameworkDark, { position: [0.6, 8.1, 0], parent: root });+ createPart('Mast_SonarDome', sphereGeo(0.4, 14, 10), hullDark, { position: [0.6, 9.3, 0], parent: root });+ createPart('Mast_AcousticBoom', cylinderGeo(0.04, 0.04, 1.3, 8), frameworkDark, { position: [0.6, 8.8, 0], rotation: [90, 0, 0], parent: root });+ createPart('Mast_TransducerL', cylinderGeo(0.08, 0.05, 0.18, 8), safetyYellow, { position: [0.6, 8.8, 0.65], rotation: [90, 0, 0], parent: root });+ createPart('Mast_TransducerR', cylinderGeo(0.08, 0.05, 0.18, 8), safetyYellow, { position: [0.6, 8.8, -0.65], rotation: [-90, 0, 0], parent: root });+ createPart('Mast_Beacon', sphereGeo(0.1, 10, 8), amberBeacon, { position: [0.6, 9.75, 0], parent: root });+ createPart('Mast_AntennaSpire', cylinderGeo(0.015, 0.03, 1.4, 6), chromeMetal, { position: [0.6, 10.5, 0], parent: root });++ // Aft Power Reactor / Engineering Pod (-X)+ createPart('Reactor_Corridor', cylinderGeo(0.7, 0.7, 1.2, 16), hullDark, { position: [-2.8, 3.8, 0], rotation: [0, 0, 90], parent: root });+ createPart('Reactor_Hull', cylinderGeo(1.35, 1.45, 1.8, 20), hullWhite, { position: [-4.2, 3.8, 0], rotation: [0, 0, 90], parent: root });+ createPart('Reactor_EndCap', sphereGeo(1.35, 16, 12), hullDark, { position: [-5.1, 3.8, 0], parent: root });+ createPart('Reactor_VaneTop', boxGeo(1.6, 0.4, 0.12), frameworkDark, { position: [-4.2, 4.7, 0], parent: root });+ createPart('Reactor_VaneStbd', boxGeo(1.6, 0.12, 0.4), frameworkDark, { position: [-4.2, 3.8, 1.5], parent: root });+ createPart('Reactor_VanePort', boxGeo(1.6, 0.12, 0.4), frameworkDark, { position: [-4.2, 3.8, -1.5], parent: root });++ // ==========================================+ // 2. SEAFLOOR ANCHORAGE & 4 LANDING LEGS+ // ==========================================+ const legAngles = [45, 135, 225, 315];+ for (let i = 0; i < 4; i++) {+ const deg = legAngles[i];+ const rad = d2r(deg);+ const cosA = Math.cos(rad);+ const sinA = Math.sin(rad);++ const fx = 5.0 * cosA;+ const fz = 5.0 * sinA;+ const fy = 0.1;++ const hx = 2.2 * cosA;+ const hz = 2.2 * sinA;+ const hy = 2.2;++ const prefix = 'Leg_' + deg;++ // Footpad resting on seabed (Y=0 to Y=0.2)+ createPart(prefix + '_Foot', cylinderGeo(0.8, 0.95, 0.2, 16), hullDark, { position: [fx, fy, fz], parent: root });+ createPart(prefix + '_BallastRing', cylinderGeo(0.65, 0.65, 0.15, 14), safetyYellow, { position: [fx, fy + 0.15, fz], parent: root });+ createPart(prefix + '_AnkleBall', sphereGeo(0.28, 12, 10), jointBlack, { position: [fx, fy + 0.32, fz], parent: root });++ // Telescoping heavy strut+ const midX = (fx + hx) * 0.5;+ const midY = (fy + 0.32 + hy) * 0.5;+ const midZ = (fz + hz) * 0.5;++ beamBetween(prefix + '_LowerStrut', [fx, fy + 0.32, fz], [midX, midY, midZ], 0.15, frameworkDark, { parent: root });+ beamBetween(prefix + '_ChromePiston', [fx * 0.4 + hx * 0.6, (fy + 0.32) * 0.4 + hy * 0.6, fz * 0.4 + hz * 0.6], [hx, hy, hz], 0.11, chromeMetal, { parent: root });+ beamBetween(prefix + '_UpperCollar', [midX, midY, midZ], [hx, hy, hz], 0.16, frameworkDark, { parent: root });++ // Diagonal knee brace to underbelly+ const kx = 0.8 * cosA;+ const kz = 0.8 * sinA;+ const ky = 1.9;+ beamBetween(prefix + '_KneeBrace', [midX, midY, midZ], [kx, ky, kz], 0.08, frameworkDark, { parent: root });+ }++ // Underside Gas / Life-Support Storage Tanks+ const tankAngles = [30, 90, 150, 210, 270, 330];+ for (let t = 0; t < tankAngles.length; t++) {+ const tRad = d2r(tankAngles[t]);+ const tx = 1.75 * Math.cos(tRad);+ const tz = 1.75 * Math.sin(tRad);+ createPart('Tank_' + t, capsuleGeo(0.22, 1.0, 8), tankGas, { position: [tx, 2.3, tz], parent: root });+ createPart('TankBand_' + t, cylinderGeo(0.23, 0.23, 0.25, 12), tankStripe, { position: [tx, 2.3, tz], parent: root });+ createPart('TankValve_' + t, cylinderGeo(0.07, 0.07, 0.12, 8), jointBlack, { position: [tx, 2.9, tz], parent: root });+ }++ // Maneuvering Station-Keeping Thrusters+ const thrusterAngles = [0, 90, 180, 270];+ for (let th = 0; th < 4; th++) {+ const a = d2r(thrusterAngles[th]);+ const thX = 2.8 * Math.cos(a);+ const thZ = 2.8 * Math.sin(a);+ const rotY = -thrusterAngles[th];++ beamBetween('ThPylon_' + th, [2.2 * Math.cos(a), 2.5, 2.2 * Math.sin(a)], [thX, 2.5, thZ], 0.12, frameworkDark, { parent: root });+ createPart('ThDuct_' + th, cylinderGeo(0.35, 0.35, 0.4, 14), safetyYellow, { position: [thX, 2.5, thZ], rotation: [90, rotY, 0], parent: root });+ createPart('ThCore_' + th, cylinderGeo(0.12, 0.12, 0.44, 10), jointBlack, { position: [thX, 2.5, thZ], rotation: [90, rotY, 0], parent: root });+ }++ // ==========================================+ // 3. GLASS HABITAT PODS WITH INTERIORS+ // ==========================================++ // Helper for Pod Corridors+ function buildCorridor(name, start, end) {+ beamBetween(name + '_Tube', start, end, 0.72, hullWhite, { parent: root });+ const mid = [(start[0] + end[0]) * 0.5, (start[1] + end[1]) * 0.5, (start[2] + end[2]) * 0.5];+ const dx = end[0] - start[0];+ const dz = end[2] - start[2];+ const angleY = Math.atan2(dz, dx) * 180 / Math.PI;++ createPart(name + '_Ring1', cylinderGeo(0.82, 0.82, 0.16, 18), hullDark, {+ position: [start[0] + dx * 0.35, start[1], start[2] + dz * 0.35],+ rotation: [0, -angleY, 90],+ parent: root+ });+ createPart(name + '_Ring2', cylinderGeo(0.82, 0.82, 0.16, 18), hullDark, {+ position: [start[0] + dx * 0.75, start[1], start[2] + dz * 0.75],+ rotation: [0, -angleY, 90],+ parent: root+ });++ // Subsea conduit piping along corridor underside+ const p1 = [start[0], start[1] - 0.75, start[2]];+ const p2 = [end[0], end[1] - 0.75, end[2]];+ const pipeGeo = pipeAlongPath([p1, p2], 0.05, { bendRadius: 0.1 });+ createPart(name + '_UnderPipe', pipeGeo, jointBlack, { parent: root });+ }++ // Pod 1: Forward Science / Deep Bio-Lab Pod+ buildCorridor('Corridor_Fwd', [2.3, 3.8, 0], [4.4, 3.8, 0]);+ const fwdPodCenter = [5.3, 3.8, 0];+ const podR = 1.55;++ // Glass Spheres+ createPart('Pod_Fwd_Glass', sphereGeo(podR, 24, 18), glass, { position: fwdPodCenter, parent: root });+ createPart('Pod_Fwd_EqFrame', torusGeo(podR + 0.02, 0.05, 8, 28), podFrameOrange, { position: fwdPodCenter, rotation: [90, 0, 0], parent: root });+ createPart('Pod_Fwd_MeridFrame1', torusGeo(podR + 0.02, 0.05, 8, 28), podFrameOrange, { position: fwdPodCenter, rotation: [0, 90, 0], parent: root });+ createPart('Pod_Fwd_MeridFrame2', torusGeo(podR + 0.02, 0.05, 8, 28), podFrameOrange, { position: fwdPodCenter, rotation: [0, 0, 0], parent: root });+ createPart('Pod_Fwd_NoseCap', cylinderGeo(0.18, 0.1, 0.16, 12), safetyYellow, { position: [fwdPodCenter[0] + podR, fwdPodCenter[1], fwdPodCenter[2]], rotation: [0, 0, -90], parent: root });+ createPart('Pod_Fwd_Beacon', sphereGeo(0.08, 8, 6), amberBeacon, { position: [fwdPodCenter[0] + podR + 0.14, fwdPodCenter[1], fwdPodCenter[2]], parent: root });++ // Forward Pod Interior+ createPart('Pod_Fwd_Floor', cylinderGeo(1.38, 1.38, 0.08, 20), interiorDeck, { position: [5.3, 3.0, 0], parent: root });+ createPart('Pod_Fwd_SpecimenTable', cylinderGeo(0.42, 0.42, 0.55, 12), interiorPanel, { position: [5.3, 3.32, 0], parent: root });+ createPart('Pod_Fwd_HoloSphere', sphereGeo(0.16, 12, 10), cyanGlow, { position: [5.3, 3.75, 0], parent: root });+ createPart('Pod_Fwd_ConsoleDesk', boxGeo(0.4, 0.7, 0.8), interiorPanel, { position: [5.9, 3.4, 0.4], parent: root });+ createPart('Pod_Fwd_ConsoleScreen', boxGeo(0.04, 0.35, 0.65), cyanGlow, { position: [5.7, 3.65, 0.4], parent: root });+ createPart('Pod_Fwd_Rack', boxGeo(0.35, 0.8, 0.7), interiorPanel, { position: [5.9, 3.45, -0.4], parent: root });++ // Pod 2: Starboard Habitat & Living Pod (+Z)+ buildCorridor('Corridor_Stbd', [0, 3.8, 2.3], [0, 3.8, 4.4]);+ const stbdPodCenter = [0, 3.8, 5.3];++ createPart('Pod_Stbd_Glass', sphereGeo(podR, 24, 18), glass, { position: stbdPodCenter, parent: root });+ createPart('Pod_Stbd_EqFrame', torusGeo(podR + 0.02, 0.05, 8, 28), podFrameOrange, { position: stbdPodCenter, rotation: [90, 0, 0], parent: root });+ createPart('Pod_Stbd_MeridFrame1', torusGeo(podR + 0.02, 0.05, 8, 28), podFrameOrange, { position: stbdPodCenter, rotation: [0, 0, 0], parent: root });+ createPart('Pod_Stbd_MeridFrame2', torusGeo(podR + 0.02, 0.05, 8, 28), podFrameOrange, { position: stbdPodCenter, rotation: [0, 90, 0], parent: root });+ createPart('Pod_Stbd_Cap', cylinderGeo(0.18, 0.1, 0.16, 12), safetyYellow, { position: [0, 3.8, 5.3 + podR], rotation: [90, 0, 0], parent: root });+ createPart('Pod_Stbd_Beacon', sphereGeo(0.08, 8, 6), amberBeacon, { position: [0, 3.8, 5.3 + podR + 0.14], parent: root });++ // Starboard Pod Interior+ createPart('Pod_Stbd_Floor', cylinderGeo(1.38, 1.38, 0.08, 20), interiorDeck, { position: [0, 3.0, 5.3], parent: root });+ createPart('Pod_Stbd_NavTable', cylinderGeo(0.45, 0.45, 0.55, 12), interiorPanel, { position: [0, 3.32, 5.3], parent: root });+ createPart('Pod_Stbd_NavDisplay', cylinderGeo(0.35, 0.35, 0.04, 12), cyanGlow, { position: [0, 3.62, 5.3], parent: root });+ createPart('Pod_Stbd_StationDesk', boxGeo(0.8, 0.7, 0.35), interiorPanel, { position: [0.4, 3.4, 5.9], parent: root });+ createPart('Pod_Stbd_StationScreen', boxGeo(0.65, 0.35, 0.04), cyanGlow, { position: [0.4, 3.65, 5.7], parent: root });++ // Pod 3: Port Oceanographic / Sensor Pod (-Z)+ buildCorridor('Corridor_Port', [0, 3.8, -2.3], [0, 3.8, -4.4]);+ const portPodCenter = [0, 3.8, -5.3];++ createPart('Pod_Port_Glass', sphereGeo(podR, 24, 18), glass, { position: portPodCenter, parent: root });+ createPart('Pod_Port_EqFrame', torusGeo(podR + 0.02, 0.05, 8, 28), podFrameOrange, { position: portPodCenter, rotation: [90, 0, 0], parent: root });+ createPart('Pod_Port_MeridFrame1', torusGeo(podR + 0.02, 0.05, 8, 28), podFrameOrange, { position: portPodCenter, rotation: [0, 0, 0], parent: root });+ createPart('Pod_Port_MeridFrame2', torusGeo(podR + 0.02, 0.05, 8, 28), podFrameOrange, { position: portPodCenter, rotation: [0, 90, 0], parent: root });+ createPart('Pod_Port_Cap', cylinderGeo(0.18, 0.1, 0.16, 12), safetyYellow, { position: [0, 3.8, -5.3 - podR], rotation: [-90, 0, 0], parent: root });+ createPart('Pod_Port_Beacon', sphereGeo(0.08, 8, 6), amberBeacon, { position: [0, 3.8, -5.3 - podR - 0.14], parent: root });++ // Port Pod Interior+ createPart('Pod_Port_Floor', cylinderGeo(1.38, 1.38, 0.08, 20), interiorDeck, { position: [0, 3.0, -5.3], parent: root });+ createPart('Pod_Port_Mainframe', boxGeo(0.7, 1.1, 0.4), interiorPanel, { position: [-0.3, 3.6, -5.9], parent: root });+ createPart('Pod_Port_ServerGlow', boxGeo(0.6, 0.9, 0.04), cyanGlow, { position: [-0.3, 3.6, -5.68], parent: root });+ createPart('Pod_Port_AnalysisDesk', boxGeo(0.8, 0.7, 0.35), interiorPanel, { position: [0.3, 3.4, -5.9], parent: root });++ // Pod 4: Top Command Vista Cupola+ createPart('Cupola_DeckRim', cylinderGeo(1.2, 1.25, 0.2, 20), hullDark, { position: [0, 6.7, 0], parent: root });+ createPart('Cupola_Glass', sphereGeo(1.1, 20, 14), glass, { position: [0, 6.85, 0], parent: root });+ createPart('Cupola_FrameArch1', torusGeo(1.12, 0.04, 8, 24), podFrameOrange, { position: [0, 6.85, 0], rotation: [0, 0, 0], parent: root });+ createPart('Cupola_FrameArch2', torusGeo(1.12, 0.04, 8, 24), podFrameOrange, { position: [0, 6.85, 0], rotation: [0, 90, 0], parent: root });+ createPart('Cupola_Floor', cylinderGeo(1.0, 1.0, 0.06, 18), interiorDeck, { position: [0, 6.75, 0], parent: root });+ createPart('Cupola_CommandOrb', sphereGeo(0.18, 12, 8), cyanGlow, { position: [0, 7.15, 0], parent: root });++ // ==========================================+ // 4. YELLOW ROBOTIC MANIPULATOR ARMS+ // ==========================================++ function buildArticulatedArm(armName, mountPos, yawDeg, pitch1Deg, pitch2Deg, pitch3Deg, rollDeg, gripClosed, hasScanner) {+ // 0. Reinforced Sponson Outrigger from Hull+ beamBetween(armName + '_Sponson', [2.1, 2.4, mountPos[2] * 0.65], mountPos, 0.18, frameworkDark, { parent: root });+ createPart(armName + '_BaseMount', cylinderGeo(0.42, 0.45, 0.25, 16), hullDark, {+ position: mountPos,+ parent: root+ });++ // 1. Shoulder Joint Pivot+ const shoulderPivot = createPivot(armName + '_ShoulderYaw', [mountPos[0], mountPos[1] + 0.16, mountPos[2]], root);+ shoulderPivot.rotation.y = d2r(yawDeg);++ // Turret Yoke & Rotary Table+ createPart(armName + '_YokeBase', cylinderGeo(0.38, 0.38, 0.12, 16), safetyYellow, {+ position: [0, 0.06, 0],+ parent: shoulderPivot+ });+ createPart(armName + '_YokeArmL', boxGeo(0.14, 0.55, 0.28), safetyYellow, {+ position: [0, 0.3, 0.22],+ parent: shoulderPivot+ });+ createPart(armName + '_YokeArmR', boxGeo(0.14, 0.55, 0.28), safetyYellow, {+ position: [0, 0.3, -0.22],+ parent: shoulderPivot+ });+ createPart(armName + '_ShoulderPin', cylinderGeo(0.13, 0.13, 0.52, 14), jointBlack, {+ position: [0, 0.48, 0],+ rotation: [90, 0, 0],+ parent: shoulderPivot+ });++ // 2. Shoulder Pitch Pivot+ const shoulderPitch = createPivot(armName + '_ShoulderPitch', [0, 0.48, 0], shoulderPivot);+ shoulderPitch.rotation.z = d2r(pitch1Deg);++ // Heavy Upper Arm Boom (length 2.3)+ const L1 = 2.3;+ createPart(armName + '_BoomMain', boxGeo(L1, 0.32, 0.3), safetyYellow, {+ position: [L1 * 0.5, 0, 0],+ parent: shoulderPitch+ });+ createPart(armName + '_BoomPlateT', boxGeo(L1 * 0.85, 0.04, 0.26), jointBlack, {+ position: [L1 * 0.5, 0.16, 0],+ parent: shoulderPitch+ });+ createPart(armName + '_BoomPlateB', boxGeo(L1 * 0.85, 0.04, 0.26), jointBlack, {+ position: [L1 * 0.5, -0.16, 0],+ parent: shoulderPitch+ });++ // Dual Hydraulic Lift Cylinders (Top and Bottom)+ createPart(armName + '_BoomHydrCylTop', cylinderGeo(0.06, 0.06, L1 * 0.55, 10), safetyYellow, {+ position: [L1 * 0.35, 0.24, 0],+ rotation: [0, 0, 90],+ parent: shoulderPitch+ });+ createPart(armName + '_BoomHydrRodTop', cylinderGeo(0.036, 0.036, L1 * 0.5, 10), chromeMetal, {+ position: [L1 * 0.75, 0.24, 0],+ rotation: [0, 0, 90],+ parent: shoulderPitch+ });++ // Hydraulic supply conduits along upper arm+ const upperHose = pipeAlongPath([[0, -0.22, 0.14], [L1 * 0.5, -0.24, 0.14], [L1 * 0.9, -0.22, 0.14]], 0.028, { bendRadius: 0.08 });+ createPart(armName + '_UpperHose', upperHose, jointBlack, { parent: shoulderPitch });++ // 3. Elbow Pitch Pivot+ const elbowPitch = createPivot(armName + '_ElbowPitch', [L1, 0, 0], shoulderPitch);+ elbowPitch.rotation.z = d2r(pitch2Deg);++ createPart(armName + '_ElbowHinge', cylinderGeo(0.15, 0.15, 0.38, 14), jointBlack, {+ position: [0, 0, 0],+ rotation: [90, 0, 0],+ parent: elbowPitch+ });++ // Forearm Boom (length 2.0)+ const L2 = 2.0;+ createPart(armName + '_ForearmMain', boxGeo(L2, 0.26, 0.26), safetyYellow, {+ position: [L2 * 0.5, 0, 0],+ parent: elbowPitch+ });+ // Hazard Stripes on forearm+ createPart(armName + '_HazardStripe1', boxGeo(0.22, 0.28, 0.28), jointBlack, {+ position: [L2 * 0.35, 0, 0],+ parent: elbowPitch+ });+ createPart(armName + '_HazardStripe2', boxGeo(0.22, 0.28, 0.28), jointBlack, {+ position: [L2 * 0.85, 0, 0],+ parent: elbowPitch+ });++ // Forearm Hydraulic Pitch Cylinder+ createPart(armName + '_ForeHydrCyl', cylinderGeo(0.05, 0.05, L2 * 0.5, 10), safetyYellow, {+ position: [L2 * 0.35, 0.2, 0],+ rotation: [0, 0, 90],+ parent: elbowPitch+ });+ createPart(armName + '_ForeHydrRod', cylinderGeo(0.03, 0.03, L2 * 0.45, 10), chromeMetal, {+ position: [L2 * 0.72, 0.2, 0],+ rotation: [0, 0, 90],+ parent: elbowPitch+ });++ // Flexible conduit hose on forearm+ const foreHose = pipeAlongPath([[0, -0.16, 0.12], [L2 * 0.5, -0.18, 0.12], [L2 * 0.9, -0.16, 0.12]], 0.025, { bendRadius: 0.06 });+ createPart(armName + '_ForeHose', foreHose, jointBlack, { parent: elbowPitch });++ // Arm-mounted Deep-Sea Heavy LED Work Spotlight+ createPart(armName + '_SpotHousing', cylinderGeo(0.09, 0.12, 0.22, 12), hullDark, {+ position: [L2 * 0.65, -0.22, 0],+ rotation: [0, 0, -90],+ parent: elbowPitch+ });+ createPart(armName + '_SpotLens', cylinderGeo(0.085, 0.085, 0.03, 12), floodLight, {+ position: [L2 * 0.65 + 0.12, -0.22, 0],+ rotation: [0, 0, -90],+ parent: elbowPitch+ });++ // 4. Wrist Assembly+ const wristPivot = createPivot(armName + '_Wrist', [L2, 0, 0], elbowPitch);+ wristPivot.rotation.x = d2r(rollDeg);+ wristPivot.rotation.z = d2r(pitch3Deg);++ createPart(armName + '_WristRotator', cylinderGeo(0.15, 0.15, 0.2, 14), safetyYellow, {+ position: [0.1, 0, 0],+ rotation: [0, 0, -90],+ parent: wristPivot+ });+ createPart(armName + '_WristFlange', cylinderGeo(0.17, 0.17, 0.06, 14), jointBlack, {+ position: [0.22, 0, 0],+ rotation: [0, 0, -90],+ parent: wristPivot+ });++ // 5. Tool / Manipulator End-Effector+ const clawBaseX = 0.25;++ if (hasScanner) {+ // Oceanographic Multispectral Scanner Tool Head+ createPart(armName + '_ScannerShaft', cylinderGeo(0.08, 0.08, 0.35, 12), chromeMetal, {+ position: [clawBaseX + 0.18, 0, 0],+ rotation: [0, 0, -90],+ parent: wristPivot+ });+ createPart(armName + '_ScannerHead', cylinderGeo(0.18, 0.14, 0.24, 14), safetyYellow, {+ position: [clawBaseX + 0.42, 0, 0],+ rotation: [0, 0, -90],+ parent: wristPivot+ });+ createPart(armName + '_ScannerLens', sphereGeo(0.12, 14, 10), cyanGlow, {+ position: [clawBaseX + 0.54, 0, 0],+ parent: wristPivot+ });+ createPart(armName + '_ScannerRing', torusGeo(0.19, 0.03, 8, 20), jointBlack, {+ position: [clawBaseX + 0.44, 0, 0],+ rotation: [0, 90, 0],+ parent: wristPivot+ });+ }++ // Heavy 3-Finger Articulated Gripper Claws+ const gripFactor = gripClosed ? 0.35 : 0.9;+ for (let f = 0; f < 3; f++) {+ const phi = (f * 120) * Math.PI / 180;+ const fy = Math.cos(phi) * 0.12;+ const fz = Math.sin(phi) * 0.12;++ // Base knuckle+ createPart(armName + '_FingerKnuckle_' + f, boxGeo(0.1, 0.06, 0.06), safetyYellow, {+ position: [clawBaseX + 0.05, fy, fz],+ parent: wristPivot+ });++ // Proximal heavy phalanx+ beamBetween(armName + '_FingerProx_' + f,+ [clawBaseX + 0.08, fy, fz],+ [clawBaseX + 0.28, fy * 1.15, fz * 1.15],+ 0.03, safetyYellow, { parent: wristPivot }+ );++ // Distal hardened chrome claw prong curved inward+ beamBetween(armName + '_FingerDist_' + f,+ [clawBaseX + 0.28, fy * 1.15, fz * 1.15],+ [clawBaseX + 0.48, fy * gripFactor, fz * gripFactor],+ 0.022, chromeMetal, { parent: wristPivot }+ );+ }+ }++ // Starboard Heavy Robotic Arm: Posed reaching down toward seabed mineral sample+ buildArticulatedArm('Arm_Stbd', [2.5, 2.5, 1.6], -20, -36, 46, -10, 22, true, false);++ // Port Heavy Robotic Arm: Posed hovering over forward specimen collection basket with active scanner+ buildArticulatedArm('Arm_Port', [2.5, 2.5, -1.6], 30, -18, 34, -16, -28, false, true);++ // ==========================================+ // 5. SEABED BENTHIC BASKET & WORKSTATION+ // ==========================================++ // Forward Specimen Collection Basket [4.1, 0.35, 0]+ createPart('Basket_Base', boxGeo(1.4, 0.08, 0.95), frameworkDark, { position: [4.1, 0.08, 0], parent: root });+ createPart('Basket_FrontRail', boxGeo(1.4, 0.05, 0.05), safetyYellow, { position: [4.1, 0.48, 0.47], parent: root });+ createPart('Basket_RearRail', boxGeo(1.4, 0.05, 0.05), safetyYellow, { position: [4.1, 0.48, -0.47], parent: root });+ createPart('Basket_LeftRail', boxGeo(0.05, 0.05, 0.95), safetyYellow, { position: [4.8, 0.48, 0], parent: root });+ createPart('Basket_RightRail', boxGeo(0.05, 0.05, 0.95), safetyYellow, { position: [3.4, 0.48, 0], parent: root });++ // Basket Corner Posts+ createPart('Basket_Post1', boxGeo(0.06, 0.4, 0.06), safetyYellow, { position: [4.77, 0.28, 0.44], parent: root });+ createPart('Basket_Post2', boxGeo(0.06, 0.4, 0.06), safetyYellow, { position: [4.77, 0.28, -0.44], parent: root });+ createPart('Basket_Post3', boxGeo(0.06, 0.4, 0.06), safetyYellow, { position: [3.43, 0.28, 0.44], parent: root });+ createPart('Basket_Post4', boxGeo(0.06, 0.4, 0.06), safetyYellow, { position: [3.43, 0.28, -0.44], parent: root });++ // Sturdy Deployment Support Struts Connecting Basket to Station Lower Hull+ beamBetween('Basket_StrutL', [2.3, 2.2, 0.6], [3.5, 0.45, 0.4], 0.08, frameworkDark, { parent: root });+ beamBetween('Basket_StrutR', [2.3, 2.2, -0.6], [3.5, 0.45, -0.4], 0.08, frameworkDark, { parent: root });++ // Core Sample Canisters inside Basket+ createPart('Canister_1', cylinderGeo(0.09, 0.09, 0.45, 12), chromeMetal, { position: [3.9, 0.32, 0.2], parent: root });+ createPart('Canister_1_Cap', cylinderGeo(0.095, 0.095, 0.07, 12), cyanGlow, { position: [3.9, 0.56, 0.2], parent: root });++ createPart('Canister_2', cylinderGeo(0.09, 0.09, 0.45, 12), safetyYellow, { position: [4.3, 0.32, 0.18], parent: root });+ createPart('Canister_2_Cap', cylinderGeo(0.095, 0.095, 0.07, 12), jointBlack, { position: [4.3, 0.56, 0.18], parent: root });++ createPart('Canister_3', cylinderGeo(0.09, 0.09, 0.45, 12), chromeMetal, { position: [3.8, 0.32, -0.2], parent: root });+ createPart('Canister_3_Cap', cylinderGeo(0.095, 0.095, 0.07, 12), amberBeacon, { position: [3.8, 0.56, -0.2], parent: root });++ // Seabed Hydrothermal Mineral Chimney Spire near Starboard Arm Claw+ createPart('Hydro_Mound', cylinderGeo(0.35, 0.55, 0.25, 12), frameworkDark, { position: [4.3, 0.125, 1.3], parent: root });+ createPart('Hydro_Spire', cylinderGeo(0.14, 0.28, 0.68, 12), hullDark, { position: [4.3, 0.57, 1.3], parent: root });+ createPart('Hydro_VentGlow', sphereGeo(0.09, 10, 8), amberBeacon, { position: [4.3, 0.92, 1.3], parent: root });++ // Oceanographic Subsea Sensor Tether Cable Connecting Chimney to Station Hull+ const hydroTether = pipeAlongPath([[2.2, 2.2, 1.2], [3.2, 0.3, 1.3], [4.3, 0.15, 1.3]], 0.035, { bendRadius: 0.15 });+ createPart('Hydro_SensorTether', hydroTether, jointBlack, { parent: root });++ // ==========================================+ // 6. EXTERIOR FLOODLIGHTS & UMBILICALS+ // ==========================================++ // Dual Forward Heavy LED Floodlight Pods aimed at seabed sampling+ createPart('Flood_FwdL_Bracket', boxGeo(0.1, 0.1, 0.2), frameworkDark, { position: [2.5, 3.2, 0.85], parent: root });+ createPart('Flood_FwdL_Housing', cylinderGeo(0.16, 0.22, 0.32, 12), hullDark, {+ position: [2.7, 3.1, 0.85],+ rotation: [-22, 15, 0],+ parent: root+ });+ createPart('Flood_FwdL_Lens', cylinderGeo(0.15, 0.15, 0.03, 12), floodLight, {+ position: [2.82, 3.05, 0.88],+ rotation: [-22, 15, 0],+ parent: root+ });++ createPart('Flood_FwdR_Bracket', boxGeo(0.1, 0.1, 0.2), frameworkDark, { position: [2.5, 3.2, -0.85], parent: root });+ createPart('Flood_FwdR_Housing', cylinderGeo(0.16, 0.22, 0.32, 12), hullDark, {+ position: [2.7, 3.1, -0.85],+ rotation: [-22, -15, 0],+ parent: root+ });+ createPart('Flood_FwdR_Lens', cylinderGeo(0.15, 0.15, 0.03, 12), floodLight, {+ position: [2.82, 3.05, -0.88],+ rotation: [-22, -15, 0],+ parent: root+ });++ return root;+}diff --git a/site/examples/history/demo-diesel-locomotive/history.json b/site/examples/history/demo-diesel-locomotive/history.jsonnew file mode 100644index 00000000..5add92c4--- /dev/null+++ b/site/examples/history/demo-diesel-locomotive/history.json@@ -0,0 +1,22 @@+{+ "version": 1,+ "brief": {+ "kind": "recorded",+ "text": "Make the red paint deep forest green and the handrails brass."+ },+ "currentSourceHash": "483aef3d91f13d831e9c964dcd059957ee26b4c230b92cf2feb26d684e548378",+ "revisions": [+ {+ "file": "revision-1.kiln.js",+ "title": "Saved revision 1",+ "description": "Create a red and cream diesel locomotive with detailed wheels and running gear.",+ "sourceHash": "341f79e9b238326374b535b05221baa7eda081d38563e57df03dc931aadf74b1"+ },+ {+ "file": "revision-2.kiln.js",+ "title": "Saved revision 2",+ "description": "Make the red paint deep forest green and the handrails brass.",+ "sourceHash": "483aef3d91f13d831e9c964dcd059957ee26b4c230b92cf2feb26d684e548378"+ }+ ]+}diff --git a/site/examples/history/demo-diesel-locomotive/revision-1.kiln.js b/site/examples/history/demo-diesel-locomotive/revision-1.kiln.jsnew file mode 100644index 00000000..ed879639--- /dev/null+++ b/site/examples/history/demo-diesel-locomotive/revision-1.kiln.js@@ -0,0 +1,195 @@+const meta = {name:"RCL 2406 — Red & Cream Diesel",category:"vehicle",role:"vehicle"};+function build(){+const root=createRoot("RCL_2406_Diesel");+const red=gameMaterial(0xa62328,{metalness:.3,roughness:.36});+const cream=gameMaterial(0xf1dfb2,{metalness:.15,roughness:.44});+const dark=gameMaterial(0x242b30,{metalness:.6,roughness:.48});+const steel=gameMaterial(0x697278,{metalness:.85,roughness:.28});+const black=gameMaterial(0x10191f,{metalness:.25,roughness:.5});+const glass=gameMaterial(0x244650,{metalness:.55,roughness:.18});+const lamp=gameMaterial(0xffedba,{emissive:0xffd994,emissiveIntensity:.45,roughness:.2});+function box(n,w,h,d,x,y,z,m,p=root){return createPart(n,boxGeo(w,h,d),m,{position:[x,y,z],parent:p});}+function cyl(n,r,h,x,y,z,m,rot=[90,0,0],p=root,seg=32){return createPart(n,cylinderGeo(r,r,h,seg),m,{position:[x,y,z],rotation:rot,parent:p});}+function rod(n,a,b,r,m,p=root){+const av=new THREE.Vector3(...a),bv=new THREE.Vector3(...b),v=bv.clone().sub(av);+const ob=createPart(n,cylinderGeo(r,r,v.length(),10),m,{position:av.clone().add(bv).multiplyScalar(.5).toArray(),parent:p});+ob.quaternion.setFromUnitVectors(new THREE.Vector3(0,1,0),v.normalize());return ob;+}+function pipe(n,pts,r,m,p=root){+const curve=new THREE.CatmullRomCurve3(pts.map(a=>new THREE.Vector3(...a)));+return createPart(n,new THREE.TubeGeometry(curve,Math.max(12,pts.length*5),r,6,false),m,{parent:p});+}+function prism(n,x0,x1,profile,m,p=root){+const v=[],idx=[],N=profile.length; for(const x of [x0,x1])for(const yz of profile)v.push(x,yz[0],yz[1]);+for(let i=1;i<N-1;i++){idx.push(0,i+1,i);idx.push(N,N+i,N+i+1);}+for(let i=0;i<N;i++){let j=(i+1)%N;idx.push(i,j,N+j,i,N+j,N+i);}+const g=new THREE.BufferGeometry();g.setAttribute("position",new THREE.Float32BufferAttribute(v,3));g.setIndex(idx);g.computeVertexNormals();+return createPart(n,g,m,{parent:p});+}+box("Main_sill",16.2,.32,2.9,0,1.56,0,dark);+box("Red_walkway_edge",16.35,.13,3.06,0,1.79,0,red);+box("Walkway_tread",16.25,.065,3.02,0,1.89,0,dark);+prism("Long_hood",-7.25,2.65,[[1.94,-1.06],[3.65,-1.06],[3.91,-.82],[3.91,.82],[3.65,1.06],[1.94,1.06]],red);+for(const s of [-1,1]){+box("Cream_hood_band_"+s,9.91,.42,.028,-2.3,3.06,s*1.077,cream);+box("Lower_cream_pinstripe_"+s,9.91,.055,.028,-2.3,2.77,s*1.079,cream);+for(let i=0;i<10;i++){+const x=-6.78+i*.92;+box("Engine_access_seam_"+s+"_"+i,.018,.70,.018,x,2.34,s*1.079,black);+box("Panel_handle_"+s+"_"+i,.16,.035,.05,x+.38,2.45,s*1.096,steel);+box("Panel_hinge_"+s+"_"+i,.065,.12,.044,x+.06,2.25,s*1.09,dark);+}+for(let j=0;j<3;j++){+let x=-6.37+j*1.07;+box("Radiator_recess_"+s+"_"+j,.9,.59,.034,x,3.5,s*1.08,black);+for(let k=0;k<7;k++)box("Radiator_louver_"+s+"_"+j+"_"+k,.83,.028,.048,x,3.26+k*.073,s*1.108,steel);+}+for(let j=0;j<2;j++){+box("Intake_recess_"+s+"_"+j,.7,.52,.03,1+j*.83,3.52,s*1.08,black);+for(let k=0;k<7;k++)box("Intake_grille_"+s+"_"+j+"_"+k,.025,.46,.045,.73+j*.83+k*.09,3.52,s*1.1,dark);+}+}+prism("Cab_shell",2.65,4.85,[[1.95,-1.43],[3.94,-1.43],[4.38,-1.04],[4.38,1.04],[3.94,1.43],[1.95,1.43]],red);+prism("Cream_cab_roof",2.49,5.00,[[3.99,-1.50],[4.46,-1.08],[4.50,-.8],[4.50,.8],[4.46,1.08],[3.99,1.50]],cream);+for(const s of [-1,1]){+box("Cab_cream_waist_"+s,2.21,.42,.026,3.75,3.06,s*1.447,cream);+box("Cab_window_seal_"+s,1.56,.73,.038,3.77,3.7,s*1.451,black);+box("Cab_side_glass_"+s,1.43,.61,.044,3.77,3.7,s*1.478,glass);+box("Cab_window_mullion_"+s,.055,.65,.057,3.64,3.7,s*1.505,cream);+box("Cab_sill_"+s,1.65,.055,.095,3.77,3.30,s*1.48,cream);+box("Cab_door_seam_"+s,.72,.94,.02,3.92,2.44,s*1.45,dark);+box("Cab_door_panel_"+s,.68,.90,.025,3.92,2.44,s*1.464,red);+box("Cab_door_latch_"+s,.17,.045,.07,4.13,2.71,s*1.5,steel);+}+for(const end of [2.633,4.872]){+for(const s of [-1,1]){+box("Windshield_gasket_"+end+"_"+s,.04,.70,.96,end,3.75,s*.66,black);+box("Windshield_glass_"+end+"_"+s,.055,.58,.84,end+(end>4?.025:-.025),3.75,s*.66,glass);+rod("Wiper_"+end+"_"+s,[end+(end>4?.068:-.068),3.47,s*.35],[end+(end>4?.068:-.068),3.91,s*.8],.013,dark);+}+}+prism("Short_nose",4.84,7.25,[[1.91,-1.06],[2.79,-1.06],[3.02,-.81],[3.02,.81],[2.79,1.06],[1.91,1.06]],red);+for(const s of [-1,1])box("Nose_cream_band_"+s,2.35,.32,.025,6.075,2.66,s*1.078,cream);+box("Front_nose_cream_band",.026,.32,2.13,7.27,2.66,0,cream);+box("Rear_cream_band",.026,.42,2.13,-7.27,3.06,0,cream);+// Roof fans: rings, radial blades, grille bars.+for(let i=0;i<3;i++){+let x=-5.9+i*1.55;+cyl("Fan_shroud_"+i,.61,.11,x,3.96,0,dark,[0,0,0]);+cyl("Fan_recess_"+i,.52,.12,x,3.97,0,black,[0,0,0]);+cyl("Fan_hub_"+i,.11,.15,x,4.02,0,steel,[0,0,0],root,20);+for(let j=0;j<10;j++){+let a=j*Math.PI/5;rod("Fan_radial_grille_"+i+"_"+j,[x+Math.cos(a)*.1,4.053,Math.sin(a)*.1],[x+Math.cos(a)*.56,4.053,Math.sin(a)*.56],.015,steel);+}+for(const r of [.27,.44,.59]){+const t=createPart("Fan_cage_ring_"+i+"_"+r,new THREE.TorusGeometry(r,.014,6,40),steel,{position:[x,4.057,0],rotation:[90,0,0],parent:root});+}+}+box("Exhaust_plinth",.7,.15,.65,-.70,3.98,0,dark);+cyl("Exhaust_stack",.18,.37,-.70,4.18,0,dark,[0,0,0],root,20);+cyl("Exhaust_dark_mouth",.135,.008,-.70,4.37,0,black,[0,0,0],root,20);+for(const s of [-1,1]){+cyl("Horn_"+s,.095,.39,3.16,4.61,s*.25,cream,[0,0,90],root,16);+cyl("Horn_bell_"+s,.14,.035,3.36,4.61,s*.25,dark,[0,0,90],root,20);+rod("Horn_mount_"+s,[3.05,4.44,s*.25],[3.05,4.6,s*.25],.025,dark);+}+rod("Antenna",[4.2,4.47,.15],[4.2,4.94,.15],.014,steel);+// Underbody tank and separate air reservoirs.+prism("Fuel_tank",-2.30,2.05,[[.34,-.85],[.34,.85],[.50,1.13],[1.32,1.13],[1.4,.95],[1.4,-.95],[1.32,-1.13],[.50,-1.13]],dark);+for(const x of [-1.8,1.5])for(const s of [-1,1])box("Tank_strap_"+x+"_"+s,.13,.80,.035,x,.91,s*1.15,steel);+for(const s of [-1,1]){+cyl("Air_reservoir_"+s,.21,2.7,-.1,1.28,s*1.32,dark,[0,0,90]);+cyl("Fuel_cap_"+s,.11,.06,.65,1.19,s*1.19,steel);+pipe("Air_line_"+s,[[-2.6,1.30,s*1.37],[-1.8,1.48,s*1.37],[1.7,1.48,s*1.37],[2.65,1.20,s*1.37]],.032,steel);+}+// Six powered axles, flanges, recessed wheel faces, exposed truck frames.+for(const c of [-4.75,4.75]){+const truck=createPivot(c<0?"Rear_truck":"Front_truck",[c,0,0],root);+box("Truck_cross_bolster",1.1,.30,2.35,0,1.14,0,dark,truck);+cyl("Truck_pivot",.4,.26,0,1.40,0,steel,[0,0,0],truck);+for(const a of [-1.28,0,1.28]){+cyl("Axle_"+a,.125,2.41,a,.59,0,steel,[90,0,0],truck,20);+cyl("Traction_motor_"+a,.27,.96,a+.28,.72,0,dark,[90,0,0],truck,20);+for(const s of [-1,1]){+cyl("Wheel_tread_"+a+"_"+s,.59,.19,a,.59,s*.84,steel,[90,0,0],truck,48);+cyl("Wheel_flange_"+a+"_"+s,.635,.047,a,.59,s*.733,dark,[90,0,0],truck,48);+cyl("Wheel_dished_face_"+a+"_"+s,.46,.032,a,.59,s*.955,dark,[90,0,0],truck,40);+cyl("Wheel_hub_"+a+"_"+s,.20,.11,a,.59,s*1.008,steel,[90,0,0],truck,24);+cyl("Axle_box_round_"+a+"_"+s,.185,.23,a,.59,s*1.16,dark,[90,0,0],truck,24);+box("Axle_box_cover_"+a+"_"+s,.30,.29,.06,a,.59,s*1.31,steel,truck);+for(const dx of [-.10,.10])for(const dy of [-.095,.095])cyl("Axlebox_bolt",.026,.028,a+dx,.59+dy,s*1.358,dark,[90,0,0],truck,8);+for(const dx of [-.43,.43]){+box("Brake_shoe",.12,.32,.19,a+dx,.57,s*.91,dark,truck);+rod("Brake_hanger",[a+dx,.66,s*1.01],[a+dx*.87,1.03,s*1.02],.038,steel,truck);+}+}+}+for(const s of [-1,1]){+box("Truck_upper_frame_"+s,3.55,.18,.24,0,1.06,s*1.18,dark,truck);+box("Truck_lower_tie_"+s,3.22,.105,.16,0,.37,s*1.18,dark,truck);+for(const x of [-.66,.66]){+box("Spring_bottom_seat",.54,.09,.35,x,.64,s*1.2,steel,truck);+box("Spring_upper_seat",.54,.07,.35,x,1.05,s*1.2,steel,truck);+for(const dx of [-.14,.14]){+const pts=[];for(let k=0;k<=64;k++){let a=k/64*Math.PI*12;pts.push([x+dx+.082*Math.cos(a),.70+k/64*.28,s*1.2+.082*Math.sin(a)]);}+pipe("Suspension_coil",pts,.023,steel,truck);+}+rod("Suspension_diagonal",[x-.24,.43,s*1.23],[x+.22,.93,s*1.23],.055,dark,truck);+}+rod("Brake_pull_rod",[-1.69,.79,s*1.37],[1.69,.79,s*1.37],.03,steel,truck);+for(const ax of [-1.28,0,1.28])rod("Brake_cross_link",[ax+.38,.91,s*1.02],[ax+.38,.79,s*1.37],.035,steel,truck);+cyl("Brake_cylinder",.115,.46,.62,1.20,s*1.19,dark,[0,0,90],truck,16);+for(const x of [-1.7,1.7])rod("Frame_end_taper",[x,1.06,s*1.18],[x*.90,.38,s*1.18],.08,dark,truck);+}+}+// End pilots, knuckle couplers, hoses and steps.+for(const e of [-1,1]){+box("Pilot_beam_"+e,.23,.64,2.88,e*8.13,1.16,0,red);+prism("Pilot_plow_"+e,e*8.13-.16,e*8.13+.16,[[.28,-1.30],[.28,1.30],[.94,1.43],[.94,-1.43]],dark);+box("Coupler_shank_"+e,.67,.19,.24,e*8.51,.94,0,steel);+box("Coupler_head_"+e,.30,.28,.40,e*8.85,.96,0,dark);+box("Coupler_knuckle_"+e,.18,.27,.16,e*8.99,.96,.17,steel);+for(const s of [-1,1]){+pipe("Brake_hose_"+e+"_"+s,[[e*8.3,1.28,s*.49],[e*8.53,.99,s*.55],[e*8.49,.56,s*.61],[e*8.30,.58,s*.65]],.042,black);+box("End_marker_housing_"+e+"_"+s,.1,.16,.18,e*7.32,2.23,s*.79,dark);+cyl("End_marker_lens_"+e+"_"+s,.06,.045,e*7.39,2.23,s*.79,lamp,[0,0,90],root,16);+for(let i=0;i<4;i++){+box("Entry_step_"+e+"_"+s,.59,.09,.40,e*(7.63+.07*i),.52+i*.35,s*1.28,steel);+}+rod("Step_outer_stringer_"+e+"_"+s,[e*7.9,.44,s*1.49],[e*7.6,1.88,s*1.49],.047,dark);+}+for(const y of [2.92,3.17]){+cyl("Headlight_bezel_"+e+"_"+y,.135,.09,e*(e>0?4.94:7.34),e>0?y+.89:y+.33,0,steel,[0,0,90]);+cyl("Headlight_lens_"+e+"_"+y,.102,.10,e*(e>0?4.97:7.37),e>0?y+.89:y+.33,0,lamp,[0,0,90]);+}+}+// Safety rails: side walkways and end returns.+for(const s of [-1,1]){+for(const range of [[-7.85,2.5],[5.1,7.9]]){+rod("Cream_top_handrail",[range[0],2.79,s*1.43],[range[1],2.79,s*1.43],.032,cream);+const count=Math.ceil((range[1]-range[0])/1.4);+for(let i=0;i<=count;i++){+let x=range[0]+(range[1]-range[0])*i/count;+rod("Handrail_stanchion",[x,1.91,s*1.43],[x,2.79,s*1.43],.028,cream);+box("Stanchion_foot",.09,.10,.09,x,1.96,s*1.43,dark);+}+}+for(const e of [-1,1]){+rod("End_handrail",[e*7.91,2.79,s*1.43],[e*7.91,2.79,s*.40],.032,cream);+rod("End_gate_upright",[e*7.91,1.93,s*.4],[e*7.91,2.79,s*.4],.03,cream);+}+}+// Crisp geometry-based road numbers.+const glyphs={"2":[0,1,6,4,3],"4":[5,6,1,2],"0":[0,1,2,3,4,5],"6":[0,5,6,4,3,2]};+function number(s){+const str="2406",sz=.30,base=-1.43;+for(let i=0;i<4;i++){let x=base+i*.39;for(const a of glyphs[str[i]]){+const xy=[[0,.2],[.1,.1],[.1,-.1],[0,-.2],[-.1,-.1],[-.1,.1],[0,0]][a];+box("Road_number_"+s+"_"+i+"_"+a,a===0||a===3||a===6?.19:.038,a===0||a===3||a===6?.035:.18,.018,x+xy[0],3.48+xy[1],s*1.087,cream);+}}+}+number(-1);number(1);+const nameCounts={};root.traverse(o=>{const n=o.name||"Part";nameCounts[n]=(nameCounts[n]||0)+1;if(nameCounts[n]>1)o.name=n+"_"+nameCounts[n];});+root.position.y=.045;+return root;+}\ No newline at end of filediff --git a/site/examples/history/demo-diesel-locomotive/revision-2.kiln.js b/site/examples/history/demo-diesel-locomotive/revision-2.kiln.jsnew file mode 100644index 00000000..6ff2e03f--- /dev/null+++ b/site/examples/history/demo-diesel-locomotive/revision-2.kiln.js@@ -0,0 +1,196 @@+const meta = {name:"RCL 2406 — Red & Cream Diesel",category:"vehicle",role:"vehicle"};+function build(){+const root=createRoot("RCL_2406_Diesel");+const red=gameMaterial(0x173f2c,{metalness:.3,roughness:.36});+const brass=gameMaterial(0xb9954e,{metalness:.85,roughness:.26});+const cream=gameMaterial(0xf1dfb2,{metalness:.15,roughness:.44});+const dark=gameMaterial(0x242b30,{metalness:.6,roughness:.48});+const steel=gameMaterial(0x697278,{metalness:.85,roughness:.28});+const black=gameMaterial(0x10191f,{metalness:.25,roughness:.5});+const glass=gameMaterial(0x244650,{metalness:.55,roughness:.18});+const lamp=gameMaterial(0xffedba,{emissive:0xffd994,emissiveIntensity:.45,roughness:.2});+function box(n,w,h,d,x,y,z,m,p=root){return createPart(n,boxGeo(w,h,d),m,{position:[x,y,z],parent:p});}+function cyl(n,r,h,x,y,z,m,rot=[90,0,0],p=root,seg=32){return createPart(n,cylinderGeo(r,r,h,seg),m,{position:[x,y,z],rotation:rot,parent:p});}+function rod(n,a,b,r,m,p=root){+const av=new THREE.Vector3(...a),bv=new THREE.Vector3(...b),v=bv.clone().sub(av);+const ob=createPart(n,cylinderGeo(r,r,v.length(),10),m,{position:av.clone().add(bv).multiplyScalar(.5).toArray(),parent:p});+ob.quaternion.setFromUnitVectors(new THREE.Vector3(0,1,0),v.normalize());return ob;+}+function pipe(n,pts,r,m,p=root){+const curve=new THREE.CatmullRomCurve3(pts.map(a=>new THREE.Vector3(...a)));+return createPart(n,new THREE.TubeGeometry(curve,Math.max(12,pts.length*5),r,6,false),m,{parent:p});+}+function prism(n,x0,x1,profile,m,p=root){+const v=[],idx=[],N=profile.length; for(const x of [x0,x1])for(const yz of profile)v.push(x,yz[0],yz[1]);+for(let i=1;i<N-1;i++){idx.push(0,i+1,i);idx.push(N,N+i,N+i+1);}+for(let i=0;i<N;i++){let j=(i+1)%N;idx.push(i,j,N+j,i,N+j,N+i);}+const g=new THREE.BufferGeometry();g.setAttribute("position",new THREE.Float32BufferAttribute(v,3));g.setIndex(idx);g.computeVertexNormals();+return createPart(n,g,m,{parent:p});+}+box("Main_sill",16.2,.32,2.9,0,1.56,0,dark);+box("Red_walkway_edge",16.35,.13,3.06,0,1.79,0,red);+box("Walkway_tread",16.25,.065,3.02,0,1.89,0,dark);+prism("Long_hood",-7.25,2.65,[[1.94,-1.06],[3.65,-1.06],[3.91,-.82],[3.91,.82],[3.65,1.06],[1.94,1.06]],red);+for(const s of [-1,1]){+box("Cream_hood_band_"+s,9.91,.42,.028,-2.3,3.06,s*1.077,cream);+box("Lower_cream_pinstripe_"+s,9.91,.055,.028,-2.3,2.77,s*1.079,cream);+for(let i=0;i<10;i++){+const x=-6.78+i*.92;+box("Engine_access_seam_"+s+"_"+i,.018,.70,.018,x,2.34,s*1.079,black);+box("Panel_handle_"+s+"_"+i,.16,.035,.05,x+.38,2.45,s*1.096,steel);+box("Panel_hinge_"+s+"_"+i,.065,.12,.044,x+.06,2.25,s*1.09,dark);+}+for(let j=0;j<3;j++){+let x=-6.37+j*1.07;+box("Radiator_recess_"+s+"_"+j,.9,.59,.034,x,3.5,s*1.08,black);+for(let k=0;k<7;k++)box("Radiator_louver_"+s+"_"+j+"_"+k,.83,.028,.048,x,3.26+k*.073,s*1.108,steel);+}+for(let j=0;j<2;j++){+box("Intake_recess_"+s+"_"+j,.7,.52,.03,1+j*.83,3.52,s*1.08,black);+for(let k=0;k<7;k++)box("Intake_grille_"+s+"_"+j+"_"+k,.025,.46,.045,.73+j*.83+k*.09,3.52,s*1.1,dark);+}+}+prism("Cab_shell",2.65,4.85,[[1.95,-1.43],[3.94,-1.43],[4.38,-1.04],[4.38,1.04],[3.94,1.43],[1.95,1.43]],red);+prism("Cream_cab_roof",2.49,5.00,[[3.99,-1.50],[4.46,-1.08],[4.50,-.8],[4.50,.8],[4.46,1.08],[3.99,1.50]],cream);+for(const s of [-1,1]){+box("Cab_cream_waist_"+s,2.21,.42,.026,3.75,3.06,s*1.447,cream);+box("Cab_window_seal_"+s,1.56,.73,.038,3.77,3.7,s*1.451,black);+box("Cab_side_glass_"+s,1.43,.61,.044,3.77,3.7,s*1.478,glass);+box("Cab_window_mullion_"+s,.055,.65,.057,3.64,3.7,s*1.505,cream);+box("Cab_sill_"+s,1.65,.055,.095,3.77,3.30,s*1.48,cream);+box("Cab_door_seam_"+s,.72,.94,.02,3.92,2.44,s*1.45,dark);+box("Cab_door_panel_"+s,.68,.90,.025,3.92,2.44,s*1.464,red);+box("Cab_door_latch_"+s,.17,.045,.07,4.13,2.71,s*1.5,steel);+}+for(const end of [2.633,4.872]){+for(const s of [-1,1]){+box("Windshield_gasket_"+end+"_"+s,.04,.70,.96,end,3.75,s*.66,black);+box("Windshield_glass_"+end+"_"+s,.055,.58,.84,end+(end>4?.025:-.025),3.75,s*.66,glass);+rod("Wiper_"+end+"_"+s,[end+(end>4?.068:-.068),3.47,s*.35],[end+(end>4?.068:-.068),3.91,s*.8],.013,dark);+}+}+prism("Short_nose",4.84,7.25,[[1.91,-1.06],[2.79,-1.06],[3.02,-.81],[3.02,.81],[2.79,1.06],[1.91,1.06]],red);+for(const s of [-1,1])box("Nose_cream_band_"+s,2.35,.32,.025,6.075,2.66,s*1.078,cream);+box("Front_nose_cream_band",.026,.32,2.13,7.27,2.66,0,cream);+box("Rear_cream_band",.026,.42,2.13,-7.27,3.06,0,cream);+// Roof fans: rings, radial blades, grille bars.+for(let i=0;i<3;i++){+let x=-5.9+i*1.55;+cyl("Fan_shroud_"+i,.61,.11,x,3.96,0,dark,[0,0,0]);+cyl("Fan_recess_"+i,.52,.12,x,3.97,0,black,[0,0,0]);+cyl("Fan_hub_"+i,.11,.15,x,4.02,0,steel,[0,0,0],root,20);+for(let j=0;j<10;j++){+let a=j*Math.PI/5;rod("Fan_radial_grille_"+i+"_"+j,[x+Math.cos(a)*.1,4.053,Math.sin(a)*.1],[x+Math.cos(a)*.56,4.053,Math.sin(a)*.56],.015,steel);+}+for(const r of [.27,.44,.59]){+const t=createPart("Fan_cage_ring_"+i+"_"+r,new THREE.TorusGeometry(r,.014,6,40),steel,{position:[x,4.057,0],rotation:[90,0,0],parent:root});+}+}+box("Exhaust_plinth",.7,.15,.65,-.70,3.98,0,dark);+cyl("Exhaust_stack",.18,.37,-.70,4.18,0,dark,[0,0,0],root,20);+cyl("Exhaust_dark_mouth",.135,.008,-.70,4.37,0,black,[0,0,0],root,20);+for(const s of [-1,1]){+cyl("Horn_"+s,.095,.39,3.16,4.61,s*.25,cream,[0,0,90],root,16);+cyl("Horn_bell_"+s,.14,.035,3.36,4.61,s*.25,dark,[0,0,90],root,20);+rod("Horn_mount_"+s,[3.05,4.44,s*.25],[3.05,4.6,s*.25],.025,dark);+}+rod("Antenna",[4.2,4.47,.15],[4.2,4.94,.15],.014,steel);+// Underbody tank and separate air reservoirs.+prism("Fuel_tank",-2.30,2.05,[[.34,-.85],[.34,.85],[.50,1.13],[1.32,1.13],[1.4,.95],[1.4,-.95],[1.32,-1.13],[.50,-1.13]],dark);+for(const x of [-1.8,1.5])for(const s of [-1,1])box("Tank_strap_"+x+"_"+s,.13,.80,.035,x,.91,s*1.15,steel);+for(const s of [-1,1]){+cyl("Air_reservoir_"+s,.21,2.7,-.1,1.28,s*1.32,dark,[0,0,90]);+cyl("Fuel_cap_"+s,.11,.06,.65,1.19,s*1.19,steel);+pipe("Air_line_"+s,[[-2.6,1.30,s*1.37],[-1.8,1.48,s*1.37],[1.7,1.48,s*1.37],[2.65,1.20,s*1.37]],.032,steel);+}+// Six powered axles, flanges, recessed wheel faces, exposed truck frames.+for(const c of [-4.75,4.75]){+const truck=createPivot(c<0?"Rear_truck":"Front_truck",[c,0,0],root);+box("Truck_cross_bolster",1.1,.30,2.35,0,1.14,0,dark,truck);+cyl("Truck_pivot",.4,.26,0,1.40,0,steel,[0,0,0],truck);+for(const a of [-1.28,0,1.28]){+cyl("Axle_"+a,.125,2.41,a,.59,0,steel,[90,0,0],truck,20);+cyl("Traction_motor_"+a,.27,.96,a+.28,.72,0,dark,[90,0,0],truck,20);+for(const s of [-1,1]){+cyl("Wheel_tread_"+a+"_"+s,.59,.19,a,.59,s*.84,steel,[90,0,0],truck,48);+cyl("Wheel_flange_"+a+"_"+s,.635,.047,a,.59,s*.733,dark,[90,0,0],truck,48);+cyl("Wheel_dished_face_"+a+"_"+s,.46,.032,a,.59,s*.955,dark,[90,0,0],truck,40);+cyl("Wheel_hub_"+a+"_"+s,.20,.11,a,.59,s*1.008,steel,[90,0,0],truck,24);+cyl("Axle_box_round_"+a+"_"+s,.185,.23,a,.59,s*1.16,dark,[90,0,0],truck,24);+box("Axle_box_cover_"+a+"_"+s,.30,.29,.06,a,.59,s*1.31,steel,truck);+for(const dx of [-.10,.10])for(const dy of [-.095,.095])cyl("Axlebox_bolt",.026,.028,a+dx,.59+dy,s*1.358,dark,[90,0,0],truck,8);+for(const dx of [-.43,.43]){+box("Brake_shoe",.12,.32,.19,a+dx,.57,s*.91,dark,truck);+rod("Brake_hanger",[a+dx,.66,s*1.01],[a+dx*.87,1.03,s*1.02],.038,steel,truck);+}+}+}+for(const s of [-1,1]){+box("Truck_upper_frame_"+s,3.55,.18,.24,0,1.06,s*1.18,dark,truck);+box("Truck_lower_tie_"+s,3.22,.105,.16,0,.37,s*1.18,dark,truck);+for(const x of [-.66,.66]){+box("Spring_bottom_seat",.54,.09,.35,x,.64,s*1.2,steel,truck);+box("Spring_upper_seat",.54,.07,.35,x,1.05,s*1.2,steel,truck);+for(const dx of [-.14,.14]){+const pts=[];for(let k=0;k<=64;k++){let a=k/64*Math.PI*12;pts.push([x+dx+.082*Math.cos(a),.70+k/64*.28,s*1.2+.082*Math.sin(a)]);}+pipe("Suspension_coil",pts,.023,steel,truck);+}+rod("Suspension_diagonal",[x-.24,.43,s*1.23],[x+.22,.93,s*1.23],.055,dark,truck);+}+rod("Brake_pull_rod",[-1.69,.79,s*1.37],[1.69,.79,s*1.37],.03,steel,truck);+for(const ax of [-1.28,0,1.28])rod("Brake_cross_link",[ax+.38,.91,s*1.02],[ax+.38,.79,s*1.37],.035,steel,truck);+cyl("Brake_cylinder",.115,.46,.62,1.20,s*1.19,dark,[0,0,90],truck,16);+for(const x of [-1.7,1.7])rod("Frame_end_taper",[x,1.06,s*1.18],[x*.90,.38,s*1.18],.08,dark,truck);+}+}+// End pilots, knuckle couplers, hoses and steps.+for(const e of [-1,1]){+box("Pilot_beam_"+e,.23,.64,2.88,e*8.13,1.16,0,red);+prism("Pilot_plow_"+e,e*8.13-.16,e*8.13+.16,[[.28,-1.30],[.28,1.30],[.94,1.43],[.94,-1.43]],dark);+box("Coupler_shank_"+e,.67,.19,.24,e*8.51,.94,0,steel);+box("Coupler_head_"+e,.30,.28,.40,e*8.85,.96,0,dark);+box("Coupler_knuckle_"+e,.18,.27,.16,e*8.99,.96,.17,steel);+for(const s of [-1,1]){+pipe("Brake_hose_"+e+"_"+s,[[e*8.3,1.28,s*.49],[e*8.53,.99,s*.55],[e*8.49,.56,s*.61],[e*8.30,.58,s*.65]],.042,black);+box("End_marker_housing_"+e+"_"+s,.1,.16,.18,e*7.32,2.23,s*.79,dark);+cyl("End_marker_lens_"+e+"_"+s,.06,.045,e*7.39,2.23,s*.79,lamp,[0,0,90],root,16);+for(let i=0;i<4;i++){+box("Entry_step_"+e+"_"+s,.59,.09,.40,e*(7.63+.07*i),.52+i*.35,s*1.28,steel);+}+rod("Step_outer_stringer_"+e+"_"+s,[e*7.9,.44,s*1.49],[e*7.6,1.88,s*1.49],.047,dark);+}+for(const y of [2.92,3.17]){+cyl("Headlight_bezel_"+e+"_"+y,.135,.09,e*(e>0?4.94:7.34),e>0?y+.89:y+.33,0,steel,[0,0,90]);+cyl("Headlight_lens_"+e+"_"+y,.102,.10,e*(e>0?4.97:7.37),e>0?y+.89:y+.33,0,lamp,[0,0,90]);+}+}+// Safety rails: side walkways and end returns.+for(const s of [-1,1]){+for(const range of [[-7.85,2.5],[5.1,7.9]]){+rod("Cream_top_handrail",[range[0],2.79,s*1.43],[range[1],2.79,s*1.43],.032,brass);+const count=Math.ceil((range[1]-range[0])/1.4);+for(let i=0;i<=count;i++){+let x=range[0]+(range[1]-range[0])*i/count;+rod("Handrail_stanchion",[x,1.91,s*1.43],[x,2.79,s*1.43],.028,brass);+box("Stanchion_foot",.09,.10,.09,x,1.96,s*1.43,dark);+}+}+for(const e of [-1,1]){+rod("End_handrail",[e*7.91,2.79,s*1.43],[e*7.91,2.79,s*.40],.032,brass);+rod("End_gate_upright",[e*7.91,1.93,s*.4],[e*7.91,2.79,s*.4],.03,brass);+}+}+// Crisp geometry-based road numbers.+const glyphs={"2":[0,1,6,4,3],"4":[5,6,1,2],"0":[0,1,2,3,4,5],"6":[0,5,6,4,3,2]};+function number(s){+const str="2406",sz=.30,base=-1.43;+for(let i=0;i<4;i++){let x=base+i*.39;for(const a of glyphs[str[i]]){+const xy=[[0,.2],[.1,.1],[.1,-.1],[0,-.2],[-.1,-.1],[-.1,.1],[0,0]][a];+box("Road_number_"+s+"_"+i+"_"+a,a===0||a===3||a===6?.19:.038,a===0||a===3||a===6?.035:.18,.018,x+xy[0],3.48+xy[1],s*1.087,cream);+}}+}+number(-1);number(1);+const nameCounts={};root.traverse(o=>{const n=o.name||"Part";nameCounts[n]=(nameCounts[n]||0)+1;if(nameCounts[n]>1)o.name=n+"_"+nameCounts[n];});+root.position.y=.045;+return root;+}\ No newline at end of filediff --git a/site/examples/history/demo-floating-observatory/history.json b/site/examples/history/demo-floating-observatory/history.jsonnew file mode 100644index 00000000..24cd6220--- /dev/null+++ b/site/examples/history/demo-floating-observatory/history.json@@ -0,0 +1,22 @@+{+ "version": 1,+ "brief": {+ "kind": "recorded",+ "text": "Add a waterfall spilling off the island and glowing purple crystals underneath."+ },+ "currentSourceHash": "331508e4cd10ff4c9329fc3b5adfea6a9e346424cf53bfa48ee185d170bcdb68",+ "revisions": [+ {+ "file": "revision-1.kiln.js",+ "title": "Saved revision 1",+ "description": "Create a floating island observatory with a brass telescope and a spiral staircase.",+ "sourceHash": "ffb3801bcd4c57d0f489919d16c45081e5ca481741d5d3e9a0e407e6516f9ea2"+ },+ {+ "file": "revision-2.kiln.js",+ "title": "Saved revision 2",+ "description": "Add a waterfall spilling off the island and glowing purple crystals underneath.",+ "sourceHash": "331508e4cd10ff4c9329fc3b5adfea6a9e346424cf53bfa48ee185d170bcdb68"+ }+ ]+}diff --git a/site/examples/history/demo-floating-observatory/revision-1.kiln.js b/site/examples/history/demo-floating-observatory/revision-1.kiln.jsnew file mode 100644index 00000000..80be95fd--- /dev/null+++ b/site/examples/history/demo-floating-observatory/revision-1.kiln.js@@ -0,0 +1,148 @@+const meta = {name:'AETHER REACH — Floating Observatory',category:'environment',role:'poi'};+function build(){+ const root=createRoot('AetherReach');+ const P={ground:4.05,towerX:-0.55,deck:7.45,steps:42,turn:Math.PI*2.15};+ const stone=gameMaterial(0xd3c9ab,{roughness:0.86});+ const trim=gameMaterial(0xeee0bc,{roughness:0.72});+ const rockM=[0x394652,0x45545e,0x52616b,0x657078].map(c=>gameMaterial(c,{roughness:1,flatShading:true}));+ const grass=gameMaterial(0x557b65,{roughness:1});+ const moss=gameMaterial(0x789273,{roughness:1});+ const teal=gameMaterial(0x276b70,{metalness:0.5,roughness:0.43});+ const brass=gameMaterial(0xc99b4e,{metalness:0.78,roughness:0.25});+ const darkBrass=gameMaterial(0x806138,{metalness:0.7,roughness:0.42});+ const dark=gameMaterial(0x23363d,{roughness:0.6});+ const wood=gameMaterial(0x795942,{roughness:0.85});+ const glass=gameMaterial(0x358a9a,{metalness:0.5,roughness:0.16,emissive:0x123e50,emissiveIntensity:0.28});+ const crystal=gameMaterial(0x77c9c3,{metalness:0.25,roughness:0.3,emissive:0x2e6b67,emissiveIntensity:0.3});+ function part(n,g,m,p=[0,0,0],par=root){return createPart(n,g,m,{position:p,parent:par});}+ function group(n,p=[0,0,0],par=root){const g=new THREE.Group();g.name=n;g.position.set(...p);par.add(g);return g;}+ function cyl(n,r1,r2,h,m,p,par=root){return part(n,new THREE.CylinderGeometry(r1,r2,h,32),m,p,par);}+ function rod(n,a,b,r,m,par=root){const v=new THREE.Vector3(...a),w=new THREE.Vector3(...b);const d=w.clone().sub(v);const o=part(n,new THREE.CylinderGeometry(r,r,d.length(),8),m,v.add(w).multiplyScalar(0.5).toArray(),par);o.quaternion.setFromUnitVectors(new THREE.Vector3(0,1,0),d.normalize());return o;}+ function curve(n,pts,r,m,par=root){return part(n,new THREE.TubeGeometry(new THREE.CatmullRomCurve3(pts.map(p=>new THREE.Vector3(...p))),Math.max(12,pts.length*2),r,6,false),m,[0,0,0],par);}+ function ring(n,r,t,y,m,par=root){const o=part(n,new THREE.TorusGeometry(r,t,8,72),m,[0,y,0],par);o.rotation.x=Math.PI/2;return o;}+ function sector(n,ri,ro,a,b,y,h,m,par=root){+ const vs=[],ids=[],N=6;+ for(let k=0;k<2;k++)for(let r of [ri,ro])for(let j=0;j<=N;j++){const t=a+(b-a)*j/N;vs.push(r*Math.cos(t),y+k*h,r*Math.sin(t));}+ const L=N+1;function quad(a,b,c,d){ids.push(a,b,c,a,c,d);}+ for(let j=0;j<N;j++){quad(j,j+1,L+j+1,L+j);quad(2*L+j,3*L+j,3*L+j+1,2*L+j+1);quad(j,2*L+j,2*L+j+1,j+1);quad(L+j,L+j+1,3*L+j+1,3*L+j);}+ quad(0,L,3*L,2*L);quad(N,2*L+N,3*L+N,L+N);+ return part(n,meshGeo({positions:vs,indices:ids}),m,[0,0,0],par);+ }+ // A deterministic, jagged inverted mountain. Each belt shares its boundary.+ const island=group('FloatingIsland');+ const count=15;+ const rings=[{y:0.12,r:0.18,dx:0.5,dz:0.1},{y:1.2,r:1.5,dx:0.3,dz:0.1},{y:2.6,r:3.05,dx:0.1,dz:0},{y:3.65,r:4.25,dx:0,dz:0},{y:4.02,r:4.05,dx:0,dz:0}];+ const vertices=rings.map((q,k)=>Array.from({length:count},(_,i)=>{const a=i/count*Math.PI*2;const f=1+0.11*Math.sin(i*7.13)+0.055*Math.cos(i*3.8);return [q.dx+q.r*f*Math.cos(a),q.y+(k===4?0:0.19*Math.sin(i*2.31+k)),q.dz+q.r*f*Math.sin(a)*0.88];}));+ for(let k=0;k<rings.length-1;k++){+ let v=[],idx=[];for(let i=0;i<count;i++){let j=(i+1)%count;let p=[vertices[k][i],vertices[k+1][i],vertices[k+1][j],vertices[k][j]];let o=v.length/3;v.push(...p.flat());idx.push(o,o+1,o+2,o,o+2,o+3);}+ const geo=meshGeo({positions:v,indices:idx}).toNonIndexed();geo.computeVertexNormals();part('CragBelt_'+k,geo,rockM[k], [0,0,0],island);+ }+ const capV=[0,4.025,0,...vertices[4].flat()],capI=[];+ for(let i=0;i<count;i++)capI.push(0,1+(i+1)%count,1+i);+ part('MeadowCrown',meshGeo({positions:capV,indices:capI}),grass,[0,0,0],island);+ for(let i=0;i<9;i++){+ const a=i*2.399,r=2.5+(i%3)*0.4;+ const o=part('RimStone_'+i,new THREE.DodecahedronGeometry(0.35+(i%3)*0.13,0),rockM[i%4],[Math.cos(a)*r,3.97,Math.sin(a)*r*0.9],island);o.scale.set(1.3,0.65,1);o.rotation.y=a;+ }+ for(let i=0;i<7;i++){+ const a=i*2.4,r=2.2+(i%3)*0.27;+ const o=part('UndersideCrystal_'+i,new THREE.CylinderGeometry(0.03,0.18+(i%2)*0.08,0.95+(i%3)*0.27,5),crystal,[Math.cos(a)*r,2.08+(i%3)*0.3,Math.sin(a)*r*0.88],island);o.rotation.z=Math.PI+0.22*Math.sin(a);o.rotation.x=0.2*Math.cos(a);+ }+ for(let i=0;i<3;i++){+ const a=[0.1,2.8,4.7][i],r=4.6;+ const o=part('DriftingSatellite_'+i,new THREE.DodecahedronGeometry(0.45+i*0.09,0),rockM[1],[Math.cos(a)*r,2.5-i*0.6,Math.sin(a)*r*0.85]);o.scale.set(1,1.4,0.8);o.rotation.set(0.3,i,0.4);+ }+ const tower=group('ObservatoryTower',[P.towerX,0,0]);+ cyl('Foundation',1.4,1.55,0.24,rockM[2],[0,P.ground+0.1,0],tower);+ cyl('MasonryCore',1.03,1.12,3.13,stone,[0,5.73,0],tower);+ for(let row=0;row<7;row++){+ ring('CourseJoint_'+row,1.08,0.016,4.37+row*0.41,darkBrass,tower);+ for(let j=0;j<12;j++){const a=(j+(row%2)*0.5)/12*Math.PI*2;rod('MasonrySeam_'+row+'_'+j,[1.082*Math.cos(a),4.39+row*0.41,1.082*Math.sin(a)],[1.082*Math.cos(a),4.76+row*0.41,1.082*Math.sin(a)],0.009,darkBrass,tower);}+ }+ // Narrow brass-framed windows on the tower.+ for(let i=0;i<4;i++){+ const a=i*Math.PI/2+0.3,g=group('TowerWindow_'+i,[1.085*Math.cos(a),5.65,1.085*Math.sin(a)],tower);g.rotation.y=Math.PI/2-a;+ part('WindowFrame_'+i,new THREE.BoxGeometry(0.36,0.85,0.085),brass,[0,0,0],g);+ part('WindowGlass_'+i,new THREE.BoxGeometry(0.27,0.71,0.095),dark,[0,0,0.008],g);+ rod('WindowMullion_'+i,[0,-0.36,0.065],[0,0.36,0.065],0.018,brass,g);+ }+ const stairs=group('SpiralStaircase',[P.towerX,0,0]);+ const start=-Math.PI/2,stepRise=(P.deck-P.ground)/P.steps;+ for(let i=0;i<P.steps;i++){+ const a=start+i*P.turn/P.steps,b=start+(i+1)*P.turn/P.steps;+ const y=P.ground+i*stepRise;+ sector('StoneTread_'+String(i+1).padStart(2,'0'),1.12,2.03,a,b-0.012,y,0.095,trim,stairs);+ sector('BrassTreadNosing_'+i,1.14,2.025,b-0.04,b-0.015,y+0.096,0.012,darkBrass,stairs);+ const mid=(a+b)/2;+ if(i%2===0)rod('StairBaluster_'+i,[2.01*Math.cos(mid),y+0.1,2.01*Math.sin(mid)],[2.01*Math.cos(mid),y+0.9,2.01*Math.sin(mid)],0.025,brass,stairs);+ }+ let rail=[],stringer=[];+ for(let i=0;i<=168;i++){let f=i/168,a=start+f*P.turn;rail.push([2.01*Math.cos(a),P.ground+f*(P.deck-P.ground)+0.87,2.01*Math.sin(a)]);stringer.push([1.91*Math.cos(a),P.ground+f*(P.deck-P.ground)-0.06,1.91*Math.sin(a)]);}+ curve('ContinuousSpiralHandrail',rail,0.045,brass,stairs);+ curve('SpiralOuterStringer',stringer,0.065,teal,stairs);+ cyl('TerraceCentralDais',1.12,1.12,0.18,trim,[0,P.deck-0.02,0],tower);+ cyl('TerraceDaisSurface',1.12,1.12,0.045,wood,[0,P.deck+0.09,0],tower);+ const exit=start+P.turn;+ for(let k=0;k<20;k++){+ const a=exit+(3.1+Math.PI*2-exit)*k/20,b=exit+(3.1+Math.PI*2-exit)*(k+1)/20;+ sector('TerraceSlabPanel_'+k,1.1,2.12,a,b,P.deck-0.11,0.18,trim,tower);+ sector('TerraceDeckPanel_'+k,1.1,2.05,a,b,P.deck+0.068,0.045,wood,tower);+ }+ const innerRail=[];+ for(let k=0;k<=36;k++){const a=3.1+(exit-3.1)*k/36;innerRail.push([1.1*Math.cos(a),P.deck+0.78,1.1*Math.sin(a)]);if(k%6===0)rod('StairwellDaisPost_'+k,[1.1*Math.cos(a),P.deck+0.12,1.1*Math.sin(a)],[1.1*Math.cos(a),P.deck+0.78,1.1*Math.sin(a)],0.023,brass,tower);}+ curve('StairwellDaisGuard',innerRail,0.035,brass,tower);+ ring('TerraceBrassRim',2.1,0.045,P.deck+0.075,brass,tower);+ // Roof is an open half-dome, leaving the instrument visible from the front.+ const roof=group('OpenObservatoryDome',[0,P.deck+0.18,0],tower);+ const dome=part('PatinatedCopperHalfDome',new THREE.SphereGeometry(1.98,32,16,-Math.PI/2,Math.PI,0,Math.PI/2),teal,[0,0,0],roof);+ dome.material.side=THREE.DoubleSide;+ for(let j=0;j<=8;j++){+ const phi=-Math.PI/2+j*Math.PI/8,pts=[];+ for(let k=0;k<=24;k++){const t=k/24*Math.PI/2;pts.push([-2*Math.cos(phi)*Math.sin(t),2*Math.cos(t),2*Math.sin(phi)*Math.sin(t)]);}+ curve('DomeMeridian_'+j,pts,0.024,brass,roof);+ }+ const rim=[];for(let i=0;i<=48;i++){const a=Math.PI/2+i/48*Math.PI;rim.push([1.99*Math.cos(a),0,1.99*Math.sin(a)]);}curve('DomeLowerRim',rim,0.065,brass,roof);+ cyl('DomeFinialFoot',0.16,0.2,0.12,brass,[0,2.05,0],roof);+ part('DomeFinial',new THREE.SphereGeometry(0.11,12,8),brass,[0,2.2,0],roof);+ // Partial terrace guard, with a gap where the last stair arrives.+ for(let j=0;j<18;j++){+ const a=-1.32+j*2.64/17;if(a> -1.17&&a< -0.78)continue;+ rod('TerraceBaluster_'+j,[2.035*Math.cos(a),P.deck+0.12,2.035*Math.sin(a)],[2.035*Math.cos(a),P.deck+0.69,2.035*Math.sin(a)],0.026,brass,tower);+ }+ for(const interval of [[-1.42,-1.19],[-0.76,1.42]]){const pts=[];for(let k=0;k<=30;k++){const a=interval[0]+(interval[1]-interval[0])*k/30;pts.push([2.035*Math.cos(a),P.deck+0.7,2.035*Math.sin(a)]);}curve('TerraceGuard_'+interval[0],pts,0.042,brass,tower);}+ const telescope=group('BrassTelescope',[0.18,P.deck+0.12,0],tower);+ cyl('AzimuthBase',0.52,0.64,0.13,darkBrass,[0,0.08,0],telescope);+ cyl('AzimuthDial',0.54,0.54,0.08,brass,[0,0.18,0],telescope);+ cyl('TelescopePier',0.18,0.28,0.88,teal,[0,0.64,0],telescope);+ for(let z of [-0.36,0.36]){rod('MountFork_'+z,[0,0.87,z],[0,1.18,z],0.07,brass,telescope);}+ rod('ElevationAxle',[0,1.18,-0.5],[0,1.18,0.5],0.085,darkBrass,telescope);+ const tube=group('TiltingOpticalTube',[0,1.18,0],telescope);tube.rotation.z=0.43;+ function barrel(n,x,len,r1,r2,m){const o=cyl(n,r1,r2,len,m,[x,0,0],tube);o.rotation.z=-Math.PI/2;return o;}+ barrel('BrassMainBarrel',0.14,2.22,0.27,0.21,brass);+ barrel('ForwardDewShield',1.39,0.52,0.36,0.29,brass);+ barrel('ObjectiveDarkRecess',1.654,0.01,0.305,0.305,dark);+ barrel('ObjectiveBlueLens',1.662,0.009,0.26,0.26,glass);+ barrel('RearFocuser',-1.11,0.36,0.13,0.17,darkBrass);+ barrel('Eyepiece',-1.38,0.18,0.095,0.095,brass);+ barrel('Eyecup',-1.49,0.07,0.11,0.11,dark);+ for(let x of [-0.78,0.04,0.79,1.16,1.62]){const o=part('BarrelCollar_'+x,new THREE.TorusGeometry(x>1?0.345:0.27,0.032,8,40),darkBrass,[x,0,0],tube);o.rotation.y=Math.PI/2;}+ rod('FinderBracketA',[-0.3,0.2,0],[-0.3,0.43,0],0.035,brass,tube);+ rod('FinderBracketB',[0.35,0.2,0],[0.35,0.43,0],0.035,brass,tube);+ const finder=cyl('FinderScope',0.075,0.075,0.95,brass,[0.08,0.44,0],tube);finder.rotation.z=-Math.PI/2;+ const wheel=part('ElevationHandwheel',new THREE.TorusGeometry(0.21,0.024,8,32),brass,[0,1.18,0.54],telescope);+ for(let i=0;i<4;i++){const a=i*Math.PI/2;rod('HandwheelSpoke_'+i,[0,1.18,0.54],[Math.cos(a)*0.2,1.18+Math.sin(a)*0.2,0.54],0.016,brass,telescope);}+ // Entrance path, low plant clumps, and warm beacon lanterns.+ for(let i=0;i<7;i++){const a=-Math.PI/2-0.36+i*0.075,r=3.6-i*0.23;const o=cyl('ApproachPaver_'+i,0.3,0.34,0.08,stone,[P.towerX+Math.cos(a)*r,4.07,Math.sin(a)*r]);o.scale.z=0.72;o.rotation.y=a;}+ for(let i=0;i<12;i++){+ const a=i*2.399,r=2.75+(i%3)*0.32;+ for(let j=0;j<3;j++){const o=part('GrassTuft_'+i+'_'+j,new THREE.ConeGeometry(0.09,0.34+j*0.08,4),j%2?moss:grass,[Math.cos(a)*r+j*0.08,4.18,Math.sin(a)*r*0.85]);o.rotation.z=(j-1)*0.3;}+ }+ for(let i=0;i<2;i++){+ const x=1.75,z=i?1.95:-2.05;const g=group('BeaconLantern_'+i,[x,4.07,z]);+ cyl('BeaconFoot_'+i,0.19,0.28,0.12,darkBrass,[0,0.06,0],g);+ rod('BeaconPost_'+i,[0,0.1,0],[0,0.89,0],0.055,brass,g);+ cyl('BeaconLight_'+i,0.12,0.12,0.28,gameMaterial(0xffd68b,{emissive:0xffab45,emissiveIntensity:0.7}),[0,1.02,0],g);+ part('BeaconCap_'+i,new THREE.ConeGeometry(0.23,0.17,8),teal,[0,1.25,0],g);+ }+ return root;+}\ No newline at end of filediff --git a/site/examples/history/demo-floating-observatory/revision-2.kiln.js b/site/examples/history/demo-floating-observatory/revision-2.kiln.jsnew file mode 100644index 00000000..91b1fdb7--- /dev/null+++ b/site/examples/history/demo-floating-observatory/revision-2.kiln.js@@ -0,0 +1,208 @@+const meta = {name:'AETHER REACH — Floating Observatory',category:'environment',role:'poi'};+function build(){+ const root=createRoot('AetherReach');+ const P={ground:4.05,towerX:-0.55,deck:7.45,steps:42,turn:Math.PI*2.15};+ const stone=gameMaterial(0xd3c9ab,{roughness:0.86});+ const trim=gameMaterial(0xeee0bc,{roughness:0.72});+ const rockM=[0x394652,0x45545e,0x52616b,0x657078].map(c=>gameMaterial(c,{roughness:1,flatShading:true}));+ const grass=gameMaterial(0x557b65,{roughness:1});+ const moss=gameMaterial(0x789273,{roughness:1});+ const teal=gameMaterial(0x276b70,{metalness:0.5,roughness:0.43});+ const brass=gameMaterial(0xc99b4e,{metalness:0.78,roughness:0.25});+ const darkBrass=gameMaterial(0x806138,{metalness:0.7,roughness:0.42});+ const dark=gameMaterial(0x23363d,{roughness:0.6});+ const wood=gameMaterial(0x795942,{roughness:0.85});+ const glass=gameMaterial(0x358a9a,{metalness:0.5,roughness:0.16,emissive:0x123e50,emissiveIntensity:0.28});+ const crystal=gameMaterial(0xb16af0,{metalness:0.18,roughness:0.28,emissive:0x9738ed,emissiveIntensity:1.65});+ function part(n,g,m,p=[0,0,0],par=root){return createPart(n,g,m,{position:p,parent:par});}+ function group(n,p=[0,0,0],par=root){const g=new THREE.Group();g.name=n;g.position.set(...p);par.add(g);return g;}+ function cyl(n,r1,r2,h,m,p,par=root){return part(n,new THREE.CylinderGeometry(r1,r2,h,32),m,p,par);}+ function rod(n,a,b,r,m,par=root){const v=new THREE.Vector3(...a),w=new THREE.Vector3(...b);const d=w.clone().sub(v);const o=part(n,new THREE.CylinderGeometry(r,r,d.length(),8),m,v.add(w).multiplyScalar(0.5).toArray(),par);o.quaternion.setFromUnitVectors(new THREE.Vector3(0,1,0),d.normalize());return o;}+ function curve(n,pts,r,m,par=root){return part(n,new THREE.TubeGeometry(new THREE.CatmullRomCurve3(pts.map(p=>new THREE.Vector3(...p))),Math.max(12,pts.length*2),r,6,false),m,[0,0,0],par);}+ function ring(n,r,t,y,m,par=root){const o=part(n,new THREE.TorusGeometry(r,t,8,72),m,[0,y,0],par);o.rotation.x=Math.PI/2;return o;}+ function sector(n,ri,ro,a,b,y,h,m,par=root){+ const vs=[],ids=[],N=6;+ for(let k=0;k<2;k++)for(let r of [ri,ro])for(let j=0;j<=N;j++){const t=a+(b-a)*j/N;vs.push(r*Math.cos(t),y+k*h,r*Math.sin(t));}+ const L=N+1;function quad(a,b,c,d){ids.push(a,b,c,a,c,d);}+ for(let j=0;j<N;j++){quad(j,j+1,L+j+1,L+j);quad(2*L+j,3*L+j,3*L+j+1,2*L+j+1);quad(j,2*L+j,2*L+j+1,j+1);quad(L+j,L+j+1,3*L+j+1,3*L+j);}+ quad(0,L,3*L,2*L);quad(N,2*L+N,3*L+N,L+N);+ return part(n,meshGeo({positions:vs,indices:ids}),m,[0,0,0],par);+ }+ // A deterministic, jagged inverted mountain. Each belt shares its boundary.+ const island=group('FloatingIsland');+ const count=15;+ const rings=[{y:0.12,r:0.18,dx:0.5,dz:0.1},{y:1.2,r:1.5,dx:0.3,dz:0.1},{y:2.6,r:3.05,dx:0.1,dz:0},{y:3.65,r:4.25,dx:0,dz:0},{y:4.02,r:4.05,dx:0,dz:0}];+ const vertices=rings.map((q,k)=>Array.from({length:count},(_,i)=>{const a=i/count*Math.PI*2;const f=1+0.11*Math.sin(i*7.13)+0.055*Math.cos(i*3.8);return [q.dx+q.r*f*Math.cos(a),q.y+(k===4?0:0.19*Math.sin(i*2.31+k)),q.dz+q.r*f*Math.sin(a)*0.88];}));+ for(let k=0;k<rings.length-1;k++){+ let v=[],idx=[];for(let i=0;i<count;i++){let j=(i+1)%count;let p=[vertices[k][i],vertices[k+1][i],vertices[k+1][j],vertices[k][j]];let o=v.length/3;v.push(...p.flat());idx.push(o,o+1,o+2,o,o+2,o+3);}+ const geo=meshGeo({positions:v,indices:idx}).toNonIndexed();geo.computeVertexNormals();part('CragBelt_'+k,geo,rockM[k], [0,0,0],island);+ }+ const capV=[0,4.025,0,...vertices[4].flat()],capI=[];+ for(let i=0;i<count;i++)capI.push(0,1+(i+1)%count,1+i);+ part('MeadowCrown',meshGeo({positions:capV,indices:capI}),grass,[0,0,0],island);+ for(let i=0;i<9;i++){+ const a=i*2.399,r=2.5+(i%3)*0.4;+ const o=part('RimStone_'+i,new THREE.DodecahedronGeometry(0.35+(i%3)*0.13,0),rockM[i%4],[Math.cos(a)*r,3.97,Math.sin(a)*r*0.9],island);o.scale.set(1.3,0.65,1);o.rotation.y=a;+ }+ const crystalCore=gameMaterial(0xe0afff,{metalness:0.1,roughness:0.28,emissive:0xbb62ff,emissiveIntensity:2.3});+ const crystalShade=gameMaterial(0x743bb8,{metalness:0.2,roughness:0.35,emissive:0x7621d1,emissiveIntensity:0.85});+ const gems=group('GlowingPurpleCrystalClusters',[0,0,0],island);+ function shard(n,top,bottom,r,m){+ const delta=new THREE.Vector3(...top).sub(new THREE.Vector3(...bottom)),len=delta.length(),vs=[],ids=[];+ const profiles=[[0,0.01],[0.26,r],[len*0.82,r*0.9],[len,r*0.3]];+ for(const q of profiles)for(let j=0;j<6;j++){const a=j*Math.PI/3;vs.push(Math.cos(a)*q[1],q[0],Math.sin(a)*q[1]);}+ for(let k=0;k<3;k++)for(let j=0;j<6;j++){const a=k*6+j,b=k*6+(j+1)%6;ids.push(a,b,b+6,a,b+6,a+6);}+ for(let j=1;j<5;j++){ids.push(0,j+1,j);ids.push(18,18+j,19+j);}+ const o=part(n,meshGeo({positions:vs,indices:ids}).toNonIndexed(),m,bottom,gems);+ o.quaternion.setFromUnitVectors(new THREE.Vector3(0,1,0),delta.normalize());+ }+ for(let i=0;i<7;i++){+ const a=i*2.4,r=2.45+(i%3)*0.26,y=2.95+(i%3)*0.17;+ const top=[Math.cos(a)*r,y,Math.sin(a)*r*0.88];+ const tip=[Math.cos(a)*(r+0.25),y-1.85-(i%3)*0.32,Math.sin(a)*(r+0.25)*0.88];+ shard('AmethystMain_'+i,top,tip,0.25+(i%2)*0.08,crystal);+ for(let j of [-1,1]){+ const b=a+j*0.17,rt=r+0.17;+ shard('AmethystCompanion_'+i+'_'+j,[Math.cos(b)*rt,y-0.02,Math.sin(b)*rt*0.88],+ [Math.cos(b)*(rt+0.24),y-1.12-0.2*(i%2),Math.sin(b)*(rt+0.24)*0.88],0.15,j===1?crystalCore:crystalShade);+ }+ }+ for(let i=0;i<3;i++){+ const a=[0.1,2.8,4.7][i],r=4.6;+ const o=part('DriftingSatellite_'+i,new THREE.DodecahedronGeometry(0.45+i*0.09,0),rockM[1],[Math.cos(a)*r,2.5-i*0.6,Math.sin(a)*r*0.85]);o.scale.set(1,1.4,0.8);o.rotation.set(0.3,i,0.4);+ }+ const tower=group('ObservatoryTower',[P.towerX,0,0]);+ cyl('Foundation',1.4,1.55,0.24,rockM[2],[0,P.ground+0.1,0],tower);+ cyl('MasonryCore',1.03,1.12,3.13,stone,[0,5.73,0],tower);+ for(let row=0;row<7;row++){+ ring('CourseJoint_'+row,1.08,0.016,4.37+row*0.41,darkBrass,tower);+ for(let j=0;j<12;j++){const a=(j+(row%2)*0.5)/12*Math.PI*2;rod('MasonrySeam_'+row+'_'+j,[1.082*Math.cos(a),4.39+row*0.41,1.082*Math.sin(a)],[1.082*Math.cos(a),4.76+row*0.41,1.082*Math.sin(a)],0.009,darkBrass,tower);}+ }+ // Narrow brass-framed windows on the tower.+ for(let i=0;i<4;i++){+ const a=i*Math.PI/2+0.3,g=group('TowerWindow_'+i,[1.085*Math.cos(a),5.65,1.085*Math.sin(a)],tower);g.rotation.y=Math.PI/2-a;+ part('WindowFrame_'+i,new THREE.BoxGeometry(0.36,0.85,0.085),brass,[0,0,0],g);+ part('WindowGlass_'+i,new THREE.BoxGeometry(0.27,0.71,0.095),dark,[0,0,0.008],g);+ rod('WindowMullion_'+i,[0,-0.36,0.065],[0,0.36,0.065],0.018,brass,g);+ }+ const stairs=group('SpiralStaircase',[P.towerX,0,0]);+ const start=-Math.PI/2,stepRise=(P.deck-P.ground)/P.steps;+ for(let i=0;i<P.steps;i++){+ const a=start+i*P.turn/P.steps,b=start+(i+1)*P.turn/P.steps;+ const y=P.ground+i*stepRise;+ sector('StoneTread_'+String(i+1).padStart(2,'0'),1.12,2.03,a,b-0.012,y,0.095,trim,stairs);+ sector('BrassTreadNosing_'+i,1.14,2.025,b-0.04,b-0.015,y+0.096,0.012,darkBrass,stairs);+ const mid=(a+b)/2;+ if(i%2===0)rod('StairBaluster_'+i,[2.01*Math.cos(mid),y+0.1,2.01*Math.sin(mid)],[2.01*Math.cos(mid),y+0.9,2.01*Math.sin(mid)],0.025,brass,stairs);+ }+ let rail=[],stringer=[];+ for(let i=0;i<=168;i++){let f=i/168,a=start+f*P.turn;rail.push([2.01*Math.cos(a),P.ground+f*(P.deck-P.ground)+0.87,2.01*Math.sin(a)]);stringer.push([1.91*Math.cos(a),P.ground+f*(P.deck-P.ground)-0.06,1.91*Math.sin(a)]);}+ curve('ContinuousSpiralHandrail',rail,0.045,brass,stairs);+ curve('SpiralOuterStringer',stringer,0.065,teal,stairs);+ cyl('TerraceCentralDais',1.12,1.12,0.18,trim,[0,P.deck-0.02,0],tower);+ cyl('TerraceDaisSurface',1.12,1.12,0.045,wood,[0,P.deck+0.09,0],tower);+ const exit=start+P.turn;+ for(let k=0;k<20;k++){+ const a=exit+(3.1+Math.PI*2-exit)*k/20,b=exit+(3.1+Math.PI*2-exit)*(k+1)/20;+ sector('TerraceSlabPanel_'+k,1.1,2.12,a,b,P.deck-0.11,0.18,trim,tower);+ sector('TerraceDeckPanel_'+k,1.1,2.05,a,b,P.deck+0.068,0.045,wood,tower);+ }+ const innerRail=[];+ for(let k=0;k<=36;k++){const a=3.1+(exit-3.1)*k/36;innerRail.push([1.1*Math.cos(a),P.deck+0.78,1.1*Math.sin(a)]);if(k%6===0)rod('StairwellDaisPost_'+k,[1.1*Math.cos(a),P.deck+0.12,1.1*Math.sin(a)],[1.1*Math.cos(a),P.deck+0.78,1.1*Math.sin(a)],0.023,brass,tower);}+ curve('StairwellDaisGuard',innerRail,0.035,brass,tower);+ ring('TerraceBrassRim',2.1,0.045,P.deck+0.075,brass,tower);+ // Roof is an open half-dome, leaving the instrument visible from the front.+ const roof=group('OpenObservatoryDome',[0,P.deck+0.18,0],tower);+ const dome=part('PatinatedCopperHalfDome',new THREE.SphereGeometry(1.98,32,16,-Math.PI/2,Math.PI,0,Math.PI/2),teal,[0,0,0],roof);+ dome.material.side=THREE.DoubleSide;+ for(let j=0;j<=8;j++){+ const phi=-Math.PI/2+j*Math.PI/8,pts=[];+ for(let k=0;k<=24;k++){const t=k/24*Math.PI/2;pts.push([-2*Math.cos(phi)*Math.sin(t),2*Math.cos(t),2*Math.sin(phi)*Math.sin(t)]);}+ curve('DomeMeridian_'+j,pts,0.024,brass,roof);+ }+ const rim=[];for(let i=0;i<=48;i++){const a=Math.PI/2+i/48*Math.PI;rim.push([1.99*Math.cos(a),0,1.99*Math.sin(a)]);}curve('DomeLowerRim',rim,0.065,brass,roof);+ cyl('DomeFinialFoot',0.16,0.2,0.12,brass,[0,2.05,0],roof);+ part('DomeFinial',new THREE.SphereGeometry(0.11,12,8),brass,[0,2.2,0],roof);+ // Partial terrace guard, with a gap where the last stair arrives.+ for(let j=0;j<18;j++){+ const a=-1.32+j*2.64/17;if(a> -1.17&&a< -0.78)continue;+ rod('TerraceBaluster_'+j,[2.035*Math.cos(a),P.deck+0.12,2.035*Math.sin(a)],[2.035*Math.cos(a),P.deck+0.69,2.035*Math.sin(a)],0.026,brass,tower);+ }+ for(const interval of [[-1.42,-1.19],[-0.76,1.42]]){const pts=[];for(let k=0;k<=30;k++){const a=interval[0]+(interval[1]-interval[0])*k/30;pts.push([2.035*Math.cos(a),P.deck+0.7,2.035*Math.sin(a)]);}curve('TerraceGuard_'+interval[0],pts,0.042,brass,tower);}+ const telescope=group('BrassTelescope',[0.18,P.deck+0.12,0],tower);+ cyl('AzimuthBase',0.52,0.64,0.13,darkBrass,[0,0.08,0],telescope);+ cyl('AzimuthDial',0.54,0.54,0.08,brass,[0,0.18,0],telescope);+ cyl('TelescopePier',0.18,0.28,0.88,teal,[0,0.64,0],telescope);+ for(let z of [-0.36,0.36]){rod('MountFork_'+z,[0,0.87,z],[0,1.18,z],0.07,brass,telescope);}+ rod('ElevationAxle',[0,1.18,-0.5],[0,1.18,0.5],0.085,darkBrass,telescope);+ const tube=group('TiltingOpticalTube',[0,1.18,0],telescope);tube.rotation.z=0.43;+ function barrel(n,x,len,r1,r2,m){const o=cyl(n,r1,r2,len,m,[x,0,0],tube);o.rotation.z=-Math.PI/2;return o;}+ barrel('BrassMainBarrel',0.14,2.22,0.27,0.21,brass);+ barrel('ForwardDewShield',1.39,0.52,0.36,0.29,brass);+ barrel('ObjectiveDarkRecess',1.654,0.01,0.305,0.305,dark);+ barrel('ObjectiveBlueLens',1.662,0.009,0.26,0.26,glass);+ barrel('RearFocuser',-1.11,0.36,0.13,0.17,darkBrass);+ barrel('Eyepiece',-1.38,0.18,0.095,0.095,brass);+ barrel('Eyecup',-1.49,0.07,0.11,0.11,dark);+ for(let x of [-0.78,0.04,0.79,1.16,1.62]){const o=part('BarrelCollar_'+x,new THREE.TorusGeometry(x>1?0.345:0.27,0.032,8,40),darkBrass,[x,0,0],tube);o.rotation.y=Math.PI/2;}+ rod('FinderBracketA',[-0.3,0.2,0],[-0.3,0.43,0],0.035,brass,tube);+ rod('FinderBracketB',[0.35,0.2,0],[0.35,0.43,0],0.035,brass,tube);+ const finder=cyl('FinderScope',0.075,0.075,0.95,brass,[0.08,0.44,0],tube);finder.rotation.z=-Math.PI/2;+ const wheel=part('ElevationHandwheel',new THREE.TorusGeometry(0.21,0.024,8,32),brass,[0,1.18,0.54],telescope);+ for(let i=0;i<4;i++){const a=i*Math.PI/2;rod('HandwheelSpoke_'+i,[0,1.18,0.54],[Math.cos(a)*0.2,1.18+Math.sin(a)*0.2,0.54],0.016,brass,telescope);}+ // Entrance path, low plant clumps, and warm beacon lanterns.+ for(let i=0;i<7;i++){const a=-Math.PI/2-0.36+i*0.075,r=3.6-i*0.23;const o=cyl('ApproachPaver_'+i,0.3,0.34,0.08,stone,[P.towerX+Math.cos(a)*r,4.07,Math.sin(a)*r]);o.scale.z=0.72;o.rotation.y=a;}+ for(let i=0;i<12;i++){+ const a=i*2.399,r=2.75+(i%3)*0.32;+ for(let j=0;j<3;j++){const o=part('GrassTuft_'+i+'_'+j,new THREE.ConeGeometry(0.09,0.34+j*0.08,4),j%2?moss:grass,[Math.cos(a)*r+j*0.08,4.18,Math.sin(a)*r*0.85]);o.rotation.z=(j-1)*0.3;}+ }+ for(let i=0;i<2;i++){+ const x=1.75,z=i?1.95:-2.05;const g=group('BeaconLantern_'+i,[x,4.07,z]);+ cyl('BeaconFoot_'+i,0.19,0.28,0.12,darkBrass,[0,0.06,0],g);+ rod('BeaconPost_'+i,[0,0.1,0],[0,0.89,0],0.055,brass,g);+ cyl('BeaconLight_'+i,0.12,0.12,0.28,gameMaterial(0xffd68b,{emissive:0xffab45,emissiveIntensity:0.7}),[0,1.02,0],g);+ part('BeaconCap_'+i,new THREE.ConeGeometry(0.23,0.17,8),teal,[0,1.25,0],g);+ }+ // Spring-fed waterfall: a shallow pool joins a continuous fluted curtain.+ const water=gameMaterial(0x42c6df,{metalness:0.15,roughness:0.22,emissive:0x0c556d,emissiveIntensity:0.22});+ const waterLight=gameMaterial(0xa0eeef,{roughness:0.3,emissive:0x398ca3,emissiveIntensity:0.3});+ const foam=gameMaterial(0xe5fcf8,{roughness:0.65,emissive:0x77b5cc,emissiveIntensity:0.2});+ const falls=group('IslandWaterfall');+ const pool=cyl('SpringPool',0.68,0.65,0.055,water,[2.18,4.073,0.65],falls);pool.scale.z=0.7;+ const course=new THREE.CatmullRomCurve3([+ new THREE.Vector3(2.18,4.11,0.65),new THREE.Vector3(2.85,4.105,0.92),+ new THREE.Vector3(3.55,4.1,1.19),new THREE.Vector3(4.03,4.055,1.34),+ new THREE.Vector3(4.37,3.73,1.46),new THREE.Vector3(4.51,2.8,1.51),+ new THREE.Vector3(4.63,1.5,1.55),new THREE.Vector3(4.76,0.15,1.59),+ new THREE.Vector3(4.85,-1.1,1.62)+ ]);+ const side=new THREE.Vector3(-0.316,0,0.949);+ function waterPoint(t,u){const c=course.getPoint(t),tan=course.getTangent(t).normalize();+ const normal=new THREE.Vector3().crossVectors(side,tan).normalize();+ const width=(0.79+0.12*Math.sin(t*Math.PI))*(1-0.43*Math.pow(t,5));+ c.addScaledVector(side,u*width).addScaledVector(normal,0.018*Math.sin(t*52+u*16)+0.012*Math.sin(t*24-u*35));+ return c;+ }+ const wv=[],wi=[],rows=90,cols=12;+ for(let i=0;i<=rows;i++)for(let j=0;j<=cols;j++){wv.push(...waterPoint(i/rows,j/cols-0.5).toArray());}+ for(let i=0;i<rows;i++)for(let j=0;j<cols;j++){const a=i*(cols+1)+j,b=a+cols+1;wi.push(a,a+1,b+1,a,b+1,b);}+ water.side=THREE.DoubleSide;+ part('ContinuousWaterCurtain',meshGeo({positions:wv,indices:wi}),water,[0,0,0],falls);+ for(let j=0;j<7;j++){const pts=[];const begin=j%2?0.25:0.06,end=0.89+0.015*(j%4);+ for(let k=0;k<=62;k++){const t=begin+(end-begin)*k/62,p=waterPoint(t,(j-3)*0.136);+ const n=new THREE.Vector3().crossVectors(side,course.getTangent(t)).normalize();p.addScaledVector(n,0.019);pts.push(p.toArray());}+ curve('WhitewaterRibbon_'+j,pts,j%3===0?0.023:0.012,j%3===0?foam:waterLight,falls);+ }+ for(let i=0;i<9;i++){+ const t=0.36+0.045*Math.sin(i*2.3),p=waterPoint(t,(i-4)*0.12);+ const o=part('SpillLipFoam_'+i,new THREE.IcosahedronGeometry(0.065+(i%3)*0.018,1),foam,p.toArray(),falls);o.scale.set(1.2,0.48,1);+ }+ for(let i=0;i<14;i++){+ const t=0.57+(i%7)*0.067,p=waterPoint(t,(i%2?1:-1)*(0.6+0.06*(i%3)));+ p.y-=0.08*(i%3);+ const o=part('WaterfallSprayDroplet_'+i,new THREE.IcosahedronGeometry(0.035+(i%3)*0.015,1),i%3?waterLight:foam,p.toArray(),falls);o.scale.y=1.8;+ }+ for(let i=0;i<6;i++){const a=1.25+i*0.68;+ const o=part('SpringBankStone_'+i,new THREE.DodecahedronGeometry(0.14+(i%2)*0.035,0),rockM[2],[2.18+Math.cos(a)*0.67,4.1,0.65+Math.sin(a)*0.48],falls);o.scale.y=0.65;}+ return root;+}\ No newline at end of filediff --git a/site/examples/history/demo-greywatch-stylized-aircraft-carrier/history.json b/site/examples/history/demo-greywatch-stylized-aircraft-carrier/history.jsonnew file mode 100644index 00000000..97be1b97--- /dev/null+++ b/site/examples/history/demo-greywatch-stylized-aircraft-carrier/history.json@@ -0,0 +1,16 @@+{+ "version": 1,+ "brief": {+ "kind": "recorded",+ "text": "Detailed stylized scale-model aircraft carrier with a faceted long hull, angled marked flight deck, deck-edge elevators, substantial radar island, defensive sponsons, deck vehicle, and five parked folded-wing jets."+ },+ "currentSourceHash": "93780997b03cd0e6f68308eddd7113fb2234c52ba079f45dda365d65b519e18e",+ "revisions": [+ {+ "file": "revision-1.kiln.js",+ "title": "Saved revision 1",+ "description": "Detailed stylized scale-model aircraft carrier with a faceted long hull, angled marked flight deck, deck-edge elevators, substantial radar island, defensive sponsons, deck vehicle, and five parked folded-wing jets.",+ "sourceHash": "93780997b03cd0e6f68308eddd7113fb2234c52ba079f45dda365d65b519e18e"+ }+ ]+}diff --git a/site/examples/history/demo-greywatch-stylized-aircraft-carrier/revision-1.kiln.js b/site/examples/history/demo-greywatch-stylized-aircraft-carrier/revision-1.kiln.jsnew file mode 100644index 00000000..37b2bfc0--- /dev/null+++ b/site/examples/history/demo-greywatch-stylized-aircraft-carrier/revision-1.kiln.js@@ -0,0 +1,332 @@++const meta = {+ name: 'Greywatch Stylized Aircraft Carrier',+ category: 'vehicle',+ role: 'vehicle'+};++function hullGeometry() {+ const stations = [+ { x: -10.6, w: 1.65, top: 2.08, shoulder: 1.62, bottom: 0.72 },+ { x: -9.2, w: 2.55, top: 2.12, shoulder: 1.55, bottom: 0.48 },+ { x: -5.8, w: 2.92, top: 2.14, shoulder: 1.48, bottom: 0.34 },+ { x: 0.0, w: 3.02, top: 2.16, shoulder: 1.44, bottom: 0.28 },+ { x: 5.5, w: 2.72, top: 2.12, shoulder: 1.50, bottom: 0.42 },+ { x: 8.6, w: 1.72, top: 2.02, shoulder: 1.52, bottom: 0.62 },+ { x: 10.5, w: 0.22, top: 1.72, shoulder: 1.38, bottom: 0.92 }+ ];+ const positions = [];+ const indices = [];+ for (const s of stations) {+ const w = s.w;+ const ring = [+ [s.x, s.top, -w * 0.82],+ [s.x, s.top, w * 0.82],+ [s.x, s.shoulder, w],+ [s.x, s.bottom + 0.32, w * 0.68],+ [s.x, s.bottom, w * 0.24],+ [s.x, s.bottom, -w * 0.24],+ [s.x, s.bottom + 0.32, -w * 0.68],+ [s.x, s.shoulder, -w]+ ];+ for (const p of ring) positions.push(...p);+ }+ const n = 8;+ for (let i = 0; i < stations.length - 1; i++) {+ for (let j = 0; j < n; j++) {+ const a = i * n + j;+ const b = i * n + (j + 1) % n;+ const c = (i + 1) * n + (j + 1) % n;+ const d = (i + 1) * n + j;+ indices.push(a, b, c, a, c, d);+ }+ }+ for (let j = 1; j < n - 1; j++) indices.push(0, j, j + 1);+ const last = (stations.length - 1) * n;+ for (let j = 1; j < n - 1; j++) indices.push(last, last + j + 1, last + j);+ return meshGeo({ positions, indices });+}++function addStrip(parent, name, length, width, position, rotationY, material, height) {+ return createPart(name, boxGeo(length, height || 0.025, width), material, {+ position, rotation: [0, rotationY || 0, 0], parent+ });+}++function addRail(parent, name, x, z, len, alongX, material, y) {+ const rail = createPart(name, cylinderGeo(0.022, 0.022, len, 8), material, {+ position: [x, y || 2.72, z],+ rotation: alongX ? [0, 0, 90] : [90, 0, 0],+ parent+ });+ return rail;+}++function addJet(parent, id, x, z, heading, mats, wingGeo) {+ const jet = createPivot('Jet_' + id, [x, 2.55, z], parent);+ jet.rotation.y = heading * Math.PI / 180;++ createPart('Jet_' + id + '_Fuselage', cylinderGeo(0.09, 0.12, 0.88, 10), mats.jet, {+ position: [0, 0.10, 0], rotation: [0, 0, -90], parent: jet+ });+ createPart('Jet_' + id + '_Nose', cylinderGeo(0.0, 0.09, 0.34, 10), mats.jetLight, {+ position: [0.61, 0.10, 0], rotation: [0, 0, -90], parent: jet+ });+ createPart('Jet_' + id + '_TailBody', cylinderGeo(0.095, 0.07, 0.28, 10), mats.jet, {+ position: [-0.56, 0.10, 0], rotation: [0, 0, -90], parent: jet+ });+ createPart('Jet_' + id + '_Cockpit', sphereGeo(0.12, 10, 6), mats.glass, {+ position: [0.22, 0.19, 0], scale: [1.45, 0.62, 0.62], parent: jet+ });+ createPart('Jet_' + id + '_InnerWings', wingGeo, mats.jet, {+ position: [-0.04, 0.10, 0], parent: jet+ });+ createPart('Jet_' + id + '_FoldedWingPort', boxGeo(0.34, 0.045, 0.30), mats.jetLight, {+ position: [-0.09, 0.22, -0.39], rotation: [-68, 0, -8], parent: jet+ });+ createPart('Jet_' + id + '_FoldedWingStarboard', boxGeo(0.34, 0.045, 0.30), mats.jetLight, {+ position: [-0.09, 0.22, 0.39], rotation: [68, 0, 8], parent: jet+ });+ createPart('Jet_' + id + '_PortTailplane', boxGeo(0.28, 0.035, 0.24), mats.jetLight, {+ position: [-0.49, 0.12, -0.16], rotation: [0, 8, 0], parent: jet+ });+ createPart('Jet_' + id + '_StarboardTailplane', boxGeo(0.28, 0.035, 0.24), mats.jetLight, {+ position: [-0.49, 0.12, 0.16], rotation: [0, -8, 0], parent: jet+ });+ createPart('Jet_' + id + '_TailFin', boxGeo(0.24, 0.22, 0.035), mats.jetLight, {+ position: [-0.47, 0.23, 0], rotation: [0, 0, -20], parent: jet+ });+ createPart('Jet_' + id + '_NoseWheel', cylinderGeo(0.035, 0.035, 0.035, 8), mats.rubber, {+ position: [0.34, -0.045, 0], rotation: [90, 0, 0], parent: jet+ });+ createPart('Jet_' + id + '_PortWheel', cylinderGeo(0.042, 0.042, 0.035, 8), mats.rubber, {+ position: [-0.15, -0.055, -0.17], rotation: [90, 0, 0], parent: jet+ });+ createPart('Jet_' + id + '_StarboardWheel', cylinderGeo(0.042, 0.042, 0.035, 8), mats.rubber, {+ position: [-0.15, -0.055, 0.17], rotation: [90, 0, 0], parent: jet+ });+}++async function build() {+ const root = createRoot('Greywatch_Carrier');++ const hullMat = gameMaterial(0x59636b, { metalness: 0.55, roughness: 0.62 });+ const hullDark = gameMaterial(0x30383e, { metalness: 0.62, roughness: 0.58 });+ const hullLight = gameMaterial(0x77838b, { metalness: 0.42, roughness: 0.68 });+ const deckMat = gameMaterial(0x24292d, { metalness: 0.35, roughness: 0.82 });+ const deckPanel = gameMaterial(0x3d464b, { metalness: 0.44, roughness: 0.73 });+ const white = gameMaterial(0xd7d9d3, { roughness: 0.72 });+ const yellow = gameMaterial(0xd2a72a, { metalness: 0.12, roughness: 0.72 });+ const red = gameMaterial(0x9f3e32, { roughness: 0.74 });+ const glass = gameMaterial(0x15252c, { metalness: 0.35, roughness: 0.22 });+ const black = gameMaterial(0x111416, { metalness: 0.3, roughness: 0.68 });+ const copper = gameMaterial(0x7a5534, { metalness: 0.55, roughness: 0.62 });+ const jet = gameMaterial(0x9ca6a7, { metalness: 0.45, roughness: 0.58 });+ const jetLight = gameMaterial(0xc2c6c2, { metalness: 0.32, roughness: 0.62 });+ const rubber = gameMaterial(0x111315, { roughness: 0.92 });++ createPart('Main_Hull', hullGeometry(), hullMat, { parent: root });++ const deckOutline = [+ [-10.5, -2.20], [-9.9, -3.05], [-4.8, -3.34], [2.5, -3.16],+ [8.8, -2.72], [10.6, -1.25], [10.2, 2.20], [6.8, 2.72],+ [-5.4, 3.18], [-10.4, 2.52]+ ];+ const deckGeo = await extrudeProfile(deckOutline, {+ depth: 0.30, axis: 'y', center: true, bevel: 0.07, bevelStyle: 'chamfer'+ });+ createPart('Angled_Flight_Deck', deckGeo, deckMat, {+ position: [0, 2.31, 0], parent: root+ });++ createPart('Hull_Port_Rub_Rail', boxGeo(16.5, 0.16, 0.16), hullDark, {+ position: [-0.8, 1.55, -2.90], parent: root+ });+ createPart('Hull_Starboard_Rub_Rail', boxGeo(15.8, 0.16, 0.16), hullDark, {+ position: [-0.2, 1.55, 2.92], parent: root+ });+ createPart('Bow_Breakwater', boxGeo(1.7, 0.24, 2.45), hullLight, {+ position: [8.25, 2.60, 0.0], rotation: [0, -3, 0], parent: root+ });+ createPart('Bow_Breakwater_DarkFace', boxGeo(0.09, 0.22, 2.25), hullDark, {+ position: [7.38, 2.60, 0.0], rotation: [0, -3, 0], parent: root+ });++ for (let i = 0; i < 10; i++) {+ createPart('Port_Hangar_Vent_' + i, boxGeo(0.46, 0.20, 0.045), black, {+ position: [-6.2 + i * 1.15, 1.42, -2.83], parent: root+ });+ }+ for (let i = 0; i < 8; i++) {+ createPart('Starboard_Hangar_Vent_' + i, boxGeo(0.42, 0.18, 0.045), black, {+ position: [-5.2 + i * 1.28, 1.40, 2.86], parent: root+ });+ }++ addStrip(root, 'Landing_Zone_Port_Edge', 12.9, 0.085, [-2.25, 2.485, -1.63], -8, white, 0.025);+ addStrip(root, 'Landing_Zone_Starboard_Edge', 12.9, 0.085, [-2.03, 2.485, 0.03], -8, white, 0.025);+ for (let i = 0; i < 12; i++) {+ addStrip(root, 'Landing_Center_Dash_' + i, 0.58, 0.095,+ [-7.15 + i * 0.86, 2.49, -0.87 + i * -0.12], -8, white, 0.028);+ }++ addStrip(root, 'Bow_Catapult_Line_Port', 8.9, 0.055, [4.4, 2.49, -0.82], 0, white, 0.025);+ addStrip(root, 'Bow_Catapult_Line_Starboard', 8.7, 0.055, [4.35, 2.49, 0.72], 0, white, 0.025);+ for (const z of [-1.10, -0.54, 0.43, 1.00]) {+ addStrip(root, 'Bow_Service_Line_' + String(z), 4.9, 0.045, [6.1, 2.488, z], 0, yellow, 0.022);+ }++ addStrip(root, 'Port_Deck_Safety_Line', 15.5, 0.075, [-1.4, 2.49, -2.82], -1.5, yellow, 0.025);+ addStrip(root, 'Starboard_Deck_Safety_Line', 14.2, 0.075, [-0.6, 2.49, 2.62], -1.5, yellow, 0.025);+ addStrip(root, 'Stern_Service_Crossline', 0.075, 4.9, [-8.95, 2.49, 0.05], 0, yellow, 0.025);++ const elevatorData = [+ { id: 'Aft_Starboard', x: -5.9, z: 3.18, sx: 2.05, sz: 1.35 },+ { id: 'Forward_Starboard', x: 4.85, z: 2.86, sx: 1.95, sz: 1.18 },+ { id: 'Aft_Port', x: -6.95, z: -3.24, sx: 1.70, sz: 1.10 }+ ];+ for (const e of elevatorData) {+ createPart('Elevator_' + e.id, boxGeo(e.sx, 0.16, e.sz), deckPanel, {+ position: [e.x, 2.39, e.z], parent: root+ });+ addStrip(root, 'Elevator_' + e.id + '_LongMark_A', e.sx * 0.88, 0.045,+ [e.x, 2.485, e.z - e.sz * 0.38], 0, yellow, 0.025);+ addStrip(root, 'Elevator_' + e.id + '_LongMark_B', e.sx * 0.88, 0.045,+ [e.x, 2.485, e.z + e.sz * 0.38], 0, yellow, 0.025);+ addStrip(root, 'Elevator_' + e.id + '_EndMark_A', 0.045, e.sz * 0.76,+ [e.x - e.sx * 0.44, 2.485, e.z], 0, yellow, 0.025);+ addStrip(root, 'Elevator_' + e.id + '_EndMark_B', 0.045, e.sz * 0.76,+ [e.x + e.sx * 0.44, 2.485, e.z], 0, yellow, 0.025);+ }++ const island = createPivot('Island_Superstructure', [1.75, 2.50, 1.95], root);+ createPart('Island_Armored_Base', await roundedBoxGeo(2.35, 0.72, 1.28, 0.09, { style: 'chamfer' }), hullMat, {+ position: [0, 0.36, 0], parent: island+ });+ createPart('Island_Mid_Block', await roundedBoxGeo(1.78, 0.72, 1.13, 0.08, { style: 'chamfer' }), hullLight, {+ position: [0.16, 1.02, 0], parent: island+ });+ createPart('Island_Bridge', await roundedBoxGeo(2.25, 0.62, 1.34, 0.08, { style: 'chamfer' }), hullMat, {+ position: [0.03, 1.64, -0.02], parent: island+ });+ createPart('Island_Bridge_Front_Windows', boxGeo(0.055, 0.25, 0.90), glass, {+ position: [1.175, 1.69, -0.02], parent: island+ });+ createPart('Island_Bridge_Port_Windows', boxGeo(1.58, 0.22, 0.05), glass, {+ position: [0.03, 1.69, -0.705], parent: island+ });+ createPart('Island_Bridge_Starboard_Windows', boxGeo(1.58, 0.22, 0.05), glass, {+ position: [0.03, 1.69, 0.665], parent: island+ });+ for (let i = 0; i < 5; i++) {+ createPart('Bridge_Window_Mullion_Port_' + i, boxGeo(0.035, 0.27, 0.065), hullDark, {+ position: [-0.60 + i * 0.31, 1.69, -0.735], parent: island+ });+ createPart('Bridge_Window_Mullion_Starboard_' + i, boxGeo(0.035, 0.27, 0.065), hullDark, {+ position: [-0.60 + i * 0.31, 1.69, 0.695], parent: island+ });+ }++ createPart('Island_Funnel', cylinderGeo(0.30, 0.40, 1.38, 10), hullDark, {+ position: [-0.42, 2.55, 0.25], rotation: [0, 0, -7], parent: island+ });+ createPart('Island_Funnel_Cap', cylinderGeo(0.35, 0.35, 0.14, 10), black, {+ position: [-0.50, 3.24, 0.25], rotation: [0, 0, -7], parent: island+ });+ createPart('Island_Mast_Lower', cylinderGeo(0.095, 0.13, 1.55, 10), hullLight, {+ position: [0.42, 2.73, -0.12], parent: island+ });+ createPart('Island_Mast_Upper', cylinderGeo(0.045, 0.085, 1.35, 10), hullLight, {+ position: [0.42, 4.05, -0.12], parent: island+ });+ createPart('Radar_Array_Lower', boxGeo(0.20, 0.78, 1.40), hullDark, {+ position: [0.46, 3.25, -0.10], rotation: [0, 0, 8], parent: island+ });+ createPart('Radar_Array_Face', boxGeo(0.055, 0.62, 1.18), glass, {+ position: [0.575, 3.25, -0.10], rotation: [0, 0, 8], parent: island+ });+ createPart('Radar_Top_Bar', boxGeo(1.20, 0.10, 0.10), hullLight, {+ position: [0.42, 4.66, -0.12], parent: island+ });+ createPart('Radar_Top_Panel', boxGeo(0.16, 0.48, 1.05), hullDark, {+ position: [0.42, 4.42, -0.12], rotation: [0, 0, -5], parent: island+ });+ createPart('Radar_Top_Face', boxGeo(0.045, 0.38, 0.88), glass, {+ position: [0.515, 4.42, -0.12], rotation: [0, 0, -5], parent: island+ });+ for (const z of [-0.62, 0.38]) {+ createPart('Yardarm_Antenna_' + String(z), cylinderGeo(0.025, 0.025, 0.85, 7), hullLight, {+ position: [0.42, 4.75, z], parent: island+ });+ }+ createPart('Mast_Top_Red_Light', sphereGeo(0.07, 10, 6), red, {+ position: [0.42, 4.78, -0.12], parent: island+ });++ createPart('Island_Deck_Crane_Post', cylinderGeo(0.075, 0.095, 0.86, 8), yellow, {+ position: [-1.35, 0.62, 0.55], parent: island+ });+ createPart('Island_Deck_Crane_Boom', boxGeo(0.90, 0.07, 0.07), yellow, {+ position: [-0.94, 1.03, 0.55], rotation: [0, 0, -18], parent: island+ });++ for (const side of [-1, 1]) {+ const z = side * 3.18;+ for (let i = 0; i < 8; i++) {+ const x = -7.7 + i * 1.95;+ addRail(root, (side < 0 ? 'Port' : 'Starboard') + '_SafetyRail_' + i,+ x, z, 1.55, true, hullLight, 2.70);+ createPart((side < 0 ? 'Port' : 'Starboard') + '_RailPost_' + i,+ cylinderGeo(0.022, 0.022, 0.35, 7), hullLight, {+ position: [x - 0.72, 2.60, z], parent: root+ });+ }+ }++ for (const x of [-7.8, -2.9, 6.5]) {+ const sponson = createPivot('Defensive_Sponson_' + String(x), [x, 2.15, 3.25], root);+ createPart('Sponson_Platform_' + String(x), cylinderGeo(0.38, 0.42, 0.16, 12), hullDark, {+ position: [0, 0.10, 0], parent: sponson+ });+ createPart('Sponson_Turret_' + String(x), sphereGeo(0.25, 10, 6), hullLight, {+ position: [0, 0.30, 0], scale: [1.2, 0.68, 1.0], parent: sponson+ });+ createPart('Sponson_Barrel_' + String(x), cylinderGeo(0.025, 0.035, 0.55, 8), black, {+ position: [0.25, 0.34, 0], rotation: [0, 0, -90], parent: sponson+ });+ }++ const wingGeo = await extrudeProfile(+ [[-0.38, -0.33], [0.22, -0.32], [0.34, 0], [0.22, 0.32], [-0.38, 0.33], [-0.23, 0]],+ { depth: 0.055, axis: 'y', center: true, bevel: 0.018, bevelStyle: 'chamfer' }+ );+ const jetMats = { jet, jetLight, glass, rubber };+ addJet(root, '01', -5.0, 1.55, 5, jetMats, wingGeo);+ addJet(root, '02', -3.35, 1.42, 5, jetMats, wingGeo);+ addJet(root, '03', -5.95, 0.15, 7, jetMats, wingGeo);+ addJet(root, '04', 4.75, -1.72, 0, jetMats, wingGeo);+ addJet(root, '05', 6.35, -1.70, 0, jetMats, wingGeo);++ const tow = createPivot('Deck_Tow_Tractor', [-1.55, 2.53, 2.20], root);+ createPart('Tow_Tractor_Body', await roundedBoxGeo(0.82, 0.26, 0.48, 0.06, { style: 'chamfer' }), yellow, {+ position: [0, 0.14, 0], parent: tow+ });+ createPart('Tow_Tractor_Cab', boxGeo(0.28, 0.30, 0.38), hullDark, {+ position: [-0.16, 0.34, 0], parent: tow+ });+ for (const x of [-0.26, 0.26]) {+ for (const z of [-0.25, 0.25]) {+ createPart('Tow_Wheel_' + String(x) + '_' + String(z), cylinderGeo(0.10, 0.10, 0.07, 10), rubber, {+ position: [x, 0.07, z], rotation: [90, 0, 0], parent: tow+ });+ }+ }++ for (let i = 0; i < 7; i++) {+ createPart('Aft_Tie_Down_' + i, torusGeo(0.055, 0.012, 6, 10), copper, {+ position: [-8.2 + i * 0.55, 2.47, 1.20], rotation: [90, 0, 0], parent: root+ });+ }++ return root;+}diff --git a/site/examples/history/demo-noctilus-nuclear-submarine/history.json b/site/examples/history/demo-noctilus-nuclear-submarine/history.jsonnew file mode 100644index 00000000..400aa8b7--- /dev/null+++ b/site/examples/history/demo-noctilus-nuclear-submarine/history.json@@ -0,0 +1,22 @@+{+ "version": 1,+ "brief": {+ "kind": "recorded",+ "text": "Refine NOCTILUS: make sail about 40% taller, add polished brass collars around the bases of all three sensor masts, preserve hull and removable cradle."+ },+ "currentSourceHash": "21a393a9ad078a8d3d8c7a8b24bbaf97d3ad8a15c3637c7400419d85a04b2237",+ "revisions": [+ {+ "file": "revision-1.kiln.js",+ "title": "Saved revision 1",+ "description": "A striking stylized nuclear submarine with a long midnight-blue teardrop hull, tall streamlined sail, raised periscopes and sensor masts, clean diving planes, sculpted stern with brass propeller, subtle panel seams, and a simple removable display cradle.",+ "sourceHash": "0685f9a9742c661da7173f41987b586f99800e3696dcaccbec9c8167faf3a3ff"+ },+ {+ "file": "revision-2.kiln.js",+ "title": "Saved revision 2",+ "description": "Refine NOCTILUS: make sail about 40% taller, add polished brass collars around the bases of all three sensor masts, preserve hull and removable cradle.",+ "sourceHash": "21a393a9ad078a8d3d8c7a8b24bbaf97d3ad8a15c3637c7400419d85a04b2237"+ }+ ]+}diff --git a/site/examples/history/demo-noctilus-nuclear-submarine/revision-1.kiln.js b/site/examples/history/demo-noctilus-nuclear-submarine/revision-1.kiln.jsnew file mode 100644index 00000000..55c84d35--- /dev/null+++ b/site/examples/history/demo-noctilus-nuclear-submarine/revision-1.kiln.js@@ -0,0 +1,111 @@+const meta = { name: 'NOCTILUS - Nuclear Submarine', category: 'vehicle', role: 'vehicle' };+const P = { hullY: 3.15, showCradle: true, hullSegments: 128, radialSegments: 64 };+async function build() {+ const root=createRoot('NOCTILUS');+ const sub=createPivot('Submarine',[0,0,0],root);+ const navy=gameMaterial(0x11283f,{metalness:0.55,roughness:0.3,flatShading:false});+ const sailmat=gameMaterial(0x19354c,{metalness:0.5,roughness:0.32,flatShading:false});+ const dark=gameMaterial(0x07131e,{metalness:0.25,roughness:0.5,flatShading:false});+ const seam=gameMaterial(0x253e50,{metalness:0.45,roughness:0.4,flatShading:false});+ const brass=gameMaterial(0xbc914a,{metalness:0.82,roughness:0.25,flatShading:false});+ const steel=gameMaterial(0x7b909a,{metalness:0.8,roughness:0.26,flatShading:false});+ const glass=gameMaterial(0x387486,{metalness:0.65,roughness:0.13,flatShading:false});+ const ivory=gameMaterial(0xd3cfb4,{metalness:0.2,roughness:0.5});+ const add=(n,g,m,pos=[0,0,0],rot=[0,0,0],parent=sub)=>createPart(n,g,m,{position:pos,rotation:rot,parent});+ const stations=[[-12,0.17],[-11,0.36],[-9.5,0.8],[-7.5,1.38],[-5,1.85],[-2,2.1],[2,2.2],[6,2.18],[9,2.02],[11,1.64],[12.5,1.03],[13.25,0.44],[13.45,0]];+ const curve=new THREE.CatmullRomCurve3(stations.map(s=>new THREE.Vector3(s[1],s[0],0)),false,'centripetal');+ const points=curve.getPoints(P.hullSegments).map(v=>new THREE.Vector2(Math.max(0,v.x),v.y));+ add('Midnight_Teardrop_Hull',new THREE.LatheGeometry(points,P.radialSegments),navy,[0,P.hullY,0],[0,0,-90]);+ function radius(x) { for(let i=0;i<points.length-1;i++) if(x>=points[i].y&&x<=points[i+1].y){let t=(x-points[i].y)/(points[i+1].y-points[i].y);return points[i].x*(1-t)+points[i+1].x*t;} return 0.2; }+ function line(n,pts,r,mat,parent=sub){const c=new THREE.CatmullRomCurve3(pts.map(p=>new THREE.Vector3(...p)));return add(n,new THREE.TubeGeometry(c,Math.max(8,pts.length*3),r,5,false),mat,[0,0,0],[0,0,0],parent);}+ for(const x of [-9.4,-5.4,0,6.8,10.7])add('Hull_Circumferential_Seam_'+x,new THREE.TorusGeometry(radius(x)+0.003,0.012,5,64),seam,[x,P.hullY,0],[0,90,0]);+ for(const a of [-0.62,0.62,2.35,3.93]){+ let pts=[];for(let x=-9;x<=10;x+=0.5){let r=radius(x)+0.004;pts.push([x,P.hullY+r*Math.cos(a),r*Math.sin(a)]);}+ line('Longitudinal_Panel_Seam_'+a,pts,0.009,seam);+ }+ // Blended, swept sail: matching airfoil sections preserve a soft rounded leading edge.+ const sail=createPivot('Sail_Assembly',[0,0,0],sub);+ function foil(cx,len,width){let p=[];for(let i=0;i<48;i++){let a=i/48*Math.PI*2;p.push([cx+len*0.5*Math.cos(a),width*0.5*Math.sin(a)*(0.88+0.12*Math.cos(a))]);}return p;}+ const sailSections=[+ [4.85,2.15,5.5,1.65],[5.35,2.1,4.8,1.25],[5.7,2.04,4.6,1.11],+ [7.9,1.68,4.02,0.98],[8.32,1.55,3.76,0.91],[8.44,1.54,3.55,0.82]];+ add('Streamlined_Sail',loftProfiles(sailSections.map(s=>({profile:foil(s[1],s[2],s[3]),frame:{origin:[0,s[0],0]}}))),sailmat,[0,0,0],[0,0,0],sail);+ add('Sail_Crown',loftProfiles([{profile:foil(1.54,3.55,0.83),frame:{origin:[0,8.43,0]}},{profile:foil(1.52,3.41,0.76),frame:{origin:[0,8.51,0]}}]),dark,[0,0,0],[0,0,0],sail);+ for(const side of [-1,1]){+ for(let i=0;i<6;i++)add('Sail_Vent_'+side+'_'+i,await roundedBoxGeo(0.13,0.36,0.025,0.012),dark,[0.65+i*0.25,6.02,side*0.515],[0,0,0],sail);+ line('Sail_Service_Panel_'+side,[[0.12,6.55,side*0.44],[0.03,7.58,side*0.43],[0.87,7.75,side*0.46],[0.98,6.55,side*0.49],[0.12,6.55,side*0.44]],0.012,seam,sail);+ add('Sail_Ivory_Insignia_'+side,await roundedBoxGeo(0.7,0.09,0.025,0.009),ivory,[2.02,7.43,side*0.467],[0,0,0],sail);+ add('Sail_Brass_Badge_'+side,cylinderGeo(0.105,0.105,0.026,24),brass,[2.61,7.43,side*0.41],[90,0,0],sail);+ }+ const masts=[{x:2.45,h:2.65,r:0.075},{x:1.55,h:2.1,r:0.10},{x:0.62,h:1.48,r:0.135}];+ for(let i=0;i<masts.length;i++){+ const m=masts[i],bottom=8.49;+ add('Mast_Deck_Boot_'+i,cylinderGeo(m.r*1.7,m.r*2,0.16,24),dark,[m.x,bottom+0.05,0],[0,0,0],sail);+ add('Raised_Sensor_Mast_'+i,cylinderGeo(m.r,m.r,m.h,20),steel,[m.x,bottom+m.h/2,0],[0,0,0],sail);+ add('Mast_Brass_Collar_'+i,cylinderGeo(m.r*1.3,m.r*1.3,0.09,24),brass,[m.x,bottom+m.h*0.52,0],[0,0,0],sail);+ if(i<2){+ add('Periscope_Elbow_'+i,await roundedBoxGeo(0.35,0.2,0.19,0.07),navy,[m.x+0.09,bottom+m.h,0],[0,0,0],sail);+ add('Periscope_Lens_'+i,cylinderGeo(0.065,0.065,0.015,20),glass,[m.x+0.274,bottom+m.h,0],[0,0,90],sail);+ }else{+ add('Electronic_Sensor_Head',await roundedBoxGeo(0.32,0.64,0.32,0.08),navy,[m.x,bottom+m.h,0],[0,0,0],sail);+ add('Electronic_Sensor_Band',await roundedBoxGeo(0.325,0.13,0.325,0.055),glass,[m.x,bottom+m.h+0.08,0],[0,0,0],sail);+ }+ }+ // Airfoil planes along local Y, rotated into each radial direction.+ function plane(name,x,rStart,rEnd,chord,tipChord,angle){+ const prof=(c,t)=>{let p=[];for(let i=0;i<24;i++){let a=i/24*Math.PI*2;p.push([c/2*Math.cos(a),t/2*Math.sin(a)]);}return p;};+ const g=loftProfiles([+ {profile:prof(chord,0.24),frame:{origin:[x,rStart,0]}},+ {profile:prof(chord*0.82,0.18),frame:{origin:[x-0.25,rStart+(rEnd-rStart)*0.64,0]}},+ {profile:prof(tipChord,0.065),frame:{origin:[x-0.57,rEnd,0]}}+ ]);+ add(name,g,navy,[0,P.hullY,0],[angle,0,0]);+ const rad=angle*Math.PI/180;+ line(name+'_Control_Hinge',[[x-chord*0.3,P.hullY+(rStart+0.12)*Math.cos(rad),(rStart+0.12)*Math.sin(rad)],[x-0.57-tipChord*0.22,P.hullY+(rEnd-0.1)*Math.cos(rad),(rEnd-0.1)*Math.sin(rad)]],0.012,seam);+ }+ plane('Port_Bow_Diving_Plane',7.1,1.8,3.55,2.1,0.86,-90);+ plane('Starboard_Bow_Diving_Plane',7.1,1.8,3.55,2.1,0.86,90);+ for(let i=0;i<4;i++)plane('Cruciform_Stern_Plane_'+i,-9.3,0.36,i===2?2.62:2.92,2.7,1.05,i*90);+ // Flush dorsal equipment, carefully spaced instead of surface clutter.+ for(const x of [-4.7,-1.7,7.7]){+ const y=P.hullY+radius(x);+ add('Hatch_Recess_'+x,cylinderGeo(0.43,0.43,0.035,40),dark,[x,y+0.012,0]);+ add('Hatch_Cover_'+x,cylinderGeo(0.355,0.355,0.055,40),sailmat,[x,y+0.04,0]);+ add('Hatch_Center_'+x,cylinderGeo(0.105,0.105,0.023,24),brass,[x,y+0.082,0]);+ for(const side of [-1,1])add('Hatch_Hinge_'+x+'_'+side,await roundedBoxGeo(0.16,0.08,0.12,0.025),steel,[x+0.3,y+0.05,side*0.2]);+ }+ for(let i=0;i<10;i++)for(const side of [-1,1]){+ const x=-6.7+i*0.38,r=radius(x);+ add('Aft_Deck_FreeFlood_Vent_'+side+'_'+i,await roundedBoxGeo(0.21,0.035,0.1,0.015),dark,[x,P.hullY+r*0.966+0.015,side*r*0.259],[side*15,0,0]);+ }+ // Swept seven-blade propeller, separate hierarchy.+ const prop=createPivot('Brass_Propeller',[-12.43,P.hullY,0],sub);+ add('Propeller_Shaft',cylinderGeo(0.14,0.14,0.88,32),steel,[-12.16,P.hullY,0],[0,0,90]);+ add('Propeller_Hub',cylinderGeo(0.28,0.17,0.7,40),brass,[0,0,0],[0,0,90],prop);+ for(let b=0;b<7;b++){+ const sections=[[0.2,0,0,0.3],[0.53,-0.03,0.12,0.65],[1.02,-0.14,0.38,0.84],[1.48,-0.31,0.63,0.64],[1.71,-0.36,0.69,0.16]];+ const profiles=sections.map(s=>{const p=[];for(let j=0;j<20;j++){const a=j/20*Math.PI*2;const chord=s[3]*0.5*Math.cos(a);p.push([s[1]+chord*0.48+0.035*Math.sin(a),s[2]+chord]);}return {profile:p,frame:{origin:[0,s[0],0]}};});+ add('Swept_Brass_Blade_'+b,loftProfiles(profiles),brass,[0,0,0],[b*360/7,0,0],prop);+ }+ add('Propeller_Aft_Cap',new THREE.SphereGeometry(0.19,24,16),brass,[-0.36,0,0],[0,0,0],prop);+ if(P.showCradle){+ const stand=createPivot('Removable_Display_Cradle',[0,0,0],root);+ const base=gameMaterial(0x17212a,{metalness:0.5,roughness:0.33,flatShading:false});+ const rubber=gameMaterial(0x0a1016,{roughness:0.85,flatShading:false});+ add('Cradle_Plinth',await roundedBoxGeo(18,0.22,5.4,0.1),base,[0,0.11,0],[0,0,0],stand);+ for(const x of [-5,5]){+ add('Cradle_Foot_'+x,await roundedBoxGeo(0.85,0.24,4.3,0.1),base,[x,0.32,0],[0,0,0],stand);+ const r=radius(x);+ for(const side of [-1,1]){+ const z=side*r*0.62,top=P.hullY-r*Math.sqrt(1-0.62*0.62);+ add('Cradle_Support_'+x+'_'+side,await roundedBoxGeo(0.55,top-0.42,0.55,0.07),base,[x,(top+0.42)/2,z],[0,0,0],stand);+ add('Cradle_Rubber_Pad_'+x+'_'+side,await roundedBoxGeo(0.72,0.12,0.56,0.04),rubber,[x,top,z],[side*-38,0,0],stand);+ add('Cradle_Brass_Fastener_'+x+'_'+side,cylinderGeo(0.085,0.085,0.025,20),brass,[x,0.455,side*1.9],[0,0,0],stand);+ }+ }+ add('Cradle_Nameplate',await roundedBoxGeo(2.8,0.025,0.46,0.012),brass,[0,0.233,2.08],[0,0,0],stand);+ for(let i=0;i<5;i++)add('Nameplate_Engraving_'+i,await roundedBoxGeo(0.08+i*0.035,0.009,0.18,0.004),dark,[-0.5+i*0.25,0.25,2.08],[0,0,0],stand);+ }+ root.traverse(node=>{if(node.isMesh && node.geometry.getAttribute('normal')) node.geometry.normalizeNormals();});+ return root;+}\ No newline at end of filediff --git a/site/examples/history/demo-noctilus-nuclear-submarine/revision-2.kiln.js b/site/examples/history/demo-noctilus-nuclear-submarine/revision-2.kiln.jsnew file mode 100644index 00000000..d0f8c628--- /dev/null+++ b/site/examples/history/demo-noctilus-nuclear-submarine/revision-2.kiln.js@@ -0,0 +1,121 @@+const meta = { name: 'NOCTILUS - Nuclear Submarine', category: 'vehicle', role: 'vehicle' };+const P = { hullY: 3.15, showCradle: true, hullSegments: 128, radialSegments: 64 };+async function build() {+ const root=createRoot('NOCTILUS');+ const sub=createPivot('Submarine',[0,0,0],root);+ const navy=gameMaterial(0x11283f,{metalness:0.55,roughness:0.3,flatShading:false});+ const sailmat=gameMaterial(0x19354c,{metalness:0.5,roughness:0.32,flatShading:false});+ const dark=gameMaterial(0x07131e,{metalness:0.25,roughness:0.5,flatShading:false});+ const seam=gameMaterial(0x253e50,{metalness:0.45,roughness:0.4,flatShading:false});+ const brass=gameMaterial(0xbc914a,{metalness:0.82,roughness:0.25,flatShading:false});+ const steel=gameMaterial(0x7b909a,{metalness:0.8,roughness:0.26,flatShading:false});+ const glass=gameMaterial(0x387486,{metalness:0.65,roughness:0.13,flatShading:false});+ const ivory=gameMaterial(0xd3cfb4,{metalness:0.2,roughness:0.5});+ const add=(n,g,m,pos=[0,0,0],rot=[0,0,0],parent=sub)=>createPart(n,g,m,{position:pos,rotation:rot,parent});+ const stations=[[-12,0.17],[-11,0.36],[-9.5,0.8],[-7.5,1.38],[-5,1.85],[-2,2.1],[2,2.2],[6,2.18],[9,2.02],[11,1.64],[12.5,1.03],[13.25,0.44],[13.45,0]];+ const curve=new THREE.CatmullRomCurve3(stations.map(s=>new THREE.Vector3(s[1],s[0],0)),false,'centripetal');+ const points=curve.getPoints(P.hullSegments).map(v=>new THREE.Vector2(Math.max(0,v.x),v.y));+ add('Midnight_Teardrop_Hull',new THREE.LatheGeometry(points,P.radialSegments),navy,[0,P.hullY,0],[0,0,-90]);+ function radius(x) { for(let i=0;i<points.length-1;i++) if(x>=points[i].y&&x<=points[i+1].y){let t=(x-points[i].y)/(points[i+1].y-points[i].y);return points[i].x*(1-t)+points[i+1].x*t;} return 0.2; }+ function line(n,pts,r,mat,parent=sub){const c=new THREE.CatmullRomCurve3(pts.map(p=>new THREE.Vector3(...p)));return add(n,new THREE.TubeGeometry(c,Math.max(8,pts.length*3),r,5,false),mat,[0,0,0],[0,0,0],parent);}+ for(const x of [-9.4,-5.4,0,6.8,10.7])add('Hull_Circumferential_Seam_'+x,new THREE.TorusGeometry(radius(x)+0.003,0.012,5,64),seam,[x,P.hullY,0],[0,90,0]);+ for(const a of [-0.62,0.62,2.35,3.93]){+ let pts=[];for(let x=-9;x<=10;x+=0.5){let r=radius(x)+0.004;pts.push([x,P.hullY+r*Math.cos(a),r*Math.sin(a)]);}+ line('Longitudinal_Panel_Seam_'+a,pts,0.009,seam);+ }+ // Blended, swept sail: matching airfoil sections preserve a soft rounded leading edge.+ const sail=createPivot('Sail_Assembly',[0,0,0],sub);+ function foil(cx,len,width){let p=[];for(let i=0;i<48;i++){let a=i/48*Math.PI*2;p.push([cx+len*0.5*Math.cos(a),width*0.5*Math.sin(a)*(0.88+0.12*Math.cos(a))]);}return p;}+ const sailSections=[+ [4.85,2.15,5.5,1.65],[5.35,2.1,4.8,1.25],[5.7,2.04,4.6,1.11],+ [7.9,1.68,4.02,0.98],[8.32,1.55,3.76,0.91],[8.44,1.54,3.55,0.82]];+ add('Streamlined_Sail',loftProfiles(sailSections.map(s=>({profile:foil(s[1],s[2],s[3]),frame:{origin:[0,s[0],0]}}))),sailmat,[0,0,0],[0,0,0],sail);+ add('Sail_Crown',loftProfiles([{profile:foil(1.54,3.55,0.83),frame:{origin:[0,8.43,0]}},{profile:foil(1.52,3.41,0.76),frame:{origin:[0,8.51,0]}}]),dark,[0,0,0],[0,0,0],sail);+ for(const side of [-1,1]){+ for(let i=0;i<6;i++)add('Sail_Vent_'+side+'_'+i,await roundedBoxGeo(0.13,0.36,0.025,0.012),dark,[0.65+i*0.25,6.02,side*0.515],[0,0,0],sail);+ line('Sail_Service_Panel_'+side,[[0.12,6.55,side*0.44],[0.03,7.58,side*0.43],[0.87,7.75,side*0.46],[0.98,6.55,side*0.49],[0.12,6.55,side*0.44]],0.012,seam,sail);+ add('Sail_Ivory_Insignia_'+side,await roundedBoxGeo(0.7,0.09,0.025,0.009),ivory,[2.02,7.43,side*0.467],[0,0,0],sail);+ add('Sail_Brass_Badge_'+side,cylinderGeo(0.105,0.105,0.026,24),brass,[2.61,7.43,side*0.41],[90,0,0],sail);+ }+ // Stretch the sail shell 40% about its original foot; carry the masts upward without stretching them.+ const sailHeightFactor=1.4, sailFootY=4.85;+ const mastRise=(8.51-sailFootY)*(sailHeightFactor-1);+ const shellParts=sail.children.slice();+ const tallShell=createPivot('Tall_Sail_Shell',[0,sailFootY*(1-sailHeightFactor),0],sail);+ tallShell.scale.y=sailHeightFactor;+ shellParts.forEach(part=>tallShell.add(part));+ const polishedBrass=gameMaterial(0xc79b50,{metalness:0.92,roughness:0.14,flatShading:false});+ const masts=[{x:2.45,h:2.65,r:0.075},{x:1.55,h:2.1,r:0.10},{x:0.62,h:1.48,r:0.135}];+ for(let i=0;i<masts.length;i++){+ const m=masts[i],bottom=8.49+mastRise;+ add('Mast_Deck_Boot_'+i,cylinderGeo(m.r*1.7,m.r*2,0.16,24),dark,[m.x,bottom+0.05,0],[0,0,0],sail);+ add('Polished_Brass_Mast_Base_Collar_'+i,cylinderGeo(m.r*1.75,m.r*1.95,0.23,40),polishedBrass,[m.x,bottom+0.22,0],[0,0,0],sail);+ add('Polished_Brass_Collar_Flange_'+i,cylinderGeo(m.r*2.12,m.r*2.12,0.055,40),polishedBrass,[m.x,bottom+0.135,0],[0,0,0],sail);+ add('Raised_Sensor_Mast_'+i,cylinderGeo(m.r,m.r,m.h,20),steel,[m.x,bottom+m.h/2,0],[0,0,0],sail);+ add('Mast_Brass_Collar_'+i,cylinderGeo(m.r*1.3,m.r*1.3,0.09,24),brass,[m.x,bottom+m.h*0.52,0],[0,0,0],sail);+ if(i<2){+ add('Periscope_Elbow_'+i,await roundedBoxGeo(0.35,0.2,0.19,0.07),navy,[m.x+0.09,bottom+m.h,0],[0,0,0],sail);+ add('Periscope_Lens_'+i,cylinderGeo(0.065,0.065,0.015,20),glass,[m.x+0.274,bottom+m.h,0],[0,0,90],sail);+ }else{+ add('Electronic_Sensor_Head',await roundedBoxGeo(0.32,0.64,0.32,0.08),navy,[m.x,bottom+m.h,0],[0,0,0],sail);+ add('Electronic_Sensor_Band',await roundedBoxGeo(0.325,0.13,0.325,0.055),glass,[m.x,bottom+m.h+0.08,0],[0,0,0],sail);+ }+ }+ // Airfoil planes along local Y, rotated into each radial direction.+ function plane(name,x,rStart,rEnd,chord,tipChord,angle){+ const prof=(c,t)=>{let p=[];for(let i=0;i<24;i++){let a=i/24*Math.PI*2;p.push([c/2*Math.cos(a),t/2*Math.sin(a)]);}return p;};+ const g=loftProfiles([+ {profile:prof(chord,0.24),frame:{origin:[x,rStart,0]}},+ {profile:prof(chord*0.82,0.18),frame:{origin:[x-0.25,rStart+(rEnd-rStart)*0.64,0]}},+ {profile:prof(tipChord,0.065),frame:{origin:[x-0.57,rEnd,0]}}+ ]);+ add(name,g,navy,[0,P.hullY,0],[angle,0,0]);+ const rad=angle*Math.PI/180;+ line(name+'_Control_Hinge',[[x-chord*0.3,P.hullY+(rStart+0.12)*Math.cos(rad),(rStart+0.12)*Math.sin(rad)],[x-0.57-tipChord*0.22,P.hullY+(rEnd-0.1)*Math.cos(rad),(rEnd-0.1)*Math.sin(rad)]],0.012,seam);+ }+ plane('Port_Bow_Diving_Plane',7.1,1.8,3.55,2.1,0.86,-90);+ plane('Starboard_Bow_Diving_Plane',7.1,1.8,3.55,2.1,0.86,90);+ for(let i=0;i<4;i++)plane('Cruciform_Stern_Plane_'+i,-9.3,0.36,i===2?2.62:2.92,2.7,1.05,i*90);+ // Flush dorsal equipment, carefully spaced instead of surface clutter.+ for(const x of [-4.7,-1.7,7.7]){+ const y=P.hullY+radius(x);+ add('Hatch_Recess_'+x,cylinderGeo(0.43,0.43,0.035,40),dark,[x,y+0.012,0]);+ add('Hatch_Cover_'+x,cylinderGeo(0.355,0.355,0.055,40),sailmat,[x,y+0.04,0]);+ add('Hatch_Center_'+x,cylinderGeo(0.105,0.105,0.023,24),brass,[x,y+0.082,0]);+ for(const side of [-1,1])add('Hatch_Hinge_'+x+'_'+side,await roundedBoxGeo(0.16,0.08,0.12,0.025),steel,[x+0.3,y+0.05,side*0.2]);+ }+ for(let i=0;i<10;i++)for(const side of [-1,1]){+ const x=-6.7+i*0.38,r=radius(x);+ add('Aft_Deck_FreeFlood_Vent_'+side+'_'+i,await roundedBoxGeo(0.21,0.035,0.1,0.015),dark,[x,P.hullY+r*0.966+0.015,side*r*0.259],[side*15,0,0]);+ }+ // Swept seven-blade propeller, separate hierarchy.+ const prop=createPivot('Brass_Propeller',[-12.43,P.hullY,0],sub);+ add('Propeller_Shaft',cylinderGeo(0.14,0.14,0.88,32),steel,[-12.16,P.hullY,0],[0,0,90]);+ add('Propeller_Hub',cylinderGeo(0.28,0.17,0.7,40),brass,[0,0,0],[0,0,90],prop);+ for(let b=0;b<7;b++){+ const sections=[[0.2,0,0,0.3],[0.53,-0.03,0.12,0.65],[1.02,-0.14,0.38,0.84],[1.48,-0.31,0.63,0.64],[1.71,-0.36,0.69,0.16]];+ const profiles=sections.map(s=>{const p=[];for(let j=0;j<20;j++){const a=j/20*Math.PI*2;const chord=s[3]*0.5*Math.cos(a);p.push([s[1]+chord*0.48+0.035*Math.sin(a),s[2]+chord]);}return {profile:p,frame:{origin:[0,s[0],0]}};});+ add('Swept_Brass_Blade_'+b,loftProfiles(profiles),brass,[0,0,0],[b*360/7,0,0],prop);+ }+ add('Propeller_Aft_Cap',new THREE.SphereGeometry(0.19,24,16),brass,[-0.36,0,0],[0,0,0],prop);+ if(P.showCradle){+ const stand=createPivot('Removable_Display_Cradle',[0,0,0],root);+ const base=gameMaterial(0x17212a,{metalness:0.5,roughness:0.33,flatShading:false});+ const rubber=gameMaterial(0x0a1016,{roughness:0.85,flatShading:false});+ add('Cradle_Plinth',await roundedBoxGeo(18,0.22,5.4,0.1),base,[0,0.11,0],[0,0,0],stand);+ for(const x of [-5,5]){+ add('Cradle_Foot_'+x,await roundedBoxGeo(0.85,0.24,4.3,0.1),base,[x,0.32,0],[0,0,0],stand);+ const r=radius(x);+ for(const side of [-1,1]){+ const z=side*r*0.62,top=P.hullY-r*Math.sqrt(1-0.62*0.62);+ add('Cradle_Support_'+x+'_'+side,await roundedBoxGeo(0.55,top-0.42,0.55,0.07),base,[x,(top+0.42)/2,z],[0,0,0],stand);+ add('Cradle_Rubber_Pad_'+x+'_'+side,await roundedBoxGeo(0.72,0.12,0.56,0.04),rubber,[x,top,z],[side*-38,0,0],stand);+ add('Cradle_Brass_Fastener_'+x+'_'+side,cylinderGeo(0.085,0.085,0.025,20),brass,[x,0.455,side*1.9],[0,0,0],stand);+ }+ }+ add('Cradle_Nameplate',await roundedBoxGeo(2.8,0.025,0.46,0.012),brass,[0,0.233,2.08],[0,0,0],stand);+ for(let i=0;i<5;i++)add('Nameplate_Engraving_'+i,await roundedBoxGeo(0.08+i*0.035,0.009,0.18,0.004),dark,[-0.5+i*0.25,0.25,2.08],[0,0,0],stand);+ }+ root.traverse(node=>{if(node.isMesh && node.geometry.getAttribute('normal')) node.geometry.normalizeNormals();});+ return root;+}\ No newline at end of filediff --git a/site/examples/history/demo-ocean-salvage-tug/history.json b/site/examples/history/demo-ocean-salvage-tug/history.jsonnew file mode 100644index 00000000..6c514b76--- /dev/null+++ b/site/examples/history/demo-ocean-salvage-tug/history.json@@ -0,0 +1,22 @@+{+ "version": 1,+ "brief": {+ "kind": "recorded",+ "text": "Extended A-frame crane and orange cable drum guards"+ },+ "currentSourceHash": "c79b655b05918d92494477304821eeadaa590c8865d100ab2a15a28396f7eb03",+ "revisions": [+ {+ "file": "revision-1.kiln.js",+ "title": "Saved revision 1",+ "description": "Recorded saved demo revision.",+ "sourceHash": "49a7df1925feceffbe224eb1bdcfc1da0694667917ceeb51de1d7abb76487d27"+ },+ {+ "file": "revision-2.kiln.js",+ "title": "Saved revision 2",+ "description": "Extended A-frame crane and orange cable drum guards",+ "sourceHash": "c79b655b05918d92494477304821eeadaa590c8865d100ab2a15a28396f7eb03"+ }+ ]+}diff --git a/site/examples/history/demo-ocean-salvage-tug/revision-1.kiln.js b/site/examples/history/demo-ocean-salvage-tug/revision-1.kiln.jsnew file mode 100644index 00000000..98fa8d27--- /dev/null+++ b/site/examples/history/demo-ocean-salvage-tug/revision-1.kiln.js@@ -0,0 +1,306 @@+const meta = { name: 'Ocean salvage tug', category: 'vehicle', role: 'vehicle' };++// Dimensions in metres. +X forward, +Y up, +Z starboard.+// Stylized ocean salvage tug: navy hull, cream cabin/bulwark, safety-orange+// working deck trim, A-frame, winch and funnel. Keel at Y=0 (drydock sit).++const NAVY = 0x1e3a5c;+const CREAM = 0xf2e8d5;+const ORANGE = 0xff5a1f;+const RUBBER = 0x1b1b1e;+const STEEL = 0x3a4148;+const DARKSTEEL = 0x23272d;+const WINDOW = 0x22394e;+const DECKFORE = 0xe4d9c2;+const CABLE = 0x22262b;++// Plan-view outline of the hull (X forward, Z starboard), ordered+// stern-port -> bow -> stern-starboard so the loop closes across the transom.+function hullOutline(beamScale) {+ const pts = [+ [-2.4, -1.05],+ [-0.6, -1.15],+ [1.4, -0.85],+ [2.5, 0.0],+ [1.4, 0.85],+ [-0.6, 1.15],+ [-2.4, 1.05],+ ];+ return pts.map(([x, z]) => [x, z * beamScale]);+}++/** Vertical tire fender hung against the hull side. */+function tireFender(name, pos, parent, mats) {+ createPart(name, torusGeo(0.17, 0.065, 10, 20), mats.rubber, {+ position: pos, parent,+ });+}++/** Pair of bollard posts with a top plate. */+function bollard(name, x, z, deckY, parent, mats) {+ const g = createPivot(name, [x, deckY, z], parent);+ createPart('PostA', cylinderGeo(0.05, 0.06, 0.28, 12), mats.steel, {+ position: [-0.09, 0.14, 0], parent: g,+ });+ createPart('PostB', cylinderGeo(0.05, 0.06, 0.28, 12), mats.steel, {+ position: [0.09, 0.14, 0], parent: g,+ });+ createPart('TopPlate', boxGeo(0.3, 0.05, 0.12), mats.steel, {+ position: [0, 0.3, 0], parent: g,+ });+ return g;+}++function build() {+ const root = createRoot('SalvageTug');++ const mats = {+ navy: gameMaterial(NAVY),+ cream: gameMaterial(CREAM),+ orange: gameMaterial(ORANGE),+ rubber: gameMaterial(RUBBER),+ steel: gameMaterial(STEEL),+ dark: gameMaterial(DARKSTEEL),+ window: gameMaterial(WINDOW),+ deckFore: gameMaterial(DECKFORE),+ cable: gameMaterial(CABLE),+ };++ // ---- Hull: loft three plan sections (keel -> waterline -> deck edge) ----+ const hullGeo = loftProfiles([+ { profile: hullOutline(0.72), frame: { origin: [0, 0.15, 0], rotation: [0, 0, 0] } },+ { profile: hullOutline(0.92), frame: { origin: [0, 0.55, 0], rotation: [0, 0, 0] } },+ { profile: hullOutline(1.0), frame: { origin: [0, 1.05, 0], rotation: [0, 0, 0] } },+ ]);+ createPart('Hull', hullGeo, mats.navy, { parent: root });++ // Waterline boot stripe (thin loft band just above the waterline).+ // Kept slightly proud of the hull surface to avoid z-fighting.+ const stripeGeo = loftProfiles([+ { profile: hullOutline(0.945), frame: { origin: [0, 0.64, 0], rotation: [0, 0, 0] } },+ { profile: hullOutline(0.965), frame: { origin: [0, 0.76, 0], rotation: [0, 0, 0] } },+ ]);+ createPart('BootStripe', stripeGeo, mats.orange, { parent: root });++ // ---- Decks ----+ // Aft working deck (safety orange) and foredeck (cream).+ createPart('WorkingDeck', boxGeo(2.9, 0.07, 1.86), mats.orange, {+ position: [-0.95, 1.09, 0], parent: root,+ });+ createPart('ForeDeck', boxGeo(1.7, 0.07, 1.5), mats.deckFore, {+ position: [1.35, 1.09, 0], parent: root,+ });+ // Deck anti-slip strips.+ for (let i = 0; i < 4; i++) {+ createPart('DeckStrip' + i, boxGeo(2.5, 0.02, 0.05), mats.dark, {+ position: [-0.95, 1.13, -0.6 + i * 0.4], parent: root,+ });+ }++ // ---- Bulwark (cream) with orange cap rail ----+ const bulwarkH = 0.42;+ const bulwarkY = 1.05 + bulwarkH / 2;+ // Straight side walls.+ createPart('BulwarkPort', boxGeo(3.0, bulwarkH, 0.08), mats.cream, {+ position: [-0.9, bulwarkY, -1.06], parent: root,+ });+ createPart('BulwarkStbd', boxGeo(3.0, bulwarkH, 0.08), mats.cream, {+ position: [-0.9, bulwarkY, 1.06], parent: root,+ });+ // Transom wall.+ createPart('BulwarkTransom', boxGeo(0.08, bulwarkH, 2.2), mats.cream, {+ position: [-2.38, bulwarkY, 0], parent: root,+ });+ // Angled bow walls (port/starboard).+ createPart('BulwarkBowPort', boxGeo(1.5, bulwarkH, 0.08), mats.cream, {+ position: [1.55, bulwarkY, -0.78], rotation: [0, -28, 0], parent: root,+ });+ createPart('BulwarkBowStbd', boxGeo(1.5, bulwarkH, 0.08), mats.cream, {+ position: [1.55, bulwarkY, 0.78], rotation: [0, 28, 0], parent: root,+ });+ // Orange cap rail on top of each wall.+ const capY = 1.05 + bulwarkH + 0.03;+ createPart('CapPort', boxGeo(3.0, 0.06, 0.12), mats.orange, {+ position: [-0.9, capY, -1.06], parent: root,+ });+ createPart('CapStbd', boxGeo(3.0, 0.06, 0.12), mats.orange, {+ position: [-0.9, capY, 1.06], parent: root,+ });+ createPart('CapTransom', boxGeo(0.12, 0.06, 2.2), mats.orange, {+ position: [-2.38, capY, 0], parent: root,+ });+ createPart('CapBowPort', boxGeo(1.5, 0.06, 0.12), mats.orange, {+ position: [1.55, capY, -0.78], rotation: [0, -28, 0], parent: root,+ });+ createPart('CapBowStbd', boxGeo(1.5, 0.06, 0.12), mats.orange, {+ position: [1.55, capY, 0.78], rotation: [0, 28, 0], parent: root,+ });++ // ---- Rubber fenders ----+ // Vertical side fenders (cylinders) + hanging tire fenders (torus).+ const fenderX = [-1.9, -0.9, 0.1];+ for (let i = 0; i < fenderX.length; i++) {+ createPart('FenderPort' + i, cylinderGeo(0.11, 0.11, 0.55, 14), mats.rubber, {+ position: [fenderX[i], 0.82, -1.13], parent: root,+ });+ createPart('FenderStbd' + i, cylinderGeo(0.11, 0.11, 0.55, 14), mats.rubber, {+ position: [fenderX[i], 0.82, 1.13], parent: root,+ });+ }+ tireFender('TirePortA', [-1.4, 0.95, -1.2], root, mats);+ tireFender('TirePortB', [-0.4, 0.95, -1.22], root, mats);+ tireFender('TireStbdA', [-1.4, 0.95, 1.2], root, mats);+ tireFender('TireStbdB', [-0.4, 0.95, 1.22], root, mats);+ // Bow stem fender.+ createPart('StemFender', cylinderGeo(0.1, 0.1, 0.7, 12), mats.rubber, {+ position: [2.5, 0.82, 0], parent: root,+ });+ // Stern push fender (horizontal log across transom).+ createPart('SternFender', cylinderGeo(0.13, 0.13, 1.9, 14), mats.rubber, {+ position: [-2.5, 0.85, 0], rotation: [90, 0, 0], parent: root,+ });++ // ---- Cabin block (cream) with navy roof ----+ createPart('CabinBase', boxGeo(1.5, 0.95, 1.5), mats.cream, {+ position: [0.55, 1.6, 0], parent: root,+ });+ createPart('Wheelhouse', boxGeo(1.3, 0.75, 1.35), mats.cream, {+ position: [0.55, 2.45, 0], parent: root,+ });+ createPart('CabinRoof', boxGeo(1.55, 0.1, 1.6), mats.navy, {+ position: [0.55, 2.88, 0], parent: root,+ });+ // Window band (dark) around wheelhouse + front windshields.+ createPart('WindowBand', boxGeo(1.32, 0.3, 1.37), mats.window, {+ position: [0.55, 2.55, 0], parent: root,+ });+ // Mullions to break the band into windows (cream posts).+ for (let i = -1; i <= 1; i++) {+ createPart('MullionFront' + i, boxGeo(0.06, 0.32, 0.06), mats.cream, {+ position: [1.22, 2.55, i * 0.4], parent: root,+ });+ }+ // Cabin door (aft face) + portholes.+ createPart('CabinDoor', boxGeo(0.06, 0.7, 0.4), mats.navy, {+ position: [-0.23, 1.6, 0.3], parent: root,+ });+ for (let i = 0; i < 2; i++) {+ createPart('PortholePort' + i, cylinderGeo(0.09, 0.09, 0.06, 16), mats.navy, {+ position: [0.2 + i * 0.5, 1.65, -0.76], rotation: [90, 0, 0], parent: root,+ });+ createPart('PortholeStbd' + i, cylinderGeo(0.09, 0.09, 0.06, 16), mats.navy, {+ position: [0.2 + i * 0.5, 1.65, 0.76], rotation: [90, 0, 0], parent: root,+ });+ }+ // Orange cabin trim stripe.+ createPart('CabinStripe', boxGeo(1.52, 0.1, 1.52), mats.orange, {+ position: [0.55, 2.02, 0], parent: root,+ });++ // ---- Funnel (safety orange with dark cap) ----+ createPart('Funnel', cylinderGeo(0.28, 0.34, 0.7, 18), mats.orange, {+ position: [-0.55, 2.35, 0], parent: root,+ });+ createPart('FunnelCap', cylinderGeo(0.29, 0.29, 0.14, 18), mats.dark, {+ position: [-0.55, 2.75, 0], parent: root,+ });++ // ---- Mast + radar + lights ----+ createPart('Mast', cylinderGeo(0.05, 0.07, 1.1, 10), mats.steel, {+ position: [0.55, 3.45, 0], parent: root,+ });+ createPart('RadarPedestal', cylinderGeo(0.09, 0.11, 0.16, 12), mats.cream, {+ position: [0.55, 3.1, 0], parent: root,+ });+ // Radar scanner bar (stylized, static forward pose).+ createPart('RadarBar', boxGeo(0.16, 0.07, 0.85), mats.cream, {+ position: [0.55, 3.24, 0], parent: root,+ });+ createPart('RadarDome', sphereGeo(0.11, 16, 12), mats.cream, {+ position: [0.15, 3.0, 0], parent: root,+ });+ // Navigation lights: port red-ish? Keep palette: small cream masthead + orange stern.+ createPart('MastheadLight', sphereGeo(0.05, 10, 8), mats.orange, {+ position: [0.55, 4.02, 0], parent: root,+ });++ // ---- Towing winch drum on working deck ----+ const winch = createPivot('Winch', [-1.15, 1.12, 0], root);+ createPart('WinchBaseL', boxGeo(0.7, 0.18, 0.12), mats.steel, {+ position: [0, 0.09, -0.55], parent: winch,+ });+ createPart('WinchBaseR', boxGeo(0.7, 0.18, 0.12), mats.steel, {+ position: [0, 0.09, 0.55], parent: winch,+ });+ createPart('WinchFrameL', boxGeo(0.12, 0.55, 0.1), mats.orange, {+ position: [-0.25, 0.4, -0.55], parent: winch,+ });+ createPart('WinchFrameR', boxGeo(0.12, 0.55, 0.1), mats.orange, {+ position: [-0.25, 0.4, 0.55], parent: winch,+ });+ createPart('Drum', cylinderGeo(0.26, 0.26, 0.95, 20), mats.dark, {+ position: [-0.25, 0.55, 0], rotation: [90, 0, 0], parent: winch,+ });+ // Wound cable wrap (slightly larger, cable color) + flange discs.+ createPart('CableWrap', cylinderGeo(0.29, 0.29, 0.6, 20), mats.cable, {+ position: [-0.25, 0.55, 0], rotation: [90, 0, 0], parent: winch,+ });+ createPart('FlangeL', cylinderGeo(0.4, 0.4, 0.06, 20), mats.orange, {+ position: [-0.25, 0.55, -0.5], rotation: [90, 0, 0], parent: winch,+ });+ createPart('FlangeR', cylinderGeo(0.4, 0.4, 0.06, 20), mats.orange, {+ position: [-0.25, 0.55, 0.5], rotation: [90, 0, 0], parent: winch,+ });+ // Tow cable running aft off the drum toward the stern roller.+ createPart('TowCable', cylinderGeo(0.025, 0.025, 1.3, 8), mats.cable, {+ position: [-0.95, 0.5, 0], rotation: [0, 0, 78], parent: winch,+ });++ // Stern roller for the tow wire.+ createPart('SternRoller', cylinderGeo(0.09, 0.09, 0.7, 12), mats.steel, {+ position: [-2.25, 1.2, 0], rotation: [90, 0, 0], parent: root,+ });++ // ---- A-frame crane (safety orange) over the stern ----+ // Feet sit on the aft deck at the transom so the hook hangs over the water.+ const frameX = -2.3;+ // Legs lean inward in Z; feet at deck, apexes high and close together.+ createPart('AFrameLegPort', cylinderGeo(0.07, 0.09, 1.8, 12), mats.orange, {+ position: [frameX, 1.95, -0.62], rotation: [20, 0, 0], parent: root,+ });+ createPart('AFrameLegStbd', cylinderGeo(0.07, 0.09, 1.8, 12), mats.orange, {+ position: [frameX, 1.95, 0.62], rotation: [-20, 0, 0], parent: root,+ });+ // Crossbeam between apexes + top pulley block.+ createPart('AFrameBeam', cylinderGeo(0.07, 0.07, 0.75, 12), mats.orange, {+ position: [frameX, 2.78, 0], rotation: [90, 0, 0], parent: root,+ });+ createPart('CraneBlock', boxGeo(0.18, 0.24, 0.14), mats.dark, {+ position: [frameX, 2.6, 0], parent: root,+ });+ // Hook cable + hook (hanging aft of the transom, under the block).+ createPart('HookCable', cylinderGeo(0.02, 0.02, 0.9, 8), mats.cable, {+ position: [frameX - 0.05, 2.05, 0], parent: root,+ });+ createPart('Hook', torusGeo(0.09, 0.03, 8, 16), mats.steel, {+ position: [frameX - 0.05, 1.55, 0], parent: root,+ });++ // ---- Deck fittings ----+ bollard('BollardSternPort', -2.0, -0.75, 1.12, root, mats);+ bollard('BollardSternStbd', -2.0, 0.75, 1.12, root, mats);+ bollard('BollardBowPort', 1.9, -0.5, 1.12, root, mats);+ bollard('BollardBowStbd', 1.9, 0.5, 1.12, root, mats);+ // Foredeck hatch + vent.+ createPart('ForeHatch', boxGeo(0.6, 0.18, 0.6), mats.steel, {+ position: [1.35, 1.2, 0], parent: root,+ });+ createPart('Vent', cylinderGeo(0.09, 0.11, 0.4, 12), mats.orange, {+ position: [0.0, 1.5, -0.6], parent: root,+ });+ createPart('VentHead', sphereGeo(0.11, 12, 8), mats.orange, {+ position: [0.0, 1.72, -0.6], parent: root,+ });++ return root;+}diff --git a/site/examples/history/demo-ocean-salvage-tug/revision-2.kiln.js b/site/examples/history/demo-ocean-salvage-tug/revision-2.kiln.jsnew file mode 100644index 00000000..bd9d897a--- /dev/null+++ b/site/examples/history/demo-ocean-salvage-tug/revision-2.kiln.js@@ -0,0 +1,325 @@+const meta = { name: 'Ocean salvage tug', category: 'vehicle', role: 'vehicle' };++// Dimensions in metres. +X forward, +Y up, +Z starboard.+// Stylized ocean salvage tug: navy hull, cream cabin/bulwark, safety-orange+// working deck trim, A-frame, winch and funnel. Keel at Y=0 (drydock sit).++const NAVY = 0x1e3a5c;+const CREAM = 0xf2e8d5;+const ORANGE = 0xff5a1f;+const RUBBER = 0x1b1b1e;+const STEEL = 0x3a4148;+const DARKSTEEL = 0x23272d;+const WINDOW = 0x22394e;+const DECKFORE = 0xe4d9c2;+const CABLE = 0x22262b;++// Plan-view outline of the hull (X forward, Z starboard), ordered+// stern-port -> bow -> stern-starboard so the loop closes across the transom.+function hullOutline(beamScale) {+ const pts = [+ [-2.4, -1.05],+ [-0.6, -1.15],+ [1.4, -0.85],+ [2.5, 0.0],+ [1.4, 0.85],+ [-0.6, 1.15],+ [-2.4, 1.05],+ ];+ return pts.map(([x, z]) => [x, z * beamScale]);+}++/** Vertical tire fender hung against the hull side. */+function tireFender(name, pos, parent, mats) {+ createPart(name, torusGeo(0.17, 0.065, 10, 20), mats.rubber, {+ position: pos, parent,+ });+}++/** Pair of bollard posts with a top plate. */+function bollard(name, x, z, deckY, parent, mats) {+ const g = createPivot(name, [x, deckY, z], parent);+ createPart('PostA', cylinderGeo(0.05, 0.06, 0.28, 12), mats.steel, {+ position: [-0.09, 0.14, 0], parent: g,+ });+ createPart('PostB', cylinderGeo(0.05, 0.06, 0.28, 12), mats.steel, {+ position: [0.09, 0.14, 0], parent: g,+ });+ createPart('TopPlate', boxGeo(0.3, 0.05, 0.12), mats.steel, {+ position: [0, 0.3, 0], parent: g,+ });+ return g;+}++function build() {+ const root = createRoot('SalvageTug');++ const mats = {+ navy: gameMaterial(NAVY),+ cream: gameMaterial(CREAM),+ orange: gameMaterial(ORANGE),+ rubber: gameMaterial(RUBBER),+ steel: gameMaterial(STEEL),+ dark: gameMaterial(DARKSTEEL),+ window: gameMaterial(WINDOW),+ deckFore: gameMaterial(DECKFORE),+ cable: gameMaterial(CABLE),+ };++ // ---- Hull: loft three plan sections (keel -> waterline -> deck edge) ----+ const hullGeo = loftProfiles([+ { profile: hullOutline(0.72), frame: { origin: [0, 0.15, 0], rotation: [0, 0, 0] } },+ { profile: hullOutline(0.92), frame: { origin: [0, 0.55, 0], rotation: [0, 0, 0] } },+ { profile: hullOutline(1.0), frame: { origin: [0, 1.05, 0], rotation: [0, 0, 0] } },+ ]);+ createPart('Hull', hullGeo, mats.navy, { parent: root });++ // Waterline boot stripe (thin loft band just above the waterline).+ // Kept slightly proud of the hull surface to avoid z-fighting.+ const stripeGeo = loftProfiles([+ { profile: hullOutline(0.945), frame: { origin: [0, 0.64, 0], rotation: [0, 0, 0] } },+ { profile: hullOutline(0.965), frame: { origin: [0, 0.76, 0], rotation: [0, 0, 0] } },+ ]);+ createPart('BootStripe', stripeGeo, mats.orange, { parent: root });++ // ---- Decks ----+ // Aft working deck (safety orange) and foredeck (cream).+ createPart('WorkingDeck', boxGeo(2.9, 0.07, 1.86), mats.orange, {+ position: [-0.95, 1.09, 0], parent: root,+ });+ createPart('ForeDeck', boxGeo(1.7, 0.07, 1.5), mats.deckFore, {+ position: [1.35, 1.09, 0], parent: root,+ });+ // Deck anti-slip strips.+ for (let i = 0; i < 4; i++) {+ createPart('DeckStrip' + i, boxGeo(2.5, 0.02, 0.05), mats.dark, {+ position: [-0.95, 1.13, -0.6 + i * 0.4], parent: root,+ });+ }++ // ---- Bulwark (cream) with orange cap rail ----+ const bulwarkH = 0.42;+ const bulwarkY = 1.05 + bulwarkH / 2;+ // Straight side walls.+ createPart('BulwarkPort', boxGeo(3.0, bulwarkH, 0.08), mats.cream, {+ position: [-0.9, bulwarkY, -1.06], parent: root,+ });+ createPart('BulwarkStbd', boxGeo(3.0, bulwarkH, 0.08), mats.cream, {+ position: [-0.9, bulwarkY, 1.06], parent: root,+ });+ // Transom wall.+ createPart('BulwarkTransom', boxGeo(0.08, bulwarkH, 2.2), mats.cream, {+ position: [-2.38, bulwarkY, 0], parent: root,+ });+ // Angled bow walls (port/starboard).+ createPart('BulwarkBowPort', boxGeo(1.5, bulwarkH, 0.08), mats.cream, {+ position: [1.55, bulwarkY, -0.78], rotation: [0, -28, 0], parent: root,+ });+ createPart('BulwarkBowStbd', boxGeo(1.5, bulwarkH, 0.08), mats.cream, {+ position: [1.55, bulwarkY, 0.78], rotation: [0, 28, 0], parent: root,+ });+ // Orange cap rail on top of each wall.+ const capY = 1.05 + bulwarkH + 0.03;+ createPart('CapPort', boxGeo(3.0, 0.06, 0.12), mats.orange, {+ position: [-0.9, capY, -1.06], parent: root,+ });+ createPart('CapStbd', boxGeo(3.0, 0.06, 0.12), mats.orange, {+ position: [-0.9, capY, 1.06], parent: root,+ });+ createPart('CapTransom', boxGeo(0.12, 0.06, 2.2), mats.orange, {+ position: [-2.38, capY, 0], parent: root,+ });+ createPart('CapBowPort', boxGeo(1.5, 0.06, 0.12), mats.orange, {+ position: [1.55, capY, -0.78], rotation: [0, -28, 0], parent: root,+ });+ createPart('CapBowStbd', boxGeo(1.5, 0.06, 0.12), mats.orange, {+ position: [1.55, capY, 0.78], rotation: [0, 28, 0], parent: root,+ });++ // ---- Rubber fenders ----+ // Vertical side fenders (cylinders) + hanging tire fenders (torus).+ const fenderX = [-1.9, -0.9, 0.1];+ for (let i = 0; i < fenderX.length; i++) {+ createPart('FenderPort' + i, cylinderGeo(0.11, 0.11, 0.55, 14), mats.rubber, {+ position: [fenderX[i], 0.82, -1.13], parent: root,+ });+ createPart('FenderStbd' + i, cylinderGeo(0.11, 0.11, 0.55, 14), mats.rubber, {+ position: [fenderX[i], 0.82, 1.13], parent: root,+ });+ }+ tireFender('TirePortA', [-1.4, 0.95, -1.2], root, mats);+ tireFender('TirePortB', [-0.4, 0.95, -1.22], root, mats);+ tireFender('TireStbdA', [-1.4, 0.95, 1.2], root, mats);+ tireFender('TireStbdB', [-0.4, 0.95, 1.22], root, mats);+ // Bow stem fender.+ createPart('StemFender', cylinderGeo(0.1, 0.1, 0.7, 12), mats.rubber, {+ position: [2.5, 0.82, 0], parent: root,+ });+ // Stern push fender (horizontal log across transom).+ createPart('SternFender', cylinderGeo(0.13, 0.13, 1.9, 14), mats.rubber, {+ position: [-2.5, 0.85, 0], rotation: [90, 0, 0], parent: root,+ });++ // ---- Cabin block (cream) with navy roof ----+ createPart('CabinBase', boxGeo(1.5, 0.95, 1.5), mats.cream, {+ position: [0.55, 1.6, 0], parent: root,+ });+ createPart('Wheelhouse', boxGeo(1.3, 0.75, 1.35), mats.cream, {+ position: [0.55, 2.45, 0], parent: root,+ });+ createPart('CabinRoof', boxGeo(1.55, 0.1, 1.6), mats.navy, {+ position: [0.55, 2.88, 0], parent: root,+ });+ // Window band (dark) around wheelhouse + front windshields.+ createPart('WindowBand', boxGeo(1.32, 0.3, 1.37), mats.window, {+ position: [0.55, 2.55, 0], parent: root,+ });+ // Mullions to break the band into windows (cream posts).+ for (let i = -1; i <= 1; i++) {+ createPart('MullionFront' + i, boxGeo(0.06, 0.32, 0.06), mats.cream, {+ position: [1.22, 2.55, i * 0.4], parent: root,+ });+ }+ // Cabin door (aft face) + portholes.+ createPart('CabinDoor', boxGeo(0.06, 0.7, 0.4), mats.navy, {+ position: [-0.23, 1.6, 0.3], parent: root,+ });+ for (let i = 0; i < 2; i++) {+ createPart('PortholePort' + i, cylinderGeo(0.09, 0.09, 0.06, 16), mats.navy, {+ position: [0.2 + i * 0.5, 1.65, -0.76], rotation: [90, 0, 0], parent: root,+ });+ createPart('PortholeStbd' + i, cylinderGeo(0.09, 0.09, 0.06, 16), mats.navy, {+ position: [0.2 + i * 0.5, 1.65, 0.76], rotation: [90, 0, 0], parent: root,+ });+ }+ // Orange cabin trim stripe.+ createPart('CabinStripe', boxGeo(1.52, 0.1, 1.52), mats.orange, {+ position: [0.55, 2.02, 0], parent: root,+ });++ // ---- Funnel (safety orange with dark cap) ----+ createPart('Funnel', cylinderGeo(0.28, 0.34, 0.7, 18), mats.orange, {+ position: [-0.55, 2.35, 0], parent: root,+ });+ createPart('FunnelCap', cylinderGeo(0.29, 0.29, 0.14, 18), mats.dark, {+ position: [-0.55, 2.75, 0], parent: root,+ });++ // ---- Mast + radar + lights ----+ createPart('Mast', cylinderGeo(0.05, 0.07, 1.1, 10), mats.steel, {+ position: [0.55, 3.45, 0], parent: root,+ });+ createPart('RadarPedestal', cylinderGeo(0.09, 0.11, 0.16, 12), mats.cream, {+ position: [0.55, 3.1, 0], parent: root,+ });+ // Radar scanner bar (stylized, static forward pose).+ createPart('RadarBar', boxGeo(0.16, 0.07, 0.85), mats.cream, {+ position: [0.55, 3.24, 0], parent: root,+ });+ createPart('RadarDome', sphereGeo(0.11, 16, 12), mats.cream, {+ position: [0.15, 3.0, 0], parent: root,+ });+ // Navigation lights: port red-ish? Keep palette: small cream masthead + orange stern.+ createPart('MastheadLight', sphereGeo(0.05, 10, 8), mats.orange, {+ position: [0.55, 4.02, 0], parent: root,+ });++ // ---- Towing winch drum on working deck ----+ const winch = createPivot('Winch', [-1.15, 1.12, 0], root);+ createPart('WinchBaseL', boxGeo(0.7, 0.18, 0.12), mats.steel, {+ position: [0, 0.09, -0.55], parent: winch,+ });+ createPart('WinchBaseR', boxGeo(0.7, 0.18, 0.12), mats.steel, {+ position: [0, 0.09, 0.55], parent: winch,+ });+ createPart('WinchFrameL', boxGeo(0.12, 0.55, 0.1), mats.orange, {+ position: [-0.25, 0.4, -0.55], parent: winch,+ });+ createPart('WinchFrameR', boxGeo(0.12, 0.55, 0.1), mats.orange, {+ position: [-0.25, 0.4, 0.55], parent: winch,+ });+ createPart('Drum', cylinderGeo(0.26, 0.26, 0.95, 20), mats.dark, {+ position: [-0.25, 0.55, 0], rotation: [90, 0, 0], parent: winch,+ });+ // Wound cable wrap (slightly larger, cable color) + flange discs.+ createPart('CableWrap', cylinderGeo(0.29, 0.29, 0.6, 20), mats.cable, {+ position: [-0.25, 0.55, 0], rotation: [90, 0, 0], parent: winch,+ });+ createPart('FlangeL', cylinderGeo(0.4, 0.4, 0.06, 20), mats.orange, {+ position: [-0.25, 0.55, -0.5], rotation: [90, 0, 0], parent: winch,+ });+ createPart('FlangeR', cylinderGeo(0.4, 0.4, 0.06, 20), mats.orange, {+ position: [-0.25, 0.55, 0.5], rotation: [90, 0, 0], parent: winch,+ });+ // Orange cable drum guards: side frames standing clear of the flanges.+ createPart('DrumGuardLegFL', boxGeo(0.08, 0.9, 0.08), mats.orange, {+ position: [-0.55, 0.45, -0.62], parent: winch,+ });+ createPart('DrumGuardLegRL', boxGeo(0.08, 0.9, 0.08), mats.orange, {+ position: [0.05, 0.45, -0.62], parent: winch,+ });+ createPart('DrumGuardLegFR', boxGeo(0.08, 0.9, 0.08), mats.orange, {+ position: [-0.55, 0.45, 0.62], parent: winch,+ });+ createPart('DrumGuardLegRR', boxGeo(0.08, 0.9, 0.08), mats.orange, {+ position: [0.05, 0.45, 0.62], parent: winch,+ });+ createPart('DrumGuardTopL', boxGeo(0.68, 0.08, 0.08), mats.orange, {+ position: [-0.25, 0.92, -0.62], parent: winch,+ });+ createPart('DrumGuardTopR', boxGeo(0.68, 0.08, 0.08), mats.orange, {+ position: [-0.25, 0.92, 0.62], parent: winch,+ });+ // Tow cable running aft off the drum toward the stern roller.+ createPart('TowCable', cylinderGeo(0.025, 0.025, 1.3, 8), mats.cable, {+ position: [-0.95, 0.5, 0], rotation: [0, 0, 78], parent: winch,+ });++ // Stern roller for the tow wire.+ createPart('SternRoller', cylinderGeo(0.09, 0.09, 0.7, 12), mats.steel, {+ position: [-2.25, 1.2, 0], rotation: [90, 0, 0], parent: root,+ });++ // ---- A-frame crane (safety orange) over the stern ----+ // Feet sit on the aft deck at the transom so the hook hangs over the water.+ const frameX = -2.3;+ // Legs lean inward in Z; feet at deck, apexes high and close together.+ createPart('AFrameLegPort', cylinderGeo(0.07, 0.09, 2.3, 12), mats.orange, {+ position: [frameX, 2.2, -0.68], rotation: [20, 0, 0], parent: root,+ });+ createPart('AFrameLegStbd', cylinderGeo(0.07, 0.09, 2.3, 12), mats.orange, {+ position: [frameX, 2.2, 0.68], rotation: [-20, 0, 0], parent: root,+ });+ // Crossbeam between apexes + top pulley block.+ createPart('AFrameBeam', cylinderGeo(0.07, 0.07, 0.75, 12), mats.orange, {+ position: [frameX, 3.28, 0], rotation: [90, 0, 0], parent: root,+ });+ createPart('CraneBlock', boxGeo(0.18, 0.24, 0.14), mats.dark, {+ position: [frameX, 3.08, 0], parent: root,+ });+ // Hook cable + hook (hanging aft of the transom, under the block).+ createPart('HookCable', cylinderGeo(0.02, 0.02, 1.2, 8), mats.cable, {+ position: [frameX - 0.05, 2.36, 0], parent: root,+ });+ createPart('Hook', torusGeo(0.09, 0.03, 8, 16), mats.steel, {+ position: [frameX - 0.05, 1.7, 0], parent: root,+ });++ // ---- Deck fittings ----+ bollard('BollardSternPort', -2.0, -0.75, 1.12, root, mats);+ bollard('BollardSternStbd', -2.0, 0.75, 1.12, root, mats);+ bollard('BollardBowPort', 1.9, -0.5, 1.12, root, mats);+ bollard('BollardBowStbd', 1.9, 0.5, 1.12, root, mats);+ // Foredeck hatch + vent.+ createPart('ForeHatch', boxGeo(0.6, 0.18, 0.6), mats.steel, {+ position: [1.35, 1.2, 0], parent: root,+ });+ createPart('Vent', cylinderGeo(0.09, 0.11, 0.4, 12), mats.orange, {+ position: [0.0, 1.5, -0.6], parent: root,+ });+ createPart('VentHead', sphereGeo(0.11, 12, 8), mats.orange, {+ position: [0.0, 1.72, -0.6], parent: root,+ });++ return root;+}diff --git a/site/examples/history/demo-resolute-polar-fleet-flagship/history.json b/site/examples/history/demo-resolute-polar-fleet-flagship/history.jsonnew file mode 100644index 00000000..49b7c88f--- /dev/null+++ b/site/examples/history/demo-resolute-polar-fleet-flagship/history.json@@ -0,0 +1,28 @@+{+ "version": 1,+ "brief": {+ "kind": "recorded",+ "text": "Final hull-fitting refinement: scuttles conform to tapered side stations, solid fleet number 07, functional whole-assembly length/beam/deck-scale controls. Original source and two predecessor revisions retained."+ },+ "currentSourceHash": "23e70f4f899e07478b5392505a13446b77ae382962fbcb9e8c9ac794ddbc5c70",+ "revisions": [+ {+ "file": "revision-1.kiln.js",+ "title": "Saved revision 1",+ "description": "Initial reviewed design: triple batteries, stepped bridge, paired funnels, navy ivory and teak palette. Compact pole radar before revision.",+ "sourceHash": "df1e34212f92ec92c6fdb0193d68dca4c5931d07c350ba5cc04a867df40fe52c"+ },+ {+ "file": "revision-2.kiln.js",+ "title": "Saved revision 2",+ "description": "Visual revision: open 3.2 m radar array, lattice bracing, signal flags, bridge roof railings, deck crane; repaired rangefinder and anchor-chain attachments.",+ "sourceHash": "17d3a5faf2c1a89d1dd4a9920e45e889b5f01d634065fdfd9412c3719417e2e3"+ },+ {+ "file": "revision-3.kiln.js",+ "title": "Saved revision 3",+ "description": "Final hull-fitting refinement: scuttles conform to tapered side stations, solid fleet number 07, functional whole-assembly length/beam/deck-scale controls. Original source and two predecessor revisions retained.",+ "sourceHash": "23e70f4f899e07478b5392505a13446b77ae382962fbcb9e8c9ac794ddbc5c70"+ }+ ]+}diff --git a/site/examples/history/demo-resolute-polar-fleet-flagship/revision-1.kiln.js b/site/examples/history/demo-resolute-polar-fleet-flagship/revision-1.kiln.jsnew file mode 100644index 00000000..c62dfd4c--- /dev/null+++ b/site/examples/history/demo-resolute-polar-fleet-flagship/revision-1.kiln.js@@ -0,0 +1,158 @@+// RESOLUTE / polar fleet flagship. Original procedural design, metres, +X bow.+const meta = { name: 'Resolute — Polar Fleet Flagship', category: 'vehicle', role: 'vehicle' };+const DESIGN = { length: 32, beam: 6.6, deckY: 2.8, mastHeight: 9.3, radarWidth: 1.5, railHeight: 0.40 };+function build() {+ const root = createRoot('Resolute');+ const navy = gameMaterial(0x243e53,{roughness:0.65,metalness:0.25});+ const blue = gameMaterial(0x496779,{roughness:0.6,metalness:0.2});+ const ivory = gameMaterial(0xd5d7c8,{roughness:0.68});+ const teak = gameMaterial(0xb7824c,{roughness:0.95});+ const seam = gameMaterial(0x795738,{roughness:1});+ const brass = gameMaterial(0xd8ac55,{metalness:0.65,roughness:0.35});+ const red = gameMaterial(0x963e39,{roughness:0.8});+ const black = gameMaterial(0x172631,{roughness:0.8});+ const glass = gameMaterial(0x4fc4cb,{metalness:0.25,roughness:0.2});+ const white = gameMaterial(0xf0e7cc,{roughness:0.7});+ const orange = gameMaterial(0xdd7947,{roughness:0.8});+ const part=(n,g,m,p=[0,0,0],r=[0,0,0],parent=root)=>createPart(n,g,m,{position:p,rotation:r,parent});+ const box=(n,s,p,m,r=[0,0,0],parent=root)=>part(n,boxGeo(...s),m,p,r,parent);+ function rod(n,a,b,r,m,parent=root) {+ const va=new THREE.Vector3(...a), vb=new THREE.Vector3(...b),d=vb.clone().sub(va);+ const o=part(n,cylinderGeo(r,r,d.length(),8),m,va.clone().add(vb).multiplyScalar(.5).toArray(),[0,0,0],parent);+ o.quaternion.setFromUnitVectors(new THREE.Vector3(0,1,0),d.normalize()); return o;+ }+ // Convex waterline outline sampled along deliberately asymmetric bow/stern stations.+ const stations=[[-16,.15],[-15,1.5],[-13,2.55],[-10,3.1],[-6,3.3],[2,3.3],[7,3.05],[11,2.4],[14,1.3],[16,.06]];+ const outline=stations.map(s=>[s[0],s[1]]).concat(stations.slice().reverse().map(s=>[s[0],-s[1]]));+ function shell(n,rings,m) {+ const p=[],idx=[],N=outline.length;+ for(const [y,sx,sz] of rings) for(const [x,z] of outline)p.push(x*sx,y,z*sz);+ for(let k=0;k<rings.length-1;k++)for(let i=0;i<N;i++){+ const j=(i+1)%N,a=k*N+i,b=k*N+j,c=(k+1)*N+i,d=(k+1)*N+j;idx.push(a,b,c,b,d,c);+ }+ // Outline ordering is clockwise in XZ; its cap orientation is +Y.+ const bot=p.length/3;p.push(0,rings[0][0],0);const top=p.length/3;p.push(0,rings[rings.length-1][0],0);+ for(let i=0;i<N;i++){let j=(i+1)%N;idx.push(bot,j,i);let k=(rings.length-1)*N;idx.push(top,k+i,k+j);}+ return part(n,meshGeo({positions:p,indices:idx}),m);+ }+ shell('Red antifouling carved keel',[[0,.88,.42],[.45,.96,.70],[1.15,1,.94]],red);+ shell('Boot stripe',[[1.15,1,.94],[1.35,1,.96]],black);+ shell('Armoured flared hull',[[1.35,1,.96],[2.35,1,1],[2.77,1,1]],navy);+ shell('Ivory sheer stripe',[[2.56,1.001,1.006],[2.68,1.001,1.006]],ivory);+ shell('Teak main deck',[[2.77,.994,.982],[2.82,.994,.982]],teak);+ // Plank seams follow vessel length but stop at the narrowing bow and stern.+ for(let z=-2.8;z<=2.81;z+=.22){+ let xs=stations.filter(s=>s[1]>Math.abs(z)+.08).map(s=>s[0]);+ if(xs.length>1)box('Deck plank seam '+z.toFixed(2),[Math.max(...xs)-Math.min(...xs),.008,.018],[(Math.max(...xs)+Math.min(...xs))/2,2.827,z],seam);+ }+ // A perimeter handrail composed from station-to-station rails, with vertical stanchions.+ for(let i=0;i<outline.length;i++){+ let a=outline[i],b=outline[(i+1)%outline.length];+ let dist=Math.hypot(b[0]-a[0],b[1]-a[1]),count=Math.ceil(dist/.8);+ for(let t=0;t<count;t++){+ let x=(a[0]+(b[0]-a[0])*t/count)*.985,z=(a[1]+(b[1]-a[1])*t/count)*.96;+ rod('Rail stanchion '+i+'-'+t,[x,2.83,z],[x,2.83+DESIGN.railHeight,z],.022,ivory);+ }+ for(const h of [.19,DESIGN.railHeight])rod('Continuous safety rail '+i+'-'+h,[a[0]*.985,2.83+h,a[1]*.96],[b[0]*.985,2.83+h,b[1]*.96],.018,ivory);+ }+ // Side portholes and projecting armour ribs give the hull scale.+ for(const s of [-1,1])for(let x=-11;x<=10;x+=1.05){+ part('Brass scuttle '+s+' '+x,torusGeo(.095,.024,6,12),brass,[x,2.28,s*3.13]);+ part('Dark scuttle glass '+s+' '+x,cylinderGeo(.078,.078,.018,12),black,[x,2.28,s*3.135],[90,0,0]);+ }+ // Turret assembly in its own local coordinate frame. Articulated pivot retained for edits.+ function turret(n,x,y,dir,scale=1){+ const g=createPivot(n,[x,y,0],root);g.rotation.y=dir*Math.PI/180;+ part(n+' barbette',cylinderGeo(1.1*scale,1.2*scale,.4*scale,16),blue,[0,.2*scale,0],[0,0,0],g);+ // Faceted armour geometry with sloping cheeks; independent turret roof.+ const shape=[[-1.05,-.97],[-1.05,.97],[.65,1.02],[1.12,.65],[1.12,-.65],[.65,-1.02]];+ const pts=[],inds=[];+ for(const [yy,fac] of [[.38,1],[1.2,.82]])for(const [xx,zz] of shape)pts.push(xx*scale*fac,yy*scale,zz*scale*fac);+ for(let i=0;i<6;i++){let j=(i+1)%6;inds.push(i,j,6+i,j,6+j,6+i);}+ for(let i=1;i<5;i++){inds.push(0,i+1,i,6,6+i,6+i+1);}+ part(n+' angled gunhouse',meshGeo({positions:pts,indices:inds}),ivory,[0,0,0],[0,0,0],g);+ box(n+' roof plate',[1.42*scale,.08*scale,1.4*scale],[-.1*scale,1.24*scale,0],blue,[0,0,0],g);+ for(const z of [-.57,0,.57]){+ part(n+' gun mantlet '+z,cylinderGeo(.2*scale,.2*scale,.5*scale,12),navy,[.9*scale,.75*scale,z*scale],[0,0,90],g);+ rod(n+' barrel '+z,[1*scale,.75*scale,z*scale],[4.1*scale,1.02*scale,z*scale],.108*scale,blue,g);+ rod(n+' reinforced breech '+z,[1*scale,.75*scale,z*scale],[2*scale,.837*scale,z*scale],.145*scale,navy,g);+ part(n+' black muzzle '+z,cylinderGeo(.08*scale,.08*scale,.03*scale,12),black,[4.12*scale,1.022*scale,z*scale],[0,0,95],g);+ }+ box(n+' rangefinder',[.25*scale,.22*scale,2.15*scale],[-.45*scale,1.43*scale,0],brass,[0,0,0],g);+ }+ turret('A forward battery',8.3,2.84,0);+ box('B raised battery platform',[3.4,.62,3.7],[3.9,3.13,0],navy);+ turret('B superfiring battery',4.0,3.45,0,.91);+ turret('Y stern battery',-10.2,2.84,180);+ // Long central citadel, stepped bridge and glazed observation deck.+ box('Citadel lower deck',[11.6,.9,3.5],[-2,3.28,0],blue);+ box('Citadel teak roof',[11.8,.1,3.7],[-2,3.78,0],teak);+ box('Bridge lower block',[3.2,1.25,2.7],[.85,4.43,0],ivory);+ box('Bridge middle deck rim',[3.8,.16,3.25],[.85,5.13,0],brass);+ box('Bridge panoramic dark band',[2.8,.65,2.55],[.85,5.53,0],black);+ box('Bridge roof overhang',[3.25,.18,2.95],[.85,5.94,0],ivory);+ for(const s of [-1,1])for(let x=-.25;x<=1.96;x+=.43)box('Bridge side glazing '+s+' '+x,[.32,.42,.03],[x,5.55,s*1.285],glass);+ for(let z=-1;z<=1.01;z+=.4)box('Forward bridge glazing '+z,[.03,.42,.29],[2.27,5.55,z],glass);+ box('Conning tower',[1.3,.83,1.45],[.55,6.43,0],blue);+ part('Director turntable',cylinderGeo(.7,.7,.18,16),brass,[.55,6.93,0]);+ box('Optical director',[.7,.45,1.2],[.55,7.24,0],ivory);+ box('Director rangefinder',[.22,.23,2.1],[.6,7.4,0],navy);+ for(const s of [-1,1]){+ box('Bridge wing '+s,[1.6,.15,1.2],[.5,5.04,s*1.75],blue);+ box('Wing screen '+s,[1.7,.4,.08],[.5,5.3,s*2.31],ivory);+ // stairway with clear readable risers+ for(let i=0;i<8;i++)box('Citadel access step '+s+' '+i,[.25,.1,.55],[2.55-i*.15,2.88+i*.12,s*2.0],ivory);+ }+ // Paired raked funnels, dark mouths and horizontal brass collars.+ for(const x of [-2.4,-5.7]){+ box('Funnel plinth '+x,[1.9,.34,1.85],[x,3.99,0],navy);+ part('Raked funnel '+x,cylinderGeo(.66,.86,1.85,8),ivory,[x-.12,5.05,0],[0,0,-8]);+ part('Funnel brass collar '+x,cylinderGeo(.68,.70,.16,8),brass,[x-.23,5.59,0],[0,0,-8]);+ part('Funnel soot cap '+x,cylinderGeo(.70,.7,.35,8),navy,[x-.26,5.91,0],[0,0,-8]);+ part('Funnel dark opening '+x,cylinderGeo(.56,.56,.025,8),black,[x-.285,6.088,0],[0,0,-8]);+ for(let i=0;i<6;i++)box('Funnel intake louvre '+x+' '+i,[.8,.055,.04],[x,4.25+i*.13,.78],black);+ }+ // Mast initially a compact pole radar; revise after render review.+ rod('Main mast',[-1.25,5.9,0],[-1.25,DESIGN.mastHeight,0],.075,navy);+ rod('Mast port brace',[-2.1,3.83,-1.1],[-1.25,7.8,0],.06,ivory);+ rod('Mast starboard brace',[-2.1,3.83,1.1],[-1.25,7.8,0],.06,ivory);+ rod('Signal yard',[-1.25,7.8,-1.8],[-1.25,7.8,1.8],.045,brass);+ box('Radar panel',[.15,.6,DESIGN.radarWidth],[-1.25,DESIGN.mastHeight,0],blue);+ // REVISION_INSERT+ // Davit-carried lifeboats, secondary twin mounts and ventilators.+ for(const s of [-1,1]){+ for(const x of [-3.6,-6.2]){+ const boat=part('Lifeboat hull '+s+' '+x,cylinderGeo(.5,.28,2.25,8),ivory,[x,4.22,s*2.17],[0,0,90]);boat.scale.z=.55;+ box('Lifeboat dark cockpit '+s+' '+x,[1.5,.1,.46],[x,4.5,s*2.17],navy);+ for(const xx of [x-.65,x+.65]){rod('Boat davit upright '+s+' '+xx,[xx,3.75,s*1.5],[xx,4.9,s*1.5],.05,brass);rod('Boat davit arm '+s+' '+xx,[xx,4.9,s*1.5],[xx,4.9,s*2.2],.05,brass);rod('Boat sling '+s+' '+xx,[xx,4.9,s*2.2],[xx,4.45,s*2.2],.018,black);}+ }+ for(const x of [-8,-.8,6.0]){+ part('Secondary pedestal '+s+' '+x,cylinderGeo(.43,.5,.42,12),navy,[x,3.03,s*2.2]);+ box('Secondary shield '+s+' '+x,[.72,.55,.8],[x,3.42,s*2.2],ivory);+ for(const dx of [-.19,.19])rod('Secondary barrel '+s+' '+x+' '+dx,[x+dx,3.43,s*2.3],[x+dx,3.85,s*3.6],.047,blue);+ }+ for(const x of [-12,-9,10,12]){+ part('Mooring bollard '+s+' '+x,cylinderGeo(.09,.12,.27,8),navy,[x,2.96,s*1.1]);+ box('Bollard cap '+s+' '+x,[.3,.06,.19],[x,3.12,s*1.1],brass);+ }+ for(const x of [-5,-3,-1]){+ box('Hull armour applique '+s+' '+x,[1.5,.42,.11],[x,1.96,s*3.31],blue);+ part('Life ring '+s+' '+x,torusGeo(.18,.045,8,16),orange,[x,3.4,s*1.78]);+ }+ }+ // Foredeck anchor gear: winches, chain links and starboard anchor silhouette.+ for(const s of [-1,1]){+ part('Anchor capstan '+s,cylinderGeo(.25,.32,.3,12),blue,[12,2.99,s*.65]);+ for(let i=0;i<12;i++)part('Anchor chain link '+s+' '+i,torusGeo(.07,.018,6,10),black,[12.25+i*.18,2.88,s*(.65+i*.015)],[90,i%2*60,0]);+ rod('Anchor shank '+s,[13.8,2.38,s*1.5],[13.8,1.62,s*1.55],.05,brass);+ rod('Anchor crossbar '+s,[13.48,2.16,s*1.51],[14.12,2.16,s*1.51],.045,brass);+ rod('Anchor fluke L '+s,[13.8,1.62,s*1.55],[13.45,1.9,s*1.55],.055,brass);+ rod('Anchor fluke R '+s,[13.8,1.62,s*1.55],[14.15,1.9,s*1.55],.055,brass);+ }+ // Stern aircraft-free working deck with winch and crane.+ part('Stern winch',cylinderGeo(.3,.3,.65,12),blue,[-13.1,3.08,0],[90,0,0]);+ rod('Stern flagstaff',[-14.7,2.83,0],[-14.7,4.7,0],.035,brass);+ box('Fleet pennant',[.02,.44,.8],[-14.7,4.43,.42],red);+ box('Pennant ivory stripe',[.024,.12,.8],[-14.7,4.43,.42],ivory);+ return root;+}diff --git a/site/examples/history/demo-resolute-polar-fleet-flagship/revision-2.kiln.js b/site/examples/history/demo-resolute-polar-fleet-flagship/revision-2.kiln.jsnew file mode 100644index 00000000..09248c75--- /dev/null+++ b/site/examples/history/demo-resolute-polar-fleet-flagship/revision-2.kiln.js@@ -0,0 +1,196 @@+// RESOLUTE / polar fleet flagship. Original procedural design, metres, +X bow.+const meta = { name: 'Resolute — Polar Fleet Flagship', category: 'vehicle', role: 'vehicle' };+const DESIGN = { length: 32, beam: 6.6, deckY: 2.8, mastHeight: 9.5, radarWidth: 3.2, railHeight: 0.40 };+function build() {+ const root = createRoot('Resolute');+ const navy = gameMaterial(0x243e53,{roughness:0.65,metalness:0.25});+ const blue = gameMaterial(0x496779,{roughness:0.6,metalness:0.2});+ const ivory = gameMaterial(0xd5d7c8,{roughness:0.68});+ const teak = gameMaterial(0xb7824c,{roughness:0.95});+ const seam = gameMaterial(0x795738,{roughness:1});+ const brass = gameMaterial(0xd8ac55,{metalness:0.65,roughness:0.35});+ const red = gameMaterial(0x963e39,{roughness:0.8});+ const black = gameMaterial(0x172631,{roughness:0.8});+ const glass = gameMaterial(0x4fc4cb,{metalness:0.25,roughness:0.2});+ const white = gameMaterial(0xf0e7cc,{roughness:0.7});+ const orange = gameMaterial(0xdd7947,{roughness:0.8});+ const part=(n,g,m,p=[0,0,0],r=[0,0,0],parent=root)=>createPart(n,g,m,{position:p,rotation:r,parent});+ const box=(n,s,p,m,r=[0,0,0],parent=root)=>part(n,boxGeo(...s),m,p,r,parent);+ function rod(n,a,b,r,m,parent=root) {+ const va=new THREE.Vector3(...a), vb=new THREE.Vector3(...b),d=vb.clone().sub(va);+ const o=part(n,cylinderGeo(r,r,d.length(),8),m,va.clone().add(vb).multiplyScalar(.5).toArray(),[0,0,0],parent);+ o.quaternion.setFromUnitVectors(new THREE.Vector3(0,1,0),d.normalize()); return o;+ }+ // Convex waterline outline sampled along deliberately asymmetric bow/stern stations.+ const stations=[[-16,.15],[-15,1.5],[-13,2.55],[-10,3.1],[-6,3.3],[2,3.3],[7,3.05],[11,2.4],[14,1.3],[16,.06]];+ const outline=stations.map(s=>[s[0],s[1]]).concat(stations.slice().reverse().map(s=>[s[0],-s[1]]));+ function shell(n,rings,m) {+ const p=[],idx=[],N=outline.length;+ for(const [y,sx,sz] of rings) for(const [x,z] of outline)p.push(x*sx,y,z*sz);+ for(let k=0;k<rings.length-1;k++)for(let i=0;i<N;i++){+ const j=(i+1)%N,a=k*N+i,b=k*N+j,c=(k+1)*N+i,d=(k+1)*N+j;idx.push(a,b,c,b,d,c);+ }+ // Outline ordering is clockwise in XZ; its cap orientation is +Y.+ const bot=p.length/3;p.push(0,rings[0][0],0);const top=p.length/3;p.push(0,rings[rings.length-1][0],0);+ for(let i=0;i<N;i++){let j=(i+1)%N;idx.push(bot,j,i);let k=(rings.length-1)*N;idx.push(top,k+i,k+j);}+ return part(n,meshGeo({positions:p,indices:idx}),m);+ }+ shell('Red antifouling carved keel',[[0,.88,.42],[.45,.96,.70],[1.15,1,.94]],red);+ shell('Boot stripe',[[1.15,1,.94],[1.35,1,.96]],black);+ shell('Armoured flared hull',[[1.35,1,.96],[2.35,1,1],[2.77,1,1]],navy);+ shell('Ivory sheer stripe',[[2.56,1.001,1.006],[2.68,1.001,1.006]],ivory);+ shell('Teak main deck',[[2.77,.994,.982],[2.82,.994,.982]],teak);+ // Plank seams follow vessel length but stop at the narrowing bow and stern.+ for(let z=-2.8;z<=2.81;z+=.22){+ let xs=stations.filter(s=>s[1]>Math.abs(z)+.08).map(s=>s[0]);+ if(xs.length>1)box('Deck plank seam '+z.toFixed(2),[Math.max(...xs)-Math.min(...xs),.008,.018],[(Math.max(...xs)+Math.min(...xs))/2,2.827,z],seam);+ }+ // A perimeter handrail composed from station-to-station rails, with vertical stanchions.+ for(let i=0;i<outline.length;i++){+ let a=outline[i],b=outline[(i+1)%outline.length];+ let dist=Math.hypot(b[0]-a[0],b[1]-a[1]),count=Math.ceil(dist/.8);+ for(let t=0;t<count;t++){+ let x=(a[0]+(b[0]-a[0])*t/count)*.985,z=(a[1]+(b[1]-a[1])*t/count)*.96;+ rod('Rail stanchion '+i+'-'+t,[x,2.83,z],[x,2.83+DESIGN.railHeight,z],.022,ivory);+ }+ for(const h of [.19,DESIGN.railHeight])rod('Continuous safety rail '+i+'-'+h,[a[0]*.985,2.83+h,a[1]*.96],[b[0]*.985,2.83+h,b[1]*.96],.018,ivory);+ }+ // Side portholes and projecting armour ribs give the hull scale.+ for(const s of [-1,1])for(let x=-11;x<=10;x+=1.05){+ part('Brass scuttle '+s+' '+x,torusGeo(.095,.024,6,12),brass,[x,2.28,s*3.13]);+ part('Dark scuttle glass '+s+' '+x,cylinderGeo(.078,.078,.018,12),black,[x,2.28,s*3.135],[90,0,0]);+ }+ // Turret assembly in its own local coordinate frame. Articulated pivot retained for edits.+ function turret(n,x,y,dir,scale=1){+ const g=createPivot(n,[x,y,0],root);g.rotation.y=dir*Math.PI/180;+ part(n+' barbette',cylinderGeo(1.1*scale,1.2*scale,.4*scale,16),blue,[0,.2*scale,0],[0,0,0],g);+ // Faceted armour geometry with sloping cheeks; independent turret roof.+ const shape=[[-1.05,-.97],[-1.05,.97],[.65,1.02],[1.12,.65],[1.12,-.65],[.65,-1.02]];+ const pts=[],inds=[];+ for(const [yy,fac] of [[.38,1],[1.2,.82]])for(const [xx,zz] of shape)pts.push(xx*scale*fac,yy*scale,zz*scale*fac);+ for(let i=0;i<6;i++){let j=(i+1)%6;inds.push(i,j,6+i,j,6+j,6+i);}+ for(let i=1;i<5;i++){inds.push(0,i+1,i,6,6+i,6+i+1);}+ part(n+' angled gunhouse',meshGeo({positions:pts,indices:inds}),ivory,[0,0,0],[0,0,0],g);+ box(n+' roof plate',[1.42*scale,.08*scale,1.4*scale],[-.1*scale,1.24*scale,0],blue,[0,0,0],g);+ for(const z of [-.57,0,.57]){+ part(n+' gun mantlet '+z,cylinderGeo(.2*scale,.2*scale,.5*scale,12),navy,[.9*scale,.75*scale,z*scale],[0,0,90],g);+ rod(n+' barrel '+z,[1*scale,.75*scale,z*scale],[4.1*scale,1.02*scale,z*scale],.108*scale,blue,g);+ rod(n+' reinforced breech '+z,[1*scale,.75*scale,z*scale],[2*scale,.837*scale,z*scale],.145*scale,navy,g);+ part(n+' black muzzle '+z,cylinderGeo(.08*scale,.08*scale,.03*scale,12),black,[4.12*scale,1.022*scale,z*scale],[0,0,95],g);+ }+ box(n+' rangefinder',[.25*scale,.22*scale,2.15*scale],[-.45*scale,1.37*scale,0],brass,[0,0,0],g);+ }+ turret('A forward battery',8.3,2.84,0);+ box('B raised battery platform',[3.4,.62,3.7],[3.9,3.13,0],navy);+ turret('B superfiring battery',4.0,3.45,0,.91);+ turret('Y stern battery',-10.2,2.84,180);+ // Long central citadel, stepped bridge and glazed observation deck.+ box('Citadel lower deck',[11.6,.9,3.5],[-2,3.28,0],blue);+ box('Citadel teak roof',[11.8,.1,3.7],[-2,3.78,0],teak);+ box('Bridge lower block',[3.2,1.25,2.7],[.85,4.43,0],ivory);+ box('Bridge middle deck rim',[3.8,.16,3.25],[.85,5.13,0],brass);+ box('Bridge panoramic dark band',[2.8,.65,2.55],[.85,5.53,0],black);+ box('Bridge roof overhang',[3.25,.18,2.95],[.85,5.94,0],ivory);+ for(const s of [-1,1])for(let x=-.25;x<=1.96;x+=.43)box('Bridge side glazing '+s+' '+x,[.32,.42,.03],[x,5.55,s*1.285],glass);+ for(let z=-1;z<=1.01;z+=.4)box('Forward bridge glazing '+z,[.03,.42,.29],[2.27,5.55,z],glass);+ box('Conning tower',[1.3,.83,1.45],[.55,6.43,0],blue);+ part('Director turntable',cylinderGeo(.7,.7,.18,16),brass,[.55,6.93,0]);+ box('Optical director',[.7,.45,1.2],[.55,7.24,0],ivory);+ box('Director rangefinder',[.22,.23,2.1],[.6,7.4,0],navy);+ for(const s of [-1,1]){+ box('Bridge wing '+s,[1.6,.15,1.2],[.5,5.04,s*1.75],blue);+ box('Wing screen '+s,[1.7,.4,.08],[.5,5.3,s*2.31],ivory);+ // stairway with clear readable risers+ for(let i=0;i<8;i++)box('Citadel access step '+s+' '+i,[.25,.1,.55],[2.55-i*.15,2.88+i*.12,s*2.0],ivory);+ }+ // Paired raked funnels, dark mouths and horizontal brass collars.+ for(const x of [-2.4,-5.7]){+ box('Funnel plinth '+x,[1.9,.34,1.85],[x,3.99,0],navy);+ part('Raked funnel '+x,cylinderGeo(.66,.86,1.85,8),ivory,[x-.12,5.05,0],[0,0,-8]);+ part('Funnel brass collar '+x,cylinderGeo(.68,.70,.16,8),brass,[x-.23,5.59,0],[0,0,-8]);+ part('Funnel soot cap '+x,cylinderGeo(.70,.7,.35,8),navy,[x-.26,5.91,0],[0,0,-8]);+ part('Funnel dark opening '+x,cylinderGeo(.56,.56,.025,8),black,[x-.285,6.088,0],[0,0,-8]);+ for(let i=0;i<6;i++)box('Funnel intake louvre '+x+' '+i,[.8,.055,.04],[x,4.25+i*.13,.78],black);+ }+ // Revised naval mast with braced radar, signal halyards, and triangulated support.+ rod('Main mast',[-1.25,5.9,0],[-1.25,DESIGN.mastHeight,0],.075,navy);+ rod('Mast port brace',[-2.1,3.83,-1.1],[-1.25,7.8,0],.06,ivory);+ rod('Mast starboard brace',[-2.1,3.83,1.1],[-1.25,7.8,0],.06,ivory);+ rod('Signal yard',[-1.25,7.8,-1.8],[-1.25,7.8,1.8],.045,brass);+ // Solid radar panel replaced with an open framed array below.+ // Open trussed radar and signal structure: revised silhouette and visible supports.+ const rh=DESIGN.mastHeight, rw=DESIGN.radarWidth;+ for(const z of [-rw/2,rw/2])rod('Radar vertical frame '+z,[-1.25,rh-.52,z],[-1.25,rh+.52,z],.045,brass);+ for(const y of [rh-.52,rh+.52])rod('Radar horizontal frame '+y,[-1.25,y,-rw/2],[-1.25,y,rw/2],.045,brass);+ for(let j=0;j<=8;j++){+ const z=-rw/2+j*rw/8;+ rod('Radar grid vertical '+j,[-1.25,rh-.5,z],[-1.25,rh+.5,z],.019,blue);+ }+ for(let j=1;j<4;j++)rod('Radar grid horizontal '+j,[-1.25,rh-.52+j*.26,-rw/2],[-1.25,rh-.52+j*.26,rw/2],.022,blue);+ rod('Radar diagonal brace L',[-1.25,rh-.52,-rw/2],[-1.25,rh+.52,0],.026,ivory);+ rod('Radar diagonal brace R',[-1.25,rh+.52,0],[-1.25,rh-.52,rw/2],.026,ivory);+ part('Radar rotator bearing',cylinderGeo(.22,.28,.26,12),brass,[-1.25,rh-.65,0]);+ for(let i=0;i<4;i++){+ const y=6.1+i*.58,w=.53*(1-i*.17),wn=.53*(1-(i+1)*.17);+ for(const s of [-1,1]){+ rod('Mast lattice leg '+s+' '+i,[-1.25,y,s*w],[-1.25,y+.58,s*wn],.044,navy);+ rod('Mast lattice cross '+s+' '+i,[-1.25,y,s*w],[-1.25,y+.58,-s*wn],.025,ivory);+ }+ }+ for(const s of [-1,1]){+ rod('Mast tension rigging '+s,[-1.25,8.6,0],[-5.0,3.83,s*1.45],.012,black);+ rod('Signal halyard '+s,[-1.25,7.8,s*1.6],[-1.25,5.5,s*1.6],.012,brass);+ for(let i=0;i<3;i++){+ box('Signal flag '+s+' '+i,[.025,.28,.4],[-1.25,7.25-i*.43,s*1.4],i===1?glass:red);+ box('Signal flag stripe '+s+' '+i,[.028,.07,.4],[-1.25,7.25-i*.43,s*1.4],white);+ }+ }+ // Observation roof railing emphasizes the stepped bridge as an occupied structure.+ for(const s of [-1,1]){+ for(let x=-.6;x<2.4;x+=.45)rod('Bridge roof stanchion '+s+' '+x,[x,6.03,s*1.35],[x,6.35,s*1.35],.02,navy);+ rod('Bridge roof handrail '+s,[-.6,6.35,s*1.35],[2.3,6.35,s*1.35],.025,brass);+ }+ // Deck crane amidships aft, with an open triangular boom and suspended hook.+ part('Crane slewing base',cylinderGeo(.3,.4,.45,12),navy,[-7.7,4.02,0]);+ rod('Crane mast',[-7.7,4.1,0],[-7.7,5.55,0],.07,brass);+ rod('Crane boom upper',[-7.7,5.55,0],[-9.0,5.4,1.4],.055,brass);+ rod('Crane boom lower',[-7.7,4.75,0],[-9.0,5.4,1.4],.045,brass);+ rod('Crane hanging cable',[-9,5.4,1.4],[-9,4.35,1.4],.017,black);+ part('Crane hook',torusGeo(.09,.025,6,12),brass,[-9,4.27,1.4]);+ // Davit-carried lifeboats, secondary twin mounts and ventilators.+ for(const s of [-1,1]){+ for(const x of [-3.6,-6.2]){+ const boat=part('Lifeboat hull '+s+' '+x,cylinderGeo(.5,.28,2.25,8),ivory,[x,4.22,s*2.17],[0,0,90]);boat.scale.z=.55;+ box('Lifeboat dark cockpit '+s+' '+x,[1.5,.1,.46],[x,4.5,s*2.17],navy);+ for(const xx of [x-.65,x+.65]){rod('Boat davit upright '+s+' '+xx,[xx,3.75,s*1.5],[xx,4.9,s*1.5],.05,brass);rod('Boat davit arm '+s+' '+xx,[xx,4.9,s*1.5],[xx,4.9,s*2.2],.05,brass);rod('Boat sling '+s+' '+xx,[xx,4.9,s*2.2],[xx,4.45,s*2.2],.018,black);}+ }+ for(const x of [-8,-.8,6.0]){+ part('Secondary pedestal '+s+' '+x,cylinderGeo(.43,.5,.42,12),navy,[x,3.03,s*2.2]);+ box('Secondary shield '+s+' '+x,[.72,.55,.8],[x,3.42,s*2.2],ivory);+ for(const dx of [-.19,.19])rod('Secondary barrel '+s+' '+x+' '+dx,[x+dx,3.43,s*2.3],[x+dx,3.85,s*3.6],.047,blue);+ }+ for(const x of [-12,-9,10,12]){+ part('Mooring bollard '+s+' '+x,cylinderGeo(.09,.12,.27,8),navy,[x,2.96,s*1.1]);+ box('Bollard cap '+s+' '+x,[.3,.06,.19],[x,3.12,s*1.1],brass);+ }+ for(const x of [-5,-3,-1]){+ box('Hull armour applique '+s+' '+x,[1.5,.42,.11],[x,1.96,s*3.31],blue);+ part('Life ring '+s+' '+x,torusGeo(.18,.045,8,16),orange,[x,3.4,s*1.78]);+ }+ }+ // Foredeck anchor gear: winches, chain links and starboard anchor silhouette.+ for(const s of [-1,1]){+ part('Anchor capstan '+s,cylinderGeo(.25,.32,.3,12),blue,[12,2.99,s*.65]);+ for(let i=0;i<12;i++)part('Anchor chain link '+s+' '+i,torusGeo(.07,.018,6,10),black,[12.25+i*.145,2.84,s*(.65+i*.015)],[90,i%2*60,0]);+ rod('Anchor shank '+s,[13.8,2.38,s*1.5],[13.8,1.62,s*1.55],.05,brass);+ rod('Anchor crossbar '+s,[13.48,2.16,s*1.51],[14.12,2.16,s*1.51],.045,brass);+ rod('Anchor fluke L '+s,[13.8,1.62,s*1.55],[13.45,1.9,s*1.55],.055,brass);+ rod('Anchor fluke R '+s,[13.8,1.62,s*1.55],[14.15,1.9,s*1.55],.055,brass);+ }+ // Stern aircraft-free working deck with winch and crane.+ part('Stern winch',cylinderGeo(.3,.3,.65,12),blue,[-13.1,3.08,0],[90,0,0]);+ rod('Stern flagstaff',[-14.7,2.83,0],[-14.7,4.7,0],.035,brass);+ box('Fleet pennant',[.02,.44,.8],[-14.7,4.43,.42],red);+ box('Pennant ivory stripe',[.024,.12,.8],[-14.7,4.43,.42],ivory);+ return root;+}diff --git a/site/examples/history/demo-resolute-polar-fleet-flagship/revision-3.kiln.js b/site/examples/history/demo-resolute-polar-fleet-flagship/revision-3.kiln.jsnew file mode 100644index 00000000..f481862c--- /dev/null+++ b/site/examples/history/demo-resolute-polar-fleet-flagship/revision-3.kiln.js@@ -0,0 +1,212 @@+// RESOLUTE / polar fleet flagship. Original procedural design, metres, +X bow.+const meta = { name: 'Resolute — Polar Fleet Flagship', category: 'vehicle', role: 'vehicle' };+const DESIGN = { length: 32, beam: 6.6, deckY: 2.8, mastHeight: 9.5, radarWidth: 3.2, railHeight: 0.40 };+function build() {+ const root = createRoot('Resolute');+ const navy = gameMaterial(0x243e53,{roughness:0.65,metalness:0.25});+ const blue = gameMaterial(0x496779,{roughness:0.6,metalness:0.2});+ const ivory = gameMaterial(0xd5d7c8,{roughness:0.68});+ const teak = gameMaterial(0xb7824c,{roughness:0.95});+ const seam = gameMaterial(0x795738,{roughness:1});+ const brass = gameMaterial(0xd8ac55,{metalness:0.65,roughness:0.35});+ const red = gameMaterial(0x963e39,{roughness:0.8});+ const black = gameMaterial(0x172631,{roughness:0.8});+ const glass = gameMaterial(0x4fc4cb,{metalness:0.25,roughness:0.2});+ const white = gameMaterial(0xf0e7cc,{roughness:0.7});+ const orange = gameMaterial(0xdd7947,{roughness:0.8});+ const part=(n,g,m,p=[0,0,0],r=[0,0,0],parent=root)=>createPart(n,g,m,{position:p,rotation:r,parent});+ const box=(n,s,p,m,r=[0,0,0],parent=root)=>part(n,boxGeo(...s),m,p,r,parent);+ function rod(n,a,b,r,m,parent=root) {+ const va=new THREE.Vector3(...a), vb=new THREE.Vector3(...b),d=vb.clone().sub(va);+ const o=part(n,cylinderGeo(r,r,d.length(),8),m,va.clone().add(vb).multiplyScalar(.5).toArray(),[0,0,0],parent);+ o.quaternion.setFromUnitVectors(new THREE.Vector3(0,1,0),d.normalize()); return o;+ }+ // Convex waterline outline sampled along deliberately asymmetric bow/stern stations.+ const stations=[[-16,.15],[-15,1.5],[-13,2.55],[-10,3.1],[-6,3.3],[2,3.3],[7,3.05],[11,2.4],[14,1.3],[16,.06]];+ const outline=stations.map(s=>[s[0],s[1]]).concat(stations.slice().reverse().map(s=>[s[0],-s[1]]));+ function shell(n,rings,m) {+ const p=[],idx=[],N=outline.length;+ for(const [y,sx,sz] of rings) for(const [x,z] of outline)p.push(x*sx,y,z*sz);+ for(let k=0;k<rings.length-1;k++)for(let i=0;i<N;i++){+ const j=(i+1)%N,a=k*N+i,b=k*N+j,c=(k+1)*N+i,d=(k+1)*N+j;idx.push(a,b,c,b,d,c);+ }+ // Outline ordering is clockwise in XZ; its cap orientation is +Y.+ const bot=p.length/3;p.push(0,rings[0][0],0);const top=p.length/3;p.push(0,rings[rings.length-1][0],0);+ for(let i=0;i<N;i++){let j=(i+1)%N;idx.push(bot,j,i);let k=(rings.length-1)*N;idx.push(top,k+i,k+j);}+ return part(n,meshGeo({positions:p,indices:idx}),m);+ }+ shell('Red antifouling carved keel',[[0,.88,.42],[.45,.96,.70],[1.15,1,.94]],red);+ shell('Boot stripe',[[1.15,1,.94],[1.35,1,.96]],black);+ shell('Armoured flared hull',[[1.35,1,.96],[2.35,1,1],[2.77,1,1]],navy);+ shell('Ivory sheer stripe',[[2.56,1.001,1.006],[2.68,1.001,1.006]],ivory);+ shell('Teak main deck',[[2.77,.994,.982],[2.82,.994,.982]],teak);+ // Plank seams follow vessel length but stop at the narrowing bow and stern.+ for(let z=-2.8;z<=2.81;z+=.22){+ let xs=stations.filter(s=>s[1]>Math.abs(z)+.08).map(s=>s[0]);+ if(xs.length>1)box('Deck plank seam '+z.toFixed(2),[Math.max(...xs)-Math.min(...xs),.008,.018],[(Math.max(...xs)+Math.min(...xs))/2,2.827,z],seam);+ }+ // A perimeter handrail composed from station-to-station rails, with vertical stanchions.+ for(let i=0;i<outline.length;i++){+ let a=outline[i],b=outline[(i+1)%outline.length];+ let dist=Math.hypot(b[0]-a[0],b[1]-a[1]),count=Math.ceil(dist/.8);+ for(let t=0;t<count;t++){+ let x=(a[0]+(b[0]-a[0])*t/count)*.985,z=(a[1]+(b[1]-a[1])*t/count)*.96;+ rod('Rail stanchion '+i+'-'+t,[x,2.83,z],[x,2.83+DESIGN.railHeight,z],.022,ivory);+ }+ for(const h of [.19,DESIGN.railHeight])rod('Continuous safety rail '+i+'-'+h,[a[0]*.985,2.83+h,a[1]*.96],[b[0]*.985,2.83+h,b[1]*.96],.018,ivory);+ }+ // Scuttles track the hull stations so they remain mounted along the tapered sides.+ function hullWidth(x) {+ for(let i=0;i<stations.length-1;i++)if(x>=stations[i][0]&&x<=stations[i+1][0]){+ const a=stations[i],b=stations[i+1];return a[1]+(b[1]-a[1])*(x-a[0])/(b[0]-a[0]);+ }+ return .06;+ }+ for(const s of [-1,1])for(let x=-11;x<=10;x+=1.05){+ const z=s*(hullWidth(x)*.9972+.012);+ const yaw=-s*Math.atan((hullWidth(x+.01)-hullWidth(x-.01))/.02)*180/Math.PI;+ part('Brass scuttle '+s+' '+x,torusGeo(.095,.024,6,12),brass,[x,2.28,z],[0,yaw,0]);+ part('Dark scuttle glass '+s+' '+x,cylinderGeo(.078,.078,.018,12),black,[x,2.28,z],[90,yaw,0]);+ }+ // Fleet hull registry 07 is editable solid geometry, with no external font or texture.+ const digits=[[[0,0],[0,.48],[.26,.48],[.26,0],[0,0]],[[0,.48],[.26,.48],[.08,0]]];+ for(const s of [-1,1])for(let d=0;d<2;d++)for(let i=0;i<digits[d].length-1;i++){+ const a=digits[d][i],b=digits[d][i+1];+ rod('Hull registry 07 '+s+' '+d+' '+i,[1.15+s*(a[0]+d*.4),1.74+a[1],s*3.31],[1.15+s*(b[0]+d*.4),1.74+b[1],s*3.31],.027,ivory);+ }+ // Turret assembly in its own local coordinate frame. Articulated pivot retained for edits.+ function turret(n,x,y,dir,scale=1){+ const g=createPivot(n,[x,y,0],root);g.rotation.y=dir*Math.PI/180;+ part(n+' barbette',cylinderGeo(1.1*scale,1.2*scale,.4*scale,16),blue,[0,.2*scale,0],[0,0,0],g);+ // Faceted armour geometry with sloping cheeks; independent turret roof.+ const shape=[[-1.05,-.97],[-1.05,.97],[.65,1.02],[1.12,.65],[1.12,-.65],[.65,-1.02]];+ const pts=[],inds=[];+ for(const [yy,fac] of [[.38,1],[1.2,.82]])for(const [xx,zz] of shape)pts.push(xx*scale*fac,yy*scale,zz*scale*fac);+ for(let i=0;i<6;i++){let j=(i+1)%6;inds.push(i,j,6+i,j,6+j,6+i);}+ for(let i=1;i<5;i++){inds.push(0,i+1,i,6,6+i,6+i+1);}+ part(n+' angled gunhouse',meshGeo({positions:pts,indices:inds}),ivory,[0,0,0],[0,0,0],g);+ box(n+' roof plate',[1.42*scale,.08*scale,1.4*scale],[-.1*scale,1.24*scale,0],blue,[0,0,0],g);+ for(const z of [-.57,0,.57]){+ part(n+' gun mantlet '+z,cylinderGeo(.2*scale,.2*scale,.5*scale,12),navy,[.9*scale,.75*scale,z*scale],[0,0,90],g);+ rod(n+' barrel '+z,[1*scale,.75*scale,z*scale],[4.1*scale,1.02*scale,z*scale],.108*scale,blue,g);+ rod(n+' reinforced breech '+z,[1*scale,.75*scale,z*scale],[2*scale,.837*scale,z*scale],.145*scale,navy,g);+ part(n+' black muzzle '+z,cylinderGeo(.08*scale,.08*scale,.03*scale,12),black,[4.12*scale,1.022*scale,z*scale],[0,0,95],g);+ }+ box(n+' rangefinder',[.25*scale,.22*scale,2.15*scale],[-.45*scale,1.37*scale,0],brass,[0,0,0],g);+ }+ turret('A forward battery',8.3,2.84,0);+ box('B raised battery platform',[3.4,.62,3.7],[3.9,3.13,0],navy);+ turret('B superfiring battery',4.0,3.45,0,.91);+ turret('Y stern battery',-10.2,2.84,180);+ // Long central citadel, stepped bridge and glazed observation deck.+ box('Citadel lower deck',[11.6,.9,3.5],[-2,3.28,0],blue);+ box('Citadel teak roof',[11.8,.1,3.7],[-2,3.78,0],teak);+ box('Bridge lower block',[3.2,1.25,2.7],[.85,4.43,0],ivory);+ box('Bridge middle deck rim',[3.8,.16,3.25],[.85,5.13,0],brass);+ box('Bridge panoramic dark band',[2.8,.65,2.55],[.85,5.53,0],black);+ box('Bridge roof overhang',[3.25,.18,2.95],[.85,5.94,0],ivory);+ for(const s of [-1,1])for(let x=-.25;x<=1.96;x+=.43)box('Bridge side glazing '+s+' '+x,[.32,.42,.03],[x,5.55,s*1.285],glass);+ for(let z=-1;z<=1.01;z+=.4)box('Forward bridge glazing '+z,[.03,.42,.29],[2.27,5.55,z],glass);+ box('Conning tower',[1.3,.83,1.45],[.55,6.43,0],blue);+ part('Director turntable',cylinderGeo(.7,.7,.18,16),brass,[.55,6.93,0]);+ box('Optical director',[.7,.45,1.2],[.55,7.24,0],ivory);+ box('Director rangefinder',[.22,.23,2.1],[.6,7.4,0],navy);+ for(const s of [-1,1]){+ box('Bridge wing '+s,[1.6,.15,1.2],[.5,5.04,s*1.75],blue);+ box('Wing screen '+s,[1.7,.4,.08],[.5,5.3,s*2.31],ivory);+ // stairway with clear readable risers+ for(let i=0;i<8;i++)box('Citadel access step '+s+' '+i,[.25,.1,.55],[2.55-i*.15,2.88+i*.12,s*2.0],ivory);+ }+ // Paired raked funnels, dark mouths and horizontal brass collars.+ for(const x of [-2.4,-5.7]){+ box('Funnel plinth '+x,[1.9,.34,1.85],[x,3.99,0],navy);+ part('Raked funnel '+x,cylinderGeo(.66,.86,1.85,8),ivory,[x-.12,5.05,0],[0,0,-8]);+ part('Funnel brass collar '+x,cylinderGeo(.68,.70,.16,8),brass,[x-.23,5.59,0],[0,0,-8]);+ part('Funnel soot cap '+x,cylinderGeo(.70,.7,.35,8),navy,[x-.26,5.91,0],[0,0,-8]);+ part('Funnel dark opening '+x,cylinderGeo(.56,.56,.025,8),black,[x-.285,6.088,0],[0,0,-8]);+ for(let i=0;i<6;i++)box('Funnel intake louvre '+x+' '+i,[.8,.055,.04],[x,4.25+i*.13,.78],black);+ }+ // Revised naval mast with braced radar, signal halyards, and triangulated support.+ rod('Main mast',[-1.25,5.9,0],[-1.25,DESIGN.mastHeight,0],.075,navy);+ rod('Mast port brace',[-2.1,3.83,-1.1],[-1.25,7.8,0],.06,ivory);+ rod('Mast starboard brace',[-2.1,3.83,1.1],[-1.25,7.8,0],.06,ivory);+ rod('Signal yard',[-1.25,7.8,-1.8],[-1.25,7.8,1.8],.045,brass);+ // Solid radar panel replaced with an open framed array below.+ // Open trussed radar and signal structure: revised silhouette and visible supports.+ const rh=DESIGN.mastHeight, rw=DESIGN.radarWidth;+ for(const z of [-rw/2,rw/2])rod('Radar vertical frame '+z,[-1.25,rh-.52,z],[-1.25,rh+.52,z],.045,brass);+ for(const y of [rh-.52,rh+.52])rod('Radar horizontal frame '+y,[-1.25,y,-rw/2],[-1.25,y,rw/2],.045,brass);+ for(let j=0;j<=8;j++){+ const z=-rw/2+j*rw/8;+ rod('Radar grid vertical '+j,[-1.25,rh-.5,z],[-1.25,rh+.5,z],.019,blue);+ }+ for(let j=1;j<4;j++)rod('Radar grid horizontal '+j,[-1.25,rh-.52+j*.26,-rw/2],[-1.25,rh-.52+j*.26,rw/2],.022,blue);+ rod('Radar diagonal brace L',[-1.25,rh-.52,-rw/2],[-1.25,rh+.52,0],.026,ivory);+ rod('Radar diagonal brace R',[-1.25,rh+.52,0],[-1.25,rh-.52,rw/2],.026,ivory);+ part('Radar rotator bearing',cylinderGeo(.22,.28,.26,12),brass,[-1.25,rh-.65,0]);+ for(let i=0;i<4;i++){+ const y=6.1+i*.58,w=.53*(1-i*.17),wn=.53*(1-(i+1)*.17);+ for(const s of [-1,1]){+ rod('Mast lattice leg '+s+' '+i,[-1.25,y,s*w],[-1.25,y+.58,s*wn],.044,navy);+ rod('Mast lattice cross '+s+' '+i,[-1.25,y,s*w],[-1.25,y+.58,-s*wn],.025,ivory);+ }+ }+ for(const s of [-1,1]){+ rod('Mast tension rigging '+s,[-1.25,8.6,0],[-5.0,3.83,s*1.45],.012,black);+ rod('Signal halyard '+s,[-1.25,7.8,s*1.6],[-1.25,5.5,s*1.6],.012,brass);+ for(let i=0;i<3;i++){+ box('Signal flag '+s+' '+i,[.025,.28,.4],[-1.25,7.25-i*.43,s*1.4],i===1?glass:red);+ box('Signal flag stripe '+s+' '+i,[.028,.07,.4],[-1.25,7.25-i*.43,s*1.4],white);+ }+ }+ // Observation roof railing emphasizes the stepped bridge as an occupied structure.+ for(const s of [-1,1]){+ for(let x=-.6;x<2.4;x+=.45)rod('Bridge roof stanchion '+s+' '+x,[x,6.03,s*1.35],[x,6.35,s*1.35],.02,navy);+ rod('Bridge roof handrail '+s,[-.6,6.35,s*1.35],[2.3,6.35,s*1.35],.025,brass);+ }+ // Deck crane amidships aft, with an open triangular boom and suspended hook.+ part('Crane slewing base',cylinderGeo(.3,.4,.45,12),navy,[-7.7,4.02,0]);+ rod('Crane mast',[-7.7,4.1,0],[-7.7,5.55,0],.07,brass);+ rod('Crane boom upper',[-7.7,5.55,0],[-9.0,5.4,1.4],.055,brass);+ rod('Crane boom lower',[-7.7,4.75,0],[-9.0,5.4,1.4],.045,brass);+ rod('Crane hanging cable',[-9,5.4,1.4],[-9,4.35,1.4],.017,black);+ part('Crane hook',torusGeo(.09,.025,6,12),brass,[-9,4.27,1.4]);+ // Davit-carried lifeboats, secondary twin mounts and ventilators.+ for(const s of [-1,1]){+ for(const x of [-3.6,-6.2]){+ const boat=part('Lifeboat hull '+s+' '+x,cylinderGeo(.5,.28,2.25,8),ivory,[x,4.22,s*2.17],[0,0,90]);boat.scale.z=.55;+ box('Lifeboat dark cockpit '+s+' '+x,[1.5,.1,.46],[x,4.5,s*2.17],navy);+ for(const xx of [x-.65,x+.65]){rod('Boat davit upright '+s+' '+xx,[xx,3.75,s*1.5],[xx,4.9,s*1.5],.05,brass);rod('Boat davit arm '+s+' '+xx,[xx,4.9,s*1.5],[xx,4.9,s*2.2],.05,brass);rod('Boat sling '+s+' '+xx,[xx,4.9,s*2.2],[xx,4.45,s*2.2],.018,black);}+ }+ for(const x of [-8,-.8,6.0]){+ part('Secondary pedestal '+s+' '+x,cylinderGeo(.43,.5,.42,12),navy,[x,3.03,s*2.2]);+ box('Secondary shield '+s+' '+x,[.72,.55,.8],[x,3.42,s*2.2],ivory);+ for(const dx of [-.19,.19])rod('Secondary barrel '+s+' '+x+' '+dx,[x+dx,3.43,s*2.3],[x+dx,3.85,s*3.6],.047,blue);+ }+ for(const x of [-12,-9,10,12]){+ part('Mooring bollard '+s+' '+x,cylinderGeo(.09,.12,.27,8),navy,[x,2.96,s*1.1]);+ box('Bollard cap '+s+' '+x,[.3,.06,.19],[x,3.12,s*1.1],brass);+ }+ for(const x of [-5,-3,-1]){+ box('Hull armour applique '+s+' '+x,[1.5,.42,.11],[x,1.96,s*3.31],blue);+ part('Life ring '+s+' '+x,torusGeo(.18,.045,8,16),orange,[x,3.4,s*1.78]);+ }+ }+ // Foredeck anchor gear: winches, chain links and starboard anchor silhouette.+ for(const s of [-1,1]){+ part('Anchor capstan '+s,cylinderGeo(.25,.32,.3,12),blue,[12,2.99,s*.65]);+ for(let i=0;i<12;i++)part('Anchor chain link '+s+' '+i,torusGeo(.07,.018,6,10),black,[12.25+i*.145,2.84,s*(.65+i*.015)],[90,i%2*60,0]);+ rod('Anchor shank '+s,[13.8,2.38,s*1.5],[13.8,1.62,s*1.55],.05,brass);+ rod('Anchor crossbar '+s,[13.48,2.16,s*1.51],[14.12,2.16,s*1.51],.045,brass);+ rod('Anchor fluke L '+s,[13.8,1.62,s*1.55],[13.45,1.9,s*1.55],.055,brass);+ rod('Anchor fluke R '+s,[13.8,1.62,s*1.55],[14.15,1.9,s*1.55],.055,brass);+ }+ // Stern aircraft-free working deck with winch and crane.+ part('Stern winch',cylinderGeo(.3,.3,.65,12),blue,[-13.1,3.08,0],[90,0,0]);+ rod('Stern flagstaff',[-14.7,2.83,0],[-14.7,4.7,0],.035,brass);+ box('Fleet pennant',[.02,.44,.8],[-14.7,4.43,.42],red);+ box('Pennant ivory stripe',[.024,.12,.8],[-14.7,4.43,.42],ivory);+ // Shared dimensions scale the entire assembly and preserve all attachment relationships.+ root.scale.set(DESIGN.length/32,DESIGN.deckY/2.8,DESIGN.beam/6.6);+ return root;+}diff --git a/site/examples/history/demo-solar-sail-courier/history.json b/site/examples/history/demo-solar-sail-courier/history.jsonnew file mode 100644index 00000000..0500c323--- /dev/null+++ b/site/examples/history/demo-solar-sail-courier/history.json@@ -0,0 +1,16 @@+{+ "version": 1,+ "brief": {+ "kind": "recorded",+ "text": "Solar sail courier with ivory cargo pod, delicate structural spars, and folded copper-and-gold sails that animate deploying."+ },+ "currentSourceHash": "aeb05750d6b48e52dc56f9e068c41cb897bcaa5159380b60e52748ca22bd6e66",+ "revisions": [+ {+ "file": "revision-1.kiln.js",+ "title": "Saved revision 1",+ "description": "Solar sail courier with ivory cargo pod, delicate structural spars, and folded copper-and-gold sails that animate deploying.",+ "sourceHash": "aeb05750d6b48e52dc56f9e068c41cb897bcaa5159380b60e52748ca22bd6e66"+ }+ ]+}diff --git a/site/examples/history/demo-solar-sail-courier/revision-1.kiln.js b/site/examples/history/demo-solar-sail-courier/revision-1.kiln.jsnew file mode 100644index 00000000..9b624efb--- /dev/null+++ b/site/examples/history/demo-solar-sail-courier/revision-1.kiln.js@@ -0,0 +1,318 @@+const meta = {+ name: 'Solar sail courier',+ category: 'vehicle',+ role: 'vehicle',+};++function makeFoilFacet(positions, indices) {+ const doubleIndices = [...indices];+ for (let i = 0; i < indices.length; i += 3) {+ doubleIndices.push(indices[i], indices[i + 2], indices[i + 1]);+ }+ return meshGeo({ positions, indices: doubleIndices });+}++async function build() {+ const root = createRoot('SolarCourier');++ // Materials palette+ const ivoryHull = gameMaterial(0xf6f3ea, { roughness: 0.28, metalness: 0.08 });+ const ivoryDarkTrim = gameMaterial(0x23272e, { roughness: 0.5, metalness: 0.6 });+ const copperSail = gameMaterial(0xd97543, { roughness: 0.22, metalness: 0.92 });+ const goldSail = gameMaterial(0xf5be38, { roughness: 0.18, metalness: 0.95 });+ const carbonSpar = gameMaterial(0x181a1f, { roughness: 0.45, metalness: 0.3 });+ const titaniumFitting = gameMaterial(0x9da7b3, { roughness: 0.3, metalness: 0.85 });+ const amberSensor = gameMaterial(0xff9911, { emissive: 0xff7700, emissiveIntensity: 0.85, roughness: 0.15 });+ const cyanBeacon = gameMaterial(0x38e1b0, { emissive: 0x12b886, emissiveIntensity: 1.0 });+ const plasmaBlue = gameMaterial(0x66d9e8, { emissive: 0x339af0, emissiveIntensity: 1.2 });+ const solarCellDark = gameMaterial(0x162130, { roughness: 0.2, metalness: 0.7 });++ // -------------------------------------------------------------+ // 1. COMPACT IVORY CARGO POD+ // -------------------------------------------------------------+ const podCenter = [0, 1.38, 0];+ const podBody = createPivot('PodBody', podCenter, root);++ // Main Cargo Bay Capsule+ const mainHullGeo = await roundedBoxGeo(1.3, 0.58, 0.68, 0.09);+ createPart('MainHull', mainHullGeo, ivoryHull, { position: [0, 0, 0], parent: podBody });++ // Dorsal Equipment Spine Fairing+ const spineGeo = await roundedBoxGeo(1.4, 0.12, 0.38, 0.04);+ createPart('DorsalSpine', spineGeo, ivoryHull, { position: [0.05, 0.32, 0], parent: podBody });++ // Photovoltaic power strip on spine+ createPart('SolarStrip', boxGeo(1.1, 0.015, 0.22), solarCellDark, { position: [0.05, 0.39, 0], parent: podBody });++ // High-gain communications dish & mast+ createPart('CommMast', cylinderGeo(0.018, 0.018, 0.14, 8), titaniumFitting, { position: [0.35, 0.45, 0], parent: podBody });+ createPart('CommDish', coneGeo(0.12, 0.05, 16), goldSail, { position: [0.38, 0.54, 0], rotation: [0, 0, -45], parent: podBody });+ createPart('CommFeed', cylinderGeo(0.006, 0.006, 0.08, 6), titaniumFitting, { position: [0.42, 0.58, 0], rotation: [0, 0, -45], parent: podBody });++ // Lateral Cargo Access Hatches (Port & Starboard)+ for (const side of [-1, 1]) {+ const zPos = side * 0.345;+ createPart(`CargoDoor_${side > 0 ? 'Stbd' : 'Port'}`, boxGeo(0.65, 0.36, 0.02), ivoryDarkTrim, { position: [-0.05, 0, zPos], parent: podBody });+ createPart(`CargoLatchA_${side > 0 ? 'Stbd' : 'Port'}`, boxGeo(0.04, 0.08, 0.03), titaniumFitting, { position: [-0.32, 0, zPos + side * 0.01], parent: podBody });+ createPart(`CargoLatchB_${side > 0 ? 'Stbd' : 'Port'}`, boxGeo(0.04, 0.08, 0.03), titaniumFitting, { position: [0.22, 0, zPos + side * 0.01], parent: podBody });+ createPart(`StatusLight_${side > 0 ? 'Stbd' : 'Port'}`, boxGeo(0.55, 0.025, 0.02), cyanBeacon, { position: [-0.05, 0.16, zPos + side * 0.012], parent: podBody });+ }++ // Fore Avionics & Sensor Nose Module+ const noseCowlGeo = await roundedBoxGeo(0.44, 0.52, 0.60, 0.07);+ createPart('NoseCowl', noseCowlGeo, ivoryHull, { position: [0.72, 0, 0], parent: podBody });++ // Aerodynamic nose cap+ createPart('NoseCap', cylinderXGeo(0.24, 0.09, 0.28, 16), ivoryHull, { position: [0.98, 0, 0], parent: podBody });++ // Optical LIDAR / Navigation Sensor Eye+ createPart('SensorHousing', cylinderXGeo(0.12, 0.12, 0.08, 16), ivoryDarkTrim, { position: [1.08, 0, 0], parent: podBody });+ createPart('SensorLens', sphereGeo(0.09, 16, 12), amberSensor, { position: [1.11, 0, 0], parent: podBody });++ // Twin Star-Tracker Pods on upper nose+ for (const side of [-1, 1]) {+ createPart(`StarTracker_${side > 0 ? 'R' : 'L'}`, cylinderGeo(0.035, 0.04, 0.1, 8), ivoryDarkTrim, { position: [0.78, 0.25, side * 0.18], rotation: [side * 20, 0, 0], parent: podBody });+ createPart(`TrackerLens_${side > 0 ? 'R' : 'L'}`, sphereGeo(0.03, 8, 6), amberSensor, { position: [0.78, 0.3, side * 0.2], parent: podBody });+ }++ // Forward RCS Thruster Quads+ for (const side of [-1, 1]) {+ const sideKey = side > 0 ? 'R' : 'L';+ const rcsBase = createPivot(`RCS_Fwd_${sideKey}`, [0.82, 0, side * 0.32], podBody);+ createPart(`RcsHub_${sideKey}`, sphereGeo(0.035, 8, 6), titaniumFitting, { parent: rcsBase });+ createPart(`RcsNozzle_Up_${sideKey}`, coneGeo(0.02, 0.04, 8), titaniumFitting, { position: [0, 0.04, 0], parent: rcsBase });+ createPart(`RcsNozzle_Dn_${sideKey}`, coneGeo(0.02, 0.04, 8), titaniumFitting, { position: [0, -0.04, 0], rotation: [180, 0, 0], parent: rcsBase });+ createPart(`RcsNozzle_Out_${sideKey}`, coneGeo(0.02, 0.04, 8), titaniumFitting, { position: [0, 0, side * 0.04], rotation: [0, 0, side * 90], parent: rcsBase });+ }++ // Aft Service & Propulsion Collar+ const aftTaperGeo = cylinderXGeo(0.33, 0.27, 0.45, 16);+ createPart('AftHullTaper', aftTaperGeo, ivoryHull, { position: [-0.75, 0, 0], parent: podBody });++ // Sail Deployment Collar Ring+ createPart('DeploymentCollar', torusGeo(0.42, 0.045, 12, 24), titaniumFitting, { position: [-0.55, 0, 0], rotation: [0, 90, 0], parent: podBody });+ createPart('CollarCore', cylinderXGeo(0.38, 0.38, 0.14, 16), ivoryDarkTrim, { position: [-0.55, 0, 0], parent: podBody });++ // Main Ion Engine Bell & Grapple Ring+ createPart('EngineShroud', cylinderXGeo(0.26, 0.22, 0.22, 16), ivoryDarkTrim, { position: [-1.02, 0, 0], parent: podBody });+ createPart('IonEngineBell', cylinderXGeo(0.14, 0.24, 0.28, 16), titaniumFitting, { position: [-1.16, 0, 0], parent: podBody });+ createPart('IonNozzleRim', torusGeo(0.24, 0.015, 10, 20), titaniumFitting, { position: [-1.30, 0, 0], rotation: [0, 90, 0], parent: podBody });+ createPart('IonPlasmaCore', sphereGeo(0.12, 12, 8), plasmaBlue, { position: [-1.12, 0, 0], parent: podBody });+ createPart('DockingRing', torusGeo(0.25, 0.025, 10, 20), titaniumFitting, { position: [-0.94, 0, 0], rotation: [0, 90, 0], parent: podBody });++ // Retractable Landing Struts (touching ground at Y=0)+ const landingLegs = [+ { name: 'Leg_FL', top: [0.45, -0.22, -0.32], foot: [0.65, -1.36, -0.52] },+ { name: 'Leg_FR', top: [0.45, -0.22, 0.32], foot: [0.65, -1.36, 0.52] },+ { name: 'Leg_RL', top: [-0.45, -0.22, -0.32], foot: [-0.65, -1.36, -0.52] },+ { name: 'Leg_RR', top: [-0.45, -0.22, 0.32], foot: [-0.65, -1.36, 0.52] },+ ];+ for (const leg of landingLegs) {+ beamBetween(leg.name, leg.top, leg.foot, 0.022, titaniumFitting, { parent: podBody });+ createPart(`${leg.name}_Foot`, boxGeo(0.22, 0.035, 0.12), titaniumFitting, { position: [leg.foot[0], leg.foot[1] + 0.018, leg.foot[2]], parent: podBody });+ }++ // -------------------------------------------------------------+ // 2. DELICATE STRUCTURAL SPARS (4 Radial Booms)+ // -------------------------------------------------------------+ const sparAngles = [45, 135, 225, 315];+ for (let k = 0; k < 4; k++) {+ const angleDeg = sparAngles[k];+ const angleRad = (angleDeg * Math.PI) / 180;++ // Fixed base mount for spar k on the deployment collar+ const sparMount = createPivot(`SparMount_${k}`, [-0.55, 0, 0], podBody);+ sparMount.rotation.x = angleRad;++ // Gimbal mounting bracket on collar+ createPart(`GimbalBracket_${k}`, boxGeo(0.14, 0.12, 0.14), titaniumFitting, { position: [0, 0.44, 0], parent: sparMount });++ // Articulated Root Hinge: Joint_SparRoot_k+ // Initial folded pose: rotated back along pod hull (rotation.z = -78 deg)+ const sparRoot = createPivot(`SparRoot_${k}`, [0, 0.44, 0], sparMount);+ sparRoot.rotation.z = (-78 * Math.PI) / 180;++ // Hinge pin+ createPart(`HingePin_${k}`, cylinderZGeo(0.024, 0.024, 0.14, 10), titaniumFitting, { parent: sparRoot });++ // Inner Spar Truss: twin carbon chords and diagonal lattice lacing+ const chordLen = 2.1;+ createPart(`ChordA_${k}`, cylinderGeo(0.016, 0.016, chordLen, 8), carbonSpar, { position: [0, chordLen / 2, -0.035], parent: sparRoot });+ createPart(`ChordB_${k}`, cylinderGeo(0.016, 0.016, chordLen, 8), carbonSpar, { position: [0, chordLen / 2, 0.035], parent: sparRoot });++ // Cross-truss battens along inner spar+ for (let s = 1; s <= 5; s++) {+ const yBatten = s * 0.35;+ createPart(`Batten_${k}_${s}`, boxGeo(0.018, 0.014, 0.08), titaniumFitting, { position: [0, yBatten, 0], parent: sparRoot });+ beamBetween(`Brace_${k}_${s}`, [0, yBatten - 0.16, -0.035], [0, yBatten + 0.16, 0.035], 0.007, titaniumFitting, { parent: sparRoot });+ }++ // Articulated Elbow Hinge: Joint_SparElbow_k at tip of inner spar (Y = 2.1)+ // Initial folded pose: folded back along inner spar (rotation.z = +152 deg)+ const sparElbow = createPivot(`SparElbow_${k}`, [0, chordLen, 0], sparRoot);+ sparElbow.rotation.z = (152 * Math.PI) / 180;++ // Elbow knuckle & spreader strut+ createPart(`ElbowKnuckle_${k}`, boxGeo(0.08, 0.12, 0.09), titaniumFitting, { parent: sparElbow });+ createPart(`SpreaderStrut_${k}`, cylinderGeo(0.008, 0.008, 0.18, 6), titaniumFitting, { position: [0, 0.05, 0.1], rotation: [90, 0, 0], parent: sparElbow });+ createPart(`SpreaderPulley_${k}`, torusGeo(0.022, 0.006, 8, 12), goldSail, { position: [0, 0.05, 0.19], parent: sparElbow });++ // Outer Spar Boom: tapered carbon lattice boom+ const outerLen = 2.3;+ createPart(`OuterBoom_${k}`, cylinderGeo(0.012, 0.02, outerLen, 8), carbonSpar, { position: [0, outerLen / 2, 0], parent: sparElbow });++ // Outer Spar Battens+ for (let s = 1; s <= 4; s++) {+ const yOut = s * 0.45;+ createPart(`OuterBatten_${k}_${s}`, boxGeo(0.014, 0.012, 0.045), titaniumFitting, { position: [0, yOut, 0], parent: sparElbow });+ }++ // Spar Tip Assembly at Y = outerLen+ const sparTip = createPivot(`SparTip_${k}`, [0, outerLen, 0], sparElbow);+ createPart(`TipFitting_${k}`, boxGeo(0.05, 0.08, 0.05), titaniumFitting, { parent: sparTip });+ createPart(`TipTensioner_${k}`, torusGeo(0.025, 0.006, 8, 12), goldSail, { position: [0, 0.04, 0], parent: sparTip });+ createPart(`TipBeacon_${k}`, sphereGeo(0.022, 8, 6), cyanBeacon, { position: [0, 0.07, 0], parent: sparTip });++ // -------------------------------------------------------------+ // 3. FOLDED COPPER-AND-GOLD SAILS (Dual-Wing Origami Facets)+ // -------------------------------------------------------------+ // Inner Sail Package: Joint_SailFold_k_Inner attached to sparRoot+ const sailInner = createPivot(`SailFold_${k}_Inner`, [0, 0, 0], sparRoot);+ sailInner.rotation.x = (60 * Math.PI) / 180;+ sailInner.rotation.z = (-32 * Math.PI) / 180;+ sailInner.scale.set(0.12, 0.95, 0.12);++ // Starboard Wing (towards +Z)+ createPart(`Sail_Cu_InnerA_${k}`, makeFoilFacet([+ 0, 0.15, 0,+ 0, 1.1, 0,+ -0.05, 0.85, 0.65,+ -0.03, 0.2, 0.25+ ], [0, 1, 2, 0, 2, 3]), copperSail, { parent: sailInner });++ createPart(`Sail_Au_InnerA_${k}`, makeFoilFacet([+ 0, 1.1, 0,+ 0, 2.05, 0,+ -0.08, 1.6, 1.35,+ -0.05, 0.85, 0.65+ ], [0, 1, 2, 0, 2, 3]), goldSail, { parent: sailInner });++ // Port Wing (towards -Z)+ createPart(`Sail_Cu_InnerB_${k}`, makeFoilFacet([+ 0, 0.15, 0,+ 0, 1.1, 0,+ -0.05, 0.85, -0.65,+ -0.03, 0.2, -0.25+ ], [0, 1, 2, 0, 2, 3]), copperSail, { parent: sailInner });++ createPart(`Sail_Au_InnerB_${k}`, makeFoilFacet([+ 0, 1.1, 0,+ 0, 2.05, 0,+ -0.08, 1.6, -1.35,+ -0.05, 0.85, -0.65+ ], [0, 1, 2, 0, 2, 3]), goldSail, { parent: sailInner });++ // Outer Sail Package: Joint_SailFold_k_Outer attached to sparElbow+ const sailOuter = createPivot(`SailFold_${k}_Outer`, [0, 0, 0], sparElbow);+ sailOuter.rotation.x = (-55 * Math.PI) / 180;+ sailOuter.rotation.z = (30 * Math.PI) / 180;+ sailOuter.scale.set(0.12, 0.95, 0.12);++ // Outer Starboard Wing (towards +Z)+ createPart(`Sail_Cu_OuterA_${k}`, makeFoilFacet([+ 0, 0.02, 0,+ 0, 1.15, 0,+ -0.10, 0.85, 1.85,+ -0.08, 0.02, 1.35+ ], [0, 1, 2, 0, 2, 3]), copperSail, { parent: sailOuter });++ createPart(`Sail_Au_OuterA_${k}`, makeFoilFacet([+ 0, 1.15, 0,+ 0, 2.25, 0,+ -0.12, 1.75, 2.45,+ -0.10, 0.85, 1.85+ ], [0, 1, 2, 0, 2, 3]), goldSail, { parent: sailOuter });++ beamBetween(`SailEdgeA_${k}`, [0, 2.25, 0], [-0.12, 1.75, 2.45], 0.007, carbonSpar, { parent: sailOuter });++ // Outer Port Wing (towards -Z)+ createPart(`Sail_Cu_OuterB_${k}`, makeFoilFacet([+ 0, 0.02, 0,+ 0, 1.15, 0,+ -0.10, 0.85, -1.85,+ -0.08, 0.02, -1.35+ ], [0, 1, 2, 0, 2, 3]), copperSail, { parent: sailOuter });++ createPart(`Sail_Au_OuterB_${k}`, makeFoilFacet([+ 0, 1.15, 0,+ 0, 2.25, 0,+ -0.12, 1.75, -2.45,+ -0.10, 0.85, -1.85+ ], [0, 1, 2, 0, 2, 3]), goldSail, { parent: sailOuter });++ beamBetween(`SailEdgeB_${k}`, [0, 2.25, 0], [-0.12, 1.75, -2.45], 0.007, carbonSpar, { parent: sailOuter });+ }++ return root;+}++function animate(root) {+ const tracks = [];+ const duration = 3.6;++ for (let k = 0; k < 4; k++) {+ // 1. Root Spar Rotation Track: sweeps outward from folded (-78 deg) to deployed (0 deg)+ tracks.push(rotationTrack(`Joint_SparRoot_${k}`, [+ { time: 0.0, rotation: [0, 0, -78] },+ { time: 0.8, rotation: [0, 0, -65] },+ { time: 2.0, rotation: [0, 0, -20] },+ { time: 2.8, rotation: [0, 0, 0] },+ { time: 3.2, rotation: [0, 0, 0.8] },+ { time: 3.6, rotation: [0, 0, 0] },+ ]));++ // 2. Elbow Spar Rotation Track: unfolds from folded (+152 deg) to straight (0 deg)+ tracks.push(rotationTrack(`Joint_SparElbow_${k}`, [+ { time: 0.0, rotation: [0, 0, 152] },+ { time: 0.6, rotation: [0, 0, 145] },+ { time: 1.8, rotation: [0, 0, 45] },+ { time: 2.8, rotation: [0, 0, 0] },+ { time: 3.2, rotation: [0, 0, -0.6] },+ { time: 3.6, rotation: [0, 0, 0] },+ ]));++ // 3. Inner Sail Package: expands from folded accordion pleat to full taut membrane+ tracks.push(rotationTrack(`Joint_SailFold_${k}_Inner`, [+ { time: 0.0, rotation: [60, 0, -32] },+ { time: 1.0, rotation: [42, 0, -20] },+ { time: 2.0, rotation: [18, 0, -8] },+ { time: 2.8, rotation: [0, 0, 0] },+ { time: 3.6, rotation: [0, 0, 0] },+ ]));+ tracks.push(scaleTrack(`Joint_SailFold_${k}_Inner`, [+ { time: 0.0, scale: [0.12, 0.95, 0.12] },+ { time: 1.0, scale: [0.35, 0.97, 0.35] },+ { time: 2.0, scale: [0.72, 1.0, 0.72] },+ { time: 2.8, scale: [1.0, 1.0, 1.0] },+ { time: 3.6, scale: [1.0, 1.0, 1.0] },+ ]));++ // 4. Outer Sail Package: unfurls outwards to full radial span+ tracks.push(rotationTrack(`Joint_SailFold_${k}_Outer`, [+ { time: 0.0, rotation: [-55, 0, 30] },+ { time: 1.0, rotation: [-38, 0, 18] },+ { time: 2.0, rotation: [-16, 0, 6] },+ { time: 2.8, rotation: [0, 0, 0] },+ { time: 3.6, rotation: [0, 0, 0] },+ ]));+ tracks.push(scaleTrack(`Joint_SailFold_${k}_Outer`, [+ { time: 0.0, scale: [0.12, 0.95, 0.12] },+ { time: 1.0, scale: [0.35, 0.97, 0.35] },+ { time: 2.0, scale: [0.72, 1.0, 0.72] },+ { time: 2.8, scale: [1.0, 1.0, 1.0] },+ { time: 3.6, scale: [1.0, 1.0, 1.0] },+ ]));+ }++ return [createClip('Deploy', duration, tracks)];+}diff --git a/site/examples/history/demo-umbra-submarine/history.json b/site/examples/history/demo-umbra-submarine/history.jsonnew file mode 100644index 00000000..78bbdf88--- /dev/null+++ b/site/examples/history/demo-umbra-submarine/history.json@@ -0,0 +1,22 @@+{+ "version": 1,+ "brief": {+ "kind": "recorded",+ "text": "Lightweight game version strictly under 20,000 triangles."+ },+ "currentSourceHash": "7d13398e5457d8acfad423430be3af6bd33d4fb83d939854593cc4c60a80b0a0",+ "revisions": [+ {+ "file": "revision-1.kiln.js",+ "title": "Saved revision 1",+ "description": "Create a detailed nuclear submarine with a dark hull, a tall sail, and stern fins.",+ "sourceHash": "529fb9b95c6e464f26bc41a6e2693c09a8f96f4e05907b64035c91f4e981f71a"+ },+ {+ "file": "revision-2.kiln.js",+ "title": "Saved revision 2",+ "description": "Lightweight game version strictly under 20,000 triangles.",+ "sourceHash": "7d13398e5457d8acfad423430be3af6bd33d4fb83d939854593cc4c60a80b0a0"+ }+ ]+}diff --git a/site/examples/history/demo-umbra-submarine/revision-1.kiln.js b/site/examples/history/demo-umbra-submarine/revision-1.kiln.jsnew file mode 100644index 00000000..9b312925--- /dev/null+++ b/site/examples/history/demo-umbra-submarine/revision-1.kiln.js@@ -0,0 +1,113 @@+const meta = {name:'UMBRA SSN - Nuclear Submarine',category:'vehicle',role:'vehicle'};+function build(){+ const root=createRoot('UMBRA_SSN');+ const P={cy:6.2, radius:5.5, sailTop:21.5};+ const hull=gameMaterial(0x202b32,{metalness:.45,roughness:.43,flatShading:false});+ const lower=gameMaterial(0x182126,{metalness:.35,roughness:.53,flatShading:false});+ const panel=gameMaterial(0x303d44,{metalness:.5,roughness:.44,flatShading:false});+ const seam=gameMaterial(0x111a1e,{roughness:.7,flatShading:false});+ const edge=gameMaterial(0x60717a,{metalness:.7,roughness:.32,flatShading:false});+ const bronze=gameMaterial(0x9d7640,{metalness:.82,roughness:.3,flatShading:false});+ const glass=gameMaterial(0x17383f,{metalness:.55,roughness:.16,flatShading:false});+ const ivory=gameMaterial(0xc5c9bd,{roughness:.65});+ const add=(n,g,m,p=[0,0,0],r=[0,0,0],parent=root)=>createPart(n,g,m,{position:p,rotation:r,parent});+ const box=(n,s,m,p,r)=>add(n,new THREE.BoxGeometry(...s),m,p,r);+ const cyl=(n,rt,rb,h,m,p,r)=>add(n,new THREE.CylinderGeometry(rt,rb,h,32),m,p,r);+ const sphere=(n,s,m,p)=>createPart(n,new THREE.SphereGeometry(1,40,24),m,{position:p,scale:s,parent:root});+ const line=(n,pts,r,m)=>add(n,new THREE.TubeGeometry(new THREE.CatmullRomCurve3(pts.map(p=>new THREE.Vector3(...p))),Math.max(8,pts.length*4),r,6,false),m);+ const stations=[[-55,0.35],[-52,.65],[-49,1.3],[-45,2.15],[-39,3.25],[-31,4.55],[-22,5.23],[-12,5.47],[0,5.5],[20,5.5],[34,5.44],[43,4.95],[49,3.95],[53,2.5],[55,.15]];+ const curve=new THREE.CatmullRomCurve3(stations.map(p=>new THREE.Vector3(p[0],p[1],0)),false,'centripetal');+ const samples=curve.getPoints(200);+ const geo=new THREE.LatheGeometry(samples.map(p=>new THREE.Vector2(p.y,p.x)),80);+ geo.rotateZ(-Math.PI/2);+ add('Pressure_Hull',geo,hull,[0,P.cy,0]);+ function radius(x){let a=samples[0];for(const b of samples){if(b.x>=x){const t=(x-a.x)/(b.x-a.x||1);return a.y+(b.y-a.y)*t;}a=b;}return a.y;}+ // Conformal lower coating follows the pressure hull.+ const low=new THREE.LatheGeometry(samples.map(p=>new THREE.Vector2(p.y+.016,p.x)),80,0,Math.PI);+ low.rotateZ(-Math.PI/2);add('Lower_Hull_Coating',low,lower,[0,P.cy,0]);+ // Fine circumferential joints, deliberately darker than the hull.+ [-39,-30,-18,-5,8,27,38,45].forEach((x,i)=>add('Hull_Expansion_Seam_'+i,new THREE.TorusGeometry(radius(x)+.008,.027,6,80),seam,[x,P.cy,0],[0,90,0]));+ function foil(chord,width,cx=0){const p=[];for(let i=0;i<=32;i++){let t=i/32;let z=5*width*(.2969*Math.sqrt(t)-.126*t-.3516*t*t+.2843*t*t*t-.1036*t*t*t*t);p.push([cx+chord/2-chord*t,z]);}for(let i=31;i>0;i--){let t=i/32;let z=5*width*(.2969*Math.sqrt(t)-.126*t-.3516*t*t+.2843*t*t*t-.1036*t*t*t*t);p.push([cx+chord/2-chord*t,-z]);}return p;}+ add('Dorsal_Casing',loftProfiles([{profile:foil(69,4.1),frame:{origin:[4,10.8,0]}},{profile:foil(68,3.6),frame:{origin:[4,11.55,0]}}]),hull);+ add('Tall_Streamlined_Sail',loftProfiles([+ {profile:foil(18,4.9),frame:{origin:[13,10.8,0]}},+ {profile:foil(16.8,4.3),frame:{origin:[13.2,13,0]}},+ {profile:foil(15.3,3.8),frame:{origin:[13.7,P.sailTop-.45,0]}},+ {profile:foil(14.7,3.5),frame:{origin:[13.65,P.sailTop,0]}}]),panel);+ add('Sail_Crown',loftProfiles([{profile:foil(14.8,3.55),frame:{origin:[13.65,21.43,0]}},{profile:foil(14.5,3.4),frame:{origin:[13.65,21.63,0]}}]),hull);+ // Hydroplanes have a thick leading edge, tapered tips and swept trailing geometry.+ function fin(name,x,y,z,span,chord,rot){+ const f=loftProfiles([{profile:foil(chord,1.05),frame:{origin:[0,0,0]}},{profile:foil(chord*.9,.72,-.5),frame:{origin:[0,span*.62,0]}},{profile:foil(chord*.49,.23,-1.05),frame:{origin:[0,span,0]}}]);+ add(name,f,hull,[x,y,z],[rot,0,0]);+ }+ fin('Stern_Upper_Rudder',-45,6.2,0,9.5,10.5,0);+ fin('Stern_Lower_Rudder',-45,6.2,0,6.1,10.5,180);+ fin('Stern_Starboard_Plane',-45,6.2,0,10.4,10.8,90);+ fin('Stern_Port_Plane',-45,6.2,0,10.4,10.8,-90);+ fin('Sail_Starboard_Plane',15,15.1,1.5,6,5.8,90);+ fin('Sail_Port_Plane',15,15.1,-1.5,6,5.8,-90);+ for(const s of [-1,1]){+ line('Stern_Control_Hinge_'+s,[[-48,6.22,s*3],[-48.8,6.22,s*6.5],[-49.05,6.22,s*9.5]],.042,seam);+ line('Rudder_Hinge_'+s,[[-48,6.2+s*2.1,0],[-48.7,6.2+s*5.5,0]],.045,seam);+ // Bridge optics and inspection panels.+ for(let j=0;j<4;j++)box('Sail_Optical_Window_'+s+'_'+j,[.74,.42,.05],glass,[17.4-j*.94,20.45,s*(.94+j*.1)]);+ line('Sail_Service_Seam_'+s,[[8.3,13.3,s*.8],[8.7,18.8,s*.78],[9,20.6,s*.76]],.025,seam);+ for(let j=0;j<6;j++)box('Sail_Vent_'+s+'_'+j,[.65,.075,.045],seam,[9.4,14.1+j*.23,s*1.54]);+ // Aft free-flood vent bank.+ for(let j=0;j<12;j++){const x=-22+j*.91;const z=s*3.1;const y=P.cy+Math.sqrt(radius(x)*radius(x)-z*z);+ box('Flood_Vent_'+s+'_'+j,[.51,.042,.28],seam,[x,y+.025,z],[s*34,0,0]);}+ }+ // Concentric escape hatches, bolts, grab handles and deck access panels.+ function hatch(name,x,z,r){+ const y=11.57;+ cyl(name+'_Recess',r+.14,r+.14,.07,seam,[x,y,z]);+ cyl(name+'_Rim',r,r,.1,edge,[x,y+.06,z]);+ cyl(name+'_Lid',r*.86,r*.86,.11,hull,[x,y+.14,z]);+ for(let i=0;i<8;i++){const a=i*Math.PI/4;cyl(name+'_Bolt_'+i,.055,.055,.045,bronze,[x+Math.cos(a)*r*.91,y+.15,z+Math.sin(a)*r*.91]);}+ line(name+'_Handle',[[x-.25,y+.16,z],[x-.25,y+.4,z],[x+.25,y+.4,z],[x+.25,y+.16,z]],.045,edge);+ }+ hatch('Forward_Escape_Hatch',29,0,.97);hatch('Aft_Escape_Hatch',-15,0,.85);+ for(let j=0;j<6;j++){const x=-5-j*2.9;box('Deck_Access_Recess_'+j,[2.2,.055,1.45],seam,[x,11.57,0]);box('Deck_Access_Lid_'+j,[2.08,.06,1.33],panel,[x,11.61,0]);}+ // Telescoping sensor package.+ function mast(name,x,z,h,r){+ cyl(name+'_Boot',r*1.65,r*1.9,.38,hull,[x,21.73,z]);+ cyl(name+'_Brass_Collar',r*1.5,r*1.5,.16,bronze,[x,21.98,z]);+ cyl(name+'_Stem',r,r,h,edge,[x,22+h/2,z]);+ cyl(name+'_Black_Sleeve',r*1.04,r*1.04,h*.31,hull,[x,22+h*.25,z]);+ return 22+h;+ }+ let y=mast('Search_Periscope',17,0,5.3,.16);+ box('Periscope_Head',[.72,.4,.42],hull,[17.16,y,0]);+ box('Periscope_Lens',[.026,.21,.25],glass,[17.535,y,0]);+ y=mast('Optronic_Mast',13.5,.14,4.15,.25);+ cyl('Optronic_Head',.38,.35,.84,hull,[13.5,y+.24,.14]);+ box('Optronic_Lens',[.025,.32,.3],glass,[13.88,y+.25,.14]);+ y=mast('Radar_Mast',10.2,0,2.5,.22);+ box('Radar_Array',[2.3,.4,.54],panel,[10.2,y+.1,0]);+ mast('Radio_Antenna',8.3,0,4.0,.075);+ // Low-profile bridge hatch.+ cyl('Bridge_Hatch_Rim',.65,.65,.11,seam,[18.3,21.69,0]);+ cyl('Bridge_Hatch',.52,.52,.12,panel,[18.3,21.77,0]);+ // Seven curved, skewed bronze propeller blades, on an aft shaft.+ cyl('Propeller_Shaft',.39,.39,3.8,edge,[-55.25,6.2,0],[0,0,90]);+ sphere('Propeller_Hub',[1.75,.77,.77],bronze,[-57,6.2,0]);+ for(let i=0;i<7;i++){+ const blade=loftProfiles([+ {profile:foil(1.1,.23),frame:{origin:[0,.55,0],rotation:[0,20,0]}},+ {profile:foil(2.5,.19),frame:{origin:[-.3,2,0],rotation:[0,36,0]}},+ {profile:foil(2.2,.13),frame:{origin:[-.75,3.4,0],rotation:[0,53,0]}},+ {profile:foil(.55,.07),frame:{origin:[-1.3,4.1,0],rotation:[0,63,0]}}]);+ add('Skewed_Propeller_Blade_'+i,blade,bronze,[-56.9,6.2,0],[i*360/7,0,0]);+ }+ // Bow sonar boundary and conformal flank sensor fairings.+ add('Sonar_Cap_Seam',new THREE.TorusGeometry(radius(43)+.023,.045,6,80),seam,[43,6.2,0],[0,90,0]);+ for(const s of [-1,1]){+ sphere('Flank_Array_'+s,[13,.37,.12],panel,[8,6.6,s*5.47]);+ for(let j=0;j<5;j++)box('Draft_Marking_'+s+'_'+j,[.5,.1,.03],ivory,[38,6+j*.42,s*(radius(38)-.02-j*.015)]);+ // Small forward torpedo shutter outlines.+ for(const offset of [-.65,.65]){+ const pts=[];for(let i=0;i<=32;i++){const a=i*Math.PI/16;const x=45+2.3*Math.cos(a), yy=6.2+offset+.48*Math.sin(a);const zz=s*Math.sqrt(Math.max(.1,radius(x)*radius(x)-(yy-6.2)*(yy-6.2)));pts.push([x,yy,zz+s*.02]);}line('Bow_Shutter_'+s+'_'+offset,pts,.035,seam);+ }+ }+ return root;+}\ No newline at end of filediff --git a/site/examples/history/demo-umbra-submarine/revision-2.kiln.js b/site/examples/history/demo-umbra-submarine/revision-2.kiln.jsnew file mode 100644index 00000000..b2249897--- /dev/null+++ b/site/examples/history/demo-umbra-submarine/revision-2.kiln.js@@ -0,0 +1,153 @@+const meta = {name:'UMBRA SSN - Nuclear Submarine',category:'vehicle',role:'vehicle'};+function build(){+ const root=createRoot('UMBRA_SSN');+ const P={cy:6.2, radius:5.5, sailTop:21.5};+ // Game LOD: named source parts remain editable; export batches static geometry.+ const Q={hullLength:64,hullHalf:24,foil:16,cylinder:12,sphereWidth:20,sphereHeight:12,batchStatic:true,triangleLimit:20000};+ const hull=gameMaterial(0x202b32,{metalness:.45,roughness:.43,flatShading:false});+ const lower=gameMaterial(0x182126,{metalness:.35,roughness:.53,flatShading:false});+ const panel=gameMaterial(0x303d44,{metalness:.5,roughness:.44,flatShading:false});+ const seam=gameMaterial(0x111a1e,{roughness:.7,flatShading:false});+ const edge=gameMaterial(0x60717a,{metalness:.7,roughness:.32,flatShading:false});+ const bronze=gameMaterial(0x9d7640,{metalness:.82,roughness:.3,flatShading:false});+ const glass=gameMaterial(0x17383f,{metalness:.55,roughness:.16,flatShading:false});+ const ivory=gameMaterial(0xc5c9bd,{roughness:.65});+ const add=(n,g,m,p=[0,0,0],r=[0,0,0],parent=root)=>createPart(n,g,m,{position:p,rotation:r,parent});+ const box=(n,s,m,p,r)=>add(n,new THREE.BoxGeometry(...s),m,p,r);+ const cyl=(n,rt,rb,h,m,p,r)=>add(n,new THREE.CylinderGeometry(rt,rb,h,rt<.1?6:Q.cylinder),m,p,r);+ const sphere=(n,s,m,p)=>createPart(n,new THREE.SphereGeometry(1,Q.sphereWidth,Q.sphereHeight),m,{position:p,scale:s,parent:root});+ const line=(n,pts,r,m)=>add(n,new THREE.TubeGeometry(new THREE.CatmullRomCurve3(pts.map(p=>new THREE.Vector3(...p))),Math.max(6,Math.min(24,pts.length*2)),r,4,false),m);+ const stations=[[-55,0.35],[-52,.65],[-49,1.3],[-45,2.15],[-39,3.25],[-31,4.55],[-22,5.23],[-12,5.47],[0,5.5],[20,5.5],[34,5.44],[43,4.95],[49,3.95],[53,2.5],[55,.15]];+ const curve=new THREE.CatmullRomCurve3(stations.map(p=>new THREE.Vector3(p[0],p[1],0)),false,'centripetal');+ const samples=curve.getPoints(Q.hullLength);+ // Adjacent upper/lower surfaces eliminate the hidden duplicate underside.+ const geo=new THREE.LatheGeometry(samples.map(p=>new THREE.Vector2(p.y,p.x)),Q.hullHalf,Math.PI,Math.PI);+ geo.rotateZ(-Math.PI/2);+ add('Pressure_Hull',geo,hull,[0,P.cy,0]);+ function radius(x){let a=samples[0];for(const b of samples){if(b.x>=x){const t=(x-a.x)/(b.x-a.x||1);return a.y+(b.y-a.y)*t;}a=b;}return a.y;}+ // Lower half meets the upper half at the equator.+ const low=new THREE.LatheGeometry(samples.map(p=>new THREE.Vector2(p.y,p.x)),Q.hullHalf,0,Math.PI);+ low.rotateZ(-Math.PI/2);add('Lower_Hull_Coating',low,lower,[0,P.cy,0]);+ // Fine circumferential joints, deliberately darker than the hull.+ [-39,-30,-18,-5,8,27,38,45].forEach((x,i)=>add('Hull_Expansion_Seam_'+i,new THREE.TorusGeometry(radius(x)+.008,.027,3,Q.hullHalf*2),seam,[x,P.cy,0],[0,90,0]));+ function foil(chord,width,cx=0){const p=[];const N=Q.foil;for(let i=0;i<=N;i++){let t=i/N;let z=5*width*(.2969*Math.sqrt(t)-.126*t-.3516*t*t+.2843*t*t*t-.1036*t*t*t*t);p.push([cx+chord/2-chord*t,z]);}for(let i=N-1;i>0;i--){let t=i/N;let z=5*width*(.2969*Math.sqrt(t)-.126*t-.3516*t*t+.2843*t*t*t-.1036*t*t*t*t);p.push([cx+chord/2-chord*t,-z]);}return p;}+ add('Dorsal_Casing',loftProfiles([{profile:foil(69,4.1),frame:{origin:[4,10.8,0]}},{profile:foil(68,3.6),frame:{origin:[4,11.55,0]}}]),hull);+ add('Tall_Streamlined_Sail',loftProfiles([+ {profile:foil(18,4.9),frame:{origin:[13,10.8,0]}},+ {profile:foil(16.8,4.3),frame:{origin:[13.2,13,0]}},+ {profile:foil(15.3,3.8),frame:{origin:[13.7,P.sailTop-.45,0]}},+ {profile:foil(14.7,3.5),frame:{origin:[13.65,P.sailTop,0]}}]),panel);+ add('Sail_Crown',loftProfiles([{profile:foil(14.8,3.55),frame:{origin:[13.65,21.43,0]}},{profile:foil(14.5,3.4),frame:{origin:[13.65,21.63,0]}}]),hull);+ // Hydroplanes have a thick leading edge, tapered tips and swept trailing geometry.+ function fin(name,x,y,z,span,chord,rot){+ const f=loftProfiles([{profile:foil(chord,1.05),frame:{origin:[0,0,0]}},{profile:foil(chord*.9,.72,-.5),frame:{origin:[0,span*.62,0]}},{profile:foil(chord*.49,.23,-1.05),frame:{origin:[0,span,0]}}]);+ add(name,f,hull,[x,y,z],[rot,0,0]);+ }+ fin('Stern_Upper_Rudder',-45,6.2,0,9.5,10.5,0);+ fin('Stern_Lower_Rudder',-45,6.2,0,6.1,10.5,180);+ fin('Stern_Starboard_Plane',-45,6.2,0,10.4,10.8,90);+ fin('Stern_Port_Plane',-45,6.2,0,10.4,10.8,-90);+ fin('Sail_Starboard_Plane',15,15.1,1.5,6,5.8,90);+ fin('Sail_Port_Plane',15,15.1,-1.5,6,5.8,-90);+ for(const s of [-1,1]){+ line('Stern_Control_Hinge_'+s,[[-48,6.22,s*3],[-48.8,6.22,s*6.5],[-49.05,6.22,s*9.5]],.042,seam);+ line('Rudder_Hinge_'+s,[[-48,6.2+s*2.1,0],[-48.7,6.2+s*5.5,0]],.045,seam);+ // Bridge optics and inspection panels.+ for(let j=0;j<4;j++)box('Sail_Optical_Window_'+s+'_'+j,[.74,.42,.05],glass,[17.4-j*.94,20.45,s*(.94+j*.1)]);+ line('Sail_Service_Seam_'+s,[[8.3,13.3,s*.8],[8.7,18.8,s*.78],[9,20.6,s*.76]],.025,seam);+ for(let j=0;j<6;j++)box('Sail_Vent_'+s+'_'+j,[.65,.075,.045],seam,[9.4,14.1+j*.23,s*1.54]);+ // Aft free-flood vent bank.+ for(let j=0;j<12;j++){const x=-22+j*.91;const z=s*3.1;const y=P.cy+Math.sqrt(radius(x)*radius(x)-z*z);+ box('Flood_Vent_'+s+'_'+j,[.51,.042,.28],seam,[x,y+.025,z],[s*34,0,0]);}+ }+ // Concentric escape hatches, bolts, grab handles and deck access panels.+ function hatch(name,x,z,r){+ const y=11.57;+ cyl(name+'_Recess',r+.14,r+.14,.07,seam,[x,y,z]);+ cyl(name+'_Rim',r,r,.1,edge,[x,y+.06,z]);+ cyl(name+'_Lid',r*.86,r*.86,.11,hull,[x,y+.14,z]);+ for(let i=0;i<8;i++){const a=i*Math.PI/4;cyl(name+'_Bolt_'+i,.055,.055,.045,bronze,[x+Math.cos(a)*r*.91,y+.15,z+Math.sin(a)*r*.91]);}+ line(name+'_Handle',[[x-.25,y+.16,z],[x-.25,y+.4,z],[x+.25,y+.4,z],[x+.25,y+.16,z]],.045,edge);+ }+ hatch('Forward_Escape_Hatch',29,0,.97);hatch('Aft_Escape_Hatch',-15,0,.85);+ for(let j=0;j<6;j++){const x=-5-j*2.9;box('Deck_Access_Recess_'+j,[2.2,.055,1.45],seam,[x,11.57,0]);box('Deck_Access_Lid_'+j,[2.08,.06,1.33],panel,[x,11.61,0]);}+ // Telescoping sensor package.+ function mast(name,x,z,h,r){+ cyl(name+'_Boot',r*1.65,r*1.9,.38,hull,[x,21.73,z]);+ cyl(name+'_Brass_Collar',r*1.5,r*1.5,.16,bronze,[x,21.98,z]);+ cyl(name+'_Stem',r,r,h,edge,[x,22+h/2,z]);+ cyl(name+'_Black_Sleeve',r*1.04,r*1.04,h*.31,hull,[x,22+h*.25,z]);+ return 22+h;+ }+ let y=mast('Search_Periscope',17,0,5.3,.16);+ box('Periscope_Head',[.72,.4,.42],hull,[17.16,y,0]);+ box('Periscope_Lens',[.026,.21,.25],glass,[17.535,y,0]);+ y=mast('Optronic_Mast',13.5,.14,4.15,.25);+ cyl('Optronic_Head',.38,.35,.84,hull,[13.5,y+.24,.14]);+ box('Optronic_Lens',[.025,.32,.3],glass,[13.88,y+.25,.14]);+ y=mast('Radar_Mast',10.2,0,2.5,.22);+ box('Radar_Array',[2.3,.4,.54],panel,[10.2,y+.1,0]);+ mast('Radio_Antenna',8.3,0,4.0,.075);+ // Low-profile bridge hatch.+ cyl('Bridge_Hatch_Rim',.65,.65,.11,seam,[18.3,21.69,0]);+ cyl('Bridge_Hatch',.52,.52,.12,panel,[18.3,21.77,0]);+ // Seven curved, skewed bronze propeller blades, on an aft shaft.+ cyl('Propeller_Shaft',.39,.39,3.8,edge,[-55.25,6.2,0],[0,0,90]);+ sphere('Propeller_Hub',[1.75,.77,.77],bronze,[-57,6.2,0]);+ for(let i=0;i<7;i++){+ const blade=loftProfiles([+ {profile:foil(1.1,.23),frame:{origin:[0,.55,0],rotation:[0,20,0]}},+ {profile:foil(2.5,.19),frame:{origin:[-.3,2,0],rotation:[0,36,0]}},+ {profile:foil(2.2,.13),frame:{origin:[-.75,3.4,0],rotation:[0,53,0]}},+ {profile:foil(.55,.07),frame:{origin:[-1.3,4.1,0],rotation:[0,63,0]}}]);+ add('Skewed_Propeller_Blade_'+i,blade,bronze,[-56.9,6.2,0],[i*360/7,0,0]);+ }+ // Bow sonar boundary and conformal flank sensor fairings.+ add('Sonar_Cap_Seam',new THREE.TorusGeometry(radius(43)+.023,.045,3,Q.hullHalf*2),seam,[43,6.2,0],[0,90,0]);+ for(const s of [-1,1]){+ sphere('Flank_Array_'+s,[13,.37,.12],panel,[8,6.6,s*5.47]);+ for(let j=0;j<5;j++)box('Draft_Marking_'+s+'_'+j,[.5,.1,.03],ivory,[38,6+j*.42,s*(radius(38)-.02-j*.015)]);+ // Small forward torpedo shutter outlines.+ for(const offset of [-.65,.65]){+ const pts=[];for(let i=0;i<=32;i++){const a=i*Math.PI/16;const x=45+2.3*Math.cos(a), yy=6.2+offset+.48*Math.sin(a);const zz=s*Math.sqrt(Math.max(.1,radius(x)*radius(x)-(yy-6.2)*(yy-6.2)));pts.push([x,yy,zz+s*.02]);}line('Bow_Shutter_'+s+'_'+offset,pts,.035,seam);+ }+ }+ // Keep only triangles needed for the visible exterior; budget includes every mesh.+ if(Q.batchStatic){+ root.updateMatrixWorld(true);+ const groups=new Map(), original=[];+ root.traverse(m=>{+ if(!m.isMesh)return;+ original.push(m);+ const rotating=/Skewed_Propeller_Blade|Propeller_Hub/.test(m.name);+ const key=(rotating?'Propeller_':'Static_')+m.material.uuid;+ if(!groups.has(key))groups.set(key,{material:m.material,rotating,positions:[],normals:[],uvs:[],indices:[],names:[]});+ const b=groups.get(key),g=m.geometry.clone().applyMatrix4(m.matrixWorld);+ const p=g.getAttribute('position'),n=g.getAttribute('normal'),uv=g.getAttribute('uv'),base=b.positions.length/3;+ for(let i=0;i<p.count;i++){+ b.positions.push(p.getX(i)+(rotating?56.9:0),p.getY(i)-(rotating?6.2:0),p.getZ(i));+ b.normals.push(n.getX(i),n.getY(i),n.getZ(i));+ b.uvs.push(uv?uv.getX(i):0,uv?uv.getY(i):0);+ }+ if(g.index){for(let i=0;i<g.index.count;i++)b.indices.push(base+g.index.getX(i));}+ else{for(let i=0;i<p.count;i++)b.indices.push(base+i);}+ b.names.push(m.name);+ g.dispose();+ });+ original.forEach(m=>m.parent.remove(m));+ let groupIndex=0;+ groups.forEach(b=>{+ const g=new THREE.BufferGeometry();+ g.setAttribute('position',new THREE.Float32BufferAttribute(b.positions,3));+ g.setAttribute('normal',new THREE.Float32BufferAttribute(b.normals,3));+ g.setAttribute('uv',new THREE.Float32BufferAttribute(b.uvs,2));+ g.setIndex(b.indices);+ const m=add(b.rotating?'Propeller_Assembly':'Static_Material_Batch_'+groupIndex++,g,b.material,b.rotating?[-56.9,6.2,0]:[0,0,0]);+ m.userData.sourceParts=b.names;+ });+ }+ let triangles=0;+ root.traverse(m=>{if(m.isMesh)triangles+=(m.geometry.index?m.geometry.index.count:m.geometry.getAttribute('position').count)/3;});+ if(triangles>=Q.triangleLimit)throw new Error('Game triangle budget exceeded: '+triangles);+ return root;+}\ No newline at end of filediff --git a/site/examples/history/demo-unfolding-dragonfly/history.json b/site/examples/history/demo-unfolding-dragonfly/history.jsonnew file mode 100644index 00000000..86029749--- /dev/null+++ b/site/examples/history/demo-unfolding-dragonfly/history.json@@ -0,0 +1,16 @@+{+ "version": 1,+ "brief": {+ "kind": "recorded",+ "text": "Articulated clockwork dragonfly with four folding copper wings, exposed gearbox, glowing core, and 10-segment abdomen."+ },+ "currentSourceHash": "ebb4e45d66b43fdbaad8d90290e005921bcca87a8712638b34ed344d8e70bd48",+ "revisions": [+ {+ "file": "revision-1.kiln.js",+ "title": "Saved revision 1",+ "description": "Articulated clockwork dragonfly with four folding copper wings, exposed gearbox, glowing core, and 10-segment abdomen.",+ "sourceHash": "ebb4e45d66b43fdbaad8d90290e005921bcca87a8712638b34ed344d8e70bd48"+ }+ ]+}diff --git a/site/examples/history/demo-unfolding-dragonfly/revision-1.kiln.js b/site/examples/history/demo-unfolding-dragonfly/revision-1.kiln.jsnew file mode 100644index 00000000..85edd0e5--- /dev/null+++ b/site/examples/history/demo-unfolding-dragonfly/revision-1.kiln.js@@ -0,0 +1,676 @@+const meta = {+ name: 'Mechanical Dragonfly with Unfolding Copper Wings',+ category: 'character',+ role: 'prop'+};++function build() {+ const root = createRoot('MechanicalDragonfly');++ // --- Materials ---+ const matCopper = gameMaterial(0xcd683d, { metalness: 0.88, roughness: 0.28 });+ const matBrightCopper = gameMaterial(0xdf7a4a, { metalness: 0.92, roughness: 0.20 });+ const matBrass = gameMaterial(0xd4af37, { metalness: 0.85, roughness: 0.30 });+ const matGunmetal = gameMaterial(0x282a30, { metalness: 0.80, roughness: 0.42 });+ const matSteel = gameMaterial(0x9ca3af, { metalness: 0.92, roughness: 0.18 });+ const matObsidianEye = gameMaterial(0x161e26, { metalness: 0.82, roughness: 0.12 });+ const matGlowAmber = gameMaterial(0xd9822b, { metalness: 0.35, roughness: 0.25, emissive: 0x8a4510, emissiveIntensity: 0.8 });+ const matPowerCore = gameMaterial(0x38bdf8, { metalness: 0.20, roughness: 0.20, emissive: 0x0284c7, emissiveIntensity: 1.5 });+ const matCopperFoil = gameMaterial(0xc25e36, { metalness: 0.88, roughness: 0.32 });+ const matCopperVane = gameMaterial(0xd86f3e, { metalness: 0.92, roughness: 0.22 });++ // --- 1. Head & Cephalon ---+ const headPos = [0.22, 0.175, 0];+ const headGroup = createPivot('Head_Mount', headPos, root);++ // Skull casing+ createPart('Head_Casing', capsuleGeo(0.028, 0.032, 12), matGunmetal, {+ rotation: [0, 0, 90],+ parent: headGroup+ });+ // Frontal brow plate & cowl+ createPart('Head_Brow', boxGeo(0.032, 0.016, 0.048), matBrass, {+ position: [0.018, 0.008, 0],+ parent: headGroup+ });+ createPart('Head_FacePlate', taperConeGeo(0.024, 0.012, 0.028, 'x', 8), matCopper, {+ position: [0.028, -0.008, 0],+ parent: headGroup+ });++ // Large Compound Eyes (Left & Right)+ for (const s of [1, -1]) {+ const eyeZ = s * 0.034;+ // Main faceted compound eye hemisphere+ createPart(`Eye_${s > 0 ? 'R' : 'L'}`, sphereGeo(0.026, 16, 12), matObsidianEye, {+ position: [0.008, 0.008, eyeZ],+ scale: [1.1, 1.0, 0.85],+ parent: headGroup+ });+ // Brass ocular bezel / retaining collar+ createPart(`EyeBezel_${s > 0 ? 'R' : 'L'}`, torusGeo(0.026, 0.0032, 8, 20), matBrass, {+ position: [0.008, 0.008, eyeZ * 0.88],+ rotation: [0, s * 25, 0],+ parent: headGroup+ });+ // Ocular gear teeth ring+ const eyeGear = gearGeo({ teeth: 18, rootRadius: 0.025, tipRadius: 0.029, boreRadius: 0.022, height: 0.004 });+ createPart(`EyeGear_${s > 0 ? 'R' : 'L'}`, eyeGear, matBrightCopper, {+ position: [0.008, 0.008, eyeZ * 0.82],+ rotation: [90, 0, s * 25],+ parent: headGroup+ });++ // Articulated Antenna+ const antRoot = [0.030, 0.022, s * 0.014];+ beamBetween(`Antenna_Base_${s > 0 ? 'R' : 'L'}`, antRoot, [antRoot[0] + 0.025, antRoot[1] + 0.020, s * 0.024], 0.0018, matBrass, { parent: headGroup });+ beamBetween(`Antenna_Tip_${s > 0 ? 'R' : 'L'}`, [antRoot[0] + 0.025, antRoot[1] + 0.020, s * 0.024], [antRoot[0] + 0.048, antRoot[1] + 0.028, s * 0.030], 0.0012, matCopper, { parent: headGroup });+ createPart(`Antenna_Orb_${s > 0 ? 'R' : 'L'}`, sphereGeo(0.0035, 8, 6), matGlowAmber, {+ position: [antRoot[0] + 0.048, antRoot[1] + 0.028, s * 0.030],+ parent: headGroup+ });++ // Mandibles / Mouthparts+ beamBetween(`Mandible_${s > 0 ? 'R' : 'L'}`, [0.030, -0.020, s * 0.012], [0.044, -0.030, s * 0.004], 0.0025, matSteel, { parent: headGroup });+ createPart(`Mandible_Tip_${s > 0 ? 'R' : 'L'}`, coneGeo(0.003, 0.010, 6), matBrass, {+ position: [0.044, -0.030, s * 0.004],+ rotation: [0, 0, -60],+ parent: headGroup+ });+ }++ // 3 Dorsal Ocelli (sensory eyes)+ createPart('Ocellus_Center', sphereGeo(0.0045, 8, 6), matGlowAmber, {+ position: [0.016, 0.030, 0],+ parent: headGroup+ });+ createPart('Ocellus_R', sphereGeo(0.0035, 8, 6), matGlowAmber, {+ position: [0.010, 0.028, 0.010],+ parent: headGroup+ });+ createPart('Ocellus_L', sphereGeo(0.0035, 8, 6), matGlowAmber, {+ position: [0.010, 0.028, -0.010],+ parent: headGroup+ });++ // Neck Gimbal Collar+ createPart('Neck_Ring', torusGeo(0.022, 0.004, 8, 16), matBrass, {+ position: [0.188, 0.175, 0],+ rotation: [0, 90, 0],+ parent: root+ });+ createPart('Neck_Joint', sphereGeo(0.018, 10, 8), matSteel, {+ position: [0.188, 0.175, 0],+ parent: root+ });++ // --- 2. Thorax (Chassis & Clockwork Engine Room) ---+ const thoraxCenter = [0.05, 0.170, 0];++ // Main Dorsal Carapace Shield+ createPart('Thorax_DorsalCarapace', capsuleGeo(0.040, 0.14, 12), matGunmetal, {+ position: thoraxCenter,+ rotation: [0, 0, 90],+ scale: [1.0, 0.95, 1.1],+ parent: root+ });+ // Copper Spine Crest (Split with open clockwork gearbox bay)+ createPart('Thorax_SpineCrest_Front', boxGeo(0.045, 0.010, 0.012), matBrightCopper, {+ position: [thoraxCenter[0] + 0.055, thoraxCenter[1] + 0.042, 0],+ parent: root+ });+ createPart('Thorax_SpineCrest_Aft', boxGeo(0.040, 0.010, 0.012), matBrightCopper, {+ position: [thoraxCenter[0] - 0.055, thoraxCenter[1] + 0.042, 0],+ parent: root+ });+ // Gearbox bay filigree rim / brass housing+ createPart('Gearbox_Rim', boxGeo(0.065, 0.006, 0.030), matBrass, {+ position: [thoraxCenter[0] + 0.002, thoraxCenter[1] + 0.040, 0],+ parent: root+ });+ // Arched brass protective rib cage over exposed gears+ for (let g = -1; g <= 1; g++) {+ createPart(`Gearbox_Arch_${g}`, torusGeo(0.018, 0.0018, 6, 16), matBrass, {+ position: [thoraxCenter[0] + 0.002 + g * 0.020, thoraxCenter[1] + 0.040, 0],+ rotation: [0, 90, 0],+ parent: root+ });+ }++ // Animated Clockwork Gears inside Thorax (Prominently exposed in central bay)+ // Main Drive Gear (brass)+ const gearPivotMain = createPivot('Gear_Main', [thoraxCenter[0] + 0.018, thoraxCenter[1] + 0.024, 0], root);+ const mainGearMesh = gearGeo({ teeth: 16, rootRadius: 0.026, tipRadius: 0.032, boreRadius: 0.008, height: 0.010 });+ createPart('Gear_Main_Mesh', mainGearMesh, matBrass, {+ rotation: [90, 0, 0],+ parent: gearPivotMain+ });++ // Secondary Reduction Gear (copper, meshing with main gear)+ const gearPivotSec = createPivot('Gear_Sec', [thoraxCenter[0] - 0.020, thoraxCenter[1] + 0.028, 0], root);+ const secGearMesh = gearGeo({ teeth: 10, rootRadius: 0.014, tipRadius: 0.019, boreRadius: 0.005, height: 0.010 });+ createPart('Gear_Sec_Mesh', secGearMesh, matCopper, {+ rotation: [90, 0, 0],+ parent: gearPivotSec+ });++ // Transverse brass drive shafts linking gearbox to wing saddles+ beamBetween('Gear_Shaft_Fore',+ [thoraxCenter[0] + 0.018, thoraxCenter[1] + 0.024, -0.036],+ [thoraxCenter[0] + 0.018, thoraxCenter[1] + 0.024, 0.036],+ 0.003, matSteel, { parent: root });+ beamBetween('Gear_Shaft_Aft',+ [thoraxCenter[0] - 0.020, thoraxCenter[1] + 0.028, -0.034],+ [thoraxCenter[0] - 0.020, thoraxCenter[1] + 0.028, 0.034],+ 0.0025, matSteel, { parent: root });++ // Side Pressure Gauge (Port side)+ createPart('PressureGauge_Body', cylinderGeo(0.012, 0.012, 0.006, 12), matBrass, {+ position: [thoraxCenter[0] + 0.010, thoraxCenter[1] + 0.015, 0.046],+ rotation: [90, 0, 0],+ parent: root+ });+ createPart('PressureGauge_Face', cylinderGeo(0.009, 0.009, 0.007, 12), matGlowAmber, {+ position: [thoraxCenter[0] + 0.010, thoraxCenter[1] + 0.015, 0.047],+ rotation: [90, 0, 0],+ parent: root+ });+ // Starboard Escapement Wheel+ createPart('Escapement_Body', cylinderGeo(0.010, 0.010, 0.006, 10), matBrass, {+ position: [thoraxCenter[0] - 0.015, thoraxCenter[1] + 0.015, -0.046],+ rotation: [90, 0, 0],+ parent: root+ });++ // Twin Steam Exhaust Funnels on Dorsal Carapace+ for (const s of [1, -1]) {+ createPart(`Steam_Funnel_${s > 0 ? 'R' : 'L'}`, cylinderGeo(0.0045, 0.003, 0.022, 10), matBrass, {+ position: [thoraxCenter[0] - 0.045, thoraxCenter[1] + 0.045, s * 0.020],+ rotation: [s * 15, 0, -25],+ parent: root+ });+ createPart(`Steam_Rim_${s > 0 ? 'R' : 'L'}`, torusGeo(0.005, 0.0012, 6, 12), matBrightCopper, {+ position: [thoraxCenter[0] - 0.050, thoraxCenter[1] + 0.054, s * 0.024],+ rotation: [s * 15, 0, -25],+ parent: root+ });+ }++ // Wing Saddle Mounts on Dorsal Carapace+ for (const s of [1, -1]) {+ // Forewing Mount Block+ createPart(`Forewing_Saddle_${s > 0 ? 'R' : 'L'}`, boxGeo(0.022, 0.014, 0.016), matBrass, {+ position: [0.08, 0.210, s * 0.038],+ parent: root+ });+ // Hindwing Mount Block+ createPart(`Hindwing_Saddle_${s > 0 ? 'R' : 'L'}`, boxGeo(0.022, 0.014, 0.016), matBrass, {+ position: [-0.01, 0.205, s * 0.036],+ parent: root+ });+ }++ // --- 3. 10-Segmented Abdomen & Caudal Claspers ---+ const abdomenStart = -0.05;+ const numSegments = 10;+ const segLength = 0.044;+ let curX = abdomenStart;++ for (let seg = 1; seg <= numSegments; seg++) {+ const t = (seg - 1) / (numSegments - 1);+ const rFront = 0.024 * (1 - 0.65 * t);+ const rBack = 0.024 * (1 - 0.65 * (t + 1 / numSegments));+ const centerX = curX - segLength * 0.5;++ // Segment Body Shell+ createPart(`Abdomen_S${seg}_Shell`, taperConeGeo(rBack, rFront, segLength, 'x', 8), matGunmetal, {+ position: [centerX, 0.165 - t * 0.025, 0],+ parent: root+ });++ // Brass Joint Ring between segments+ createPart(`Abdomen_S${seg}_Ring`, torusGeo(rFront * 1.05, 0.0022, 6, 16), matBrass, {+ position: [curX, 0.165 - t * 0.025, 0],+ rotation: [0, 90, 0],+ parent: root+ });++ // Longitudinal Dorsal Spine Conduit+ beamBetween(`Abdomen_S${seg}_Spine`,+ [curX, 0.165 - t * 0.025 + rFront * 1.05, 0],+ [curX - segLength, 0.165 - (t + 1 / numSegments) * 0.025 + rBack * 1.05, 0],+ 0.0020, matBrightCopper, { parent: root });++ // Lateral copper rivet studs+ for (const s of [1, -1]) {+ createPart(`Abdomen_S${seg}_Stud_${s > 0 ? 'R' : 'L'}`, sphereGeo(0.0022, 6, 4), matCopper, {+ position: [centerX, 0.165 - t * 0.025, s * (rFront + rBack) * 0.5],+ parent: root+ });+ }++ curX -= segLength;+ }++ // S10 Tip & Tail Claspers (Cerci)+ const tipX = curX;+ const tipY = 0.140;+ createPart('Caudal_Base', cylinderGeo(0.008, 0.006, 0.016, 8), matBrass, {+ position: [tipX, tipY, 0],+ rotation: [0, 0, 90],+ parent: root+ });+ // Upper dual forceps / claspers+ for (const s of [1, -1]) {+ beamBetween(`Clasper_Upper_${s > 0 ? 'R' : 'L'}`,+ [tipX - 0.008, tipY + 0.003, s * 0.004],+ [tipX - 0.038, tipY + 0.012, s * 0.012],+ 0.0016, matSteel, { parent: root });+ beamBetween(`Clasper_Tip_${s > 0 ? 'R' : 'L'}`,+ [tipX - 0.038, tipY + 0.012, s * 0.012],+ [tipX - 0.052, tipY + 0.008, s * 0.002],+ 0.0012, matBrightCopper, { parent: root });+ }+ // Lower ventral clasper prong+ beamBetween('Clasper_Lower',+ [tipX - 0.008, tipY - 0.004, 0],+ [tipX - 0.040, tipY - 0.010, 0],+ 0.0016, matSteel, { parent: root });++ // --- 4. 6 Articulated Mechanical Legs (Ground Contact at Y = 0) ---+ // Legs: Forelegs, Midlegs, Hindlegs+ const legDefs = [+ { name: 'Foreleg', rootX: 0.12, rootY: 0.13, rootZ: 0.042, knee: [0.17, 0.19, 0.095], ankle: [0.16, 0.05, 0.120], foot: [0.17, 0.0, 0.135] },+ { name: 'Midleg', rootX: 0.04, rootY: 0.12, rootZ: 0.045, knee: [0.04, 0.18, 0.125], ankle: [0.02, 0.05, 0.150], foot: [0.02, 0.0, 0.165] },+ { name: 'Hindleg', rootX: -0.04, rootY: 0.12, rootZ: 0.045, knee: [-0.08, 0.19, 0.135], ankle: [-0.13, 0.06, 0.160], foot: [-0.15, 0.0, 0.175] }+ ];++ for (const def of legDefs) {+ for (const s of [1, -1]) {+ const pRoot = [def.rootX, def.rootY, s * def.rootZ];+ const pKnee = [def.knee[0], def.knee[1], s * def.knee[2]];+ const pAnkle = [def.ankle[0], def.ankle[1], s * def.ankle[2]];+ const pFoot = [def.foot[0], def.foot[1], s * def.foot[2]];+ const prefix = `${def.name}_${s > 0 ? 'R' : 'L'}`;++ // Coxa mounting ball & socket+ createPart(`${prefix}_Coxa`, sphereGeo(0.008, 8, 8), matBrass, {+ position: pRoot,+ parent: root+ });+ // Femur strut (Coxa to Knee)+ beamBetween(`${prefix}_Femur`, pRoot, pKnee, 0.0035, matGunmetal, { parent: root });+ // Copper hydraulic line along femur+ beamBetween(`${prefix}_FemurTube`,+ [pRoot[0], pRoot[1] + 0.004, pRoot[2]],+ [pKnee[0], pKnee[1] + 0.004, pKnee[2]],+ 0.0015, matCopper, { parent: root });++ // Knee hinge disc+ createPart(`${prefix}_KneeDisc`, cylinderGeo(0.007, 0.007, 0.006, 10), matBrass, {+ position: pKnee,+ rotation: [0, 0, 90],+ parent: root+ });++ // Tibia strut (Knee to Ankle) with classic dragonfly spines+ beamBetween(`${prefix}_Tibia`, pKnee, pAnkle, 0.0028, matSteel, { parent: root });++ // 3 Tibial spines+ for (let sp = 1; sp <= 3; sp++) {+ const u = sp / 4;+ const spBase = [+ pKnee[0] + u * (pAnkle[0] - pKnee[0]),+ pKnee[1] + u * (pAnkle[1] - pKnee[1]),+ pKnee[2] + u * (pAnkle[2] - pKnee[2])+ ];+ const spTip = [spBase[0] + 0.003, spBase[1] - 0.006, spBase[2] + s * 0.004];+ beamBetween(`${prefix}_Spine_${sp}`, spBase, spTip, 0.0010, matBrightCopper, { parent: root });+ }++ // Tarsal Joint / Ankle knuckle+ createPart(`${prefix}_Ankle`, sphereGeo(0.0045, 8, 6), matBrass, {+ position: pAnkle,+ parent: root+ });++ // Tarsus / Claws reaching firmly down to Y = 0+ beamBetween(`${prefix}_Tarsus`, pAnkle, pFoot, 0.0022, matSteel, { parent: root });+ // Sharp curved gripping claw touching Y = 0+ createPart(`${prefix}_ClawOuter`, coneGeo(0.0028, 0.010, 6), matBrightCopper, {+ position: [pFoot[0], pFoot[1] + 0.003, pFoot[2]],+ rotation: [s * 20, 0, -45],+ parent: root+ });+ createPart(`${prefix}_ClawInner`, coneGeo(0.0028, 0.010, 6), matBrightCopper, {+ position: [pFoot[0] - 0.004, pFoot[1] + 0.003, pFoot[2] - s * 0.003],+ rotation: [s * 10, 0, -50],+ parent: root+ });+ }+ }++ // --- 5. Unfolding Copper Wings (Forewings & Hindwings) ---+ // Helper to build an intricate folding wing+ function createFoldingWing(wingId, isHind, side, mountPos) {+ const s = side; // +1 = Right (+Z), -1 = Left (-Z)+ const sideKey = s > 0 ? 'R' : 'L';+ const tag = `${wingId}_${sideKey}`;++ // Root Pivot: receives rotation tracks in animation+ const rootPivot = createPivot(`${tag}_Root`, mountPos, root);++ // Root swivel clevis & actuator piston+ createPart(`${tag}_Clevis`, boxGeo(0.014, 0.012, 0.012), matBrass, {+ position: [0, 0, 0],+ parent: rootPivot+ });+ // Miniature hydraulic pushrod pylon+ beamBetween(`${tag}_Actuator`, [-0.010, -0.015, 0], [0, 0, s * 0.015], 0.0025, matSteel, { parent: rootPivot });++ // Inner Wing Dimensions+ const innerSpan = isHind ? 0.14 : 0.16;+ const baseChord = isHind ? 0.070 : 0.052;+ const midChord = isHind ? 0.065 : 0.048;++ // --- Inner Wing Assembly (attached to rootPivot) ---+ // Leading tubular copper spar+ beamBetween(`${tag}_Inner_LeadSpar`, [0, 0, 0], [0, 0, s * innerSpan], 0.0035, matBrightCopper, { parent: rootPivot });+ // Subcostal spar+ beamBetween(`${tag}_Inner_SubSpar`, [-0.012, -0.001, s * 0.015], [-0.010, -0.001, s * innerSpan], 0.0022, matCopper, { parent: rootPivot });++ // Inner venation ribs & braces+ const numInnerRibs = 5;+ for (let r = 1; r <= numInnerRibs; r++) {+ const u = r / numInnerRibs;+ const zPos = s * innerSpan * u;+ const chord = baseChord * (1 - u) + midChord * u;+ // Cross vein from leading spar back to trailing edge+ beamBetween(`${tag}_Inner_Rib_${r}`, [0, 0, zPos], [-chord, -0.001, zPos], 0.0014, matCopper, { parent: rootPivot });+ // Diagonal cross-truss+ if (r > 1) {+ const prevZ = s * innerSpan * ((r - 1) / numInnerRibs);+ beamBetween(`${tag}_Inner_Truss_${r}`, [-0.010, -0.001, prevZ], [-chord * 0.7, -0.001, zPos], 0.0010, matBrass, { parent: rootPivot });+ }+ }+ // Trailing edge copper framing wire+ beamBetween(`${tag}_Inner_TrailWire`, [-baseChord, -0.001, s * 0.010], [-midChord, -0.001, s * innerSpan], 0.0016, matBrightCopper, { parent: rootPivot });++ // Inner Wing Translucent Copper Membrane (meshGeo)+ // Triangle strip from leading edge to trailing edge+ const innerPositions = [];+ const innerIndices = [];+ for (let r = 0; r <= numInnerRibs; r++) {+ const u = r / numInnerRibs;+ const zPos = s * innerSpan * u;+ const chord = baseChord * (1 - u) + midChord * u;+ innerPositions.push(0, 0, zPos); // front vertex+ innerPositions.push(-chord, 0, zPos); // back vertex+ }+ for (let r = 0; r < numInnerRibs; r++) {+ const i0 = r * 2;+ const i1 = r * 2 + 1;+ const i2 = (r + 1) * 2;+ const i3 = (r + 1) * 2 + 1;+ // Two triangles per quad cell (both clockwise and CCW for double-sided visibility)+ innerIndices.push(i0, i1, i2, i2, i1, i3);+ innerIndices.push(i2, i1, i0, i3, i1, i2);+ }+ const innerMembraneGeo = meshGeo({ positions: innerPositions, indices: innerIndices });+ createPart(`${tag}_Inner_Membrane`, innerMembraneGeo, matCopperFoil, {+ position: [0, -0.0005, 0],+ parent: rootPivot+ });++ // Elbow Hinge Joint (Nodus / Folding Elbow Mechanism)+ const elbowPos = [0, 0, s * innerSpan];+ createPart(`${tag}_ElbowKnuckle`, cylinderGeo(0.006, 0.006, 0.008, 12), matBrass, {+ position: elbowPos,+ rotation: [90, 0, 0],+ parent: rootPivot+ });+ // Miniature spur gear linking inner & outer wing+ const elbowGear = gearGeo({ teeth: 12, rootRadius: 0.006, tipRadius: 0.0085, boreRadius: 0.0025, height: 0.004 });+ createPart(`${tag}_ElbowGear`, elbowGear, matBrightCopper, {+ position: [elbowPos[0], elbowPos[1] + 0.003, elbowPos[2]],+ rotation: [0, 0, 90],+ parent: rootPivot+ });++ // --- Mid Pivot: outer wing unfolds from here! ---+ const midPivot = createPivot(`${tag}_Mid`, elbowPos, rootPivot);++ // Outer Wing Dimensions+ const outerSpan = isHind ? 0.16 : 0.18;+ const tipChord = 0.015;++ // Outer leading copper spar+ beamBetween(`${tag}_Outer_LeadSpar`, [0, 0, 0], [-0.006, 0, s * outerSpan], 0.0030, matBrightCopper, { parent: midPivot });+ // Outer subcostal spar+ beamBetween(`${tag}_Outer_SubSpar`, [-0.010, -0.001, 0], [-0.010, -0.001, s * outerSpan * 0.75], 0.0018, matCopper, { parent: midPivot });++ // Outer venation ribs+ const numOuterRibs = 6;+ for (let r = 1; r <= numOuterRibs; r++) {+ const u = r / numOuterRibs;+ const zPos = s * outerSpan * u;+ const chord = midChord * (1 - u) + tipChord * u;+ const frontX = -0.006 * u;+ // Cross rib+ beamBetween(`${tag}_Outer_Rib_${r}`, [frontX, 0, zPos], [frontX - chord, -0.001, zPos], 0.0012, matCopper, { parent: midPivot });+ // Venation diagonals+ if (r > 1) {+ const prevZ = s * outerSpan * ((r - 1) / numOuterRibs);+ const prevFrontX = -0.006 * ((r - 1) / numOuterRibs);+ beamBetween(`${tag}_Outer_Truss_${r}`, [prevFrontX - 0.008, -0.001, prevZ], [frontX - chord * 0.6, -0.001, zPos], 0.0009, matBrass, { parent: midPivot });+ }+ }+ // Trailing edge wire for outer wing+ beamBetween(`${tag}_Outer_TrailWire`, [-midChord, -0.001, 0], [-0.006 - tipChord, -0.001, s * outerSpan], 0.0015, matBrightCopper, { parent: midPivot });++ // Pterostigma (Aerodynamic counterweight plate near wing tip)+ const pteroZ = s * outerSpan * 0.82;+ createPart(`${tag}_Pterostigma`, boxGeo(0.008, 0.0025, 0.024), matBrass, {+ position: [-0.008, 0.001, pteroZ],+ parent: midPivot+ });+ createPart(`${tag}_Pterostigma_Trim`, boxGeo(0.005, 0.0035, 0.018), matBrightCopper, {+ position: [-0.008, 0.001, pteroZ],+ parent: midPivot+ });++ // Outer Wing Translucent Copper Membrane (meshGeo)+ const outerPositions = [];+ const outerIndices = [];+ for (let r = 0; r <= numOuterRibs; r++) {+ const u = r / numOuterRibs;+ const zPos = s * outerSpan * u;+ const chord = midChord * (1 - u) + tipChord * u;+ const frontX = -0.006 * u;+ outerPositions.push(frontX, 0, zPos); // front vertex+ outerPositions.push(frontX - chord, 0, zPos); // back vertex+ }+ for (let r = 0; r < numOuterRibs; r++) {+ const i0 = r * 2;+ const i1 = r * 2 + 1;+ const i2 = (r + 1) * 2;+ const i3 = (r + 1) * 2 + 1;+ outerIndices.push(i0, i1, i2, i2, i1, i3);+ outerIndices.push(i2, i1, i0, i3, i1, i2);+ }+ const outerMembraneGeo = meshGeo({ positions: outerPositions, indices: outerIndices });+ createPart(`${tag}_Outer_Membrane`, outerMembraneGeo, matCopperFoil, {+ position: [0, -0.0005, 0],+ parent: midPivot+ });++ // Wing Tip Filigree Finial+ createPart(`${tag}_TipFinial`, sphereGeo(0.0035, 8, 6), matBrightCopper, {+ position: [-0.006, 0, s * outerSpan],+ parent: midPivot+ });++ // --- Trailing Edge Deployable Copper Fan Vane (Flap) ---+ // Pivots to fan out the rear chord when unfolding+ const flapPivot = createPivot(`${tag}_Flap`, [-baseChord * 0.45, 0, s * 0.02], rootPivot);+ const flapWidth = isHind ? 0.030 : 0.020;+ const flapLength = innerSpan * 0.72;+ // Flat, thin, filigree copper fan blade+ const flapPositions = [+ 0, 0, 0,+ -flapWidth, 0, s * flapLength * 0.35,+ -flapWidth * 0.8, 0, s * flapLength,+ 0, 0, s * flapLength+ ];+ const flapIndices = [+ 0, 1, 2, 0, 2, 3,+ 2, 1, 0, 3, 2, 0+ ];+ const flapGeo = meshGeo({ positions: flapPositions, indices: flapIndices });+ createPart(`${tag}_FlapVane`, flapGeo, matCopperVane, {+ position: [0, -0.0008, 0],+ parent: flapPivot+ });+ beamBetween(`${tag}_FlapRib1`, [0, 0, 0], [-flapWidth, -0.0008, s * flapLength * 0.35], 0.0012, matBrightCopper, { parent: flapPivot });+ beamBetween(`${tag}_FlapRib2`, [0, 0, 0], [-flapWidth * 0.8, -0.0008, s * flapLength], 0.0012, matBrightCopper, { parent: flapPivot });+ }++ // Instantiate the 4 Wings (Forewings and Hindwings, Right and Left)+ createFoldingWing('WingF', false, 1, [0.08, 0.220, 0.038]); // Forewing Right+ createFoldingWing('WingF', false, -1, [0.08, 0.220, -0.038]); // Forewing Left+ createFoldingWing('WingH', true, 1, [-0.01, 0.215, 0.036]); // Hindwing Right+ createFoldingWing('WingH', true, -1, [-0.01, 0.215, -0.036]); // Hindwing Left++ return root;+}++function animate(root) {+ // Total duration: 5.0 seconds for a majestic, slow unfolding sequence+ const tracks = [];++ // 1. Clockwork Gears in Thorax+ tracks.push(rotationTrack('Joint_Gear_Main', [+ { time: 0.0, rotation: [0, 0, 0] },+ { time: 1.0, rotation: [0, 0, 90] },+ { time: 2.5, rotation: [0, 0, 220] },+ { time: 4.0, rotation: [0, 0, 360] },+ { time: 5.0, rotation: [0, 0, 360] }+ ]));++ tracks.push(rotationTrack('Joint_Gear_Sec', [+ { time: 0.0, rotation: [0, 0, 0] },+ { time: 1.0, rotation: [0, 0, -144] },+ { time: 2.5, rotation: [0, 0, -352] },+ { time: 4.0, rotation: [0, 0, -576] },+ { time: 5.0, rotation: [0, 0, -576] }+ ]));++ // 2. Right Forewing+ // Root Pivot: yaw sweeps from folded back (-76 deg) to flight stance (+3 deg)+ tracks.push(rotationTrack('Joint_WingF_R_Root', [+ { time: 0.0, rotation: [-10, -76, 12] },+ { time: 0.8, rotation: [-8, -68, 10] },+ { time: 2.0, rotation: [-4, -35, 6] },+ { time: 3.2, rotation: [-1, -6, 2] },+ { time: 4.2, rotation: [ 0, 3, 1] },+ { time: 4.6, rotation: [ 1, 3, 3] },+ { time: 5.0, rotation: [ 0, 3, 2] }+ ]));+ // Mid Pivot (Elbow): hinges open from folded (+135 deg) to straight (0 deg)+ tracks.push(rotationTrack('Joint_WingF_R_Mid', [+ { time: 0.0, rotation: [0, 135, 0] },+ { time: 1.0, rotation: [0, 125, 0] },+ { time: 2.2, rotation: [0, 70, 0] },+ { time: 3.4, rotation: [0, 18, 0] },+ { time: 4.2, rotation: [0, 0, 0] },+ { time: 5.0, rotation: [0, 0, 0] }+ ]));+ // Trailing Flap: fans open+ tracks.push(rotationTrack('Joint_WingF_R_Flap', [+ { time: 0.0, rotation: [0, 35, 0] },+ { time: 1.5, rotation: [0, 30, 0] },+ { time: 3.0, rotation: [0, 12, 0] },+ { time: 4.2, rotation: [0, 0, 0] },+ { time: 5.0, rotation: [0, 0, 0] }+ ]));++ // 3. Left Forewing (Symmetric)+ tracks.push(rotationTrack('Joint_WingF_L_Root', [+ { time: 0.0, rotation: [-10, 76, -12] },+ { time: 0.8, rotation: [-8, 68, -10] },+ { time: 2.0, rotation: [-4, 35, -6] },+ { time: 3.2, rotation: [-1, 6, -2] },+ { time: 4.2, rotation: [ 0, -3, -1] },+ { time: 4.6, rotation: [ 1, -3, -3] },+ { time: 5.0, rotation: [ 0, -3, -2] }+ ]));+ tracks.push(rotationTrack('Joint_WingF_L_Mid', [+ { time: 0.0, rotation: [0, -135, 0] },+ { time: 1.0, rotation: [0, -125, 0] },+ { time: 2.2, rotation: [0, -70, 0] },+ { time: 3.4, rotation: [0, -18, 0] },+ { time: 4.2, rotation: [0, 0, 0] },+ { time: 5.0, rotation: [0, 0, 0] }+ ]));+ tracks.push(rotationTrack('Joint_WingF_L_Flap', [+ { time: 0.0, rotation: [0, -35, 0] },+ { time: 1.5, rotation: [0, -30, 0] },+ { time: 3.0, rotation: [0, -12, 0] },+ { time: 4.2, rotation: [0, 0, 0] },+ { time: 5.0, rotation: [0, 0, 0] }+ ]));++ // 4. Right Hindwing (Slightly delayed for realistic organic mechanical stagger)+ tracks.push(rotationTrack('Joint_WingH_R_Root', [+ { time: 0.0, rotation: [-8, -78, 10] },+ { time: 1.0, rotation: [-8, -74, 10] },+ { time: 2.3, rotation: [-4, -42, 6] },+ { time: 3.5, rotation: [-1, -12, 2] },+ { time: 4.4, rotation: [ 0, -4, 1] },+ { time: 4.7, rotation: [ 1, -4, 2.5] },+ { time: 5.0, rotation: [ 0, -4, 1.5] }+ ]));+ tracks.push(rotationTrack('Joint_WingH_R_Mid', [+ { time: 0.0, rotation: [0, 130, 0] },+ { time: 1.2, rotation: [0, 120, 0] },+ { time: 2.5, rotation: [0, 65, 0] },+ { time: 3.6, rotation: [0, 15, 0] },+ { time: 4.4, rotation: [0, 0, 0] },+ { time: 5.0, rotation: [0, 0, 0] }+ ]));+ tracks.push(rotationTrack('Joint_WingH_R_Flap', [+ { time: 0.0, rotation: [0, 32, 0] },+ { time: 1.6, rotation: [0, 28, 0] },+ { time: 3.2, rotation: [0, 10, 0] },+ { time: 4.4, rotation: [0, 0, 0] },+ { time: 5.0, rotation: [0, 0, 0] }+ ]));++ // 5. Left Hindwing (Symmetric)+ tracks.push(rotationTrack('Joint_WingH_L_Root', [+ { time: 0.0, rotation: [-8, 78, -10] },+ { time: 1.0, rotation: [-8, 74, -10] },+ { time: 2.3, rotation: [-4, 42, -6] },+ { time: 3.5, rotation: [-1, 12, -2] },+ { time: 4.4, rotation: [ 0, 4, -1] },+ { time: 4.7, rotation: [ 1, 4, -2.5] },+ { time: 5.0, rotation: [ 0, 4, -1.5] }+ ]));+ tracks.push(rotationTrack('Joint_WingH_L_Mid', [+ { time: 0.0, rotation: [0, -130, 0] },+ { time: 1.2, rotation: [0, -120, 0] },+ { time: 2.5, rotation: [0, -65, 0] },+ { time: 3.6, rotation: [0, -15, 0] },+ { time: 4.4, rotation: [0, 0, 0] },+ { time: 5.0, rotation: [0, 0, 0] }+ ]));+ tracks.push(rotationTrack('Joint_WingH_L_Flap', [+ { time: 0.0, rotation: [0, -32, 0] },+ { time: 1.6, rotation: [0, -28, 0] },+ { time: 3.2, rotation: [0, -10, 0] },+ { time: 4.4, rotation: [0, 0, 0] },+ { time: 5.0, rotation: [0, 0, 0] }+ ]));++ return [createClip('Unfold', 5.0, tracks)];+}diff --git a/site/examples/history/demo-vintage-typewriter/history.json b/site/examples/history/demo-vintage-typewriter/history.jsonnew file mode 100644index 00000000..f8855578--- /dev/null+++ b/site/examples/history/demo-vintage-typewriter/history.json@@ -0,0 +1,22 @@+{+ "version": 1,+ "brief": {+ "kind": "recorded",+ "text": "Deep red enamel body, ivory space bar retained"+ },+ "currentSourceHash": "6059425d4eca5dda33c6d958d4208da3eda9684d8e841d54aeee47c5a2794dc3",+ "revisions": [+ {+ "file": "revision-1.kiln.js",+ "title": "Saved revision 1",+ "description": "Vintage typewriter with round ivory keys, brass trim, platen and paper",+ "sourceHash": "e795b716b9227be1f2ee295470d74215400fe66117bf0f768668bafdb1eb97a3"+ },+ {+ "file": "revision-2.kiln.js",+ "title": "Saved revision 2",+ "description": "Deep red enamel body, ivory space bar retained",+ "sourceHash": "6059425d4eca5dda33c6d958d4208da3eda9684d8e841d54aeee47c5a2794dc3"+ }+ ]+}diff --git a/site/examples/history/demo-vintage-typewriter/revision-1.kiln.js b/site/examples/history/demo-vintage-typewriter/revision-1.kiln.jsnew file mode 100644index 00000000..66699232--- /dev/null+++ b/site/examples/history/demo-vintage-typewriter/revision-1.kiln.js@@ -0,0 +1,149 @@+const meta = { name: 'Vintage Typewriter', category: 'prop', role: 'prop' };++async function build() {+ const root = createRoot('VintageTypewriter');++ const iron = gameMaterial(0x1b1b20, { metalness: 0.55, roughness: 0.5 });+ const ironLight = gameMaterial(0x2e2e35, { metalness: 0.6, roughness: 0.45 });+ const brass = gameMaterial(0xc9972f, { metalness: 0.9, roughness: 0.32 });+ const brassDark = gameMaterial(0x8f6a1f, { metalness: 0.85, roughness: 0.45 });+ const ivory = gameMaterial(0xf4ecd8, { metalness: 0.05, roughness: 0.45 });+ const ivoryDim = gameMaterial(0xe8dcc0, { metalness: 0.05, roughness: 0.55 });+ const rubber = gameMaterial(0x111114, { metalness: 0.1, roughness: 0.85 });+ const steel = gameMaterial(0x9aa0a8, { metalness: 0.9, roughness: 0.35 });+ const paperMat = gameMaterial(0xf7f4ea, { metalness: 0.0, roughness: 0.9 });+ const wood = gameMaterial(0x4a2f1c, { metalness: 0.0, roughness: 0.7 });+ const inkBlack = gameMaterial(0x0c0c0e, { metalness: 0.2, roughness: 0.7 });++ // --- Feet + wooden base ---+ const footGeo = cylinderGeo(0.018, 0.022, 0.02, 12);+ const footPos = [[0.15, 0.01, 0.16], [0.15, 0.01, -0.16], [-0.15, 0.01, 0.16], [-0.15, 0.01, -0.16]];+ for (let i = 0; i < 4; i++) {+ createPart('Foot' + i, footGeo, rubber, { position: footPos[i], parent: root });+ }+ const baseBoard = await roundedBoxGeo(0.38, 0.035, 0.42, 0.01, { style: 'round' });+ createPart('BaseBoard', baseBoard, wood, { position: [0, 0.037, 0], parent: root });+ const baseTrim = await roundedBoxGeo(0.385, 0.012, 0.425, 0.005, { style: 'chamfer' });+ createPart('BaseTrim', baseTrim, brassDark, { position: [0, 0.058, 0], parent: root });++ // --- Lower body ---+ const lowerBody = await roundedBoxGeo(0.30, 0.10, 0.34, 0.02, { style: 'round' });+ createPart('LowerBody', lowerBody, iron, { position: [0.02, 0.115, 0], parent: root });++ // Front brass maker plate+ const frontPlate = await roundedBoxGeo(0.01, 0.03, 0.20, 0.004, { style: 'chamfer' });+ createPart('FrontPlate', frontPlate, brass, { position: [0.172, 0.10, 0], parent: root });++ // Sloped top housing (rear of keys)+ const topHousing = await roundedBoxGeo(0.16, 0.07, 0.32, 0.02, { style: 'round' });+ createPart('TopHousing', topHousing, iron, { position: [-0.04, 0.185, 0], rotation: [0, 0, -8], parent: root });++ // Ribbon cover strip+ const ribbonCover = await roundedBoxGeo(0.06, 0.02, 0.28, 0.008, { style: 'round' });+ createPart('RibbonCover', ribbonCover, ironLight, { position: [-0.03, 0.225, 0], parent: root });++ // --- Ribbon spools ---+ const spoolGeo = cylinderGeo(0.028, 0.028, 0.014, 20);+ const spoolHubGeo = cylinderGeo(0.008, 0.008, 0.022, 12);+ const spoolZ = [0.085, -0.085];+ for (let i = 0; i < 2; i++) {+ createPart('Spool' + i, spoolGeo, inkBlack, { position: [-0.03, 0.242, spoolZ[i]], parent: root });+ createPart('SpoolHub' + i, spoolHubGeo, brass, { position: [-0.03, 0.245, spoolZ[i]], parent: root });+ }++ // --- Type-bar basket (fan of levers converging to center) ---+ for (let i = -5; i <= 5; i++) {+ const t = i / 5;+ const sx = 0.0 + Math.abs(t) * 0.01;+ const sz = t * 0.11;+ const ex = -0.075;+ const ez = t * 0.02;+ beamBetween('TypeBar' + (i + 5), [sx, 0.21, sz], [ex, 0.245, ez], 0.0022, steel, { parent: root });+ }+ // Center guide+ const guideGeo = boxGeo(0.02, 0.03, 0.02);+ createPart('TypeGuide', guideGeo, brassDark, { position: [-0.075, 0.25, 0], parent: root });++ // --- Round ivory keys ---+ const brassRingGeo = cylinderGeo(0.0165, 0.0175, 0.010, 20);+ const ivoryTopGeo = cylinderGeo(0.0135, 0.0145, 0.009, 20);+ const keyStemGeo = cylinderGeo(0.0035, 0.0035, 0.035, 8);++ let keyIndex = 0;+ function makeKey(px, py, pz, ivoryMat) {+ const id = keyIndex++;+ createPart('KeyStem' + id, keyStemGeo, steel, { position: [px, py - 0.02, pz], rotation: [0, 0, -18], parent: root });+ createPart('KeyRing' + id, brassRingGeo, brass, { position: [px, py, pz], rotation: [0, 0, -18], parent: root });+ createPart('KeyTop' + id, ivoryTopGeo, ivoryMat, { position: [px + 0.003, py + 0.007, pz], rotation: [0, 0, -18], parent: root });+ }++ const rows = [+ { x: 0.125, y: 0.180, n: 10, w: 0.29 },+ { x: 0.09, y: 0.196, n: 9, w: 0.265 },+ { x: 0.055, y: 0.212, n: 9, w: 0.265 },+ { x: 0.02, y: 0.228, n: 8, w: 0.24 },+ ];+ for (let r = 0; r < rows.length; r++) {+ const row = rows[r];+ for (let k = 0; k < row.n; k++) {+ const z = row.n === 1 ? 0 : -row.w / 2 + (row.w * k) / (row.n - 1);+ const mat = (r + k) % 7 === 3 ? ivoryDim : ivory;+ makeKey(row.x, row.y, z, mat);+ }+ }++ // Space bar - long ivory bar in front+ const spaceBar = await roundedBoxGeo(0.025, 0.012, 0.16, 0.005, { style: 'round' });+ createPart('SpaceBar', spaceBar, ivory, { position: [0.155, 0.172, 0], rotation: [0, 0, -12], parent: root });+ const spaceTrim = await roundedBoxGeo(0.028, 0.005, 0.165, 0.002, { style: 'chamfer' });+ createPart('SpaceTrim', spaceTrim, brass, { position: [0.153, 0.165, 0], rotation: [0, 0, -12], parent: root });++ // --- Carriage: side frames ---+ const sideGeo = boxGeo(0.09, 0.07, 0.015);+ createPart('CarriageSideR', sideGeo, iron, { position: [-0.10, 0.235, 0.185], parent: root });+ createPart('CarriageSideL', sideGeo, iron, { position: [-0.10, 0.235, -0.185], parent: root });+ // Brass side caps+ const sideCapGeo = cylinderZGeo(0.012, 0.012, 0.018, 12);+ createPart('SideCapR', sideCapGeo, brass, { position: [-0.10, 0.25, 0.195], parent: root });+ createPart('SideCapL', sideCapGeo, brass, { position: [-0.10, 0.25, -0.195], parent: root });++ // Carriage rail (steel bar in front of platen)+ const railGeo = cylinderZGeo(0.008, 0.008, 0.40, 12);+ createPart('CarriageRail', railGeo, steel, { position: [-0.055, 0.235, 0], parent: root });++ // --- Platen (paper roller) ---+ const platenGeo = cylinderZGeo(0.028, 0.028, 0.37, 24);+ createPart('Platen', platenGeo, rubber, { position: [-0.115, 0.275, 0], parent: root });+ const axleGeo = cylinderZGeo(0.006, 0.006, 0.44, 10);+ createPart('PlatenAxle', axleGeo, steel, { position: [-0.115, 0.275, 0], parent: root });++ // Brass platen knobs+ const knobGeo = cylinderZGeo(0.020, 0.020, 0.022, 16);+ const knobCapGeo = sphereGeo(0.012, 12, 8);+ createPart('KnobR', knobGeo, brass, { position: [-0.115, 0.275, 0.205], parent: root });+ createPart('KnobL', knobGeo, brass, { position: [-0.115, 0.275, -0.205], parent: root });+ createPart('KnobCapR', knobCapGeo, brassDark, { position: [-0.115, 0.275, 0.219], parent: root });+ createPart('KnobCapL', knobCapGeo, brassDark, { position: [-0.115, 0.275, -0.219], parent: root });++ // Paper bail bar + rollers+ const bailGeo = cylinderZGeo(0.004, 0.004, 0.34, 8);+ createPart('PaperBail', bailGeo, steel, { position: [-0.095, 0.29, 0], parent: root });+ const bailRollerGeo = cylinderZGeo(0.007, 0.007, 0.02, 10);+ createPart('BailRoller1', bailRollerGeo, rubber, { position: [-0.095, 0.29, 0.08], parent: root });+ createPart('BailRoller2', bailRollerGeo, rubber, { position: [-0.095, 0.29, -0.08], parent: root });++ // --- Paper sheet ---+ const paperGeo = boxGeo(0.004, 0.24, 0.24);+ createPart('Paper', paperGeo, paperMat, { position: [-0.135, 0.38, 0], rotation: [0, 0, 8], parent: root });++ // --- Return lever (brass, left side) ---+ beamBetween('ReturnArm', [-0.115, 0.28, -0.20], [-0.05, 0.33, -0.24], 0.006, brass, { parent: root });+ const leverHandleGeo = sphereGeo(0.013, 12, 8);+ createPart('ReturnHandle', leverHandleGeo, wood, { position: [-0.05, 0.33, -0.24], parent: root });++ // Paper guide+ const guidePlate = boxGeo(0.002, 0.06, 0.26);+ createPart('PaperGuide', guidePlate, steel, { position: [-0.098, 0.295, 0], rotation: [0, 0, 10], parent: root });++ return root;+}diff --git a/site/examples/history/demo-vintage-typewriter/revision-2.kiln.js b/site/examples/history/demo-vintage-typewriter/revision-2.kiln.jsnew file mode 100644index 00000000..5d6539d3--- /dev/null+++ b/site/examples/history/demo-vintage-typewriter/revision-2.kiln.js@@ -0,0 +1,149 @@+const meta = { name: 'Vintage Typewriter', category: 'prop', role: 'prop' };++async function build() {+ const root = createRoot('VintageTypewriter');++ const iron = gameMaterial(0x7c1d1d, { metalness: 0.35, roughness: 0.42 });+ const ironLight = gameMaterial(0x932222, { metalness: 0.35, roughness: 0.38 });+ const brass = gameMaterial(0xc9972f, { metalness: 0.9, roughness: 0.32 });+ const brassDark = gameMaterial(0x8f6a1f, { metalness: 0.85, roughness: 0.45 });+ const ivory = gameMaterial(0xf4ecd8, { metalness: 0.05, roughness: 0.45 });+ const ivoryDim = gameMaterial(0xe8dcc0, { metalness: 0.05, roughness: 0.55 });+ const rubber = gameMaterial(0x111114, { metalness: 0.1, roughness: 0.85 });+ const steel = gameMaterial(0x9aa0a8, { metalness: 0.9, roughness: 0.35 });+ const paperMat = gameMaterial(0xf7f4ea, { metalness: 0.0, roughness: 0.9 });+ const wood = gameMaterial(0x4a2f1c, { metalness: 0.0, roughness: 0.7 });+ const inkBlack = gameMaterial(0x0c0c0e, { metalness: 0.2, roughness: 0.7 });++ // --- Feet + wooden base ---+ const footGeo = cylinderGeo(0.018, 0.022, 0.02, 12);+ const footPos = [[0.15, 0.01, 0.16], [0.15, 0.01, -0.16], [-0.15, 0.01, 0.16], [-0.15, 0.01, -0.16]];+ for (let i = 0; i < 4; i++) {+ createPart('Foot' + i, footGeo, rubber, { position: footPos[i], parent: root });+ }+ const baseBoard = await roundedBoxGeo(0.38, 0.035, 0.42, 0.01, { style: 'round' });+ createPart('BaseBoard', baseBoard, wood, { position: [0, 0.037, 0], parent: root });+ const baseTrim = await roundedBoxGeo(0.385, 0.012, 0.425, 0.005, { style: 'chamfer' });+ createPart('BaseTrim', baseTrim, brassDark, { position: [0, 0.058, 0], parent: root });++ // --- Lower body ---+ const lowerBody = await roundedBoxGeo(0.30, 0.10, 0.34, 0.02, { style: 'round' });+ createPart('LowerBody', lowerBody, iron, { position: [0.02, 0.115, 0], parent: root });++ // Front brass maker plate+ const frontPlate = await roundedBoxGeo(0.01, 0.03, 0.20, 0.004, { style: 'chamfer' });+ createPart('FrontPlate', frontPlate, brass, { position: [0.172, 0.10, 0], parent: root });++ // Sloped top housing (rear of keys)+ const topHousing = await roundedBoxGeo(0.16, 0.07, 0.32, 0.02, { style: 'round' });+ createPart('TopHousing', topHousing, iron, { position: [-0.04, 0.185, 0], rotation: [0, 0, -8], parent: root });++ // Ribbon cover strip+ const ribbonCover = await roundedBoxGeo(0.06, 0.02, 0.28, 0.008, { style: 'round' });+ createPart('RibbonCover', ribbonCover, ironLight, { position: [-0.03, 0.225, 0], parent: root });++ // --- Ribbon spools ---+ const spoolGeo = cylinderGeo(0.028, 0.028, 0.014, 20);+ const spoolHubGeo = cylinderGeo(0.008, 0.008, 0.022, 12);+ const spoolZ = [0.085, -0.085];+ for (let i = 0; i < 2; i++) {+ createPart('Spool' + i, spoolGeo, inkBlack, { position: [-0.03, 0.242, spoolZ[i]], parent: root });+ createPart('SpoolHub' + i, spoolHubGeo, brass, { position: [-0.03, 0.245, spoolZ[i]], parent: root });+ }++ // --- Type-bar basket (fan of levers converging to center) ---+ for (let i = -5; i <= 5; i++) {+ const t = i / 5;+ const sx = 0.0 + Math.abs(t) * 0.01;+ const sz = t * 0.11;+ const ex = -0.075;+ const ez = t * 0.02;+ beamBetween('TypeBar' + (i + 5), [sx, 0.21, sz], [ex, 0.245, ez], 0.0022, steel, { parent: root });+ }+ // Center guide+ const guideGeo = boxGeo(0.02, 0.03, 0.02);+ createPart('TypeGuide', guideGeo, brassDark, { position: [-0.075, 0.25, 0], parent: root });++ // --- Round ivory keys ---+ const brassRingGeo = cylinderGeo(0.0165, 0.0175, 0.010, 20);+ const ivoryTopGeo = cylinderGeo(0.0135, 0.0145, 0.009, 20);+ const keyStemGeo = cylinderGeo(0.0035, 0.0035, 0.035, 8);++ let keyIndex = 0;+ function makeKey(px, py, pz, ivoryMat) {+ const id = keyIndex++;+ createPart('KeyStem' + id, keyStemGeo, steel, { position: [px, py - 0.02, pz], rotation: [0, 0, -18], parent: root });+ createPart('KeyRing' + id, brassRingGeo, brass, { position: [px, py, pz], rotation: [0, 0, -18], parent: root });+ createPart('KeyTop' + id, ivoryTopGeo, ivoryMat, { position: [px + 0.003, py + 0.007, pz], rotation: [0, 0, -18], parent: root });+ }++ const rows = [+ { x: 0.125, y: 0.180, n: 10, w: 0.29 },+ { x: 0.09, y: 0.196, n: 9, w: 0.265 },+ { x: 0.055, y: 0.212, n: 9, w: 0.265 },+ { x: 0.02, y: 0.228, n: 8, w: 0.24 },+ ];+ for (let r = 0; r < rows.length; r++) {+ const row = rows[r];+ for (let k = 0; k < row.n; k++) {+ const z = row.n === 1 ? 0 : -row.w / 2 + (row.w * k) / (row.n - 1);+ const mat = (r + k) % 7 === 3 ? ivoryDim : ivory;+ makeKey(row.x, row.y, z, mat);+ }+ }++ // Space bar - long ivory bar in front+ const spaceBar = await roundedBoxGeo(0.025, 0.012, 0.16, 0.005, { style: 'round' });+ createPart('SpaceBar', spaceBar, ivory, { position: [0.155, 0.172, 0], rotation: [0, 0, -12], parent: root });+ const spaceTrim = await roundedBoxGeo(0.028, 0.005, 0.165, 0.002, { style: 'chamfer' });+ createPart('SpaceTrim', spaceTrim, brass, { position: [0.153, 0.165, 0], rotation: [0, 0, -12], parent: root });++ // --- Carriage: side frames ---+ const sideGeo = boxGeo(0.09, 0.07, 0.015);+ createPart('CarriageSideR', sideGeo, iron, { position: [-0.10, 0.235, 0.185], parent: root });+ createPart('CarriageSideL', sideGeo, iron, { position: [-0.10, 0.235, -0.185], parent: root });+ // Brass side caps+ const sideCapGeo = cylinderZGeo(0.012, 0.012, 0.018, 12);+ createPart('SideCapR', sideCapGeo, brass, { position: [-0.10, 0.25, 0.195], parent: root });+ createPart('SideCapL', sideCapGeo, brass, { position: [-0.10, 0.25, -0.195], parent: root });++ // Carriage rail (steel bar in front of platen)+ const railGeo = cylinderZGeo(0.008, 0.008, 0.40, 12);+ createPart('CarriageRail', railGeo, steel, { position: [-0.055, 0.235, 0], parent: root });++ // --- Platen (paper roller) ---+ const platenGeo = cylinderZGeo(0.028, 0.028, 0.37, 24);+ createPart('Platen', platenGeo, rubber, { position: [-0.115, 0.275, 0], parent: root });+ const axleGeo = cylinderZGeo(0.006, 0.006, 0.44, 10);+ createPart('PlatenAxle', axleGeo, steel, { position: [-0.115, 0.275, 0], parent: root });++ // Brass platen knobs+ const knobGeo = cylinderZGeo(0.020, 0.020, 0.022, 16);+ const knobCapGeo = sphereGeo(0.012, 12, 8);+ createPart('KnobR', knobGeo, brass, { position: [-0.115, 0.275, 0.205], parent: root });+ createPart('KnobL', knobGeo, brass, { position: [-0.115, 0.275, -0.205], parent: root });+ createPart('KnobCapR', knobCapGeo, brassDark, { position: [-0.115, 0.275, 0.219], parent: root });+ createPart('KnobCapL', knobCapGeo, brassDark, { position: [-0.115, 0.275, -0.219], parent: root });++ // Paper bail bar + rollers+ const bailGeo = cylinderZGeo(0.004, 0.004, 0.34, 8);+ createPart('PaperBail', bailGeo, steel, { position: [-0.095, 0.29, 0], parent: root });+ const bailRollerGeo = cylinderZGeo(0.007, 0.007, 0.02, 10);+ createPart('BailRoller1', bailRollerGeo, rubber, { position: [-0.095, 0.29, 0.08], parent: root });+ createPart('BailRoller2', bailRollerGeo, rubber, { position: [-0.095, 0.29, -0.08], parent: root });++ // --- Paper sheet ---+ const paperGeo = boxGeo(0.004, 0.24, 0.24);+ createPart('Paper', paperGeo, paperMat, { position: [-0.135, 0.38, 0], rotation: [0, 0, 8], parent: root });++ // --- Return lever (brass, left side) ---+ beamBetween('ReturnArm', [-0.115, 0.28, -0.20], [-0.05, 0.33, -0.24], 0.006, brass, { parent: root });+ const leverHandleGeo = sphereGeo(0.013, 12, 8);+ createPart('ReturnHandle', leverHandleGeo, wood, { position: [-0.05, 0.33, -0.24], parent: root });++ // Paper guide+ const guidePlate = boxGeo(0.002, 0.06, 0.26);+ createPart('PaperGuide', guidePlate, steel, { position: [-0.098, 0.295, 0], rotation: [0, 0, 10], parent: root });++ return root;+}diff --git a/site/scripts/build-assets.mjs b/site/scripts/build-assets.mjsindex 68da66ab..349db2e1 100644--- a/site/scripts/build-assets.mjs+++ b/site/scripts/build-assets.mjs@@ -1,5 +1,5 @@// Build GLBs, exact source copies and attribution records for the static site.-import { mkdir, readFile, readdir, rm, writeFile } from 'node:fs/promises';+import { cp, mkdir, readFile, readdir, rm, writeFile } from 'node:fs/promises';import { basename, dirname, join, resolve } from 'node:path';import { fileURLToPath } from 'node:url';@@ -163,6 +163,9 @@ console.log(await buildEditDemo(REPO, OUT);await buildGeometryDemo(REPO, OUT);+try {+ await cp(join(REPO, 'assets', 'video'), join(OUT, 'video'), { recursive: true });+} catch {}const finalInputs = await runtimeBuildIdentity(REPO);if (buildInputs.identity !== finalInputs.identity)throw new Error('Engine source changed during the site asset build. Rebuild from a stable tree.');diff --git a/site/scripts/collection.mjs b/site/scripts/collection.mjsindex c0598ae8..656911c8 100644--- a/site/scripts/collection.mjs+++ b/site/scripts/collection.mjs@@ -1,5 +1,5 @@// Repository source history is broader than the published gallery collection.-const excluded = new Set(['crate', 'well', 'tidal-observatory', 'fire-lookout-tower', 'brass-tellurion', 'victorian-greenhouse', 'demo-unfolding-dragonfly']);+const excluded = new Set(['crate', 'well', 'tidal-observatory', 'fire-lookout-tower', 'brass-tellurion', 'victorian-greenhouse']);export function isPublicExample(name) {return !excluded.has(name);}diff --git a/site/src/Gallery.tsx b/site/src/Gallery.tsxindex 364a3028..8e7a83f0 100644--- a/site/src/Gallery.tsx+++ b/site/src/Gallery.tsx@@ -4,13 +4,33 @@ import { REPO, asset } from './repo';import type { Specimen } from './types';const CURATED = [- 'orbital-station',- 'abyssal-surveyor',- 'kestrel-rescue-craft',+ 'typewriter','solar-sail-courier','mechanical-peacock',+ 'kestrel-rescue-craft',+ 'anglerfish',+ 'kinetic-wave','orrery',- 'typewriter',+ 'orbital-station',+ 'deco-radio',+ 'cathedral',+ 'steam-locomotive',+ 'lighthouse',+ 'alpine-cable-terminal',+ 'research-vessel',+ 'sushi-store',+ 'windmill',+ 'tram',+ 'ribbon-tea-pavilion',+ 'demo-diesel-locomotive',+ 'demo-art-deco-conservatory',+ 'demo-floating-observatory',+ 'demo-deep-sea-station',+ 'demo-unfolding-dragonfly',+ 'demo-vintage-typewriter',+ 'demo-argent-aircraft-carrier',+ 'demo-noctilus-nuclear-submarine',+ 'demo-resolute-polar-fleet-flagship',];const rank = (name: string) => (CURATED.includes(name) ? CURATED.indexOf(name) : CURATED.length);diff --git a/site/src/Home.tsx b/site/src/Home.tsxindex 22ab3085..5cace8b0 100644--- a/site/src/Home.tsx+++ b/site/src/Home.tsx@@ -43,16 +43,33 @@ export function Home({ specimens }: { specimens: Specimen[] }) {const [geometryTab, setGeometryTab] = useState('surface');const hero = specimens.find((s) => s.name === 'orbital-station');const featured = [- 'abyssal-surveyor',- 'kestrel-rescue-craft',+ 'typewriter','solar-sail-courier','mechanical-peacock',+ 'kestrel-rescue-craft',+ 'anglerfish',+ 'kinetic-wave','orrery',- 'typewriter',- 'nautilus-habitat',+ 'orbital-station',+ 'deco-radio',+ 'cathedral',+ 'steam-locomotive',+ 'lighthouse',+ 'alpine-cable-terminal',+ 'research-vessel',+ 'sushi-store',+ 'windmill',+ 'tram','ribbon-tea-pavilion',- 'polar-rover',- 'kinetic-wave',+ 'demo-diesel-locomotive',+ 'demo-art-deco-conservatory',+ 'demo-floating-observatory',+ 'demo-deep-sea-station',+ 'demo-unfolding-dragonfly',+ 'demo-vintage-typewriter',+ 'demo-argent-aircraft-carrier',+ 'demo-noctilus-nuclear-submarine',+ 'demo-resolute-polar-fleet-flagship',].flatMap((name) => specimens.find((s) => s.name === name) ?? []);return (<main className="doc home">@@ -109,12 +126,13 @@ export function Home({ specimens }: { specimens: Specimen[] }) {</div><a href="#/gallery">Browse all {specimens.length} examples →</a></div>- <div className="featured-assets editorial-grid">+ <div className="featured-assets compact-grid">{featured.map((s, index) => (<a- className={`featured-asset ${index === 0 ? 'feature-lead' : index === 1 ? 'feature-wide' : 'feature-compact'}`}+ className="featured-asset compact-card"key={s.name}href={`#/${s.name}`}+ title={`${s.name.replaceAll('-', ' ')} — ${s.model} (${s.harness})`}><div className="feature-image"><img@@ -124,11 +142,12 @@ export function Home({ specimens }: { specimens: Specimen[] }) {/></div><div className="feature-copy">- <span className="feature-number" aria-hidden="true">- {String(index + 1).padStart(2, '0')}- </span>- <h3 className="feature-title">{s.name.replaceAll('-', ' ')}</h3>- <p className="feature-caption">{s.caption}</p>+ <div className="feature-header">+ <span className="feature-number" aria-hidden="true">+ {String(index + 1).padStart(2, '0')}+ </span>+ <h3 className="feature-title">{s.name.replaceAll('-', ' ')}</h3>+ </div><small className="feature-credit">{s.model} · {s.harness}</small>diff --git a/site/src/styles.css b/site/src/styles.cssindex 19e6aab2..b649ba12 100644--- a/site/src/styles.css+++ b/site/src/styles.css@@ -957,12 +957,90 @@ button {.capability-strip { display:flex; justify-content:space-between; flex-wrap:wrap; gap:16px; padding:22px 0; border-bottom:1px solid var(--rule); font:11px var(--mono); color:var(--dim); }.doc .band { padding:64px 0; }.band h2 { font-size:clamp(28px,4vw,42px); line-height:1.15; font-weight:500; letter-spacing:-.035em; }-.featured-assets { gap:16px; }-.featured-asset { background:#141719; border-color:#2c3031; }-.featured-asset img { aspect-ratio:1.2; transition:transform .25s; }-.featured-asset:hover img { transform:scale(1.035); }-.featured-asset small { min-height:32px; }-.featured-asset span { font-size:18px; }+.featured-assets.compact-grid {+ display: grid;+ grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));+ gap: 12px;+ margin-bottom: 24px;+}+@media (min-width: 1200px) {+ .featured-assets.compact-grid {+ grid-template-columns: repeat(9, 1fr);+ gap: 10px;+ }+}+.featured-assets.compact-grid .featured-asset {+ display: flex;+ flex-direction: column;+ background: var(--stage);+ border: 1px solid var(--rule);+ border-radius: 4px;+ overflow: hidden;+ text-decoration: none;+ padding-bottom: 8px;+ transition: transform 0.2s, border-color 0.2s;+}+.featured-assets.compact-grid .featured-asset:hover {+ border-color: var(--flame);+ transform: translateY(-2px);+}+.featured-assets.compact-grid .feature-image {+ width: 100%;+ aspect-ratio: 1;+ background: #111;+ overflow: hidden;+ display: flex;+ align-items: center;+ justify-content: center;+}+.featured-assets.compact-grid .feature-image img {+ width: 100%;+ height: 100%;+ aspect-ratio: 1;+ object-fit: cover;+ transition: transform 0.25s;+}+.featured-assets.compact-grid .featured-asset:hover .feature-image img {+ transform: scale(1.06);+}+.featured-assets.compact-grid .feature-copy {+ padding: 6px 8px 2px;+ display: flex;+ flex-direction: column;+ gap: 2px;+}+.featured-assets.compact-grid .feature-header {+ display: flex;+ align-items: baseline;+ gap: 5px;+ overflow: hidden;+}+.featured-assets.compact-grid .feature-number {+ font: 10px var(--mono);+ color: var(--flame);+ flex-shrink: 0;+ padding: 0;+}+.featured-assets.compact-grid .feature-title {+ margin: 0;+ font-size: 12px;+ font-weight: 500;+ line-height: 1.3;+ color: var(--ink);+ white-space: nowrap;+ overflow: hidden;+ text-overflow: ellipsis;+ text-transform: capitalize;+}+.featured-assets.compact-grid .feature-credit {+ font-size: 9.5px;+ color: var(--dim);+ white-space: nowrap;+ overflow: hidden;+ text-overflow: ellipsis;+ padding: 0;+ min-height: 0;+}.fit-section { display:grid; grid-template-columns:1fr 1fr; gap:50px; }.tab[aria-pressed="true"] { color:var(--ink); border-color:var(--flame); background:#39291d; }.provenance { pointer-events:auto; color:var(--dim); font-size:11px; max-width:44ch; min-width:0; overflow-wrap:anywhere; }diff --git a/src/__tests__/examples.test.ts b/src/__tests__/examples.test.tsindex b233171e..c552c858 100644--- a/src/__tests__/examples.test.ts+++ b/src/__tests__/examples.test.ts@@ -104,6 +104,40 @@ const documentedAdvisories: Record<string, string[]> = {...Array.from({ length: 12 }, (_, i) => `Mesh_StructuralRib_${i + 1}: ${sweepAdvisory}`),`Mesh_CentralSpine: ${sweepAdvisory}`,],+ 'demo-argent-aircraft-carrier': [+ 'Mesh_SculptedHull',+ 'Mesh_RedLowerHull',+ 'Mesh_FlightDeckRim',+ 'Mesh_FlightDeck',+ ...Array.from({ length: 7 }, (_, i) => `Mesh_DeckBracket_-1_${i}`),+ ...Array.from({ length: 7 }, (_, i) => `Mesh_DeckBracket_1_${i}`),+ 'Mesh_IslandFoundation',+ 'Mesh_IslandMainTower',+ 'Mesh_IslandOrangeRecognitionBand',+ 'Mesh_NavigationBridge',+ 'Mesh_BridgeRoof',+ ...Array.from({ length: 4 }, () => [+ 'Mesh_AerodynamicFuselage',+ 'Mesh_SweptWing-1',+ 'Mesh_Tailplane-1',+ 'Mesh_SweptWing1',+ 'Mesh_Tailplane1',+ ]).flat(),+ ].map((name) => `${name}: ${loftAdvisory}`),+ 'demo-floating-observatory': [+ 'Floating parts (no mesh overlap with any sibling, 2cm tol): Mesh_WaterfallSprayDroplet_3 — Fix: shift "Mesh_WaterfallSprayDroplet_3" by [0.000, 0.000, -0.024] toward "Mesh_ContinuousWaterCurtain", or call snapTo(part, hostPart) to do it automatically. | Mesh_WaterfallSprayDroplet_5 — Fix: shift "Mesh_WaterfallSprayDroplet_5" by [0.000, 0.000, -0.026] toward "Mesh_ContinuousWaterCurtain", or call snapTo(part, hostPart) to do it automatically. | Mesh_WaterfallSprayDroplet_9 — Fix: shift "Mesh_WaterfallSprayDroplet_9" by [0.000, 0.000, -0.046] toward "Mesh_ContinuousWaterCurtain", or call snapTo(part, hostPart) to do it automatically. | Mesh_WaterfallSprayDroplet_11 — Fix: shift "Mesh_WaterfallSprayDroplet_11" by [0.000, 0.000, -0.059] toward "Mesh_ContinuousWaterCurtain", or call snapTo(part, hostPart) to do it automatically.',+ ],+ 'demo-noctilus-nuclear-submarine': [+ ...[+ 'Streamlined_Sail',+ 'Sail_Crown',+ 'Port_Bow_Diving_Plane',+ 'Starboard_Bow_Diving_Plane',+ ].map((n) => `Mesh_${n}: ${loftAdvisory}`),+ ...Array.from({ length: 4 }, (_, i) => `Mesh_Cruciform_Stern_Plane_${i}: ${loftAdvisory}`),+ ...Array.from({ length: 7 }, (_, i) => `Mesh_Swept_Brass_Blade_${i}: ${loftAdvisory}`),+ ],+ 'demo-ocean-salvage-tug': [...['Hull', 'BootStripe'].map((n) => `Mesh_${n}: ${loftAdvisory}`)],};describe('examples', () => {@@ -158,9 +192,10 @@ describe('hero gallery', () => {'fire-lookout-tower','brass-tellurion','victorian-greenhouse',- 'demo-unfolding-dragonfly',];- const publicNames = names.filter((name) => !excluded.includes(name));+ const publicNames = names.filter(+ (name) => !excluded.includes(name) && !name.startsWith('demo-'),+ );expect([...(await heroes)].sort()).toEqual(publicNames);const count = /public gallery contains (\d+) selected examples/.exec(await readme);expect(count).not.toBeNull();@@ -177,7 +212,19 @@ describe('hero gallery', () => {];for (const archive of archives) expect(publicHeroes).not.toContain(archive);const expected = [...publicHeroes, ...archives].map((h) => `${h}.png`).sort();- const actual = (await readdir(RENDERS)).filter((f) => f.endsWith('.png')).sort();+ const actual = (await readdir(RENDERS))+ .filter((f) => f.endsWith('.png') && !f.startsWith('demo-'))+ .sort();+ expect(actual).toEqual(expected);+ });++ it('has a render for every curated demo addition', async () => {+ const demos = names.filter((n) => n.startsWith('demo-'));+ expect(demos.length).toBe(18);+ const expected = demos.map((d) => `${d}.png`).sort();+ const actual = (await readdir(RENDERS))+ .filter((f) => f.startsWith('demo-') && f.endsWith('.png'))+ .sort();expect(actual).toEqual(expected);});