@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.
Files changed (102) hide show
  1. package/dist/cast-art-DbwsToaQ.js +1 -0
  2. package/dist/index.js +8 -7
  3. package/dist/landfall-CSZGx2iA.js +21 -0
  4. package/dist/types/client/armor/clip.d.ts +22 -0
  5. package/dist/types/client/armor/cooking.d.ts +14 -0
  6. package/dist/types/client/armor/details.d.ts +65 -0
  7. package/dist/types/client/armor/fit.d.ts +8 -0
  8. package/dist/types/client/armor/regions.d.ts +304 -0
  9. package/dist/types/client/armor/scratches.d.ts +4 -0
  10. package/dist/types/client/armor/shell.d.ts +46 -0
  11. package/dist/types/client/armor/types.d.ts +37 -0
  12. package/dist/types/client/armor/wear.d.ts +22 -0
  13. package/dist/types/client/armor.d.ts +9 -393
  14. package/dist/types/client/body/constants.d.ts +35 -0
  15. package/dist/types/client/body/create.d.ts +3 -0
  16. package/dist/types/client/body/fingers.d.ts +112 -0
  17. package/dist/types/client/body/glove.d.ts +27 -0
  18. package/dist/types/client/body/hands.d.ts +28 -0
  19. package/dist/types/client/body/hunter.d.ts +26 -0
  20. package/dist/types/client/body/motion.d.ts +42 -0
  21. package/dist/types/client/body/reach.d.ts +65 -0
  22. package/dist/types/client/body/types.d.ts +39 -0
  23. package/dist/types/client/body/wield.d.ts +30 -0
  24. package/dist/types/client/body.d.ts +10 -207
  25. package/dist/types/client/cast-art.d.ts +2 -0
  26. package/dist/types/client/gait/constants.d.ts +34 -0
  27. package/dist/types/client/gait/create.d.ts +3 -0
  28. package/dist/types/client/gait/fists.d.ts +55 -0
  29. package/dist/types/client/gait/maths.d.ts +38 -0
  30. package/dist/types/client/gait/moves.d.ts +129 -0
  31. package/dist/types/client/gait/types.d.ts +59 -0
  32. package/dist/types/client/gait.d.ts +6 -146
  33. package/dist/types/client/gun/ammo.d.ts +21 -0
  34. package/dist/types/client/gun/display.d.ts +32 -0
  35. package/dist/types/client/gun/held.d.ts +75 -0
  36. package/dist/types/client/gun/kinds.d.ts +12 -0
  37. package/dist/types/client/gun/loft.d.ts +16 -0
  38. package/dist/types/client/gun/paint.d.ts +30 -0
  39. package/dist/types/client/gun/railgun.d.ts +34 -0
  40. package/dist/types/client/gun/reload.d.ts +112 -0
  41. package/dist/types/client/gun/rifle.d.ts +54 -0
  42. package/dist/types/client/gun/sidearm.d.ts +32 -0
  43. package/dist/types/client/gun.d.ts +10 -308
  44. package/dist/types/client/hulk/cabin.d.ts +36 -0
  45. package/dist/types/client/hulk/common.d.ts +55 -0
  46. package/dist/types/client/hulk/debris.d.ts +16 -0
  47. package/dist/types/client/hulk/hull.d.ts +81 -0
  48. package/dist/types/client/hulk/inside.d.ts +5 -0
  49. package/dist/types/client/hulk/parts.d.ts +16 -0
  50. package/dist/types/client/hulk/types.d.ts +7 -0
  51. package/dist/types/client/hulk/wings.d.ts +4 -0
  52. package/dist/types/client/hulk.d.ts +8 -18
  53. package/dist/types/client/hunter/animation.d.ts +113 -0
  54. package/dist/types/client/hunter/constants.d.ts +53 -0
  55. package/dist/types/client/hunter/disc.d.ts +33 -0
  56. package/dist/types/client/hunter/harpoon.d.ts +68 -0
  57. package/dist/types/client/hunter/marine.d.ts +14 -0
  58. package/dist/types/client/hunter/model.d.ts +4 -0
  59. package/dist/types/client/hunter/rest.d.ts +7 -0
  60. package/dist/types/client/hunter.d.ts +7 -164
  61. package/dist/types/client/render/camera.d.ts +58 -0
  62. package/dist/types/client/render/constants.d.ts +63 -0
  63. package/dist/types/client/render/scene.d.ts +58 -0
  64. package/dist/types/client/render/shader.d.ts +69 -0
  65. package/dist/types/client/render/shots.d.ts +61 -0
  66. package/dist/types/client/render/types.d.ts +74 -0
  67. package/dist/types/client/render.d.ts +9 -277
  68. package/dist/types/client/sfx/air.d.ts +46 -0
  69. package/dist/types/client/sfx/anthem.d.ts +27 -0
  70. package/dist/types/client/sfx/layers.d.ts +6 -0
  71. package/dist/types/client/sfx/music.d.ts +96 -0
  72. package/dist/types/client/sfx/render.d.ts +10 -0
  73. package/dist/types/client/sfx/sounds.d.ts +180 -0
  74. package/dist/types/client/sfx/synth.d.ts +24 -0
  75. package/dist/types/client/sfx/voices.d.ts +59 -0
  76. package/dist/types/client/sfx.d.ts +8 -325
  77. package/dist/types/client/skin/head.d.ts +120 -0
  78. package/dist/types/client/skin/lofts.d.ts +145 -0
  79. package/dist/types/client/skin/pose.d.ts +102 -0
  80. package/dist/types/client/skin/shape.d.ts +2 -0
  81. package/dist/types/client/skin.d.ts +4 -179
  82. package/dist/types/client/soldier/animate.d.ts +12 -0
  83. package/dist/types/client/soldier/carry.d.ts +28 -0
  84. package/dist/types/client/soldier/common.d.ts +8 -0
  85. package/dist/types/client/soldier/draw.d.ts +12 -0
  86. package/dist/types/client/soldier/grasp.d.ts +28 -0
  87. package/dist/types/client/soldier/hunter.d.ts +38 -0
  88. package/dist/types/client/soldier/runner.d.ts +58 -0
  89. package/dist/types/client/soldier/stance.d.ts +20 -0
  90. package/dist/types/client/soldier/types.d.ts +107 -0
  91. package/dist/types/client/soldier.d.ts +9 -236
  92. package/dist/types/client/xeno/back.d.ts +113 -0
  93. package/dist/types/client/xeno/body.d.ts +63 -0
  94. package/dist/types/client/xeno/common.d.ts +28 -0
  95. package/dist/types/client/xeno/head.d.ts +109 -0
  96. package/dist/types/client/xeno/limbs.d.ts +62 -0
  97. package/dist/types/client/xeno/mouth.d.ts +23 -0
  98. package/dist/types/client/xeno/parts.d.ts +40 -0
  99. package/dist/types/client/xeno/tail.d.ts +107 -0
  100. package/dist/types/client/xeno.d.ts +8 -246
  101. package/package.json +1 -1
  102. package/dist/landfall-CXJnap8w.js +0 -21
