@korial29/tiny-fps 0.147.2 → 0.147.4
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,36 @@
|
|
|
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
|
+
* Where the skin `s` is in `data`, made once: its vertices and its corners (a corner: its vertex, its
|
|
9
|
+
* colour, the colour it fades to and how far). With `hood`, the ninja's (build and face): dress() at
|
|
10
|
+
* rest on the skin his face's traits have shaped, its pressed places taken as the rest's, and only
|
|
11
|
+
* the face's expressions left for the shader, none under the guard (hidden there, and the jaw would
|
|
12
|
+
* push the face through it).
|
|
13
|
+
*/
|
|
14
|
+
export declare const skinOf: (s: Skin, hood?: [number, ArrayLike<number>]) => [number, number];
|
|
15
|
+
/**
|
|
16
|
+
* The armour armor() cuts out of the skin `s`, made once into `data`, its vertices of PLATE texels:
|
|
17
|
+
* [its skin triangle, its corner in its triangle, the triangle's kind, its layer], each corner's
|
|
18
|
+
* [weights, distance off the skin], its own swell slope and whether it is a scratch, its normal at
|
|
19
|
+
* rest, its colour. Each vertex carries its triangle's corners: a wall's normal is the triangle's.
|
|
20
|
+
*/
|
|
21
|
+
export declare const armourOf: (s: Skin, fine: boolean, ninja: boolean, astro: boolean, bare: boolean) => [number, number];
|
|
22
|
+
/**
|
|
23
|
+
* Draws the skin `s` in the pose `pose` and, with `armour`, the armour cut out of it, posed by the
|
|
24
|
+
* shader: into `list`, as skin(), dress() (`hood`: the ninja's build) and armor() would into the
|
|
25
|
+
* frame's vertices.
|
|
26
|
+
*/
|
|
27
|
+
export declare const flesh: (list: Pieces, s: Skin, pose: {
|
|
28
|
+
pos: Vec3[];
|
|
29
|
+
rot: Quat[];
|
|
30
|
+
}, colors: number[][], face: ArrayLike<number> | undefined, armour?: {
|
|
31
|
+
fine: boolean;
|
|
32
|
+
plate?: number[];
|
|
33
|
+
accent: number[];
|
|
34
|
+
ninja?: boolean;
|
|
35
|
+
bare?: boolean;
|
|
36
|
+
}, hood?: number) => void;
|
|
@@ -22,6 +22,8 @@ export declare const MOUTH: {
|
|
|
22
22
|
* the face under the guard pressed in behind it.
|
|
23
23
|
*/
|
|
24
24
|
export declare const dress: (out: Out, from: number, s: Skin, at: Vec3, q: Quat, build?: number) => void;
|
|
25
|
+
/** What the last dress() made of each of the `n` vertices of its skin: its bare share (-1: none), where it was pressed in (NaN: not). */
|
|
26
|
+
export declare const dressedOf: (n: number) => [Float64Array, Float64Array];
|
|
25
27
|
/** Appends the guard and the ideograms on the head joint at `at` turned by `q` (see solve()), on the woman's smaller head with `build`, in the team's `color`. */
|
|
26
28
|
export declare const mask: (out: Out, at: Vec3, q: Quat, build?: number, color?: number[],
|
|
27
29
|
/** A far runner's: fewer quads. */
|
|
@@ -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,19 +6,41 @@ 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. */
|
|
19
41
|
export declare let filled: number;
|
|
20
42
|
/** The piece `key`, made by `make` (into an empty array, at the origin) the first time it is asked for. */
|
|
21
|
-
export declare const mesh: (key: string, make: (out:
|
|
43
|
+
export declare const mesh: (key: string, make: (out: Out) => void) => Mesh;
|
|
22
44
|
/** The frame's pieces, drawn after its other vertices. */
|
|
23
45
|
export type Pieces = Draw[];
|
|
24
46
|
/** The turn and the place of no move: a rigid piece made with them is at the origin. */
|
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.
|
|
5
|
+
"version": "0.147.4",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist"
|