@matchomag/cs2-replay 0.0.0-stage → 0.3.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.
Files changed (74) hide show
  1. package/FORMAT.md +350 -0
  2. package/README.md +453 -2
  3. package/bin/demo-replay-darwin-amd64 +0 -0
  4. package/bin/demo-replay-darwin-arm64 +0 -0
  5. package/bin/demo-replay-linux-amd64 +0 -0
  6. package/bin/demo-replay-linux-arm64 +0 -0
  7. package/bin/demo-replay-windows-amd64.exe +0 -0
  8. package/bin/demo-replay.js +22 -0
  9. package/dist/2d/index.js +1 -0
  10. package/dist/3d/index.js +11 -0
  11. package/dist/chunks/actors-EZRYEB4I.js +177 -0
  12. package/dist/chunks/chunk-5BFKVD63.js +1 -0
  13. package/dist/chunks/chunk-D5ST2XVO.js +106 -0
  14. package/dist/chunks/chunk-DQPOBPMK.js +1 -0
  15. package/dist/chunks/chunk-FBSLUYGT.js +1 -0
  16. package/dist/chunks/chunk-Q37CWKZX.js +12 -0
  17. package/dist/chunks/chunk-VSIECNZM.js +1 -0
  18. package/dist/chunks/chunk-YJG3LSSB.js +1 -0
  19. package/dist/chunks/chunk-YO73RW3Y.js +1 -0
  20. package/dist/chunks/look-2WBUGHMJ.js +669 -0
  21. package/dist/index.js +1 -0
  22. package/dist/maps/index.js +1 -0
  23. package/dist/parse/index.js +1 -0
  24. package/dist/parse/wasm/replay.wasm +0 -0
  25. package/dist/parse/worker.js +1 -0
  26. package/dist/types/2d/index.d.ts +17 -0
  27. package/dist/types/2d/radar.d.ts +35 -0
  28. package/dist/types/3d/actors.d.ts +90 -0
  29. package/dist/types/3d/characters/anim.d.ts +93 -0
  30. package/dist/types/3d/characters/ao.d.ts +3 -0
  31. package/dist/types/3d/characters/body.d.ts +37 -0
  32. package/dist/types/3d/characters/builder.d.ts +82 -0
  33. package/dist/types/3d/characters/index.d.ts +74 -0
  34. package/dist/types/3d/characters/rig.d.ts +73 -0
  35. package/dist/types/3d/characters/textures.d.ts +4 -0
  36. package/dist/types/3d/characters/viewmodel.d.ts +51 -0
  37. package/dist/types/3d/characters/weapons.d.ts +25 -0
  38. package/dist/types/3d/follow.d.ts +43 -0
  39. package/dist/types/3d/fx/batch.d.ts +87 -0
  40. package/dist/types/3d/fx/context.d.ts +34 -0
  41. package/dist/types/3d/fx/explosion.d.ts +14 -0
  42. package/dist/types/3d/fx/fire.d.ts +11 -0
  43. package/dist/types/3d/fx/index.d.ts +84 -0
  44. package/dist/types/3d/fx/lights.d.ts +25 -0
  45. package/dist/types/3d/fx/meshes.d.ts +18 -0
  46. package/dist/types/3d/fx/misc.d.ts +15 -0
  47. package/dist/types/3d/fx/random.d.ts +21 -0
  48. package/dist/types/3d/fx/smoke.d.ts +10 -0
  49. package/dist/types/3d/fx/textures.d.ts +29 -0
  50. package/dist/types/3d/fx/types.d.ts +117 -0
  51. package/dist/types/3d/greybox.d.ts +22 -0
  52. package/dist/types/3d/index.d.ts +127 -0
  53. package/dist/types/3d/look.d.ts +49 -0
  54. package/dist/types/3d/markers.d.ts +23 -0
  55. package/dist/types/3d/smoke/volume.d.ts +95 -0
  56. package/dist/types/3d/smoke/voxels.d.ts +87 -0
  57. package/dist/types/3d/world/index.d.ts +179 -0
  58. package/dist/types/3d/world/look.d.ts +16 -0
  59. package/dist/types/3d/world/material.d.ts +128 -0
  60. package/dist/types/3d/world/post.d.ts +75 -0
  61. package/dist/types/3d/world/probes.d.ts +39 -0
  62. package/dist/types/3d/world/release.d.ts +28 -0
  63. package/dist/types/3d/world/stage.d.ts +84 -0
  64. package/dist/types/core/format.d.ts +163 -0
  65. package/dist/types/core/live.d.ts +115 -0
  66. package/dist/types/core/model.d.ts +164 -0
  67. package/dist/types/core/playback.d.ts +82 -0
  68. package/dist/types/core/theme.d.ts +46 -0
  69. package/dist/types/index.d.ts +6 -0
  70. package/dist/types/maps/index.d.ts +258 -0
  71. package/dist/types/parse/index.d.ts +108 -0
  72. package/dist/types/ui/shell.d.ts +131 -0
  73. package/dist/types/ui/styles.d.ts +1 -0
  74. package/package.json +68 -4