@@ -0,0 +1,58 @@
1
+ import type { Light } from '../lights';
2
+ import type { Vec3 } from '../mesh';
3
+ /**
4
+ * Column-major view-projection matrix of basis(yaw, pitch, roll) at eye. t is the tangent of half the
5
+ * vertical field of view (70° by default), [N, F] the near and far clip distances.
6
+ */
7
+ export declare const viewProj: (eye: Vec3, yaw: number, pitch: number, aspect: number, roll?: number, t?: number, [N, F]?: [number, number]) => Float32Array<ArrayBuffer>;
8
+ /** A world point on screen, in [0, 1] from the top left; undefined behind the camera. */
9
+ export declare const project: (m: Float32Array, x: number, y: number, z: number) => [number, number] | undefined;
10
+ /**
11
+ * Whether a sphere reaches into the view of `m`, by its left, right, bottom, top and near planes (the
12
+ * last row plus or minus another). A point light out of it lights no pixel drawn, and the GPU pays
13
+ * for every light on every fragment, hidden ones too.
14
+ */
15
+ export declare const inView: (m: Float32Array, p: Vec3, r: number) => boolean;
16
+ /**
17
+ * The pixels [x, y, width, height] (from the bottom left) the quads cover on a `w` by `h` target seen
18
+ * through `m`, cut at the near plane, a pixel wider each side; undefined when none. Each quad's box
19
+ * is clamped alone: two mouths off either side of the view are none.
20
+ */
21
+ export declare const cover: (m: Float32Array, quads: Vec3[][], w: number, h: number) => [number, number, number, number] | undefined;
22
+ /**
23
+ * The view-projection of a spot's shadow map: from its position along its axis, a square window
24
+ * just wide enough for the cone, clipped from 0.3 m (a flashlight sits inside its player's head)
25
+ * to its range.
26
+ */
27
+ export declare const lightProj: ({ p, d, cone, range }: Light) => Float32Array<ArrayBuffer>;
28
+ /** The lights of this frame that reach into the view, refilled every frame. */
29
+ export declare const lit: Light[];
30
+ export declare const PACKED: {
31
+ n: number;
32
+ maps: number;
33
+ a: Float32Array<ArrayBuffer>;
34
+ b: Float32Array<ArrayBuffer>;
35
+ k: Float32Array<ArrayBuffer>;
36
+ m: Float32Array<ArrayBuffer>;
37
+ };
38
+ /**
39
+ * The lights as the shader's uniform arrays (see FRAG): at most MAX_LIGHTS of them, and the first
40
+ * MAX_SHADOWS shadowed spots get a slot, whose matrix goes in m at 16 floats a slot.
41
+ */
42
+ export declare const pack: (lights: Light[]) => {
43
+ n: number;
44
+ maps: number;
45
+ a: Float32Array<ArrayBuffer>;
46
+ b: Float32Array<ArrayBuffer>;
47
+ k: Float32Array<ArrayBuffer>;
48
+ m: Float32Array<ArrayBuffer>;
49
+ };
50
+ /**
51
+ * The view-projection of the sun's shadow map: an orthographic window of `area` metres a side
52
+ * looking along -dir (dir points toward the sun), centred on the eye and clipped `depth` metres
53
+ * either side of it. The centre is snapped to the map's texels along the window's own axes, so a
54
+ * shadow edge keeps its texels as the eye moves instead of crawling.
55
+ */
56
+ export declare const sunProj: (dir: Vec3, eye: Vec3, area?: number, depth?: number) => Float32Array<ArrayBuffer>;
57
+ /** The middle of the sun's shadow window for an eye looking along `yaw`: SUN_AHEAD metres ahead of it on the ground. */
58
+ export declare const sunAt: (eye: Vec3, yaw: number) => Vec3;
@@ -0,0 +1,63 @@
1
+ /** Tints a world can use at once, white included (see palette). */
2
+ export declare const MAX_TINTS = 16;
3
+ /** Bytes the dynamic tail starts with; it grows when a frame needs more. */
4
+ export declare const TAIL: number;
5
+ /** Metres one texture covers. */
6
+ export declare const TILE = 2;
7
+ /** Shadow map side in texels. */
8
+ export declare const SHADOW = 1024;
9
+ /** Metres the sun's shadow window spans on a side: 9 cm a texel. */
10
+ export declare const SUN_AREA = 96;
11
+ /**
12
+ * Metres the window's middle is ahead of the eye, along the look on the ground: what is behind the
13
+ * camera needs little of it. It reaches 19 m behind the eye and 77 m ahead: a rover at 20 m/s seen
14
+ * from a chase camera keeps its shadow, and those of the hills it drives at, for 4 s ahead.
15
+ */
16
+ export declare const SUN_AHEAD = 29;
17
+ /** Half the depth range of the sun's window, metres: what stands this far from the eye along the sun's direction still casts. */
18
+ export declare const SUN_DEPTH = 100;
19
+ /** 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. */
20
+ export declare const HAZE = 0.6;
21
+ /**
22
+ * The height fog: besides the haze at the density of the world's fog, a layer of FOG_LAYER times that
23
+ * density at the lowest roof, which grows by e every 1 / FOG_RISE metres down: 2 % more at the roofs,
24
+ * about three times the haze on the street 94 m under them.
25
+ */
26
+ export declare const FOG_LAYER = 0.02;
27
+ export declare const FOG_RISE = 0.05;
28
+ /** 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. */
29
+ export declare const FOG_CLIMB = 50;
30
+ /** 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. */
31
+ export declare const FAR = 1200;
32
+ /** 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. */
33
+ export declare const FOG_FAR: number;
34
+ /** The vertical field of view at rest, degrees, and the tangent of its half. */
35
+ export declare const FOV_DEG = 70;
36
+ export declare const FOV: number;
37
+ /** Metres within which another player is drawn with the near level of detail (see DETAIL), and within which with the close one (see body()). */
38
+ export declare const NEAR: number, CLOSE: number;
39
+ /** Metres within which a rover is drawn with its near level of detail (rover.ts), and within which with the middle one. */
40
+ export declare const ROVER_NEAR: number, ROVER_MID: number;
41
+ /** A ship's, 14 m long: its cockpit and its struts within 45 m, its plain shape past 160 m. */
42
+ export declare const SHIP_NEAR: number, SHIP_MID: number;
43
+ /** Texels a row of the store's data texture (flesh.ts). */
44
+ export declare const TEXELS = 2048;
45
+ /** R of the frame's own vertices (see VERT): no turn, a scale of 1, at the origin. */
46
+ export declare const STILL: number[];
47
+ /** The moon's radius, metres, and the climb over the edge of space in which the crater fades into its globe. */
48
+ export declare const MOON_R = 1737400;
49
+ export declare const ORBIT_FADE = 250;
50
+ /** The height from which the globe shows past the relief's edge, and the climb over which it comes in. */
51
+ export declare const GLOBE_FROM = 20;
52
+ export declare const GLOBE_IN = 60;
53
+ export declare const clamp01: (v: number) => number;
54
+ /**
55
+ * The layer of the ninja's boots' uppers, in WEAVE's band (woven as it is): the shader adds their
56
+ * details on the rest place (the user, 2026-11-17): a band wound round the ankle, a cord tied under
57
+ * the lip of the shaft, and the split of the toe.
58
+ */
59
+ export declare const BOOT_LAYER = -0.88;
60
+ /** 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). */
61
+ export declare const SUIT: number[];
62
+ /** Samples of the scene target: the canvas' own antialiasing no longer reaches it. */
63
+ export declare const SAMPLES = 4;
@@ -0,0 +1,58 @@
1
+ import type { World, WorldDef } from '../../shared/world';
2
+ import type { Vec3 } from '../mesh';
3
+ /** The tints of a world's brushes, white first and each once: the shader's palette, MAX_TINTS at most. */
4
+ export declare const palette: ({ def }: Pick<World, "def">) => Vec3[];
5
+ /** The corners of a face's two triangles, as [along p, along q] picks of its min or max. */
6
+ export declare const CORNERS: number[][];
7
+ /**
8
+ * The faces of every brush as triangles in the vertex format of mesh.ts: the top gets the brush's
9
+ * top texture, every other face its side texture. Texture coordinates are world metres on the face
10
+ * (x, z on horizontal faces; z, y on faces facing x; x, y on faces facing z), so a texture runs on
11
+ * across neighbouring brushes. A face another brush covers flush is not built, nor is the bottom
12
+ * of a brush at or under the kill floor: nothing is seen from there. A brush's light is packed
13
+ * with its palette index as 2 * index + 1: the light is 1 (the daylight is in the shader), and
14
+ * the shader takes the index from floor(w / 2).
15
+ */
16
+ export declare const level: (world: World) => number[];
17
+ /**
18
+ * What the daylight of a world lights its surfaces with, linear RGB, as the shader's H uniform:
19
+ * the ambient from the sky above, from the sides and bounced up from below, then the sky's zenith
20
+ * and horizon colours. The ambient is the sky's own colour, washed toward white so a shadow is
21
+ * blue-grey and not blue, and dimmer on the sides and below.
22
+ */
23
+ export declare const daylight: ({ sky: [zenith, horizon] }: WorldDef) => Vec3[];
24
+ /** The world as it is drawn: its buildings down to the street, and a city around them. The physics knows only `world`. */
25
+ export declare const city: (world: World) => World;
26
+ /**
27
+ * A map's own scenery, loaded with its chunk before the renderer is made (decor()): its ground drawn
28
+ * once, and on the moon the Earth (`sky`, the ground's last vertices) and where it stands.
29
+ */
30
+ /** 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. */
31
+ export type Decor = {
32
+ land: number[];
33
+ sky: number[];
34
+ heavens?: Vec3;
35
+ glass?: number[];
36
+ /** GLSL for the map's rocks (TEX.ROCK) under BEACH, spliced in by fragOf(): Landfall's granite, which its chunk brings. */
37
+ rock?: string;
38
+ };
39
+ /** The scenery of a map that has none of its own: the city's is drawn here. */
40
+ export declare const BARE: Decor;
41
+ /** The scenery of each map already loaded: it is the same each time the map is played. */
42
+ export declare const decors: Map<WorldDef, Decor>;
43
+ /**
44
+ * The scenery of the map `def`: none for a map that has no chunk of its own (Highline), and one
45
+ * already loaded, at once; else a promise of it, from Tranquility's or Landfall's chunk.
46
+ */
47
+ export declare const decor: (def: WorldDef) => Decor | Promise<Decor>;
48
+ /** 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. */
49
+ export declare const scenery: (world: World, d?: Decor) => number[];
50
+ /** 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. */
51
+ export declare const fogRef: ({ brushes }: WorldDef) => number;
52
+ /**
53
+ * The fog's optical depth from `eye` to `p`, what the shader integrates: the haze plus the layer,
54
+ * for a world whose fog density is `density` and whose layer sits at `ref`.
55
+ */
56
+ export declare const fogDepth: (density: number, ref: number, eye: Vec3, p: Vec3) => number;
57
+ /** 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. */
58
+ export declare const fogOf: ({ fog, sky }: WorldDef) => [number, number, number, number];
@@ -0,0 +1,69 @@
1
+ import type { Brush, WorldDef } from '../../shared/world';
2
+ export declare const VERT: string;
3
+ export declare const POST_VERT = "#version 300 es\nout vec2 U;void main(){U=vec2(gl_VertexID&1,gl_VertexID>>1)*2.;gl_Position=vec4(U*2.-1.,0,1);}";
4
+ 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);}";
5
+ /**
6
+ * Blinn-Phong strength and exponent: a row per TEX id in order (brick, tile, lava, stone, metal, wood,
7
+ * moss, grate, concrete, glass, steel, paint, rock), then the flat bodies, then polished metal (SHINE),
8
+ * then a glossy shell (GLOSS: broader, so it shows on the armour). Lava and glows never get here: they
9
+ * light themselves.
10
+ */
11
+ export declare const SPEC: number[][];
12
+ /** Bands a metre up the ninja's bracers and shin guards: leather straps one over the next, 4.5 cm each. */
13
+ export declare const BANDS = 22;
14
+ /** Diamonds a metre of the quilting on the trunk of the ninja's armour, along each diagonal: 2.5 cm each. */
15
+ export declare const QUILT = 40;
16
+ /** Folds a metre up the ninja's sash (the user, 2026-11-24: a big cloth belt with folds): 2.6 cm each, wavering round the waist. */
17
+ export declare const PLEATS = 38;
18
+ /** Threads a metre of the woven cloth (WEAVE): 1.6 mm each, coarse enough to show on a runner a few metres off. */
19
+ export declare const PITCH = 620;
20
+ /** Metres a height of 1 in a texture's alpha stands for. */
21
+ export declare const RELIEF = 0.06;
22
+ /** Metres from the eye where the mirrors begin to fade to the sky, and where they end. */
23
+ export declare const MIRROR_NEAR: number[];
24
+ /** Landfall's haze over a pixel `ds` metres from the eye, for what its own code draws (the sea, the smoke). */
25
+ export declare const MIST = "1.-exp(-F.a*ds*(1.+0.02*exp(0.05*(U-E.y))))";
26
+ export declare const FRAG: string;
27
+ /** The scene's uniforms. */
28
+ export declare const UNIFORMS: string[];
29
+ /** The vertex shader's uniforms (VERT): all the depth passes' program reads. */
30
+ export declare const DEPTH_UNIFORMS: string[];
31
+ /** A scene program (fragOf()): its uniforms' places and the arguments last sent to each. */
32
+ export interface Variant {
33
+ p: WebGLProgram;
34
+ u: Record<string, WebGLUniformLocation>;
35
+ sent: Map<string, unknown[]>;
36
+ /** The kind it was made for (fragOf()), to make its twin with the vision's code. */
37
+ kind: string;
38
+ /** For a program with the vision's code (VISION): the one without it that it stands in for. */
39
+ base?: Variant;
40
+ }
41
+ export type Setter = Extract<keyof WebGL2RenderingContext, `uniform${string}`>;
42
+ /** The most boxes the mirrors are tested against: a reflected pixel loops over all of them. */
43
+ export declare const MIRROR_BOXES = 256;
44
+ /** Metres round the eye whose boxes the mirrors reflect, and how far the eye goes before they are chosen again. */
45
+ export declare const MIRROR_REACH = 90;
46
+ export declare const MIRROR_STEP = 10;
47
+ /** The boxes the glass and the steel reflect near (x, z): the map's solid brushes within MIRROR_REACH of it, in the plan. */
48
+ export declare const mirrorBoxes: (brushes: readonly Brush[] | undefined, x: number, z: number) => Brush[];
49
+ /** A map that has glass or steel, so a program that mirrors the boxes (MIRROR). */
50
+ export declare const mirrors: (brushes?: readonly Brush[]) => boolean;
51
+ /**
52
+ * The scene's fragment shader for a map and for what it draws: the moon's globe, stars, craters and
53
+ * orbit fade only where the map has them, the ninja's quilting, cloth, boots and brushed metal only
54
+ * where he is offered (rolesOf()). `LAND` is the map and the sky
55
+ * (the regolith, no skin, armour, hair or chitin), `FLESH` the runners, the vehicles and the
56
+ * effects (no regolith), `ORB` the globe alone, `DEPTH` the shadow maps' depth (a few lines: the
57
+ * 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,
58
+ * code still costs every pixel through the shader's registers: the moon 2.4 ms of GPU a frame on
59
+ * Highline, the ninja's 1.9 ms on three astronauts at 3 m on the moon. `rock` is the GLSL of the
60
+ * map's rocks under BEACH (Decor.rock: Landfall's granite, from its chunk). `sight` adds the
61
+ * vision's filter and its glowing prey (VISION), for a frame in a xenomorph's or the Hunter's
62
+ * vision: its loop and palettes were 4.6 ms a frame on Highline with none ever drawn, 1.4 on
63
+ * Tranquility and none on Landfall, through the registers they take from every pixel.
64
+ */
65
+ export declare const fragOf: (def: Pick<WorldDef, "scenery" | "seam" | "relief" | "helmets"> & Partial<Pick<WorldDef, "brushes">>, kind?: string, rock?: string, sight?: boolean) => string;
66
+ /** A map whose ground takes footprints (createPrints): Landfall's sand, the moon's regolith. */
67
+ export declare const printed: (def: Pick<WorldDef, "scenery" | "relief">) => boolean;
68
+ /** A map with the moon's sky: its globe, stars and craters. Not the beach, whose sand is a relief too. */
69
+ export declare const moonly: (def: Pick<WorldDef, "scenery" | "seam" | "relief">) => boolean;
@@ -0,0 +1,61 @@
1
+ import type { PlayerState } from '../../shared/types';
2
+ /** Pixels high a picture is drawn at least, for a small card's to be smooth. */
3
+ export declare const PICTURE_MIN = 320;
4
+ /** 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). */
5
+ export declare const PORTRAIT: {
6
+ y: number;
7
+ eye: number;
8
+ away: number;
9
+ turn: number;
10
+ sun: number;
11
+ fov: number;
12
+ side: number;
13
+ };
14
+ /** A haircut's picture: the head alone, seen three quarters from behind so a tail or a bun shows. */
15
+ export declare const HEAD: {
16
+ eye: number;
17
+ away: number;
18
+ turn: number;
19
+ fov: number;
20
+ side: number;
21
+ y: number;
22
+ sun: number;
23
+ };
24
+ /** A picture's framing, and whether he grins in it. */
25
+ export type Shot = typeof PORTRAIT & {
26
+ grin?: boolean;
27
+ /** What he holds, over the empty hands of a picture (the character screen's weapon). */
28
+ hold?: Partial<PlayerState>;
29
+ /** Radians he is turned from his usual pose, towards his left: a weapon held ahead then shows across the picture. */
30
+ spin?: number;
31
+ };
32
+ /** An ally's face on the radio screen: the head nearly from the front, grinning. */
33
+ export declare const FACE: Shot;
34
+ /** 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. */
35
+ export declare const MAX_PIXELS: number;
36
+ /** The canvas size in device pixels: the CSS size times the pixel ratio (2 at most), scaled down to MAX_PIXELS. */
37
+ export declare const backing: (cw: number, ch: number, dpr: number) => [number, number];
38
+ /** Throws when the browser has no WebGL2. */
39
+ /**
40
+ * What a renderer builds before its first frame, as steps of a few tens of milliseconds, each kept
41
+ * where every renderer finds it (memoized, or in the GPU store): the runners' skins at every level,
42
+ * now, built on the first runner to come near (the close one with its face's channels takes a
43
+ * tenth of a second) they would stall a frame of the match. So would their armour's recipes (a
44
+ * quarter of a second close up; the own body's, close and of the own `build`, a third of a second
45
+ * on the first frame), the halves a katana's cut makes of each (cut(), some 40 ms for every level
46
+ * and limb), her close hair, every style (half a second for the five: a style can come with a
47
+ * player who joins or change in the menu mid-match), the xenomorph's skins and rigid pieces (its
48
+ * close skull alone took a frame of 70 ms), the racks' weapons and the textures. An armour's
49
+ * recipe is a step of many (preparing()), a slice of its skin at a time. createRenderer()
50
+ * runs them at once; index.ts runs them one task each before, so the loading screen paints on.
51
+ * `own` is the own runner's build, whose first-person body is drawn close: a match's, not the
52
+ * character screen's. `hunter`: the Hunter's pieces too (warmHunter()), which the character
53
+ * screen draws on a tile and a match only once one comes.
54
+ */
55
+ /** A step of a renderer's warm-up: true when it has more to do (it is run again). */
56
+ export type Step = () => boolean | void;
57
+ /** Runs `step` to its end. */
58
+ export declare const through: (step: Step) => void;
59
+ /** A build's skins at the levels runners are drawn at, their armour's recipes and the halves of the cuts. */
60
+ export declare const outfit: (build: number) => Step[];
61
+ export declare const warmSteps: (own?: number, hunter?: boolean) => Step[];
@@ -0,0 +1,74 @@
1
+ import type { Choice, PlayerState, Rover } from '../../shared/types';
2
+ import type { Body } from '../body';
3
+ import type { Tracer } from '../beams';
4
+ import type { Effects } from '../effects';
5
+ import type { CtfScene } from '../flag';
6
+ import type { Light } from '../lights';
7
+ import type { Vec3 } from '../mesh';
8
+ import type { Out } from '../verts';
9
+ import type { Shot } from './shots';
10
+ /** A texture and the framebuffer that draws into it. */
11
+ /** What targets() builds, and how to delete it. */
12
+ export interface Targets {
13
+ made: number[];
14
+ hdr: Target;
15
+ orb: Target | undefined;
16
+ bloom: [Target, Target][];
17
+ msaa: WebGLFramebuffer;
18
+ owned: (() => void)[];
19
+ }
20
+ export interface Target {
21
+ t: WebGLTexture;
22
+ f: WebGLFramebuffer;
23
+ w: number;
24
+ h: number;
25
+ }
26
+ export interface FrameView {
27
+ width: number;
28
+ height: number;
29
+ now: number;
30
+ }
31
+ export interface Renderer {
32
+ /**
33
+ * Draws one frame: the sky, the brushes and the others as seen from eye, then the own `body` over
34
+ * a cleared depth, lit but casting no shadow. colors maps player id to CSS.
35
+ */
36
+ frame(eye: Vec3, yaw: number, pitch: number, others: PlayerState[], colors: ReadonlyMap<number, string>, fx: Effects,
37
+ /** gather() in lights.ts: at most MAX_LIGHTS, the first MAX_SHADOWS shadowed spots mapped, besides the sun. */
38
+ lights: Light[], body?: Body,
39
+ /** The bases, the flags, the racks and the health packs: drawn lit, casting shadows, with the other players. */
40
+ ctf?: CtfScene,
41
+ /** The plasma balls, the flashes and the sparks: they glow and cast no shadow. */
42
+ tracer?: Tracer,
43
+ /** The map's rovers (Predictor.rovers()): drawn lit, casting shadows, with the other players. */
44
+ rovers?: Rover[],
45
+ /** The own player when the camera is not in his head (seated in a rover): drawn whole, like the others. */
46
+ self?: PlayerState,
47
+ /** Adds what else moves in the map (the doors): drawn lit, casting shadows, with the other players. */
48
+ more?: (v: Out) => void, view?: FrameView): boolean;
49
+ /** A world point on screen as of the last frame, in [0, 1] from the top left. */
50
+ project(x: number, y: number, z: number): [number, number] | undefined;
51
+ /** The footsteps of the player `id`'s runner so far (Gait.steps), undefined before it is drawn. */
52
+ steps(id: number): number | undefined;
53
+ /** The muzzle of the long gun of the player `id`'s runner as last drawn, from his feet (Runner.tip). */
54
+ muzzle(id: number): Vec3 | undefined;
55
+ /** The runners of the players `ids` grin for a moment: their team has captured. */
56
+ cheer(ids: number[]): void;
57
+ /** The katana of player `id` struck a ball back, seen `late` s before he is drawn there: his runner parries. */
58
+ parried(id: number, late: number): void;
59
+ /** The xenomorph's vision (the own player is one): a grey-blue world, the enemies in sight glowing. */
60
+ vision(on: boolean): void;
61
+ /** The Hunter's local vision filter and the players it can detect. */
62
+ hunterVision(mode: number, targets: PlayerState[], cold?: PlayerState[]): void;
63
+ /** Let eligible glory kill targets flash during play. */
64
+ edge(on: boolean): void;
65
+ /** 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`. */
66
+ wear(builds: ReadonlyMap<number, number>, looks?: ReadonlyMap<number, Choice>): void;
67
+ /**
68
+ * A picture of the player `p` as the character `build` in `color`, with the skin and haircut
69
+ * `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
70
+ * frame() replaces on the screen. False when nothing could be drawn yet.
71
+ */
72
+ portrait(into: HTMLCanvasElement, p: PlayerState, build: number, color: string, look?: Choice, shot?: Shot): boolean;
73
+ destroy(): void;
74
+ }