@korial29/tiny-fps 0.147.0 → 0.147.2
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 +15 -14
- package/dist/types/client/gun.d.ts +4 -1
- package/dist/types/client/katana.d.ts +5 -2
- package/dist/types/client/pads.d.ts +4 -1
- package/dist/types/client/soldier.d.ts +8 -5
- package/dist/types/client/store.d.ts +31 -0
- package/dist/types/client/traffic.d.ts +2 -1
- package/package.json +1 -1
|
@@ -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
|
|
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
|
/**
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Vec3 } from './mesh';
|
|
2
2
|
import type { Quat } from './rig';
|
|
3
|
+
import type { Pieces } from './store';
|
|
3
4
|
import type { Out } from './verts';
|
|
4
5
|
/**
|
|
5
6
|
* A lame, from the arm's joint at rest (metres, +x out): where it starts and ends across, its half
|
|
@@ -84,4 +85,6 @@ export declare const pads: (out: Out, s: {
|
|
|
84
85
|
rot: Quat[];
|
|
85
86
|
}, build?: number, color?: number[], marine?: boolean, band?: number[],
|
|
86
87
|
/** A far runner's: fewer quads. */
|
|
87
|
-
far?: boolean
|
|
88
|
+
far?: boolean,
|
|
89
|
+
/** The frame's pieces of the store: each pad and the collar go there, built once (store.ts). */
|
|
90
|
+
list?: Pieces) => void;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { Choice, PlayerState, Rover } from '../shared/types';
|
|
2
2
|
import type { World } from '../shared/world';
|
|
3
3
|
import type { Gait, Seat } from './gait';
|
|
4
|
+
import type { Pieces } from './store';
|
|
4
5
|
import type { Tracer } from './beams';
|
|
5
6
|
import type { Piece } from './limbs';
|
|
6
7
|
import type { Vec3 } from './mesh';
|
|
7
|
-
import type { Pose } from './rig';
|
|
8
|
+
import type { Pose, Quat } from './rig';
|
|
8
9
|
import type { Face } from './expression';
|
|
9
10
|
import type { Trail } from './trail';
|
|
10
11
|
import type { Out } from './verts';
|
|
@@ -127,7 +128,7 @@ export declare const dissolve: (out: Out, from: number, k: number) => void;
|
|
|
127
128
|
export declare const stance: (r: Runner) => {
|
|
128
129
|
s: {
|
|
129
130
|
pos: Vec3[];
|
|
130
|
-
rot:
|
|
131
|
+
rot: Quat[];
|
|
131
132
|
};
|
|
132
133
|
sink: number;
|
|
133
134
|
yaw: number;
|
|
@@ -135,14 +136,16 @@ export declare const stance: (r: Runner) => {
|
|
|
135
136
|
} | {
|
|
136
137
|
s: {
|
|
137
138
|
pos: Vec3[];
|
|
138
|
-
rot:
|
|
139
|
+
rot: Quat[];
|
|
139
140
|
};
|
|
140
141
|
sink: number;
|
|
141
142
|
yaw: number;
|
|
142
143
|
carry: [Vec3, Vec3[]] | undefined;
|
|
143
144
|
};
|
|
144
145
|
/** Draws the runner and gives back its solved skeleton, or nothing once a bolt has burnt it away. */
|
|
145
|
-
export declare const soldier: (out: Out, r: Runner, color: number[], lod?: number, helmets?: boolean, armored?: boolean
|
|
146
|
+
export declare const soldier: (out: Out, r: Runner, color: number[], lod?: number, helmets?: boolean, armored?: boolean,
|
|
147
|
+
/** The frame's pieces of the store: the rigid ones go there (store.ts), but on one coming apart. */
|
|
148
|
+
list?: Pieces) => {
|
|
146
149
|
pos: Vec3[];
|
|
147
|
-
rot:
|
|
150
|
+
rot: Quat[];
|
|
148
151
|
} | undefined;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Vec3 } from './mesh';
|
|
2
|
+
import type { Quat } from './rig';
|
|
3
|
+
import type { Out } from './verts';
|
|
4
|
+
/** A piece built once: where its vertices start in the store and how many there are. */
|
|
5
|
+
export interface Mesh {
|
|
6
|
+
first: number;
|
|
7
|
+
count: number;
|
|
8
|
+
}
|
|
9
|
+
/** One piece drawn: `m` turned by `q`, scaled by `k`, moved to `t`. */
|
|
10
|
+
export interface Draw {
|
|
11
|
+
m: Mesh;
|
|
12
|
+
q: Quat;
|
|
13
|
+
t: Vec3;
|
|
14
|
+
k: number;
|
|
15
|
+
}
|
|
16
|
+
/** Every piece's vertices one after the other, in the renderer's vertex format: what the GPU gets. */
|
|
17
|
+
export declare let stored: Float32Array<ArrayBuffer>;
|
|
18
|
+
/** The floats of `stored` written: a renderer uploads what it has not yet. */
|
|
19
|
+
export declare let filled: number;
|
|
20
|
+
/** 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: number[]) => void) => Mesh;
|
|
22
|
+
/** The frame's pieces, drawn after its other vertices. */
|
|
23
|
+
export type Pieces = Draw[];
|
|
24
|
+
/** The turn and the place of no move: a rigid piece made with them is at the origin. */
|
|
25
|
+
export declare const ID: Quat;
|
|
26
|
+
export declare const ORIGIN: Vec3;
|
|
27
|
+
/**
|
|
28
|
+
* Appends the vertices of a drawn piece to `out` as the vertex shader places them (the tests'
|
|
29
|
+
* eyes): position turned and scaled then moved, normal turned, colour as is.
|
|
30
|
+
*/
|
|
31
|
+
export declare const expand: (out: Out, { m, q, t, k }: Draw) => void;
|
|
@@ -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.
|
|
5
|
+
"version": "0.147.2",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist"
|