@korial29/tiny-fps 1.8.0 → 1.9.1
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/cast-art-DbwsToaQ.js +1 -0
- package/dist/index.js +8 -7
- package/dist/landfall-CSZGx2iA.js +21 -0
- package/dist/types/client/armor/clip.d.ts +22 -0
- package/dist/types/client/armor/cooking.d.ts +14 -0
- package/dist/types/client/armor/details.d.ts +65 -0
- package/dist/types/client/armor/fit.d.ts +8 -0
- package/dist/types/client/armor/regions.d.ts +304 -0
- package/dist/types/client/armor/scratches.d.ts +4 -0
- package/dist/types/client/armor/shell.d.ts +46 -0
- package/dist/types/client/armor/types.d.ts +37 -0
- package/dist/types/client/armor/wear.d.ts +22 -0
- package/dist/types/client/armor.d.ts +9 -393
- package/dist/types/client/body/constants.d.ts +35 -0
- package/dist/types/client/body/create.d.ts +3 -0
- package/dist/types/client/body/fingers.d.ts +112 -0
- package/dist/types/client/body/glove.d.ts +27 -0
- package/dist/types/client/body/hands.d.ts +28 -0
- package/dist/types/client/body/hunter.d.ts +26 -0
- package/dist/types/client/body/motion.d.ts +42 -0
- package/dist/types/client/body/reach.d.ts +65 -0
- package/dist/types/client/body/types.d.ts +39 -0
- package/dist/types/client/body/wield.d.ts +30 -0
- package/dist/types/client/body.d.ts +10 -207
- package/dist/types/client/cast-art.d.ts +2 -0
- package/dist/types/client/gait/constants.d.ts +34 -0
- package/dist/types/client/gait/create.d.ts +3 -0
- package/dist/types/client/gait/fists.d.ts +55 -0
- package/dist/types/client/gait/maths.d.ts +38 -0
- package/dist/types/client/gait/moves.d.ts +129 -0
- package/dist/types/client/gait/types.d.ts +59 -0
- package/dist/types/client/gait.d.ts +6 -146
- package/dist/types/client/gun/ammo.d.ts +21 -0
- package/dist/types/client/gun/display.d.ts +32 -0
- package/dist/types/client/gun/held.d.ts +75 -0
- package/dist/types/client/gun/kinds.d.ts +12 -0
- package/dist/types/client/gun/loft.d.ts +16 -0
- package/dist/types/client/gun/paint.d.ts +30 -0
- package/dist/types/client/gun/railgun.d.ts +34 -0
- package/dist/types/client/gun/reload.d.ts +112 -0
- package/dist/types/client/gun/rifle.d.ts +54 -0
- package/dist/types/client/gun/sidearm.d.ts +32 -0
- package/dist/types/client/gun.d.ts +10 -308
- package/dist/types/client/hulk/cabin.d.ts +36 -0
- package/dist/types/client/hulk/common.d.ts +55 -0
- package/dist/types/client/hulk/debris.d.ts +16 -0
- package/dist/types/client/hulk/hull.d.ts +81 -0
- package/dist/types/client/hulk/inside.d.ts +5 -0
- package/dist/types/client/hulk/parts.d.ts +16 -0
- package/dist/types/client/hulk/types.d.ts +7 -0
- package/dist/types/client/hulk/wings.d.ts +4 -0
- package/dist/types/client/hulk.d.ts +8 -18
- package/dist/types/client/hunter/animation.d.ts +113 -0
- package/dist/types/client/hunter/constants.d.ts +53 -0
- package/dist/types/client/hunter/disc.d.ts +33 -0
- package/dist/types/client/hunter/harpoon.d.ts +68 -0
- package/dist/types/client/hunter/marine.d.ts +14 -0
- package/dist/types/client/hunter/model.d.ts +4 -0
- package/dist/types/client/hunter/rest.d.ts +7 -0
- package/dist/types/client/hunter.d.ts +7 -164
- package/dist/types/client/render/camera.d.ts +58 -0
- package/dist/types/client/render/constants.d.ts +63 -0
- package/dist/types/client/render/scene.d.ts +58 -0
- package/dist/types/client/render/shader.d.ts +69 -0
- package/dist/types/client/render/shots.d.ts +61 -0
- package/dist/types/client/render/types.d.ts +74 -0
- package/dist/types/client/render.d.ts +9 -277
- package/dist/types/client/sfx/air.d.ts +46 -0
- package/dist/types/client/sfx/anthem.d.ts +27 -0
- package/dist/types/client/sfx/layers.d.ts +6 -0
- package/dist/types/client/sfx/music.d.ts +96 -0
- package/dist/types/client/sfx/render.d.ts +10 -0
- package/dist/types/client/sfx/sounds.d.ts +180 -0
- package/dist/types/client/sfx/synth.d.ts +24 -0
- package/dist/types/client/sfx/voices.d.ts +59 -0
- package/dist/types/client/sfx.d.ts +8 -325
- package/dist/types/client/skin/head.d.ts +120 -0
- package/dist/types/client/skin/lofts.d.ts +145 -0
- package/dist/types/client/skin/pose.d.ts +102 -0
- package/dist/types/client/skin/shape.d.ts +2 -0
- package/dist/types/client/skin.d.ts +4 -179
- package/dist/types/client/soldier/animate.d.ts +12 -0
- package/dist/types/client/soldier/carry.d.ts +28 -0
- package/dist/types/client/soldier/common.d.ts +8 -0
- package/dist/types/client/soldier/draw.d.ts +12 -0
- package/dist/types/client/soldier/grasp.d.ts +28 -0
- package/dist/types/client/soldier/hunter.d.ts +38 -0
- package/dist/types/client/soldier/runner.d.ts +58 -0
- package/dist/types/client/soldier/stance.d.ts +20 -0
- package/dist/types/client/soldier/types.d.ts +107 -0
- package/dist/types/client/soldier.d.ts +9 -236
- package/dist/types/client/xeno/back.d.ts +113 -0
- package/dist/types/client/xeno/body.d.ts +63 -0
- package/dist/types/client/xeno/common.d.ts +28 -0
- package/dist/types/client/xeno/head.d.ts +109 -0
- package/dist/types/client/xeno/limbs.d.ts +62 -0
- package/dist/types/client/xeno/mouth.d.ts +23 -0
- package/dist/types/client/xeno/parts.d.ts +40 -0
- package/dist/types/client/xeno/tail.d.ts +107 -0
- package/dist/types/client/xeno.d.ts +8 -246
- package/package.json +1 -1
- package/dist/landfall-CXJnap8w.js +0 -21
|
@@ -1,278 +1,10 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import type { Out } from './verts';
|
|
10
|
-
/** Tints a world can use at once, white included (see palette). */
|
|
11
|
-
export declare const MAX_TINTS = 16;
|
|
12
|
-
/** Shadow map side in texels. */
|
|
13
|
-
export declare const SHADOW = 1024;
|
|
14
|
-
/** Metres the sun's shadow window spans on a side: 9 cm a texel. */
|
|
15
|
-
export declare const SUN_AREA = 96;
|
|
16
|
-
/**
|
|
17
|
-
* Metres the window's middle is ahead of the eye, along the look on the ground: what is behind the
|
|
18
|
-
* camera needs little of it. It reaches 19 m behind the eye and 77 m ahead: a rover at 20 m/s seen
|
|
19
|
-
* from a chase camera keeps its shadow, and those of the hills it drives at, for 4 s ahead.
|
|
20
|
-
*/
|
|
21
|
-
export declare const SUN_AHEAD = 29;
|
|
22
|
-
/** Half the depth range of the sun's window, metres: what stands this far from the eye along the sun's direction still casts. */
|
|
23
|
-
export declare const SUN_DEPTH = 100;
|
|
24
|
-
/** How far the fog colour is pulled toward the sky's horizon, 0 to 1: a fog unlike the horizon draws an edge against the sky. */
|
|
25
|
-
export declare const HAZE = 0.6;
|
|
26
|
-
/**
|
|
27
|
-
* The height fog: besides the haze at the density of the world's fog, a layer of FOG_LAYER times that
|
|
28
|
-
* density at the lowest roof, which grows by e every 1 / FOG_RISE metres down: 2 % more at the roofs,
|
|
29
|
-
* about three times the haze on the street 94 m under them.
|
|
30
|
-
*/
|
|
31
|
-
export declare const FOG_LAYER = 0.02;
|
|
32
|
-
export declare const FOG_RISE = 0.05;
|
|
33
|
-
/** The bound on the fog's climb (FOG_RISE times the height between the eye and the point): a kilometre up or down, and exp() of it stays finite in float32. */
|
|
34
|
-
export declare const FOG_CLIMB = 50;
|
|
35
|
-
/** The far clip, metres: the moon's stars (moonscape.ts SKY) seen from the far end of its crater, the widest view of any map. */
|
|
36
|
-
export declare const FAR = 1200;
|
|
37
|
-
/** The bound on the distance the fog integrates over: nothing drawn is further, and a point extrapolated off a thin face can be kilometres off. */
|
|
38
|
-
export declare const FOG_FAR: number;
|
|
39
|
-
/** The vertical field of view at rest, degrees, and the tangent of its half. */
|
|
40
|
-
export declare const FOV_DEG = 70;
|
|
41
|
-
export declare const FOV: number;
|
|
42
|
-
/** Metres within which a rover is drawn with its near level of detail (rover.ts), and within which with the middle one. */
|
|
43
|
-
export declare const ROVER_NEAR: number, ROVER_MID: number;
|
|
44
|
-
/** A ship's, 14 m long: its cockpit and its struts within 45 m, its plain shape past 160 m. */
|
|
45
|
-
export declare const SHIP_NEAR: number, SHIP_MID: number;
|
|
46
|
-
/**
|
|
47
|
-
* The layer of the ninja's boots' uppers, in WEAVE's band (woven as it is): the shader adds their
|
|
48
|
-
* details on the rest place (the user, 2026-11-17): a band wound round the ankle, a cord tied under
|
|
49
|
-
* the lip of the shaft, and the split of the toe.
|
|
50
|
-
*/
|
|
51
|
-
export declare const BOOT_LAYER = -0.88;
|
|
52
|
-
/** The regions of a ninja's skin that are woven cloth: his suit, and his boots' uppers (the user, 2026-11-17: cloth, not leather). */
|
|
53
|
-
export declare const SUIT: number[];
|
|
54
|
-
export declare const POST_FRAG = "#version 300 es\nprecision highp float;uniform sampler2D S[4];uniform vec4 Y;uniform float L,Dp;in vec2 U;out vec4 o;\nvec3 b(vec2 x){vec3 c=texture(S[0],x).rgb;return c*smoothstep(.9,2.,max(c.r,max(c.g,c.b)));}\n#define T(k)texture(S[0],U+Y.xy*(k)).rgb\nvoid main(){\nvec3 c;\nif(Y.z<1.)c=(b(U+Y.xy)+b(U-Y.xy)+b(U+Y.xy*vec2(1,-1))+b(U-Y.xy*vec2(1,-1)))/4.;\nelse if(Y.z<2.)c=T(0.)*.227+(T(1.3846)+T(-1.3846))*.3162+(T(3.2308)+T(-3.2308))*.0703;\nelse{\nvec3 s=texture(S[0],U).rgb;\nif(Dp>0.){vec2 e=Y.xy*3.,f=e*.7;s=mix(s,(s+texture(S[0],U+e*vec2(1,0)).rgb+texture(S[0],U-e*vec2(1,0)).rgb+texture(S[0],U+e*vec2(0,1)).rgb+texture(S[0],U-e*vec2(0,1)).rgb+texture(S[0],U+f).rgb+texture(S[0],U-f).rgb+texture(S[0],U+f*vec2(1,-1)).rgb+texture(S[0],U-f*vec2(1,-1)).rgb)/9.,Dp);}\nc=s+texture(S[1],U).rgb*1.3+texture(S[2],U).rgb*1.+texture(S[3],U).rgb*.7;\nvec2 q=U-.5;\nc=min(c,.6)+.4*(1.-exp(-max(c-.6,0.)/.4));\nc=mix(c,c*vec3(.3,.7,.95)+vec3(0,.025,.045),Dp*.85);\nfloat a=atan(q.y,q.x)*24.,h=fract(sin(floor(a)*12.9898)*43758.5453);\nc+=L*step(.85-.5*L,h)*sin(fract(a)*3.1416)*smoothstep(.2,.6,length(q))*fract(length(q)*3.-Y.w*.002+h*9.)*.22;\nc*=1.-(.7+.3*L+.4*Dp)*dot(q,q);\nc=pow(max(c*vec3(.97,1.,1.03),0.),vec3(.92))+(fract(sin(dot(gl_FragCoord.xy+Y.w,vec2(12.9898,78.233)))*43758.5453)-.5)*.03;}\no=vec4(c,1);}";
|
|
55
|
-
/**
|
|
56
|
-
* Blinn-Phong strength and exponent: a row per TEX id in order (brick, tile, lava, stone, metal, wood,
|
|
57
|
-
* moss, grate, concrete, glass, steel, paint, rock), then the flat bodies, then polished metal (SHINE),
|
|
58
|
-
* then a glossy shell (GLOSS: broader, so it shows on the armour). Lava and glows never get here: they
|
|
59
|
-
* light themselves.
|
|
60
|
-
*/
|
|
61
|
-
export declare const SPEC: number[][];
|
|
62
|
-
export declare const FRAG: string;
|
|
63
|
-
/**
|
|
64
|
-
* The scene's fragment shader for a map and for what it draws: the moon's globe, stars, craters and
|
|
65
|
-
* orbit fade only where the map has them, the ninja's quilting, cloth, boots and brushed metal only
|
|
66
|
-
* where he is offered (rolesOf()). `LAND` is the map and the sky
|
|
67
|
-
* (the regolith, no skin, armour, hair or chitin), `FLESH` the runners, the vehicles and the
|
|
68
|
-
* effects (no regolith), `ORB` the globe alone, `DEPTH` the shadow maps' depth (a few lines: the
|
|
69
|
-
* colour's registers kept every shadow map's pixels from running as many at once); with none, all of it. Left in where it never runs,
|
|
70
|
-
* code still costs every pixel through the shader's registers: the moon 2.4 ms of GPU a frame on
|
|
71
|
-
* Highline, the ninja's 1.9 ms on three astronauts at 3 m on the moon. `rock` is the GLSL of the
|
|
72
|
-
* map's rocks under BEACH (Decor.rock: Landfall's granite, from its chunk).
|
|
73
|
-
*/
|
|
74
|
-
export declare const fragOf: (def: Pick<WorldDef, "scenery" | "seam" | "relief" | "helmets"> & Partial<Pick<WorldDef, "brushes">>, kind?: string, rock?: string) => string;
|
|
75
|
-
/**
|
|
76
|
-
* Column-major view-projection matrix of basis(yaw, pitch, roll) at eye. t is the tangent of half the
|
|
77
|
-
* vertical field of view (70° by default), [N, F] the near and far clip distances.
|
|
78
|
-
*/
|
|
79
|
-
export declare const viewProj: (eye: Vec3, yaw: number, pitch: number, aspect: number, roll?: number, t?: number, [N, F]?: [number, number]) => Float32Array<ArrayBuffer>;
|
|
80
|
-
/** A world point on screen, in [0, 1] from the top left; undefined behind the camera. */
|
|
81
|
-
export declare const project: (m: Float32Array, x: number, y: number, z: number) => [number, number] | undefined;
|
|
82
|
-
/**
|
|
83
|
-
* Whether a sphere reaches into the view of `m`, by its left, right, bottom, top and near planes (the
|
|
84
|
-
* last row plus or minus another). A point light out of it lights no pixel drawn, and the GPU pays
|
|
85
|
-
* for every light on every fragment, hidden ones too.
|
|
86
|
-
*/
|
|
87
|
-
export declare const inView: (m: Float32Array, p: Vec3, r: number) => boolean;
|
|
88
|
-
/**
|
|
89
|
-
* The pixels [x, y, width, height] (from the bottom left) the quads cover on a `w` by `h` target seen
|
|
90
|
-
* through `m`, cut at the near plane, a pixel wider each side; undefined when none. Each quad's box
|
|
91
|
-
* is clamped alone: two mouths off either side of the view are none.
|
|
92
|
-
*/
|
|
93
|
-
export declare const cover: (m: Float32Array, quads: Vec3[][], w: number, h: number) => [number, number, number, number] | undefined;
|
|
94
|
-
/**
|
|
95
|
-
* The view-projection of a spot's shadow map: from its position along its axis, a square window
|
|
96
|
-
* just wide enough for the cone, clipped from 0.3 m (a flashlight sits inside its player's head)
|
|
97
|
-
* to its range.
|
|
98
|
-
*/
|
|
99
|
-
export declare const lightProj: ({ p, d, cone, range }: Light) => Float32Array<ArrayBuffer>;
|
|
100
|
-
/**
|
|
101
|
-
* The lights as the shader's uniform arrays (see FRAG): at most MAX_LIGHTS of them, and the first
|
|
102
|
-
* MAX_SHADOWS shadowed spots get a slot, whose matrix goes in m at 16 floats a slot.
|
|
103
|
-
*/
|
|
104
|
-
export declare const pack: (lights: Light[]) => {
|
|
105
|
-
n: number;
|
|
106
|
-
maps: number;
|
|
107
|
-
a: Float32Array<ArrayBuffer>;
|
|
108
|
-
b: Float32Array<ArrayBuffer>;
|
|
109
|
-
k: Float32Array<ArrayBuffer>;
|
|
110
|
-
m: Float32Array<ArrayBuffer>;
|
|
111
|
-
};
|
|
112
|
-
/**
|
|
113
|
-
* The view-projection of the sun's shadow map: an orthographic window of `area` metres a side
|
|
114
|
-
* looking along -dir (dir points toward the sun), centred on the eye and clipped `depth` metres
|
|
115
|
-
* either side of it. The centre is snapped to the map's texels along the window's own axes, so a
|
|
116
|
-
* shadow edge keeps its texels as the eye moves instead of crawling.
|
|
117
|
-
*/
|
|
118
|
-
export declare const sunProj: (dir: Vec3, eye: Vec3, area?: number, depth?: number) => Float32Array<ArrayBuffer>;
|
|
119
|
-
/** The middle of the sun's shadow window for an eye looking along `yaw`: SUN_AHEAD metres ahead of it on the ground. */
|
|
120
|
-
export declare const sunAt: (eye: Vec3, yaw: number) => Vec3;
|
|
121
|
-
/** The tints of a world's brushes, white first and each once: the shader's palette, MAX_TINTS at most. */
|
|
122
|
-
export declare const palette: ({ def }: Pick<World, "def">) => Vec3[];
|
|
123
|
-
/**
|
|
124
|
-
* The faces of every brush as triangles in the vertex format of mesh.ts: the top gets the brush's
|
|
125
|
-
* top texture, every other face its side texture. Texture coordinates are world metres on the face
|
|
126
|
-
* (x, z on horizontal faces; z, y on faces facing x; x, y on faces facing z), so a texture runs on
|
|
127
|
-
* across neighbouring brushes. A face another brush covers flush is not built, nor is the bottom
|
|
128
|
-
* of a brush at or under the kill floor: nothing is seen from there. A brush's light is packed
|
|
129
|
-
* with its palette index as 2 * index + 1: the light is 1 (the daylight is in the shader), and
|
|
130
|
-
* the shader takes the index from floor(w / 2).
|
|
131
|
-
*/
|
|
132
|
-
export declare const level: (world: World) => number[];
|
|
133
|
-
/**
|
|
134
|
-
* What the daylight of a world lights its surfaces with, linear RGB, as the shader's H uniform:
|
|
135
|
-
* the ambient from the sky above, from the sides and bounced up from below, then the sky's zenith
|
|
136
|
-
* and horizon colours. The ambient is the sky's own colour, washed toward white so a shadow is
|
|
137
|
-
* blue-grey and not blue, and dimmer on the sides and below.
|
|
138
|
-
*/
|
|
139
|
-
export declare const daylight: ({ sky: [zenith, horizon] }: WorldDef) => Vec3[];
|
|
140
|
-
/** The world as it is drawn: its buildings down to the street, and a city around them. The physics knows only `world`. */
|
|
141
|
-
export declare const city: (world: World) => World;
|
|
142
|
-
/**
|
|
143
|
-
* A map's own scenery, loaded with its chunk before the renderer is made (decor()): its ground drawn
|
|
144
|
-
* once, and on the moon the Earth (`sky`, the ground's last vertices) and where it stands.
|
|
145
|
-
*/
|
|
146
|
-
/** A map's own scenery: its land, its sky, the Earth's place, glass drawn blended after the rest (Landfall's canopy), and its rocks' GLSL. */
|
|
147
|
-
export type Decor = {
|
|
148
|
-
land: number[];
|
|
149
|
-
sky: number[];
|
|
150
|
-
heavens?: Vec3;
|
|
151
|
-
glass?: number[];
|
|
152
|
-
/** GLSL for the map's rocks (TEX.ROCK) under BEACH, spliced in by fragOf(): Landfall's granite, which its chunk brings. */
|
|
153
|
-
rock?: string;
|
|
154
|
-
};
|
|
155
|
-
/** The scenery of a map that has none of its own: the city's is drawn here. */
|
|
156
|
-
export declare const BARE: Decor;
|
|
157
|
-
/**
|
|
158
|
-
* The scenery of the map `def`: none for a map that has no chunk of its own (Highline), and one
|
|
159
|
-
* already loaded, at once; else a promise of it, from Tranquility's or Landfall's chunk.
|
|
160
|
-
*/
|
|
161
|
-
export declare const decor: (def: WorldDef) => Decor | Promise<Decor>;
|
|
162
|
-
/** All the map's vertices, drawn once: the city (on the moon and the beach, `d` instead), the brushes, the street under them, the parks' trees, the runner's red and the team zones. */
|
|
163
|
-
export declare const scenery: (world: World, d?: Decor) => number[];
|
|
164
|
-
/** The height the fog layer is anchored at: the lowest top of the world, so that at a roof the layer is a few percent of the haze at most. */
|
|
165
|
-
export declare const fogRef: ({ brushes }: WorldDef) => number;
|
|
166
|
-
/**
|
|
167
|
-
* The fog's optical depth from `eye` to `p`, what the shader integrates: the haze plus the layer,
|
|
168
|
-
* for a world whose fog density is `density` and whose layer sits at `ref`.
|
|
169
|
-
*/
|
|
170
|
-
export declare const fogDepth: (density: number, ref: number, eye: Vec3, p: Vec3) => number;
|
|
171
|
-
/** The shader's fog uniform: the world's fog colour pulled toward its horizon by HAZE, and its density; none when the world has no fog. */
|
|
172
|
-
export declare const fogOf: ({ fog, sky }: WorldDef) => [number, number, number, number];
|
|
173
|
-
interface FrameView {
|
|
174
|
-
width: number;
|
|
175
|
-
height: number;
|
|
176
|
-
now: number;
|
|
177
|
-
}
|
|
178
|
-
export interface Renderer {
|
|
179
|
-
/**
|
|
180
|
-
* Draws one frame: the sky, the brushes and the others as seen from eye, then the own `body` over
|
|
181
|
-
* a cleared depth, lit but casting no shadow. colors maps player id to CSS.
|
|
182
|
-
*/
|
|
183
|
-
frame(eye: Vec3, yaw: number, pitch: number, others: PlayerState[], colors: ReadonlyMap<number, string>, fx: Effects,
|
|
184
|
-
/** gather() in lights.ts: at most MAX_LIGHTS, the first MAX_SHADOWS shadowed spots mapped, besides the sun. */
|
|
185
|
-
lights: Light[], body?: Body,
|
|
186
|
-
/** The bases, the flags, the racks and the health packs: drawn lit, casting shadows, with the other players. */
|
|
187
|
-
ctf?: CtfScene,
|
|
188
|
-
/** The plasma balls, the flashes and the sparks: they glow and cast no shadow. */
|
|
189
|
-
tracer?: Tracer,
|
|
190
|
-
/** The map's rovers (Predictor.rovers()): drawn lit, casting shadows, with the other players. */
|
|
191
|
-
rovers?: Rover[],
|
|
192
|
-
/** The own player when the camera is not in his head (seated in a rover): drawn whole, like the others. */
|
|
193
|
-
self?: PlayerState,
|
|
194
|
-
/** Adds what else moves in the map (the doors): drawn lit, casting shadows, with the other players. */
|
|
195
|
-
more?: (v: Out) => void, view?: FrameView): boolean;
|
|
196
|
-
/** A world point on screen as of the last frame, in [0, 1] from the top left. */
|
|
197
|
-
project(x: number, y: number, z: number): [number, number] | undefined;
|
|
198
|
-
/** The footsteps of the player `id`'s runner so far (Gait.steps), undefined before it is drawn. */
|
|
199
|
-
steps(id: number): number | undefined;
|
|
200
|
-
/** The muzzle of the long gun of the player `id`'s runner as last drawn, from his feet (Runner.tip). */
|
|
201
|
-
muzzle(id: number): Vec3 | undefined;
|
|
202
|
-
/** The runners of the players `ids` grin for a moment: their team has captured. */
|
|
203
|
-
cheer(ids: number[]): void;
|
|
204
|
-
/** The katana of player `id` struck a ball back, seen `late` s before he is drawn there: his runner parries. */
|
|
205
|
-
parried(id: number, late: number): void;
|
|
206
|
-
/** The xenomorph's vision (the own player is one): a grey-blue world, the enemies in sight glowing. */
|
|
207
|
-
vision(on: boolean): void;
|
|
208
|
-
/** The Hunter's local vision filter and the players it can detect. */
|
|
209
|
-
hunterVision(mode: number, targets: PlayerState[], cold?: PlayerState[]): void;
|
|
210
|
-
/** Let eligible glory kill targets flash during play. */
|
|
211
|
-
edge(on: boolean): void;
|
|
212
|
-
/** The body of each player (PlayerInfo.body, BODY), from the roster: the man's for one not in it; and the skin and haircut he picked, his id's for one not in `looks`. */
|
|
213
|
-
wear(builds: ReadonlyMap<number, number>, looks?: ReadonlyMap<number, Choice>): void;
|
|
214
|
-
/**
|
|
215
|
-
* A picture of the player `p` as the character `build` in `color`, with the skin and haircut
|
|
216
|
-
* `look`, framed by `shot` (PORTRAIT, or HEAD for the head alone), into the 2D canvas `into`: a frame of him alone in the map's sky, which the next
|
|
217
|
-
* frame() replaces on the screen. False when nothing could be drawn yet.
|
|
218
|
-
*/
|
|
219
|
-
portrait(into: HTMLCanvasElement, p: PlayerState, build: number, color: string, look?: Choice, shot?: Shot): boolean;
|
|
220
|
-
destroy(): void;
|
|
221
|
-
}
|
|
222
|
-
/** A character card's picture: how high over the map he stands (m), the camera's height over his feet and its distance (m), its angle off his front and his own off the sun (rad), its field of view (degrees), and how far it steps to its right (m). */
|
|
223
|
-
export declare const PORTRAIT: {
|
|
224
|
-
y: number;
|
|
225
|
-
eye: number;
|
|
226
|
-
away: number;
|
|
227
|
-
turn: number;
|
|
228
|
-
sun: number;
|
|
229
|
-
fov: number;
|
|
230
|
-
side: number;
|
|
231
|
-
};
|
|
232
|
-
/** A haircut's picture: the head alone, seen three quarters from behind so a tail or a bun shows. */
|
|
233
|
-
export declare const HEAD: {
|
|
234
|
-
eye: number;
|
|
235
|
-
away: number;
|
|
236
|
-
turn: number;
|
|
237
|
-
fov: number;
|
|
238
|
-
side: number;
|
|
239
|
-
y: number;
|
|
240
|
-
sun: number;
|
|
241
|
-
};
|
|
242
|
-
/** A picture's framing, and whether he grins in it. */
|
|
243
|
-
export type Shot = typeof PORTRAIT & {
|
|
244
|
-
grin?: boolean;
|
|
245
|
-
/** What he holds, over the empty hands of a picture (the character screen's weapon). */
|
|
246
|
-
hold?: Partial<PlayerState>;
|
|
247
|
-
/** Radians he is turned from his usual pose, towards his left: a weapon held ahead then shows across the picture. */
|
|
248
|
-
spin?: number;
|
|
249
|
-
};
|
|
250
|
-
/** An ally's face on the radio screen: the head nearly from the front, grinning. */
|
|
251
|
-
export declare const FACE: Shot;
|
|
252
|
-
/** Pixels drawn at most (1080p): every one is lit per light and shadow map, so a 4K screen at a pixel ratio of 2 would pay for 8 million. */
|
|
253
|
-
export declare const MAX_PIXELS: number;
|
|
254
|
-
/** The canvas size in device pixels: the CSS size times the pixel ratio (2 at most), scaled down to MAX_PIXELS. */
|
|
255
|
-
export declare const backing: (cw: number, ch: number, dpr: number) => [number, number];
|
|
256
|
-
/** Throws when the browser has no WebGL2. */
|
|
257
|
-
/**
|
|
258
|
-
* What a renderer builds before its first frame, as steps of a few tens of milliseconds, each kept
|
|
259
|
-
* where every renderer finds it (memoized, or in the GPU store): the runners' skins at every level,
|
|
260
|
-
* now, built on the first runner to come near (the close one with its face's channels takes a
|
|
261
|
-
* tenth of a second) they would stall a frame of the match. So would their armour's recipes (a
|
|
262
|
-
* quarter of a second close up; the own body's, close and of the own `build`, a third of a second
|
|
263
|
-
* on the first frame), the halves a katana's cut makes of each (cut(), some 40 ms for every level
|
|
264
|
-
* and limb), her close hair, every style (half a second for the five: a style can come with a
|
|
265
|
-
* player who joins or change in the menu mid-match), the xenomorph's skins and rigid pieces (its
|
|
266
|
-
* close skull alone took a frame of 70 ms), the racks' weapons and the textures. An armour's
|
|
267
|
-
* recipe is a step of many (preparing()), a slice of its skin at a time. createRenderer()
|
|
268
|
-
* runs them at once; index.ts runs them one task each before, so the loading screen paints on.
|
|
269
|
-
* `own` is the own runner's build, whose first-person body is drawn close: a match's, not the
|
|
270
|
-
* character screen's. `hunter`: the Hunter's pieces too (warmHunter()), which the character
|
|
271
|
-
* screen draws on a tile and a match only once one comes.
|
|
272
|
-
*/
|
|
273
|
-
/** A step of a renderer's warm-up: true when it has more to do (it is run again). */
|
|
274
|
-
export type Step = () => boolean | void;
|
|
275
|
-
export declare const warmSteps: (own?: number, hunter?: boolean) => Step[];
|
|
1
|
+
import type { World } from '../shared/world';
|
|
2
|
+
import type { Renderer } from './render/types';
|
|
3
|
+
export * from './render/constants';
|
|
4
|
+
export * from './render/shader';
|
|
5
|
+
export * from './render/camera';
|
|
6
|
+
export * from './render/scene';
|
|
7
|
+
export * from './render/types';
|
|
8
|
+
export * from './render/shots';
|
|
276
9
|
/** `d` is the map's own scenery (decor()): without it, Tranquility and Landfall draw their brushes only. */
|
|
277
|
-
export declare const createRenderer: (canvas: HTMLCanvasElement, world: World, d?: Decor) => Renderer;
|
|
278
|
-
export {};
|
|
10
|
+
export declare const createRenderer: (canvas: HTMLCanvasElement, world: World, d?: import("./render").Decor) => Renderer;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Voice } from './synth';
|
|
2
|
+
/**
|
|
3
|
+
* A map's ambience, played by audio.ts round the listener: beds that loop, each as loud as where
|
|
4
|
+
* he stands makes it, and a cry now and then from afar.
|
|
5
|
+
*/
|
|
6
|
+
export interface Air {
|
|
7
|
+
/** The beds: mono loops at MUSIC_RATE whose end joins their start. */
|
|
8
|
+
beds: (() => Float32Array)[];
|
|
9
|
+
/** Each bed's volume, 0 to 1, for a listener at `eye` at `t` seconds, written into `out`. */
|
|
10
|
+
mix(eye: readonly number[], t: number, out: number[]): void;
|
|
11
|
+
/** The cry's voices, and where one comes from, given two numbers drawn in [0, 1). */
|
|
12
|
+
cry: Voice[];
|
|
13
|
+
from(u: number, v: number): [number, number, number];
|
|
14
|
+
}
|
|
15
|
+
/** Brings the loudest sample of `s` to `peak`. */
|
|
16
|
+
export declare const level: (s: Float32Array, peak: number) => Float32Array<ArrayBufferLike>;
|
|
17
|
+
/**
|
|
18
|
+
* The surf, twelve seconds: under the far sea's rumble, two waves a loop and three weaker ones
|
|
19
|
+
* between them. Each swells, breaks (the noise opens up: its low-pass rises with the wave) and
|
|
20
|
+
* draws back down the sand as a long hiss. Every envelope is a whole number of periods a loop and
|
|
21
|
+
* the filters run a quarter of it unheard first, so the end joins the start.
|
|
22
|
+
*/
|
|
23
|
+
export declare const surf: () => Float32Array;
|
|
24
|
+
/**
|
|
25
|
+
* A steady noise that loops, `secs` long: what is left of white noise between two one-pole
|
|
26
|
+
* low-passes (`k0` 0: all that is under `k1`), and `pops` crackles a second, each a click a
|
|
27
|
+
* millisecond long. The wind in the palms is a band of it, the fire a rumble that crackles.
|
|
28
|
+
*/
|
|
29
|
+
export declare const hush: (seed: number, secs: number, peak: number, k0: number, k1: number, pops?: number) => Float32Array<ArrayBufferLike>;
|
|
30
|
+
export declare const breeze: () => Float32Array;
|
|
31
|
+
export declare const blaze: () => Float32Array;
|
|
32
|
+
/**
|
|
33
|
+
* The forest's insects, six seconds: three cicadas, each a high sine that trills and comes and
|
|
34
|
+
* goes. Every frequency is a whole number of periods a loop: its end joins its start.
|
|
35
|
+
*/
|
|
36
|
+
export declare const chirr: () => Float32Array;
|
|
37
|
+
/** Where something burns on Landfall (x, z): by the four torn engines and at the hull's four broken ends. */
|
|
38
|
+
export declare const FIRES: number[][];
|
|
39
|
+
/**
|
|
40
|
+
* Landfall's ambience: the surf, loudest at the waterline; the wind in the palms, in gusts, and
|
|
41
|
+
* the insects, both rising toward the trees; a fire's crackle within some 25 m of one; and a gull
|
|
42
|
+
* calling over the lagoon.
|
|
43
|
+
*/
|
|
44
|
+
export declare const LANDFALL: Air;
|
|
45
|
+
/** The ambience of each map by its key; the others have none. */
|
|
46
|
+
export declare const AIRS: Record<string, Air>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** A sixteenth of the menus' theme in samples, at 105 bpm: whole, and so is the loop. */
|
|
2
|
+
export declare const TICK: number;
|
|
3
|
+
/** The theme's chords: the bass's root (MIDI), then the arpeggio's three notes, round E4. */
|
|
4
|
+
export declare const HARMONY: Record<string, number[]>;
|
|
5
|
+
/**
|
|
6
|
+
* The chords, a half bar each, in E minor: E Em, C, G, D, A Am and B major, whose D sharp leads
|
|
7
|
+
* home. Four sections of eight bars: the theme, the theme again with a chord each half bar, the
|
|
8
|
+
* climax, and a breakdown that falls back to the start.
|
|
9
|
+
*/
|
|
10
|
+
export declare const CHANGES: string;
|
|
11
|
+
/**
|
|
12
|
+
* The lead, a sixteenth a character, as the moon's (a letter starts a note from C4 at a, '.'
|
|
13
|
+
* holds it, '-' rests): eight bars of sixteen for each section.
|
|
14
|
+
*/
|
|
15
|
+
export declare const THEME: string[];
|
|
16
|
+
/** Each section's drums over a bar, k kick, s snare, h hat; the climax's last bar rolls. */
|
|
17
|
+
export declare const KIT_MENU: string[];
|
|
18
|
+
/** The bass's hits in a bar, R its root and r an octave up. */
|
|
19
|
+
export declare const WALK: string[];
|
|
20
|
+
/**
|
|
21
|
+
* The menus' theme, 8-bit: thirty-two bars in E minor at 105 bpm, a chord every bar or half bar.
|
|
22
|
+
* The lead on the soft triangle, then on a pulse, then wide and with an echo at the climax, then
|
|
23
|
+
* back on the triangle with an echo over a thinner beat; under it a sixteenth arpeggio of the
|
|
24
|
+
* chord, an octave bass on the triangle and noise drums. Rhythmic, never shrill: the thin pulses
|
|
25
|
+
* stay quiet. Mono at MUSIC_RATE, deterministic, its end joining its start.
|
|
26
|
+
*/
|
|
27
|
+
export declare const anthem: () => Float32Array;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Voice } from './synth';
|
|
2
|
+
/**
|
|
3
|
+
* The sounds of the game: one entry per sound, its voices layered, in SOUND order. A low-passed
|
|
4
|
+
* noise is quiet (lp 0.06 keeps about a tenth of the swing): the loops have a high volume.
|
|
5
|
+
*/
|
|
6
|
+
export declare const LAYERS: Voice[][];
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { Voice } from './synth';
|
|
2
|
+
/** The music's sample rate: half, as nothing in it but the hats goes past 4 kHz. */
|
|
3
|
+
export declare const MUSIC_RATE: number;
|
|
4
|
+
export declare const BPM = 84;
|
|
5
|
+
export declare const BEAT: number;
|
|
6
|
+
export declare const BARS = 16;
|
|
7
|
+
/** Two bars each, in semitones above A2: Dmaj9, Bm7, Gmaj7, Asus2. */
|
|
8
|
+
export declare const CHORDS: number[][];
|
|
9
|
+
/**
|
|
10
|
+
* The bells over a chord, one character an eighth: a digit is a note of the chord an octave up, two
|
|
11
|
+
* octaves from 4. One line for each half of the loop.
|
|
12
|
+
*/
|
|
13
|
+
export declare const ARP: string[];
|
|
14
|
+
export declare const HAT: Voice;
|
|
15
|
+
export declare const PULSE: Voice;
|
|
16
|
+
/**
|
|
17
|
+
* Adds `src` to `to` from sample `at`, read `r` times as fast (a pitch) for `len` samples, wrapping
|
|
18
|
+
* round `to`, with a rise of `a` samples and a fall of `d`, both squared. `src` loops: its last
|
|
19
|
+
* sample repeats its first.
|
|
20
|
+
*/
|
|
21
|
+
export declare const add: (to: Float32Array, src: Float32Array, at: number, r?: number, gain?: number, len?: number, a?: number, d?: number) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Adds `pads` to both halves of `mix` and brings its peak to 0.35. Hot loops sit in small functions:
|
|
24
|
+
* V8 compiles a big one on its first hot loop, which costs more than the loop.
|
|
25
|
+
*/
|
|
26
|
+
export declare const mixdown: (mix: Float32Array, pads: Float32Array) => Float32Array<ArrayBufferLike>;
|
|
27
|
+
/**
|
|
28
|
+
* The music: sixteen bars in D major at 84 bpm (whole beats, whole samples), slow pads, sparse
|
|
29
|
+
* bells with an echo, soft hats and a muted pulse; mono samples in [-1, 1] at MUSIC_RATE,
|
|
30
|
+
* deterministic, whose end joins its start (every tail wraps onto the start). Quiet enough to sit
|
|
31
|
+
* under the sounds.
|
|
32
|
+
*/
|
|
33
|
+
export declare const music: () => Float32Array;
|
|
34
|
+
/** A sixteenth of the moon's music in samples, at 126 bpm: whole, and so is the loop. */
|
|
35
|
+
export declare const STEP: number;
|
|
36
|
+
/**
|
|
37
|
+
* The moon's chords in D minor, a bar each: the bass's root, then the arpeggio's three notes. A
|
|
38
|
+
* letter is semitones above C4 from a: Dm Dm Bb C Dm Dm Gm A, Bb C Am Dm Gm Bb Asus4 A.
|
|
39
|
+
*/
|
|
40
|
+
export declare const CHORDS_MOON = "ccfjccfjkcfkaaehccfjccfjhchkjbejkcfkaaehjaejccfjhchkkcfkjcejjbej";
|
|
41
|
+
/** The lead over them, a sixteenth a character: a letter starts a note, '.' holds it, '-' rests. */
|
|
42
|
+
export declare const LEAD: string;
|
|
43
|
+
/** The arpeggio's hits in a bar. */
|
|
44
|
+
export declare const COMP = "x..x..x...x..x..";
|
|
45
|
+
/** A bar of drums, k kick, s snare, h hat; the last bar of eight rolls. */
|
|
46
|
+
export declare const KIT: string[];
|
|
47
|
+
export declare const hz: (midi: number) => number;
|
|
48
|
+
/** The MIDI note of a letter of the score. */
|
|
49
|
+
export declare const key: (s: string, at?: number) => number;
|
|
50
|
+
/**
|
|
51
|
+
* Adds one chip note to `to` from sample `at`, `len` samples, wrapping round: `wave` 0 a pulse of
|
|
52
|
+
* duty `w`, 1 the NES's 4-bit triangle, 2 its noise (a 15-bit shift register tapped at `w`: 1 hisses,
|
|
53
|
+
* 6 rings), at `pitch(j)` on sample j; the volume falls from `vol` to `rest` of it in `fall`
|
|
54
|
+
* samples, in sixteen steps.
|
|
55
|
+
*/
|
|
56
|
+
export declare const chip: (to: Float32Array, at: number, len: number, pitch: (j: number) => number, wave: number, w: number, vol: number, fall: number, rest?: number) => void;
|
|
57
|
+
/**
|
|
58
|
+
* Adds `beat` to both halves of `mix`, takes the edge off the aliased squares with a one-pole
|
|
59
|
+
* low-pass at about 4 kHz (warmed on the end, so the seam holds) and brings the peak to 0.26.
|
|
60
|
+
*/
|
|
61
|
+
export declare const finish: (mix: Float32Array, beat: Float32Array) => Float32Array<ArrayBufferLike>;
|
|
62
|
+
/**
|
|
63
|
+
* The moon's music, 8-bit: thirty-two bars in D minor at 126 bpm, a pulse lead, a fast arpeggio
|
|
64
|
+
* in a thin pulse, an octave bass on the triangle and noise drums. The second sixteen bars play
|
|
65
|
+
* the lead thinner with an echo and the arpeggio an octave up. Like music(): mono at MUSIC_RATE,
|
|
66
|
+
* deterministic, its end joining its start.
|
|
67
|
+
*/
|
|
68
|
+
export declare const moon: () => Float32Array;
|
|
69
|
+
/** A sixteenth of Highline's music in samples, at 135 bpm: whole, and so is the loop. */
|
|
70
|
+
export declare const BEAM: number;
|
|
71
|
+
/**
|
|
72
|
+
* Highline's chords: the bass's root (MIDI), then the arpeggio's three notes round A4. E is E over
|
|
73
|
+
* D's root, the lydian second that keeps it floating; S is Asus4.
|
|
74
|
+
*/
|
|
75
|
+
export declare const SKY: Record<string, number[]>;
|
|
76
|
+
/**
|
|
77
|
+
* The chords, a half bar each, in D major: the theme, the theme again turning faster at its end,
|
|
78
|
+
* the bridge on the fourth, and the theme once more.
|
|
79
|
+
*/
|
|
80
|
+
export declare const CHANGES_SKY: string;
|
|
81
|
+
/** Its lead, as the moon's: a letter a note from C4 at a, '.' held, '-' a rest; a section a line. */
|
|
82
|
+
export declare const WIND: string[];
|
|
83
|
+
/** Each section's drums over a bar, k kick, s snare, h hat, o open hat; the bridge's end rolls. */
|
|
84
|
+
export declare const KIT_SKY: string[];
|
|
85
|
+
/** The bass's hits in a bar, R its root and r an octave up. */
|
|
86
|
+
export declare const WALK_SKY: string[];
|
|
87
|
+
/**
|
|
88
|
+
* Highline's music, 8-bit and airy: thirty-two bars in D major at 135 bpm with a lydian second.
|
|
89
|
+
* A high pulse lead with a dotted echo, thin on the theme and wide on the bridge, then on the soft
|
|
90
|
+
* triangle for the return; under it a sparkling sixteenth arpeggio an octave up, a bouncing octave
|
|
91
|
+
* bass on the triangle and light noise drums with an open hat. Mono at MUSIC_RATE, deterministic,
|
|
92
|
+
* its end joining its start.
|
|
93
|
+
*/
|
|
94
|
+
export declare const sky: () => Float32Array;
|
|
95
|
+
/** The music of each map by its key; the others play music(). */
|
|
96
|
+
export declare const SONGS: Record<string, () => Float32Array>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Voice } from './synth';
|
|
2
|
+
/** The seconds sound `id` lasts: its longest voice, from its start late to the end of its decay. */
|
|
3
|
+
export declare const secondsOf: (id: number, layers?: Voice[][]) => number;
|
|
4
|
+
/** The sounds played in a loop: their buffers go through seam. */
|
|
5
|
+
export declare const LOOPED: number[];
|
|
6
|
+
/**
|
|
7
|
+
* Renders the sound `id` of `layers` as mono samples in [-1, 1] at RATE, deterministic (seeded
|
|
8
|
+
* noise), silent at both ends (no click).
|
|
9
|
+
*/
|
|
10
|
+
export declare const render: (id: number, layers?: Voice[][]) => Float32Array;
|