@@ -0,0 +1,43 @@
1
+ import type { Replay } from "../core/format";
2
+ import type { PlayerState } from "../core/model";
3
+ /** "first": the followed player's eyes and aim. "third": behind them. "free": the fly or orbit camera. */
4
+ export type CameraView = "first" | "third" | "free";
5
+ /** The order of the view switch, and what V cycles through. */
6
+ export declare const CAMERA_VIEWS: readonly CameraView[];
7
+ /**
8
+ * The next (dir 1) or previous (dir -1) alive player after `current` in roster order,
9
+ * wrapping around. `current` itself when nobody else is alive, null when nobody is.
10
+ */
11
+ export declare function cyclePlayer(players: readonly PlayerState[], current: number | null, dir: 1 | -1): number | null;
12
+ /** Who 1st/3rd follows when nobody is followed: the last one followed while they're on the server, else the first alive player. */
13
+ export declare function defaultPlayer(players: readonly PlayerState[], last: number | null): number | null;
14
+ /** a − b, wrapped to (−π, π]. */
15
+ export declare function angleDelta(a: number, b: number): number;
16
+ /** One shot's kick `age` seconds after it: up in 15 ms, then decaying (about a third left after 0.1 s). */
17
+ export declare function kick(age: number): number;
18
+ /**
19
+ * First-person pitch. Positions carry only yaw, but shots carry the view angles, so the
20
+ * camera takes each gunshot's pitch and eases back to level 1–2 s after it, the way the
21
+ * game look's characters aim. Level all the time for replays without shots.
22
+ */
23
+ export declare class ShotAim {
24
+ private replay;
25
+ private byPlayer;
26
+ private grenade;
27
+ private knife;
28
+ private shots;
29
+ constructor(replay: Pick<Replay, "players" | "weapons" | "ticks" | "tickRate" | "shots">);
30
+ /** Picks up what a live replay added: players, weapons and shots. */
31
+ sync(): void;
32
+ /** Degrees, positive up, at fractional frame `t`. */
33
+ pitch(player: number, t: number): number;
34
+ /**
35
+ * How hard the player's gun is kicking at `t`: 0 at rest, 1 at the peak of a single shot,
36
+ * building up to at most 2 over a spray, where the shots' kicks overlap. Knife swings and
37
+ * grenade throws don't kick. The first-person weapon and camera punch scale with it.
38
+ */
39
+ recoil(player: number, t: number): number;
40
+ /** Index into `list` of the player's last shot at or before `tick`, -1 if none. */
41
+ private lastAt;
42
+ private tickAt;
43
+ }
@@ -0,0 +1,87 @@
1
+ import * as THREE from "three";
2
+ /** Particle types. */
3
+ export declare const LIT = 0;
4
+ export declare const UNLIT = 1;
5
+ export declare const GLOW = 2;
6
+ export declare const HEAT = 3;
7
+ /** Orientation modes. */
8
+ export declare const BILLBOARD = 0;
9
+ export declare const AXIS = 1;
10
+ export declare const FLAT = 2;
11
+ export interface ParticleLighting {
12
+ sunDir: THREE.Vector3;
13
+ sunColor: THREE.Color;
14
+ sky: THREE.Color;
15
+ ground: THREE.Color;
16
+ ambient: THREE.Color;
17
+ }
18
+ /** The scratch particle emitters fill (see ParticleBatch.start). World space, metres. */
19
+ export declare class Particle {
20
+ type: number;
21
+ cell: number;
22
+ x: number;
23
+ y: number;
24
+ z: number;
25
+ /** Rotation in the sprite plane (radians). */
26
+ rot: number;
27
+ /** Width (u) and height (v); for AXIS, w is the length along the axis. */
28
+ w: number;
29
+ h: number;
30
+ /** Linear colour (LIT: albedo; GLOW: emission; HEAT: tint of the ramp) and opacity/intensity. */
31
+ r: number;
32
+ g: number;
33
+ b: number;
34
+ a: number;
35
+ /** BILLBOARD | AXIS | FLAT, with the axis (AXIS) or plane normal (FLAT); normalised on push. */
36
+ mode: number;
37
+ ax: number;
38
+ ay: number;
39
+ az: number;
40
+ /** LIT/UNLIT: erosion threshold 0..1 (1 = gone). */
41
+ erode: number;
42
+ /** HEAT: input of the colour ramp (~0.2 deep orange .. 1 yellow .. 1.5 white). */
43
+ heat: number;
44
+ /** LIT: transmittance towards the sun and ambient occlusion, 0..1. */
45
+ sunT: number;
46
+ amb: number;
47
+ /** GLOW/HEAT: how much the sprite also hides what's behind it (0 = purely additive). */
48
+ occlude: number;
49
+ /** Floor height under the particle, for a soft contact fade. */
50
+ ground: number;
51
+ /** LIT/UNLIT: added emission, linear. */
52
+ er: number;
53
+ eg: number;
54
+ eb: number;
55
+ /** Scales the fade near the camera: a sprite drawn shrunk towards the eye by k (a first-person flash) uses k. */
56
+ near: number;
57
+ }
58
+ export declare class ParticleBatch {
59
+ readonly mesh: THREE.Mesh;
60
+ readonly capacity: number;
61
+ /** Scratch particle, see start(). */
62
+ readonly p: Particle;
63
+ /** Particles written this frame. */
64
+ count: number;
65
+ private staging;
66
+ private gpu;
67
+ private buffer;
68
+ private geometry;
69
+ private material;
70
+ private keys;
71
+ constructor(capacity: number, lights: number, smokeAtlas: THREE.Texture, glowAtlas: THREE.Texture);
72
+ begin(): void;
73
+ /**
74
+ * Starts a particle: resets the scratch particle `p` to defaults and returns it. Set its
75
+ * fields, then call push(). (Filling an object instead of passing a dozen numbers keeps
76
+ * the per-particle path free of allocations: V8 boxes doubles passed to calls it doesn't
77
+ * inline, but updates double fields in place.)
78
+ */
79
+ start(type: number, cell: number): Particle;
80
+ /** Writes the scratch particle. Dropped when the batch is full or it's invisible. */
81
+ push(): void;
82
+ setLighting(l: ParticleLighting): void;
83
+ setLight(i: number, x: number, y: number, z: number, r: number, g: number, b: number, distance: number): void;
84
+ /** Sorts back to front and uploads. */
85
+ finish(camPos: THREE.Vector3, camDir: THREE.Vector3): void;
86
+ dispose(): void;
87
+ }
@@ -0,0 +1,34 @@
1
+ import type * as THREE from "three";
2
+ import type { GrenadeKind } from "../../core/model";
3
+ import type { ParticleBatch } from "./batch";
4
+ import type { LightPool } from "./lights";
5
+ import type { PropBatch } from "./meshes";
6
+ /** What every emitter gets: write-only sinks for this frame plus a few frame constants. */
7
+ export interface FxContext {
8
+ batch: ParticleBatch;
9
+ lights: LightPool;
10
+ props: Record<GrenadeKind, PropBatch>;
11
+ brass: PropBatch | null;
12
+ bomb: PropBatch;
13
+ high: boolean;
14
+ camPos: THREE.Vector3;
15
+ /** Unit vector towards the sun. */
16
+ sunDir: THREE.Vector3;
17
+ /** Replay time in seconds (only used where no effect age exists, e.g. projectile spin). */
18
+ time: number;
19
+ projectileScale: number;
20
+ bombScale: number;
21
+ /** Eye-to-muzzle offset: forward, right, up (metres). */
22
+ muzzle: [number, number, number];
23
+ }
24
+ /** Light priorities: who keeps a pool light when there are more requests than lights. */
25
+ export declare const PRIORITY: {
26
+ readonly bombBlast: 100;
27
+ readonly he: 90;
28
+ readonly flash: 85;
29
+ readonly fire: 60;
30
+ readonly molotov: 45;
31
+ readonly bombLed: 40;
32
+ readonly muzzle: 25;
33
+ readonly decoy: 15;
34
+ };
@@ -0,0 +1,14 @@
1
+ import type * as THREE from "three";
2
+ import { type FxContext } from "./context";
3
+ export declare const HE_DURATION = 3;
4
+ export declare const BOMB_BLAST_DURATION = 8;
5
+ export declare const FLASH_DURATION = 0.6;
6
+ /** Seconds an explosion of this scale stays visible. */
7
+ export declare const blastDuration: (scale: number) => 3 | 8;
8
+ /**
9
+ * HE grenade (scale 1) or bomb (scale ~2.6): light flash, fireball, ground shockwave,
10
+ * dust ring, sparks, debris and a smoke puff that lingers and erodes.
11
+ */
12
+ export declare function explosion(ctx: FxContext, id: number, pos: THREE.Vector3, age: number, scale: number): void;
13
+ /** Flashbang: an intense white burst with a star flare, a halo, sparks and a small puff. */
14
+ export declare function flash(ctx: FxContext, id: number, pos: THREE.Vector3, age: number): void;
@@ -0,0 +1,11 @@
1
+ import type * as THREE from "three";
2
+ import { type FxContext } from "./context";
3
+ /** Seconds the scorch mark stays (fading) after the fire is out. */
4
+ export declare const FIRE_TAIL = 4;
5
+ /**
6
+ * Molotov / incendiary fire: flame patches spreading out over the first second,
7
+ * additive flame tongues, embers, dark smoke, a ground glow, a flickering warm
8
+ * light and a scorch mark that outlives the fire by FIRE_TAIL seconds.
9
+ * `remaining` may go negative (time since the fire went out).
10
+ */
11
+ export declare function fire(ctx: FxContext, id: number, pos: THREE.Vector3, age: number, remaining: number): void;
@@ -0,0 +1,84 @@
1
+ import * as THREE from "three";
2
+ import type { GrenadeKind } from "../../core/model";
3
+ import type { SmokeVolumes } from "../smoke/volume";
4
+ import type { EffectsOptions, FxFrame, FxLighting } from "./types";
5
+ export type { EffectsOptions, FxBlast, FxBomb, FxFrame, FxGrenade, FxLighting, FxShot } from "./types";
6
+ export { BOMB_BLAST_DURATION, FLASH_DURATION, HE_DURATION } from "./explosion";
7
+ export { FIRE_TAIL } from "./fire";
8
+ export { SMOKE_FADE } from "./smoke";
9
+ /**
10
+ * How long after a grenade's effect starts it should keep being passed to update(),
11
+ * given the effect's duration in the replay data (effectEnd - effectAt, 0 for flash/HE).
12
+ * Burst effects outlive their data window; fires leave a scorch mark behind.
13
+ */
14
+ export declare function fxDuration(kind: GrenadeKind, dataDuration: number): number;
15
+ /**
16
+ * Effect class for a weapon name from `replay.weapons` (e.g. "AK-47", "AWP", "Nova"),
17
+ * or null for weapon_fire events that aren't gunshots (knives, grenades, C4, Zeus).
18
+ */
19
+ export declare function weaponClass(name: string): "pistol" | "smg" | "rifle" | "heavy" | "sniper" | "shotgun" | null;
20
+ /**
21
+ * World direction of a view angle from the replay (degrees; yaw 0 = game +x, pitch > 0
22
+ * looks down), using `toWorld`'s axes: game (x, y, z) -> world (y, z, x).
23
+ */
24
+ export declare function shotDirection(yawDeg: number, pitchDeg: number, out?: THREE.Vector3): THREE.Vector3;
25
+ /**
26
+ * Real-time grenade, bomb and gunfire effects for the 3D view. Add `object` to the
27
+ * scene once and call update() every frame. Everything is a deterministic function
28
+ * of the inputs (ages, positions, replay time), so seeking and pausing just work.
29
+ */
30
+ export declare class EffectsSystem {
31
+ readonly object: THREE.Group<THREE.Object3DEventMap>;
32
+ private batch;
33
+ private pool;
34
+ private smokeAtlas;
35
+ private glowAtlas;
36
+ private propMaterial;
37
+ private props;
38
+ private brass;
39
+ private bombProp;
40
+ private ctx;
41
+ private showBomb;
42
+ private lighting;
43
+ private sunDir;
44
+ private sunColor;
45
+ private sky;
46
+ private groundCol;
47
+ private ambient;
48
+ private particleLighting;
49
+ private vel;
50
+ private velOut;
51
+ private frameNo;
52
+ private volumes;
53
+ private smokeInputs;
54
+ private onLight;
55
+ constructor(opts?: EffectsOptions);
56
+ /**
57
+ * Compiles the effect shaders now instead of on first use (props stay hidden until a
58
+ * grenade appears, which would otherwise compile them mid-replay). Call once the
59
+ * object is in the scene, with the scene's lights in place. Pass the render target the
60
+ * scene is drawn into (e.g. the composer's HDR buffer): tone mapping and colour space
61
+ * are part of a program, so compiling against the canvas builds the wrong variant.
62
+ */
63
+ compile(renderer: THREE.WebGLRenderer, camera: THREE.Camera, scene?: THREE.Scene, target?: THREE.WebGLRenderTarget | null): void;
64
+ /**
65
+ * Render smokes as volumes (GameStage.smoke) instead of billboard puffs: they fill
66
+ * the game's voxel grid around walls and are ray-marched against the scene depth.
67
+ */
68
+ setSmokeVolumes(v: SmokeVolumes | null): void;
69
+ /** Point the smoke shading at the scene's lights (read again on every update). */
70
+ setLighting(l: FxLighting): void;
71
+ /** Particles and pool lights used by the last update. */
72
+ get stats(): {
73
+ particles: number;
74
+ particleCapacity: number;
75
+ lights: number;
76
+ lightRequests: number;
77
+ lightPool: number;
78
+ };
79
+ update(frame: FxFrame): void;
80
+ private resolveLighting;
81
+ /** Velocity from the previous frame's position; works for forward and backward playback, kept while paused. */
82
+ private estimateVelocity;
83
+ dispose(): void;
84
+ }
@@ -0,0 +1,25 @@
1
+ import * as THREE from "three";
2
+ export declare class LightPool {
3
+ readonly lights: THREE.PointLight[];
4
+ readonly group: THREE.Group<THREE.Object3DEventMap>;
5
+ /** Requests this frame (including those that didn't get a light). */
6
+ requests: number;
7
+ /** Lights in use after commit(). */
8
+ used: number;
9
+ private req;
10
+ private order;
11
+ private score;
12
+ constructor(count: number);
13
+ begin(): void;
14
+ /**
15
+ * Asks for a light this frame. Intensity is in candela (three.js physical units),
16
+ * colour is linear; `priority` decides who gets a light when the pool is full.
17
+ */
18
+ request(x: number, y: number, z: number, r: number, g: number, b: number, intensity: number, distance: number, priority: number): void;
19
+ /**
20
+ * Hands the pool's lights to the most important requests: priority first, then the
21
+ * apparent brightness at the camera. `onLight` mirrors each slot (e.g. into shader uniforms).
22
+ */
23
+ commit(cam: THREE.Vector3, onLight?: (i: number, x: number, y: number, z: number, r: number, g: number, b: number, distance: number) => void): void;
24
+ dispose(): void;
25
+ }
@@ -0,0 +1,18 @@
1
+ import * as THREE from "three";
2
+ import type { GrenadeKind } from "../../core/model";
3
+ export declare function grenadeGeometry(kind: GrenadeKind): THREE.BufferGeometry;
4
+ /** Planted-bomb prop (original design): charge block, tape, control box with keypad. */
5
+ export declare const BOMB_LED: THREE.Vector3;
6
+ export declare function bombGeometry(): THREE.BufferGeometry;
7
+ export declare function brassGeometry(): THREE.BufferGeometry;
8
+ export declare const PROP_KINDS: GrenadeKind[];
9
+ /** An InstancedMesh refilled every frame. */
10
+ export declare class PropBatch {
11
+ readonly mesh: THREE.InstancedMesh;
12
+ count: number;
13
+ constructor(geo: THREE.BufferGeometry, mat: THREE.Material, capacity: number, name: string);
14
+ begin(): void;
15
+ add(x: number, y: number, z: number, q: THREE.Quaternion, scale: number): void;
16
+ finish(): void;
17
+ dispose(): void;
18
+ }
@@ -0,0 +1,15 @@
1
+ import * as THREE from "three";
2
+ import type { GrenadeKind } from "../../core/model";
3
+ import { type FxContext } from "./context";
4
+ import type { FxBomb, FxShot } from "./types";
5
+ /** Decoy: the canister on the floor, popping in bursts like distant gunfire. */
6
+ export declare function decoy(ctx: FxContext, id: number, p: THREE.Vector3, age: number, remaining: number): void;
7
+ /**
8
+ * A grenade in flight: its prop, spinning (from replay time), a faint streak behind it,
9
+ * and for a molotov a burning rag with a small light. `v` is world velocity in m/s.
10
+ */
11
+ export declare function projectile(ctx: FxContext, id: number, kind: GrenadeKind, p: THREE.Vector3, v: THREE.Vector3 | null): void;
12
+ /** The bomb prop, its blinking LED and light, the defuse confirmation and the explosion. */
13
+ export declare function bomb(ctx: FxContext, bm: FxBomb, showProp: boolean): void;
14
+ /** One shot: muzzle flash (sprite + side flare + light), tracer(s), brass and an impact spark. */
15
+ export declare function shot(ctx: FxContext, s: FxShot): void;
@@ -0,0 +1,21 @@
1
+ /** Uniform [0, 1) from up to three integers. */
2
+ export declare function hash(a: number, b?: number, c?: number): number;
3
+ /**
4
+ * Fills out[0..n) with uniform [0, 1) values for (a, b): a particle's random vector in one
5
+ * call. Reading them from a typed array avoids the boxed double a non-inlined hash() returns.
6
+ */
7
+ export declare function fillRand(a: number, b: number, out: Float64Array, n: number): void;
8
+ /** Signed [-1, 1) variant. */
9
+ export declare const hashS: (a: number, b?: number, c?: number) => number;
10
+ export declare const clamp01: (x: number) => number;
11
+ export declare const lerp: (a: number, b: number, k: number) => number;
12
+ export declare function smoothstep(e0: number, e1: number, x: number): number;
13
+ export declare const easeOutCubic: (k: number) => number;
14
+ /** 1 - e^(-t/tau): fast start, settles at 1. */
15
+ export declare const approach: (t: number, tau: number) => number;
16
+ /** A bump 0 -> 1 -> 0 over k in [0, 1]. */
17
+ export declare const bump: (k: number) => number;
18
+ /** The shader's blackbody-ish ramp (batch.ts heatRamp), for emissive smoke. Writes into out[0..2]. */
19
+ export declare function heatRamp(h: number, out: Float64Array): Float64Array;
20
+ /** Cheap smooth pseudo-noise from summed sines; deterministic in t. Range about [-1, 1]. */
21
+ export declare function flicker(t: number, seed: number): number;
@@ -0,0 +1,10 @@
1
+ import type * as THREE from "three";
2
+ import type { FxContext } from "./context";
3
+ /** Seconds a smoke takes to thin out and dissolve at the end. */
4
+ export declare const SMOKE_FADE = 2.6;
5
+ /**
6
+ * A smoke grenade cloud: lit billboard puffs filling a squat dome (~3.5 m radius,
7
+ * ~3 m tall). Puffs bloom out of the canister over ~1.2 s, churn slowly, and in the
8
+ * last SMOKE_FADE seconds erode away from the outside in.
9
+ */
10
+ export declare function smokeCloud(ctx: FxContext, id: number, pos: THREE.Vector3, age: number, remaining: number, tint: THREE.Color | undefined): void;
@@ -0,0 +1,29 @@
1
+ import * as THREE from "three";
2
+ export declare const ATLAS_N = 4;
3
+ /** Cells of the smoke atlas: RGB = sprite-space normal, A = density. */
4
+ export declare const SMOKE: {
5
+ readonly puff: 0;
6
+ readonly puffs: 6;
7
+ readonly wisp: 6;
8
+ readonly dust: 8;
9
+ readonly chunk: 10;
10
+ readonly soft: 11;
11
+ readonly scorch: 12;
12
+ };
13
+ /** Cells of the glow atlas: luminance in every channel. */
14
+ export declare const GLOW: {
15
+ readonly soft: 0;
16
+ readonly core: 1;
17
+ readonly streak: 2;
18
+ readonly star4: 3;
19
+ readonly star6: 4;
20
+ readonly ring: 5;
21
+ readonly muzzle: 6;
22
+ readonly muzzleSide: 7;
23
+ readonly flame: 8;
24
+ readonly fireball: 12;
25
+ readonly disc: 14;
26
+ readonly tracer: 15;
27
+ };
28
+ export declare function createSmokeAtlas(): THREE.DataTexture;
29
+ export declare function createGlowAtlas(): THREE.DataTexture;
@@ -0,0 +1,117 @@
1
+ import type * as THREE from "three";
2
+ import type { GrenadeKind } from "../../core/model";
3
+ /** World units are metres, Y up (see `toWorld`). */
4
+ export interface FxGrenade {
5
+ /** Stable per grenade (e.g. its index in replay.grenades); seeds the effect's randomness. */
6
+ id: number;
7
+ kind: GrenadeKind;
8
+ /** Projectile position while it flies, else null. */
9
+ projectile: THREE.Vector3 | null;
10
+ /** Projectile velocity (m/s) for the trail. Estimated from consecutive frames when left out. */
11
+ velocity?: THREE.Vector3 | null;
12
+ effect: {
13
+ kind: GrenadeKind;
14
+ position: THREE.Vector3;
15
+ /** Seconds since the effect started. */
16
+ age: number;
17
+ /**
18
+ * Seconds until the effect ends. May go negative to show the aftermath: a fire's
19
+ * scorch mark stays FIRE_TAIL s after it went out (see `fxDuration`).
20
+ */
21
+ remaining: number;
22
+ burst: number;
23
+ } | null;
24
+ /** Theme colour (linear); tints smoke slightly. */
25
+ color?: THREE.Color;
26
+ /**
27
+ * Smokes: the game's voxel cloud (grid centre in world metres, keyframe bytes). With
28
+ * smoke volumes set (setSmokeVolumes) smokes render volumetrically, filling around
29
+ * walls; without data the cloud is built from the map.
30
+ */
31
+ voxels?: {
32
+ center: THREE.Vector3;
33
+ data: Uint8Array;
34
+ } | null;
35
+ }
36
+ /** An HE explosion, for clearing smoke volumes. */
37
+ export interface FxBlast {
38
+ position: THREE.Vector3;
39
+ /** Seconds since it went off (smoke refills over ~5 s). */
40
+ age: number;
41
+ }
42
+ export interface FxShot {
43
+ /** Stable per shot; seeds flash shape, spread and brass. */
44
+ id: number;
45
+ /** Eye position of the shooter (see the `muzzleOffset` option). */
46
+ origin: THREE.Vector3;
47
+ direction: THREE.Vector3;
48
+ /** Seconds since the shot. Shots stay visible for ~1.5 s (tracer, brass). */
49
+ age: number;
50
+ /** pistol | smg | rifle | heavy | sniper | shotgun (default rifle). */
51
+ weaponClass?: string;
52
+ /** Distance to what the bullet hit (m): ends the tracer there and adds impact sparks. Default: 60 m, no impact. */
53
+ distance?: number;
54
+ /** Floor height under the shooter, for brass. Default origin.y - 1.6. */
55
+ groundY?: number;
56
+ /** The muzzle's world position, instead of `origin` plus the `muzzleOffset` option. */
57
+ muzzle?: THREE.Vector3;
58
+ /**
59
+ * The camera's own shot, from a first-person weapon drawn shrunk towards the eye by
60
+ * `scale` (see Viewmodel): the flash and its light are drawn shrunk the same way, at the
61
+ * weapon's muzzle and in front of walls; the tracer leaves from the true `muzzle`. No brass.
62
+ */
63
+ view?: {
64
+ eye: THREE.Vector3;
65
+ scale: number;
66
+ };
67
+ /** Draw the muzzle flash and its light (default true). */
68
+ flash?: boolean;
69
+ }
70
+ export interface FxBomb {
71
+ state: "hidden" | "carried" | "dropped" | "planted" | "defused" | "exploded";
72
+ position: THREE.Vector3;
73
+ sincePlant: number;
74
+ /** Seconds since the explosion; defaults to sincePlant - 40. */
75
+ sinceExplode?: number;
76
+ /** Seconds since the defuse, for a short confirmation pulse. */
77
+ sinceDefuse?: number;
78
+ }
79
+ export interface FxFrame {
80
+ /** Seconds since the last frame (0 while paused). Effects don't integrate it; they're functions of age. */
81
+ dt: number;
82
+ /** Replay time in seconds; drives projectile spin. */
83
+ time: number;
84
+ camera: THREE.Camera;
85
+ /** Direction towards the sun; overrides the light set with setLighting(). */
86
+ sunDirection?: THREE.Vector3;
87
+ grenades: FxGrenade[];
88
+ shots: FxShot[];
89
+ bomb: FxBomb | null;
90
+ /** Recent HE explosions (up to ~7 s old): they clear holes in volumetric smoke. */
91
+ blasts?: FxBlast[];
92
+ }
93
+ export interface EffectsOptions {
94
+ /** Size of the fixed point-light pool (default 6, 4 on low quality). */
95
+ maxLights?: number;
96
+ quality?: "low" | "high";
97
+ /** Scale of grenade props in flight; >1 keeps them visible from replay distances (default 1.6). */
98
+ projectileScale?: number;
99
+ /** Scale of the bomb prop (default 1.3). */
100
+ bombScale?: number;
101
+ /** Draw the bomb prop (default true). Turn off to keep your own bomb mesh; the LED and effects stay. */
102
+ bombModel?: boolean;
103
+ /** Eye -> muzzle offset as [forward, right, up] metres (default [0.55, 0.12, -0.12]; use [0, 0, 0] if shot origins are muzzles). */
104
+ muzzleOffset?: [number, number, number];
105
+ /** Ejected brass (default true on high quality). */
106
+ brass?: boolean;
107
+ }
108
+ export interface FxLighting {
109
+ /** The scene's sun: direction, colour and intensity are read every update. */
110
+ sun?: THREE.DirectionalLight | null;
111
+ /** The scene's hemisphere fill. */
112
+ hemi?: THREE.HemisphereLight | null;
113
+ /** Extra flat ambient (e.g. what the environment map adds), linear colour × intensity. */
114
+ ambient?: THREE.Color | null;
115
+ /** Multiplies all smoke lighting (default 1). */
116
+ smokeBrightness?: number;
117
+ }
@@ -0,0 +1,22 @@
1
+ import * as THREE from "three";
2
+ import type { MapStage, StageMap } from "./look";
3
+ /**
4
+ * The grey-box look: a flat-shaded map drawn straight to the canvas, lit by a sky fill
5
+ * and a sun. Players and effects are tone mapped (ACES) so the characters' materials and
6
+ * the effects look right; the map isn't, so it keeps its flat colours.
7
+ */
8
+ export declare class GreyboxStage implements MapStage {
9
+ private gl;
10
+ private scene;
11
+ private camera;
12
+ readonly prepareFirst = false;
13
+ readonly game: null;
14
+ readonly fill: THREE.HemisphereLight;
15
+ readonly sun: THREE.DirectionalLight;
16
+ private root;
17
+ constructor(gl: THREE.WebGLRenderer, scene: THREE.Scene, camera: THREE.Camera);
18
+ load(url: string, _prepare: null, arrived?: () => void): Promise<StageMap>;
19
+ render(): void;
20
+ setSize(): void;
21
+ dispose(): void;
22
+ }