@ferret/clothing
Classes
ClothingService class
class ClothingService implements Servicereadonly name: "clothing" | |
readonly dressed: Map<string, { meshes: Mesh[]; garments: DressedGarment[]; body: Mesh; indices: Uint32Array<ArrayBufferLike>; }> | dressed entities: their garments' meshes and what they hid |
init(world: World): void | |
dress(a: DressRequest): { garments: { name: string; vertices: number; triangles: number }[]; hidden: number } | |
undress(id: string): boolean | |
dispose(): void |
packages/clothing/src/service.ts:54
ClothMotion class
class ClothMotionreadonly positions: Float32Array | vertices of the garment and the cloth positions of the last step (bind positions before the first one) |
readonly indices: Uint32Array | |
readonly skin: ClothSkin | |
readonly drive: Float32Array | per vertex: 1 follows the skin rigidly, 0 is free, between is the band |
freeVertices: number | number of vertices simulated (not rigid), of links, and the substeps the last frame used |
linkCount: number | |
lastSubsteps: number | |
bodySurface: Surface | null | the posed body's surface of the last step (what the cloth collided with) |
readonly sim: ClothSim | |
fade: number | how much of the simulated cloth is shown: 0 only the skinned one, 1 only the simulated (a change of detail blends over fadeTime) |
frame: number | frames simulated since the last reset |
constructor(garment: Pick<DressedGarment, 'positions' | 'indices'> & { garment?: { support?: unknown; cloth?: { density?: number; stretch?: number; bend?: number; thickness?: number; damping?: number; friction?: number } } }, body: ClothingBody, o: MotionOptions = {}) | |
substeps(): number | the substeps a frame takes: the most the budget allows, 2 at least, and half at the reduced detail |
setBudget(b: number | undefined): void | |
setDetail(level: 0 | 1 | 2): void | 0 the skinned garment only, 1 simulated with fewer substeps, 2 simulated (a rise from 0 starts the cloth from the skinned pose) |
get detail(): number | |
cost(): number | work one frame costs now: links x substeps, 0 when only skinned |
reset(): void | back to the start: the cloth is the skinned garment at the next pose, at rest |
asCollider(): MotionCollider | the cloth of the last step as a collider for the garment over it |
step(mats: ArrayLike<number>, dt = FIXED): Float32Array | one frame of dt (the fixed step) with the body in the pose mats; the cloth is in positions |
maxStretchNow(): number | the longest edge of the simulated cloth now as a ratio of its length at rest (edges between two rigid vertices are the skin's, not the cloth's) |
freeIndices(): Uint32Array | the vertices that are not rigid (their bind-pose positions change when the cloth moves) |
skinnedPositions(mats: ArrayLike<number>, out = this.skinnedAll): Float32Array | the garment's vertices skinned only, in the pose of the last step (bind-pose positions of the rigid part, and of the rest by its weights) |
positionsAtRest(): Float32Array |
packages/clothing/src/motion.ts:130
ClothMotionService class
class ClothMotionService implements ServiceCloth in motion in the world: the garments ClothingService has dressed, moved each fixed step by the animated skeleton. A vertex budget and distances set the detail: the nearest garments are simulated until the budget of free vertices is spent, farther ones are only skinned (what the dressing already gives them) and cost nothing. Everything is a command (clothing.motion.*).
readonly name: "clothing-motion" | |
readonly moving: Map<string, Moving> | |
budget: number | free vertices that may be simulated at once, simulated within near metres of the camera (full) and far (half the substeps); beyond it skinned only |
near: number | |
far: number | |
viewer: () => [number, number, number] | the point distances are measured from (a camera); the world's origin until set |
enabled: boolean | |
init(world: World): void | |
start(a: MotionRequest): { garments: { name: string; freeVertices: number; links: number }[] } | |
stop(entity: string): boolean | |
assign(): void | which garments are simulated at what detail by distance and the vertex budget (nearest first) |
fixedUpdate(dt: number): void | Called before the components' fixed update, at the fixed rate. |
stats(): { garment: string; entity: string; freeVertices: number; detail: number; substeps: number; stretch: number; distance: number }[] | |
dispose(): void |
packages/clothing/src/motion.ts:360
ClothSim class
class ClothSimThe cloth solver: extended position-based dynamics with small steps (one iteration per substep,
many substeps), distance links with compliance (stretch, bending, seams, tacks), gravity, damping, and the collision of collide.ts: every substep the
cloth is tested against the surfaces (vertex-triangle, triangle-vertex, edge-edge, continuous, the side kept from the start of the substep,
friction) and, when enableSelfCollision is called, against itself. Deterministic.
Kept for the old drape (drape.ts, until step 6 of the plan removes it): colliders/collidersT/torsoV/bodyOnly/bodyOnlyV (they only choose,
per particle, which of the surfaces it sees), findContacts/skipReset (now no-ops: contacts are found per substep), contact2/hasContact2 (second
planes set from outside, solved as before), maxSpeed (an optional limit, default none; the collision does not need it), resolveInside, holdI, pin.
readonly n: number | |
readonly x: Float64Array | |
readonly p: Float64Array | |
readonly v: Float64Array | |
readonly w: Float64Array | |
li: number[] | links: i, j, rest, compliance; rest may be changed (seams closing) |
lj: number[] | |
rest: number[] | |
comp: number[] | |
lambda: number[] | |
pinI: number[] | pins: particle i pulled to a fixed point (a waistband held up by braces, a cap on the head); compliance per pin |
pinX: number[] | |
pinC: number[] | |
pinOn: number | |
holdI: number[] | height holds: particle i kept at height y (an edge that must not slide down while the seams close round it) |
holdY: number[] | |
pin(i: number, at: ArrayLike<number>, compliance: number): void | |
seamLinks: number[] | the links of the seams (indices) and how many extra iterations they get per substep |
seamIters: number | |
readonly world: CollisionWorld | the collision world: surfaces added with world.addStatic(surface, thickness, id) are seen by every particle (see also colliders) |
self: SelfCollider | null | self collision of the cloth (null: off), see enableSelfCollision |
colliders: Surface[] | the surfaces (the first is the body: solid, closed, wound outward; the others are layers dressed before). They are registered in world at the next step. |
collidersT: Surface[] | null | colliders of the particles flagged in torsoV (when set) |
torsoV: Uint8Array | null | |
bodyOnly: boolean | while bodyOnly is set the particles flagged in bodyOnlyV see only the first collider (the body) |
bodyOnlyV: Uint8Array | null | |
thickness: number | distance the cloth keeps from the colliders (m) |
friction: number | friction of the cloth on the colliders |
damping: number | |
gravity: number | |
maxSpeed: number | optional speed limit, m/s. The collision is continuous and does not need it; the old drape uses it to hold the cloth still while it is sewn. |
contactPasses: number | rounds of contact projection per substep |
collideRounds: number | rounds of (find contacts, project them) per substep: a later round finds what the earlier ones moved into |
contact2: Float64Array | second contact planes (a panel lying over another panel of the same garment): point, normal, per particle; set from outside each frame (old drape) |
hasContact2: Uint8Array | |
lastContacts: number | contacts found in the last substep |
constructor(positions: ArrayLike<number>, masses: ArrayLike<number>) | |
link(i: number, j: number, rest: number, compliance: number): number | |
drag: { normal: number; tangent: number } | null | air drag on the cloth's triangles (set by applyFabric; needs setTriangles): normal and tangent coefficients, and the air's velocity |
wind: [number, number, number] | |
airDensity: number | |
applyFabric(p: FabricPhysics): void | Take the fabric's measured values: thickness (the distance kept from surfaces and from itself), friction on the skin (the first collider, the body) and on cloth (the other colliders and itself), and the air drag. Mass per area and the link compliances belong to whoever builds the links. |
skinFriction: number | null | friction on the first collider (the body) when it differs from friction (set by applyFabric) |
setTriangles(idx: ArrayLike<number>): void | the cloth's triangles: they give the edges for the edge-edge tests and the triangles for the tests of the surfaces' vertices (without them only the cloth's vertices are tested) |
enableSelfCollision(idx: ArrayLike<number>, glue: ArrayLike<readonly [number, number]> = [], thickness = 0.002, friction = 0.3): SelfCollider | switch the cloth's collision with itself on; glue: pairs of particles that are one point (the two sides of a seam) |
findContacts(_reach?: number): void | old API of the drape: contacts are found per substep now, nothing is searched per frame |
skipReset(): void | |
step(dt: number, sub: number): void | one frame of dt seconds in sub substeps |
resolveInside(reach: number, maxMove = Infinity): number | old API of the drape: push every particle out of the colliders along the nearest normal (after the run). A post pass; the new dressing does not use it. |
packages/clothing/src/sim.ts:16
CollisionWorld class
class CollisionWorldThe surfaces cloth collides with. addStatic(surface, thickness, id); an animated body is moved between frames by writing the surface's pos
(or moveStatic): beginFrame() finds it out, and during the frame the surface goes linearly from where it was to the new place.
Per substep update(positionsPrev, positionsNext, invMass) -> ContactSet of the contacts to be solved on the predicted positions.
At most 32 static surfaces (a particle's view of them is a 32-bit mask): the body and the layers of one outfit are far fewer.
setTriangles gives the cloth's triangles (the edges for the edge tests and the triangles for the tests of the surface's vertices).
readonly statics: Static[] | |
friction: number | |
skin: number | extra distance round the motion of an item that its candidate list covers (m): a list is rebuilt when the item leaves it |
rescue: number | how deep inside a solid surface a vertex is still pushed out (m) |
readonly contacts: ContactSet | |
readonly stats: { vertexTri: number; triVertex: number; edgeEdge: number; contacts: number; updates: number; } | machine-independent work counters since the last resetStats(): narrow-phase pair tests (cloth vertex/surface triangle, surface vertex/cloth triangle, cloth edge/surface edge), contacts produced, update calls |
resetStats(): void | |
commit(p: Float64Array): void | call at the end of each substep with the final positions: the particles that were tested move their anchors to where they are |
addStatic(surface: Surface, thickness: number, id: string, opts: StaticOptions = {}): number | |
removeStatic(id: string): void | |
getStatic(id: string): { surface: Surface; thickness: number; friction: number; k: number } | undefined | |
moveStatic(id: string, positions: ArrayLike<number>): void | move a static surface to new positions (takes effect with the next beginFrame) |
moveStaticSkinned(id: string, rest: ArrayLike<number>, joints: ArrayLike<number>, weights: ArrayLike<number>, matrices: ArrayLike<number>): void | Move a static surface by skeleton matrices (linear blend skinning), for an animated body: rest are the vertex positions in the bind pose
(3 per vertex), joints/weights 4 per vertex, matrices 16 numbers per joint, column-major, each already multiplied by the joint's
inverse bind matrix (the matrix that takes a bind-pose point to its place now). Takes effect with the next beginFrame. |
setTriangles(idx: ArrayLike<number>): void | the cloth's triangles (3 indices each): the edges and the triangles the surfaces' vertices are tested against |
get triangles(): Uint32Array | the cloth's triangles as given to setTriangles |
get triangleCount(): number | |
beginFrame(): void | call once per frame before its substeps: finds the surfaces that moved since the last frame and prepares their boxes and bins |
endFrame(): void | call once per frame after its substeps |
vertexContacts(x: Float64Array, p: Float64Array, w: Float64Array, a: number, b: number, tau0: number, tau1: number, mask: Uint32Array | null, out: ContactSet): void | Pure range search (for parallel workers): the contacts of cloth vertices [a, b) with the surfaces' triangles on the motion x -> p of one substep
(typed arrays in, out appended; the surfaces and setTriangles data are only read; the only state written is the per-vertex candidate list of the
vertices in the range, so disjoint ranges on separate CollisionWorld copies, or on one for ranges that do not overlap, never interfere).
mask: per particle bit mask of the statics it sees (null: all). One contact per vertex and surface: the most violated. |
update(x: Float64Array, p: Float64Array, w: Float64Array, opts: UpdateOptions = {}): ContactSet | Contacts for one substep: particle i goes from x[i] (start) to p[i] (predicted). Particles with w[i] = 0 are fixed. Appended to out after it is cleared. |
packages/clothing/src/collide.ts:261
ContactSet class
class ContactSeta list of contact constraints: C = dir . (sum om[k] p[m[k]]) - off, kept >= 0
n: number | |
m: Int32Array<ArrayBuffer> | |
om: Float64Array<ArrayBuffer> | |
dir: Float64Array<ArrayBuffer> | |
off: Float64Array<ArrayBuffer> | |
mu: Float64Array<ArrayBuffer> | |
sv: Float64Array<ArrayBuffer> | |
clear(): void | |
addFrom(o: ContactSet, i: number): void | append contact i of another set |
appendFrom(o: ContactSet): void | |
keepFrom(o: ContactSet, skip: Uint8Array): void | append the contacts of another set none of whose particles is flagged in skip |
add(m0: number, m1: number, m2: number, m3: number, o0: number, o1: number, o2: number, o3: number, dx: number, dy: number, dz: number, off: number, mu: number, sx = 0, sy = 0, sz = 0): void | a constraint over up to 4 particles (-1 ends the list); sv is the motion of the surface point during the substep (friction is taken relative to it) |
set(i: number, m0: number, m1: number, m2: number, m3: number, o0: number, o1: number, o2: number, o3: number, dx: number, dy: number, dz: number, off: number, mu: number, sx = 0, sy = 0, sz = 0): void | overwrite contact i (used to keep the most violated of several contacts of one vertex with one surface) |
solve(p: Float64Array, x: Float64Array, w: Float64Array, passes = 2): number | Project the contacts on the predicted positions p (particle k has inverse mass w[k]; x are the positions at the start of the substep, for
friction): passes rounds; in the first the tangential motion of a violated contact is cut by mu * depth. Returns the contacts violated in the first round. |
packages/clothing/src/collide.ts:24
DescribeError class
class DescribeError extends Errorissues: DescribeIssue[] | |
constructor(issues: DescribeIssue[]) |
packages/clothing/src/describe.ts:33
FolderBackend class
class FolderBackend implements StoreBackendreadonly readOnly: false | |
constructor(private io: FolderIO) | |
get(n: string) | |
put(n: string, b: Uint8Array) | |
async has(n: string) | |
async list() | |
delete(n: string) |
packages/clothing/src/cache.ts:344
MemoryBackend class
class MemoryBackend implements StoreBackendreadonly readOnly: false | |
readonly files: Map<string, Uint8Array<ArrayBufferLike>> | |
async get(n: string) | |
async put(n: string, b: Uint8Array) | |
async has(n: string) | |
async list() | |
async delete(n: string) |
packages/clothing/src/cache.ts:327
Narrow class
class NarrowThe narrow phase tests, on the motion of one substep. Inputs are set in the arrays (T: triangle, E and F: two edges; index 0 at the start of the
substep, 1 at its end); results are dir (the direction away from the other surface, unit), w (barycentric weights on the triangle),
q (the point of the other surface at the end), s and t (the parameters on the edges).
readonly T0: Float64Array<ArrayBuffer> | |
readonly T1: Float64Array<ArrayBuffer> | |
readonly E0: Float64Array<ArrayBuffer> | |
readonly E1: Float64Array<ArrayBuffer> | |
readonly F0: Float64Array<ArrayBuffer> | |
readonly F1: Float64Array<ArrayBuffer> | |
readonly dir: Float64Array<ArrayBuffer> | |
readonly w: Float64Array<ArrayBuffer> | |
readonly q: Float64Array<ArrayBuffer> | |
s: number | |
t: number | |
vertexTri(x0x: number, x0y: number, x0z: number, x1x: number, x1y: number, x1z: number, th: number, solid: boolean, surf: Surface | null, ia: number, ib: number, ic: number, reach: number): boolean | a point (x0 -> x1) against the triangle T0 -> T1. th: thickness; solid: the triangle belongs to a closed surface wound outward (whatever is
inside is pushed out, up to reach deep); surf and ia, ib, ic: the surface and the triangle's vertices (its smooth normals decide the side at
an edge or a corner; null: the face normal). true when the point must be held (a crossing, or nearer than th). |
edgeEdge(th: number): boolean | edge E (E0 -> E1: both end points at the start and at the end) against edge F. Handles the crossing of two edges and the closeness of their inner points (an end point against an edge is a vertex-triangle case). s, t: parameters on E and F at the end; dir: from F to E; q: the point of F. |
packages/clothing/src/collide.ts:89
OutfitStore class
class OutfitStoreconstructor(readonly backend: StoreBackend) | |
async has(key: string): Promise<boolean> | |
async getBytes(key: string): Promise<Uint8Array | undefined> | |
async get(key: string): Promise<OutfitRecord | undefined> | |
async put(key: string, rec: OutfitRecord): Promise<void> | |
async list(): Promise<string[]> | keys, sorted |
async drop(key: string): Promise<void> | |
async addAnim(key: string, a: CachedAnim): Promise<void> | add the baked animation of one garment and clip to a stored record |
async assign(characterId: string, outfitId: string, key: string, fit: Record<string, unknown> = {}): Promise<void> | |
async unassign(characterId: string, outfitId: string): Promise<void> | |
async forCharacter(characterId: string, outfitId: string): Promise<MapEntry | undefined> | |
async loadFor(characterId: string, outfitId: string): Promise<(MapEntry & { record: OutfitRecord }) | undefined> | the entry and its record |
async assignments(): Promise<{ characterId: string; outfitId: string; key: string; fit: Record<string, unknown> }[]> | every assignment, sorted |
async dangling(): Promise<{ characterId: string; outfitId: string; key: string }[]> | assignments whose record is not stored |
once<T>(key: string, make: () => Promise<T>): Promise<T> |
packages/clothing/src/cache.ts:377
PackageBackend class
class PackageBackend implements StoreBackenda store packed into a Ferret package under prefix (default outfits/), read only: what the game opens at run time
readonly readOnly: true | |
constructor(private pkg: PackageFiles, private prefix = 'outfits/') | |
async get(n: string) | |
async put(): Promise<void> | |
async has(n: string) | |
async list() | |
async delete(): Promise<void> |
packages/clothing/src/cache.ts:357
SelfCollider class
class SelfCollidera cloth's collision with itself
thickness: number | the cloth keeps this far from itself |
friction: number | |
skin: number | Verlet skin (m) |
readonly n: number | |
builds: number | how many times the pair lists were rebuilt (tests and the speed report read it) |
constructor(n: number, idx: ArrayLike<number>, glue: ArrayLike<readonly [number, number]> = []) | |
near(a: number, b: number): boolean | are a and b in the same patch of the cloth (left out of each other's tests)? |
update(x: Float64Array, p: Float64Array, w: Float64Array, out: ContactSet): void | the contacts of the cloth with itself for one substep (appended to out) |
packages/clothing/src/collide.ts:525
Sha256Stream class
class Sha256Streaman incremental SHA-256 (synchronous, so the key is made the same in Node, a browser and a worker)
update(data: Uint8Array): this | |
hex(): string |
packages/clothing/src/cache.ts:42
Surface class
class SurfaceA triangle surface to collide with: closest point on its triangles to a point, with the side (outside along the interpolated vertex
normal). Triangles are binned in a grid; a query looks at the cells within reach.
readonly normals: Float32Array | |
pos: Float32Array | the positions the queries use (may be moved: a body shrunk for the start of a drape, then grown back) |
constructor(readonly base: Float32Array, readonly idx: Uint32Array, cell = 0.03) | |
core: Float32Array | null | points every vertex shrinks toward (its bones' axes), see shrinkTargets |
shrinkTo(k: number): void | scale the surface toward its core: 1 = as it is, 0.4 = limbs at 40 % of their thickness round the bones (no surface turns inside out) |
inflate(d: number): void | move every vertex d metres along its normal from the base (negative: inward) |
closest(x: number, y: number, z: number, reach: number, out: SurfaceHit): boolean | closest point within reach: { d: signed distance (+ outside), p, n (outward), t (triangle), w (barycentric) } or null |
triBox(): Float32Array | per-triangle boxes x0,y0,z0,x1,y1,z1 (of pos; after refit(from) of from and pos together, so they hold for the whole move) |
refit(from?: ArrayLike<number>): void | The surface has moved (pos changed; or the first call): recompute the normals, the triangle boxes and the grid. With from (where it was)
the boxes and bins cover from and pos together, so a query finds every triangle at every instant of the move. |
updateNormals(): void | vertex normals of pos, in place |
collectBox(x0: number, y0: number, z0: number, x1: number, y1: number, z1: number, out: number[]): void | push into out the triangles whose box overlaps the box x0..x1 (after refit; in a fixed order) |
rim(h: SurfaceHit): boolean | Is the closest point of h on a free edge of the surface (the rim of a waist or a hem; seams that share positions are not free)? A cloth
vertex whose nearest point is a rim has gone past the end of the surface: the rim's plane must not hold it (it would lift the cloth over a waist). |
packages/clothing/src/body.ts:91
Functions
add function
function add: (a: V3, b: V3) => V3packages/clothing/src/body.ts:28
animToBaked function
function animToBaked(a: CachedAnim): BakedCloththe baked cloth of an animation slot (getAnim); throws when the slot holds another kind
packages/clothing/src/bake.ts:166
armGirth function
function armGirth(m: Measurements, U: UpperFrame, s: number): numberthe arm's girth at the distance s along it from the shoulder joint (upper arm, elbow, wrist)
packages/clothing/src/parts/util.ts:34
armholeDrop function
function armholeDrop(kind: HoldKind, thickness: number, sleeveless: boolean): numberthe depth of the armhole below the sleeve root, beyond the body's armpit, metres: a hung garment's armhole is cut lower (it hangs off the shoulder and the arm lifts it), a sleeveless one is cut away, and every layer under needs the room of its sleeve
packages/clothing/src/blocks/ease.ts:46
armPath function
function armPath(U: UpperFrame, sx: 1 | -1, back = 0.03): V3[]the arm's own path: from back metres above the shoulder joint (along the upper arm) through the elbow to the wrist
packages/clothing/src/blocks/common.ts:42
bakeClip function
function bakeClip(garment: Pick<DressedGarment, 'positions' | 'indices'> & { name?: string; garment?: unknown }, body: ClothingBody, clip: PoseSource, o: BakeOptions = {}): BakedClothBake garment over clip: the cloth is simulated at 60 Hz with the pose stepping through the clip, after warm-up cycles (so the first frame is the cloth in its steady state of the motion), and every 60/fps-th step is stored. For a loop the start is blended into the continuation of the end, so the last frame is followed by the first without a jump.
packages/clothing/src/bake.ts:88
bakedToAnim function
function bakedToAnim(b: BakedCloth): CachedAnima baked cloth as the outfit record's animation slot (setAnim; the slot is keyed by clip and garment name, as the block names them)
packages/clothing/src/bake.ts:162
bakeFabricTile function
function bakeFabricTile(f: FabricSpec, size = 1, pxPerMeter = 2048): { width: number; height: number; albedo: Uint8Array; normal: Uint8Array; orm: Uint8Array }a flat tile of a fabric size metres square at pxPerMeter, baked as a garment panel is (for looking at a fabric on its own)
packages/clothing/src/fabric.ts:219
bakeGarment function
function bakeGarment(d: DressedGarment, o: TextureBakeOptions): BakedGarmentbake a dressed garment's textures: albedo, normal, ORM, with the seams, hems and buttonholes
packages/clothing/src/fabric.ts:231
ballJoint function
function ballJoint(body: ClothingBody, side: 1 | -1): V3the ball of the foot; a rig without one gets a point 14 cm in front of the ankle, 4 cm above the floor (the lowest vertex)
packages/clothing/src/body.ts:66
beanie function
function beanie(body: ClothingBody, m: Measurements, s: BeanieStyle = {}): Garmentpackages/clothing/src/blocks/hats.ts:70
belt function
function belt(body: ClothingBody, m: Measurements, s: BeltStyle = {}): GarmentA belt or sash: a stiff band closed into a ring at the waist over what is worn there, held at the waist, with a buckle at the centre front.
packages/clothing/src/blocks/accessories.ts:163
blockSpec function
function blockSpec(name: string): BlockSpec | undefinedthe block's spec, or undefined
packages/clothing/src/catalog.ts:332
bodyFit function
function bodyFit(body: ClothingBody, m: Measurements): BodyFitpackages/clothing/src/fit.ts:41
bodyFromMesh function
function bodyFromMesh(mesh: BABYLON.Mesh): ClothingBodyThe engine side of clothes: a skinned Babylon mesh as a clothing body (its bind pose, its skin, its skeleton's bone names and rest positions), and a dressed garment as a Babylon mesh skinned to the same skeleton, with its baked textures.
packages/clothing/src/babylon.ts:11
bodyGirth function
function bodyGirth(m: Measurements, y: number): numberthe body's girth at a world height (chest above the chest line, then the waist, the seat, held below)
packages/clothing/src/parts/ctx.ts:85
bodyKey function
function bodyKey(body: ClothingBody): stringthe key of the body alone (a character's identity for the cache; its mesh, skin, joints and rig hints)
packages/clothing/src/cache.ts:125
bodyRig function
function bodyRig(body: ClothingBody): RigMapthe roles of the body's joints (resolved once per body)
packages/clothing/src/body.ts:45
bodyZ function
function bodyZ(m: Measurements, y: number): numberz of the body's centre at a world height
packages/clothing/src/parts/ctx.ts:92
boots function
function boots(body: ClothingBody, s: BootStyle = {}): Bootspackages/clothing/src/footwear.ts:23
breeches function
function breeches(body: ClothingBody, m: Measurements, s: BreechesStyle = {}): Garmentpackages/clothing/src/blocks/breeches.ts:24
brimmedHat function
function brimmedHat(body: ClothingBody, m: Measurements, s: BrimmedHatStyle = {}): Garmentpackages/clothing/src/blocks/hats.ts:37
brodyHelmet function
function brodyHelmet(body: ClothingBody, m: Measurements, s: BrodyHelmetStyle = {}): GarmentThe Brodie steel helmet: a dome of six gores (the developable pattern of a sphere, each gore a lens) and a down-sloping brim of six sectors (a cone frustum), pressed steel, so every piece has the bending stiffness of steel; the optional chin strap hangs from the brim on each side and is joined under the chin. It sits on the head by the dome's rim.
packages/clothing/src/blocks/accessories.ts:100
buildUpper function
function buildUpper(body: ClothingBody, m: Measurements, st: UpperStyle = {}, d: UpperDefaults): Garmentthe defaults of a garment with the style over them -> the garment
packages/clothing/src/parts/style.ts:84
button function
function button(at: { p: V3; n: V3; v: number }, o: { name?: string; size?: number; style?: 'horn' | 'brass'; material?: string } = {}): TrimMesha button on the cloth: a rim, a dished face, four holes (horn) or a domed face (brass, with the anchor in its normal map)
packages/clothing/src/trims.ts:35
buttonFace function
function buttonFace(style: 'horn' | 'brass', size = 256): { albedo: Uint8Array; normal: Uint8Array; orm: Uint8Array }a button's face texture (RGBA, size square): brass with a fouled anchor raised in its height, or horn with four holes; height in A
packages/clothing/src/trims.ts:102
cap function
function cap(body: ClothingBody, m: Measurements, s: CapStyle = {}): Garmentpackages/clothing/src/blocks/headwear.ts:22
capCrown function
function capCrown(lF: number, lB: number, wt: number, Lcut: number, setting: number): { Lu: number; h: number; xa: number; cf: V2[]; cb: V2[] }The crown of a set-in sleeve of width wt (the sleeve's flat top, round the upper arm) whose seam length is the front armhole lF and the back
armhole lB each plus setting (the fraction): the crown's height h and the slide xa of its apex toward the longer half are solved, the
cap lies on the sleeve from the height Lu = Lcut - h up. Returns the two cap edges (front from the sleeve's front corner, back to its back corner).
packages/clothing/src/parts/sleeves.ts:113
catalogInfo function
function catalogInfo(): Record<string, { implemented: boolean; description: string; defaultFabric: string; options: Record<string, { type: string; values?: string[]; min?: number; max?: number; unit?: string; description: string }> }>a plain-data copy of the registry (no functions) for commands and docs
packages/clothing/src/catalog.ts:335
clipPoseSource function
function clipPoseSource(body: ClothingBody, clip: ClipJson, rest: Rest): PoseSourcethe skinning matrices of a clip of the animation package on body (its joints named as the clip's bones; rest is the skeleton's rest pose in the body's frame)
packages/clothing/src/bake.ts:60
cloak function
function cloak(body: ClothingBody, m: Measurements, s: CloakStyle = {}): Garmentpackages/clothing/src/blocks/cloak.ts:30
closestOnTri function
function closestOnTri(px: number, py: number, pz: number, ax: number, ay: number, az: number, bx: number, by: number, bz: number, cx: number, cy: number, cz: number, out: Float64Array): voidclosest point of triangle abc to p (Ericson), with its barycentric weights: out = [x, y, z, wa, wb, wc]
packages/clothing/src/body.ts:227
coat function
function coat(body: ClothingBody, m: Measurements, s: CoatStyle = {}): Garmentpackages/clothing/src/blocks/coat.ts:13
composeUpper function
function composeUpper(body: ClothingBody, m: Measurements, s: UpperSpec): Garmentpackages/clothing/src/parts/compose.ts:47
convexHull function
function convexHull(p: [number, number][]): [number, number][]packages/clothing/src/body.ts:292
cross function
function cross: (a: V3, b: V3) => V3packages/clothing/src/body.ts:31
curve function
function curve(ctrl: V2[], n = 8): V2[]a smooth curve through control points (Catmull-Rom), n points per span
packages/clothing/src/pattern.ts:205
dartLegs function
function dartLegs(d: Dart, dir: V2): [V2, V2]the two legs' base points of a dart whose base lies on an edge running along dir (unit, 2D)
packages/clothing/src/fit.ts:96
darts function
function darts(m: Measurements, style: DartStyle = 'fitted', o: { fit?: BodyFit; region?: 'bodice' | 'skirt'; easeBust?: number; easeWaist?: number; easeHip?: number } = {}): DartPlanThe darts a bodice takes from its bust to its waist (region: 'bodice', default) or a skirt from its hip to its waist ('skirt'; the darts are then shorter and there is no bust dart). About half of the shaping goes into darts, the rest into the side seams; style scales it: fitted all, semi 0.55, shift 0.2, none nothing. The eases are the finished garment's (see ease).
packages/clothing/src/fit.ts:118
decodeOutfit function
function decodeOutfit(bytes: Uint8Array): OutfitRecordpackages/clothing/src/cache.ts:276
delaunay function
function delaunay(p: V2[]): [number, number, number][]Bowyer-Watson Delaunay triangulation of a point set
packages/clothing/src/pattern.ts:290
describe function
function describe(input: string | Record<string, unknown> | unknown[], opts: DescribeOptions = {}): DescriptionDescribe garments in words or in the structured form.
- text: "blue denim shorts", "a long single-breasted wool overcoat with notched lapels and flap pockets", "красное шёлковое платье с короткими рукавами"
- JSON (a string starting with { or [, or the object): {garments: [{block, style?, fabric?, color?}], fabrics?: {key: FabricSpec | {fabric, color?}}}
Throws DescribeError (its issues name the fields) when the text names no garment or the JSON is not valid.
packages/clothing/src/describe.ts:358
dot function
function dot: (a: V3, b: V3) => numberpackages/clothing/src/body.ts:30
draftClosure function
function draftClosure(ctx: UpperCtx, spec: ClosureSpec): ClosureDraftpackages/clothing/src/parts/closures.ts:32
draftCollar function
function draftCollar(ctx: UpperCtx, spec: CollarSpec): NeckDraftpackages/clothing/src/parts/collars.ts:54
draftHood function
function draftHood(ctx: UpperCtx, spec: HoodSpec, ring: NeckRing, nd: number): Piecepackages/clothing/src/parts/hood.ts:33
draftPockets function
function draftPockets(ctx: UpperCtx, specs: PocketSpec[]): Piecepackages/clothing/src/parts/pockets.ts:23
draftSleeve function
function draftSleeve(ctx: UpperCtx, spec: SleeveSpec): SleeveDraftpackages/clothing/src/parts/sleeves.ts:49
drape function
function drape(body: ClothingBody, garments: Garment[], o: DrapeOptions = {}): DressedGarment[]dress the garments in order of their layer, each settling over the body and those before it
packages/clothing/src/drape.ts:79
dress function
function dress(body: ClothingBody, m: Measurements, s: DressStyle = {}): Garmentpackages/clothing/src/blocks/dress.ts:35
dressCached function
async function dressCached(body: ClothingBody, garments: Garment[], options: { fabrics?: Record<string, unknown> } & Record<string, unknown>, store: OutfitStore, dress: Dresser): Promise<{ key: string; record: OutfitRecord; hit: boolean }>The outfit of these garments on this body: from the store when its key is there, else dressed by dress and put. options holds the fabrics (options.fabrics, if any) and everything else the dressing reads; all of it is in the key. A read-only store that misses throws.
packages/clothing/src/cache.ts:457
dressGarment function
function dressGarment(sewn: SewnGarment, body: ClothingBody, layersBelow: LayerBelow[] = [], o: DressOptions = {}): DressedClothPut a sewn garment on the body over layersBelow (the layers dressed before it, lower first) and let it settle. Deterministic. The garment must have been sewn with the same body's measurements (its pattern already has the ease for the layers under it).
packages/clothing/src/dress.ts:129
ease function
function ease(fitting: Fitting, fit?: Pick<BodyFit, 'childness'>): { bust: number; waist: number; hip: number }Ease in metres of girth over the body at the bust, the waist and the hip for a fitting; a child's figure is straighter, and a child grows, so it gets a little more room.
packages/clothing/src/fit.ts:87
emptyOutfit function
function emptyOutfit(key: string, meta: Record<string, unknown> = {}): OutfitRecordpackages/clothing/src/cache.ts:204
encodeOutfit function
function encodeOutfit(rec: OutfitRecord): Uint8Arraypackages/clothing/src/cache.ts:252
fabricAt function
function fabricAt(f: FabricSpec, x: number, y: number, px: number, panel = '', py = y): { h: number; shade: number; rough: number; mix?: number }The relief of a fabric at a flat point: height (metres) and a colour factor (thread shade), filtered for the pixel size px (metres): structure finer than two pixels fades to its mean so the bake does not alias.
packages/clothing/src/fabric.ts:66
fabricFor function
function fabricFor(name: string, color?: number | RGB | string): { name: string; spec: FabricSpec; cloth: ClothProps }the fabric name (or a word that names it) with an optional colour (sRGB hex number, linear RGB triple, or a colour word); copies, never the catalogue's own objects
packages/clothing/src/fabrics.ts:110
findColor function
function findColor(word: string): number | undefineda colour word to its hex: an exact word, or a Russian stem the word starts with (the longest stem wins)
packages/clothing/src/fabrics.ts:101
findFabric function
function findFabric(name: string): CatalogFabric | undefineda fabric by exact name, or by one of its words
packages/clothing/src/fabrics.ts:94
foldShade function
function foldShade(pos: ArrayLike<number>, nrm: ArrayLike<number>, idx: ArrayLike<number>, strength = 1): Float32Arrayper vertex darkening in the folds (concave places, from the mesh's own curvature): a colour multiplier 0..1
packages/clothing/src/fabric.ts:335
garmentMesh function
function garmentMesh(scene: BABYLON.Scene, d: DressedGarment, baked: BakedGarment, skin: ClothSkin, skeleton: BABYLON.Skeleton | null, fabric?: FabricSpec): BABYLON.Mesha dressed garment as a mesh skinned to skeleton (bone indices as in the body), its atlas as textures, wool sheen when the fabric has it
packages/clothing/src/babylon.ts:30
garmentRecord function
function garmentRecord(d: DressedGarment, o: { skin: ClothSkin; uv: ArrayLike<number>; texture?: CachedTexture; material?: Record<string, unknown> }): CachedGarmenta record garment from a dressed one, its skin and its baked atlas (uv as bakeGarment gives it)
packages/clothing/src/cache.ts:209
getAnim function
function getAnim(rec: OutfitRecord, clip: string, garment: string): CachedAnim | undefinedpackages/clothing/src/cache.ts:236
girthAt function
function girthAt(body: ClothingBody, y: number, band = 0.01, keep: (x: number, z: number) => boolean = () => true): { girth: number; cx: number; cz: number; depth: number; width: number }convex girth of the cross-section of the body at height y (only vertices within band of y, kept by keep)
packages/clothing/src/body.ts:270
gloves function
function gloves(body: ClothingBody, s: GloveStyle = {}): Glovespackages/clothing/src/blocks/gloves.ts:95
handDigits function
function handDigits(body: ClothingBody, side: 1 | -1): { hand: V3; digits: Digit[]; axis: V3; palmLen: number }the digits of the hand on side (1: left): from the skeleton's tree under the hand joint
packages/clothing/src/blocks/gloves.ts:34
hashCanonical function
function hashCanonical(h: Sha256Stream, v: unknown, path = '$'): voidThe canonical form of a value, fed to the hash: object keys sorted (their order does not matter), undefined fields left out, numbers by their shortest round-trip text (-0 is 0), typed arrays by their bytes (little endian) with their kind, Maps by sorted keys. A function or a non-finite-safe unknown thing throws: it has no stable form.
packages/clothing/src/cache.ts:96
hashOf function
function hashOf(v: unknown): stringthe hash of a value in its canonical form, hex
packages/clothing/src/cache.ts:122
hasJoint function
function hasJoint(body: ClothingBody, name: string): booleanpackages/clothing/src/body.ts:40
hasRole function
function hasRole(body: ClothingBody, role: BoneRole): booleanpackages/clothing/src/body.ts:50
hemAt function
function hemAt(body: ClothingBody, m: Measurements, length: UpperHemName | number): numberthe world height of a named hem, or length metres below the shoulder point
packages/clothing/src/parts/style.ts:58
hemHeight function
function hemHeight(m: Measurements, name: HemName): numberthe hem height above the floor for a named length
packages/clothing/src/blocks/skirt.ts:43
hemLine function
function hemLine(x0: number, x1: number, rise: number, w: number): V2[]a plain hem line across a half panel from x0 to x1, curved up at the ends by rise
packages/clothing/src/parts/hems.ts:48
hex function
function hex(h: number): RGBsRGB hex to linear RGB
packages/clothing/src/fabrics.ts:23
hoodie function
function hoodie(body: ClothingBody, m: Measurements, s: HoodieStyle = {}): Garmentpackages/clothing/src/blocks/hoodie.ts:12
interlining function
function interlining: (what: "collar stand" | "collar fall" | "lapel" | "waistband" | "cuff" | "brim" | "band" | "flap" | "facing" | "crown" | "shell" | "belt") => numberpackages/clothing/src/blocks/ease.ts:81
isKnit function
function isKnit: (c?: ClothProps | undefined) => booleana cloth that stretches (a knit) rather than a woven one
packages/clothing/src/blocks/ease.ts:27
jacket function
function jacket(body: ClothingBody, m: Measurements, s: JacketStyle = {}): Garmentpackages/clothing/src/blocks/jacket.ts:37
jersey function
function jersey(body: ClothingBody, m: Measurements, s: JerseyStyle = {}): Garmentpackages/clothing/src/blocks/jersey.ts:30
joint function
function joint(body: ClothingBody, name: string): V3packages/clothing/src/body.ts:35
layerGirth function
function layerGirth: (t: number) => numberthe girth a thickness t of layers under a garment adds to it, metres
packages/clothing/src/blocks/ease.ts:24
legBlock function
function legBlock(body: ClothingBody, m: Measurements, s: LegBlockStyle): Garmentpackages/clothing/src/blocks/shorts.ts:41
legGirthAt function
function legGirthAt(body: ClothingBody, m: Measurements, y: number): numberthe girth of the leg at height y (the thigh and calf cross sections along the leg's axis)
packages/clothing/src/blocks/shorts.ts:34
len2 function
function len2: (a: V2, b: V2) => numberpackages/clothing/src/pattern.ts:187
lerp3 function
function lerp3: (a: V3, b: V3, t: number) => V3packages/clothing/src/body.ts:33
limbGirth function
function limbGirth(body: ClothingBody, a: V3, b: V3, t: number, maxR: number): numbergirth round a limb: the cross-section perpendicular to the segment a->b at fraction t, only vertices nearer than maxR to the axis
packages/clothing/src/body.ts:280
listAnims function
function listAnims(rec: OutfitRecord): { clip: string; garment: string }[]packages/clothing/src/cache.ts:237
locate function
function locate(d: DressedGarment, panel: string, at: V2): { p: V3; n: V3; v: number } | nullthe dressed position, normal and nearest vertex of a flat point of a panel (barycentric in the panel triangle that holds it)
packages/clothing/src/trims.ts:14
makeCtx function
function makeCtx(body: ClothingBody, m: Measurements, spec: BodySpec): UpperCtxpackages/clothing/src/parts/ctx.ts:124
mapRig function
function mapRig(jointNames: string[], jointPositions: RigV3[], jointParents?: number[], hint?: RigHint, map?: RigOverride): RigMapResolves the bone roles of a skeleton (joint names, bind-pose world positions, parent per joint with -1 for a root). Order: the names (unless hint.scheme is 'geometry'), then the geometry of the tree for the roles the names left out (needs jointParents), then map. The left side is the +x side: a rig whose names put the left at -x is swapped, so callers can rely on 'l' being at +x.
packages/clothing/src/rig.ts:187
mat4Identity function
function mat4Identity(out: Float32Array | Float64Array, o = 0): voidpackages/clothing/src/motion.ts:30
mat4InvAffine function
function mat4InvAffine(m: ArrayLike<number>, out: Float32Array | Float64Array): booleanthe inverse of an affine matrix (rotation, scale, translation)
packages/clothing/src/motion.ts:32
mat4Mul function
function mat4Mul(a: ArrayLike<number>, ao: number, b: ArrayLike<number>, bo: number, out: Float32Array | Float64Array, oo = 0): voidout = a then b (row vectors: p a b)
packages/clothing/src/motion.ts:25
measureBody function
function measureBody(body: ClothingBody): Measurementsthe body's measurements, from its joints (by role, see rig.ts) and cross-sections
packages/clothing/src/body.ts:302
meshPanel function
function meshPanel(panel: Panel, h: number, counts: Map<string, number> = new Map()): PanelMeshMesh a panel: every edge resampled into counts.get(edge) segments (or by h), interior points on a triangular lattice of spacing h
(none closer than 0.6 h to the outline), Delaunay triangulation (Bowyer-Watson), triangles outside the outline dropped. Deterministic.
packages/clothing/src/pattern.ts:255
mirrorEdges function
function mirrorEdges(edges: PanelEdge[]): PanelEdge[]mirror a panel's outline in x (a left front from a right one); edge order reversed so the outline keeps its winding
packages/clothing/src/pattern.ts:234
nativeStyle function
function nativeStyle(block: string, style: Record<string, unknown>): Record<string, unknown>the style in the keys the block function takes: for blocks that exist, closure/pockets/length/fit/collar become the block's own numbers
packages/clothing/src/catalog.ts:360
neckerchief function
function neckerchief(body: ClothingBody, m: Measurements, s: KerchiefStyle = {}): Garmentpackages/clothing/src/blocks/headwear.ts:63
neckJoint function
function neckJoint(body: ClothingBody): V3the neck joint; a rig without one gets the point half way from the top of the spine (or the pelvis) to the head
packages/clothing/src/body.ts:60
newHit function
function newHit: () => SurfaceHitpackages/clothing/src/body.ts:223
norm function
function norm: (a: V3) => V3packages/clothing/src/body.ts:32
normalize function
function normalize(s: string): stringthe normal form of a description: lower case, ё as е, hyphens and underscores as spaces, one space between words
packages/clothing/src/catalog.ts:329
notchChain function
function notchChain(panel: string, tag: string, x0: number, x1: number, y: number, notches: { x: number; intake: number; apexY: number }[]): { edges: PanelEdge[]; pieces: string[]; seams: Seam[] }the waist edge of a panel with notches: the edges (pieces and the two legs of each notch) and the seams that close the notches
packages/clothing/src/blocks/skirt.ts:63
notchedEdge function
function notchedEdge(x0: number, x1: number, y: number, notches: { x: number; intake: number; apexY: number }[]): { pieces: V2[][]; legs: [V2, V2, V2][] }A pattern edge with notches (darts) cut into it: the straight edge from x0 to x1 at height y with a notch of intake at each x whose apex lies apexY away (up for positive). Returns the straight pieces between the notches and each notch's legs (base a, apex, base b), in the order along the edge, so a panel's outline can be assembled as piece, leg, leg, piece ...
packages/clothing/src/fit.ts:148
outfitKey function
function outfitKey(input: OutfitInput): stringthe content key of an outfit on a body: 64 hex digits. Any change of any input gives another key; the order of object keys does not.
packages/clothing/src/cache.ts:130
parseBakedCloth function
function parseBakedCloth(bytes: Uint8Array): BakedClothpackages/clothing/src/bake.ts:152
parseBoneName function
function parseBoneName(raw: string): Parsedstrips the namespace / family prefix and splits off the side: 'mixamorig:LeftUpLeg' -> {l, 'upleg'}, 'thigh_l' -> {l, 'thigh'}, 'CC_Base_R_Calf' -> {r, 'calf'}
packages/clothing/src/rig.ts:52
pathLength function
function pathLength: (p: V3[]) => numberpackages/clothing/src/blocks/common.ts:57
peak function
function peak(d: DressedGarment, panel: string, edge: string, o: { depth?: number; half?: number; material?: string } = {}): TrimMesh | nulla cap's peak: a stiff curved plate sewn along the front of the band's bottom edge, depth deep, tilted down a little, with a rolled edge
packages/clothing/src/trims.ts:54
placePoint function
function placePoint(panel: Panel, uv: V2, top: number, mid: number): V3the 3D start position of a flat panel point: wrapped on the panel's tube
packages/clothing/src/drape.ts:65
pointInPolygon function
function pointInPolygon(p: V2, poly: V2[]): booleanpackages/clothing/src/pattern.ts:219
polyLength function
function polyLength: (p: V2[]) => numberpackages/clothing/src/pattern.ts:188
requireRoles function
function requireRoles(rig: RigMap, roles: readonly BoneRole[] = ESSENTIAL_ROLES): voidthrows with the list of roles the garments cannot do without if any is missing
packages/clothing/src/rig.ts:240
resample function
function resample(p: V2[], n: number): V2[]points of a polyline at n + 1 equal arc-length steps (both ends included)
packages/clothing/src/pattern.ts:191
rigPoint function
function rigPoint(rig: RigMap, positions: RigV3[], role: BoneRole): RigV3 | nullworld position of a role, or null
packages/clothing/src/rig.ts:236
roleJoint function
function roleJoint(body: ClothingBody, role: BoneRole): V3the bind-pose position of the joint that plays role; throws if the rig has none
packages/clothing/src/body.ts:52
sameOutfit function
function sameOutfit(a: OutfitRecord, b: OutfitRecord): booleantwo records are the same when their files are the same bytes
packages/clothing/src/cache.ts:306
sampleBakedCloth function
function sampleBakedCloth(b: BakedCloth, time: number, rest: ArrayLike<number>, out: Float32Array): Float32ArrayPlay a baked cloth: the bind-pose positions of the garment at time seconds into out (rest positions with the stored offsets of the two frames round time blended), no simulation. A loop wraps; a clip that does not loop holds its last frame.
packages/clothing/src/bake.ts:130
scale function
function scale: (a: V3, s: number) => V3packages/clothing/src/body.ts:29
seamRank function
function seamRank(s: Seam, transverse: boolean): numberThe rank of a seam in the order of sewing: the garment's own stage when it gives one; else by what the seam is. The scale is the one the blocks use (a seam without a stage is a body seam: 0; a sleeve's underarm seam 0, a sleeve into its armhole 1, a collar or a band 2); darts come before everything, shoulders before the sides, a hinge (a collar's fall, a lapel's roll) last.
packages/clothing/src/sew.ts:246
serializeBakedCloth function
function serializeBakedCloth(b: BakedCloth): Uint8Arraybytes of a baked cloth: a JSON header (length first), then the active vertices (uint32) and the data (int16)
packages/clothing/src/bake.ts:144
setAnim function
function setAnim(rec: OutfitRecord, a: CachedAnim): voidthe baked animation slot: put (replacing the same clip and garment), get, list
packages/clothing/src/cache.ts:229
settingEase function
function settingEase(sleeve: SleeveKind, cloth?: ClothProps): numberHow much longer the cap of a set-in sleeve is than the armhole it goes in (the fraction): the cap is eased in by steaming and a row of gathering stitches. A knit takes no ease (it stretches), a light woven 2.5 %, a heavy woollen 5 % (it shrinks under the iron); the other sleeves have no cap to ease: their edge is as long as the armhole.
packages/clothing/src/blocks/ease.ts:39
sewGarment function
function sewGarment(g: Garment, o: SewOptions = {}): SewnGarmentsew a garment off the body: its pieces on their form, its seams closed stage by stage, the closed seams welded into nodes
packages/clothing/src/sew.ts:350
shirt function
function shirt(body: ClothingBody, m: Measurements, s: ShirtStyle = {}): Garmentpackages/clothing/src/blocks/shirt.ts:14
shorts function
function shorts(body: ClothingBody, m: Measurements, s: ShortsStyle = {}): Garmentpackages/clothing/src/blocks/shorts.ts:131
shrinkTargets function
function shrinkTargets(body: ClothingBody): Float32Array | nullfor every body vertex, the nearest point on the bones it is skinned to (weighted): the body shrinks toward these and keeps its shape
packages/clothing/src/body.ts:340
skinPositions function
function skinPositions(positions: ArrayLike<number>, joints: ArrayLike<number>, weights: ArrayLike<number>, mats: ArrayLike<number>, out: Float32Array | Float64Array, only?: ArrayLike<number>): voidlinear blend skinning of positions (the vertices only or all) by 4 joints and weights per vertex, into out
packages/clothing/src/motion.ts:46
skirt function
function skirt(body: ClothingBody, m: Measurements, s: SkirtStyle = {}): Garmentpackages/clothing/src/blocks/skirt.ts:76
sleeveReach function
function sleeveReach(U: UpperFrame, len: UpperSleeveLength): numberthe sleeve's end along the arm from the shoulder joint, metres (long: to the wrist, a little short as a tailored sleeve is)
packages/clothing/src/parts/util.ts:41
spineJoints function
function spineJoints(body: ClothingBody): V3[]the spine chain from the pelvis up (may be empty)
packages/clothing/src/body.ts:58
sub function
function sub: (a: V3, b: V3) => V3packages/clothing/src/body.ts:27
subPath function
function subPath(p: V3[], from: number, to: number): V3[]the part of a polyline between arc lengths from and to (extended along the last segment past its end)
packages/clothing/src/blocks/common.ts:47
supportKindFor function
function supportKindFor: (fitting: Fitting) => "fitted" | "hung"the kind of support a fitting gives a garment that is not hung by its cut: a loose cut hangs from the shoulders, a close one rests on the body
packages/clothing/src/blocks/ease.ts:30
supportOf function
function supportOf(kind: HoldKind, panels: Panel[], pinned: PinnedLine[], o: { zones?: Support['zones']; what?: Record<string, StiffPiece['what']> } = {}): Supportthe support of a garment from its panels: the stiffened pieces are the panels whose stiff is above 1 (what by name unless given)
packages/clothing/src/blocks/ease.ts:84
supportsOf function
function supportsOf(g: Garment, extra: SupportSpec[] = []): SupportSpec[]The supports of a garment: the lines its pattern pins (Garment.support.pinned, each with its role) plus extra. A pattern that does not state its support (an old or hand-made one) gets the lines it can be read to hold: its held edges, shoulder seams and collar stand.
packages/clothing/src/sew.ts:261
topAt function
function topAt(body: ClothingBody, x: number, zMax = 0.07): numberthe top of the body over the shoulder line at |x| (highest vertex within 6 mm of |x|, not further than zMax from the body's mid plane)
packages/clothing/src/blocks/common.ts:5
transferSkin function
function transferSkin(body: ClothingBody, d: Pick<DressedGarment, 'positions' | 'indices'>, o: { smooth?: number; reach?: number } = {}): ClothSkinpackages/clothing/src/transfer.ts:12
trimRecord function
function trimRecord(tr: TrimMesh, garment: string, skin: ClothSkin, o: { texture?: CachedTexture; material?: Record<string, unknown> } = {}): CachedMesha record mesh from a trim, weighted like the cloth vertex it rides on
packages/clothing/src/cache.ts:222
trimsOf function
function trimsOf(d: DressedGarment, o: { buttonStyle?: 'horn' | 'brass' } = {}): TrimMesh[]all trims of a dressed garment
packages/clothing/src/trims.ts:80
trousers function
function trousers(body: ClothingBody, m: Measurements, s: TrouserStyle = {}): Garmentpackages/clothing/src/blocks/trousers.ts:32
tshirt function
function tshirt(body: ClothingBody, m: Measurements, s: TshirtStyle = {}): Garmentpackages/clothing/src/blocks/tshirt.ts:14
tuckUnder function
function tuckUnder(low: DressedGarment, up: DressedGarment, body: Surface): voidA garment dressed over another may leave the one under it standing outside its cloth in places (a shirt through a jacket's sleeve or hem). Every vertex of the lower garment that lies outside the upper one's cloth, near it and not past its free edges (where the upper garment is open: a shirt shows in the V of a jacket) is moved in to just under the upper cloth, never nearer the body than keep. Seam-welded vertices move together (same position, same move), and the normals are recomputed.
packages/clothing/src/drape.ts:109
underThickness function
function underThickness(under?: Under): numberthe radial thickness of everything under the garment, metres (a layer's cloth stands thickness off the layer below)
packages/clothing/src/blocks/ease.ts:15
unskinPositions function
function unskinPositions(posed: ArrayLike<number>, joints: ArrayLike<number>, weights: ArrayLike<number>, mats: ArrayLike<number>, out: Float32Array | Float64Array, only?: ArrayLike<number>): voidThe inverse of skinning: the bind-pose position that, skinned by mats, lands on posed. A mesh drawn with GPU skinning plays a simulated or baked cloth by having these in its vertex buffer. A vertex whose blended matrix cannot be inverted keeps posed.
packages/clothing/src/motion.ts:63
upperEases function
function upperEases(o: { fitting: Fitting; kind: HoldKind; fit?: Pick<BodyFit, 'childness'>; t?: number; chest?: number; sleeve?: SleeveKind; cloth?: ClothProps; sleeveless?: boolean }): UpperEasesthe eases of an upper garment of a fitting, worn over layers of a total thickness t (an explicit chest ease replaces the rule's)
packages/clothing/src/blocks/ease.ts:64
upperFrame function
function upperFrame(body: ClothingBody, m: Measurements): UpperFramepackages/clothing/src/blocks/common.ts:23
upperPinned function
function upperPinned(panels: Panel[], kind: HoldKind): PinnedLine[]the pinned lines of an upper garment from the panels it has: the shoulder seams, the neck edges (the collar's bottom or the bare neckline), the closure edges of the fronts
packages/clothing/src/blocks/ease.ts:96
validateFabricSpec function
function validateFabricSpec(v: unknown, path: string): DescribeIssue[]the problems of a FabricSpec given as JSON, each naming its field
packages/clothing/src/describe.ts:261
validateStyle function
function validateStyle(block: string, style: unknown, path = 'style'): string[]check a style against a block's options; returns one message per problem, each naming the field (path + key)
packages/clothing/src/catalog.ts:342
vertexNormals function
function vertexNormals(pos: ArrayLike<number>, idx: ArrayLike<number>): Float32Arrayvertex normals (area weighted)
packages/clothing/src/body.ts:75
waistcoat function
function waistcoat(body: ClothingBody, m: Measurements, s: WaistcoatStyle = {}): Garmentpackages/clothing/src/blocks/waistcoat.ts:13
waistLine function
function waistLine(body: ClothingBody, m: Measurements, w: SkirtStyle['waist'] = 'natural', fit?: BodyFit): { y: number; girth: number }the height of the skirt's top above the floor and its girth there
packages/clothing/src/blocks/skirt.ts:54
waistSupport function
function waistSupport(panels: Panel[], waistEdges: { panel: string; edge: string }[], o: { depth?: number; bend?: number } = {}): Supportthe support of a waist-held garment (a skirt, trousers, shorts, breeches): the waistband's top edge is pinned at the waist line, and a strip of depth below it is stiff (the waistband and its interfacing)
packages/clothing/src/blocks/ease.ts:107
weltPieces function
function weltPieces(ctx: UpperCtx, halves: WeltHalf[], spec: HemSpec, closedFront: boolean): Piecethe welt bands under the half panels, joined to their hems, to one another at the sides, the back (and the front when it is closed)
packages/clothing/src/parts/hems.ts:25
witchHat function
function witchHat(body: ClothingBody, m: Measurements, s: WitchHatStyle = {}): GarmentA pointed hat: the cone is a circular sector (a developable cone) in two halves sewn up the sides, bent back at the tip with the point curling down, on a wide brim in two halves; felt with buckram (brim and cone stiff). It sits on the head by the cone's foot.
packages/clothing/src/blocks/accessories.ts:40
Interfaces
Anchor interface
interface Anchorpackages/clothing/src/parts/sleeves.ts:30
BakedCloth interface
interface BakedClothformat: 1 | |
garment: string | the garment and the clip it was made for (names, as the record keys them) |
clip: string | |
fps: number | frames per second of the stored frames, how many frames, the clip's length in seconds and whether it loops (a loop has frames distinct frames, the next after the last is the first) |
frames: number | |
duration: number | |
loop: boolean | |
vertexCount: number | vertices of the garment, and the ones stored (ascending) |
active: Uint32Array | |
scale: number | metres per unit of data |
data: Int16Array | frames x active x 3, the offset of the vertex from its rest position in the bind pose |
packages/clothing/src/bake.ts:27
BakedGarment interface
interface BakedGarmentwidth: number | |
height: number | |
albedo: Uint8Array | RGBA 8 bit, sRGB colour |
normal: Uint8Array | RGBA 8 bit, tangent-space normal (y up in the flat panel = v up) |
orm: Uint8Array | RGBA 8 bit: R occlusion, G roughness, B metal (glTF ORM) |
uv: Float32Array | per vertex atlas UV (v down, glTF) |
pxPerMeter: number |
packages/clothing/src/fabric.ts:38
BakeOptions interface
interface BakeOptionsfps?: number | stored frames per second; it must divide 60 (60, 30, 20, 15, 12, 10; default 30) |
motion?: MotionOptions | simulation of the garment (see MotionOptions); the garment's skin, supports and layers under it go here |
warmCycles?: number | cycles run before the first stored frame for a looping clip (default 3), and frames the first pose is held for a clip that does not loop (default 60) |
warmHold?: number | |
loopBlend?: number | seconds over which the start of a loop is blended into the continuation of its end, so the loop closes (default 0.3) |
garmentName?: string | names for the record |
clipName?: string | |
onFrame?: (frame: number, positions: Float32Array, mats: Float32Array) => void | called for every stored frame with the simulated cloth (positions in the pose, the pose matrices) before it is turned into offsets |
packages/clothing/src/bake.ts:42
BeanieStyle interface
interface BeanieStyleheight?: number | body height above the cuff, metres (default 0.13: a little slouch) and cuff height (default 0.07) |
cuff?: number | |
fitted?: number | how much of the head's girth the knit takes (the knit stretches round the head; default 0.93) |
hair?: number | |
fabric?: string | |
rib?: string | |
layer?: number |
packages/clothing/src/blocks/hats.ts:20
BeltStyle interface
interface BeltStylewidth?: number | width of the band, metres (default 0.04) |
waist?: 'natural' | 'high' | 'low' | number | where it sits: the natural waist, high or low, or metres above (+) / below (-) it |
under?: Under | the layers worn under it (dress, skirt, a wrap: thicknesses in metres or garments): the ring is longer by their room |
buckle?: boolean | a buckle at the front (default true) |
ease?: number | how loose it is, metres of girth (default 0.01) |
fabric?: string | |
layer?: number |
packages/clothing/src/blocks/accessories.ts:148
BlockSpec interface
interface BlockSpecname: string | |
implemented: boolean | false: registered by name and options, the block itself is being written by another lane |
description: string | |
nouns: (string | NounSpec)[] | |
options: Record<string, OptionSpec> | |
defaultFabric: string | the fabric used when a description names none |
woolAs?: string | the fabric that "wool" means for this block (default: wool serge) |
longLength?: string | what "long" means for this block's length |
native?: (style: Record<string, unknown>) => Record<string, unknown> | implemented blocks: turns the described options (closure, pockets, length, fit, collar ...) into the keys the block function takes |
packages/clothing/src/catalog.ts:32
BodyFit interface
interface BodyFitFits: descriptors a cut needs beyond measureBody, computed from the measurements and the body itself and the same for any sex or age: the bust (girth, height, apexes), the underbust, the waist and hip lines, the proportions of a child, and the ease a style asks for. darts turns them into the bust and waist darts that shape a bodice or a skirt.
height: number | floor to the top of the head, metres |
headsTall: number | heads tall (height over the head's height) and crotch height over height: a child is short, short-legged and big-headed |
legRatio: number | |
childness: number | 0 = adult proportions, 1 = a small child (from height and proportions) |
child: boolean | |
bust: number | the bust: girth at the fullest point, its height, the apexes (x, z) of the left (+x) and right sides, their distance |
bustY: number | |
apex: { l: V2; r: V2 } | |
bustSpan: number | |
bustProjection: number | how far the bust stands out in front of the ribs, metres, and the (bust - underbust) girth difference |
bustDifference: number | |
underbust: number | |
underbustY: number | |
waist: number | |
waistY: number | |
highHip: number | a hand's breadth below the waist: the high hip |
highHipY: number | |
hip: number | |
hipY: number | |
waistToHip: number | vertical distance from the waist to the fullest part of the hip |
neckToBust: number | neck point to the bust, to the waist (front length) |
neckToWaist: number | |
bustToWaist: number | the shaping a figure has from the bust and the hip down to the waist (metres of girth) |
hipToWaist: number |
packages/clothing/src/fit.ts:10
BodySpec interface
interface BodySpechemY: number | world height of the lowest edge of the garment (below any welt) |
ease: number | ease over the chest, metres in all |
fit: Fit | |
flare: number | extra girth at the hem (aline: from the chest down; fitted: below the seat), metres in all |
cbWaist: number | how far the centre back seam is taken in at the waist, metres |
pad: number | extra start radius over the body's half depth (the start shape of the old drape only) |
eases: UpperEases | the cutting rules' eases for this garment (see upperEases): ease is its chest ease |
welt: number | height of a rib or self band under the body (0: none) |
fabric: string | |
rib: string | |
backNeckDrop: number | the front's armhole depth below the chest line, metres (set by the sleeve) |
packages/clothing/src/parts/ctx.ts:32
BootPart interface
interface BootPartname: string | |
pos: number[] | |
nrm: number[] | |
uv: number[] | |
idx: number[] | |
material: 'leather' | 'sole' | 'lace' | 'metal' |
packages/clothing/src/footwear.ts:20
Boots interface
interface Bootsparts: BootPart[] | |
raise: number |
packages/clothing/src/footwear.ts:21
BootStyle interface
interface BootStyleFootwear on a last: a boot is built round the body's own foot, as a shoemaker builds it round a last taken from the foot: a sole following the foot's outline with a heel block and a welt, an upper lofted from the sole up over the foot with the room a foot needs, a shaft round the ankle, a tongue and a laced opening with eyelets and laces. Meshes in metres, in the body's frame.
shaft?: number | shaft height above the floor (default 0.15: an ankle boot) |
sole?: number | sole and heel thickness |
heel?: number | |
room?: number | room round the foot |
eyelets?: number | eyelets per side |
packages/clothing/src/footwear.ts:9
BreechesStyle interface
interface BreechesStyleBreeches: the leg block of the shorts cut full over the thigh (flare, the riding breeches' wings) and closed on a
band below the knee (band), buttoned or laced in life: here a ring sewn to the hem. length 'knee' puts the band just under the knee,
'calf' on the calf, or give the height of the band's top above the floor.
length?: 'knee' | 'calf' | number | |
flare?: number | extra half width at the wings on each seam, metres (default 0.05) |
band?: number | band height (default 0.08) and its ease over the leg there (default 0.02) |
bandEase?: number | |
fitting?: Fitting | |
under?: Under | |
seatEase?: number | |
waistEase?: number | |
rise?: number | |
fabric?: string | |
layer?: number |
packages/clothing/src/blocks/breeches.ts:13
BrimmedHatStyle interface
interface BrimmedHatStyleHats beyond the cap: a brimmed hat (a tube crown with a flat top and a stiff brim cut in two halves, the way a felt hat
is blocked) and a beanie (a knitted tube closed at the top, with a rib cuff). Both sit on the hair line round the head (hair keeps them
off the scalp). The hood is the upper-garment lane's.
crown?: number | crown height and brim width, metres (defaults 0.1 and 0.06: a trilby) |
brim?: number | |
crownOver?: number | the crown's top is wider than the head by this much (default 0.008) |
hair?: number | hair under it, metres (default 0.012) |
fabric?: string | |
layer?: number |
packages/clothing/src/blocks/hats.ts:11
BrodyHelmetStyle interface
interface BrodyHelmetStyledome?: number | radius of the dome, metres (default 0.105) |
brim?: number | width of the brim measured along the slope (default 0.052) and how far its outer edge hangs below its inner (default 0.034) |
drop?: number | |
strap?: boolean | a chin strap |
hair?: number | |
fabric?: string | |
layer?: number |
packages/clothing/src/blocks/accessories.ts:83
CachedAnim interface
interface CachedAnimBaked cloth animation of one garment for one clip (written by the cloth animation bake, read by the game). Three kinds: - positions: frames frames of vertexCount vertices, x y z each, at fps, in data; - vat: the same as a vertex animation texture in data (RGBA32F, width x height); - baked: the block of bakeClip (serializeBakedCloth bytes: the vertices that move, 16-bit offsets from rest) in bytes, data empty;
`bakedToAnim` and `animToBaked` (bake.ts) turn it from and to the typed `BakedCloth`. `frames`, `fps` and `vertexCount` are the block's own.clip: string | |
garment: string | |
fps: number | |
frames: number | |
vertexCount: number | |
kind: 'positions' | 'vat' | 'baked' | |
data: Float32Array | |
width?: number | |
height?: number | |
bytes?: Uint8Array | kind: 'baked': the serialized block |
packages/clothing/src/cache.ts:180
CachedEdge interface
interface CachedEdgepanel: string | |
edge: string | |
verts: Uint32Array |
packages/clothing/src/cache.ts:142
CachedGarment interface
interface CachedGarmentname: string | |
positions: Float32Array | |
normals: Float32Array | |
uv: Float32Array | |
indices: Uint32Array | |
joints: Uint16Array | 4 joint indices and 4 weights per vertex (the body's skeleton) |
weights: Float32Array | |
panelOf: Uint16Array | the panel of each vertex, index into panels |
panels: string[] | |
edges: CachedEdge[] | the edge vertex lists trims and hems need |
hems: { panel: string; edge: string }[] | |
texture?: CachedTexture | |
material?: Record<string, unknown> | material parameters (sheen ...), plain JSON |
packages/clothing/src/cache.ts:144
CachedHidden interface
interface CachedHiddenthe body triangles hidden under the outfit at a level of detail: one byte per triangle, 1 = hidden
lod: number | |
mask: Uint8Array |
packages/clothing/src/cache.ts:171
CachedMesh interface
interface CachedMesha trim or a boot part: its own mesh, skinned, with its material
name: string | |
kind: string | |
pos: Float32Array | |
nrm: Float32Array | |
uv: Float32Array | |
idx: Uint32Array | |
joints?: Uint16Array | |
weights?: Float32Array | |
garment?: string | the garment it rides on, and the vertex of that garment it follows |
rides?: number | |
texture?: CachedTexture | |
material: Record<string, unknown> |
packages/clothing/src/cache.ts:160
CachedTexture interface
interface CachedTexturepackages/clothing/src/cache.ts:140
CapStyle interface
interface CapStyleA soft peaked cloth cap: a round crown wider than the head (it sags over the band), a band round the head held at the
brow, a stiff peak sewn to the front of the band. clearance keeps it off the scalp by the hair's thickness.
crownOver?: number | crown radius over the head's (default 0.035: a full, flat cap) |
band?: number | |
peak?: number | |
hair?: number | hair under it, metres (default 0.012) |
fabric?: string | |
layer?: number |
packages/clothing/src/blocks/headwear.ts:11
CatalogFabric interface
interface CatalogFabricFabric catalogue: named fabrics, each a surface (FabricSpec, baked by bakeGarment) and the way the cloth behaves
in the drape (ClothProps: density kg/m^2, stretch and bend compliances, half thickness, friction). A description picks a fabric by
name and a colour by word; fabricFor makes the pair with that colour.
name: string | |
words: string[] | words that name this fabric in a description (lower case, English words and Russian stems) |
spec: FabricSpec | |
cloth: ClothProps |
packages/clothing/src/fabrics.ts:10
CloakStyle interface
interface CloakStyleA cloak or cape: a circle of cloth with a hole at the neck, cut in two halves joined down the back, open at the front
and clasped at the neck. It starts flat at the shoulders and falls over them. length is how far it hangs below the neck point (a
hem height name, or metres), spread the angle of each half (a circle cape 2.8, a capelet 2.0), collar none | stand | hood.
length?: UpperHemName | number | the hem: a height name, or metres below the neck point (default 'calf': a cloak; 0.45: a cape) |
spread?: number | the angle of each half round the neck, radians (default 2.7; the front stays open by pi minus that on each side) |
collar?: CollarSpec | 'none' | 'stand' | 'hood' | |
hood?: HoodSpec | |
under?: Under | the layers worn under it (thicknesses in metres or garments): the neck ring is wider by their thickness |
fabric?: string | |
layer?: number |
packages/clothing/src/blocks/cloak.ts:17
ClosureDraft interface
interface ClosureDraftkind: NonNullable<ClosureSpec['kind']> | |
e: number | |
edges: (from: V2, lapel: boolean, y0: number) => PanelEdge[] | the front edges after the neck (and a lapel's roll): from from to the hem |
build: (o: { end: V2; lapel: boolean; yB: number; buttonTop: number }) => Piece |
packages/clothing/src/parts/closures.ts:24
ClosureSpec interface
interface ClosureSpecClosures: single-breasted (buttons on the centre front, a small overlap), double-breasted (a wide overlap, two columns), zip (the fronts sewn along the centre front, topstitched), pullover (the fronts sewn along the centre front), wrap (the left front crosses over the right, held at the waist). The left front lies over the right.
kind?: 'single' | 'double' | 'zip' | 'pullover' | 'wrap' | |
buttons?: number | number of buttons in a column (default from the length of the front) |
buttonSize?: number | button diameter (default 0.012; double-breasted 0.024) |
extension?: number | half the overlap past the centre front (default by kind: single 0.03, double 0.085, wrap 0.15) |
buttonX?: number | double-breasted: distance of each column from the centre front (default 0.065) |
lowest?: number | the lowest button, relative to the hem (default: just under the waist) |
packages/clothing/src/parts/closures.ts:10
ClothingBody interface
interface ClothingBodypositions: Float32Array | metres, y up, the figure faces +z |
indices: Uint32Array | |
joints?: Uint16Array | per vertex, 4 joint indices and 4 weights |
weights?: Float32Array | |
jointNames: string[] | joint names and world positions in the bind pose (UE/MetaHuman names: pelvis, spine_01..05, neck_01, head, clavicle_l, upperarm_l ...) |
jointPositions: V3[] | |
jointParents?: number[] | parent of each joint (-1 for a root): bones are the segments joint-parent |
rigHint?: RigHint | how to read the rig (see rig.ts): a hint for the name matching, and roles given by hand (they win over the names and the geometry) |
rigMap?: RigOverride |
packages/clothing/src/body.ts:10
ClothProps interface
interface ClothPropsdensity?: number | surface density, kg/m^2 (serge 0.45, jersey knit 0.5, cotton shirting 0.12) |
stretch?: number | compliance of stretch (m/N); 0 = inextensible |
bend?: number | compliance of bending |
seamBodyOnly?: boolean | [OLD DRAPE ONLY, OLD-SWITCHES.md] seam vertices ignore the garments under while the seams close (cloth over baggy cloth) |
layersAfter?: boolean | [OLD DRAPE ONLY, OLD-SWITCHES.md] the garments under are not collided with in the settle, only pushed out of afterwards |
seamFinish?: boolean | [OLD DRAPE ONLY, OLD-SWITCHES.md] after the seams are welded the cloth is pushed once more out of the garments under it, and bridged over their grooves (the cleft of a seat under a shirt's back seam) |
underTrim?: number | [OLD DRAPE ONLY, OLD-SWITCHES.md] metres of the top of this garment left out of what a garment over it collides with (a waistband under a shirt) |
hemFair?: boolean | [OLD DRAPE ONLY, OLD-SWITCHES.md] fair the hem across its seams (no V at a seam) and smooth the points where three or more seams meet |
ridgeSeams?: string | [OLD DRAPE ONLY, OLD-SWITCHES.md] regular expression on a seam's name (panelA.edgeA/panelB.edgeB): a seam that stands out as a ridge (surplus cloth gathered along it) is shaved, with its surroundings |
bendLong?: number | |
seamIterations?: number | [OLD DRAPE ONLY, OLD-SWITCHES.md] extra solver iterations of the seam links per substep (corners where several panels meet close tighter; default 14) |
frames?: number | [OLD DRAPE ONLY, OLD-SWITCHES.md] frames of the drape for this garment (overrides the run's): a long run lets a tight, light-seamed garment creep and open at its front edge |
fair?: number | [OLD DRAPE ONLY, OLD-SWITCHES.md] rounds of fairing of the finished cloth (default 6; 0 off) |
shell?: boolean | [OLD DRAPE ONLY, OLD-SWITCHES.md] drape on the body thickened by the garments under it (one smooth shell), not on their cloth: for outer garments (jacket, coat) |
layerPush?: boolean | [OLD DRAPE ONLY, OLD-SWITCHES.md] false: no pushing out of the garments under it at the end (an outer garment that must keep its seams closed; default true) |
thickness?: number | |
clearance?: number | extra distance kept from the body (what the body mesh does not have: hair under a cap), metres |
friction?: number |
packages/clothing/src/pattern.ts:135
ClothSkin interface
interface ClothSkinWeights and hidden body. Every cloth vertex takes the skin of the nearest point of the body surface (the three corner vertices' joints blended by the barycentric weights), then the weights are smoothed along the cloth so a fold does not tear between two bones; the body triangles that every garment covers well inside its edges are listed, to be left out of the drawn body.
joints: Uint16Array | |
weights: Float32Array |
packages/clothing/src/transfer.ts:10
CollarSpec interface
interface CollarSpecCollars: none (a bare neckline: crew, V or scoop), band (a closed rib or self band on the neckline), stand (a mandarin collar with open ends), shirt collar (stand and fall), notched and peaked lapels and shawl (lapels turned back on the roll line, a stand and a fall), hood. A collar gives the shape of the front neckline (and the roll line of a lapel) and, once the body is cut, the panels that go on the neck ring.
kind?: 'none' | 'band' | 'stand' | 'shirt' | 'notched' | 'peaked' | 'shawl' | 'hood' | |
neckline?: 'crew' | 'v' | 'scoop' | the bare neckline of none / band / hood |
depth?: number | depth of the neckline at the centre front (default by kind) |
stand?: number | collar stand and fall heights; a band's height is stand |
fall?: number | |
lapel?: number | lapel width at its point |
gorge?: number | the gorge (where lapel and collar meet) this far below the neck point (default 0.085) |
hood?: HoodSpec | a hood |
packages/clothing/src/parts/collars.ts:14
Dart interface
interface Darta dart: its base point on the pattern's edge, its apex, and the width it takes in at the base (the legs lie either side of the base)
packages/clothing/src/fit.ts:94
DartPlan interface
interface DartPlanbust: { sideY: number; apex: V2; intake: number } | null | the bust dart from the side seam to the apex (pattern coordinates: x from the centre front, y above the waist line); null when the cut needs no bust shaping |
front: { x: number; length: number; intake: number }[] | waist darts, from the waist line up: x from the centre line, the length up from the waist, the intake (one per side of the panel) |
back: { x: number; length: number; intake: number }[] | |
sideIn: number | how much each side seam moves in at the waist on each panel (the rest of the shaping), metres |
total: number | the girth of shaping to take out in all (bust or hip minus waist, with the eases) |
packages/clothing/src/fit.ts:101
DescribedGarment interface
interface DescribedGarmentDescription to garments: describe(text | JSON) turns "a long single-breasted wool overcoat with notched lapels and
flap pockets" (English, or basic Russian) or the structured form into {garments: [{block, style}], fabrics} that clothing.dress takes.
The parser works off the registry (catalog.ts): the words that name each block and set each option are the registry's, so a block
needs no code to be described. The structured form is validated and every problem names its field.
Text grammar: the garment nouns are found first (adjacent nouns make the first a modifier: "jersey dress", "suit jacket"); the text is cut into one clause per garment at the last "and" / comma between two nouns (a clause is the adjectives before its noun and the "with ..." after it); in a clause the fabric is taken first, then the option phrases (longest first), then the colour. A trailing "all in navy wool" applies to every garment that has no fabric or colour of its own.
block: string | |
style: Record<string, unknown> |
packages/clothing/src/describe.ts:18
DescribeIssue interface
interface DescribeIssuefield: string | |
message: string |
packages/clothing/src/describe.ts:31
DescribeOptions interface
interface DescribeOptionsnative?: boolean | turn described options into the keys of blocks that exist (default true); false keeps closure/pockets/length/fit/collar |
packages/clothing/src/describe.ts:27
Description interface
interface Descriptiongarments: DescribedGarment[] | |
fabrics: Record<string, FabricSpec> | key (as in each garment's style.fabric) to surface, for clothing.dress |
cloth: Record<string, ClothProps> | key to cloth behaviour of the catalogue fabric (density, stretch, bend ...), for the drape |
warnings: string[] |
packages/clothing/src/describe.ts:19
Digit interface
interface Digitone digit of a hand: its joint chain from the base to the tip (the tip is extrapolated) and the vertices it owns
joints: number[] | |
chain: V3[] | |
radius: number[] | |
thumb: boolean |
packages/clothing/src/blocks/gloves.ts:31
DrapeOptions interface
interface DrapeOptionsh?: number | triangle size, metres (default 0.012) |
frames?: number | frames of 1/60 s (default 220) |
substeps?: number | |
shrink?: number | how far in the body starts (it grows back to full in the first part of the run), metres |
snapshot?: number[] | frames whose cloth positions are handed to onSnapshot (to look at the run) |
onSnapshot?: (garment: string, frame: number, positions: Float32Array, indices: Uint32Array) => void | |
thin?: number | how thin the body is while the seams close (its limbs scaled toward the bones; default 0.55) |
seamIterations?: number | extra solver iterations of the seam links per substep (default 6): corners where several panels meet close tighter |
fair?: number | rounds of fairing of the finished cloth (default 6; 0 off) |
under?: { positions: ArrayLike<number>; indices: ArrayLike<number> }[] | rigid things the garments hang over besides the body (boots: a trouser leg falls over the shaft, not through it) |
log?: (s: string) => void | progress |
packages/clothing/src/drape.ts:25
DressedCloth interface
interface DressedCloththe result: what the trims, the seam textures and the skin transfer read (the old DressedGarment, with the sewing's welds and edges)
name: string | |
positions: Float32Array | |
normals: Float32Array | |
flat: Float32Array | flat panel coordinates, metres (x across the panel, y along the grain) |
indices: Uint32Array | |
panelOf: Uint16Array | the panel of each vertex (index into panels) |
panels: Panel[] | |
meshes: { mesh: PanelMesh; offset: number }[] | per panel: its mesh (flat outline, edge vertices) with the vertex offset into this garment |
garment: Garment | |
edgeVerts: Map<string, number[]> | the vertices along a panel edge, by panel.edge (global indices) |
weld: Uint32Array | per vertex: the smallest vertex index at its place (welded vertices share it) |
groups: number[][] | |
seamGap: number | the widest gap of the seams just before they were sewn shut, metres (from the sewing) |
stats: { frames: number; contacts: number; restedFrames: number; maxSpeed: number; pinned: number; startedInside: number } |
packages/clothing/src/dress.ts:24
DressedGarment interface
interface DressedGarmentDressing: the panels of a garment are meshed, wrapped round the body where they belong, sewn (the seams close step by step, then the paired edge vertices are welded) and left to settle under gravity against the body and the garments dressed before.
name: string | |
positions: Float32Array | |
normals: Float32Array | |
flat: Float32Array | flat panel coordinates, metres (x across the panel, y along the grain) |
indices: Uint32Array | |
panelOf: Uint16Array | the panel of each vertex (index into panels) |
panels: Panel[] | |
meshes: { mesh: PanelMesh; offset: number }[] | per panel: its mesh (flat outline, edge vertices) with the vertex offset into this garment |
garment: Garment |
packages/clothing/src/drape.ts:10
DressOptions interface
interface DressOptionsframes?: number | frames of 1/60 s of the settle (default 240) |
substeps?: number | substeps per frame (default 8) |
self?: boolean | collision of the cloth with itself (default true) |
ramp?: number | frames over which gravity grows from nothing to full (default 20) |
release?: number | the part of the run, at its end, with the pins released (default 0.15): what rests there is the result |
clearance?: number | extra distance kept from the body, metres (hair under a cap; adds to cloth.clearance) |
log?: (s: string) => void | progress |
onFrame?: (frame: number, positions: Float32Array) => void | called with the cloth's positions (per vertex) every every frames, to look at the run |
every?: number | |
maxSpeed?: number | speed limit of the cloth while it settles, m/s (default 2) |
pull?: number | the fitted pull toward the body, m/s at its strongest (default 0.15) |
packages/clothing/src/dress.ts:50
DressRequest interface
interface DressRequestentity: string | the entity whose skinned mesh is the body (its first skinned mesh, or mesh by name) |
mesh?: string | |
garments: { block: string; style?: Record<string, unknown> }[] | |
fabrics: Record<string, FabricSpec> | |
h?: number | triangle size and frames of the drape |
frames?: number | |
hide?: boolean | leave the covered body triangles out (default true) |
maxTex?: number | texture side limit |
packages/clothing/src/service.ts:40
DressStyle interface
interface DressStylecut?: DressCut | |
fitting?: Fitting | |
under?: Under | the layers worn under it (thicknesses in metres or garments): the cut is wider by the room they take |
length?: number | HemName | hem: a name, or metres below the waist (default 'knee') |
sleeves?: SleeveLength | |
neckline?: Neckline | |
flare?: number | A-line: how much wider the hem is than the hip on each half panel, metres (default 0.16) |
fabric?: string | |
layer?: number |
packages/clothing/src/blocks/dress.ts:20
FabricSpec interface
interface FabricSpecweave: Weave | |
color: [number, number, number] | linear RGB 0..1 |
weft?: [number, number, number] | colour of the weft threads (denim: indigo warp, pale weft; the twill shows the weft on the other face); other weaves ignore it |
wales?: number | corduroy: wales per metre (default 700 = 1.4 mm period); velvet: pile sheen strength 0..1 (default 0.6) |
pile?: number | |
heather?: [number, number, number] | second fibre colour mixed in (heathered wool), and how much |
heatherAmount?: number | |
period?: number | thread / stitch period, metres: twill wale 0.0008, knit stitch width 0.0036, rib 2 x 2 |
roughness?: number | |
depth?: number | relief depth of the weave, metres |
wear?: number | how worn: lighter, smoother on raised parts, fuzz |
yoke?: { panels: string[]; above: number; pattern: 'ladder' | 'moss' | 'ridges' } | a knitted yoke pattern above this panel y on the panels listed (the guernsey's patterned chest) |
thread?: [number, number, number] | thread of the stitching |
sheen?: [number, number, number] | sheen (wool fuzz) colour and roughness for KHR_materials_sheen |
sheenRoughness?: number |
packages/clothing/src/fabric.ts:13
FolderIO interface
interface FolderIOthe file operations of a folder (Node's fs in the tools, a platform file API in a game); read gives undefined when the file is not there
read(name: string): Promise<Uint8Array | undefined> | |
write(name: string, bytes: Uint8Array): Promise<void> | |
list(): Promise<string[]> | |
remove(name: string): Promise<void> |
packages/clothing/src/cache.ts:338
Garment interface
interface Garmentname: string | |
panels: Panel[] | |
seams: Seam[] | |
tacks?: Tack[] | |
hold?: { panel: string; edge: string; ease?: number; free?: boolean }[] | free: the edge is only kept from sliding down once sewn (it may close its seams freely), instead of pinned to the body |
hems?: { panel: string; edge: string }[] | edges that are hemmed (stitched turn-ups) |
cloth?: ClothProps | cloth behaviour |
h?: number | triangle size for this garment (small things: a cap, a kerchief), metres |
over?: [string, string, number?][] | panels lying over other panels of this garment (a front buttoned over the other, a lapel over its front): [upper, lower, gap metres] |
layer?: number | the order of dressing: lower layers first; a layer collides with all garments dressed before it |
support?: Support | how the garment is held (every block states it) |
seatGirth?: number | girth at the seat (a lower garment): the old way to cut upper garments over it; the new way is the under option of every block (OLD-SWITCHES.md) |
trims?: TrimSpec[] | trims (buttons, eyelets ...) placed on the dressed cloth |
folds?: { axis: [number, number, number][]; amp: number; n: number; twist?: number; from?: number; ramp?: number }[] | [OLD DRAPE ONLY, OLD-SWITCHES.md] hanging folds of a garment with more cloth than the body needs (wide trouser legs), put in after the settle (a field over the 3D position, so
the two sides of a seam move alike): vertical creases round an axis, outward and inward by about amp, growing toward the free end |
packages/clothing/src/pattern.ts:106
GlovePart interface
interface GlovePartname: string | |
pos: number[] | |
nrm: number[] | |
uv: number[] | |
idx: number[] | |
material: 'leather' | 'knit' | 'cloth' |
packages/clothing/src/blocks/gloves.ts:26
Gloves interface
interface Glovesa glove is a shaped shell on the hand: it is held by the hand (the fingers and the wrist), nothing is pinned or sewn on the pattern, and a gauntlet's cuff is stiff
packages/clothing/src/blocks/gloves.ts:28
GloveStyle interface
interface GloveStyleGloves, built like the boots round a last taken from the body: a cuff and palm lofted through cross sections of the hand and forearm, with a finger for each digit (a tube along the digit's joint chain, wide as the digit's own vertices, ending in a round tip), or one mitten pocket for the four fingers and a thumb. Digits are found from the skeleton, not from names: the children of the hand joint are its metacarpals and the thumb; each digit follows its farthest child to the tip. Sizes come from the body's skin weights: the vertices a digit's joints own. Parts are meshes in metres in the body's frame, one per glove and side, a mirror pair for a pair.
kind?: 'glove' | 'mitten' | 'glove' (a finger each) or 'mitten' (the four fingers together, the thumb apart) |
cuff?: 'wrist' | 'gauntlet' | 'elbow' | number | cuff length up the forearm from the wrist: a name or metres (default 'wrist' 0.05) |
room?: number | room round the hand, metres (default 0.004: a close leather glove; 0.012 a knitted one) |
flare?: number | the cuff flares at its top by this much round the radius, metres (default 0 for 'wrist', 0.012 for longer cuffs) |
material?: 'leather' | 'knit' | 'cloth' | |
side?: 1 | -1 | only one hand: 1 left, -1 right (default both) |
packages/clothing/src/blocks/gloves.ts:12
HemSpec interface
interface HemSpecHems: the lower edge of the body: a plain stitched hem (straight or curved up at the sides like a shirt-tail), or a welt, a band of rib or of the cloth sewn under the body (a sweatshirt, a guernsey, a bomber), with side vents or closed.
trim?: 'plain' | 'rib' | 'band' | plain: a turned hem; rib: a rib welt; band: a welt of the main cloth |
height?: number | height of a welt (default 0.06) |
shape?: 'straight' | 'curved' | a plain hem's shape: straight, or curved up at the sides by rise (a shirt-tail) |
rise?: number | |
vents?: boolean | a welt left open at the sides (the guernsey's vents) |
packages/clothing/src/parts/hems.ts:10
HoodSpec interface
interface HoodSpecA hood: two side panels joined along the crown seam (a long curve from the back of the neck over the head to the forehead), the face opening hemmed, the neck edge sewn round the neck ring. The panels start flat behind the head (up) or hanging down the back (down) and the seams carry them round; the cloth settles on the head or on the shoulders.
up?: boolean | the hood up over the head (default false: it hangs down the back) |
ease?: number | ease over the head, metres (default 0.045) |
deeper?: number | extra length of the face opening and crown (a deeper hood), metres |
packages/clothing/src/parts/hood.ts:12
JacketStyle interface
interface JacketStyleA tailored jacket, the double-breasted reefer by default: two backs with a centre seam, two fronts with the double-breasted extension, lapels turned back along the roll line (separate panels sewn on the roll line as a hinge, lying over the fronts), a collar of a stand and a fall turned down over it, set-in sleeves with a crown drafted to the armhole's length, the left front buttoned over the right (tacks at the buttons), flapped pockets.
fitting?: Fitting | how close the cut is (default 'loose': a jacket is worn over a shirt and a waistcoat); the ease over the chest follows from it and grows with the layers under |
under?: Under | the layers worn under it: thicknesses (metres) or garments (default a shirt and a waistcoat) |
chestEase?: number | an explicit ease over the chest (in all), metres, instead of the rule's |
hemBelowCrotch?: number | length: the hem this far below the crotch (default 0.0) |
extension?: number | half the overlap of a double-breasted front past the centre (default 0.085); 0.02 for single-breasted |
buttonRows?: number | buttons: rows (default 3), distance of each column from the centre front (default 0.065) |
buttonX?: number | |
lapel?: number | lapel width at its point, collar stand and fall heights |
stand?: number | |
fall?: number | |
pockets?: boolean | |
fabric?: string | |
lining?: string | |
layer?: number |
packages/clothing/src/blocks/jacket.ts:17
JerseyStyle interface
interface JerseyStyleA knitted jersey, the fisherman's guernsey by default: a body as a front and a back (drop shoulders, a straight armhole), sleeves tapering to the wrist, rib welts at the hem left open at the sides (the guernsey's vents), rib cuffs and a rib stand collar. Sizes from the chest, neck, upper arm, wrist and arm length, with the ease of the style.
fitting?: Fitting | how close the cut is (default 'fitted': a knit is cut close and stretches); the ease follows from it and grows with the layers under |
under?: Under | the layers worn under it (thicknesses in metres or garments; default a shirt) |
chestEase?: number | an explicit ease over the chest, metres in all, instead of the rule's |
length?: number | body length below the shoulder point, metres (default to the top of the seat) |
welt?: number | rib heights: hem welt, cuffs, collar |
cuff?: number | |
collar?: number | |
vents?: boolean | vents: the welts are not sewn at the sides |
fabric?: string | |
rib?: string | |
layer?: number |
packages/clothing/src/blocks/jersey.ts:13
KerchiefStyle interface
interface KerchiefStyleA neckerchief: a long folded strip round the neck over the collar, its ends crossing at the front and hanging, knotted where they cross.
length?: number | |
width?: number | |
fabric?: string | |
layer?: number |
packages/clothing/src/blocks/headwear.ts:61
LayerBelow interface
interface LayerBelowa rigid or cloth surface the garment lies over (a layer dressed before, boots): positions and triangles
positions: ArrayLike<number> | |
indices: ArrayLike<number> |
packages/clothing/src/dress.ts:48
LegBlockStyle interface
interface LegBlockStyleShorts and the leg block they share with breeches: the four-panel trouser draft (front crotch extension seat/16, back seat/8, the back rise raised and slanted) with the hem at any height of the leg: the leg's width at each height comes from the body (the thigh girth where the hem falls) plus the ease and flare of the style. The trousers block itself is untouched.
fitting?: Fitting | how close the cut is (default 'comfortable'): the seat's ease follows from it and grows with the layers under; an explicit seatEase replaces the rule's |
under?: Under | the layers worn under it (thicknesses in metres or garments) |
seatEase?: number | |
waistEase?: number | |
rise?: number | waist line above the natural waist, metres |
hemY: number | hem height above the floor, metres |
hemC: number | finished girth at the hem, metres |
thighFlare?: number | extra girth at the thigh (over the seat's share), the flare of riding breeches; a leg is hemC at the hem, kneeC at the knee when the hem is below it |
kneeC?: number | |
band?: number | a band round the hem: its height and a hem band cut as a separate strip (knee band, cuff) |
fabric?: string | |
layer?: number | |
name: string | |
cloth?: Garment['cloth'] |
packages/clothing/src/blocks/shorts.ts:12
MapEntry interface
interface MapEntrywhat the game records for a character and an outfit: the content key of the dressed outfit and the fit (plain JSON the maker chooses: raise, scale, body key ...)
key: string | |
fit: Record<string, unknown> |
packages/clothing/src/cache.ts:374
Measurements interface
interface Measurementsneck: number | girths (metres round the body) |
chest: number | |
waist: number | |
seat: number | |
thigh: number | |
knee: number | |
calf: number | |
ankle: number | |
upperarm: number | |
elbow: number | |
wrist: number | |
head: number | |
floorY: number | heights above the floor |
neckY: number | |
chestY: number | |
waistY: number | |
seatY: number | |
crotchY: number | |
kneeY: number | |
ankleY: number | |
headBandY: number | |
bootTopY?: number | world height of the top of the boots the figure wears (set by the dressing tool when there are boots): trousers end just over it |
underGirth?: number | girth at the seat of a garment worn under the one being cut (baggy trousers under a shirt): a hem cannot be narrower than what it hangs over |
shoulderHalf: number | half the distance between the shoulder points (the outer ends of the shoulders) |
armLength: number | shoulder point to wrist along the arm |
chestDepth: number | front-to-back depth at the chest and at the seat |
seatDepth: number | |
chestZ: number | z of the body's centre at the chest, waist and seat |
waistZ: number | |
seatZ: number | |
armDir: { l: V3; r: V3 } | the arm's direction from the shoulder (A-pose), per side |
packages/clothing/src/body.ts:248
MotionCollider interface
interface MotionCollidera surface a garment may not enter that is not the body: a garment under it (its positions are read each frame)
positions(): ArrayLike<number> | |
indices: Uint32Array |
packages/clothing/src/motion.ts:81
MotionOptions interface
interface MotionOptionsskin?: ClothSkin | skin weights of the garment's vertices (default: taken from the body, transferSkin) |
driven?: ArrayLike<number> | vertices that follow the skin rigidly (an explicit list wins over support) |
supports?: ArrayLike<number> | the garment's vertices that are held (waistband, shoulder line): the driven part is the cloth within rigid metres of them along the cloth |
support?: SupportKind | { kind: SupportKind } | how the garment is held (Garment.support.kind when the garment has one): 'fitted' follows the skin everywhere, 'hung' and 'waist' hold at the supports and let the rest fall, 'free' holds nothing but the supports |
rigid?: number | distance from the supports that stays rigid, and the width of the band where the cloth goes from rigid to free (metres) |
band?: number | |
density?: number | surface density kg/m2 |
stretch?: number | compliance of stretch and of bending (m/N); the garment's own cloth properties are used when it has them |
bend?: number | |
damping?: number | |
gravity?: number | |
thickness?: number | |
friction?: number | |
substeps?: number | substeps per frame at full detail (default 6) |
budget?: number | work budget per frame in link solves (links x substeps); fewer substeps are taken when the garment is big (default unlimited) |
maxStretch?: number | no edge stretches past this ratio of its length at rest (default 1.1) |
reach?: number | contact search distance round a vertex (metres, default 0.06) |
under?: MotionCollider[] | layers under this garment |
fadeTime?: number | seconds a change between skinned only and simulated takes to blend (default 0.5) |
packages/clothing/src/motion.ts:83
MotionRequest interface
interface MotionRequestentity: string | the entity whose skinned mesh is the body |
garments?: string[] | the dressed garments to move (default: all the entity has under clothing.dress) |
options?: MotionOptions |
packages/clothing/src/motion.ts:345
NeckDraft interface
interface NeckDraftkind: NonNullable<CollarSpec['kind']> | |
frontNeck: V2[] | the front half's neck edge from (nw, yN) to end, the back neck depth |
end: V2 | |
backDrop: number | |
roll?: (e: number, yB: number) => V2[] | a lapel's roll line from end to (-e, yB) |
lapel: boolean | |
build: (ring: NeckRing, e: number, yB: number) => Piece | the panels on the neck ring, given the ring and the front's extension |
buttonTop: number | the front buttons start this far below the neck end |
packages/clothing/src/parts/collars.ts:39
NeckEdge interface
interface NeckEdgeone edge of the neck ring (the body's neck edges, and a raglan sleeve's, in order round the neck)
panel: string | |
edge: string | |
len: number | |
rev: boolean |
packages/clothing/src/parts/collars.ts:31
NeckRing interface
interface NeckRingfrom the centre front on the figure's right, round the back, to the centre front on its left: front_r [sleeve_r] back_r back_l [sleeve_l] front_l
edges: NeckEdge[] | |
front?: { x: number; drop: number } | where the front neck edges end: their distance from the centre front and how far below the neck point |
packages/clothing/src/parts/collars.ts:33
NounSpec interface
interface NounSpecword: string | the phrase that names the block |
implies?: Record<string, string | number | boolean> | options this noun implies ("overcoat" is a coat that is knee long) |
fabric?: string | the fabric this noun implies ("jeans" are denim) |
packages/clothing/src/catalog.ts:23
OptionSpec interface
interface OptionSpecBlock registry: every garment block by name, its style options with their allowed values, the words (English and Russian) that name it and that set its options, and what it is made of when nothing is said. The description parser (describe.ts) works off this registry only, so a block needs no code to be describable: lanes that add blocks register the name here.
Word lists are written in the normal form of normalize: lower case, ё as е, hyphens as spaces ("single breasted", "a line"). An English word also matches its plural (s, es); a Russian word is a stem and matches every word that starts with it. A phrase is words separated by spaces; a value's phrases are tried longest first, so "short sleeves" is not read as "short". A phrase that starts with ~ is a weak default: it counts only when nothing else set the option.
type: 'enum' | 'number' | 'boolean' | 'string' | |
values?: string[] | enum: the allowed values |
min?: number | number: the range and the unit |
max?: number | |
unit?: string | |
description: string | |
words?: Record<string, string[]> | enum: phrases that set each value (see above); $long as a value means the block's longLength |
packages/clothing/src/catalog.ts:12
OutfitInput interface
interface OutfitInputWhat makes a dressed outfit. options is everything else the dressing reads (triangle size, frames, hide, texture size, boots, colliders ...).
body: ClothingBody | |
garments: Garment[] | |
fabrics?: Record<string, unknown> | |
options?: Record<string, unknown> |
packages/clothing/src/cache.ts:114
OutfitRecord interface
interface OutfitRecordformat: number | |
key: string | the content key this record was made for |
core: number | the core version it was dressed by |
garments: CachedGarment[] | |
trims: CachedMesh[] | |
boots: CachedMesh[] | |
hidden: CachedHidden[] | |
anims: CachedAnim[] | |
meta: Record<string, unknown> | whatever the maker keeps with it (the body's key, raise, outfit name ...): plain JSON |
packages/clothing/src/cache.ts:189
PackageFiles interface
interface PackageFilesthe part of a Ferret package source (PackageSource of
list(): string[] | |
has(path: string): boolean | |
read(path: string): Promise<Uint8Array> |
packages/clothing/src/cache.ts:355
Panel interface
interface Panelname: string | |
edges: PanelEdge[] | |
place: Placement | |
fabric?: string | the fabric this panel is cut from (a key of the garment's fabrics) |
stiff?: number | a stiffer panel (interfaced collar, cap peak): bending multiplier |
grain?: number | the grain: the angle (radians) from the panel's y axis to the warp (the lengthwise threads; for a knit, the wales). 0 = the panel's y is along the warp (a body panel), pi/2 = the warp runs along x (a band cut lengthwise), pi/4 = a bias cut (a strip that drapes and stretches round a curve). Default 0. |
packages/clothing/src/pattern.ts:43
PanelEdge interface
interface PanelEdgename: string | |
pts: V2[] | points from the corner where this edge starts to the corner where the next one starts (the last point is that next corner) |
packages/clothing/src/pattern.ts:9
PanelMesh interface
interface PanelMeshpanel: Panel | |
uv: Float64Array | flat positions (metres) |
tris: Uint32Array | |
edgeVerts: Map<string, number[]> | per edge name: the boundary vertex indices along it, from its start to its end (corners included) |
boundary: number[] | boundary vertices (in order round the outline) |
packages/clothing/src/pattern.ts:240
Piece interface
interface PieceParts: the pieces of an upper garment that can be swapped for one another. Every part emits a Piece (panels, seams, tacks, trims ...) given the UpperCtx: the body's frame and the garment's own dimensions (the hem, the girth at every height, the neck, the armhole). composeUpper (compose.ts) puts the chosen parts together into a Garment.
panels: Panel[] | |
seams: Seam[] | |
tacks: Tack[] | |
trims: TrimSpec[] | |
over: [string, string, number?][] | |
hems: { panel: string; edge: string }[] | |
hold: NonNullable<Garment['hold']> |
packages/clothing/src/parts/ctx.ts:13
PinnedLine interface
interface PinnedLinea line of the pattern that is put on the body's matching line and held there: panel and edge names, and what line of the body it belongs to
panel: string | |
edge: string | |
role: 'shoulder' | 'neck' | 'collar' | 'waist' | 'closure' | 'band' | 'cuff' | 'brim' | 'hem' |
packages/clothing/src/pattern.ts:81
Placement interface
interface Placementwhere a panel is put round the body before it is sewn: wrapped on a tube along axis (see drape.ts)
plane?: { origin: [number, number, number]; u: [number, number, number]; v: [number, number, number] } | a flat start instead of a tube: panel point (x, y) at origin + u x + v y (a cap's crown above the head) |
axis: [number, number, number][] | the tube's axis, top to bottom (panel y = 0 at axis[0], growing toward the last point) |
radius: number[] | distance from the axis at each axis point, metres |
angle: number | number[] | angle round the axis (radians, 0 = front +z, +pi/2 = the figure's left, +x) where panel x = x0 lies; one per axis point to turn along it |
x0?: number | number[] | panel x that sits at angle (default: the middle of the panel); one per axis point to shift along it |
y0?: number | panel y of the axis start (default: the panel's top) |
ref?: [number, number, number] | the direction angle 0 points to (made perpendicular to the axis; default +z, the front): +y for a sleeve, whose angle 0 is the top of the arm |
dir?: 1 | -1 | +1: panel x grows with the angle; -1: against it |
anchors?: { at: V2; to: [number, number, number]; reach?: number }[] | flat points that must start at given places (an armhole running round the front of the arm root): the tube placement is bent to
them, each anchor moving the cloth within reach metres of it (flat distance), fading out |
lift?: number | extra distance outward (layers lying over others: a lapel, a collar fall), metres |
ripple?: { amp: number; n: number; twist?: number; from?: number } | [OLD DRAPE ONLY, OLD-SWITCHES.md] folds seeded in the start shape of a garment with more cloth than the body needs (wide trousers): the radius varies as amp sin(n angle + twist s),
growing from 0 at from metres along the axis over 15 cm; the settle keeps part of it as folds |
packages/clothing/src/pattern.ts:16
PocketSpec interface
interface PocketSpeckind: PocketKind | |
at?: 'hip' | 'chest' | hip (default) or chest (the wearer's left) |
width?: number | size of the patch or flap (defaults by kind) |
height?: number | |
y?: number | the pocket's top edge, world height (default by place) |
x?: number | its inner edge, metres from the centre front |
packages/clothing/src/parts/pockets.ts:11
PoseSource interface
interface PoseSourcea body pose by time: skinning matrices (16 per joint, Babylon's layout, see motion.ts) at t seconds
duration: number | |
loop: boolean | |
jointCount: number | |
pose(t: number, out: Float32Array): void |
packages/clothing/src/bake.ts:20
RigHint interface
interface RigHintscheme?: RigScheme | force a family ('geometry' skips the names altogether) |
noGeometry?: boolean | do not fill what the names left out from the geometry of the tree |
packages/clothing/src/rig.ts:28
RigMap interface
interface RigMapscheme: RigScheme | |
roles: Partial<Record<BoneRole, number>> | joint index per role (only the roles that were found) |
spine: number[] | the spine chain from the pelvis up (joint indices; may be empty) |
source: Partial<Record<BoneRole, RigSource>> | where each role came from |
missing: BoneRole[] | the roles that were not found |
packages/clothing/src/rig.ts:35
RigOverride interface
interface RigOverridewhat the caller may give by hand: roles to joints, and the spine chain (bottom to top)
packages/clothing/src/rig.ts:27
Seam interface
interface Seama: SeamSide | |
b: SeamSide | |
hinge?: boolean | a seam that folds flat (a collar's fall over its stand, a lapel over the front): no bending across it |
stage?: number | sewing order: seams of stage 0 close first, then 1 ... (a sleeve goes in after the body is sewn up) |
topstitch?: boolean | stitched as topstitching (visible lines) |
packages/clothing/src/pattern.ts:57
SeamSide interface
interface SeamSidepanel: string | |
edge: string | |
reverse?: boolean |
packages/clothing/src/pattern.ts:56
SewnGarment interface
interface SewnGarmentname: string | |
positions: Float32Array | |
normals: Float32Array | |
flat: Float32Array | flat panel coordinates, metres (x across the panel, y along the grain): the UVs at the cloth's real scale |
indices: Uint32Array | |
panelOf: Uint16Array | the panel of each vertex (index into panels) |
panels: Panel[] | |
meshes: { mesh: PanelMesh; offset: number }[] | per panel: its mesh (flat outline, edge vertices) with the vertex offset into this garment |
garment: Garment | |
weld: Uint32Array | per vertex: the smallest vertex index at its place (itself when it is alone); welded vertices share it |
groups: number[][] | groups of two or more vertices that are one node (seams, corners) |
edgeVerts: Map<string, number[]> | the vertices along a panel edge, from its start to its end (global indices), by panel.edge |
seams: SewnSeam[] | |
supports: SewnSupport[] | |
hold?: HoldKind | how the garment is held (the pattern's ; undefined for a pattern that does not say) and the zones held differently, with the vertices of their panels |
zones: { kind: HoldKind; verts: number[] }[] | |
stiff: SewnStiff[] | the stiff pieces of the pattern (), with their vertices |
stages: string[][] | the order the seams were closed in: per stage the names of its seams |
stats: { maxGapBeforeWeld: number; maxStretch: number; frames: number } |
packages/clothing/src/sew.ts:65
SewnSeam interface
interface SewnSeamname: string | |
a: string | |
b: string | |
stage: number | |
pairs: [number, number][] | the paired vertices (global indices), a side first |
gap: number | the widest gap between the two sides just before they were welded, metres |
packages/clothing/src/sew.ts:49
SewnStiff interface
interface SewnStiffa piece (or a strip of one) cut with an interlining: the vertices that are stiff and the factor on the fabric's bending stiffness
panel: string | |
what: string | |
bend: number | |
verts: number[] |
packages/clothing/src/sew.ts:63
SewnSupport interface
interface SewnSupporta pinned line of the sewn garment: its role, how the garment as a whole is held, and the vertices along the edge (global indices, start to end)
name: string | |
role: string | |
verts: number[] | |
kind?: HoldKind |
packages/clothing/src/sew.ts:60
SewOptions interface
interface SewOptionsh?: number | triangle size, metres (the garment's own h first; default 0.012) |
frames?: number | frames of 1/60 s per stage (default 40) |
substeps?: number | |
passes?: number | passes over all the links per substep (default 4) |
seamPasses?: number | extra passes over the seam links of the stage per substep (default 6): corners where several pieces meet close tighter |
tackComp?: number | compliance of a tack (default 1e-2: a stitch gives under the pull of a piece that lies a few centimetres from where its partner is) |
relaxFrames?: number | frames of relaxation of the closed cloth before the tacks (default half of frames) |
relaxPasses?: number | |
relaxForm?: number | |
settleFrames?: number | |
settlePasses?: number | |
settleForm?: number | |
supports?: SupportSpec[] | supports the pattern does not give itself (see supportsOf) |
onStage?: (stage: number, positions: Float32Array) => void | called with the positions of every vertex at the start of the sewing (stage -1) and after each stage (to look at the run) |
log?: (s: string) => void | progress |
packages/clothing/src/sew.ts:25
ShortsStyle interface
interface ShortsStyleShorts: the leg block with the hem at a given inseam length (default 0.2 m below the crotch), a little wider than the thigh there
length?: number | 'brief' | 'short' | 'bermuda' | inseam: crotch to hem, metres, or a name |
fitting?: Fitting | |
under?: Under | |
seatEase?: number | |
waistEase?: number | |
rise?: number | |
hemEase?: number | extra girth at the hem over the thigh's, metres (default 0.1) |
fabric?: string | |
layer?: number |
packages/clothing/src/blocks/shorts.ts:121
SkirtStyle interface
interface SkirtStylekind?: SkirtKind | |
waist?: 'natural' | 'high' | 'low' | number | where the waistband sits: 'natural', 'high' (6 cm up), 'low' (half way to the hip), or metres above (+) or below (-) the natural waist |
length?: number | HemName | length from the waist line to the hem in metres, or a name (default by kind) |
fitting?: Fitting | |
under?: Under | the layers worn under it (thicknesses in metres or garments): the hip is cut wider by the room they take |
taper?: number | straight: the hem is narrower than the hip by this much on each half panel (a pencil skirt; default 0.01) |
flare?: number | A-line: the hem is wider than the hip by this much on each half panel (default 0.13) |
pleats?: number | pleated, kilt: pleat count per half panel, and the fullness (fabric width over the hip width; default 1.65 for both; kilt: the back only; fabric over 1.8 times the hip is too much for tucks to carry) |
fullness?: number | |
circle?: 'full' | 'three-quarter' | 'half' | circle: how much of the circle the skirt is cut from (default 'full') |
vent?: number | a vent at the centre back from the hem up, metres (default 0; a straight skirt 0.15 when it reaches below the knee) |
fabric?: string | |
layer?: number |
packages/clothing/src/blocks/skirt.ts:17
SleeveDraft interface
interface SleeveDraftkind: 'set-in' | 'raglan' | 'drop' | 'kimono' | 'none' | |
yA: number | armhole depth and the shoulder end, relative to ctx.base |
sw: number | |
yS: number | |
F: V2[] | the armhole edges: the front's (left panel coordinates) from the side up, the back's (left coordinates) from the top down |
B: V2[] | |
shoulder: boolean | a shoulder seam joins front and back (false: raglan, the sleeve covers the shoulder) |
neckTop?: number | raglan: the length of the sleeve's own neck edge |
anchors: (back: boolean, sx: 1 | -1) => Anchor[] | |
build: () => Piece |
packages/clothing/src/parts/sleeves.ts:31
SleeveSpec interface
interface SleeveSpecSleeves: set-in (a crown drafted to the armhole), raglan (the sleeve runs up to the neck, no shoulder seam), drop shoulder (a straight armhole low on the arm), kimono (a very low, wide armhole: the shoulder runs on down the arm), none (the armhole is only hemmed). Any length from a cap to the wrist, with a band or rib cuff or a plain hem.
kind?: 'set-in' | 'raglan' | 'drop' | 'kimono' | 'none' | 'short' | |
length?: UpperSleeveLength | long (to the wrist), three-quarter, elbow, short, cap, or metres from the shoulder joint along the arm |
cuff?: 'none' | 'band' | 'rib' | |
cuffHeight?: number | |
ease?: number | ease over the upper arm, metres in all (an explicit value replaces the cutting rule: by fitting and layers, see upperEases) |
endEase?: number | ease of the sleeve's end over the arm there, metres in all (default: the rule, by the cuff) |
shoulderPad?: number | a set-in shoulder's width past the shoulder point (shoulder pads), metres |
gather?: number | cuff gathering: the sleeve end is this many times as wide as the band (band cuffs only, default 1.15) |
packages/clothing/src/parts/sleeves.ts:14
StaticOptions interface
interface StaticOptionsfriction?: number | friction of the cloth on this surface (default: the world's) |
solid?: boolean | a closed surface wound outward (the body): what is found inside it is pushed out. A layer of cloth is not solid: it holds from the side the cloth came from. |
packages/clothing/src/collide.ts:225
StiffPiece interface
interface StiffPiecea piece cut with an interlining (canvas, fusing, board): its bending stiffness is the fabric's times bend
panel: string | |
bend: number | |
what: 'collar stand' | 'collar fall' | 'lapel' | 'waistband' | 'cuff' | 'brim' | 'band' | 'flap' | 'facing' | 'crown' | 'shell' | 'belt' | |
edge?: string | a strip of the panel along this edge, depth metres deep, instead of the whole panel (a waistband cut in one with the trouser panels) |
depth?: number |
packages/clothing/src/pattern.ts:88
StoreBackend interface
interface StoreBackendwhere the files of a store live; names are flat (<key>.fout, map.json)
readonly readOnly: boolean | |
get(name: string): Promise<Uint8Array | undefined> | |
put(name: string, bytes: Uint8Array): Promise<void> | |
has(name: string): Promise<boolean> | |
list(): Promise<string[]> | |
delete(name: string): Promise<void> |
packages/clothing/src/cache.ts:316
Support interface
interface Supportkind: HoldKind | |
pinned: PinnedLine[] | the lines held where they are put on the body |
stiff: StiffPiece[] | the pieces cut stiffer than their fabric (also the stiff of those panels) |
zones?: { kind: HoldKind; panels: string[] }[] | parts of the garment that are held differently from the whole (a dress: the skirt hangs from the waist seam, the bodice rests): the panels and their kind |
packages/clothing/src/pattern.ts:96
SupportSpec interface
interface SupportSpecan edge of the garment where it is held when it is put on (the shoulder line, the waistband, the collar stand): the pattern's own pinned lines (), or what reads from a pattern that has none
name: string | |
role: string | what the line is: a ('shoulder', 'neck', 'collar', 'waist', 'closure', 'band', 'cuff', 'brim', 'hem') or, for a pattern without , 'hold' |
panel: string | |
edge: string |
packages/clothing/src/sew.ts:17
SurfaceHit interface
interface SurfaceHitd: number | |
p: Float64Array | |
n: Float64Array | |
t: number | |
w: Float64Array |
packages/clothing/src/body.ts:222
Tack interface
interface Tacka point of one panel held at a point of another (a button through its hole): gap metres apart along the lower panel's normal
packages/clothing/src/pattern.ts:69
TextureBakeOptions interface
interface TextureBakeOptionsoptions of the texture bake (bakeGarment); the cloth animation bake has its own, BakeOptions of bake.ts
maxSize?: number | texture side limit (default 4096) |
pxPerMeter?: number | wanted resolution (default 3000 px/m: 0.33 mm a pixel) |
stitch?: { length?: number; width?: number; seamOffset?: number; hemOffset?: number; hemRows?: number } | stitching: seams sewn with a visible topstitch line offset metres in from the seam, hems with two rows |
buttonholes?: { panel: string; at: V2; length: number; angle?: number }[] | buttonholes in panel coordinates |
fabrics: Record<string, FabricSpec> | fabric of each panel by its fabric key |
packages/clothing/src/fabric.ts:182
TrimMesh interface
interface TrimMeshTrims: rigid little parts placed on the dressed cloth at flat points of its panels, riding the cloth there: buttons (a domed disc with a rim, four holes or a shank, an anchor raised on a brass one), eyelets, a cap's peak. Each is a mesh in the garment's frame with the cloth vertex it rides (for its skin weights).
name: string | |
kind: string | |
pos: number[] | |
nrm: number[] | |
uv: number[] | |
idx: number[] | |
material: string | |
rides: number |
packages/clothing/src/trims.ts:11
TrimSpec interface
interface TrimSpeckind: 'button' | 'eyelet' | 'peak' | |
panel: string | |
at: V2 | flat point (a button's centre); for a peak, the middle of the edge it is sewn along |
size?: number | a button's diameter; a peak's depth |
edge?: string | a peak: the flat edge it is sewn along and its half angle |
material?: string |
packages/clothing/src/pattern.ts:173
TrouserStyle interface
interface TrouserStyleTrousers: four panels, a front and a back for each leg, drafted from the seat, waist, rise, knee and length as a tailor's block (front crotch extension seat/16, back seat/8, back rise raised and slanted), sewn at the outseams, inseams, the front crotch and the centre back. The waist edge is turned and stitched (a waistband facing); the hems are turned up.
fitting?: Fitting | how close the cut is (default 'comfortable'); the ease over the seat follows from it and grows with the layers under |
under?: Under | the layers worn under it (thicknesses in metres or garments) |
seatEase?: number | an explicit ease over the seat, metres in all, instead of the rule's |
waistEase?: number | ease over the waist (default 0.03) |
rise?: number | waist line above the natural waist, metres (default 0.01: worn high, on braces) |
knee?: number | finished width of a leg at the knee and at the hem (circumference), metres; default from the knee girth |
hem?: number | |
hemAbove?: number | hem above the floor, metres (default 0.03) |
fabric?: string |
packages/clothing/src/blocks/trousers.ts:13
UpdateOptions interface
interface UpdateOptionstau0?: number | where this substep lies within the frame (0..1): where a moving surface is at its start and at its end |
tau1?: number | |
full?: boolean | run pass 2 (default true) |
edges?: boolean | run pass 3, edge against edge (default: with full) |
mask?: Uint32Array | null | per particle, bit k set: the particle sees static k (default: all); at most 32 statics |
out?: ContactSet | the contacts go here (cleared first); default world.contacts |
packages/clothing/src/collide.ts:239
UpperCtx interface
interface UpperCtxthe dimensions every part reads
body: ClothingBody | |
m: Measurements | |
U: UpperFrame | |
figure: BodyFit | the body's fit descriptors (bust, underbust, childness ...) |
eases: UpperEases | |
spec: BodySpec | |
fab: string | |
rib: string | |
base: number | world height of the panels' y = 0 (the hem, or the top of the welt) |
yN: number | heights above base: neck point, shoulder point, waist |
yS: number | |
yW: number | |
girth: (y: number) => number | girth with ease at a height above base, metres |
frontExtra: number | how much longer the front is than the back at the centre front (the chest and belly stand out), metres |
halfF: (y: number) => number | half width of the front and back panels at a height above base |
halfB: (y: number) => number | |
torsoAxis: V3[] | the start tube of the torso panels |
torsoR: number[] | |
nw: number | neck half width in the panels |
rel: (worldY: number) => number |
packages/clothing/src/parts/ctx.ts:55
UpperDefaults interface
interface UpperDefaultsname: string | |
layer: number | |
length: UpperHemName | number | |
fitting: Fitting | |
kind?: HoldKind | how it is held; default from the fitting (a loose cut hangs from the shoulders) |
under: number[] | what is usually worn under it, radial thicknesses (metres) |
fit: Fit | |
flare?: number | |
cbWaist?: number | |
backNeckDrop?: number | |
fabric: string | |
rib?: string | |
sleeve: SleeveSpec | |
collar: CollarSpec | |
closure: ClosureSpec | |
pockets: PocketSpec[] | |
hem: HemSpec | |
cloth: ClothProps |
packages/clothing/src/parts/style.ts:43
UpperEases interface
interface UpperEaseschest: number | ease over the chest, metres in all |
upperArm: number | ease over the upper arm, metres in all |
end: { plain: number; band: number; rib: number } | ease of the sleeve's end over the arm there for a plain hem, a band cuff (gathered into the band), a rib cuff |
setting: number | the fraction the cap is longer than the armhole |
armholeDrop: number | extra depth of the armhole, metres |
packages/clothing/src/blocks/ease.ts:50
UpperFrame interface
interface UpperFramewhere the upper body garments sit: the neck point and shoulder point heights, the arm axes (shoulder point to wrist), the torso's z
neckR: number | |
neckPointY: number | |
shoulderPointY: number | |
shoulderX: number | |
arm: { l: { s: V3; w: V3; d: V3; c: V3; e: V3 }; r: { s: V3; w: V3; d: V3; c: V3; e: V3 } } | per side: the shoulder point, the wrist point, the unit direction down the arm, and c: the arm's own axis start (the shoulder joint) |
z: number | |
neckZ: number | z of the neck's centre at the neck point |
root: { l: { front: V3; back: V3; pit: V3 }; r: { front: V3; back: V3; pit: V3 } } | per side: the arm root's front and back (where an armhole passes in front of and behind the arm) and the armpit |
packages/clothing/src/blocks/common.ts:12
UpperSpec interface
interface UpperSpecComposing an upper garment from its parts: the body (two backs, two fronts) cut for a fit and a length, a sleeve (it sets the armhole), a collar (it sets the neckline), a closure (the front edges and the buttons), pockets and a hem.
name: string | |
layer: number | |
hemY: number | world height of the lowest edge |
fitting: Fitting | how close the cut is (fit.ts): the chest ease comes from it by the rules of upperEases, plus the room for what is worn under |
kind: HoldKind | how the garment is held: fitted rests on the body, hung hangs from the shoulders and the collar |
under?: Under | the layers worn under it: thicknesses (metres) or garments; the ease grows with them |
chestEase?: number | an explicit chest ease (metres in all) instead of the rule's |
fit?: Fit | |
flare?: number | |
cbWaist?: number | the centre back seam taken in at the waist (default 0.012 when fitted) |
darts?: boolean | the bust darts of a fitted cut (default: when the figure's bust asks for them) |
backNeckDrop?: number | |
fabric: string | |
rib?: string | |
sleeve?: SleeveSpec | |
collar?: CollarSpec | |
closure?: ClosureSpec | |
pockets?: PocketSpec[] | |
hem?: HemSpec | |
cloth: ClothProps |
packages/clothing/src/parts/compose.ts:17
UpperStyle interface
interface UpperStyleThe style of an upper garment as the commands give it (JSON): every part may be named by a string (sleeve: 'raglan') or given in full (sleeve: { kind: 'raglan', length: 'elbow', cuff: 'rib' }).
length?: UpperHemName | number | the hem: a height name, or metres below the shoulder point |
fitting?: Fitting | how close the cut is; the ease over the chest follows from it (see upperEases) and grows with the layers under |
under?: Under | the layers worn under it, thicknesses in metres or the garments themselves (default: what is usually worn under this kind of garment) |
ease?: number | an explicit ease over the chest, metres in all (replaces the rule's) |
fit?: Fit | |
flare?: number | |
sleeve?: SleeveSpec | NonNullable<SleeveSpec['kind']> | |
collar?: CollarSpec | NonNullable<CollarSpec['kind']> | |
closure?: ClosureSpec | NonNullable<ClosureSpec['kind']> | |
pockets?: (PocketSpec | PocketKind)[] | PocketKind | 'none' | |
hem?: HemSpec | NonNullable<HemSpec['trim']> | |
fabric?: string | |
rib?: string | |
layer?: number | |
cloth?: ClothProps |
packages/clothing/src/parts/style.ts:22
WeltHalf interface
interface WeltHalfpanel: string | |
x0: number | |
x1: number | |
back: boolean | |
side: 'l' | 'r' |
packages/clothing/src/parts/hems.ts:22
WitchHatStyle interface
interface WitchHatStyleheight?: number | height of the cone, metres (0.42..0.48) |
brim?: number | width of the brim (0.13..0.2) |
bend?: number | how far the tip is bent back from the cone's axis (0.16..0.2) |
crumple?: number | crumpledness of the cone, 0..1 (a worn, dented felt) |
hair?: number | hair under it, metres (default 0.012) |
fabric?: string | |
layer?: number |
packages/clothing/src/blocks/accessories.ts:22
Types
BlockFn type
type BlockFn = (body: ClothingBody, m: Measurements, style?: Record<string, unknown>) => GarmentClothes on characters of the world: the blocks by name, an entity's skinned body measured, garments drafted to it, draped, baked, weighted and put on (meshes skinned to the entity's skeleton; the body's triangles under them hidden). Every step is a command, so a person, a test and an agent dress a character the same way.
packages/clothing/src/service.ts:33
BoneRole type
type BoneRole = CentralRole | `${LimbRole}_${Side}`packages/clothing/src/rig.ts:13
CentralRole type
type CentralRole = 'pelvis' | 'neck' | 'head'packages/clothing/src/rig.ts:10
CoatStyle type
type CoatStyle = UpperStyleAn overcoat or greatcoat of heavy melton or serge: a body flaring from the chest, set-in sleeves, notched lapels
with a stand and fall, flap pockets. length is the parameter that makes the difference: hip, thigh, knee (overcoat, default), calf
(greatcoat), ankle, or metres below the shoulder point. closure: 'double' buttons it double-breasted (the greatcoat).
packages/clothing/src/blocks/coat.ts:11
DartStyle type
type DartStyle = 'fitted' | 'semi' | 'shift' | 'none'packages/clothing/src/fit.ts:100
DressCut type
type DressCut = 'fitted' | 'aline' | 'shift'Dresses: a bodice with a bust dart (from the side seam to the bust) and waist darts, over a skirt sewn on at the waist
('fitted': straight skirt, 'aline': flared skirt), or a one-piece 'shift' that hangs from the shoulders with the bust dart only. The
armholes are cut to the shoulder point; sleeves are optional (none, cap, short, elbow, three-quarter, long) and set in. The cut comes
from bodyFit and darts (fit.ts) whatever the sex or age of the body.
packages/clothing/src/blocks/dress.ts:16
Dresser type
type Dresser = (input: OutfitInput) => OutfitRecord | Promise<OutfitRecord>the function that dresses: the same inputs must give the same record
packages/clothing/src/cache.ts:451
Fit type
type Fit = 'fitted' | 'straight' | 'aline'the shape of the body of the garment: it follows the body (fitted), hangs straight from the widest point, or flares to the hem
packages/clothing/src/parts/ctx.ts:30
Fitting type
type Fitting = 'skin' | 'close' | 'fitted' | 'comfortable' | 'loose' | 'oversized'how loose a cut is
packages/clothing/src/fit.ts:81
HemName type
type HemName = 'mini' | 'knee' | 'midi' | 'ankle' | 'floor'hem lengths by name: mini above mid-thigh, knee, midi (mid-calf), ankle, floor
packages/clothing/src/blocks/skirt.ts:15
HoldKind type
type HoldKind = 'fitted' | 'hung' | 'waist' | 'head' | 'hand' | 'foot'How a garment is held on the figure: data from the cut, read by the dressing; nothing in it is per outfit.
- fitted: the whole surface rests on what is under it (a T-shirt, a shirt, a bodice, a jersey, a close dress);
- hung: the shoulder line and the collar stand hold it, the closure holds the fronts, the rest falls (a coat, a jacket, a cape, a loose shirt);
- waist: the waistband holds it, the hips and legs only stop it (a skirt, trousers, shorts, breeches);
- head, hand, foot: a hat on the head, a glove on the hand, a boot on the foot.
packages/clothing/src/pattern.ts:78
HoodieStyle type
type HoodieStyle = UpperStyle & { hood?: { up?: boolean; ease?: number; deeper?: number } }A hooded sweatshirt of fleece: drop shoulders, rib welt and cuffs, a kangaroo pocket, a hood (hanging down the back
by default). hood: { up: true } puts it over the head; closure: 'zip' makes it a zip-up.
packages/clothing/src/blocks/hoodie.ts:10
JointRef type
type JointRef = string | numbera joint given by name or by index
packages/clothing/src/rig.ts:25
LimbRole type
type LimbRole = 'clavicle' | 'upperArm' | 'forearm' | 'hand' | 'thigh' | 'calf' | 'foot' | 'ball'packages/clothing/src/rig.ts:11
Neckline type
type Neckline = 'round' | 'scoop' | 'vee' | 'square'packages/clothing/src/blocks/dress.ts:17
PocketKind type
type PocketKind = 'patch' | 'flap' | 'welt' | 'kangaroo'Pockets: patch (a rectangle sewn on three sides), flap (a flap hanging from its top edge over a slit), welt (a narrow strip over a slit), kangaroo (one big patch across the front with its sides open). They lie on the fronts and are held to them by tacks.
packages/clothing/src/parts/pockets.ts:10
RigScheme type
type RigScheme = 'ue' | 'mixamo' | 'cc' | 'generic' | 'geometry'packages/clothing/src/rig.ts:21
RigSource type
type RigSource = 'name' | 'geometry' | 'map'packages/clothing/src/rig.ts:22
RigV3 type
type RigV3 = [number, number, number]Rigs: the module never reads bone names, it reads bone roles. mapRig resolves the roles of a skeleton from the bone names of Unreal / MetaHuman (also the
packages/clothing/src/rig.ts:8
ShirtStyle type
type ShirtStyle = UpperStyleA shirt or blouse of a light woven cloth: a fitted body with a shirt-tail hem, set-in sleeves with band cuffs, a
collar of a stand and a fall, buttons down the front, a patch pocket on the chest. Any part can be swapped through UpperStyle
(collar: 'stand', sleeve: 'short', closure: 'pullover' for an over-the-head shirt ...).
packages/clothing/src/blocks/shirt.ts:12
Side type
type Side = 'l' | 'r'packages/clothing/src/rig.ts:12
SkirtKind type
type SkirtKind = 'straight' | 'aline' | 'pleated' | 'circle' | 'kilt'Skirts: straight, A-line, pleated, circle and kilt, drafted from the waist, the hip and the length. Each is a front and two back halves (a centre back seam, with an optional vent) or, for the circle, four sectors. The waist edge is held on the body at the waist line the style asks for; waist darts (darts of fit.ts) take the hip in to the waist; pleats are tucks stitched down to the hip with the fullness hanging free below.
packages/clothing/src/blocks/skirt.ts:13
SleeveKind type
type SleeveKind = 'set-in' | 'raglan' | 'drop' | 'kimono' | 'none'packages/clothing/src/blocks/ease.ts:32
SleeveLength type
type SleeveLength = 'none' | 'cap' | 'short' | 'elbow' | 'three-quarter' | 'long'packages/clothing/src/blocks/dress.ts:18
SupportKind type
type SupportKind = 'fitted' | 'hung' | 'waist' | 'free'how a garment is held to the body: by it the driven part of the cloth is chosen
packages/clothing/src/motion.ts:78
TexData type
type TexData = Uint8Array | { ref: string }a baked texture: PNG bytes, or a reference to a file the game keeps elsewhere (a shared tile)
packages/clothing/src/cache.ts:139
TshirtStyle type
type TshirtStyle = UpperStyle & { neckline?: 'crew' | 'v' | 'scoop' }A T-shirt of a light jersey knit: short set-in sleeves, a rib neck band, a body that follows the figure a little loosely.
Style: neckline crew | v | scoop; sleeve (short by default; long, raglan, drop ...); length (hem height name or metres below the
shoulder point); fit; any other part by UpperStyle.
packages/clothing/src/blocks/tshirt.ts:12
Under type
type Under = (number | Pick<Garment, 'cloth'>)[]the layers a garment is worn over: the radial thicknesses (metres) or the garments themselves (their cloth thickness is used)
packages/clothing/src/blocks/ease.ts:12
UpperHemName type
type UpperHemName = 'waist' | 'hip' | 'crotch' | 'thigh' | 'knee' | 'calf' | 'ankle'named hem heights
packages/clothing/src/parts/style.ts:16
UpperSleeveLength type
type UpperSleeveLength = 'long' | 'three-quarter' | 'elbow' | 'short' | 'cap' | numberpackages/clothing/src/parts/util.ts:39
V2 type
type V2 = [number, number]Patterns: a garment is cut from flat panels, as a tailor cuts it. A panel's outline is a closed chain of named edges (polylines in metres, in the panel's own plane: x across, y up along the grain); seams join two edges, hems and folds are edges too. A panel is meshed into near-equilateral triangles of a chosen size; its flat coordinates stay with every vertex (the cloth's UV at its real scale).
packages/clothing/src/pattern.ts:7
V3 type
type V3 = [number, number, number]packages/clothing/src/body.ts:8
WaistcoatStyle type
type WaistcoatStyle = UpperStyle & { vDepth?: number }A waistcoat: sleeveless, fitted, a deep V front buttoned in a single row, welt pockets, ending just below the waist.
collar: 'shawl' gives a shawl-collar waistcoat; closure: 'double' a double-breasted one; vDepth the depth of the V.
packages/clothing/src/blocks/waistcoat.ts:11
Weave type
type Weave = 'twill' | 'plain' | 'stockinette' | 'rib' | 'leather' | 'felt' | 'flannel' | 'denim' | 'corduroy' | 'velvet' | 'satin' | 'linen'Fabrics: the surface of a cloth made in code at its real thread scale, evaluated in the flat panel coordinates (metres, y along the grain), so the weave runs along the grain and is the same size on every panel. Each fabric gives a colour, a height (the relief of threads and stitches, metres) and a roughness at a point; a garment's panels are packed into one texture atlas and baked with the stitching of its seams and hems drawn where they are sewn.
packages/clothing/src/fabric.ts:11
Constants
ALL_ROLES const
const ALL_ROLES: readonly BoneRole[]packages/clothing/src/rig.ts:17
BLOCK_NAMES const
const BLOCK_NAMES: string[]packages/clothing/src/catalog.ts:324
BLOCKS const
const BLOCKS: Record<string, BlockFn>packages/clothing/src/service.ts:34
CATALOG const
const CATALOG: Record<string, BlockSpec>packages/clothing/src/catalog.ts:163
CENTRAL_ROLES const
const CENTRAL_ROLES: readonly CentralRole[]packages/clothing/src/rig.ts:15
CLOTHING_CORE_VERSION const
const CLOTHING_CORE_VERSION: 1The version of the cloth core (drafting rules aside: the garments are in the key itself). EVERY change that can change a dressed result bumps it by one: the simulation (sim.ts, drape.ts, sew.ts, dress.ts), the collision (body.ts), the skin transfer and hidden body (transfer.ts), the baking (fabric.ts), the trims and boots (trims.ts, footwear.ts), and the record layout below. A change that cannot change a result (a comment, a rename, a test) does not. When unsure, bump: a wrong bump costs a re-dress, a missing one ships stale clothes.
packages/clothing/src/cache.ts:26
COLOR_WORDS const
const COLOR_WORDS: Record<string, number>colour words to sRGB hex (English words; Russian stems are matched by prefix); a garment's colour in a description
packages/clothing/src/fabrics.ts:83
ESSENTIAL_ROLES const
const ESSENTIAL_ROLES: readonly BoneRole[]roles the measurements and the garments cannot do without (the neck, the clavicle, the ball of the foot and the spine have fallbacks)
packages/clothing/src/rig.ts:19
FABRICS const
const FABRICS: Record<string, CatalogFabric>packages/clothing/src/fabrics.ts:28
GARMENT_SETS const
const GARMENT_SETS: { word: string; blocks: string[]; }[]garment sets: one word that is several blocks ("suit": jacket and trousers)
packages/clothing/src/catalog.ts:317
INTERLINING const
const INTERLINING: Record<"collar stand" | "collar fall" | "lapel" | "waistband" | "cuff" | "brim" | "band" | "flap" | "facing" | "crown" | "shell" | "belt", number> & { steel: number; }Interlining by piece: the bending stiffness of the piece over its fabric's. A shirt collar and a waistband are fused, a lapel is canvassed, a cuff is turned double, a felt brim is blocked and stiffened, a peak is board.
packages/clothing/src/blocks/ease.ts:80
LAYER_BULK const
const LAYER_BULK: 0.5layers do not squeeze to nothing, and fold at their seams: a layer takes its thickness and half as much again
packages/clothing/src/blocks/ease.ts:22
LIMB_ROLES const
const LIMB_ROLES: readonly LimbRole[]packages/clothing/src/rig.ts:16
OUTFIT_MAP_FORMAT const
const OUTFIT_MAP_FORMAT: 1the version of the map file layout
packages/clothing/src/cache.ts:30
OUTFIT_RECORD_FORMAT const
const OUTFIT_RECORD_FORMAT: 1the version of the record file layout
packages/clothing/src/cache.ts:28
WEAVES const
const WEAVES: Weave[]every weave bakeGarment knows
packages/clothing/src/fabrics.ts:19