import { camera, effects, environments, game, instances, lights, material, model, primitives, scene, sky, type AuraTransformSpec, type AuraVec3 } from "@aura3d/engine"; import { assets } from "./aura-assets"; // Shift change at a coastal freight terminal, just before dawn. // Sodium-lit gantries and enamel safety markings against petrol-blue steel. // The courier holds still for a portrait before the relay deck opens into view. export const relays = [-6, -15, -24] as const; export const portraitEye: AuraVec3 = [1.98, 1.40, 3.35]; export const portraitAim: AuraVec3 = [0, 0.98, 0]; const steel = (color: string, roughness = 0.53) => material.pbr({ color, roughness, metalness: 0.46 }); const glow = (color: string, intensity = 1.4) => material.emissive({ color, emissive: color, emissiveIntensity: intensity }); const surfaces = { frame: steel("#152e38"), floor: steel("#233a46", 0.43), ledge: steel("#364d56"), black: steel("#0d1d26"), crane: steel("#72412f"), stripe: steel("#996531"), roof: steel("#223a43"), gateAmber: material.emissive({ color:"#9b3905", emissive:"#ff5406", emissiveIntensity:0.72 }), sodium: glow("#ffab56"), ice: glow("#94dfec", 0.94), darkWindow: glow("#426979", 0.20), red: glow("#ef5d3d"), distant: material.pbr({color:"#112431",roughness:0.94,metalness:0.05}) }; export function buildStage() { const stage = scene().background("#10202c") .add(sky.gradient({name:"blue hour over the terminal",zenith:"#07121f",horizon:"#213848",ground:"#0e1921",captureEnvironment:false,affectsFog:false})) .camera(camera.perspective({ position: portraitEye, target: portraitAim, near: 0.09, far: 170, fov: 40 })) .add(environments.hdri({ name: "dockside steel reflections", texture: assets.studio, background: false, rotation: 1.2, intensity: 0.40 })) .add(lights.key({ position: [-3.5, 5, 4], target: [0, 1, -2], color: "#bfdef6", intensity: 1.12 })) .add(lights.directional({ position: [4, 3.5, -4], target: [0, 1, 0], color: "#ff9d5c", intensity: 1.54 })) .add(lights.point({ name:"dispatch booth key",position:[-1.65,2.65,2.2],color:"#b4e1ff",intensity:2.4,distance:5.5 })) .add(lights.point({name:"courier shoulder kicker",position:[1.65,2.2,-0.9],color:"#ff9451",intensity:2.7,distance:4.5})) // This narrow port-side wash follows the courier. It catches the outside of the helmet, // backpack ribs and calf armour while leaving the terminal beyond its range unlit. .add(lights.spot({name:"courier port rim",position:[-1.25,2.45,0.85],target:[0,1.08,0], angle:0.53,penumbra:0.63,distance:3.8,color:"#9bdcff",intensity:11,shadow:false}) .runtime(game.runtimeNode("courier-rim"))) .add(effects.contactShadows({length:0.21,thickness:0.08,steps:8,intensity:0.58,lights:"sun"})) .add(effects.fog({ name: "salt haze", mode: "linear", color: "#1a303e", near: 13, far: 88, maxOpacity: 0.72, affectsBackground: false })) .add(effects.cinematicBloom({ name: "halation on port signals", intensity: 0.11, threshold: 1.15, radius: 2 })) .add(effects.antiAlias({ mode: "fxaa" })) .add(model(assets.courier, { name: "Ember Courier", scaleMode: "world", castShadow: true, receiveShadow: true }) .scale(1.92).runtime(game.runtimeNode("courier", { tags: ["player"] }))); const batches = new Map(); function plate(surface: keyof typeof surfaces, x: number, y: number, z: number, w: number, h: number, d: number, roll = 0, yaw = 0) { const batch = batches.get(surface) ?? []; if (!batches.has(surface)) batches.set(surface, batch); batch.push({ position: [x,y,z], scale: [w,h,d], rotation: [0,yaw,roll] }); } // Deck plates have bevel-like shadow gaps, inspection strips, edge lamps and inset expansion joints. plate("black", 0,-0.22,-12, 8.5,0.36,42); for (let i = 0; i < 21; i++) { const z = 7 - i * 2; for (const side of [-1, 1]) { plate("floor",side*1.06,-0.05,z,2.09,0.1,1.98); plate("frame",side*3.12,-0.055,z,1.98,0.11,1.98); plate("stripe",side*2.28,0.007,z,0.064,0.014,1.91); plate("black",side*2.77,0.005,z,0.22,0.013,1.74); for (let j=0; j<7; j++) plate("ledge",side*2.77,0.015,z-0.72+j*0.24,0.21,0.013,0.065); plate("black",side*4.11,0.52,z,0.09,1.13,0.12); plate("ledge",side*4.11,1.07,z,0.09,0.08,2); plate("frame",side*4.11,0.46,z,0.055,0.045,2); if (i%2===0) plate("ice",side*3.75,0.017,z,0.12,0.02,0.58); } } // Tubular refinery stacks with flanged bands and pairs of riveted storage silos. for (let i=0; i<16; i++) { const side = i%2 ? 1 : -1; const x = side*(10+(i*7)%12); const z = 5 - Math.floor(i/2)*6.5; const radius = 1.15+(i%3)*0.5; const top = 1.5+(i*3)%7; stage.add(primitives.cylinder({ name: 'pressure vessel '+i, size:[radius*2,top+6,radius*2],params:{radialSegments:24},material:surfaces.roof }).position(x,(top-6)/2,z)); for(let j=0;j<4;j++) { stage.add(primitives.cylinder({ name:'vessel collar '+i+'-'+j,size:[radius*2+0.09,0.12,radius*2+0.09],params:{radialSegments:24},material:surfaces.frame }).position(x,top-j*1.55,z)); } plate("red",x,top+0.14,z,0.10,0.22,0.10); plate("black",x-radius-0.13,(top-6)/2,z,0.08,top+6,0.46); for(let j=0;j