@korial29/tiny-fps 0.20.0 → 0.22.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.
@@ -20,7 +20,8 @@ export declare const FOV_DEG = 70;
20
20
  export declare const FOV: number;
21
21
  /**
22
22
  * Blinn-Phong strength and exponent: a row per TEX id in order (brick, tile, lava, stone, metal, wood,
23
- * moss, grate), then the flat bodies. Lava and glows never get here: they light themselves.
23
+ * moss, grate, concrete, glass, steel, paint), then the flat bodies. Lava and glows never get here:
24
+ * they light themselves.
24
25
  */
25
26
  export declare const SPEC: number[][];
26
27
  /**
@@ -74,6 +75,10 @@ export declare const level: (world: World) => number[];
74
75
  * blue-grey and not blue, and dimmer on the sides and below.
75
76
  */
76
77
  export declare const daylight: ({ sky: [zenith, horizon] }: WorldDef) => Vec3[];
78
+ /** The world as it is drawn: its brushes and a distant city around them. The physics knows only the brushes. */
79
+ export declare const city: (world: World) => World;
80
+ /** All the map's vertices, drawn once: the city, the brushes, the runner's red and the team zones. */
81
+ export declare const scenery: (world: World) => number[];
77
82
  /** 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. */
78
83
  export declare const fogOf: ({ fog, sky }: WorldDef) => [number, number, number, number];
79
84
  export interface Renderer {
@@ -0,0 +1,3 @@
1
+ import type { Brush, WorldDef } from '../shared/world';
2
+ /** The towers of a world's skyline, centred on its play area; the same ones every time. */
3
+ export declare const skyline: ({ brushes }: WorldDef) => Brush[];
@@ -1,4 +1,6 @@
1
1
  export declare const SIZE = 128;
2
2
  export declare const LAYERS: number;
3
+ /** Integer hash of a lattice point to [0, 1). */
4
+ export declare const hash: (x: number, y: number, s: number) => number;
3
5
  /** All layers, RGBA, layer after layer, rows top to bottom: the upload of a texture array. */
4
6
  export declare const textures: () => Uint8ClampedArray;
@@ -0,0 +1,17 @@
1
+ import type { Brush, WorldDef } from '../shared/world';
2
+ /** A side of a brush: its axis (0 x, 2 z) and 1 for its max, 0 for its min. */
3
+ export type Side = [axis: number, up: number];
4
+ export interface Use {
5
+ /** The whole brush is red. */
6
+ beam: boolean;
7
+ /** Top edges to band. */
8
+ lips: Side[];
9
+ /** Faces to stripe at hand height. */
10
+ stripes: Side[];
11
+ }
12
+ /** What a runner can use on brush `b` of the world `def`. */
13
+ export declare const uses: ({ brushes, floor }: WorldDef, b: Brush) => Use;
14
+ /** The red of every use in the world, in the map's vertex format (layer -2 glows, -1 is lit). */
15
+ export declare const vision: (def: WorldDef) => number[];
16
+ /** A square on each team's roof around its base, lit paint of the team's colour: pale inside, a strong frame. */
17
+ export declare const zones: ({ teams }: WorldDef) => number[];
@@ -1,4 +1,5 @@
1
1
  import type { WorldDef } from './world';
2
+ type Vec3 = [number, number, number];
2
3
  /**
3
4
  * A parkour test course, laid out for the moves of step 3 and flown with them by test/lines.ts.
4
5
  * Metres, y up, the course runs north (toward -z). A walking jump flies about 4.2 m on the flat, a
@@ -19,3 +20,7 @@ import type { WorldDef } from './world';
19
20
  * the same line in reverse, then a drop to B and the A gap jumped south.
20
21
  */
21
22
  export declare const ROOFTOPS: WorldDef;
23
+ /** The two team tints, red then blue. */
24
+ export declare const TEAM_TINT: Vec3[];
25
+ export declare const HIGHLINE: WorldDef;
26
+ export {};
@@ -150,6 +150,14 @@ export declare const TEX: {
150
150
  readonly MOSS: 6;
151
151
  /** Metal floor grating over darkness. */
152
152
  readonly GRATE: 7;
153
+ /** White precast concrete in 1 m panels: the roofs and walls. */
154
+ readonly CONCRETE: 8;
155
+ /** Dark blue glass in steel frames; the shader adds the sky's reflection. */
156
+ readonly GLASS: 9;
157
+ /** Brushed steel. */
158
+ readonly STEEL: 10;
159
+ /** A near white painted panel: the brush tint is its colour. */
160
+ readonly PAINT: 11;
153
161
  };
154
162
  /** One player in a snapshot: the state (its ev and fall read 0) and the ack. */
155
163
  export interface SnapPlayer extends PlayerState {
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.20.0",
5
+ "version": "0.22.0",
6
6
  "type": "module",
7
7
  "files": [
8
8
  "dist"