The kit is going public, so everything a reader sees is now English:
27 model sources, the core vocabulary, meta.ts (titles, descriptions and
every slider label), the viewer UI, all script output, REFERENCE.md and
the READMEs.
Rules applied: only comments, doc comments and human-facing strings were
touched. Identifiers, numbers, logic, registry item ids, part names and
material slot names are unchanged — those are a published contract and
were already English.
Verified rather than assumed: for all 53 changed .ts files the code
skeleton (source with comments stripped and string contents replaced by a
placeholder) is byte-identical before and after. Full gate is green —
typecheck, registry conformance, ~510 model checks, GLB round trip and a
production build.
Also fixed here:
- index.html and viewer.html were missed by the translation pass because
the file list only covered .ts/.md/.css. Both had lang="tr" and Turkish
titles.
- The viewer formatted triangle counts with toLocaleString('tr-TR'), which
prints 15.425 rather than 15,425.
- REFERENCE.md's model table header did not match what
scripts/catalog-table.ts emits, so the next regeneration would have
silently changed it. Aligned to the generator.
- Removed scripts/probe.ts and scripts/zdiag.ts; they were throwaway
diagnostics that got committed by accident.
49 lines
1.5 KiB
TypeScript
49 lines
1.5 KiB
TypeScript
import { Group } from 'three'
|
|
|
|
import type { PartHandle } from '@vibe3d/model.ts'
|
|
|
|
/**
|
|
* Semantic part slot: fixed anchor + replaceable content.
|
|
*
|
|
* This is the most easily misunderstood contract in vibe3d. `PartHandle`
|
|
* declares two separate objects and they CANNOT BE THE SAME:
|
|
*
|
|
* anchor the same object for the lifetime of the model. The consumer
|
|
* attaches its light, its label, its collision body, its gameplay
|
|
* object here.
|
|
* content the geometry that is thrown away and rebuilt every time
|
|
* configure() is called.
|
|
*
|
|
* Making both the same Group and calling `clear()` on rebuild silently deletes
|
|
* everything the consumer attached too — the model keeps working, but the
|
|
* protocol's actual promise is broken. `scripts/verify-model.ts` tests this
|
|
* separately.
|
|
*/
|
|
export interface PartSlot extends PartHandle<Group> {
|
|
readonly anchor: Group
|
|
readonly content: Group
|
|
/** Replaces the content with a fresh Group and returns it. Leaves the anchor alone. */
|
|
reset(): Group
|
|
}
|
|
|
|
export function createPart(name: string): PartSlot {
|
|
const anchor = new Group()
|
|
anchor.name = name
|
|
let content = new Group()
|
|
content.name = `${name}/content`
|
|
anchor.add(content)
|
|
|
|
return {
|
|
anchor,
|
|
get content(): Group {
|
|
return content
|
|
},
|
|
reset(): Group {
|
|
anchor.remove(content)
|
|
content = new Group()
|
|
content.name = `${name}/content`
|
|
anchor.add(content)
|
|
return content
|
|
},
|
|
}
|
|
}
|