// Offline wall-hug geometry evidence only; no WebGL/photo rendering. import {writeFileSync} from 'node:fs';import * as T from 'three'; import {loadTypescript} from './load-typescript.mjs';import {loadFrameGeometry} from './load-frame-geometry.mjs'; const {prepareHouseAsset}=await loadTypescript(new URL('../../src/objects/BlenderHouseSurround.ts',import.meta.url)); const {prepareFrameAsset,fitWindowScale}=await loadTypescript(new URL('../../src/objects/BlenderWindowFrame.ts',import.meta.url)); const {CameraController}=await loadTypescript(new URL('../../src/input/CameraController.ts',import.meta.url)); const views=[];for(const [label,aspect]of[['portrait',375/812],['landscape',844/390]]){ const f=fitWindowScale(aspect,.8)*.82,w=f*.8*.8,h=f*.8,s=Math.min(w,h),room=loadFrameGeometry(new URL('../../public/assets/window/grandma-house-surround.glb',import.meta.url)),frame=loadFrameGeometry(); prepareHouseAsset(room).resize(w,h,.6,undefined,true);prepareFrameAsset(frame).resize(w,h,.6);const root=new T.Group();root.add(room,frame);root.updateMatrixWorld(true); const meshes=[];root.traverse(m=>{if(!m.isMesh)return;const g=m.geometry.clone().applyMatrix4(m.matrixWorld);meshes.push({name:m.name,positions:[...g.attributes.position.array],indices:g.index?[...g.index.array]:Array.from({length:g.attributes.position.count},(_,i)=>i),colors:g.attributes.color?[...g.attributes.color.array]:null});}); for(const variant of['left','right','middle','neutral']){ const c=new T.PerspectiveCamera(40,aspect,.1,100),control=new CameraController(c);control.setRoomBounds(w,h,.6);control.setCompositionMode('wall');control.setView(variant==='left'?-1:variant==='right'?1:variant==='middle'?.65:0,0);control.update(10,1); c.updateMatrixWorld(true); views.push({name:label+'-'+variant,aspect,fov:c.fov,matrix:c.matrixWorld.toArray(),meshes}); } } writeFileSync('/tmp/wall-final-qa/scenes.json',JSON.stringify(views));