@adatechnology/game-vehicles-three 0.10.1 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -0
- package/dist/{chunk-5T52WAQS.js → chunk-GAPMLLDL.js} +224 -5
- package/dist/chunk-GAPMLLDL.js.map +1 -0
- package/dist/chunk-UHLZ23KF.js +565 -0
- package/dist/chunk-UHLZ23KF.js.map +1 -0
- package/dist/index.d.ts +173 -10
- package/dist/index.global.js +1424 -62
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +482 -3
- package/dist/index.js.map +1 -1
- package/dist/testing.js +2 -1
- package/dist/worker-kinds-Dnbh9_c9.d.ts +51 -0
- package/dist/worker-kinds.d.ts +2 -0
- package/dist/worker-kinds.js +9 -0
- package/dist/worker-kinds.js.map +1 -0
- package/package.json +20 -12
- package/dist/chunk-5T52WAQS.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/hull-geometry.ts","../src/vehicle-hulls.ts","../src/hull-plan-kind.ts","../src/hull-excess.ts","../src/hull-split.ts","../src/hull-plan.ts"],"sourcesContent":["/** Convex hull of a point set (incremental), the point reduction a hull is made from, and its volume: the plain geometry under `vehicle-hulls.ts`. */\n\n/** A hull face: three point numbers, wound so the normal (right hand) points out of the hull. */\nexport type HullFace = readonly [number, number, number]\n\n/** A point this close (m) to a face plane is on it. */\nconst PLANE_EPS = 1e-7\n/** The 26 directions of the cube around a point: its corners, edge middles and face middles. */\nconst DIRECTIONS: ReadonlyArray<readonly [number, number, number]> = (() => {\n const out: Array<readonly [number, number, number]> = []\n for (let x = -1; x <= 1; x++) for (let y = -1; y <= 1; y++) for (let z = -1; z <= 1; z++) if (x !== 0 || y !== 0 || z !== 0) out.push([x, y, z])\n return out\n})()\n\ninterface Face {\n readonly a: number\n readonly b: number\n readonly c: number\n readonly nx: number\n readonly ny: number\n readonly nz: number\n readonly d: number\n}\n\nconst faceOf = (p: ArrayLike<number>, a: number, b: number, c: number): Face => {\n const ux = p[b * 3]! - p[a * 3]!, uy = p[b * 3 + 1]! - p[a * 3 + 1]!, uz = p[b * 3 + 2]! - p[a * 3 + 2]!\n const wx = p[c * 3]! - p[a * 3]!, wy = p[c * 3 + 1]! - p[a * 3 + 1]!, wz = p[c * 3 + 2]! - p[a * 3 + 2]!\n let nx = uy * wz - uz * wy, ny = uz * wx - ux * wz, nz = ux * wy - uy * wx\n const length = Math.hypot(nx, ny, nz) || 1\n nx /= length\n ny /= length\n nz /= length\n return { a, b, c, nx, ny, nz, d: nx * p[a * 3]! + ny * p[a * 3 + 1]! + nz * p[a * 3 + 2]! }\n}\n\nconst sideOf = (face: Face, p: ArrayLike<number>, i: number): number => face.nx * p[i * 3]! + face.ny * p[i * 3 + 1]! + face.nz * p[i * 3 + 2]! - face.d\n\n/** The four corners of a first tetrahedron: the extremes along x, then the farthest from the line, then from the plane. Null when the points lie on a plane or a line. */\nconst tetrahedronOf = (p: ArrayLike<number>, count: number): [number, number, number, number] | null => {\n let a = 0\n for (let i = 1; i < count; i++) if (p[i * 3]! < p[a * 3]!) a = i\n const farthest = (score: (i: number) => number): number => {\n let best = -1\n let bestScore = PLANE_EPS\n for (let i = 0; i < count; i++) {\n const s = score(i)\n if (s > bestScore) [best, bestScore] = [i, s]\n }\n return best\n }\n const b = farthest((i) => Math.hypot(p[i * 3]! - p[a * 3]!, p[i * 3 + 1]! - p[a * 3 + 1]!, p[i * 3 + 2]! - p[a * 3 + 2]!))\n if (b < 0) return null\n const ux = p[b * 3]! - p[a * 3]!, uy = p[b * 3 + 1]! - p[a * 3 + 1]!, uz = p[b * 3 + 2]! - p[a * 3 + 2]!\n const c = farthest((i) => {\n const wx = p[i * 3]! - p[a * 3]!, wy = p[i * 3 + 1]! - p[a * 3 + 1]!, wz = p[i * 3 + 2]! - p[a * 3 + 2]!\n return Math.hypot(uy * wz - uz * wy, uz * wx - ux * wz, ux * wy - uy * wx) / Math.hypot(ux, uy, uz)\n })\n if (c < 0) return null\n const base = faceOf(p, a, b, c)\n const d = farthest((i) => Math.abs(sideOf(base, p, i)))\n return d < 0 ? null : [a, b, c, d]\n}\n\n/** The faces of the convex hull of the points (x y z triples), wound outward; null when the points do not enclose a volume. */\nexport const convexFaces = (points: ArrayLike<number>): HullFace[] | null => {\n const count = Math.floor(points.length / 3)\n if (count < 4) return null\n const corners = tetrahedronOf(points, count)\n if (!corners) return null\n const [a, b, c, d] = corners\n const inside = [0, 1, 2].map((k) => (points[a * 3 + k]! + points[b * 3 + k]! + points[c * 3 + k]! + points[d * 3 + k]!) / 4) as [number, number, number]\n let faces: Face[] = []\n const add = (i: number, j: number, k: number): void => {\n const face = faceOf(points, i, j, k)\n const towardInside = face.nx * inside[0] + face.ny * inside[1] + face.nz * inside[2] - face.d\n faces.push(towardInside > 0 ? faceOf(points, i, k, j) : face)\n }\n add(a, b, c)\n add(a, b, d)\n add(a, c, d)\n add(b, c, d)\n for (let i = 0; i < count; i++) {\n if (i === a || i === b || i === c || i === d) continue\n const visible = faces.filter((face) => sideOf(face, points, i) > PLANE_EPS)\n if (visible.length === 0) continue\n const edges = new Map<number, [number, number]>()\n const key = (from: number, to: number): number => from * count + to\n for (const face of visible) for (const [from, to] of [[face.a, face.b], [face.b, face.c], [face.c, face.a]] as const) edges.set(key(from, to), [from, to])\n const kept = faces.filter((face) => !visible.includes(face))\n for (const [from, to] of edges.values()) {\n if (edges.has(key(to, from))) continue\n kept.push(faceOf(points, from, to, i))\n }\n faces = kept\n }\n return faces.map((face) => [face.a, face.b, face.c] as const)\n}\n\n/** The volume (m3) the faces enclose. */\nexport const hullVolume = (points: ArrayLike<number>, faces: readonly HullFace[]): number => {\n let sum = 0\n for (const [a, b, c] of faces) {\n const ax = points[a * 3]!, ay = points[a * 3 + 1]!, az = points[a * 3 + 2]!\n const bx = points[b * 3]!, by = points[b * 3 + 1]!, bz = points[b * 3 + 2]!\n const cx = points[c * 3]!, cy = points[c * 3 + 1]!, cz = points[c * 3 + 2]!\n sum += ax * (by * cz - bz * cy) + ay * (bz * cx - bx * cz) + az * (bx * cy - by * cx)\n }\n return Math.abs(sum) / 6\n}\n\n/**\n * At most `max` of the points (x y z triples): the extreme of each of the 26 directions, then the point farthest from those taken, again and again. Always points of the input,\n * so a hull made of them never leaves what was drawn.\n */\nexport const reducePoints = (points: ArrayLike<number>, max: number): number[] => {\n const count = Math.floor(points.length / 3)\n const picked: number[] = []\n const taken = new Set<number>()\n const take = (i: number): void => {\n if (taken.has(i)) return\n taken.add(i)\n picked.push(i)\n }\n for (const [dx, dy, dz] of DIRECTIONS) {\n let best = 0\n let bestDot = -Infinity\n for (let i = 0; i < count; i++) {\n const dot = points[i * 3]! * dx + points[i * 3 + 1]! * dy + points[i * 3 + 2]! * dz\n if (dot > bestDot) [best, bestDot] = [i, dot]\n }\n take(best)\n }\n const away = new Float64Array(count).fill(Infinity)\n const refresh = (from: number): void => {\n for (let i = 0; i < count; i++) {\n const dist = (points[i * 3]! - points[from * 3]!) ** 2 + (points[i * 3 + 1]! - points[from * 3 + 1]!) ** 2 + (points[i * 3 + 2]! - points[from * 3 + 2]!) ** 2\n if (dist < away[i]!) away[i] = dist\n }\n }\n for (const i of picked) refresh(i)\n while (picked.length < Math.min(max, count)) {\n let far = -1\n let farDist = 0\n for (let i = 0; i < count; i++) if (away[i]! > farDist) [far, farDist] = [i, away[i]!]\n if (far < 0) break\n take(far)\n refresh(far)\n }\n return picked.slice(0, max).flatMap((i) => [points[i * 3]!, points[i * 3 + 1]!, points[i * 3 + 2]!])\n}\n","import { convexFaces, reducePoints } from './hull-geometry'\n\n/** Points a hull is made of at most (design 10.1). */\nexport const MAX_HULL_POINTS = 64\n/** A flat piece (thinner than twice this) gets this much (m) on each side of its plane. */\nexport const FLAT_PAD = 0.0025\n\ntype Vec3 = readonly [number, number, number]\n\n/** The triangles of a drawn piece (or of several, merged) in the vehicle's frame. */\nexport interface HullSoup {\n readonly vertices: readonly number[]\n readonly indices: readonly number[]\n}\n\n/** The unit normal of the largest triangle: the direction a flat piece is flat along. */\nconst mainNormal = (soup: HullSoup): Vec3 => {\n const v = soup.vertices\n let best: Vec3 = [0, 1, 0]\n let bestArea = 0\n for (let t = 0; t + 2 < soup.indices.length; t += 3) {\n const a = soup.indices[t]! * 3, b = soup.indices[t + 1]! * 3, c = soup.indices[t + 2]! * 3\n const ux = v[b]! - v[a]!, uy = v[b + 1]! - v[a + 1]!, uz = v[b + 2]! - v[a + 2]!\n const wx = v[c]! - v[a]!, wy = v[c + 1]! - v[a + 1]!, wz = v[c + 2]! - v[a + 2]!\n const cross: Vec3 = [uy * wz - uz * wy, uz * wx - ux * wz, ux * wy - uy * wx]\n const area = Math.hypot(...cross)\n if (area > bestArea) [best, bestArea] = [[cross[0] / area, cross[1] / area, cross[2] / area], area]\n }\n return best\n}\n\nconst spreadAlong = (points: readonly number[], axis: Vec3): number => {\n let low = Infinity\n let high = -Infinity\n for (let i = 0; i < points.length; i += 3) {\n const t = points[i]! * axis[0] + points[i + 1]! * axis[1] + points[i + 2]! * axis[2]\n if (t < low) low = t\n if (t > high) high = t\n }\n return high - low\n}\n\n/** The points each moved `FLAT_PAD` both ways along the axis. */\nconst paddedAlong = (points: readonly number[], axis: Vec3): number[] => {\n const out: number[] = []\n for (let i = 0; i < points.length; i += 3) {\n for (const sign of [-1, 1]) out.push(points[i]! + sign * axis[0] * FLAT_PAD, points[i + 1]! + sign * axis[1] * FLAT_PAD, points[i + 2]! + sign * axis[2] * FLAT_PAD)\n }\n return out\n}\n\n/** A unit vector across `axis`, for a piece that is flat along it and also a line. */\nconst acrossOf = (axis: Vec3): Vec3 => {\n const pick: Vec3 = Math.abs(axis[0]) < 0.9 ? [1, 0, 0] : [0, 1, 0]\n const cross: Vec3 = [axis[1] * pick[2] - axis[2] * pick[1], axis[2] * pick[0] - axis[0] * pick[2], axis[0] * pick[1] - axis[1] * pick[0]]\n const length = Math.hypot(...cross)\n return [cross[0] / length, cross[1] / length, cross[2] / length]\n}\n\n/**\n * The one convex hull (at most `MAX_HULL_POINTS` points, x y z triples, every one a drawn vertex) of the drawn vertices of a piece (design 10.1, method B): `reducePoints` always keeps the\n * extreme of each of the 26 directions, so the hull reaches the drawn surface where it reaches farthest. A piece flatter than `2 * FLAT_PAD` gets `FLAT_PAD` on each side of its plane\n * (a line, on each side of its plane and across it): a hull with no volume is no shape. Null when the soup has fewer than three points.\n */\nexport const hullOf = (soup: HullSoup): number[] | null => {\n if (soup.vertices.length < 9) return null\n const reduced = reducePoints(soup.vertices, MAX_HULL_POINTS)\n const normal = mainNormal(soup)\n if (spreadAlong(reduced, normal) >= 2 * FLAT_PAD && convexFaces(reduced)) return reduced\n const thick = paddedAlong(reducePoints(reduced, MAX_HULL_POINTS / 2), normal)\n if (convexFaces(thick)) return thick\n const lined = paddedAlong(paddedAlong(reducePoints(reduced, MAX_HULL_POINTS / 4), normal), acrossOf(normal))\n return convexFaces(lined) ? lined : null\n}\n","import { WORKER_KIND_DEFAULTS, WORKER_KIND_ID } from '@adatechnology/game-contracts'\nimport type { TaskKind } from '@adatechnology/game-contracts'\n\nimport { newHullPlan, planDivision } from './hull-plan'\nimport { hullOf } from './vehicle-hulls'\nimport type { CutNode } from './hull-split'\n\n/** One thin piece of the intact car, named by its key: its triangles in the frame of the colliders. */\nexport interface HullPlanPiece {\n readonly key: string\n readonly vertices: Float64Array\n readonly indices: Uint32Array\n}\n\n/** What the division of a car's pieces needs: the thin pieces, the pieces of the solid parts (one entry per piece, `key` the part: each part gets one hull of all its pieces) and the hulls the model may have besides the solid parts. */\nexport interface HullPlanJob {\n readonly pieces: readonly HullPlanPiece[]\n readonly solids: readonly HullPlanPiece[]\n readonly maxHulls: number\n}\n\n/** The one hull of a solid part (empty `points` when it has none), named by the part. */\nexport interface HullPlanSolid {\n readonly key: string\n readonly points: Float32Array\n}\n\n/** A hull the division made: the piece it is from (`unit`, with `~n` for a protrusion), the cuts that lead to it, its points and the drawn vertices it was made from. */\nexport interface HullPlanLeaf {\n readonly unit: string\n readonly path: string\n readonly points: Float32Array\n readonly vertices: Float64Array\n}\n\n/** The plan of a car, as plain data (no `Map`, so two results compare byte for byte): the cuts and the protrusions taken off each piece, and the hulls they make. */\nexport interface HullPlanResult {\n readonly cuts: ReadonlyArray<readonly [string, CutNode]>\n readonly taken: ReadonlyArray<readonly [string, readonly number[]]>\n readonly leaves: readonly HullPlanLeaf[]\n readonly solids: readonly HullPlanSolid[]\n}\n\n/** The hull of each solid part: its pieces together, in the order the parts first appear. */\nconst solidHullsOf = (pieces: readonly HullPlanPiece[]): HullPlanSolid[] => {\n const parts = new Map<string, { vertices: number[]; indices: number[] }>()\n for (const piece of pieces) {\n let part = parts.get(piece.key)\n if (!part) parts.set(piece.key, (part = { vertices: [], indices: [] }))\n const offset = part.vertices.length / 3\n for (const value of piece.vertices) part.vertices.push(value)\n for (const index of piece.indices) part.indices.push(index + offset)\n }\n return [...parts].map(([key, soup]) => ({ key, points: new Float32Array(hullOf(soup) ?? []) }))\n}\n\n/** The whole division of an intact car (design 10.3): a pure function of the job, the same on the main thread and in a worker. */\nexport const planHulls = (job: HullPlanJob): HullPlanResult => {\n const plan = newHullPlan()\n const leaves = planDivision(job.pieces.map((piece) => ({ key: piece.key, soup: { vertices: Array.from(piece.vertices), indices: Array.from(piece.indices) } })), plan, job.maxHulls)\n return {\n cuts: [...plan.cuts],\n taken: [...plan.taken].map(([unit, numbers]) => [unit, [...numbers]] as const),\n solids: solidHullsOf(job.solids),\n leaves: leaves.flatMap((leaf) => (leaf.points ? [{ unit: leaf.unit, path: leaf.path, points: new Float32Array(leaf.points), vertices: Float64Array.from(leaf.soup.vertices) }] : [])),\n }\n}\n\nconst WARMUP: HullPlanJob = {\n pieces: [{ key: 'roof#1', vertices: Float64Array.of(0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0.5, 1.4, 0.5), indices: Uint32Array.of(0, 1, 2, 0, 2, 3, 0, 1, 4) }],\n solids: [{ key: 'engine', vertices: Float64Array.of(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), indices: Uint32Array.of(0, 1, 2, 0, 1, 3) }],\n maxHulls: 8,\n}\n\n/**\n * The division of a car's hulls as a task kind of the worker coordinator (`vehicles.hull-plan`, lane `build`, CLAUDE.md §14): the pieces of the intact car in (their buffers handed over, not copied: a car whose worker fails makes the job again), the plan and the hulls\n * out, the buffers transferred back. It is made once per model and kept by `createHullPlanCache`; until it arrives the car collides as the pieces' boxes. A game's worker file lists it in\n * `installWorkerHost`.\n */\nexport const hullPlanKind: TaskKind<HullPlanJob, HullPlanResult> = Object.freeze({\n id: WORKER_KIND_ID.VEHICLE_HULL_PLAN,\n kind: 'task' as const,\n ...WORKER_KIND_DEFAULTS[WORKER_KIND_ID.VEHICLE_HULL_PLAN],\n run: planHulls,\n transferInput: (job: HullPlanJob): ArrayBuffer[] => [...job.pieces, ...job.solids].flatMap((piece) => [piece.vertices.buffer as ArrayBuffer, piece.indices.buffer as ArrayBuffer]),\n transferOutput: (result: HullPlanResult): ArrayBuffer[] => [...result.leaves.flatMap((leaf) => [leaf.points.buffer as ArrayBuffer, leaf.vertices.buffer as ArrayBuffer]), ...result.solids.map((solid) => solid.points.buffer as ArrayBuffer)],\n warmup: WARMUP,\n})\n","import { convexFaces } from './hull-geometry'\nimport type { HullSoup } from './vehicle-hulls'\n\n/** A point of a hull face is floating when no drawn triangle of the piece is within this (m): a ball of the check (r = 10 cm) leans on it with nothing drawn at its side (design 10.3, K3). */\nexport const FLOATING_REACH = 0.05\n/** The floating area (m2) of a hull a piece is divided again over. */\nexport const FLOATING_AREA = 0.004\n\n/** Samples of a face are on a grid of this many steps along each edge. */\nconst STEPS = 3\n\n/** Triangles are looked up in a grid of this cell (m); one covering more than `MAX_CELLS` cells is always looked at. */\nconst CELL = 0.1\nconst MAX_CELLS = 64\nconst cellKey = (x: number, y: number, z: number): number => ((x + 4096) * 8192 + (y + 4096)) * 8192 + (z + 4096)\n\ntype Point = readonly [number, number, number]\n\nconst sub = (a: Point, b: Point): Point => [a[0] - b[0], a[1] - b[1], a[2] - b[2]]\nconst dot = (a: Point, b: Point): number => a[0] * b[0] + a[1] * b[1] + a[2] * b[2]\n\n/** Squared distance from `p` to the triangle `a b c` (closest point on the triangle). */\nconst distanceSquared = (p: Point, a: Point, b: Point, c: Point): number => {\n const ab = sub(b, a), ac = sub(c, a), ap = sub(p, a)\n const d1 = dot(ab, ap), d2 = dot(ac, ap)\n let closest: Point\n const at = (u: number, v: number): Point => [a[0] + ab[0] * u + ac[0] * v, a[1] + ab[1] * u + ac[1] * v, a[2] + ab[2] * u + ac[2] * v]\n const bp = sub(p, b), d3 = dot(ab, bp), d4 = dot(ac, bp)\n const cp = sub(p, c), d5 = dot(ab, cp), d6 = dot(ac, cp)\n const vc = d1 * d4 - d3 * d2, vb = d5 * d2 - d1 * d6, va = d3 * d6 - d5 * d4\n if (d1 <= 0 && d2 <= 0) closest = a\n else if (d3 >= 0 && d4 <= d3) closest = b\n else if (vc <= 0 && d1 >= 0 && d3 <= 0) closest = at(d1 / (d1 - d3), 0)\n else if (d6 >= 0 && d5 <= d6) closest = c\n else if (vb <= 0 && d2 >= 0 && d6 <= 0) closest = at(0, d2 / (d2 - d6))\n else if (va <= 0 && d4 - d3 >= 0 && d5 - d6 >= 0) closest = at(1 - (d4 - d3) / (d4 - d3 + (d5 - d6)), (d4 - d3) / (d4 - d3 + (d5 - d6)))\n else {\n const sum = va + vb + vc\n closest = at(vb / sum, vc / sum)\n }\n const d = sub(p, closest)\n return dot(d, d)\n}\n\n/** The triangles of a piece laid in a grid, to ask whether any is near a point. */\nexport interface DrawnIndex {\n readonly isNear: (x: number, y: number, z: number) => boolean\n}\n\n/** The grid of the triangles of a piece (all of them, protrusions too: they are drawn), built the first time it is asked and then kept. */\nexport const drawnIndexOf = (soup: HullSoup): DrawnIndex => {\n let built: DrawnIndex | null = null\n return { isNear: (x, y, z) => (built ??= buildIndex(soup)).isNear(x, y, z) }\n}\n\nconst buildIndex = (soup: HullSoup): DrawnIndex => {\n const triangles = soup.indices.length / 3\n const corner = new Float64Array(triangles * 9)\n const boxes = new Float64Array(triangles * 6)\n for (let t = 0; t < triangles; t++) {\n for (let k = 0; k < 3; k++) {\n const v = soup.indices[t * 3 + k]! * 3\n for (let a = 0; a < 3; a++) corner[t * 9 + k * 3 + a] = soup.vertices[v + a]!\n }\n for (let a = 0; a < 3; a++) {\n const x = corner[t * 9 + a]!, y = corner[t * 9 + 3 + a]!, z = corner[t * 9 + 6 + a]!\n boxes[t * 6 + a] = Math.min(x, y, z) - FLOATING_REACH\n boxes[t * 6 + 3 + a] = Math.max(x, y, z) + FLOATING_REACH\n }\n }\n const cells = new Map<number, number[]>()\n const wide: number[] = []\n for (let t = 0; t < triangles; t++) {\n const o = t * 6\n const [x0, y0, z0, x1, y1, z1] = [0, 1, 2, 3, 4, 5].map((k) => Math.floor(boxes[o + k]! / CELL))\n if ((x1! - x0! + 1) * (y1! - y0! + 1) * (z1! - z0! + 1) > MAX_CELLS) {\n wide.push(t)\n continue\n }\n for (let x = x0!; x <= x1!; x++) for (let y = y0!; y <= y1!; y++) for (let z = z0!; z <= z1!; z++) {\n const key = cellKey(x, y, z)\n const list = cells.get(key)\n if (list) list.push(t)\n else cells.set(key, [t])\n }\n }\n const isNearTriangle = (t: number, x: number, y: number, z: number): boolean => {\n const o = t * 6\n if (x < boxes[o]! || y < boxes[o + 1]! || z < boxes[o + 2]! || x > boxes[o + 3]! || y > boxes[o + 4]! || z > boxes[o + 5]!) return false\n const c = t * 9\n return distanceSquared([x, y, z], [corner[c]!, corner[c + 1]!, corner[c + 2]!], [corner[c + 3]!, corner[c + 4]!, corner[c + 5]!], [corner[c + 6]!, corner[c + 7]!, corner[c + 8]!]) <= FLOATING_REACH * FLOATING_REACH\n }\n return {\n isNear: (x, y, z) => {\n for (const t of cells.get(cellKey(Math.floor(x / CELL), Math.floor(y / CELL), Math.floor(z / CELL))) ?? []) if (isNearTriangle(t, x, y, z)) return true\n for (const t of wide) if (isNearTriangle(t, x, y, z)) return true\n return false\n },\n }\n}\n\n/**\n * The area (m2) of the hull's faces that is floating: samples of each face with no triangle of the piece within `FLOATING_REACH`. It is what a convex hull of a concave piece adds over\n * the drawn one (the cone from an antenna's tip to the roof, the filled floor between its rails); a piece is divided over it. A local stand-in for K3: only the piece's own triangles count.\n */\nexport const floatingAreaOf = (points: ArrayLike<number>, drawn: DrawnIndex): number => {\n const faces = convexFaces(points)\n if (!faces) return 0\n const vertex = (i: number): Point => [points[i * 3]!, points[i * 3 + 1]!, points[i * 3 + 2]!]\n let floating = 0\n for (const [ia, ib, ic] of faces) {\n const a = vertex(ia), b = vertex(ib), c = vertex(ic)\n const ab = sub(b, a), ac = sub(c, a)\n const area = Math.hypot(ab[1] * ac[2] - ab[2] * ac[1], ab[2] * ac[0] - ab[0] * ac[2], ab[0] * ac[1] - ab[1] * ac[0]) / 2\n let samples = 0, far = 0\n for (let i = 0; i <= STEPS; i++) {\n for (let j = 0; i + j <= STEPS; j++) {\n samples++\n const u = i / STEPS, v = j / STEPS\n if (!drawn.isNear(a[0] + ab[0] * u + ac[0] * v, a[1] + ab[1] * u + ac[1] * v, a[2] + ab[2] * u + ac[2] * v)) far++\n }\n }\n floating += (area * far) / samples\n }\n return floating\n}\n","import { convexFaces, hullVolume, reducePoints } from './hull-geometry'\nimport type { HullSoup } from './vehicle-hulls'\n\n/** A protrusion is thin when both of the two smaller sides of its box are at most this (m). */\nexport const THIN_SECTION = 0.08\n/** A thin part sticks out of the body when its box passes the body's box by more than this (m). */\nexport const PROTRUSION_REACH = 0.03\n/** A thin part has a hull of at most this volume (m3): a rod, a stalk, a blade. */\nexport const THIN_VOLUME = 2e-4\n/** The bulk of a piece along a direction is found in this many bins. */\nconst BULK_BINS = 256\n/** The tail of a piece along a direction is the triangles past the point that holds this share of the piece's area, by `PROTRUSION_REACH`. */\nexport const BULK_SHARE = 0.99\n/** A piece shorter than this (m) along its longest side is not divided again. */\nexport const MIN_DIVISIBLE = 0.05\n\n/** A cut across one axis; the two halves it makes are cut again by `lo` and `hi`, or are leaves when those are null. */\nexport interface CutNode {\n readonly axis: 0 | 1 | 2\n readonly at: number\n lo: CutNode | null\n hi: CutNode | null\n}\n\n/** The triangles (by number) of a soup as a soup of their own, vertices kept once. */\nexport const subSoup = (soup: HullSoup, triangles: readonly number[]): HullSoup => {\n const moved = new Map<number, number>()\n const vertices: number[] = []\n const indices: number[] = []\n for (const t of triangles) {\n for (let k = 0; k < 3; k++) {\n const v = soup.indices[t * 3 + k]!\n let at = moved.get(v)\n if (at === undefined) {\n at = vertices.length / 3\n moved.set(v, at)\n vertices.push(soup.vertices[v * 3]!, soup.vertices[v * 3 + 1]!, soup.vertices[v * 3 + 2]!)\n }\n indices.push(at)\n }\n }\n return { vertices, indices }\n}\n\n/** Vertices closer than this (m) are one: a mesh that repeats a corner for each face is still one surface. */\nconst WELD = 1e-4\n\n/** The triangles of the soup by connected part (a corner in common, welded at `WELD`), each list in triangle order, the lists by their first triangle. */\nexport const componentsOf = (soup: HullSoup): number[][] => {\n const welded = new Map<number, number>()\n const weldOf = (v: number): number => {\n const key = ((Math.round(soup.vertices[v * 3]! / WELD) * 73856093) ^ (Math.round(soup.vertices[v * 3 + 1]! / WELD) * 19349663) ^ (Math.round(soup.vertices[v * 3 + 2]! / WELD) * 83492791)) >>> 0\n let id = welded.get(key)\n if (id === undefined) welded.set(key, (id = welded.size))\n return id\n }\n const parent: number[] = []\n const rootOf = (v: number): number => {\n let root = v\n while (parent[root] !== root) root = parent[root]!\n for (let node = v; parent[node] !== root; ) [node, parent[node]] = [parent[node]!, root]\n return root\n }\n const corners: number[] = []\n for (let i = 0; i < soup.indices.length; i++) {\n const id = weldOf(soup.indices[i]!)\n while (parent.length <= id) parent.push(parent.length)\n corners.push(id)\n }\n for (let t = 0; t < corners.length; t += 3) {\n parent[rootOf(corners[t + 1]!)] = rootOf(corners[t]!)\n parent[rootOf(corners[t + 2]!)] = rootOf(corners[t]!)\n }\n const groups = new Map<number, number[]>()\n for (let t = 0; t < corners.length / 3; t++) {\n const root = rootOf(corners[t * 3]!)\n const list = groups.get(root)\n if (list) list.push(t)\n else groups.set(root, [t])\n }\n return [...groups.values()]\n}\n\ntype Box = { readonly low: [number, number, number]; readonly high: [number, number, number] }\n\nconst boxOf = (soup: HullSoup): Box => {\n const low: [number, number, number] = [Infinity, Infinity, Infinity]\n const high: [number, number, number] = [-Infinity, -Infinity, -Infinity]\n for (let i = 0; i < soup.vertices.length; i += 3) {\n for (let k = 0; k < 3; k++) {\n const value = soup.vertices[i + k]!\n if (value < low[k]!) low[k] = value\n if (value > high[k]!) high[k] = value\n }\n }\n return { low, high }\n}\n\nconst volumeOf = (soup: HullSoup): number => {\n const points = reducePoints(soup.vertices, 64)\n const faces = convexFaces(points)\n return faces ? hullVolume(points, faces) : 0\n}\n\n/** The directions a tail is looked for along: the six of the axes. */\nconst AXES: ReadonlyArray<readonly [number, number]> = [[0, 1], [0, -1], [1, 1], [1, -1], [2, 1], [2, -1]]\n\n/** The triangles whose centre is more than `PROTRUSION_REACH` past the bulk (`BULK_SHARE` of the area) of the piece, along any of the six axis directions. */\nconst tailOf = (soup: HullSoup): number[] => {\n const count = soup.indices.length / 3\n const areas: number[] = []\n const centres: number[][] = []\n for (let t = 0; t < count; t++) {\n const [a, b, c] = [0, 1, 2].map((k) => soup.indices[t * 3 + k]! * 3) as [number, number, number]\n const v = soup.vertices\n const ux = v[b]! - v[a]!, uy = v[b + 1]! - v[a + 1]!, uz = v[b + 2]! - v[a + 2]!, wx = v[c]! - v[a]!, wy = v[c + 1]! - v[a + 1]!, wz = v[c + 2]! - v[a + 2]!\n areas.push(Math.hypot(uy * wz - uz * wy, uz * wx - ux * wz, ux * wy - uy * wx))\n centres.push([(v[a]! + v[b]! + v[c]!) / 3, (v[a + 1]! + v[b + 1]! + v[c + 1]!) / 3, (v[a + 2]! + v[b + 2]! + v[c + 2]!) / 3])\n }\n const total = areas.reduce((sum, area) => sum + area, 0)\n const tail = new Set<number>()\n for (const [axis, sign] of AXES) {\n const values = centres.map((centre) => sign * centre[axis]!)\n let low = Infinity, high = -Infinity\n for (const value of values) {\n if (value < low) low = value\n if (value > high) high = value\n }\n const step = (high - low) / BULK_BINS || 1\n const area = new Float64Array(BULK_BINS + 1)\n values.forEach((value, t) => { area[Math.floor((value - low) / step)]! += areas[t]! })\n let reached = 0, bin = 0\n while (bin < BULK_BINS && reached + area[bin]! < total * BULK_SHARE) reached += area[bin++]!\n const bulk = low + (bin + 1) * step\n for (let t = 0; t < count; t++) if (values[t]! > bulk + PROTRUSION_REACH) tail.add(t)\n }\n return [...tail].sort((p, q) => p - q)\n}\n\n/** A thin part that sticks out of a piece: its triangles (by number in the piece's soup), the soup of them, and its name in a piece (the number of its first triangle). */\nexport interface Protrusion {\n readonly id: number\n readonly triangles: readonly number[]\n readonly soup: HullSoup\n}\n\n/**\n * Thin parts that may be taken off a piece (antenna, wiper, handle on a stalk, step): parts that stick out of it and have a hull of at most `THIN_VOLUME`. A part sticks out when it is a\n * connected part (corners welded at `WELD`) of its own that is thin (both smaller sides of its box at most `THIN_SECTION`) and passes the box of what is not thin by `PROTRUSION_REACH`;\n * or, welded to the body, when its triangles are the tail of the piece (`tailOf`).\n */\nexport const protrusionsOf = (soup: HullSoup): Protrusion[] => {\n const taken = new Set<number>()\n const out: Protrusion[] = []\n const add = (triangles: readonly number[], from: HullSoup): void => {\n out.push({ id: triangles[0]!, triangles, soup: from })\n for (const t of triangles) taken.add(t)\n }\n const tail = tailOf(soup)\n if (tail.length > 0) {\n for (const group of componentsOf(subSoup(soup, tail))) {\n const triangles = group.map((t) => tail[t]!)\n const part = subSoup(soup, triangles)\n if (volumeOf(part) <= THIN_VOLUME) add(triangles, part)\n }\n }\n const parts = componentsOf(soup)\n if (parts.length < 2) return out\n const soups = parts.map((triangles) => subSoup(soup, triangles))\n const boxes = soups.map(boxOf)\n const isThin = boxes.map((box) => box.high.map((high, k) => high - box.low[k]!).sort((a, b) => a - b)[1]! <= THIN_SECTION)\n const thick = soups.filter((_, i) => !isThin[i])\n if (thick.length === 0) return out\n const bodyBox = boxOf({ vertices: thick.flatMap((part) => part.vertices), indices: [] })\n parts.forEach((triangles, i) => {\n if (!isThin[i] || triangles.some((t) => taken.has(t))) return\n const box = boxes[i]!\n if ([0, 1, 2].some((k) => box.high[k]! > bodyBox.high[k]! + PROTRUSION_REACH || box.low[k]! < bodyBox.low[k]! - PROTRUSION_REACH)) add(triangles, soups[i]!)\n })\n return out\n}\n\n/** The soup without the triangles of the protrusions. */\nexport const withoutProtrusions = (soup: HullSoup, protrusions: readonly Protrusion[]): HullSoup => {\n const gone = new Set(protrusions.flatMap((protrusion) => protrusion.triangles))\n return subSoup(soup, Array.from({ length: soup.indices.length / 3 }, (_, t) => t).filter((t) => !gone.has(t)))\n}\n\n/** Two soups as one. */\nexport const joined = (a: HullSoup, b: HullSoup): HullSoup => ({ vertices: [...a.vertices, ...b.vertices], indices: [...a.indices, ...b.indices.map((i) => i + a.vertices.length / 3)] })\n\n/** The units of a piece when `taken` (the numbers of the protrusions the plan took off it) are the ones to take off: the body, named by `key`, then each protrusion, named by `key` and its number. */\nexport const unitsOf = (key: string, soup: HullSoup, taken: ReadonlySet<number> | undefined): Array<{ readonly key: string; readonly soup: HullSoup }> => {\n if (!taken || taken.size === 0) return [{ key, soup }]\n const off = protrusionsOf(soup).filter((protrusion) => taken.has(protrusion.id))\n if (off.length === 0) return [{ key, soup }]\n return [{ key, soup: withoutProtrusions(soup, off) }, ...off.map((protrusion) => ({ key: `${key}~${protrusion.id}`, soup: protrusion.soup }))]\n}\n\n/** The longest side of the box of the triangles' centres: its axis, and the middle of it (the centres, not the corners, so a spike does not carry the cut off the piece). */\nexport const longestSide = (soup: HullSoup): { readonly axis: 0 | 1 | 2; readonly at: number; readonly length: number } => {\n const centres: number[] = []\n for (let t = 0; t < soup.indices.length / 3; t++) {\n for (let k = 0; k < 3; k++) centres.push((soup.vertices[soup.indices[t * 3]! * 3 + k]! + soup.vertices[soup.indices[t * 3 + 1]! * 3 + k]! + soup.vertices[soup.indices[t * 3 + 2]! * 3 + k]!) / 3)\n }\n const { low, high } = boxOf({ vertices: centres, indices: [] })\n let axis: 0 | 1 | 2 = 0\n for (const k of [1, 2] as const) if (high[k]! - low[k]! > high[axis]! - low[axis]!) axis = k\n return { axis, at: (low[axis]! + high[axis]!) / 2, length: high[axis]! - low[axis]! }\n}\n\n/** The triangles whose centre is below the cut and the ones that are not, as two soups (a half with no triangle is null). */\nexport const cutSoup = (soup: HullSoup, axis: number, at: number): [HullSoup | null, HullSoup | null] => {\n const lo: number[] = []\n const hi: number[] = []\n for (let t = 0; t < soup.indices.length / 3; t++) {\n const centre = (soup.vertices[soup.indices[t * 3]! * 3 + axis]! + soup.vertices[soup.indices[t * 3 + 1]! * 3 + axis]! + soup.vertices[soup.indices[t * 3 + 2]! * 3 + axis]!) / 3\n ;(centre < at ? lo : hi).push(t)\n }\n return [lo.length ? subSoup(soup, lo) : null, hi.length ? subSoup(soup, hi) : null]\n}\n\n/** The leaves of a unit under its cuts (the same cuts as when the car was whole): the soup of each, named by the unit's key and the path of the cuts. */\nexport const leavesOf = (key: string, soup: HullSoup, node: CutNode | null, path = ''): Array<{ readonly key: string; readonly path: string; readonly soup: HullSoup }> => {\n if (!node) return [{ key: path ? `${key}:${path}` : key, path, soup }]\n const [lo, hi] = cutSoup(soup, node.axis, node.at)\n return [...(lo ? leavesOf(key, lo, node.lo, `${path}0`) : []), ...(hi ? leavesOf(key, hi, node.hi, `${path}1`) : [])]\n}\n","import { FLOATING_AREA, drawnIndexOf, floatingAreaOf } from './hull-excess'\nimport type { DrawnIndex } from './hull-excess'\nimport { MIN_DIVISIBLE, cutSoup, joined, longestSide, protrusionsOf, withoutProtrusions } from './hull-split'\nimport type { CutNode } from './hull-split'\nimport { hullOf } from './vehicle-hulls'\nimport type { HullSoup } from './vehicle-hulls'\n\n/** What the division decided about a car and kept: the cuts of each unit, and the protrusions (by number) taken off each piece. Later builds of the same car (dented) follow it. */\nexport interface HullPlan {\n readonly cuts: Map<string, CutNode>\n readonly taken: Map<string, Set<number>>\n}\n\nexport const newHullPlan = (): HullPlan => ({ cuts: new Map(), taken: new Map() })\n\n/** A piece of the car (named by its key), or a protrusion taken off one (the key and its number), as a soup. */\nexport interface HullUnit {\n readonly key: string\n readonly soup: HullSoup\n}\n\n/** A piece of a unit and its hull (null when it has none) and the floating area of it. */\nexport interface HullLeaf {\n readonly unit: string\n readonly path: string\n readonly soup: HullSoup\n readonly points: number[] | null\n readonly floating: number\n /** Its protrusions have been looked at (or it is not a whole piece). */\n readonly isDone: boolean\n /** The drawn triangles of the whole piece it belongs to. */\n readonly drawn: DrawnIndex\n}\n\nconst floatingOf = (soup: HullSoup, drawn: DrawnIndex): number => {\n const points = hullOf(soup)\n return points ? floatingAreaOf(points, drawn) : 0\n}\n\nconst leafOf = (unit: string, path: string, soup: HullSoup, isDone: boolean, drawn: DrawnIndex): HullLeaf => {\n const points = hullOf(soup)\n return { unit, path, soup, points, floating: points ? floatingAreaOf(points, drawn) : 0, isDone, drawn }\n}\n\nconst insertCut = (cuts: Map<string, CutNode>, unit: string, path: string, node: CutNode): void => {\n if (path === '') {\n cuts.set(unit, node)\n return\n }\n let at = cuts.get(unit)!\n for (const step of path.slice(0, -1)) at = (step === '0' ? at.lo : at.hi)!\n if (path.endsWith('0')) at.lo = node\n else at.hi = node\n}\n\n/** Takes the thin parts that stretch the hull of a piece off it: those that add more than `FLOATING_AREA` to the floating area of the rest, the one that adds most first, while the model has room. */\nconst takeProtrusions = (leaf: HullLeaf, room: number): { body: HullLeaf; parts: HullLeaf[]; ids: number[] } => {\n const all = protrusionsOf(leaf.soup)\n const rest = withoutProtrusions(leaf.soup, all)\n const base = floatingOf(rest, leaf.drawn)\n const gains = all.map((protrusion) => ({ protrusion, gain: floatingOf(joined(rest, protrusion.soup), leaf.drawn) - base })).filter(({ gain }) => gain > FLOATING_AREA)\n const taken = gains.sort((a, b) => b.gain - a.gain || a.protrusion.id - b.protrusion.id).slice(0, Math.max(0, room)).map(({ protrusion }) => protrusion)\n const body = leafOf(leaf.unit, '', withoutProtrusions(leaf.soup, taken), true, leaf.drawn)\n return { body, parts: taken.map((protrusion) => leafOf(`${leaf.unit}~${protrusion.id}`, '', protrusion.soup, true, leaf.drawn)), ids: taken.map((protrusion) => protrusion.id) }\n}\n\n/**\n * The adaptive division (design 10.3): every piece starts as one hull; while a hull still floats more than `FLOATING_AREA`, the one that floats most (ties go to the first in the list) first\n * gives up the thin parts that stretch it (`takeProtrusions`), then is cut in the middle of its longest side, until none floats that much, none can be cut, or the model has `maxHulls`\n * hulls. What was decided is written to `plan` and is what a dented car follows. Returns the leaves, in the order of the pieces.\n */\nexport const planDivision = (pieces: readonly HullUnit[], plan: HullPlan, maxHulls: number): HullLeaf[] => {\n let leaves = pieces.map((piece) => leafOf(piece.key, '', piece.soup, false, drawnIndexOf(piece.soup)))\n let hulls = leaves.filter((leaf) => leaf.points).length\n while (hulls < maxHulls) {\n let worst = -1\n for (let i = 0; i < leaves.length; i++) {\n const leaf = leaves[i]!\n if (leaf.floating > FLOATING_AREA && (worst < 0 || leaf.floating > leaves[worst]!.floating)) worst = i\n }\n if (worst < 0) break\n const leaf = leaves[worst]!\n if (!leaf.isDone && leaf.path === '') {\n const { body, parts, ids } = takeProtrusions(leaf, maxHulls - hulls)\n if (ids.length > 0) plan.taken.set(leaf.unit, new Set(ids))\n hulls += parts.filter((part) => part.points).length\n leaves = [...leaves.slice(0, worst), body, ...parts, ...leaves.slice(worst + 1)]\n continue\n }\n const { axis, at, length } = longestSide(leaf.soup)\n const [lo, hi] = length < MIN_DIVISIBLE ? [null, null] : cutSoup(leaf.soup, axis, at)\n if (!lo || !hi) {\n leaves[worst] = { ...leaf, floating: 0 }\n continue\n }\n insertCut(plan.cuts, leaf.unit, leaf.path, { axis, at, lo: null, hi: null })\n const halves = [leafOf(leaf.unit, `${leaf.path}0`, lo, true, leaf.drawn), leafOf(leaf.unit, `${leaf.path}1`, hi, true, leaf.drawn)]\n hulls += halves.filter((half) => half.points).length - 1\n leaves = [...leaves.slice(0, worst), ...halves, ...leaves.slice(worst + 1)]\n }\n return leaves\n}\n"],"mappings":";AAMA,IAAM,YAAY;AAElB,IAAM,cAAgE,MAAM;AAC1E,QAAM,MAAgD,CAAC;AACvD,WAAS,IAAI,IAAI,KAAK,GAAG,IAAK,UAAS,IAAI,IAAI,KAAK,GAAG,IAAK,UAAS,IAAI,IAAI,KAAK,GAAG,IAAK,KAAI,MAAM,KAAK,MAAM,KAAK,MAAM,EAAG,KAAI,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC;AAC/I,SAAO;AACT,GAAG;AAYH,IAAM,SAAS,CAAC,GAAsB,GAAW,GAAW,MAAoB;AAC9E,QAAM,KAAK,EAAE,IAAI,CAAC,IAAK,EAAE,IAAI,CAAC,GAAI,KAAK,EAAE,IAAI,IAAI,CAAC,IAAK,EAAE,IAAI,IAAI,CAAC,GAAI,KAAK,EAAE,IAAI,IAAI,CAAC,IAAK,EAAE,IAAI,IAAI,CAAC;AACtG,QAAM,KAAK,EAAE,IAAI,CAAC,IAAK,EAAE,IAAI,CAAC,GAAI,KAAK,EAAE,IAAI,IAAI,CAAC,IAAK,EAAE,IAAI,IAAI,CAAC,GAAI,KAAK,EAAE,IAAI,IAAI,CAAC,IAAK,EAAE,IAAI,IAAI,CAAC;AACtG,MAAI,KAAK,KAAK,KAAK,KAAK,IAAI,KAAK,KAAK,KAAK,KAAK,IAAI,KAAK,KAAK,KAAK,KAAK;AACxE,QAAM,SAAS,KAAK,MAAM,IAAI,IAAI,EAAE,KAAK;AACzC,QAAM;AACN,QAAM;AACN,QAAM;AACN,SAAO,EAAE,GAAG,GAAG,GAAG,IAAI,IAAI,IAAI,GAAG,KAAK,EAAE,IAAI,CAAC,IAAK,KAAK,EAAE,IAAI,IAAI,CAAC,IAAK,KAAK,EAAE,IAAI,IAAI,CAAC,EAAG;AAC5F;AAEA,IAAM,SA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GED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { E as EngineProfile, V as VehicleSoundKeys, B as BuiltVehicle } from './testing-CRVetKNa.js';
|
|
2
2
|
export { a as BIKE_ENGINE, b as BuildVehicleOptions, C as CAR_ENGINE, c as CRASH_SPEEDS, D as DEFAULT_TEST_VEHICLES, d as DEFAULT_TEST_WRECKS, e as DEFAULT_VEHICLE_SOUND_KEYS, f as DocumentLike, g as ENGINE_PROFILES, h as EffectsLike, i as EngineLayer, j as EngineLoadLayer, F as FleetDims, M as ModuleRoomLike, P as PAGE_ITEM_ALIASES, k as PAGE_SCENARIO_ALIASES, l as PROVING_AREA_ID, m as PROVING_TEXT, n as ProvingModuleOptions, o as ProvingRoomLike, p as ProvingText, T as TRUCK_ENGINE, q as VEHICLES_AREA_ID, r as VEHICLE_SCENARIO_IDS, s as VehicleEffectIds, t as VehicleFleetContent, u as VehicleQuality, v as VehicleSoundIds, w as VehicleWreck, x as VehiclesContext, y as VehiclesRoom, z as VehiclesTestFleet, A as VehiclesTestOptions, G as VehiclesThree, H as VehiclesThreeOptions, I as createProvingModule, J as createVehiclesTestModule, K as createVehiclesThree, L as defaultEffectIds, N as defaultSoundIds, O as engineProfileOfGroup, Q as hornOfGroup, R as loadProvingModule, S as loadVehiclesTestModule } from './testing-CRVetKNa.js';
|
|
3
|
-
import { EffectSink, RainCover, Vec3, AudioSink, AnimationClipSpec, DrawnCollider } from '@adatechnology/game-contracts';
|
|
4
|
-
import { CabinSource, VehicleContext, VehicleDestructible } from '@adatechnology/game-vehicles';
|
|
3
|
+
import { EffectSink, RainCover, Vec3, AudioSink, AnimationClipSpec, DrawnCollider, WorkerCoordinator } from '@adatechnology/game-contracts';
|
|
4
|
+
import { CabinSource, VehicleContext, VehicleDestructible, PartDef } from '@adatechnology/game-vehicles';
|
|
5
5
|
import { LoopRecipe, Falloff, SampleAlias, SoundRecipe, SoundBank } from '@adatechnology/game-audio';
|
|
6
6
|
import * as THREE_NS from 'three';
|
|
7
7
|
import { Texture, Material, Color, Object3D, Matrix4, MeshStandardMaterial, MeshBasicMaterial, Mesh, Vector3, Box3, CanvasTexture, CircleGeometry, BufferGeometry, Side } from 'three';
|
|
8
8
|
import { StaticBatchQueue } from '@adatechnology/game-render-three';
|
|
9
|
+
import { Vec3 as Vec3$1, ShapeDesc, BodyId, PhysicsWorld } from '@adatechnology/game-physics';
|
|
10
|
+
import { C as CutNode, H as HullPlanResult } from './worker-kinds-Dnbh9_c9.js';
|
|
11
|
+
export { a as HullPlanJob } from './worker-kinds-Dnbh9_c9.js';
|
|
9
12
|
import '@adatechnology/game-vehicles-driving';
|
|
10
13
|
import '@adatechnology/game-vehicles-proving';
|
|
11
14
|
|
|
@@ -214,7 +217,7 @@ declare function createVehicleSound(audio: AudioSink | undefined, options?: Vehi
|
|
|
214
217
|
* 0.25 and 0.45 emissive) and the colours are the team's.
|
|
215
218
|
*/
|
|
216
219
|
|
|
217
|
-
type Three$
|
|
220
|
+
type Three$2 = typeof THREE_NS;
|
|
218
221
|
/** The six classes of a fused vehicle, in the order they are added to the group. */
|
|
219
222
|
declare const LITE_CLASSES: readonly ["paint", "trim", "metal", "glass", "light", "plate"];
|
|
220
223
|
type LiteClass = (typeof LITE_CLASSES)[number];
|
|
@@ -257,14 +260,14 @@ declare function classify(mat: LiteSourceMaterial, mesh: Object3D, c: LiteSource
|
|
|
257
260
|
/** The vertex colour of a piece of a class. `paintColor` replaces the primary paint. */
|
|
258
261
|
declare function classColor(mat: LiteSourceMaterial, cls: LiteClass, primary: Material | null | undefined, paintColor: Color | null | undefined, out: Color): Color;
|
|
259
262
|
/** The material of each class (vertex colours; glass blends; light is unlit; the plate keeps its canvas texture). */
|
|
260
|
-
declare function liteMaterials(THREE: Three$
|
|
263
|
+
declare function liteMaterials(THREE: Three$2, environment: Texture | null): Record<LiteClass, LiteMaterial>;
|
|
261
264
|
/**
|
|
262
265
|
* Walks the built vehicle and collects every visible mesh, in the frame of `pivot`, into one set of arrays per class.
|
|
263
266
|
* `hidden` is the set of materials nobody sees from outside (`kit.lodHiddenMaterials()`).
|
|
264
267
|
*/
|
|
265
|
-
declare function fuse(THREE: Three$
|
|
268
|
+
declare function fuse(THREE: Three$2, c: LiteSource, pivot: Matrix4, paintColor: Color | null, primary: Material | null | undefined, hidden: ReadonlySet<Material>): LiteFusion;
|
|
266
269
|
/** One mesh per class that has triangles. */
|
|
267
|
-
declare function liteMeshes(THREE: Three$
|
|
270
|
+
declare function liteMeshes(THREE: Three$2, fusion: LiteFusion, materials: Record<LiteClass, LiteMaterial>): Mesh[];
|
|
268
271
|
|
|
269
272
|
/** Past this distance (m) an untouched vehicle draws fused: nobody sees a door seam from here, and the full model costs hundreds of draw calls. */
|
|
270
273
|
declare const VEHICLE_LOD_DISTANCE = 14;
|
|
@@ -619,16 +622,95 @@ interface WindshieldMist {
|
|
|
619
622
|
}
|
|
620
623
|
declare function createWindshieldMist(THREE: MistThree, built: BuiltVehicle): WindshieldMist;
|
|
621
624
|
|
|
622
|
-
|
|
625
|
+
/** Points a hull is made of at most (design 10.1). */
|
|
626
|
+
declare const MAX_HULL_POINTS = 64;
|
|
627
|
+
/** A flat piece (thinner than twice this) gets this much (m) on each side of its plane. */
|
|
628
|
+
declare const FLAT_PAD = 0.0025;
|
|
629
|
+
|
|
630
|
+
/** What the division decided about a car and kept: the cuts of each unit, and the protrusions (by number) taken off each piece. Later builds of the same car (dented) follow it. */
|
|
631
|
+
interface HullPlan {
|
|
632
|
+
readonly cuts: Map<string, CutNode>;
|
|
633
|
+
readonly taken: Map<string, Set<number>>;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
/** A hull and the drawn vertices (x y z triples) it was made from. */
|
|
637
|
+
interface SharedHull {
|
|
638
|
+
readonly hull: VehicleHull;
|
|
639
|
+
readonly drawn: ArrayLike<number>;
|
|
640
|
+
}
|
|
641
|
+
/** The hulls of an intact model, made once: what every car of it is given instead of making them. */
|
|
642
|
+
interface SharedHulls {
|
|
643
|
+
/** The pieces (names and vertex counts) and the hull ceiling it was made for: a car whose pieces differ makes its own. */
|
|
644
|
+
readonly signature: string;
|
|
645
|
+
readonly plan: HullPlan;
|
|
646
|
+
readonly pieces: ReadonlyMap<string, readonly SharedHull[]>;
|
|
647
|
+
/** The solid parts' hulls (one each, whole), filled in by the first car that made them. */
|
|
648
|
+
readonly solids: Map<string, {
|
|
649
|
+
readonly signature: string;
|
|
650
|
+
readonly hulls: VehicleHull[];
|
|
651
|
+
}>;
|
|
652
|
+
}
|
|
653
|
+
/** A division on its way (in a worker): the cars of the same model wait for it instead of sending another. */
|
|
654
|
+
interface HullPlanFlight {
|
|
655
|
+
readonly signature: string;
|
|
656
|
+
readonly promise: Promise<HullPlanResult>;
|
|
657
|
+
}
|
|
658
|
+
interface HullPlanCacheStats {
|
|
659
|
+
readonly models: number;
|
|
660
|
+
/** Divisions made (here or in a worker). */
|
|
661
|
+
readonly planned: number;
|
|
662
|
+
/** Cars given the hulls of a model that was already made. */
|
|
663
|
+
readonly reused: number;
|
|
664
|
+
}
|
|
665
|
+
/**
|
|
666
|
+
* The hulls of the intact models, by model (the vehicle key, its seed key and its build state, and the ceiling): the division of a car is the same for every car of the model, so it is
|
|
667
|
+
* made once. `dispose` lets everything go (design 10.4: the memory is the engine's shapes and these, nothing is kept after).
|
|
668
|
+
*/
|
|
669
|
+
interface HullPlanCache {
|
|
670
|
+
get(key: string): SharedHulls | undefined;
|
|
671
|
+
set(key: string, shared: SharedHulls): void;
|
|
672
|
+
flight(key: string): HullPlanFlight | undefined;
|
|
673
|
+
setFlight(key: string, flight: HullPlanFlight): void;
|
|
674
|
+
clearFlight(key: string): void;
|
|
675
|
+
noteReused(): void;
|
|
676
|
+
noteDivided(): void;
|
|
677
|
+
stats(): HullPlanCacheStats;
|
|
678
|
+
dispose(): void;
|
|
679
|
+
}
|
|
680
|
+
declare const createHullPlanCache: () => HullPlanCache;
|
|
681
|
+
|
|
682
|
+
type Three$1 = typeof THREE_NS;
|
|
623
683
|
interface VehicleCollidersOptions {
|
|
624
684
|
/** Triangles of work per `pieces()` call: a vehicle that spawns fills in over several calls. Default all at once. */
|
|
625
685
|
readonly budget?: number;
|
|
686
|
+
/** Keeps what `hulls()` needs (the triangles of each piece); off by default, the pieces alone need none of it. */
|
|
687
|
+
readonly hulls?: boolean;
|
|
688
|
+
/** Hulls the model may have at most: the adaptive division (design 10.3) stops there. Default no limit. */
|
|
689
|
+
readonly maxHulls?: number;
|
|
690
|
+
/** Where the division of the first car of a model is made (CLAUDE.md §14): in a worker, while `hulls()` answers nothing and the car keeps the boxes of `pieces()`. Without it the division is made in the call. */
|
|
691
|
+
readonly workers?: WorkerCoordinator;
|
|
692
|
+
/** The hulls of the models already made, shared by the cars of a model: the second car of a model is given them whole. */
|
|
693
|
+
readonly planCache?: HullPlanCache;
|
|
694
|
+
/** The model this car is of, for `planCache`; default the vehicle's key, seed key and build state. Cars with the same key must be drawn the same when intact. */
|
|
695
|
+
readonly planKey?: string;
|
|
696
|
+
}
|
|
697
|
+
/** A convex hull of drawn vertices (at most 64), in the frame `pieces()` answers in: `id` is the part it belongs to, `key` names it across calls. */
|
|
698
|
+
interface VehicleHull {
|
|
699
|
+
readonly id: string;
|
|
700
|
+
readonly key: string;
|
|
701
|
+
readonly points: Float32Array;
|
|
626
702
|
}
|
|
627
703
|
interface VehicleColliders {
|
|
628
704
|
/** The pieces now: only what changed since the last call is made again. */
|
|
629
705
|
pieces(): DrawnCollider[];
|
|
630
706
|
/** Pieces are still to be made (the budget ran out): call `pieces()` again. */
|
|
631
707
|
isPending(): boolean;
|
|
708
|
+
/** The convex hulls of what is drawn (design 10.1): one hull of the drawn vertices of each piece (part x cell of 0.8 m), a solid part one hull whole, the wheels none; only the pieces a dent touched are made again. Needs `options.hulls`. */
|
|
709
|
+
hulls(): VehicleHull[];
|
|
710
|
+
/** The division is being made in a worker (`options.workers`): `hulls()` answers nothing until it is back, and the one call after that installs it. */
|
|
711
|
+
isHullPending(): boolean;
|
|
712
|
+
/** The drawn vertices (x y z triples, the frame of `pieces()`) a hull of the last `hulls()` call was made from; empty for a hull that is not one of them. */
|
|
713
|
+
drawnPointsOf(hull: VehicleHull): number[];
|
|
632
714
|
}
|
|
633
715
|
/**
|
|
634
716
|
* What a vehicle collides with in an engine, as it is drawn: one piece per part that has a mesh of its own (a door, the hood, the lid, a bumper, a wheel, a tyre, a lamp, a
|
|
@@ -639,8 +721,89 @@ interface VehicleColliders {
|
|
|
639
721
|
* Kept between calls: where each triangle went is worked out once per mesh, and a call finds what moved (a mesh that was posed, vertices a dent pushed) and makes again only
|
|
640
722
|
* the pieces it touched.
|
|
641
723
|
*/
|
|
642
|
-
declare const createVehicleColliders: (THREE: Three, vehicle: VehicleDestructible, frame: THREE_NS.Object3D, options?: VehicleCollidersOptions) => VehicleColliders;
|
|
724
|
+
declare const createVehicleColliders: (THREE: Three$1, vehicle: VehicleDestructible, frame: THREE_NS.Object3D, options?: VehicleCollidersOptions) => VehicleColliders;
|
|
643
725
|
/** The pieces of a vehicle once, all at once (`createVehicleColliders` keeps them between calls). */
|
|
644
|
-
declare const vehicleColliders: (THREE: Three, vehicle: VehicleDestructible, frame: THREE_NS.Object3D) => DrawnCollider[];
|
|
726
|
+
declare const vehicleColliders: (THREE: Three$1, vehicle: VehicleDestructible, frame: THREE_NS.Object3D) => DrawnCollider[];
|
|
727
|
+
/** The convex hulls of a vehicle once, all at once (`createVehicleColliders` with `hulls` keeps them between calls). */
|
|
728
|
+
declare const vehicleHulls: (THREE: Three$1, vehicle: VehicleDestructible, frame: THREE_NS.Object3D) => VehicleHull[];
|
|
729
|
+
|
|
730
|
+
/** What a body weighs and how it turns: its mass, centre of mass and moments about the principal axes, all in the body's frame. */
|
|
731
|
+
interface BodyMass {
|
|
732
|
+
readonly mass: number;
|
|
733
|
+
readonly centre: Vec3$1;
|
|
734
|
+
readonly inertia: Vec3$1;
|
|
735
|
+
}
|
|
736
|
+
/** Moments of a solid box of `mass` and full `size` about its own centre. */
|
|
737
|
+
declare const boxInertia: (mass: number, size: Vec3$1) => Vec3$1;
|
|
738
|
+
/**
|
|
739
|
+
* What is left of `total` when `part` (its own mass, centre and moments, in the same frame) leaves: the mass, the centre of mass the rest has, and its moments about that
|
|
740
|
+
* centre (the whole's moments about its centre, less the part's about that centre, moved to the rest's centre by the parallel axis theorem).
|
|
741
|
+
*/
|
|
742
|
+
declare const withoutPart: (total: BodyMass, part: BodyMass) => BodyMass;
|
|
743
|
+
|
|
744
|
+
type Three = typeof THREE_NS;
|
|
745
|
+
interface CrashPartsOptions {
|
|
746
|
+
readonly THREE: Three;
|
|
747
|
+
readonly world: PhysicsWorld;
|
|
748
|
+
readonly vehicle: VehicleDestructible;
|
|
749
|
+
/** The frame the hulls and the drawn meshes are in (`createVehicleColliders`' frame); its pose is the body's. */
|
|
750
|
+
readonly frame: THREE_NS.Object3D;
|
|
751
|
+
/** Made with `hulls: true`, and its plan back (`isHullPending()` false). */
|
|
752
|
+
readonly colliders: VehicleColliders;
|
|
753
|
+
/** The kit's numbers for the whole car, in the frame: its mass, centre of mass and moments. */
|
|
754
|
+
readonly mass: BodyMass;
|
|
755
|
+
/** A part left the car (the host remakes what depends on it: a wheel, the vehicle's constraint). */
|
|
756
|
+
readonly onPartLost?: (part: PartDef) => void;
|
|
757
|
+
}
|
|
758
|
+
interface CrashParts {
|
|
759
|
+
/** The chassis compound: make the body from it (dynamic, `mass.mass`, `mass.inertia`, `centreAtOrigin` off) and `bind` it. */
|
|
760
|
+
shape(): ShapeDesc;
|
|
761
|
+
bind(chassis: BodyId): void;
|
|
762
|
+
/** Once after each step: the contact rows become damage, the parts' drawings follow their bodies, and a car at rest has its hulls made again. */
|
|
763
|
+
step(): void;
|
|
764
|
+
/** What the car weighs now. */
|
|
765
|
+
mass(): BodyMass;
|
|
766
|
+
partBodies(): ReadonlyMap<string, BodyId>;
|
|
767
|
+
/** The kit's numbers each part that came off took with it (its mass, its centre in the frame, its moments). */
|
|
768
|
+
partNumbers(): ReadonlyMap<string, BodyMass>;
|
|
769
|
+
stats(): {
|
|
770
|
+
readonly released: number;
|
|
771
|
+
readonly pushedOut: number;
|
|
772
|
+
/** Times the hulls were looked at again, how many were given to the engine again, held back by the touching rule, and left without a child to go in. */
|
|
773
|
+
readonly settles: number;
|
|
774
|
+
readonly remade: number;
|
|
775
|
+
readonly held: number;
|
|
776
|
+
readonly unplaced: number;
|
|
777
|
+
/** Blows the contact rows made (`crashVehicle` calls), the damage events they gave, and the parts whose hull was in those rows. */
|
|
778
|
+
readonly blows: number;
|
|
779
|
+
readonly events: number;
|
|
780
|
+
readonly hitParts: ReadonlySet<string>;
|
|
781
|
+
/** Children left in the chassis compound. */
|
|
782
|
+
readonly children: number;
|
|
783
|
+
};
|
|
784
|
+
/** Takes the part bodies out of the world and gives the fling back to the vehicle. The chassis body is the host's. */
|
|
785
|
+
dispose(): void;
|
|
786
|
+
}
|
|
787
|
+
declare const createCrashParts: (options: CrashPartsOptions) => CrashParts;
|
|
788
|
+
|
|
789
|
+
/**
|
|
790
|
+
* The points of a rebuilt hull held to the old one while the part is touching something (design 10.5): a point may move in as far as it likes and out at most `slop` past
|
|
791
|
+
* a face of the old hull, so the rebuilt hull does not push what rests on it (energy made). The points past that are brought back along the face they are past; what
|
|
792
|
+
* is left of the move waits for the contact to end. Returns `next` itself when nothing was past the old hull, and the old points when the old hull is not a solid.
|
|
793
|
+
*/
|
|
794
|
+
declare const holdWithin: (old: ArrayLike<number>, next: Float32Array, slop: number) => Float32Array;
|
|
795
|
+
|
|
796
|
+
/** Convex hull of a point set (incremental), the point reduction a hull is made from, and its volume: the plain geometry under `vehicle-hulls.ts`. */
|
|
797
|
+
/** A hull face: three point numbers, wound so the normal (right hand) points out of the hull. */
|
|
798
|
+
type HullFace = readonly [number, number, number];
|
|
799
|
+
/** The faces of the convex hull of the points (x y z triples), wound outward; null when the points do not enclose a volume. */
|
|
800
|
+
declare const convexFaces: (points: ArrayLike<number>) => HullFace[] | null;
|
|
801
|
+
/** The volume (m3) the faces enclose. */
|
|
802
|
+
declare const hullVolume: (points: ArrayLike<number>, faces: readonly HullFace[]) => number;
|
|
803
|
+
/**
|
|
804
|
+
* At most `max` of the points (x y z triples): the extreme of each of the 26 directions, then the point farthest from those taken, again and again. Always points of the input,
|
|
805
|
+
* so a hull made of them never leaves what was drawn.
|
|
806
|
+
*/
|
|
807
|
+
declare const reducePoints: (points: ArrayLike<number>, max: number) => number[];
|
|
645
808
|
|
|
646
|
-
export { type BodyEvent, type BodyThree, BuiltVehicle, CAR_RECORDED_RPM, CAR_START_RUN_STOP, type CabinSmoke, DASHBOARD_LOOK, type DashboardOptions, type DashboardReading, type EngineBudget, type EngineBudgetOptions, type EngineLayerSetting, type EngineMixInput, EngineProfile, LAMP_RULES, LITE_CLASSES, type LampSwitch, type LiteClass, type LiteFusion, MIST_RULES, type MistThree, PRUNE_BELOW, RAIN_SHELL_INTERVAL, VEHICLE_LOD_DISTANCE, VEHICLE_LOOPS, VEHICLE_LOOP_FALLOFF, VEHICLE_PRELOAD_SOUNDS, VEHICLE_SAMPLE_ALIASES, VEHICLE_SOUNDS, VEHICLE_SOUND_BANK, type VehicleBody, type VehicleBodyOptions, type VehicleColliders, type VehicleCollidersOptions, type VehicleDashboard, type VehicleLamps, type VehicleLod, type VehicleLodKit, type VehicleRainCovers, type VehicleSound, type VehicleSoundFrame, VehicleSoundKeys, type VehicleSoundOptions, type VehicleSoundReading, type WheelRoll, type WheelRollThree, type WindowId, type WindshieldMist, classColor, classify, createCabinSmoke, createEngineBudget, createGearGuess, createVehicleBody, createVehicleColliders, createVehicleDashboard, createVehicleLamps, createVehicleLod, createVehicleLodQueue, createVehicleRainCovers, createVehicleSound, createWheelRoll, createWindshieldMist, engineMix, firingHz, fuse, layerWeight, liteMaterials, liteMeshes, rpmShare, slideOfGrip, vehicleColliders };
|
|
809
|
+
export { type BodyEvent, type BodyMass, type BodyThree, BuiltVehicle, CAR_RECORDED_RPM, CAR_START_RUN_STOP, type CabinSmoke, type CrashParts, type CrashPartsOptions, DASHBOARD_LOOK, type DashboardOptions, type DashboardReading, type EngineBudget, type EngineBudgetOptions, type EngineLayerSetting, type EngineMixInput, EngineProfile, FLAT_PAD, type HullFace, type HullPlanCache, type HullPlanCacheStats, HullPlanResult, LAMP_RULES, LITE_CLASSES, type LampSwitch, type LiteClass, type LiteFusion, MAX_HULL_POINTS, MIST_RULES, type MistThree, PRUNE_BELOW, RAIN_SHELL_INTERVAL, VEHICLE_LOD_DISTANCE, VEHICLE_LOOPS, VEHICLE_LOOP_FALLOFF, VEHICLE_PRELOAD_SOUNDS, VEHICLE_SAMPLE_ALIASES, VEHICLE_SOUNDS, VEHICLE_SOUND_BANK, type VehicleBody, type VehicleBodyOptions, type VehicleColliders, type VehicleCollidersOptions, type VehicleDashboard, type VehicleHull, type VehicleLamps, type VehicleLod, type VehicleLodKit, type VehicleRainCovers, type VehicleSound, type VehicleSoundFrame, VehicleSoundKeys, type VehicleSoundOptions, type VehicleSoundReading, type WheelRoll, type WheelRollThree, type WindowId, type WindshieldMist, boxInertia, classColor, classify, convexFaces, createCabinSmoke, createCrashParts, createEngineBudget, createGearGuess, createHullPlanCache, createVehicleBody, createVehicleColliders, createVehicleDashboard, createVehicleLamps, createVehicleLod, createVehicleLodQueue, createVehicleRainCovers, createVehicleSound, createWheelRoll, createWindshieldMist, engineMix, firingHz, fuse, holdWithin, hullVolume, layerWeight, liteMaterials, liteMeshes, reducePoints, rpmShare, slideOfGrip, vehicleColliders, vehicleHulls, withoutPart };
|