@korial29/tiny-fps 0.204.1 → 0.204.3

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.
@@ -6,3 +6,52 @@ export declare const hunterWristEnds: () => Vec3[];
6
6
  /** Slide and stock travel in opposite directions as the compact back-mounted rifle opens. */
7
7
  export declare const drawHarpoon: (out: Out, lod: 0 | 1 | 2, at: Vec3, axes: Vec3[], scale: number, open: number, loaded?: boolean) => void;
8
8
  export declare const hunterHarpoon: (lod: 0 | 1 | 2) => number[];
9
+ /**
10
+ * The Hunter's own rest skeleton in model space: the rig's joints on his 1.2 m stature, the arms
11
+ * where the sculpted sleeves hang (wider than the rig's) and the neck under the lowered mask.
12
+ * Rest rotations are the identity, so a joint's rest frame is this point alone.
13
+ */
14
+ export declare const HUNTER_REST: Vec3[];
15
+ /** A rigid Hunter piece: the vertices that follow `joint`, in that joint's rest frame. */
16
+ export interface HunterPiece {
17
+ joint: number;
18
+ /** Too fine for a shadow (the temple optics and the rangefinder). */
19
+ thin: boolean;
20
+ /** The harpoon on his back, left out while it is in his hand. */
21
+ harpoon: boolean;
22
+ vertices: number[];
23
+ }
24
+ /**
25
+ * The triangles around a bending joint, blended between the parent bone `a` and the child `b`
26
+ * (`w`: each vertex's share of `b`) so the knee, ankle, hip and elbow do not open as they bend.
27
+ * Vertices in model space at rest.
28
+ */
29
+ export interface HunterBand {
30
+ a: number;
31
+ b: number;
32
+ vertices: Float32Array;
33
+ w: Float32Array;
34
+ }
35
+ /** The Hunter's rigid pieces and, near, his blended joint bands. */
36
+ export interface HunterRig {
37
+ pieces: HunterPiece[];
38
+ bands: HunterBand[];
39
+ }
40
+ /**
41
+ * The Hunter cut into rigid pieces, one per joint (and shadow flag, and the stowed harpoon), so the runner's animated
42
+ * skeleton can carry him: each triangle goes to the nearest bone its part may follow. Above the
43
+ * far level, the triangles across a bend go to a blended band instead (BENDS).
44
+ * `skip` leaves out parts (the far level's quills and grille).
45
+ */
46
+ export declare const hunterRig: (lod: 0 | 1 | 2, skip?: (name: string) => boolean) => HunterRig;
47
+ /**
48
+ * Where the Hunter's joints stand in the posed runner `pos`/`rot` (solve()): his own bones
49
+ * (HUNTER_REST) turned as the runner's, from a pelvis that moves as the runner's scaled to his
50
+ * stature. `at` is the runner's feet and `yaw` his heading.
51
+ */
52
+ export declare const hunterPose: (pos: Vec3[], rot: [number, number, number, number][], at: Vec3, yaw: number, out?: Vec3[]) => Vec3[];
53
+ /**
54
+ * Draws a blended band (HunterBand) on the Hunter's posed joints (hunterPose()) and the runner's
55
+ * rotations: each vertex placed by both bones and mixed by its share, its normal likewise.
56
+ */
57
+ export declare const blendHunter: (out: Out, band: HunterBand, joints: Vec3[], rot: [number, number, number, number][]) => void;
@@ -5,6 +5,7 @@ import type { Gait } from './gait';
5
5
  import type { Vec3 } from './mesh';
6
6
  import { solve } from './rig';
7
7
  import type { Quat } from './rig';
8
+ import type { Skin } from './skin';
8
9
  import type { Out } from './verts';
9
10
  /** How closed the hand of an arm cut off is (hand() in body.ts). */
10
11
  export declare const LIMP = 0.35;
@@ -57,8 +58,15 @@ export declare const track: (r: {
57
58
  /** The skeleton as last drawn, which the limb leaves from: the gait's pose without it. */
58
59
  s?: ReturnType<typeof solve>;
59
60
  }, dt: number, floor: Ground, fresh: boolean, tracer?: Pick<Tracer, "shock" | "spit">) => void;
61
+ /**
62
+ * The skeleton the piece is skinned with, where it lies now: the pose of the cut carried by the
63
+ * piece's own turn and place, sunk by `sink`. Skinned with it, the limb lands where piece() moves
64
+ * the limb skinned in the pose of the cut (dual quaternions follow a turn of all their joints).
65
+ */
66
+ export declare const placed: (c: Piece, sink: number) => ReturnType<typeof solve>;
60
67
  /**
61
68
  * Appends the piece at level of detail `lod`, in `colors` (see palette()), sunk by `sink` metres with
62
- * the body; an arm with its hand, limp, in a space suit's glove on `suit`.
69
+ * the body; an arm with its hand, limp, in a space suit's glove on `suit`. With `gpu`, its skin goes
70
+ * there, in the skeleton where it lies (posed by the shader, flesh.ts), and the hand to `out`.
63
71
  */
64
- export declare const piece: (out: Out, c: Piece, colors: number[][], lod: number, sink: number, face?: ArrayLike<number>, suit?: boolean) => void;
72
+ export declare const piece: (out: Out, c: Piece, colors: number[][], lod: number, sink: number, face?: ArrayLike<number>, suit?: boolean, gpu?: (limb: Skin, at: ReturnType<typeof solve>) => void) => void;
@@ -146,6 +146,15 @@ export declare const duals: (s: Skin, { pos, rot }: {
146
146
  pos: Vec3[];
147
147
  rot: Quat[];
148
148
  }) => Float64Array<ArrayBuffer>;
149
+ /**
150
+ * Where skin() puts the middle of the cut face of a skin cut() made, in the pose `pose`: its last
151
+ * vertex, which hangs on one joint alone (sever()). The shader draws the skin, so nothing on the
152
+ * CPU reads it back from the frame.
153
+ */
154
+ export declare const capOf: (s: Skin, { pos, rot }: {
155
+ pos: Vec3[];
156
+ rot: Quat[];
157
+ }) => Vec3;
149
158
  /** The palette `colors` as the face `face` shows it: the line between the lips dark as the mouth opens (the teeth are pieces of their own, close). */
150
159
  export declare const mouthed: (colors: number[][], face?: ArrayLike<number>) => number[][];
151
160
  /**
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@korial29/tiny-fps",
3
3
  "description": "Tiny multiplayer first-person rooftop game for the browser: raw WebGL, zero runtime dependencies, WebSocket or same-browser multi-tab play.",
4
4
  "license": "Apache-2.0",
5
- "version": "0.204.1",
5
+ "version": "0.204.3",
6
6
  "type": "module",
7
7
  "files": [
8
8
  "dist"