@korial29/tiny-fps 0.147.1 → 0.147.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.
@@ -241,12 +241,14 @@ export declare const SCRATCHED: number[][];
241
241
  * the slope of the swell at rest (x, y, z), the normal at rest (x, y, z)], and per triangle its
242
242
  * colour, layer, whether it is a wall (its normal its own, flat) and its region (-1: a scratch).
243
243
  */
244
- interface Recipe {
244
+ export interface Recipe {
245
245
  c: number[];
246
246
  t: number[];
247
247
  /** The triangles each kind of wearer has (armor()'s `ninja`, astronaut and `bare` bits), listed on first use. */
248
248
  k?: Int32Array[];
249
249
  }
250
+ export declare const CORNER = 11;
251
+ export declare const TRI = 6;
250
252
  /**
251
253
  * Her breasts on the shell (the user, 2026-11-12: a uniform dome each, a little bigger): a round
252
254
  * dome each side, `h` out at its middle (x, y) and falling to nothing `r` away, smooth at its rim;
@@ -320,5 +322,7 @@ export declare const prepare: (s: Skin, fine: boolean) => Recipe;
320
322
  * plates' colour (their walls a shade darker): white when absent, the astronaut's, who has his own
321
323
  * details in his team's colour `accent` too. The `ninja` wears his own armour.
322
324
  */
325
+ /** The recipe on the skin `s` (`fine` or not) and the triangles of it a wearer has (armor()'s rules): its first numbers' indices. */
326
+ export declare const wornOf: (s: Skin, fine: boolean, ninja: boolean, astro: boolean, bare: boolean) => [Recipe, Int32Array];
323
327
  export declare const armor: (out: Out, from: number, s: Skin, fine?: boolean, plate?: number[], ninja?: boolean, accent?: number[], bare?: boolean) => void;
324
328
  export {};
@@ -0,0 +1,32 @@
1
+ import type { Skin } from './skin';
2
+ import type { Pieces } from './store';
3
+ import type { Quat } from './rig';
4
+ import type { Vec3 } from './mesh';
5
+ /** Texels a skin vertex takes (then its face's records, two each), a corner, an armour vertex. */
6
+ export declare const VERT: number, CORN: number, PLATE: number;
7
+ /**
8
+ * A skin's data, made once. A vertex: its place at rest and its weight, its normal and its shade,
9
+ * its two joints and where its face's records start and how many (each: the channel's shift of
10
+ * its place and of its normal, by channel). A corner: its vertex, its colour, the colour it fades
11
+ * to and how far.
12
+ */
13
+ export declare const skinOf: (s: Skin) => [number, number];
14
+ /**
15
+ * The armour armor() cuts out of the skin `s`, made once into `data`, its vertices of PLATE texels:
16
+ * [its skin triangle, its corner in its triangle, the triangle's kind, its layer], each corner's
17
+ * [weights, distance off the skin], its own swell slope and whether it is a scratch, its normal at
18
+ * rest, its colour. Each vertex carries its triangle's corners: a wall's normal is the triangle's.
19
+ */
20
+ export declare const armourOf: (s: Skin, fine: boolean, ninja: boolean, astro: boolean, bare: boolean) => [number, number];
21
+ /**
22
+ * Draws the skin `s` in the pose `pose` and, `plated`, the armour cut out of it, posed by the
23
+ * shader: into `list`, as skin() and armor() would into the frame's vertices.
24
+ */
25
+ export declare const flesh: (list: Pieces, s: Skin, pose: {
26
+ pos: Vec3[];
27
+ rot: Quat[];
28
+ }, colors: number[][], face: ArrayLike<number> | undefined, armour?: {
29
+ fine: boolean;
30
+ plate?: number[];
31
+ accent: number[];
32
+ }) => void;
@@ -3,6 +3,7 @@ import type { World } from '../shared/world';
3
3
  import type { Vec3 } from './mesh';
4
4
  import type { Quat } from './rig';
5
5
  import type { Out } from './verts';
6
+ import type { Pieces } from './store';
6
7
  /**
7
8
  * The back of the body and the muzzle, the tip of the nose, in model space (the tail and the front of
8
9
  * the emitter): the line through them is the gun's long axis, the way it points and the way the
@@ -222,6 +223,8 @@ export declare const scope: (n: number, shown?: boolean, nades?: number) => numb
222
223
  * one in use, then the two in reserve), its heat (0 to 1) and whether it overheated.
223
224
  */
224
225
  export interface Lit {
226
+ /** The frame's pieces of the store: the gun's body, lit, goes there (store.ts). */
227
+ list?: Pieces;
225
228
  light?: number;
226
229
  swap?: number;
227
230
  empty?: boolean;
@@ -254,7 +257,7 @@ export declare const cellsOf: (p: Pick<PlayerState, "rail" | "cap">) => number[]
254
257
  * given, and the charge gauge at `level`; its battery (capsule) where the swap has it, its glow and
255
258
  * its counter dimmed with `light`, and the spark only when it is all on.
256
259
  */
257
- export declare const held: (out: Out, pos: Vec3, q: Quat, lod: number, k?: number, ammo?: number, level?: number, kind?: boolean | number, t?: number, { light, swap, empty, screen, digits, cells, heat, hot, press, tune, nades, id, floor, vel, carry, }?: Lit) => void;
260
+ export declare const held: (out: Out, pos: Vec3, q: Quat, lod: number, k?: number, ammo?: number, level?: number, kind?: boolean | number, t?: number, { light, swap, empty, screen, digits, cells, heat, hot, press, tune, nades, id, floor, vel, carry, list, }?: Lit) => void;
258
261
  /** The muzzle of a gun (the rail gun's or the rifle's by `kind`) whose grip is at `at` and whose axes are [right, up, forward]. */
259
262
  export declare const tip: (at: Vec3, [, u, f]: Vec3[], kind?: boolean | number) => Vec3;
260
263
  /**
@@ -2,6 +2,7 @@ import type { PlayerState } from '../shared/types';
2
2
  import type { Vec3 } from './mesh';
3
3
  import type { Quat } from './rig';
4
4
  import type { Out } from './verts';
5
+ import type { Pieces } from './store';
5
6
  /** Where the blade starts and ends along the model's forward axis, metres from the right hand: a metre from the guard to the point. */
6
7
  export declare const BASE: number, TIP: number;
7
8
  /** The left hand grips this far behind the right one: a gap between the two fists. */
@@ -20,7 +21,9 @@ export declare const arcs: (out: Out, at: Vec3, [r, u, f]: Vec3[], t: number, lo
20
21
  * Appends the katana with its right-hand grip at `at`, axes `[right, up, forward]`, `k` times its
21
22
  * size; with the clock `t` (s) it crackles, once its glow is all on (`light`, 0 off to 1).
22
23
  */
23
- export declare const sword: (out: Out, at: Vec3, ax: Vec3[], lod: number, t?: number, k?: number, light?: number, press?: number) => void;
24
+ export declare const sword: (out: Out, at: Vec3, ax: Vec3[], lod: number, t?: number, k?: number, light?: number, press?: number,
25
+ /** The hand's turn and the frame's pieces: the blade, lit, is then made once into the store and placed there (store.ts). */
26
+ q?: Quat, list?: Pieces) => void;
24
27
  /** The sword's axes [right, up, forward] for a hand turned by `q` (see body.ts): the back of the hand to its right, the blade off the thumb toward the fingers. */
25
28
  export declare const axes: (q: Quat) => Vec3[];
26
29
  /** Where the fingers point for a sword with axes `ax`: the inverse of axes(). */
@@ -28,7 +31,7 @@ export declare const fingers: ([, u, f]: Vec3[]) => Vec3;
28
31
  /** The right and the left wrist for a sword with its right-hand grip at `at`: the left hand is BEHIND the right one, mirrored. */
29
32
  export declare const wrists: (at: Vec3, ax: Vec3[]) => Vec3[];
30
33
  /** Appends the katana held in the right hand at `pos` turned by `q`. */
31
- export declare const held: (out: Out, pos: Vec3, q: Quat, lod: number, t?: number, k?: number, light?: number, press?: number) => void;
34
+ export declare const held: (out: Out, pos: Vec3, q: Quat, lod: number, t?: number, k?: number, light?: number, press?: number, list?: Pieces) => void;
32
35
  /** The root of the blade and its point, in the world, for the hand at `pos` turned by `q`. */
33
36
  export declare const ends: (pos: Vec3, q: Quat) => Vec3[];
34
37
  /**
@@ -12,6 +12,8 @@ export declare const REGION: {
12
12
  STRIPE_LOW: number;
13
13
  BELT: number;
14
14
  };
15
+ /** The palette's colours that glow, unlit (the eyes' specks, a cut's face), and its size. */
16
+ export declare const UNLIT: number[], COLOURS: number;
15
17
  /** A hair colour for the runner `id`, picked at random from HAIRS but the same for everyone who sees him; his haircut (`c.hair`, look.ts) says whether he is shaved. */
16
18
  export declare const hairOf: (id: number, c?: Choice) => number[];
17
19
  /** The hair colour of the woman `id`: as hairOf(), never the shaved head's (her hair is a style of hair.ts). */
@@ -101,6 +103,16 @@ export declare const body: (lod: number, build?: number) => Skin;
101
103
  export declare const cut: (lod: number, limb: number, build?: number) => Skin[];
102
104
  /** A build's joints at rest (solve() of its rest pose), for what is placed on its body. */
103
105
  export declare const bindOf: (build?: number) => Vec3[];
106
+ /**
107
+ * The dual quaternions that carry the rest pose of the skin `s` to the pose, joint by joint and
108
+ * then its two swings (the shoulders'): eight numbers each, the rotation then its dual.
109
+ */
110
+ export declare const duals: (s: Skin, { pos, rot }: {
111
+ pos: Vec3[];
112
+ rot: Quat[];
113
+ }) => Float64Array<ArrayBuffer>;
114
+ /** The palette `colors` as the face `face` shows it: the line between the lips, the mouth's dark as the jaw opens, the teeth when the lips are drawn off them. */
115
+ export declare const mouthed: (colors: number[][], face?: ArrayLike<number>) => number[][];
104
116
  /**
105
117
  * Appends the skin in the pose `solved` (see solve()) to `out` as triangles in the renderer's
106
118
  * vertex format, each in its palette colour: a vertex goes where the two joints it hangs on would
@@ -6,13 +6,35 @@ export interface Mesh {
6
6
  first: number;
7
7
  count: number;
8
8
  }
9
- /** One piece drawn: `m` turned by `q`, scaled by `k`, moved to `t`. */
9
+ /** One piece drawn: `m` turned by `q`, scaled by `k`, moved to `t`; or, with `f`, flesh posed by the shader. */
10
10
  export interface Draw {
11
11
  m: Mesh;
12
12
  q: Quat;
13
13
  t: Vec3;
14
14
  k: number;
15
+ f?: Flesh;
15
16
  }
17
+ /**
18
+ * A runner's skin (`kind` 1) or armour (2) posed by the vertex shader from `data` (flesh.ts): the
19
+ * texels of the skin's vertices, of the drawn vertices and of the skin's corners; the joints' dual
20
+ * quaternions (eight numbers each), the palette, the face's weights; the plates' colour (absent:
21
+ * not coloured) and the accent.
22
+ */
23
+ export interface Flesh {
24
+ kind: number;
25
+ at: [number, number, number];
26
+ d: Float32Array;
27
+ pal: Float32Array;
28
+ face: Float32Array;
29
+ plate?: number[];
30
+ accent?: number[];
31
+ }
32
+ /** What the vertex shader reads by texel (flesh.ts): four floats each, 2048 a row. */
33
+ export declare let data: Float32Array<ArrayBuffer>;
34
+ /** The floats of `data` written: a renderer uploads what it has not yet. */
35
+ export declare let used: number;
36
+ /** Appends `v` to `data`, from a new texel on, and gives that texel's index. */
37
+ export declare const texels: (v: ArrayLike<number>) => number;
16
38
  /** Every piece's vertices one after the other, in the renderer's vertex format: what the GPU gets. */
17
39
  export declare let stored: Float32Array<ArrayBuffer>;
18
40
  /** The floats of `stored` written: a renderer uploads what it has not yet. */
@@ -1,6 +1,7 @@
1
1
  import type { WorldDef } from '../shared/world';
2
2
  import type { Vec3 } from './mesh';
3
3
  import type { Out } from './verts';
4
+ import type { Pieces } from './store';
4
5
  /** Cars on the roads round the play area, and on the rest of the grid out to MARKS, fewer to the kilometre. */
5
6
  export declare const CARS = 64;
6
7
  export declare const FAR_CARS = 160;
@@ -43,4 +44,4 @@ export declare const MODEL: {
43
44
  * The drawer of a world's traffic: appends the cars in view (in front of the camera, within FAR) at
44
45
  * time t, each BODY + CABIN + LAMPS vertices, the cabin only up to NEAR_CAR and the lamps up to LIT.
45
46
  */
46
- export declare const traffic: (def: WorldDef) => (out: Out, eye: Vec3, fwd: Vec3, t: number) => void;
47
+ export declare const traffic: (def: WorldDef) => (out: Out, eye: Vec3, fwd: Vec3, t: number, pieces?: Pieces) => void;
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.147.1",
5
+ "version": "0.147.3",
6
6
  "type": "module",
7
7
  "files": [
8
8
  "dist"