A mech game prototype, pushed by GPT-6.2-Astra
agent (cont.)
+24:53exec_commandsed -n '84,157p' src/render/palette.ts && rg '^def (cylinder|piston|nozzle|subd)' kit/lib.py && rg 'export function (spaceEnvironment|addSpaceLight|createBackdrop)' src/render/space.ts -A26 && rg -n 'function material' src/render/materials.ts -A33 && ls -lh public/assets/striker.glb && date -u
command
sed -n '84,157p' src/render/palette.ts && rg '^def (cylinder|piston|nozzle|subd)' kit/lib.py && rg 'export function (spaceEnvironment|addSpaceLight|createBackdrop)' src/render/space.ts -A26 && rg -n 'function material' src/render/materials.ts -A33 && ls -lh public/assets/striker.glb && date -u
result, 144 lines
Script completed Wall time 0.1 seconds Output: Warning: truncated output (original token count: 1981) Total output lines: 176 const worn = (color: string, rust: number, rough = 0.6): Paint => ({ color, rough, metal: 0, coat: 0, rust }); export const PALETTES = { /** The player's default frame paint. */ merc: base, /** The Administration: gate white plates, petrol blue accent blocks (the chest, the boots, the cheeks), * gate cyan lights and trim. A light livery, so the frame goes darker to keep the value step. */ admin: { ...base, main: paint('#e4e8eb'), accent: paint('#1b5c5a', 0.45), trim: paint('#3fa7c9', 0.35), frame: metal('#3a3e45', 0.5, 0.8), joint: metal('#24262b', 0.55, 0.9), glow_eye: { color: '#5fd0f0', glow: 4 }, glow_core: { color: '#5fd0f0', glow: 2.4 }, glow_hot: { color: '#e6fbff', glow: 2.6 }, glow_thruster: { color: '#9ee6ff', glow: 3 }, glow_exhaust: { color: '#3fc4ff', glow: 1 }, }, /** The houses: lacquered wine plates, ivory accent fields (the crest, the breastplate, the back panel, the * tabard and the shield pale), warm gold trim on the hems and the crest's edge, emerald lenses and pale gold * drives. The wine is lifted a step and lacquered so its curves carry highlights, the frame is a darker, less * metallic steel so the plates keep a value step above it in shade too (docs/study-atelier.md). */ houses: { ...base, main: { ...paint('#781c33', 0.36, 0.5), lacquer: 0.45 }, accent: { ...paint('#ece3cc', 0.38, 0.4), lacquer: 0.4 }, trim: metal('#e6b84a', 0.3, 0.75), frame: metal('#4c5058', 0.55, 0.4), joint: metal('#3a3c42', 0.55, 0.9), metal: metal('#b5ab98', 0.3, 1), stencil: { color: '#e6dcc4', rough: 0.7, metal: 0 }, glow_eye: { color: '#4dffa6', glow: 4 }, // the reactor glow through the chest sides stays low, the lenses carry the green glow_core: { color: '#2fb877', glow: 0.7 }, glow_hot: { color: '#eafff2', glow: 2.6 }, glow_thruster: { color: '#ffe3a8', glow: 3 }, glow_exhaust: { color: '#ffcf6a', glow: 1 }, }, /** Automated pilotless frames: black and gunmetal shell, red only in lenses, seam lines and stencils. The * gunmetal is light enough to read as a block against the black at range. */ automaton: { ...base, main: paint('#1d1e23', 0.38), accent: paint('#5e646c', 0.34), metal: metal('#3e4046', 0.5, 0.8), trim: paint('#d12b35', 0.4), frame: metal('#2c2d33', 0.5), stencil: { color: '#c9c4b8', rough: 0.7, metal: 0 }, glow_eye: { color: '#ff2f3f', glow: 4.5 }, glow_core: { color: '#ff2f3f', glow: 5 }, glow_hot: { color: '#ffe4e4', glow: 2.6 }, glow_thruster: { color: '#ff9a7a', glow: 3 }, glow_exhaust: { color: '#ff3a2a', glow: 1 }, }, /** Raiders: sun-faded salvage in three donors' paint, primer patches, rust, hand paint. */ raider: { ...base, main: worn('#9c8550', 0.35), accent: worn('#5e2c22', 0.3), trim: worn('#c0561a', 0.3), frame: { ...metal('#4d4842', 0.6, 0.75), rust: 0.25 }, joint: metal('#2f2c29', 0.62, 0.85), metal: { ...metal('#8c8780', 0.45, 0.9), rust: 0.3 }, hazard: worn('#d9a92a', 0.3), donor_a: worn('#c6c3b8', 0.3), donor_b: worn('#3e566e', 0.3), donor_c: worn('#5c6143', 0.35)…389 tokens truncated…yScalar(200); sun.castShadow = true; sun.shadow.mapSize.set(2048, 2048); const c = sun.shadow.camera; c.left = c.bottom = -28; c.right = c.top = 28; c.near = 1; c.far = 500; sun.shadow.bias = -0.0004; sun.shadow.normalBias = 0.04; scene.add(sun); scene.add(sun.target); scene.add(new THREE.HemisphereLight('#8fa6d6', '#1c2436', 0.25)); const rim = new THREE.DirectionalLight('#9cc4ff', 1.6); rim.position.set(-sunDir.x, 0.35, -sunDir.z).multiplyScalar(200); rim.name = 'rim'; scene.add(rim); return sun; } /** Keep the shadow box centred on what matters (the player's frame). */ export function followSun(sun: THREE.DirectionalLight, focus: THREE.Vector3, sunDir = SUN_DIR) { sun.target.position.copy(focus); sun.position.copy(focus).addScaledVector(sunDir, 200); } -- export function spaceEnvironment(renderer: THREE.WebGLRenderer, backdrop: THREE.Scene, size = 256): THREE.Texture { const pmrem = new THREE.PMREMGenerator(renderer); const env = pmrem.fromScene(backdrop, 0.02, 1, 2e6, { size }).texture; pmrem.dispose(); return env; } 45:export function material(palette: Palette, role: Role, key: string): THREE.Material { 46- const l = look(); 47- const id = `${key}:${role}:${l.name}`; 48- const hit = cache.get(id); 49- if (hit) return hit; 50- const p = palette[role] ?? { color: '#ff00ff' }; 51- let m: THREE.Material; 52- if (p.glow) { 53- m = new THREE.MeshBasicMaterial({ color: new THREE.Color(p.color).multiplyScalar(p.glow) }); 54- } else { 55- // A floor on roughness: a near-mirror catching the sun makes a highlight brighter than the 56- // half-float buffers can hold, and the bloom smears that across the whole screen. 57- const painted = PAINT.has(role); 58- // a lacquered livery keeps its own finish under a matte look: its roughness at most, and a clear coat 59- const lacquer = painted ? p.lacquer ?? 0 : 0; 60- const paintRough = lacquer ? Math.min(l.paintRough, p.rough ?? l.paintRough) : l.paintRough; 61- const roughness = Math.max(0.2, painted ? paintRough : p.rough ?? 0.5); 62- const coat = painted ? Math.max(l.gloss ? 0.6 : 0, lacquer) : p.coat ?? 0; 63- const color = new THREE.Color(p.color); 64- if (painted && l.desaturate > 0) { 65- // weathered paint: pulled toward grey and warmed slightly, less so under lacquer 66- const grey = color.r * 0.3 + color.g * 0.59 + color.b * 0.11; 67- color.lerp(new THREE.Color(grey, grey, grey), l.desaturate * (1 - lacquer * 0.6)).multiply(new THREE.Color(1.0, 0.98, 0.94)); 68- } 69- if (l.toon) { 70- const t = new THREE.MeshToonMaterial({ color, gradientMap: toonBands() }); 71- t.name = role; 72- if (role === 'hazard') addStripes(t as unknown as THREE.MeshStandardMaterial); 73- cache.set(id, t); 74- return t; 75- } 76- const s = coat >= 0.5 77- ? new THREE.MeshPhysicalMaterial({ color, roughness, metalness: p.metal ?? 0, clearcoat: coat, clearcoatRoughness: 0.25 }) 78- : new THREE.MeshStandardMaterial({ color, roughness, metalness: p.metal ?? 0 }); -rw------- 1 runner runner 985K Nov 17 22:43 public/assets/striker.glb Tue Nov 17 23:09:14 UTC 2026exec_commandcat > kit/blocks/zero.py <<'PY'
command
cat > kit/blocks/zero.py <<'PY' """Frame 0. A pressure cabin between two open drive arches on the default block rig. Rebuild with npm run kit -- block_zero. Dimensions are in metres in Blender's rest pose. """ import math import bmesh import bpy from mathutils import Vector from lib import cylinder, loft, octo, solid from mech import nozzle_pair, pair RAD = math.pi / 180 def interp(values, t): """Cubic interpolation along hand-placed body sections.""" t = min(max(t, 0.), 1.) * (len(values) - 1) i = min(int(t), len(values) - 2) f = t - i a, b, c, d = (values[min(max(k, 0), len(values) - 1)] for k in (i-1, i, i+1, i+2)) return b + .5*f*(c-a + f*(2*a-5*b+4*c-d + f*(3*b-a-3*c+d))) def signed_power(v, exp): return math.copysign(abs(v) ** exp, v) def mesh(vertices, faces): bm = bmesh.new() vs = [bm.verts.new(v) for v in vertices] for facet in faces: bm.faces.new([vs[i] for i in facet]) bmesh.ops.recalc_face_normals(bm, faces=list(bm.faces)) return bm def path_tube(points, radii, sides=12, flat=1.0): """Oval structural members, routed in space, with a continuous local frame.""" points = [Vector(p) for p in points] verts, faces = [], [] for i, p in enumerate(points): tangent = (points[min(i+1,len(points)-1)] - points[max(i-1,0)]).normalized() across = Vector((1,0,0)) if abs(across.dot(tangent)) > .92: across = Vector((0,1,0)) across = (across - tangent*across.dot(tangent)).normalized() normal = tangent.cross(across) for j in range(sides): a = (j+.5)*2*math.pi/sides verts.append(p + radii[i]*(math.cos(a)*across + flat*math.sin(a)*normal)) if i: for j in range(sides): a = (i-1)*sides+j b = (i-1)*sides+(j+1)%sides faces.append([a,b,b+sides,a+sides]) faces.extend([list(range(sides)),list(range(len(verts)-sides,len(verts)))]) return mesh(verts,faces) class Skin: """A continuous pressure-formed surface. Separate tools trim plates out of this surface. Sections give z, centre x/y, half-width and fore/aft radii. Angle zero faces forward. """ def __init__(self, rows, exponent=.85): self.columns = list(zip(*rows)) self.exponent = exponent def point(self, t, angle, lift=0): z,x,y,w,front,back = (interp(v,t) for v in self.columns) si, co = math.sin(angle*RAD), math.cos(angle*RAD) return Vector((x+(w+lift)*signed_power(si,self.exponent), y-((front if co>0 else back)+lift)*signed_power(co,self.exponent), z)) def panel(self, lo, hi, start, end, lift=0, skew=0, hem=0, cap=0, depth=.085): # Each cut can cross stations on the diagonal, arch, or wrap around the part. n = max(4, math.ceil(abs(end-start)/12)) m = max(4, math.ceil((hi-lo)*18)) vs, fs = [], [] for k in range(2): for j in range(m+1): v=j/m for i in range(n+1): u=i/n edge=math.sin(math.pi*u) t=lo+(hi-lo)*v + edge*(hem*(1-v)+cap*v) vs.append(self.point(t,start+(end-start)*u+skew*v,lift-depth*k)) stride=n+1 count=(m+1)*stride for j in range(m): for i in range(n): a=j*stride+i q=[a,a+1,a+1+stride,a+stride] fs.extend([q,[v+count for v in reversed(q)]]) edge=(list(range(n+1))+[j*stride+n for j in range(1,m+1)] +[m*stride+i for i in reversed(range(n))] +[j*stride for j in reversed(range(1,m))]) for a,b in zip(edge,edge[1:]+edge[:1]): fs.append([a,b,b+count,a+count]) return mesh(vs,fs) class Frame: def __init__(self, blocks): self.j = blocks.nodes def put(self, name, joint, bm, role, bevel=0, smooth=True): kw = dict(panels=False, smooth=smooth, bevel=bevel, segs=2) if joint+'.L' in self.j: return pair(name,bm,role,self.j[joint+'.L'],self.j[joint+'.R'],**kw) return solid(name,bm,role,self.j[joint],**kw) def skin(self, name, joint, body, lo, hi, a, b, role, **kw): return self.put(name,joint,body.panel(lo,hi,a,b,**kw),role) def tube(self, name, joint, points, radii, role, sides=12, flat=1): return self.put(name,joint,path_tube(points,radii,sides,flat),role) def axle(self, name, joint, x, y, z, radius, width): for suffix,r,length,role in [('bearing',radius,width,'joint'), ('rim',radius*.81,width+.09,'metal'),('hub',radius*.64,width+.16,'frame'), ('spindle',radius*.29,width+.20,'metal'),('key',radius*.14,width+.23,'trim')]: self.put(name+'_'+suffix,joint,cylinder(r,x-length/2,x+length/2,28,axis='x',at=(y,z)),role,.012) def plate(self,name,joint,outline,crown,inside,role): """Cambered forging. The crown and return flange follow the actual 3D boundary.""" pts=[Vector(p) for p in outline] c=Vector(crown) d=Vector(inside) n=len(pts) vs=[p+d for p in pts] + pts + [p.lerp(c,.17)-d*.33 for p in pts] + [p.lerp(c,.70)-d*.13 for p in pts] + [c] fs=[list(range(n))] for row in range(3): for i in range(n): j=(i+1)%n fs.append([row*n+i,row*n+j,(row+1)*n+j,(row+1)*n+i]) fs.extend([[3*n+i,3*n+(i+1)%n,4*n] for i in range(n)]) return self.put(name,joint,mesh(vs,fs),role,.024) def rail(self,name,joint,a,b,r,role): self.tube(name,joint,[a,b],[r,r],role) def hull(self,name,joint,s,role='frame'): # Two half skins keep a well-defined longitudinal parting line. for a in (-180,0): self.skin(name+str(a),joint,s,0,1,a,a+180,role,lift=-.08,depth=.10) def drives(f): # A swept outer bow loops back onto the nozzle collar. The intake is open all the # way through: the inner graphite spar is visible against space from the chase view. spine=[(.87,2.12,14.72),(1.04,2.06,15.53),(1.37,2.16,16.02), (1.97,2.55,16.37),(2.58,3.11,16.44),(2.93,3.61,16.16), (2.94,3.83,15.58),(2.60,3.97,14.74),(2.08,3.91,13.84), (1.65,3.63,13.08),(1.40,3.32,12.82)] f.tube('arched_drive_case','binder',spine,[.30,.35,.36,.36,.34,.32,.31,.32,.36,.40,.36],'main',18,.70) inner=[(.90,2.13,14.7),(.86,2.30,15.12),(1.08,2.74,15.23), (1.48,3.13,14.86),(1.64,3.4,14.1),(1.49,3.42,13.25)] f.tube('intake_divider','binder',inner,[.25,.25,.29,.28,.34,.43],'accent',14,.7) for i in range(3): # Airfoil vanes tie the two faces over the lower half of the open throat. z=13.52+i*.29 f.tube('intake_vane'+str(i),'binder',[(1.50,3.40,z),(1.72+i*.10,3.66,z+.15),(1.92+i*.18,3.84,z+.30)], [.044,.07,.044],'metal',8,1.7) f.tube('ceramic_hot_section','binder',spine[7:],[.34,.39,.42,.38],'accent',18,.72) for i in (3,5,7): a,b=Vector(spine[i]),Vector(spine[i+1]) f.tube('bow_joint'+str(i),'binder',[a.lerp(b,.27),a.lerp(b,.38)],[.365 if i<5 else .338]*2,'frame',16,.74) f.tube('drive_trunnion_yoke','backpack',[(.45,1.27,14.13),(.8,1.77,14.4),(1.04,2.34,14.6)],[.39,.42,.36],'frame') f.axle('gimbal','binder',.95,2.24,14.72,.48,.68) f.tube('motor_barrel','binder',[(1.13,2.32,14.28),(1.20,2.62,13.67),(1.39,3.2,12.89)], [.42,.57,.60],'joint',24) for i in range(5): t=i/5 a=Vector((1.19+.16*t,2.55+.55*t,13.8-.76*t)) b=a+Vector((.012,.06,-.075)) f.tube('compressor_ring'+str(i),'binder',[a,b],[.55+.08*t]*2,'metal',24) nozzle_pair('main',(1.4,3.17,13.01),(.12,.72,-.78),.62,.76,f.j['binder.L'],f.j['binder.R'],housing=False) # A single central spine on the fixed backpack, with a recessed boarding collar. f.tube('dorsal_spine','backpack',[(0,1.08,12.05),(0,1.60,12.62),(0,1.72,13.51)], [.44,.61,.54],'frame',16,.64) for i in range(6): z=12.12+i*.17 f.plate('rear_heat_louver'+str(i),'backpack',[(-.53,1.47,z),(-.45,2.03,z-.07),(.45,2.03,z-.07),(.53,1.47,z)], (0,1.75,z+.10),(0,0,-.038),'metal' if i in (0,5) else 'accent') def torso(f): body=Skin([(11.54,0,0,.62,.57,.53),(12.04,0,0,.88,.76,.67), (12.80,0,0,1.26,1.03,.94),(13.7,0,.02,1.73,1.31,1.12), (14.42,0,.04,1.95,1.20,1.17),(14.90,0,.05,1.56,.90,1.02),(15.21,0,0,.72,.60,.66)],.78) # Open at the rear between the cargo rails; the cockpit's pressure shell occupies that gap. for sign in (-1,1): def p(name,lo,hi,a,b,role,**kw): f.skin(name+str(sign),'torso',body,lo,hi,sign*a,sign*b,role,**kw) p('chest_casting',.02,.99,0,138,'frame',lift=-.09) p('breast_fairing',.34,.91,3,77,'main',skew=10,hem=.085,cap=.055,lift=.06) p('collar_blade',.88,.993,7,102,'accent',skew=-5,lift=.085) p('flank_housing',.35,.88,85,140,'accent',hem=.13,lift=.045) p('pectoralis_border',.32,.35,4,75,'trim',hem=.083,cap=.081,lift=.05) for i in range(3): p('costal_lame'+str(i),.015+i*.107,.119+i*.107,8,140,'main' if i==2 else 'accent', skew=5,hem=.04,cap=.04,lift=.035) p('chest_inlay',.65,.815,21,27,'accent',skew=22,lift=.077,depth=.015) for i in range(4): p('side_slot'+str(i),.53+i*.065,.553+i*.065,91,123,'joint',skew=-3,lift=.058,depth=.022) # Crew capsule: the front windscreen and rear pressure hatch are two ends of one volume. f.plate('forward_pressure_glass','torso',[(-.31,-1.13,13.12),(-.57,-1.26,14.04),(-.41,-1.01,14.82), (.41,-1.01,14.82),(.57,-1.26,14.04),(.31,-1.13,13.12)],(0,-1.45,14.04),(0,.1,0),'visor') for s in (-1,1): f.tube('canopy_sill'+str(s),'torso',[(s*.32,-1.15,13.10),(s*.59,-1.29,14.06),(s*.42,-1.04,14.86)], [.075,.094,.075],'metal',10) f.plate('rear_pressure_vessel','torso',[(-.67,.69,13.03),(-.79,1.09,14.30),(-.62,1.00,15.03),(.62,1.00,15.03), (.79,1.09,14.30),(.67,.69,13.03)],(0,1.65,14.14),(0,-.36,0),'joint') f.plate('boarding_hatch','torso',[(-.53,1.44,13.41),(-.64,1.43,14.33),(-.37,1.29,14.86), (.37,1.29,14.86),(.64,1.43,14.33),(.53,1.44,13.41)],(0,1.82,14.1),(0,-.14,0),'main') for s in (-1,1): f.rail('boarding_rail'+str(s),'torso',(s*.71,1.48,13.26),(s*.69,1.51,14.58),.058,'trim') f.plate('rear_hatch_viewport','torso',[(-.40,1.69,14.20),(-.28,1.58,14.5),(.28,1.58,14.5),(.40,1.69,14.2)],(0,1.78,14.36),(0,-.04,0),'visor') f.rail('rear_hatch_light','torso',(-.21,1.786,14.34),(.21,1.786,14.34),.025,'glow_eye') for i in range(3): z=13.40+i*.17 f.rail('hatch_tread'+str(i),'torso',(-.28,1.73,z),(.28,1.73,z),.047,'frame') for i in range(4): z=10.93+i*.24 w=.79+.055*i f.put('abdominal_seal'+str(i),'waist',loft([(z,octo(w*2,1.37,.30)),(z+.09,octo(w*2+.08,1.43,.30)), (z+.2,octo(w*2-.12,1.25,.27))]),'joint' if i%2 else 'frame',.025) pelvis=Skin([(9.87,0,0,.65,.68,.6),(10.24,0,0,1.20,.94,.88),(10.68,0,0,1.47,.99,.92), (10.99,0,0,1.12,.78,.76)],.78) f.hull('pelvic_frame','pelvis',pelvis) for s in (-1,1): for name,lo,hi,a,b,r in [('belt',.61,.98,4,149,'main'),('hip_shield',.05,.61,32,142,'accent'),('sacral_leaf',.16,.96,146,178,'main')]: f.skin(name+str(s),'pelvis',pelvis,lo,hi,a*s,b*s,r,skew=-5*s,hem=.065,lift=.05) def head(f): f.tube('cervical_boot','neck',[(0,0,15.06),(0,.07,15.56),(0,-.03,15.94)],[.43,.39,.36],'joint',20) h=Skin([(15.70,0,-.13,.28,.46,.38),(15.92,0,-.15,.50,.66,.54),(16.31,0,-.05,.62,.79,.65), (16.71,0,.03,.68,.88,.73),(17.00,0,.10,.60,.80,.66),(17.25,0,.15,.41,.58,.49), (17.35,0,.17,.18,.24,.20)],.85) f.hull('scanner_recess','head',h,'visor') for s in (-1,1): f.skin('scanner_hood'+str(s),'head',h,.51,.99,1*s,152*s,'main',hem=-.07,skew=15*s,lift=.075) f.skin('temple_laminate'+str(s),'head',h,.21,.54,68*s,154*s,'accent',hem=.04,lift=.09) f.skin('mandible'+str(s),'head',h,.03,.36,5*s,79*s,'main',hem=.04,cap=-.065,lift=.045) f.skin('optical_bar'+str(s),'head',h,.411,.448,6*s,56*s,'glow_eye',skew=2*s,lift=-.04) f.skin('occipital_shell'+str(s),'head',h,.15,.95,155*s,179*s,'accent',lift=.035) f.tube('single_telemetry_spar','head',[(-.49,.31,16.40),(-.61,.46,16.79),(-.68,.67,17.25),(-.71,.74,17.60)], [.09,.073,.046,.017],'metal',10) for i in range(3): f.rail('nape_grille'+str(i),'head',(-.29,.69,16.21+i*.13),(.29,.69,16.21+i*.13),.038,'metal') PYresult, 4 lines
Script completed Wall time 0.1 seconds Output: {"chunk_id":"54da36","wall_time_seconds":0.00000412,"exit_code":0,"original_token_count":0,"output":""}exec_commandcat >> kit/blocks/zero.py <<'PY'
command
cat >> kit/blocks/zero.py <<'PY' def arms(f): # The shoulder roof cantilevers out over a sunken trunnion. Its low trailing # corner curls under the arm; the outer edge never describes a straight box. f.axle('shoulder_rotor','shoulder',2.08,0,14.60,.65,.92) roof=Skin([(14.02,2.47,.09,.48,.71,.62),(14.31,2.58,.05,.77,.99,1.04), (14.78,2.59,.03,.89,1.15,1.18),(15.15,2.45,.16,.78,1.00,1.11), (15.42,2.28,.26,.53,.73,.76),(15.51,2.23,.30,.20,.34,.29)],.78) f.hull('pauldron_inner','shoulder',roof) f.skin('pauldron_nose','shoulder',roof,.20,.985,-88,64,'main',skew=-14,hem=.08,lift=.07) f.skin('pauldron_aft','shoulder',roof,.07,.985,69,227,'accent',skew=-14,cap=-.03,hem=.12,lift=.08) f.skin('pauldron_inboard','shoulder',roof,.25,.98,-126,-92,'main',skew=-15,lift=.06) f.skin('pauldron_lower_lip','shoulder',roof,.025,.18,-72,79,'accent',hem=.05,cap=.07,lift=.07) for i in range(3): f.skin('shoulder_extractor'+str(i),'shoulder',roof,.33+i*.105,.375+i*.105,109,178,'joint',lift=.105,hem=.022,cap=.023) upper=Skin([(12.17,2.5,0,.35,.38,.42),(12.67,2.49,.03,.48,.56,.47),(13.43,2.47,.08,.59,.66,.60), (14.08,2.43,0,.46,.54,.53),(14.45,2.43,0,.30,.41,.35)],.84) f.hull('brachial_core','upperarm',upper) f.skin('biceps_leaf','upperarm',upper,.07,.90,-67,99,'main',skew=-20,hem=.09,cap=.03) f.skin('triceps_leaf','upperarm',upper,.22,.98,107,228,'accent',skew=-12,hem=.10) f.axle('elbow','forearm',2.49,0,11.97,.43,.90) f.tube('elbow_flexor','upperarm',[(2.70,.26,13.30),(2.78,.42,12.72),(2.73,.38,12.12)], [.13,.15,.087],'metal',12) vambrace=Skin([(9.73,2.5,-.04,.32,.39,.40),(10.04,2.52,-.07,.41,.61,.48), (10.62,2.55,-.08,.55,.72,.57),(11.32,2.55,.02,.63,.68,.62), (11.78,2.5,.08,.50,.48,.58),(12.12,2.51,.13,.32,.36,.40)],.72) f.hull('forearm_chassis','forearm',vambrace) f.skin('forearm_outboard','forearm',vambrace,.075,.93,8,147,'main',skew=-15,cap=.04,hem=.075,lift=.06) f.skin('forearm_knuckle_side','forearm',vambrace,.14,.83,-113,3,'accent',skew=-13,cap=.08,hem=.09,lift=.05) f.skin('forearm_trailing_splint','forearm',vambrace,.27,.98,150,241,'accent',skew=-10,lift=.10) f.skin('gauntlet_identification','forearm',vambrace,.46,.82,49,62,'accent',skew=-11,lift=.071,depth=.012) for i in range(2): f.skin('forearm_latch'+str(i),'forearm',vambrace,.32+i*.40,.357+i*.40,133,146,'trim',lift=.083,depth=.026) f.tube('wrist_coupling','hand',[(2.50,0,9.43),(2.50,0,9.78)],[.33,.34],'joint',20) palm=Skin([(8.97,2.5,0,.27,.43,.36),(9.12,2.5,0,.34,.46,.41),(9.48,2.5,.02,.36,.41,.35),(9.66,2.50,.01,.22,.29,.24)]) f.hull('palm','hand',palm) f.skin('hand_back','hand',palm,.06,.95,12,163,'main',skew=-6,lift=.035) for i in range(4): y=-.28+i*.19 end=8.55+abs(i-1.2)*.065 f.tube('finger'+str(i),'hand',[(2.59,y,9.17),(2.64,y,8.93),(2.56,y-.015,end+.11),(2.41,y-.035,end)], [.109,.113,.096,.064],'frame',8,.84) f.tube('digit_cap'+str(i),'hand',[(2.65,y,9.05),(2.67,y,8.92)],[.112,.106],'metal',8,.82) f.tube('opposed_thumb','hand',[(2.40,-.35,9.40),(2.27,-.45,9.15),(2.24,-.43,8.93),(2.30,-.35,8.86)], [.145,.135,.106,.08],'joint',10) def legs(f): f.axle('hip','thigh',1.14,.01,10.49,.58,.94) thigh=Skin([(6.31,1.21,.025,.41,.50,.50),(6.74,1.23,.02,.55,.68,.64), (7.63,1.26,.01,.67,.86,.80),(8.73,1.25,.04,.83,.97,.96), (9.62,1.19,.075,.84,.89,.90),(10.35,1.15,.02,.53,.65,.66)],.79) f.hull('femoral_spar','thigh',thigh) f.skin('femoral_keel','thigh',thigh,.04,.95,-46,64,'main',skew=12,hem=.065,cap=-.055,lift=.065) f.skin('thigh_outer_cuirass','thigh',thigh,.16,.94,69,149,'accent',skew=10,hem=.07,cap=.035,lift=.105) f.skin('hamstring_guard','thigh',thigh,.20,.92,154,227,'main',skew=7,hem=.08,lift=.06) f.skin('adductor_cover','thigh',thigh,.26,.95,-122,-52,'accent',skew=7,hem=.05) f.skin('outer_thigh_trace','thigh',thigh,.46,.80,89,98,'main',skew=11,lift=.119,depth=.017) for i in range(3): f.skin('thigh_vent'+str(i),'thigh',thigh,.39+i*.106,.42+i*.106,177,212,'frame',skew=4,lift=.078,depth=.029) f.axle('knee_bearing','shin',1.20,0,6.11,.61,1.19) shin=Skin([(1.61,1.20,.12,.33,.44,.44),(2.10,1.21,.04,.44,.61,.55), (3.08,1.23,-.04,.52,.83,.74),(4.18,1.24,-.02,.70,.98,.94), (5.05,1.22,.09,.77,.87,1.00),(5.68,1.21,.05,.61,.70,.74),(6.08,1.20,0,.38,.42,.45)],.76) f.hull('tibial_spar','shin',shin) f.skin('greave_long_nose','shin',shin,.025,.86,-60,46,'main',skew=14,hem=.025,cap=.09,lift=.09) f.skin('greave_outer_keel','shin',shin,.13,.93,52,132,'accent',skew=12,hem=.07,lift=.065) f.skin('greave_inner_lame','shin',shin,.20,.93,-120,-66,'main',skew=13,hem=.085,lift=.04) f.skin('calf_dorsal_shell','shin',shin,.43,.97,142,227,'main',skew=-5,hem=.09,cap=-.04,lift=.13) f.skin('greave_outer_trim','shin',shin,.53,.75,75,84,'trim',skew=11,lift=.086,depth=.022) f.plate('floating_patella','shin',[(.65,-.41,6.24),(.85,-.43,6.70),(1.32,-.49,6.84),(1.75,-.36,6.35), (1.68,-.64,5.96),(1.31,-.92,5.44),(.88,-.80,5.74)],(1.22,-1.15,6.18),(0,.23,0),'main') for i in range(3): f.skin('calf_extractor'+str(i),'shin',shin,.55+i*.092,.584+i*.092,156,210,'joint',skew=-4,lift=.15,depth=.035) # The heel is suspended from two raked tendons visible below the calf shell. for i in (-1,1): x=1.2+i*.24 f.tube('achilles_body'+str(i),'shin',[(x,.52,2.82),(x,.85,3.46),(x,.98,4.24)], [.12,.17,.17],'frame') f.rail('achilles_rod'+str(i),'shin',(x,.38,1.63),(x,.59,2.94),.080,'metal') f.axle('ankle_bearing','foot',1.20,.095,1.54,.40,.91) # Split sole, toe rocker, heel brake. Their contact faces share a plane. for s in (-1,1): x=1.20+s*.27 outline=[(x-.23,-1.53,.22),(x-.18,-1.87,.30),(x+.11,-1.92,.32),(x+.25,-1.51,.23), (x+.24,-.51,.17),(x+.14,.39,.16),(x-.16,.45,.16),(x-.24,-.45,.17)] f.plate('toe_sole'+str(s),'foot',outline,(x,-.55,.46),(0,0,-.15),'joint') f.plate('toe_fairing'+str(s),'foot',[(x-.21,-1.54,.32),(x-.13,-1.81,.36),(x+.12,-1.84,.37), (x+.23,-1.46,.37),(x+.23,-.63,.56),(x+.12,-.52,.61),(x-.18,-.64,.58)],(x,-1.04,.65),(0,0,-.12),'main') f.plate('instep','foot',[(.69,-.64,.53),(.83,-1.05,.55),(1.45,-1.07,.55),(1.73,-.67,.57),(1.68,.30,1.11), (1.49,.48,1.40),(.92,.43,1.39),(.71,.20,1.03)],(1.22,-.21,1.48),(0,0,-.24),'accent') for n in range(3): y=-.68+n*.17 f.rail('instep_buckle'+str(n),'foot',(.98,y,.94+n*.115),(1.43,y,.94+n*.115),.037,'metal') f.tube('heel_shock','foot',[(1.20,.15,1.42),(1.20,.51,.94),(1.20,.93,.46)], [.27,.32,.35],'frame',12) f.plate('heel_pad','foot',[(.82,.45,.28),(1.59,.44,.28),(1.68,1.03,.28),(1.45,1.27,.27), (.91,1.22,.27),(.74,1.01,.27)],(1.18,.90,.61),(0,0,-.24),'joint') nozzle_pair('calf',(1.22,.88,4.26),(0,.61,-.82),.29,.43,f.j['shin.L'],f.j['shin.R'],housing=False) def crew(f): import figure from lib import empty eye=figure.points('bike')['eye'] eye_target=Vector((0,-.64,14.43)) origin=eye_target-eye loc=tuple(origin[:2]) pts=figure.pilot(f.j['torso'],at=loc,z=origin.z,n='crew',pose='bike',role='trim') seat=pts['seat'] f.tube('seat_bucket','torso',[seat+Vector((0,0,-.18)),seat+Vector((0,.025,-.02))],[.32,.34],'suit',16,1.27) f.tube('seat_back','torso',[seat+Vector((0,.19,-.05)),seat+Vector((0,.21,.30)),seat+Vector((0,.10,.66))], [.28,.26,.20],'frame',12,.39) for s in ('L','R'): grip=pts['grip.'+s] peg=pts['peg.'+s] f.rail('control_stick'+s,'torso',grip+Vector((0,-.06,-.28)),grip,.037,'metal') f.rail('footrest'+s,'torso',peg-Vector((.11,0,0)),peg+Vector((.11,0,0)),.033,'metal') empty('crew.eye',eye_target,f.j['torso'],seat='reclined') def build(Blocks): blocks=Blocks() f=Frame(blocks) f.j['frame']['frame']='zero' drives(f) torso(f) head(f) arms(f) legs(f) crew(f) finish_materials() def finish_materials(): """Write the same swatches into the portable GLB that are used in the comparison.""" import json from pathlib import Path swatches=json.loads(Path(__file__).with_name('zero-paint.json').read_text()) for role, spec in swatches.items(): mat=bpy.data.materials.get(role) if mat is None: continue rgb=[int(spec['color'][i:i+2],16)/255 for i in (1,3,5)] rgba=tuple((s/12.92 if s<=.04045 else ((s+.055)/1.055)**2.4) for s in rgb)+(spec.get('alpha',1),) mat.use_nodes=True bsdf=mat.node_tree.nodes.get('Principled BSDF') bsdf.inputs['Base Color'].default_value=rgba bsdf.inputs['Roughness'].default_value=spec.get('rough',.42) bsdf.inputs['Metallic'].default_value=spec.get('metal',.15) bsdf.inputs['Alpha'].default_value=rgba[3] if spec.get('glow'): bsdf.inputs['Emission Color'].default_value=rgba bsdf.inputs['Emission Strength'].default_value=spec['glow'] PY cat > kit/blocks/zero-paint.json <<'JSON' { "main": {"color":"#ddd7be","rough":0.34,"coat":0.4}, "accent": {"color":"#22625e","rough":0.35,"coat":0.55}, "trim": {"color":"#f0763d","rough":0.4}, "frame": {"color":"#38494c","metal":0.56,"rough":0.42}, "joint": {"color":"#222a2b","metal":0.4,"rough":0.52}, "metal": {"color":"#abb5ad","metal":0.83,"rough":0.31}, "visor": {"color":"#162e31","metal":0.45,"rough":0.17,"coat":0.8}, "canopy": {"color":"#426c70","alpha":0.32,"metal":0.16,"rough":0.13}, "stencil": {"color":"#f3e9cf","rough":0.64}, "suit": {"color":"#6c5145","rough":0.65}, "glow_thruster":{"color":"#b4f5ff","glow":3}, "glow_eye":{"color":"#ffbd70","glow":2.4} } JSON python - <<'PY' from pathlib import Path p=Path('kit/blocks/zero.py');s=p.read_text().replace("p('chest_casting',.02,.99,0,138","p('chest_casting',.02,.99,19,138").replace("p('breast_fairing',.34,.91,3,77","p('breast_fairing',.34,.91,19,77").replace("(0,-1.45,14.04),(0,.1,0),'visor'","(0,-1.45,14.04),(0,.06,0),'canopy'") p.write_text(s) PY /usr/bin/time -f '%e' -o review/out/form-zero/build-time ~/.local/bin/blender -b -t 6 --python-exit-code 1 -P kit/build.py -- block_zero > review/out/form-zero/build.log 2>&1result, 4 lines
Script completed Wall time 0.4 seconds Output: {"chunk_id":"978595","wall_time_seconds":0.250988765,"session_id":33122,"original_token_count":0,"output":""}exec_commanddate -u && tail -10 review/out/form-zero/build.log && ls -ld review/out/form-zero && cat src/render/mech.ts | sed -n '100,270p' && cat src/render/decals.ts | head -92 && cat package.json
command
date -u && tail -10 review/out/form-zero/build.log && ls -ld review/out/form-zero && cat src/render/mech.ts | sed -n '100,270p' && cat src/render/decals.ts | head -92 && cat package.json
result, 243 lines
Script completed Wall time 0.1 seconds Output: Tue Nov 17 23:14:03 UTC 2026 00:00.124 system.path | WARNING Could not get a list of mounted file-systems drwx------ 2 runner runner 4096 Nov 17 23:13 review/out/form-zero if (!dir || !/^nozzle/.test(o.name)) return; const kind: NozzleKind = /main/.test(o.name) ? 'main' : /binder/.test(o.name) ? 'binder' : 'calf'; const radius = (o.userData.radius as number) ?? 0.5; // the plume's own space is in nozzle radii (render/plume.ts) const plume = new THREE.Mesh(PLUME_HULL, this.plumeMats[kind]); const d = new THREE.Vector3(...(dir as [number, number, number])); plume.quaternion.setFromUnitVectors(new THREE.Vector3(0, 0, 1), d); plume.scale.setScalar(radius); plume.visible = false; plume.renderOrder = 2; o.add(plume); this.nozzles.push({ node: o, dir: d, radius, kind, plume }); }); } /** Any named node of the model (extras like harken.L), or null. */ node(name: string): THREE.Object3D | null { return find(nodes(this.root), name) ?? null; } /** Snap to a pose. */ apply(pose: Pose) { for (const [j, node] of this.joints) { const r = pose[j] ?? [0, 0, 0]; node.quaternion.setFromEuler(tmpE.set(r[0] * D, r[1] * D, r[2] * D)); } } /** Snap to a pose and measure how high its soles sit above the root, in world metres (root * upright). A crouch lifts the feet, so the frame drops by this much to stand on its clamps. */ soles(pose: Pose): number { this.apply(pose); this.root.updateMatrixWorld(true); const v = new THREE.Vector3(); let min = Infinity; for (const j of ['foot.L', 'foot.R'] as const) { this.joints.get(j)?.traverse((o) => { const p = (o as THREE.Mesh).isMesh ? (o as THREE.Mesh).geometry.attributes.position : null; if (!p) return; for (let i = 0; i < p.count; i++) min = Math.min(min, v.fromBufferAttribute(p, i).applyMatrix4(o.matrixWorld).y); }); } return Number.isFinite(min) ? min - this.root.getWorldPosition(v).y : 0; } /** Ease toward a blend of poses; weights need not sum to 1 (the rest is the rest pose). */ blend(poses: [Pose, number][], rate: number, dt: number) { const k = 1 - Math.exp(-rate * dt); for (const [j, node] of this.joints) { let x = 0, y = 0, z = 0; for (const [p, w] of poses) { const r = p[j]; if (r) { x += r[0] * w; y += r[1] * w; z += r[2] * w; } } let t = this.targets.get(j); if (!t) this.targets.set(j, (t = new THREE.Quaternion())); t.setFromEuler(tmpE.set(x * D, y * D, z * D)); node.quaternion.slerp(t, k); } } /** Turn one joint by an extra rotation on top of its current pose (aim, lean). */ add(j: Joint, x: number, y: number, z: number) { const n = this.joints.get(j); if (n) n.quaternion.multiply(tmpQ.setFromEuler(tmpE.set(x * D, y * D, z * D))); } /** Put a weapon in the right hand: barrel along the forearm, handle in the fist. */ hold(weapon: THREE.Object3D | null) { if (this.held && this.held !== weapon) this.held.removeFromParent(); this.held = weapon; if (!weapon) return; this.grip.add(weapon); weapon.position.set(0, 0, 0); weapon.quaternion.setFromEuler(tmpE.set(Math.PI / 2, 0, 0)); } /** Step the plumes from this frame's flight reading and draw them. `time` drives the turbulence. */ thrust(r: ThrustReading, time: number, dt: number) { this.exhaust.step(r, dt); for (const k of KINDS) setPlume(this.plumeMats[k], this.exhaust.plumes[k], time); for (const n of this.nozzles) n.plume.visible = plumeVisible(this.exhaust.plumes[n.kind]); } /** Put `light` at the burning plumes' weighted centre, as bright as they burn: the glow the * exhaust throws on the frame. A light costs every lit pixel, so a scene gives one to the player * and the nearest few frames at most, and keeps the count fixed (a change recompiles shaders). */ lightExhaust(light: THREE.PointLight, strength = 1) { let w = 0; _sum.set(0, 0, 0); const s = this.root.scale.x; for (const n of this.nozzles) { const p = this.exhaust.plumes[n.kind]; const k = (Math.min(1, p.level) * (1 + 0.5 * p.heavy) + 0.4 * p.flash) * (n.radius * s) ** 2; if (k <= 0 || !n.plume.visible) continue; // a little way downstream, where the plume is brightest n.plume.localToWorld(_at.set(0, 0, 2.5)); _sum.addScaledVector(_at, k); w += k; } light.visible = true; light.color.copy(this.exhaustColor).lerp(_white, 0.4); light.intensity = w > 0 ? w * 35 * strength : 0; if (w > 0) light.position.copy(_sum).divideScalar(w); } } import * as THREE from 'three'; import { DecalGeometry } from 'three/addons/geometries/DecalGeometry.js'; // Markings projected onto armour: unit numbers, designations, caution stencils, hazard bands and the // company emblem. Each decal is found by casting a ray at the rest pose, projected onto the mesh it // hits, and parented to that mesh so it moves with its joint. export type DecalKind = 'number' | 'stencil' | 'hazard' | 'emblem'; export interface DecalSpec { kind: DecalKind; text?: string; /** A point just off the surface, model space (three.js axes: +X the frame's left, +Z forward). */ at: [number, number, number]; /** Direction into the surface. */ dir: [number, number, number]; /** Width and height in metres. */ size: [number, number]; /** Roll around the surface normal, degrees. */ roll?: number; color?: string; } const textures = new Map<string, THREE.CanvasTexture>(); function texture(spec: DecalSpec): THREE.CanvasTexture { const key = `${spec.kind}:${spec.text ?? ''}:${spec.color ?? ''}:${spec.size.join('x')}`; const hit = textures.get(key); if (hit) return hit; const W = 512, H = Math.max(32, Math.round((512 * spec.size[1]) / spec.size[0])); const c = document.createElement('canvas'); c.width = W; c.height = H; const g = c.getContext('2d')!; const ink = spec.color ?? '#20242a'; g.fillStyle = ink; g.strokeStyle = ink; g.textAlign = 'center'; g.textBaseline = 'middle'; if (spec.kind === 'hazard') { g.fillStyle = '#e2b42a'; g.fillRect(0, 0, W, H); g.fillStyle = '#15171a'; for (let x = -H; x < W + H; x += H * 1.4) { g.beginPath(); g.moveTo(x, H); g.lineTo(x + H * 0.7, H); g.lineTo(x + H * 1.4, 0); g.lineTo(x + H * 0.7, 0); g.fill(); } } else if (spec.kind === 'emblem') { const r = Math.min(W, H) * 0.42; g.lineWidth = r * 0.12; g.beginPath(); g.arc(W / 2, H / 2, r, 0, Math.PI * 2); g.stroke(); g.beginPath(); g.moveTo(W / 2 - r * 0.55, H / 2 - r * 0.25); g.lineTo(W / 2, H / 2 + r * 0.45); g.lineTo(W / 2 + r * 0.55, H / 2 - r * 0.25); g.lineTo(W / 2 + r * 0.3, H / 2 - r * 0.25); g.lineTo(W / 2, H / 2 + r * 0.05); g.lineTo(W / 2 - r * 0.3, H / 2 - r * 0.25); g.closePath(); g.fill(); } else { const size = spec.kind === 'number' ? H * 0.92 : H * 0.62; g.font = `600 ${size}px "Chakra Petch", "Arial Narrow", sans-serif`; g.fillText(spec.text ?? '', W / 2, H / 2 + size * 0.04, W * 0.96); if (spec.kind === 'stencil') { // stencil bridges: thin vertical breaks through the letters g.globalCompositeOperation = 'destination-out'; for (let x = W * 0.08; x < W; x += W / Math.max(4, (spec.text ?? '').length)) g.fillRect(x, 0, W * 0.006, H); g.globalCompositeOperation = 'source-over'; } } // wear: knock speckles out of the paint g.globalCompositeOperation = 'destination-out'; let s = key.length * 9973; const rnd = () => ((s = (s * 16807) % 2147483647) / 2147483647); for (let i = 0; i < (W * H) / 900; i++) { g.globalAlpha = 0.3 + rnd() * 0.7; g.fillRect(rnd() * W, rnd() * H, 1 + rnd() * 3, 1 + rnd() * 2); } g.globalAlpha = 1; g.globalCompositeOperation = 'source-over'; const t = new THREE.CanvasTexture(c); t.colorSpace = THREE.SRGBColorSpace; t.anisotropy = 8; textures.set(key, t); return t; } const ray = new THREE.Raycaster(); { "name": "sortie", "private": true, "version": "0.1.0", "type": "module", "scripts": { "dev": "vite --host", "build": "tsc --noEmit && vite build", "typecheck": "tsc --noEmit", "test": "vitest run", "kit": "blender -b --factory-startup -P kit/build.py --", "shoot": "node tools/shoot.mjs", "outlines": "node tools/outlines.mjs", "clip": "node tools/clip.mjs", "artifact": "VITE_MODEL_EXT=glb.json vite build && node tools/artifact.mjs" }, "dependencies": { "@fontsource/chakra-petch": "^5.3.0", "@fontsource/share-tech-mono": "^5.3.0", "lil-gui": "^0.21.0", "three": "^0.186.1" }, "devDependencies": { "@gltf-transform/core": "4.5.1", "@gltf-transform/extensions": "4.5.1", "@gltf-transform/functions": "4.5.1", "@types/three": "^0.186.0", "meshoptimizer": "1.3.0", "playwright": "^1.64.1", "typescript": "^7.0.2", "vite": "^8.3.5", "vitest": "^5.0.5" } }exec_commandrg 'export function createBackdrop' src/render/space.ts -A23 && sed -n '92,160p' src/render/decals.ts && cat src/render/plume.ts | tail -35 && ls -l public/assets/block_zero.glb && tail -5 review/out/form-zero/build.log
command
rg 'export function createBackdrop' src/render/space.ts -A23 && sed -n '92,160p' src/render/decals.ts && cat src/render/plume.ts | tail -35 && ls -l public/assets/block_zero.glb && tail -5 review/out/form-zero/build.log
result, 87 lines
Script completed Wall time 0.1 seconds Output: Warning: truncated output (original token count: 1373) Total output lines: 112 export function createBackdrop(sunDir = SUN_DIR): THREE.Scene { const scene = new THREE.Scene(); scene.add(nebula(sunDir)); scene.add(stars(7000)); scene.add(planet(sunDir)); return scene; } /** * The nebula and planet shaders are noise-heavy and never change, so render them once into a cube * map and draw that as the background. Stars stay as live points so they stay sharp. */ export function bakeBackdrop(renderer: THREE.WebGLRenderer, backdrop: THREE.Scene, size = 1024): THREE.Scene { const target = new THREE.WebGLCubeRenderTarget(size, { type: THREE.HalfFloatType, generateMipmaps: false }); const cam = new THREE.CubeCamera(1, 2e6, target); const stars = backdrop.children.filter((o) => (o as THREE.Points).isPoints); for (const s of stars) s.visible = false; cam.update(renderer, backdrop); const baked = new THREE.Scene(); baked.background = target.texture; for (const s of stars) { s.visible = true; baked.add(s.clone()); } const ray = new THREE.Raycaster(); const helper = new THREE.Object3D(); export function applyDecals(root: THREE.Object3D, specs: DecalSpec[]) { root.updateMatrixWorld(true); const meshes: THREE.Mesh[] = []; root.traverse((o) => { const m = o as THREE.Mesh; if (m.isMesh && !(m.material as THREE.MeshBasicMaterial).isMeshBasicMaterial && !m.userData.decal) meshes.push(m); }); for (const spec of specs) { const dir = new THREE.Vector3(...spec.dir).normalize(); const at = new THREE.Vector3(...spec.at).applyMatrix4(root.matrixWorld); ray.set(at.clone().addScaledVector(dir, -3), dir.clone().transformDirection(root.matrixWorld)); const hit = ray.intersectObjects(meshes, false)[0]; if (!hit?.face) continue; const mesh = hit.object as THRE…494 tokens truncated…ubleSide, uniforms: { uLen: { value: 1 }, uFlare: { value: 0 }, uPower: { value: 0 }, uCore: { value: 0 }, uDiamonds: { value: 0 }, uHeavy: { value: 0 }, uFlash: { value: 0 }, uRing: { value: 0 }, uRingA: { value: 0 }, uTime: { value: 0 }, uSeed: { value: seed }, uColor: { value: color.clone().multiplyScalar(brightness) }, // the core: the exhaust colour run almost to white uHot: { value: color.clone().lerp(new THREE.Color(1, 1, 1), 0.82).multiplyScalar(brightness) }, }, vertexShader, fragmentShader, }); } /** Copy a plume's numbers into its material. */ export function setPlume(m: THREE.ShaderMaterial, p: Plume, time: number) { const u = m.uniforms; // the length breathes a little, faster than the eye follows u.uLen.value = p.length * (0.96 + 0.04 * Math.sin(time * 53 + u.uSeed.value * 3)); u.uFlare.value = p.flare; // a fast flicker on top of the turbulence const flicker = 0.9 + 0.1 * Math.sin(time * 71.3 + u.uSeed.value); u.uPower.value = Math.min(1.5, p.level * 1.3 + 0.25 * p.flash) * flicker; u.uCore.value = p.core; u.uDiamonds.value = p.diamonds; u.uHeavy.value = p.heavy; u.uFlash.value = p.flash; u.uRing.value = p.ring; u.uRingA.value = p.ringA; // wrapped, so a long session keeps float precision in the noise (one invisible jump every 128 s) u.uTime.value = time % 128; } /** Whether a plume draws anything. */ export const plumeVisible = (p: Plume) => p.level > 0.01 || p.flash > 0.02 || p.ringA > 0.02; -rw------- 1 runner runner 3488136 Nov 17 23:14 public/assets/block_zero.glb kit: block_zero -> ~/work/sortie/public/assets/block_zero.glb (3406 KB, 16.3s) Blender 5.2.3 LTS (hash e13b728c6880 built 2026-10-22 01:35:05) Blender quitexec_commandrg 'position|rotation' src/render/space.ts && head -50 src/render/plume.ts && rg -A22 'return new THREE.ShaderMaterial|export function plumeMaterial' src/render/plume.ts && rg -n 'role|userData' kit/lib.py | head -20 && date -u
command
rg 'position|rotation' src/render/space.ts && head -50 src/render/plume.ts && rg -A22 'return new THREE.ShaderMaterial|export function plumeMaterial' src/render/plume.ts && rg -n 'role|userData' kit/lib.py | head -20 && date -u
result, 58 lines
Script completed Wall time 0.1 seconds Output: Warning: truncated output (original token count: 1294) Total output lines: 100 g.setAttribute('position', new THREE.BufferAttribute(pos, 3)); void main() { vDir = normalize(position); gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }`), vObj = normalize(position); vec4 wp = modelMatrix * vec4(position, 1.0); vec4 wp = modelMatrix * vec4(position, 1.0); g.position.set(-1.1e5, -2.6e5, 2.2e5); sun.position.copy(sunDir).multiplyScalar(200); rim.position.set(-sunDir.x, 0.35, -sunDir.z).multiplyScalar(200); sun.target.position.copy(focus); sun.position.copy(focus).addScaledVector(sunDir, 200); import * as THREE from 'three'; import type { Plume } from './exhaust'; // Thruster plumes drawn as a small volume: each nozzle gets one closed cylinder that bounds its // plume, and the fragment shader marches a few steps through it, summing a density made of a white // hot core (with shock diamonds), a coloured mantle that flares out and breaks up downstream, a // glow in the throat, an ignition flash and a shock ring. Because it is a volume it reads from any // angle, end on included, and has no hard cone edges. One draw call per nozzle, no textures. // // Plume space: the mesh is scaled by the nozzle radius, so one unit is one nozzle radius, the exit // is at z = 0 and the exhaust runs along +z. const Z0 = -0.6; const STEPS = 10; /** Past this many n…617 tokens truncated…er, fragmentShader, }); } /** Copy a plume's numbers into its material. */ export function setPlume(m: THREE.ShaderMaterial, p: Plume, time: number) { const u = m.uniforms; // the length breathes a little, faster than the eye follows u.uLen.value = p.length * (0.96 + 0.04 * Math.sin(time * 53 + u.uSeed.value * 3)); u.uFlare.value = p.flare; 10:Every solid gets a material role (main, accent, frame, glow_eye, ...). The game maps roles to toon 46:def material(role): 47: m = bpy.data.materials.get(role) 49: m = bpy.data.materials.new(role) 50: c = PREVIEW.get(role, (0.7, 0.7, 0.7)) 176:def solid(name, bm, role, parent=None, bevel=0.0, segs=1, angle=40, smooth=False, outline=True, panels=None): 177: """Turn a bmesh into an object with a material role, an optional chamfer on edges sharper than 178: `angle`, flat or smooth shading, parented to a joint without moving. Armour roles get panel 183: me.materials.append(material(role)) 195: panels = role in ("main", "accent", "hull") and not smooth 232:def boolean(target, cutter_bm, op="DIFFERENCE", role=None): 233: """Cut (or intersect/union) a solid object with a bmesh volume. With a role, the faces the cutter 238: if role is not None: 239: me.materials.append(material(role)) 247: if role is not None: Tue Nov 17 23:14:47 UTC 2026exec_commanddate -u +'%s comparison camera and first proof' >> review/out/form-zero/stages
command
date -u +'%s comparison camera and first proof' >> review/out/form-zero/stages cat > review/form-zero/screen.html <<'HTML' <!doctype html><html lang="en"><meta charset="utf-8"><base href="/"><title>Frame comparison capture</title><style>*{margin:0}body{background:#0a1517}canvas{display:block}</style><canvas id="film"></canvas><script type="module" src="/review/form-zero/screen.js"></script></html> HTML cat > review/form-zero/screen.js <<'JS' import * as THREE from 'three'; import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; import { model } from '/src/render/assets.ts'; import { applyDecals, STRIKER_DECALS } from '/src/render/decals.ts'; import { material } from '/src/render/materials.ts'; import { PALETTES } from '/src/render/palette.ts'; import { MechRig, POSES, JOINTS } from '/src/render/mech.ts'; import { setLook } from '/src/render/look.ts'; import { bakeBackdrop, createBackdrop } from '/src/render/space.ts'; import { benchInput } from '/src/view/thrusters.ts'; import swatches from '/kit/blocks/zero-paint.json'; import '@fontsource/chakra-petch/600.css'; import '@fontsource/share-tech-mono/400.css'; setLook('kit'); const params = new URLSearchParams(location.search); const W = Number(params.get('w') ?? 1600), H = Math.round(W*9/16); const film = document.querySelector('#film'); film.width=W; film.height=H; const ctx=film.getContext('2d',{alpha:false}); const scale=W/1600, viewportW=W/2, viewportH=Math.round(806*scale); const renderer=new THREE.WebGLRenderer({antialias:true,alpha:true,preserveDrawingBuffer:true,powerPreference:'high-performance'}); renderer.setSize(viewportW,viewportH,false); renderer.setClearColor(0x000000,0); renderer.autoClear=false; renderer.shadowMap.enabled=true; renderer.shadowMap.type=THREE.PCFShadowMap; renderer.toneMapping=THREE.ACESFilmicToneMapping; renderer.toneMappingExposure=1.1; const camera=new THREE.PerspectiveCamera(27,viewportW/viewportH,.2,2000); const skyCam=new THREE.PerspectiveCamera(55,viewportW/viewportH,1,2e6); const backdrop=bakeBackdrop(renderer,createBackdrop(),192); const scene=new THREE.Scene(); const pmrem=new THREE.PMREMGenerator(renderer); const studio=new RoomEnvironment(); scene.environment=pmrem.fromScene(studio,.03,0.1,100,{size:128}).texture; scene.environmentIntensity=.71; pmrem.dispose(); studio.dispose(); const key=new THREE.DirectionalLight('#fff3de',2.35); key.castShadow=true; key.shadow.mapSize.set(1024,1024); Object.assign(key.shadow.camera,{left:-12,right:12,top:12,bottom:-12,near:.1,far:100}); key.shadow.normalBias=.035; key.shadow.bias=-.0003; scene.add(key,key.target); const rim=new THREE.DirectionalLight('#c4eeff',2.1); scene.add(rim,rim.target,new THREE.HemisphereLight('#e8f1f2','#596567',.80)); const floor=new THREE.Mesh(new THREE.PlaneGeometry(120,120),new THREE.ShadowMaterial({opacity:.22})); floor.rotation.x=-Math.PI/2;floor.receiveShadow=true;scene.add(floor); const [zero,striker]=await Promise.all([model('block_zero','admin'),model('striker','merc')]); const palette={...PALETTES.admin,...swatches}; zero.traverse(o=>{ if(o.isMesh && swatches[o.userData.role] && o.userData.role!=='canopy') o.material=material(palette,o.userData.role,'zero-study'); }); // The stock number and service decals on S are part of the control. applyDecals(striker, STRIKER_DECALS); applyDecals(zero, [ {kind:'number',text:'0',at:[-2.6,14.8,1],dir:[0,0,-1],size:[.75,.60],color:'#163e3b'}, {kind:'number',text:'0',at:[2.6,14.8,-1.05],dir:[0,0,1],size:[.68,.57],color:'#f5e7c6'}, {kind:'stencil',text:'LIFT',at:[0,13.9,-1.7],dir:[0,0,1],size:[.49,.15],color:'#173a37'}, {kind:'stencil',text:'ACCESS',at:[1.22,4.5,.95],dir:[0,0,-1],size:[.58,.15],color:'#183e3b'}, ]); const rigs=[new MechRig(zero),new MechRig(striker)]; const spill=new THREE.PointLight(0xffffff,0,0,2); scene.add(zero,striker,spill); for(const rig of rigs) { if(rig.joints.size!==JOINTS.length || !rig.nozzles.length) throw Error('Incomplete frame rig'); } await Promise.all([document.fonts.load('600 32px "Chakra Petch"'),document.fonts.load('400 20px "Share Tech Mono"')]); const dur=16, fps=24, flightEnd=4, turnEnd=12.5; const ease=t=>t*t*(3-2*t); const toRadians=THREE.MathUtils.degToRad; function stateAt(t) { if(t<.85)return ['cruise',0]; if(t<2.45)return ['boost',.85]; if(t<2.92)return ['quick',2.45]; if(t<flightEnd)return ['cruise',2.92]; return ['idle',flightEnd]; } let lastTime=-1; function feed(t) { // Fixed steps give the game exhaust a reproducible ignition and decay at each cut. if(t<lastTime) throw Error('Capture frames must advance'); let start=lastTime<0?-.5:lastTime; while(start<t-1e-7) { const dt=Math.min(1/120,t-start), clock=start+dt; const [name,begin]=stateAt(clock); const f=benchInput(name,Math.max(0,clock-begin)); const reading={x:f.thrust.x,y:f.thrust.y,z:f.thrust.z,boosting:f.boosting,quick:f.quick,assault:f.assault}; for(const rig of rigs)rig.thrust(reading,clock+.5,dt); start=clock; } lastTime=t; } function render(t) { feed(t); const flight=t<flightEnd, turning=!flight&&t<turnEnd; const u=Math.min(1,Math.max(0,(t-flightEnd)/(turnEnd-flightEnd-1/fps))); const detail=Math.min(1,Math.max(0,(t-turnEnd)/(dur-turnEnd))); const yaw=flight ? 160+12*Math.sin(t*1.15) : turning ? 180+360*u : 37-57*ease(detail); const pitch=flight ? 11+2*Math.sin(t) : turning ? 7 : 9; const target=new THREE.Vector3(0,flight?8.5:turning?8.7:14.03,0); const distance=flight?43:turning?41:17.2; const angle=toRadians(yaw), elevation=toRadians(pitch); camera.position.set(Math.sin(angle)*Math.cos(elevation),Math.sin(elevation),Math.cos(angle)*Math.cos(elevation)).multiplyScalar(distance).add(target); camera.lookAt(target); // Both panes see the exact same camera matrix, environment, exposure and lights. key.position.set(Math.sin(angle+.71)*20,28,Math.cos(angle+.71)*20); key.target.position.set(0,9,0); rim.position.set(Math.sin(angle-2.2)*19,19,Math.cos(angle-2.2)*19); rim.target.position.set(0,10,0); floor.visible=!flight; const [state]=stateAt(t); ctx.setTransform(scale,0,0,scale,0,0); ctx.fillStyle='#11232a';ctx.fillRect(0,0,1600,900); for(let i=0;i<2;i++) { const root=rigs[i].root,rig=rigs[i]; zero.visible=i===0;striker.visible=i===1; rig.apply(flight?POSES.flight:POSES.stand); root.rotation.set(flight?.045:0,0,flight?.065*Math.sin(t*1.15):0); root.position.set(0,flight?.18*Math.sin(t*2.3):0,0); root.updateMatrixWorld(true); if(!flight)for(const n of rig.nozzles)n.plume.visible=false; rig.lightExhaust(spill); renderer.clear(); if(flight) { skyCam.rotation.set(-.43+Math.sin(t*1.1)*.035,-2.91+.12*Math.sin(t*1.15),.22+.07*Math.cos(t*1.15),'YXZ'); renderer.render(backdrop,skyCam);renderer.clearDepth(); } else { const grad=ctx.createLinearGradient(0,24,0,830); grad.addColorStop(0,'#b9c6c5');grad.addColorStop(.65,'#d4d8cf');grad.addColorStop(1,'#aab8b5'); ctx.fillStyle=grad;ctx.fillRect(i*800,0,800,806); } renderer.render(scene,camera); ctx.drawImage(renderer.domElement,i*800,0,800,806); } ctx.fillStyle=flight?'#4f686f':'#8e9f9d';ctx.fillRect(799,0,2,806); ctx.fillStyle='#11232a';ctx.fillRect(0,806,1600,94); ctx.fillStyle='#eddfbd';ctx.font='600 31px "Chakra Petch"'; ctx.fillText('0 / SPLIT KEEL',34,863); ctx.fillStyle='#d2dfde';ctx.fillText('S / STRIKER',834,863); ctx.font='400 20px "Share Tech Mono"';ctx.textAlign='right';ctx.fillStyle='#b5c9c6'; ctx.fillText(flight?'REAR FLIGHT / '+state.toUpperCase():turning?'FULL TURN / '+String(Math.round(360*u)).padStart(3,'0')+'°':'COCKPIT / CLOSE VIEW',1565,861); ctx.textAlign='left'; return film.toDataURL('image/jpeg',.95); } window.study={render,fps,frames:fps*dur,rigs:rigs.map(r=>({joints:r.joints.size,nozzles:r.nozzles.length}))}; JS cat > review/form-zero/capture.mjs <<'JS' import { chromium } from 'playwright'; import {createServer} from 'vite'; import {spawn} from 'node:child_process'; import {mkdir,writeFile} from 'node:fs/promises'; import {once} from 'node:events'; import {resolve,join} from 'node:path'; const proof=process.argv.includes('--proof'); const dest=resolve(process.argv[2]??'review/out/form-zero'); await mkdir(dest,{recursive:true}); const server=await createServer({configFile:false, cacheDir:resolve('review/out/form-zero/vite-cache'), server:{host:'127.0.0.1',port:0},logLevel:'error'}); await server.listen(); let browser,encoder; try{ browser=await chromium.launch({headless:true,args:['--use-angle=swiftshader','--enable-unsafe-swiftshader','--ignore-gpu-blocklist']}); const p=await browser.newPage();p.setDefaultTimeout(180000); const bad=[]; p.on('pageerror',e=>{bad.push(e.message);console.error(e.message);}); p.on('console',m=>{if(m.type()==='error'){bad.push(m.text());console.error(m.text());}}); await p.goto(server.resolvedUrls.local[0]+'review/form-zero/screen.html?w='+(proof?1104:1600)); await p.waitForFunction('Boolean(window.study)'); const info=await p.evaluate('({fps:study.fps,frames:study.frames,rigs:study.rigs})');console.log(info); const times=proof?[.45,1.6,4.05,6.18,8.25,10.33,12.45,13.2,15.5]:Array.from({length:info.frames},(_,i)=>i/info.fps); if(!proof) { encoder=spawn('ffmpeg',['-loglevel','error','-y','-f','image2pipe','-c:v','mjpeg','-framerate',String(info.fps),'-i','-', '-c:v','libx264','-threads','4','-preset','medium','-crf','17','-pix_fmt','yuv420p','-movflags','+faststart',join(dest,'zero-and-striker.mp4')],{stdio:['pipe','inherit','inherit']}); } const done=encoder&&once(encoder,'close'); for(const [i,t] of times.entries()) { const data=await p.evaluate('window.study.render('+t+')'); const bytes=Buffer.from(data.slice(data.indexOf(',')+1),'base64'); if(proof) await writeFile(join(dest,'proof-'+String(i).padStart(2,'0')+'.jpg'),bytes); else { if(i===32)await writeFile(join(dest,'zero-flight.jpg'),bytes); if(!encoder.stdin.write(bytes))await once(encoder.stdin,'drain'); if(i%48===0)console.log('frame',i); } if(bad.length)throw Error(bad.join('\n')); } if(encoder){encoder.stdin.end();if((await done)[0])throw Error('Encoding failed');} }finally{ if(encoder&&encoder.exitCode===null)encoder.kill(); await browser?.close();await server.close(); } JS node review/form-zero/capture.mjs review/out/form-zero --proof > review/out/form-zero/proof.log 2>&1result, 4 lines
Script completed Wall time 0.5 seconds Output: {"chunk_id":"48d20b","wall_time_seconds":0.257400468,"session_id":76965,"original_token_count":0,"output":""}