@korial29/tiny-fps 0.204.2 → 0.205.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.
@@ -4,6 +4,7 @@ import type { Vec3 } from './mesh';
4
4
  import { solve } from './rig';
5
5
  import type { Pose, Quat } from './rig';
6
6
  import type { Out } from './verts';
7
+ import type { Pieces } from './store';
7
8
  export type Solved = ReturnType<typeof solve>;
8
9
  export interface Body {
9
10
  /** The own player's id, -1 before the first snapshot. */
@@ -26,8 +27,12 @@ export interface Body {
26
27
  readonly phase: number;
27
28
  /** The joints for a camera at `eye`; undefined without a player, or with the camera away from the body. */
28
29
  pose(eye: Vec3, yaw: number, pitch: number, roll?: number): Solved | undefined;
29
- /** Appends the body's vertices (see STRIDE) in the jacket `color`; nothing when pose() has none. */
30
- draw(out: Out, eye: Vec3, yaw: number, pitch: number, roll?: number, color?: number[]): void;
30
+ /**
31
+ * Appends the body's vertices (see STRIDE) in the jacket `color`; nothing when pose() has none.
32
+ * Its rigid pieces go to `pieces` when given (the Hunter's armour and harpoon): kept on the GPU,
33
+ * they carry their rest place, which their textures need, where the frame's vertices have none.
34
+ */
35
+ draw(out: Out, eye: Vec3, yaw: number, pitch: number, roll?: number, color?: number[], pieces?: Pieces): void;
31
36
  /** The own player's character (BUILD in rig.ts, PlayerInfo.body): the woman's arms are slimmer and her hands smaller, on the same grips; `tone` the skin he picked (the default's when absent). */
32
37
  wear(build: number, tone?: number[], ninja?: boolean, xeno?: boolean, hunter?: boolean): void;
33
38
  }
@@ -1,10 +1,17 @@
1
1
  import type { Vec3 } from './mesh';
2
2
  import type { Out } from './verts';
3
+ import type { Pieces } from './store';
3
4
  export declare function hunter(lod: 0 | 1 | 2): Record<string, number[]>;
4
5
  /** Model-space cut trail on the same scaled mount as the baked blades. */
5
6
  export declare const hunterWristEnds: () => Vec3[];
6
- /** Slide and stock travel in opposite directions as the compact back-mounted rifle opens. */
7
- export declare const drawHarpoon: (out: Out, lod: 0 | 1 | 2, at: Vec3, axes: Vec3[], scale: number, open: number, loaded?: boolean) => void;
7
+ /**
8
+ * Slide and stock travel in opposite directions as the compact back-mounted rifle opens. With
9
+ * `pieces`, its shell, slide and stock are kept on the GPU (store.ts) and only placed, so their
10
+ * brushed metal lies on their rest place; the bolt, shortened as it folds, stays in `out`.
11
+ */
12
+ export declare const drawHarpoon: (out: Out, lod: 0 | 1 | 2, at: Vec3, axes: Vec3[], scale: number, open: number, loaded?: boolean,
13
+ /** 0 just after a shot to 1: the next bolt slides forward from the stock into its seat. */
14
+ feed?: number, pieces?: Pieces) => void;
8
15
  export declare const hunterHarpoon: (lod: 0 | 1 | 2) => number[];
9
16
  /**
10
17
  * The Hunter's own rest skeleton in model space: the rig's joints on his 1.2 m stature, the arms
@@ -17,7 +17,18 @@ export declare const S: number, C: number;
17
17
  export declare const katana: (lod: number) => number[];
18
18
  /** Right wrist space: +x over the knuckles, -y along the fingers, z across the hand. */
19
19
  export declare const wristBlade: (lod: number) => number[];
20
- export declare const heldWrist: (out: Out, pos: Vec3, q: Quat, lod: number, k?: number, list?: Pieces) => void;
20
+ /** The time (s) the blades take to slide out of their housing when they are taken in hand. */
21
+ export declare const BLADE_EXTEND = 0.3;
22
+ /**
23
+ * The right wrist's housing at `pos`, turned as the forearm `q`: always on the bracer. Into `list`
24
+ * (kept on the GPU, its brushed metal holding still) when given.
25
+ */
26
+ export declare const wristHousing: (out: Out, pos: Vec3, q: Quat, lod: number, list?: Pieces) => void;
27
+ /**
28
+ * The two blades `out` of the housing by `extend` (0 in it, 1 out): they slide out of its nose,
29
+ * drawn along the fingers from a stub hidden under its crown to their full length.
30
+ */
31
+ export declare const wristBlades: (out: Out, pos: Vec3, q: Quat, lod: number, extend?: number, list?: Pieces) => void;
21
32
  export declare const wristEnds: (pos: Vec3, q: Quat) => Vec3[];
22
33
  /** Appends arcs of lightning flickering along the blade at the clock `t` (s): a few zigzags of thin crossed ribbons, each new every 70 ms. */
23
34
  export declare const arcs: (out: Out, at: Vec3, [r, u, f]: Vec3[], t: number, lod: number, k?: 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.2",
5
+ "version": "0.205.0",
6
6
  "type": "module",
7
7
  "files": [
8
8
  "dist"