Replace project with current server release and Windows setup

Import the 2026-10-09 source release, Fastify/SQLite backend, restored source
assets, and analytics-enabled server build. Replace files from the previous
release while retaining the existing repository history.

Make builds portable across Windows and Linux, configure local startup,
normalize Windows static asset paths, and fix test fixture cleanup and file
URL handling. Exclude local environment settings, databases, dependencies,
validation output, and TypeScript build cache from version control.

Validation: npm ci, static and server builds, 106 arrival tests, and actual
local HTTP checks passed. The full suite passed 467 of 470 tests; three tests
still require QA fixtures omitted from the supplied release, documented in
README-서버실행.md.
This commit is contained in:
2026-10-09 16:43:35 +09:00
parent 71c8d3b7ff
commit e358e24436
642 changed files with 35202 additions and 17642 deletions
+74
View File
@@ -0,0 +1,74 @@
import * as THREE from 'three';
import { GOBANG_GLASS } from '../constants/glass';
export interface GlassShape { width: number; height: number; grid: number; curvature: number }
function profile(coordinate: number): [number,number] {
const span=.5-GOBANG_GLASS.flatHalfWidth, rounding=GOBANG_GLASS.bevelRound;
const t=THREE.MathUtils.clamp((Math.abs(coordinate)-GOBANG_GLASS.flatHalfWidth)/span,0,1);
let ramp=t-rounding*.5, slope=1;
if(t<rounding) { ramp=t*t/(2*rounding); slope=t/rounding; }
else if(t>1-rounding) { ramp=1-rounding-(1-t)*(1-t)/(2*rounding); slope=(1-t)/rounding; }
return [1-ramp/(1-rounding),-slope*Math.sign(coordinate)/(span*(1-rounding))];
}
/** Exact CPU counterpart of A's gobangSurface; normals derive from this same height. */
export function sampleGobangSurface(u: number, v: number, shape: GlassShape) {
const gx=shape.grid, gy=Math.max(1,gx*shape.height/shape.width), cell=Math.min(shape.width/gx,shape.height/gy);
const [px,dx]=profile(((u*gx)%1+1)%1-.5), [py,dy]=profile(((v*gy)%1+1)%1-.5);
const x=u*gx*Math.PI*2,y=v*gy*Math.PI*2, phase=x*3+Math.sin(y);
const ripple=.008*Math.sin(phase)*Math.sin(y);
const rx=.008*Math.PI*2*3*Math.cos(phase)*Math.sin(y);
const ry=.008*Math.PI*2*(Math.cos(phase)*Math.cos(y)*Math.sin(y)+Math.sin(phase)*Math.cos(y));
const amplitude=GOBANG_GLASS.heightPerCell*cell*THREE.MathUtils.clamp(shape.curvature,-1,1);
return { height:amplitude*(.25*px+.55*py+.20*px*py+ripple), dx:amplitude*((.25+.20*py)*dx+rx)/(shape.width/gx), dy:amplitude*((.55+.20*px)*dy+ry)/(shape.height/gy) };
}
function axis(cells: number, maxSegments: number): number[] {
// Include plateau and rounded-ridge breakpoints, rather than missing them on a coarse uniform grid.
const knots=[0,.043,.387,.43,.57,.613,.957];
if(Math.ceil(cells)*knots.length>maxSegments) return Array.from({length:maxSegments+1},(_,i)=>i/maxSegments);
const result:number[]=[];
for(let cell=0;cell<Math.ceil(cells);cell++) for(const k of knots) { const p=(cell+k)/cells; if(p<1) result.push(p); }
result.push(1); return result;
}
export function createPatternedGlassGeometry(shape: GlassShape) {
if (![shape.width,shape.height,shape.grid,shape.curvature].every(Number.isFinite) || shape.width<=0 || shape.height<=0 || shape.grid<1) throw new Error('Invalid glass dimensions');
const cell=Math.min(shape.width/shape.grid,shape.height/Math.max(1,shape.grid*shape.height/shape.width)), backZ=-GOBANG_GLASS.thickness-GOBANG_GLASS.heightPerCell*cell;
const gridY=Math.max(1,shape.grid*shape.height/shape.width);
const ratio=shape.height/shape.width;
const nx=Math.max(8,Math.min(240,Math.floor(Math.sqrt(40000/ratio))));
const ny=Math.max(8,Math.min(240,Math.floor(40000/nx)));
const xs=axis(shape.grid,nx), ys=axis(gridY,ny), width=xs.length;
const positions:number[]=[],normals:number[]=[],uvs:number[]=[],indices:number[]=[];
let minThickness=Infinity,maxThickness=0;
function vertex(x:number,y:number,z:number,nx:number,ny:number,nz:number,u:number,v:number):number {
const index=positions.length/3; positions.push(x,y,z);normals.push(nx,ny,nz);uvs.push(u,v);return index;
}
for(const v of ys) for(const u of xs) {
const s=sampleGobangSurface(u,v,shape),n=new THREE.Vector3(-s.dx,-s.dy,1).normalize();
vertex((u-.5)*shape.width,(v-.5)*shape.height,s.height,n.x,n.y,n.z,u,v);
const thickness=s.height-backZ;minThickness=Math.min(minThickness,thickness);maxThickness=Math.max(maxThickness,thickness);
}
for(let y=0;y<ys.length-1;y++)for(let x=0;x<xs.length-1;x++){ const a=y*width+x,b=a+1,c=a+width,d=c+1;indices.push(a,b,d,a,d,c); }
// CCW front perimeter. Duplicate seams retain the distinct side and rear normals.
const border:number[]=[];
for(let x=0;x<width;x++)border.push(x);
for(let y=1;y<ys.length;y++)border.push(y*width+width-1);
for(let x=width-2;x>=0;x--)border.push((ys.length-1)*width+x);
for(let y=ys.length-2;y>0;y--)border.push(y*width);
const rearCenter=vertex(0,0,backZ,0,0,-1,.5,.5);
const rear=border.map(i=>vertex(positions[i*3],positions[i*3+1],backZ,0,0,-1,uvs[i*2],uvs[i*2+1]));
for(let k=0;k<border.length;k++) {
const next=(k+1)%border.length,a=border[k],b=border[next];
indices.push(rearCenter,rear[next],rear[k]);
const ax=positions[a*3],ay=positions[a*3+1],bx=positions[b*3],by=positions[b*3+1];
const n=new THREE.Vector3(by-ay,ax-bx,0).normalize();
const p=vertex(ax,ay,positions[a*3+2],n.x,n.y,0,uvs[a*2],uvs[a*2+1]);
const q=vertex(bx,by,positions[b*3+2],n.x,n.y,0,uvs[b*2],uvs[b*2+1]);
const r=vertex(ax,ay,backZ,n.x,n.y,0,uvs[a*2],uvs[a*2+1]);
const s=vertex(bx,by,backZ,n.x,n.y,0,uvs[b*2],uvs[b*2+1]);
indices.push(p,r,s,p,s,q);
}
const geometry=new THREE.BufferGeometry();
geometry.setAttribute('position',new THREE.Float32BufferAttribute(positions,3));
geometry.setAttribute('normal',new THREE.Float32BufferAttribute(normals,3));
geometry.setAttribute('uv',new THREE.Float32BufferAttribute(uvs,2));geometry.setIndex(indices);geometry.computeBoundingSphere();
return {geometry,backZ,minThickness,maxThickness,frontSegments:[xs.length-1,ys.length-1],reducedSampling:Math.ceil(shape.grid)*7>nx || Math.ceil(gridY)*7>ny};
}