# AEGIS MK-VII: Procedural Powered Armour

A single self-contained `index.html` that uses Three.js to build and render a full humanoid powered-armour suit **entirely from code**. There are no models, textures, fonts or image files. Every part is made from primitives, `ExtrudeGeometry` shapes, `LatheGeometry` profiles, tubes, or a custom deformed-extrusion plate generator.

## Run

Open `index.html` in a modern browser. Three.js **r160** is loaded from jsDelivr through an import map, so you need a network connection the first time. If your browser blocks ES modules from `file://`, serve the folder instead:

```sh
python3 -m http.server 8000   # then open http://localhost:8000
```

Add `?lite` to the URL (`index.html?lite`) for weak GPUs. It turns off bloom and shadows and renders at 1× pixel ratio.

## What's in it

- **642 separate mesh parts**, split into 8 assemblies (head, torso, power pack, pelvis, both arms, both legs). The part types are: structural frame, joints, hydraulic pistons with eyelets, curved armour plates, cooling vents with slats, cables, hex bolts and emissive lights. Hands have fully built fingers with knuckles.
  When the suit is built, the console logs `PART_COUNT 642`.
- **Plate generator (`band()`)**: extrudes an annular sector, then deforms it with taper, bulge and freeform top/bottom edge curves. Normals are creased, so bevels shade smoothly while corners stay hard. Mirrored limbs reuse the same geometry.
- **Assemble / explode**: every part stores its seated transform and a computed exploded transform, which is offset per assembly, pushed outward from the assembly centre and randomly rotated. The part flies in along a spiral path, with frame parts first, then joints, plates and finally bolts, sweeping bottom to top. When a part seats it flashes and emits a "lock" ping. The glow materials power up as the suit locks together. Explode runs the sequence in reverse. You can reverse it mid-flight without parts jumping.
- **HUD**:
  - Targeting reticle with range, bearing and elevation readout.
  - Part labels that track their parts on screen, with leader lines. Labels are arranged in columns, de-overlapped, and dimmed when their part is hidden behind other geometry.
  - System status panel: power, structural lock, servo, thermal, shield, per-assembly part counts, FPS, draw calls and triangles.
  - Event log.
  - Target-lock brackets with part ID, name and type when you hover or tap a part.
- **Rendering**: PBR materials (clearcoat on desktop), an environment map generated from `RoomEnvironment`, a key light with shadows plus rim and fill lights, ACES tone mapping, and bloom on desktop.

## Controls

| Action | Mouse / keyboard | Touch |
|---|---|---|
| Orbit | left-drag | one-finger drag |
| Zoom / pan | wheel / right-drag | pinch / two-finger drag |
| Assemble / Explode | buttons, `A` / `E` | buttons |
| Scan a part | hover or click | tap |
| Toggle labels / auto-rotate | buttons, `L` | buttons |

## Performance notes

- Parts use a shared material set and cached geometry.
- The shadow map only re-renders while parts are moving.
- HUD DOM updates and label occlusion ray-casts are throttled.
- On mobile (coarse pointer) the page skips bloom and clearcoat and uses a smaller shadow map and a pixel ratio of at most 1.5.

For debugging, `window.SUIT` exposes `parts`, `assemble()`, `explode()` and `mode`.
