Back to Body Journal
SOURCE / PINNED RELEASE

Made of little things.

Body Journal

Release
e8049f8da4e2…
Author-recorded commit
61c04bf0e8aa…
License
LICENSE
Author’s source reference
nostr://npub182jczunncwe0jn6frpqwq3e0qjws7yqqnc3auccqv9nte2dnd63scjm4rf/wss%3A%2F%2Fgit.napplet.soy%2F/n-6c4554844c7

Archive hash verified: 4369d778da046a8b…. The source-to-build association is the author’s claim; it has not been independently rebuilt.

src/atlas-data.ts
import { MUSCLE_MODEL, ORGAN_MODEL } from './layers.js';

export interface AtlasPart {
  id: string; label: string; part: string; color: string; sex?: 'male' | 'female';
  vertices: number; triangles: number;
  positions: number; indices: number; skinIndices: number; skinWeights: number;
}
export interface AtlasData { id: string; parts: AtlasPart[]; buffer: ArrayBuffer; start: number }
export function decodeAtlas(buffer: ArrayBuffer, expected: typeof MUSCLE_MODEL | typeof ORGAN_MODEL): AtlasData {
  const decoder = new TextDecoder(), view = new DataView(buffer);
  if (decoder.decode(new Uint8Array(buffer, 0, 8)) !== 'BJATLS01') throw new Error('Unsupported anatomy asset.');
  const length = view.getUint32(8, true), start = 12 + length;
  const meta = JSON.parse(decoder.decode(new Uint8Array(buffer, 12, length)));
  if (meta.id !== expected || !Array.isArray(meta.parts) || !meta.parts.length) throw new Error('Anatomy version mismatch.');
  return { id: meta.id, parts: meta.parts, buffer, start };
}