Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

feat(x402): Permit2 sibling on the three CDP-settled endpoints

nirholas4d3b385daa1a
diff --git a/api/insights/revenue-vision.js b/api/insights/revenue-vision.js
index 491519a5b..3477a79db 100644
--- a/api/insights/revenue-vision.js
+++ b/api/insights/revenue-vision.js
@@ -17,6 +17,7 @@ import {
verifyPayment,
settlePayment,
encodePaymentResponseHeader,
+ permit2VariantOf,
resolveResourceUrl,
} from '../_lib/x402-spec.js';
import { env } from '../_lib/env.js';
@@ -111,18 +112,20 @@ const ROUTE_BAZAAR = {
};
function buildRequirements(resourceUrl) {
- return [
- {
- scheme: 'exact',
- network: NETWORK_BASE_MAINNET,
- amount: env.X402_MAX_AMOUNT_REQUIRED,
- payTo: env.X402_PAY_TO_BASE,
- asset: env.X402_ASSET_ADDRESS_BASE,
- maxTimeoutSeconds: 60,
- resource: resourceUrl,
- extra: { name: 'USD Coin', version: '2', decimals: 6 },
- },
- ];
+ const eip3009 = {
+ scheme: 'exact',
+ network: NETWORK_BASE_MAINNET,
+ amount: env.X402_MAX_AMOUNT_REQUIRED,
+ payTo: env.X402_PAY_TO_BASE,
+ asset: env.X402_ASSET_ADDRESS_BASE,
+ maxTimeoutSeconds: 60,
+ resource: resourceUrl,
+ extra: { name: 'USD Coin', version: '2', decimals: 6 },
+ };
+ const out = [eip3009];
+ const permit2 = permit2VariantOf(eip3009);
+ if (permit2) out.push(permit2);
+ return out;
}
const SYSTEM_PROMPT =
diff --git a/api/x402/mint-to-mesh.js b/api/x402/mint-to-mesh.js
index 06ae61736..d3ab2cc60 100644
--- a/api/x402/mint-to-mesh.js
+++ b/api/x402/mint-to-mesh.js
@@ -23,6 +23,7 @@ import {
verifyPayment,
settlePayment,
encodePaymentResponseHeader,
+ permit2VariantOf,
resolveResourceUrl,
buildBazaarSchema,
} from '../_lib/x402-spec.js';
@@ -152,18 +153,20 @@ const ROUTE_BAZAAR = {
};
function buildRequirements(resourceUrl) {
- return [
- {
- scheme: 'exact',
- network: NETWORK_BASE_MAINNET,
- amount: env.X402_MAX_AMOUNT_REQUIRED,
- payTo: env.X402_PAY_TO_BASE,
- asset: env.X402_ASSET_ADDRESS_BASE,
- maxTimeoutSeconds: 60,
- resource: resourceUrl,
- extra: { name: 'USD Coin', version: '2', decimals: 6 },
- },
- ];
+ const eip3009 = {
+ scheme: 'exact',
+ network: NETWORK_BASE_MAINNET,
+ amount: env.X402_MAX_AMOUNT_REQUIRED,
+ payTo: env.X402_PAY_TO_BASE,
+ asset: env.X402_ASSET_ADDRESS_BASE,
+ maxTimeoutSeconds: 60,
+ resource: resourceUrl,
+ extra: { name: 'USD Coin', version: '2', decimals: 6 },
+ };
+ const out = [eip3009];
+ const permit2 = permit2VariantOf(eip3009);
+ if (permit2) out.push(permit2);
+ return out;
}
// Loose Solana base58 sanity check. Real validation happens in solanaPubkey()
diff --git a/api/x402/model-check.js b/api/x402/model-check.js
index b4d112136..40d1d3f2d 100644
--- a/api/x402/model-check.js
+++ b/api/x402/model-check.js
@@ -19,6 +19,7 @@ import {
verifyPayment,
settlePayment,
encodePaymentResponseHeader,
+ permit2VariantOf,
resolveResourceUrl,
buildBazaarSchema,
} from '../_lib/x402-spec.js';
@@ -170,18 +171,24 @@ const ROUTE_BAZAAR = {
};
function buildRequirements(resourceUrl) {
- return [
- {
- scheme: 'exact',
- network: NETWORK_BASE_MAINNET,
- amount: env.X402_MAX_AMOUNT_REQUIRED,
- payTo: env.X402_PAY_TO_BASE,
- asset: env.X402_ASSET_ADDRESS_BASE,
- maxTimeoutSeconds: 60,
- resource: resourceUrl,
- extra: { name: 'USD Coin', version: '2', decimals: 6 },
- },
- ];
+ const eip3009 = {
+ scheme: 'exact',
+ network: NETWORK_BASE_MAINNET,
+ amount: env.X402_MAX_AMOUNT_REQUIRED,
+ payTo: env.X402_PAY_TO_BASE,
+ asset: env.X402_ASSET_ADDRESS_BASE,
+ maxTimeoutSeconds: 60,
+ resource: resourceUrl,
+ extra: { name: 'USD Coin', version: '2', decimals: 6 },
+ };
+ const out = [eip3009];
+ // permit2VariantOf returns null without CDP credentials (PayAI doesn't
+ // settle Permit2). When CDP is configured, append a sibling so SDK clients
+ // can take the gasless EIP-2612 path; build402Body will auto-declare the
+ // matching gas-sponsoring extensions in response.extensions.
+ const permit2 = permit2VariantOf(eip3009);
+ if (permit2) out.push(permit2);
+ return out;
}
async function fetchAndInspect(targetUrl) {
diff --git a/public/club/venue/LICENSES.md b/public/club/venue/LICENSES.md
index 7d589a1ab..de1451576 100644
--- a/public/club/venue/LICENSES.md
+++ b/public/club/venue/LICENSES.md
@@ -14,10 +14,10 @@ holds full copyright and dedicates them to the public domain under
(https://creativecommons.org/publicdomain/zero/1.0/). Use, modify, and
redistribute freely; attribution is appreciated but not required.
-| File | Source | License | Notes |
-|---|---|---|---|
-| `club-venue.glb` | Authored — primitive geometry assembled via `@gltf-transform/core` | CC0 1.0 | Floor disc, cylinder wall, ceiling, bar + neon backsplash, truss beams, per-slot backstage doors. All 14 named empties from the `src/club-venue.js` contract are present. |
-| `club-hdri.hdr` | Authored — radiance functions sampled into Radiance RGBE | CC0 1.0 | 128×64 equirectangular. Dark purple wash + four warm/coloured spot bumps + mirrorball ring + bar back-glow. Tuned for PBR reflections (`scene.environment`) only — background stays the dark fog colour. |
+| File | Source | License | Notes |
+| ---------------- | ------------------------------------------------------------------ | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `club-venue.glb` | Authored — primitive geometry assembled via `@gltf-transform/core` | CC0 1.0 | Floor disc, cylinder wall, ceiling, bar + neon backsplash, truss beams, per-slot backstage doors. All 14 named empties from the `src/club-venue.js` contract are present. |
+| `club-hdri.hdr` | Authored — radiance functions sampled into Radiance RGBE | CC0 1.0 | 128×64 equirectangular. Dark purple wash + four warm/coloured spot bumps + mirrorball ring + bar back-glow. Tuned for PBR reflections (`scene.environment`) only — background stays the dark fog colour. |
## Upgrading to artist-authored assets
@@ -30,6 +30,7 @@ before committing:
```markdown
### `club-venue.glb`
+
- **Source**: https://example.com/asset-page
- **Author**: Studio name
- **License**: CC0 1.0 (or SPDX identifier)
diff --git a/scripts/build-club-hdri.mjs b/scripts/build-club-hdri.mjs
index 4fc91bc46..0aa30a242 100644
--- a/scripts/build-club-hdri.mjs
+++ b/scripts/build-club-hdri.mjs
@@ -75,12 +75,12 @@ function sampleRadiance(u, v) {
// Base ambient — very low purple wash.
let r = 0.012;
let g = 0.006;
- let b = 0.020;
+ let b = 0.02;
// Soft hemisphere — purple ceiling, deep-blue floor — gives PBR
// chrome a faint tint even where no spotlight points.
const hemi = 0.5 + 0.5 * Math.sin(phi);
- r += hemi * 0.030;
+ r += hemi * 0.03;
g += hemi * 0.014;
b += hemi * 0.064;
@@ -88,10 +88,10 @@ function sampleRadiance(u, v) {
// roughly above the head height (phi ≈ +0.9 rad). Bright enough that
// chrome / metallic dancer accessories pick up a clear highlight.
const SPOTS = [
- { theta: -1.05, hue: [3.4, 1.8, 0.8] }, // warm tungsten
- { theta: -0.32, hue: [2.2, 0.9, 3.2] }, // magenta
- { theta: 0.32, hue: [0.9, 2.4, 3.6] }, // cyan
- { theta: 1.05, hue: [3.4, 1.8, 0.8] }, // warm tungsten
+ { theta: -1.05, hue: [3.4, 1.8, 0.8] }, // warm tungsten
+ { theta: -0.32, hue: [2.2, 0.9, 3.2] }, // magenta
+ { theta: 0.32, hue: [0.9, 2.4, 3.6] }, // cyan
+ { theta: 1.05, hue: [3.4, 1.8, 0.8] }, // warm tungsten
];
for (const spot of SPOTS) {
const w = bump(theta, phi, spot.theta, 0.95, 0.32);
@@ -155,7 +155,9 @@ function main() {
const buf = buildHdr();
const outPath = resolve(OUT_DIR, 'club-hdri.hdr');
writeFileSync(outPath, buf);
- console.log(`[club-hdri] wrote club-hdri.hdr ${(buf.length / 1024).toFixed(1)} kB (${WIDTH}x${HEIGHT})`);
+ console.log(
+ `[club-hdri] wrote club-hdri.hdr ${(buf.length / 1024).toFixed(1)} kB (${WIDTH}x${HEIGHT})`,
+ );
}
main();
diff --git a/scripts/build-club-props.mjs b/scripts/build-club-props.mjs
index d4cd2e51e..19598c742 100644
--- a/scripts/build-club-props.mjs
+++ b/scripts/build-club-props.mjs
@@ -89,20 +89,70 @@ function cylinderGeom(radiusTop, radiusBottom, height, segments = 24) {
}
function boxGeom(sx, sy, sz) {
- const x = sx / 2, y = sy / 2, z = sz / 2;
+ const x = sx / 2,
+ y = sy / 2,
+ z = sz / 2;
const faces = [
// +X
- { n: [1, 0, 0], v: [[x, -y, -z], [x, y, -z], [x, y, z], [x, -y, z]] },
+ {
+ n: [1, 0, 0],
+ v: [
+ [x, -y, -z],
+ [x, y, -z],
+ [x, y, z],
+ [x, -y, z],
+ ],
+ },
// -X
- { n: [-1, 0, 0], v: [[-x, -y, z], [-x, y, z], [-x, y, -z], [-x, -y, -z]] },
+ {
+ n: [-1, 0, 0],
+ v: [
+ [-x, -y, z],
+ [-x, y, z],
+ [-x, y, -z],
+ [-x, -y, -z],
+ ],
+ },
// +Y
- { n: [0, 1, 0], v: [[-x, y, -z], [-x, y, z], [x, y, z], [x, y, -z]] },
+ {
+ n: [0, 1, 0],
+ v: [
+ [-x, y, -z],
+ [-x, y, z],
+ [x, y, z],
+ [x, y, -z],
+ ],
+ },
// -Y
- { n: [0, -1, 0], v: [[-x, -y, z], [-x, -y, -z], [x, -y, -z], [x, -y, z]] },
+ {
+ n: [0, -1, 0],
+ v: [
+ [-x, -y, z],
+ [-x, -y, -z],
+ [x, -y, -z],
+ [x, -y, z],
+ ],
+ },
// +Z
- { n: [0, 0, 1], v: [[-x, -y, z], [x, -y, z], [x, y, z], [-x, y, z]] },
+ {
+ n: [0, 0, 1],
+ v: [
+ [-x, -y, z],
+ [x, -y, z],
+ [x, y, z],
+ [-x, y, z],
+ ],
+ },
// -Z
- { n: [0, 0, -1], v: [[x, -y, -z], [-x, -y, -z], [-x, y, -z], [x, y, -z]] },
+ {
+ n: [0, 0, -1],
+ v: [
+ [x, -y, -z],
+ [-x, -y, -z],
+ [-x, y, -z],
+ [x, y, -z],
+ ],
+ },
];
const positions = [];
const normals = [];
@@ -130,8 +180,10 @@ function torusGeom(radius, tube, radialSegments = 8, tubularSegments = 64) {
for (let i = 0; i <= tubularSegments; i++) {
const u = (i / tubularSegments) * Math.PI * 2;
const v = (j / radialSegments) * Math.PI * 2;
- const cosU = Math.cos(u), sinU = Math.sin(u);
- const cosV = Math.cos(v), sinV = Math.sin(v);
+ const cosU = Math.cos(u),
+ sinU = Math.sin(u);
+ const cosV = Math.cos(v),
+ sinV = Math.sin(v);
positions.push(
(radius + tube * cosV) * cosU,
tube * sinV,
@@ -200,7 +252,7 @@ function addEmpty(doc, scene, name, translation) {
function chromeMat(doc) {
return doc
.createMaterial('PoleChrome')
- .setBaseColorFactor([0.902, 0.910, 0.941, 1])
+ .setBaseColorFactor([0.902, 0.91, 0.941, 1])
.setMetallicFactor(1.0)
.setRoughnessFactor(0.14);
}
@@ -208,7 +260,7 @@ function chromeMat(doc) {
function brushedMat(doc) {
return doc
.createMaterial('PoleBrushed')
- .setBaseColorFactor([0.784, 0.800, 0.847, 1])
+ .setBaseColorFactor([0.784, 0.8, 0.847, 1])
.setMetallicFactor(0.95)
.setRoughnessFactor(0.32);
}
@@ -216,7 +268,7 @@ function brushedMat(doc) {
function darkMetalMat(doc) {
return doc
.createMaterial('DarkMetal')
- .setBaseColorFactor([0.102, 0.110, 0.126, 1])
+ .setBaseColorFactor([0.102, 0.11, 0.126, 1])
.setMetallicFactor(0.9)
.setRoughnessFactor(0.45);
}
@@ -224,7 +276,7 @@ function darkMetalMat(doc) {
function stageBodyMat(doc) {
return doc
.createMaterial('StageBody')
- .setBaseColorFactor([0.039, 0.020, 0.051, 1])
+ .setBaseColorFactor([0.039, 0.02, 0.051, 1])
.setMetallicFactor(0.55)
.setRoughnessFactor(0.55);
}
@@ -259,24 +311,48 @@ function buildPoleDoc() {
const dark = darkMetalMat(doc);
// Flared base disc.
- addMesh(doc, scene, buffer, brushed, 'pole.base',
- cylinderGeom(0.42, 0.46, 0.04, 40), [0, 0.02, 0]);
+ addMesh(
+ doc,
+ scene,
+ buffer,
+ brushed,
+ 'pole.base',
+ cylinderGeom(0.42, 0.46, 0.04, 40),
+ [0, 0.02, 0],
+ );
// Transition collar between base and shaft.
- addMesh(doc, scene, buffer, brushed, 'pole.collar',
- cylinderGeom(POLE_RADIUS * 2.1, 0.13, 0.09, 32), [0, 0.04 + 0.045, 0]);
+ addMesh(
+ doc,
+ scene,
+ buffer,
+ brushed,
+ 'pole.collar',
+ cylinderGeom(POLE_RADIUS * 2.1, 0.13, 0.09, 32),
+ [0, 0.04 + 0.045, 0],
+ );
// Main shaft.
- addMesh(doc, scene, buffer, chrome, 'pole.shaft',
- cylinderGeom(POLE_RADIUS, POLE_RADIUS, POLE_HEIGHT, 24), [0, POLE_HEIGHT / 2, 0]);
+ addMesh(
+ doc,
+ scene,
+ buffer,
+ chrome,
+ 'pole.shaft',
+ cylinderGeom(POLE_RADIUS, POLE_RADIUS, POLE_HEIGHT, 24),
+ [0, POLE_HEIGHT / 2, 0],
+ );
// Ceiling mount plate.
- addMesh(doc, scene, buffer, brushed, 'pole.mount.plate',
- boxGeom(0.26, 0.014, 0.26), [0, POLE_HEIGHT + 0.007, 0]);
+ addMesh(doc, scene, buffer, brushed, 'pole.mount.plate', boxGeom(0.26, 0.014, 0.26), [
+ 0,
+ POLE_HEIGHT + 0.007,
+ 0,
+ ]);
// Four bolts on the mount plate.
const boltGeom = cylinderGeom(0.012, 0.012, 0.022, 8);
- const boltInset = 0.10;
+ const boltInset = 0.1;
const boltOffsets = [
[+boltInset, +boltInset],
[+boltInset, -boltInset],
@@ -285,18 +361,32 @@ function buildPoleDoc() {
];
for (let i = 0; i < boltOffsets.length; i++) {
const [bx, bz] = boltOffsets[i];
- addMesh(doc, scene, buffer, dark, `pole.bolt.${i}`,
- boltGeom, [bx, POLE_HEIGHT + 0.024, bz]);
+ addMesh(doc, scene, buffer, dark, `pole.bolt.${i}`, boltGeom, [
+ bx,
+ POLE_HEIGHT + 0.024,
+ bz,
+ ]);
}
// Spotlight bracket.
- addMesh(doc, scene, buffer, dark, 'pole.bracket.arm',
- boxGeom(0.04, 0.02, 0.18), [0, POLE_HEIGHT + 0.024, 0.13]);
+ addMesh(doc, scene, buffer, dark, 'pole.bracket.arm', boxGeom(0.04, 0.02, 0.18), [
+ 0,
+ POLE_HEIGHT + 0.024,
+ 0.13,
+ ]);
// Rotate +90° about X so the cylinder's Y axis points along Z (head pointing forward).
// Quaternion for 90° X-rotation: (sin(45°), 0, 0, cos(45°)).
const xQuat = [Math.SQRT1_2, 0, 0, Math.SQRT1_2];
- addMesh(doc, scene, buffer, dark, 'pole.bracket.head',
- cylinderGeom(0.025, 0.025, 0.04, 16), [0, POLE_HEIGHT + 0.024, 0.22], xQuat);
+ addMesh(
+ doc,
+ scene,
+ buffer,
+ dark,
+ 'pole.bracket.head',
+ cylinderGeom(0.025, 0.025, 0.04, 16),
+ [0, POLE_HEIGHT + 0.024, 0.22],
+ xQuat,
+ );
// Spotlight attach empty (consumed by prompt 04).
// Underscored — three.js's PropertyBinding.sanitizeNodeName strips `.`
@@ -320,17 +410,39 @@ function buildStageDoc() {
const led = ledMat(doc);
// Main disc (slight outward flare at the base).
- addMesh(doc, scene, buffer, body, 'stage.body',
- cylinderGeom(STAGE_RADIUS, STAGE_RADIUS + 0.04, STAGE_HEIGHT, 64), [0, STAGE_HEIGHT / 2, 0]);
+ addMesh(
+ doc,
+ scene,
+ buffer,
+ body,
+ 'stage.body',
+ cylinderGeom(STAGE_RADIUS, STAGE_RADIUS + 0.04, STAGE_HEIGHT, 64),
+ [0, STAGE_HEIGHT / 2, 0],
+ );
// Anti-slip top face — recessed slightly inside the disc rim.
- addMesh(doc, scene, buffer, top, 'stage.top',
- cylinderGeom(STAGE_RADIUS - 0.01, STAGE_RADIUS - 0.01, 0.004, 64), [0, STAGE_HEIGHT + 0.002, 0]);
+ addMesh(
+ doc,
+ scene,
+ buffer,
+ top,
+ 'stage.top',
+ cylinderGeom(STAGE_RADIUS - 0.01, STAGE_RADIUS - 0.01, 0.004, 64),
+ [0, STAGE_HEIGHT + 0.002, 0],
+ );
// LED strip — horizontal torus around the top edge.
const xQuat = [Math.SQRT1_2, 0, 0, Math.SQRT1_2];
- addMesh(doc, scene, buffer, led, 'stage.led.ring',
- torusGeom(STAGE_RADIUS + 0.005, 0.012, 8, 96), [0, STAGE_HEIGHT - 0.014, 0], xQuat);
+ addMesh(
+ doc,
+ scene,
+ buffer,
+ led,
+ 'stage.led.ring',
+ torusGeom(STAGE_RADIUS + 0.005, 0.012, 8, 96),
+ [0, STAGE_HEIGHT - 0.014, 0],
+ xQuat,
+ );
// LED control empty (consumed by prompt 04).
addEmpty(doc, scene, 'stage_led_strip', [0, STAGE_HEIGHT - 0.014, 0]);
diff --git a/scripts/build-club-venue.mjs b/scripts/build-club-venue.mjs
index 90e25929a..41d982075 100644
--- a/scripts/build-club-venue.mjs
+++ b/scripts/build-club-venue.mjs
@@ -51,12 +51,60 @@ function boxGeom(sx, sy, sz) {
const y = sy / 2;
const z = sz / 2;
const faces = [
- { n: [1, 0, 0], v: [[x, -y, -z], [x, y, -z], [x, y, z], [x, -y, z]] },
- { n: [-1, 0, 0], v: [[-x, -y, z], [-x, y, z], [-x, y, -z], [-x, -y, -z]] },
- { n: [0, 1, 0], v: [[-x, y, -z], [-x, y, z], [x, y, z], [x, y, -z]] },
- { n: [0, -1, 0], v: [[-x, -y, z], [-x, -y, -z], [x, -y, -z], [x, -y, z]] },
- { n: [0, 0, 1], v: [[-x, -y, z], [x, -y, z], [x, y, z], [-x, y, z]] },
- { n: [0, 0, -1], v: [[x, -y, -z], [-x, -y, -z], [-x, y, -z], [x, y, -z]] },
+ {
+ n: [1, 0, 0],
+ v: [
+ [x, -y, -z],
+ [x, y, -z],
+ [x, y, z],
+ [x, -y, z],
+ ],
+ },
+ {
+ n: [-1, 0, 0],
+ v: [
+ [-x, -y, z],
+ [-x, y, z],
+ [-x, y, -z],
+ [-x, -y, -z],
+ ],
+ },
+ {
+ n: [0, 1, 0],
+ v: [
+ [-x, y, -z],
+ [-x, y, z],
+ [x, y, z],
+ [x, y, -z],
+ ],
+ },
+ {
+ n: [0, -1, 0],
+ v: [
+ [-x, -y, z],
+ [-x, -y, -z],
+ [x, -y, -z],
+ [x, -y, z],
+ ],
+ },
+ {
+ n: [0, 0, 1],
+ v: [
+ [-x, -y, z],
+ [x, -y, z],
+ [x, y, z],
+ [-x, y, z],
+ ],
+ },
+ {
+ n: [0, 0, -1],
+ v: [
+ [x, -y, -z],
+ [-x, -y, -z],
+ [-x, y, -z],
+ [x, y, -z],
+ ],
+ },
];
const positions = [];
const normals = [];
@@ -177,7 +225,7 @@ function floorMat(doc) {
function wallMat(doc) {
return doc
.createMaterial('VenueWall')
- .setBaseColorFactor([0.039, 0.020, 0.051, 1])
+ .setBaseColorFactor([0.039, 0.02, 0.051, 1])
.setMetallicFactor(0.2)
.setRoughnessFactor(0.7);
}
@@ -193,7 +241,7 @@ function ceilingMat(doc) {
function trussMat(doc) {
return doc
.createMaterial('VenueTruss')
- .setBaseColorFactor([0.110, 0.118, 0.130, 1])
+ .setBaseColorFactor([0.11, 0.118, 0.13, 1])
.setMetallicFactor(0.92)
.setRoughnessFactor(0.45);
}
@@ -204,7 +252,7 @@ function barMat(doc) {
.setBaseColorFactor([0.153, 0.078, 0.145, 1])
.setMetallicFactor(0.7)
.setRoughnessFactor(0.4)
- .setEmissiveFactor([0.063, 0.020, 0.059]);
+ .setEmissiveFactor([0.063, 0.02, 0.059]);
}
function neonMat(doc) {
@@ -273,11 +321,23 @@ function buildVenueDoc() {
// Dance-floor inlay — slightly emissive checker so the room reads as a
// club, not an empty plane. Sits 1 mm above the main floor to avoid
// z-fighting under bloom.
- addMesh(doc, scene, buffer, dance, 'venue_dancefloor', discGeom(STAGE_RADIUS + 1.4, 64, 1), [0, 0.001, 0]);
+ addMesh(
+ doc,
+ scene,
+ buffer,
+ dance,
+ 'venue_dancefloor',
+ discGeom(STAGE_RADIUS + 1.4, 64, 1),
+ [0, 0.001, 0],
+ );
// Inverse disc as the ceiling — receives no shadows but seals the room
// against the fog so we don't see fog "leaking" up to infinity.
- addMesh(doc, scene, buffer, ceiling, 'venue_ceiling', discGeom(FLOOR_RADIUS, 48, -1), [0, ROOM_HEIGHT, 0]);
+ addMesh(doc, scene, buffer, ceiling, 'venue_ceiling', discGeom(FLOOR_RADIUS, 48, -1), [
+ 0,
+ ROOM_HEIGHT,
+ 0,
+ ]);
// Cylinder side wall — interior of the room. Negative scale on Y would
// flip the inward normal; we use the inward normal directly to keep the
@@ -299,29 +359,69 @@ function buildVenueDoc() {
addMesh(doc, scene, buffer, bar, 'venue_bar', boxGeom(9.0, 1.1, 0.9), [0, 0.55, BAR_Z]);
// Bar back-splash neon — emissive plane just above the counter top.
- addMesh(doc, scene, buffer, neon, 'venue_bar_backsplash', boxGeom(8.0, 0.18, 0.04), [0, 1.55, BAR_Z - 0.45]);
+ addMesh(doc, scene, buffer, neon, 'venue_bar_backsplash', boxGeom(8.0, 0.18, 0.04), [
+ 0,
+ 1.55,
+ BAR_Z - 0.45,
+ ]);
// Truss — four cross-room beams. Heavy enough to read as metal under
// the spotlights but kept low-poly: each beam is a single box.
const beamThickness = 0.16;
- addMesh(doc, scene, buffer, truss, 'venue_truss_front', boxGeom(FLOOR_RADIUS * 1.6, beamThickness, beamThickness), [0, TRUSS_Y, 1.4]);
- addMesh(doc, scene, buffer, truss, 'venue_truss_mid', boxGeom(FLOOR_RADIUS * 1.6, beamThickness, beamThickness), [0, TRUSS_Y, -2.6]);
- addMesh(doc, scene, buffer, truss, 'venue_truss_back', boxGeom(FLOOR_RADIUS * 1.6, beamThickness, beamThickness), [0, TRUSS_Y, BAR_Z + 1.0]);
- addMesh(doc, scene, buffer, truss, 'venue_truss_left', boxGeom(beamThickness, beamThickness, 12), [-7.5, TRUSS_Y, -2.4]);
- addMesh(doc, scene, buffer, truss, 'venue_truss_right', boxGeom(beamThickness, beamThickness, 12), [7.5, TRUSS_Y, -2.4]);
+ addMesh(
+ doc,
+ scene,
+ buffer,
+ truss,
+ 'venue_truss_front',
+ boxGeom(FLOOR_RADIUS * 1.6, beamThickness, beamThickness),
+ [0, TRUSS_Y, 1.4],
+ );
+ addMesh(
+ doc,
+ scene,
+ buffer,
+ truss,
+ 'venue_truss_mid',
+ boxGeom(FLOOR_RADIUS * 1.6, beamThickness, beamThickness),
+ [0, TRUSS_Y, -2.6],
+ );
+ addMesh(
+ doc,
+ scene,
+ buffer,
+ truss,
+ 'venue_truss_back',
+ boxGeom(FLOOR_RADIUS * 1.6, beamThickness, beamThickness),
+ [0, TRUSS_Y, BAR_Z + 1.0],
+ );
+ addMesh(
+ doc,
+ scene,
+ buffer,
+ truss,
+ 'venue_truss_left',
+ boxGeom(beamThickness, beamThickness, 12),
+ [-7.5, TRUSS_Y, -2.4],
+ );
+ addMesh(
+ doc,
+ scene,
+ buffer,
+ truss,
+ 'venue_truss_right',
+ boxGeom(beamThickness, beamThickness, 12),
+ [7.5, TRUSS_Y, -2.4],
+ );
// Per-pole backstage doors — narrow vertical boxes against the back wall.
const poles = poleLayouts();
for (const p of poles) {
- addMesh(
- doc,
- scene,
- buffer,
- door,
- `venue_door_${p.id}`,
- boxGeom(0.9, 2.2, 0.08),
- [p.backstageX, 1.1, p.backstageZ - 0.05],
- );
+ addMesh(doc, scene, buffer, door, `venue_door_${p.id}`, boxGeom(0.9, 2.2, 0.08), [
+ p.backstageX,
+ 1.1,
+ p.backstageZ - 0.05,
+ ]);
}
// ─── Named empties (the contract enforced in src/club-venue.js) ──────────
diff --git a/src/club-venue.js b/src/club-venue.js
index 0267ee7fd..157e14558 100644
--- a/src/club-venue.js
+++ b/src/club-venue.js
@@ -20,9 +20,18 @@ import { Vector3 } from 'three';
export const REQUIRED_VENUE_EMPTIES = [
'truss_mirrorball',
'bar_backsplash_neon',
- 'stage_01', 'stage_02', 'stage_03', 'stage_04',
- 'backstage_door_01', 'backstage_door_02', 'backstage_door_03', 'backstage_door_04',
- 'truss_spot_01', 'truss_spot_02', 'truss_spot_03', 'truss_spot_04',
+ 'stage_01',
+ 'stage_02',
+ 'stage_03',
+ 'stage_04',
+ 'backstage_door_01',
+ 'backstage_door_02',
+ 'backstage_door_03',
+ 'backstage_door_04',
+ 'truss_spot_01',
+ 'truss_spot_02',
+ 'truss_spot_03',
+ 'truss_spot_04',
];
/**
diff --git a/tests/club-venue-load.test.js b/tests/club-venue-load.test.js
index e67ebd3a4..e064e4082 100644
--- a/tests/club-venue-load.test.js
+++ b/tests/club-venue-load.test.js
@@ -34,20 +34,20 @@ function makeSyntheticVenue(omit = new Set()) {
root.name = 'venue';
const positions = {
- 'truss_mirrorball': [0, 6.0, 0],
- 'bar_backsplash_neon': [0, 1.6, -7.5],
- 'stage_01': [-3.5, 0, -3.0],
- 'stage_02': [-1.2, 0, -4.4],
- 'stage_03': [1.2, 0, -4.4],
- 'stage_04': [3.5, 0, -3.0],
- 'backstage_door_01': [-3.5, 0, -6.8],
- 'backstage_door_02': [-1.2, 0, -7.2],
- 'backstage_door_03': [1.2, 0, -7.2],
- 'backstage_door_04': [3.5, 0, -6.8],
- 'truss_spot_01': [-3.5, 6.0, -2.5],
- 'truss_spot_02': [-1.2, 6.0, -4.0],
- 'truss_spot_03': [1.2, 6.0, -4.0],
- 'truss_spot_04': [3.5, 6.0, -2.5],
+ truss_mirrorball: [0, 6.0, 0],
+ bar_backsplash_neon: [0, 1.6, -7.5],
+ stage_01: [-3.5, 0, -3.0],
+ stage_02: [-1.2, 0, -4.4],
+ stage_03: [1.2, 0, -4.4],
+ stage_04: [3.5, 0, -3.0],
+ backstage_door_01: [-3.5, 0, -6.8],
+ backstage_door_02: [-1.2, 0, -7.2],
+ backstage_door_03: [1.2, 0, -7.2],
+ backstage_door_04: [3.5, 0, -6.8],
+ truss_spot_01: [-3.5, 6.0, -2.5],
+ truss_spot_02: [-1.2, 6.0, -4.0],
+ truss_spot_03: [1.2, 6.0, -4.0],
+ truss_spot_04: [3.5, 6.0, -2.5],
};
for (const [name, [x, y, z]] of Object.entries(positions)) {
@@ -74,13 +74,11 @@ describe('collectVenueEmpties', () => {
});
it('throws naming every missing empty when the venue is incomplete', () => {
- const { root } = makeSyntheticVenue(
- new Set(['backstage_door_03', 'truss_mirrorball']),
+ const { root } = makeSyntheticVenue(new Set(['backstage_door_03', 'truss_mirrorball']));
+ expect(() => collectVenueEmpties(root, REQUIRED_VENUE_EMPTIES)).toThrow(
+ /backstage_door_03/,
);
- expect(() => collectVenueEmpties(root, REQUIRED_VENUE_EMPTIES))
- .toThrow(/backstage_door_03/);
- expect(() => collectVenueEmpties(root, REQUIRED_VENUE_EMPTIES))
- .toThrow(/truss_mirrorball/);
+ expect(() => collectVenueEmpties(root, REQUIRED_VENUE_EMPTIES)).toThrow(/truss_mirrorball/);
});
it('rejects a non-Object3D root with a clear error', () => {