@korial29/tiny-fps 0.147.2 → 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.
- package/dist/index.js +45 -17
- package/dist/types/client/armor.d.ts +5 -1
- package/dist/types/client/flesh.d.ts +32 -0
- package/dist/types/client/skin.d.ts +12 -0
- package/dist/types/client/store.d.ts +23 -1
- package/package.json +1 -1
|
@@ -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;
|
|
@@ -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. */
|
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.3",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist"
|