@korial29/tiny-fps 0.158.0 → 0.160.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.
- package/dist/index.js +67 -34
- package/dist/types/client/hair.d.ts +14 -2
- package/dist/types/client/mesh.d.ts +13 -0
- package/dist/types/client/skin.d.ts +1 -0
- package/dist/types/client/store.d.ts +14 -3
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Quat } from './rig';
|
|
2
2
|
import type { Vec3 } from './mesh';
|
|
3
3
|
import type { Out } from './verts';
|
|
4
|
+
import type { Pieces } from './store';
|
|
4
5
|
export declare const STYLE: {
|
|
5
6
|
readonly PONYTAIL: 0;
|
|
6
7
|
readonly BOB: 1;
|
|
@@ -15,6 +16,8 @@ export declare const styleOf: (id: number, c?: {
|
|
|
15
16
|
}) => number;
|
|
16
17
|
/** The woman's head to the man's (SCALE in skin.ts), and the lowest a style may hang on the man's head at rest, metres: the chin's height. */
|
|
17
18
|
export declare const HEAD_SCALE: number, LOWEST: number;
|
|
19
|
+
/** The cards of `style`, made once. */
|
|
20
|
+
export declare const cardsOf: (style: number) => Float32Array<ArrayBufferLike>;
|
|
18
21
|
/** The style's rest mesh (make()), built once per style and fineness. */
|
|
19
22
|
export declare const tress: (style: number, fine: boolean) => Float32Array<ArrayBufferLike>;
|
|
20
23
|
/**
|
|
@@ -23,8 +26,17 @@ export declare const tress: (style: number, fine: boolean) => Float32Array<Array
|
|
|
23
26
|
* a breath when she stands (`t` seconds).
|
|
24
27
|
*/
|
|
25
28
|
export declare const sway: (phase: number, speed: number, t: number) => Vec3;
|
|
29
|
+
/**
|
|
30
|
+
* The hair of `style` seen close, at rest in the head's frame, in the store's vertex format with,
|
|
31
|
+
* in place of a colour, how light, how free (swayOf()), the layer and a phase: first the shell,
|
|
32
|
+
* drawn in a little and dark, the cards' underlayer (it fills what they leave, a phase of -1: it
|
|
33
|
+
* only swings), then the cards (makeCards()). The store keeps it (hair()), and so does the CPU.
|
|
34
|
+
*/
|
|
35
|
+
export declare const closeOf: (style: number) => Float32Array<ArrayBufferLike>;
|
|
26
36
|
/**
|
|
27
37
|
* Appends the hair `style` in `rgb` on the woman's head joint at `at` turned by `q` (see solve()),
|
|
28
|
-
* at level of detail `lod` (0 far), its loose end moved by `swing` (sway()).
|
|
38
|
+
* at level of detail `lod` (0 far), its loose end moved by `swing` (sway()). Close (`lod` 3) it is
|
|
39
|
+
* strands (closeOf()): into `gpu`, the frame's pieces, when given, the shader swaying them at the
|
|
40
|
+
* time `time`; else into `out`, swayed here the same way.
|
|
29
41
|
*/
|
|
30
|
-
export declare const hair: (out: Out, at: Vec3, q: Quat, style: number, rgb: number[], lod: number, swing?: Vec3) => void;
|
|
42
|
+
export declare const hair: (out: Out, at: Vec3, q: Quat, style: number, rgb: number[], lod: number, swing?: Vec3, time?: number, gpu?: Pieces) => void;
|
|
@@ -27,6 +27,19 @@ export declare const GLOSS = -1.12;
|
|
|
27
27
|
* tinted, turned yellow olive under a blue sky).
|
|
28
28
|
*/
|
|
29
29
|
export declare const GILT = -1.42;
|
|
30
|
+
/**
|
|
31
|
+
* Hair: a band of layers from HAIR_ROOT (the root) to HAIR_ROOT - HAIR_SPAN (the tip), how far along
|
|
32
|
+
* its strand a point is: the shader takes the strand's way from the band's gradient (Kajiya-Kay
|
|
33
|
+
* highlights, streaks). Lit like -1 but for its own highlights.
|
|
34
|
+
*/
|
|
35
|
+
export declare const HAIR_ROOT: number, HAIR_SPAN: number;
|
|
36
|
+
/**
|
|
37
|
+
* The strand cards of close hair (hair.ts): CARD_BASE - CARD_STEP * (card + across), across 0 to 1
|
|
38
|
+
* over the card, the card's id under 280 (below 100 the dense base, below 200 a clump, then a
|
|
39
|
+
* flyaway), a band no other layer of the shader takes. The shader cuts it into thin strands, alpha
|
|
40
|
+
* to coverage, and the depth passes leave it out.
|
|
41
|
+
*/
|
|
42
|
+
export declare const CARD_BASE: number, CARD_STEP: number;
|
|
30
43
|
/**
|
|
31
44
|
* Camera axes [right, up, forward]: forward is (-sin yaw cos pitch, sin pitch, -cos yaw cos pitch),
|
|
32
45
|
* y up at roll 0. A positive roll leans the camera right: up tilts toward right.
|
|
@@ -11,6 +11,7 @@ export declare const REGION: {
|
|
|
11
11
|
STRIPE: number;
|
|
12
12
|
STRIPE_LOW: number;
|
|
13
13
|
BELT: number;
|
|
14
|
+
HAIR: number;
|
|
14
15
|
};
|
|
15
16
|
/** The palette's colours that glow, unlit (the eyes' specks, a cut's face), and its size. */
|
|
16
17
|
export declare const UNLIT: number[], COLOURS: number;
|
|
@@ -13,6 +13,14 @@ export interface Draw {
|
|
|
13
13
|
t: Vec3;
|
|
14
14
|
k: number;
|
|
15
15
|
f?: Flesh;
|
|
16
|
+
/** Worn: armour, which the shader scuffs (grime, chipped paint, scratches) on its glossy and gold parts. */
|
|
17
|
+
w?: boolean;
|
|
18
|
+
/** Close hair (hair.ts), coloured `rgb`, swung by `sw` in the head's frame at the time `t`: the shader sways it (swayOf()). */
|
|
19
|
+
h?: {
|
|
20
|
+
rgb: number[];
|
|
21
|
+
sw: Vec3;
|
|
22
|
+
t: number;
|
|
23
|
+
};
|
|
16
24
|
}
|
|
17
25
|
/**
|
|
18
26
|
* A runner's skin (`kind` 1) or armour (2) posed by the vertex shader from `data` (flesh.ts): the
|
|
@@ -47,7 +55,10 @@ export type Pieces = Draw[];
|
|
|
47
55
|
export declare const ID: Quat;
|
|
48
56
|
export declare const ORIGIN: Vec3;
|
|
49
57
|
/**
|
|
50
|
-
*
|
|
51
|
-
*
|
|
58
|
+
* How far the hair vertex at `v[i]` (closeOf() in hair.ts: its normal at 3, how free at 7, its
|
|
59
|
+
* phase at 9) moves in the head's frame at the time `t`, swung by `sw` (sway()): a share of the
|
|
60
|
+
* swing, and a flutter of its own on its phase, out from the head too; a phase of -1 only swings.
|
|
61
|
+
* The scene's vertex shader does the same sums (mode 3).
|
|
52
62
|
*/
|
|
53
|
-
export declare const
|
|
63
|
+
export declare const swayOf: (v: ArrayLike<number>, i: number, t: number, sw: ArrayLike<number>) => number[];
|
|
64
|
+
export declare const expand: (out: Out, { m, q, t, k, h: hair }: Draw) => 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.
|
|
5
|
+
"version": "0.160.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist"
|