@quake2ts/engine 0.0.869 → 0.0.873

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.
@@ -4,6 +4,10 @@ var shared = require('@quake2ts/shared');
4
4
  var oggVorbis = require('@wasm-audio-decoders/ogg-vorbis');
5
5
  var glMatrix = require('gl-matrix');
6
6
 
7
+ var __defProp = Object.defineProperty;
8
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
10
+
7
11
  // src/loop.ts
8
12
  var DEFAULT_FIXED_DELTA_MS = 25;
9
13
  var DEFAULT_MAX_SUBSTEPS = 5;
@@ -18,10 +22,12 @@ var defaultScheduler = (tick) => {
18
22
  var FixedTimestepLoop = class {
19
23
  constructor(callbacks, options = {}) {
20
24
  this.callbacks = callbacks;
21
- this.accumulatorMs = 0;
22
- this.frame = 0;
23
- this.running = false;
24
- this.tick = () => {
25
+ __publicField(this, "options");
26
+ __publicField(this, "accumulatorMs", 0);
27
+ __publicField(this, "frame", 0);
28
+ __publicField(this, "lastTimeMs");
29
+ __publicField(this, "running", false);
30
+ __publicField(this, "tick", () => {
25
31
  if (!this.running) return;
26
32
  const nowMs = this.options.now();
27
33
  const elapsed = this.lastTimeMs === void 0 ? 0 : nowMs - this.lastTimeMs;
@@ -30,7 +36,7 @@ var FixedTimestepLoop = class {
30
36
  if (this.running) {
31
37
  this.options.schedule(this.tick);
32
38
  }
33
- };
39
+ });
34
40
  const fixedDeltaMs = options.fixedDeltaMs ?? DEFAULT_FIXED_DELTA_MS;
35
41
  const maxSubSteps = options.maxSubSteps ?? DEFAULT_MAX_SUBSTEPS;
36
42
  this.options = {
@@ -83,6 +89,9 @@ var FixedTimestepLoop = class {
83
89
  // src/commands.ts
84
90
  var Command = class {
85
91
  constructor(name, callback, description) {
92
+ __publicField(this, "name");
93
+ __publicField(this, "description");
94
+ __publicField(this, "callback");
86
95
  this.name = name;
87
96
  this.callback = callback;
88
97
  this.description = description;
@@ -93,10 +102,11 @@ var Command = class {
93
102
  };
94
103
  var CommandRegistry = class {
95
104
  constructor() {
96
- this.commands = /* @__PURE__ */ new Map();
97
- this.history = [];
98
- this.historyLimit = 64;
99
- this.autocompleteProviders = [];
105
+ __publicField(this, "commands", /* @__PURE__ */ new Map());
106
+ __publicField(this, "history", []);
107
+ __publicField(this, "historyLimit", 64);
108
+ __publicField(this, "autocompleteProviders", []);
109
+ __publicField(this, "onConsoleOutput");
100
110
  }
101
111
  register(name, callback, description) {
102
112
  const command = new Command(name, callback, description);
@@ -194,7 +204,14 @@ var Cvar = class {
194
204
  flags = shared.CvarFlags.None,
195
205
  onChange
196
206
  }) {
197
- this.modifiedCount = 0;
207
+ __publicField(this, "name");
208
+ __publicField(this, "defaultValue");
209
+ __publicField(this, "description");
210
+ __publicField(this, "flags");
211
+ __publicField(this, "_value");
212
+ __publicField(this, "latched");
213
+ __publicField(this, "onChange");
214
+ __publicField(this, "modifiedCount", 0);
198
215
  this.name = name;
199
216
  this.defaultValue = defaultValue;
200
217
  this.description = description;
@@ -270,7 +287,8 @@ var Cvar = class {
270
287
  };
271
288
  var CvarRegistry = class {
272
289
  constructor() {
273
- this.cvars = /* @__PURE__ */ new Map();
290
+ __publicField(this, "cvars", /* @__PURE__ */ new Map());
291
+ __publicField(this, "onCvarChange");
274
292
  }
275
293
  register(def) {
276
294
  const existing = this.cvars.get(def.name);
@@ -334,22 +352,27 @@ var EngineHost = class {
334
352
  constructor(game, client, options = {}) {
335
353
  this.game = game;
336
354
  this.client = client;
337
- this.started = false;
338
- this.paused_ = false;
339
- this.commands = new CommandRegistry();
340
- this.cvars = new CvarRegistry();
341
- this.stepSimulation = (step) => {
355
+ __publicField(this, "loop");
356
+ __publicField(this, "startTimeMs");
357
+ __publicField(this, "previousFrame");
358
+ __publicField(this, "latestFrame");
359
+ __publicField(this, "started", false);
360
+ __publicField(this, "paused_", false);
361
+ __publicField(this, "latestCommand");
362
+ __publicField(this, "commands", new CommandRegistry());
363
+ __publicField(this, "cvars", new CvarRegistry());
364
+ __publicField(this, "stepSimulation", (step) => {
342
365
  this.previousFrame = this.latestFrame;
343
366
  this.latestFrame = this.game.frame(step, this.latestCommand);
344
- };
345
- this.renderClient = (renderContext) => {
367
+ });
368
+ __publicField(this, "renderClient", (renderContext) => {
346
369
  if (!this.client) return;
347
370
  this.latestCommand = this.client.render({
348
371
  ...renderContext,
349
372
  previous: this.previousFrame,
350
373
  latest: this.latestFrame
351
374
  });
352
- };
375
+ });
353
376
  const now = options.loop?.now?.() ?? Date.now();
354
377
  this.startTimeMs = options.startTimeMs ?? options.loop?.startTimeMs ?? now;
355
378
  this.loop = new FixedTimestepLoop(
@@ -412,6 +435,10 @@ var EngineHost = class {
412
435
  // src/audio/api.ts
413
436
  var AudioApi = class {
414
437
  constructor(options) {
438
+ __publicField(this, "registry");
439
+ __publicField(this, "system");
440
+ __publicField(this, "music");
441
+ __publicField(this, "client");
415
442
  this.registry = options.registry;
416
443
  this.system = options.system;
417
444
  this.music = options.music;
@@ -504,7 +531,7 @@ var EngineRuntime = class {
504
531
  constructor(engine, host) {
505
532
  this.engine = engine;
506
533
  this.host = host;
507
- this.started = false;
534
+ __publicField(this, "started", false);
508
535
  }
509
536
  start() {
510
537
  if (this.started) return;
@@ -549,15 +576,15 @@ function assertLength(index, value) {
549
576
  }
550
577
  var ConfigStringRegistry = class {
551
578
  constructor() {
552
- this.values = /* @__PURE__ */ new Map();
553
- this.modelCursor = shared.ConfigStringIndex.Models;
554
- this.soundCursor = shared.ConfigStringIndex.Sounds;
555
- this.imageCursor = shared.ConfigStringIndex.Images;
556
- this.lightCursor = shared.ConfigStringIndex.Lights;
557
- this.shadowLightCursor = shared.ConfigStringIndex.ShadowLights;
558
- this.itemCursor = shared.ConfigStringIndex.Items;
559
- this.playerSkinCursor = shared.ConfigStringIndex.PlayerSkins;
560
- this.generalCursor = shared.ConfigStringIndex.General;
579
+ __publicField(this, "values", /* @__PURE__ */ new Map());
580
+ __publicField(this, "modelCursor", shared.ConfigStringIndex.Models);
581
+ __publicField(this, "soundCursor", shared.ConfigStringIndex.Sounds);
582
+ __publicField(this, "imageCursor", shared.ConfigStringIndex.Images);
583
+ __publicField(this, "lightCursor", shared.ConfigStringIndex.Lights);
584
+ __publicField(this, "shadowLightCursor", shared.ConfigStringIndex.ShadowLights);
585
+ __publicField(this, "itemCursor", shared.ConfigStringIndex.Items);
586
+ __publicField(this, "playerSkinCursor", shared.ConfigStringIndex.PlayerSkins);
587
+ __publicField(this, "generalCursor", shared.ConfigStringIndex.General);
561
588
  }
562
589
  set(index, value) {
563
590
  assertWithinBounds(index);
@@ -672,6 +699,9 @@ var PakArchive = class _PakArchive {
672
699
  constructor(name, buffer, entries, checksum) {
673
700
  this.name = name;
674
701
  this.buffer = buffer;
702
+ __publicField(this, "entries");
703
+ __publicField(this, "checksum");
704
+ __publicField(this, "size");
675
705
  this.entries = new Map(entries.map((entry) => [entry.name, entry]));
676
706
  this.checksum = checksum;
677
707
  this.size = buffer.byteLength;
@@ -765,7 +795,7 @@ function normalizePath2(path) {
765
795
  var StreamingPakArchive = class {
766
796
  constructor(source) {
767
797
  this.source = source;
768
- this.entries = null;
798
+ __publicField(this, "entries", null);
769
799
  }
770
800
  /**
771
801
  * Read directory asynchronously.
@@ -866,7 +896,7 @@ var HEADER_SIZE3 = 12;
866
896
  var DIRECTORY_ENTRY_SIZE3 = 64;
867
897
  var PakWriter = class _PakWriter {
868
898
  constructor() {
869
- this.entries = /* @__PURE__ */ new Map();
899
+ __publicField(this, "entries", /* @__PURE__ */ new Map());
870
900
  }
871
901
  /**
872
902
  * Adds a file to the archive.
@@ -961,10 +991,10 @@ var ResourceType = /* @__PURE__ */ ((ResourceType2) => {
961
991
  })(ResourceType || {});
962
992
  var ResourceLoadTracker = class {
963
993
  constructor() {
964
- this.tracking = false;
965
- this.entries = [];
966
- this.currentFrame = 0;
967
- this.currentTime = 0;
994
+ __publicField(this, "tracking", false);
995
+ __publicField(this, "entries", []);
996
+ __publicField(this, "currentFrame", 0);
997
+ __publicField(this, "currentTime", 0);
968
998
  }
969
999
  startTracking() {
970
1000
  this.tracking = true;
@@ -1015,9 +1045,9 @@ var ResourceLoadTracker = class {
1015
1045
  // src/assets/vfs.ts
1016
1046
  var VirtualFileSystem = class {
1017
1047
  constructor(archives = []) {
1018
- this.mounts = [];
1048
+ __publicField(this, "mounts", []);
1019
1049
  // files maps path -> list of sources, sorted by priority (high to low)
1020
- this.files = /* @__PURE__ */ new Map();
1050
+ __publicField(this, "files", /* @__PURE__ */ new Map());
1021
1051
  archives.forEach((archive) => this.mountPak(archive));
1022
1052
  }
1023
1053
  mountPak(archive, priority = 0) {
@@ -1265,7 +1295,7 @@ var PakValidationError = class extends Error {
1265
1295
  };
1266
1296
  var PakValidator = class {
1267
1297
  constructor(knownPaks = RERELEASE_KNOWN_PAKS) {
1268
- this.known = /* @__PURE__ */ new Map();
1298
+ __publicField(this, "known", /* @__PURE__ */ new Map());
1269
1299
  knownPaks.forEach((pak) => this.known.set(this.normalizePakName(pak.name), pak));
1270
1300
  }
1271
1301
  validateArchive(archive, nameOverride) {
@@ -1456,8 +1486,8 @@ var LruCache = class {
1456
1486
  this._capacity = _capacity;
1457
1487
  this._maxMemory = _maxMemory;
1458
1488
  this.sizeCalculator = sizeCalculator;
1459
- this.map = /* @__PURE__ */ new Map();
1460
- this.currentMemoryUsage = 0;
1489
+ __publicField(this, "map", /* @__PURE__ */ new Map());
1490
+ __publicField(this, "currentMemoryUsage", 0);
1461
1491
  if (_capacity <= 0) {
1462
1492
  throw new RangeError("LRU cache capacity must be greater than zero");
1463
1493
  }
@@ -2202,7 +2232,7 @@ var Md2ParseError = class extends Error {
2202
2232
  var Md2Loader = class {
2203
2233
  constructor(vfs) {
2204
2234
  this.vfs = vfs;
2205
- this.cache = /* @__PURE__ */ new Map();
2235
+ __publicField(this, "cache", /* @__PURE__ */ new Map());
2206
2236
  }
2207
2237
  async load(path) {
2208
2238
  if (this.cache.has(path)) {
@@ -2653,7 +2683,7 @@ function parseMd3(buffer) {
2653
2683
  var Md3Loader = class {
2654
2684
  constructor(vfs) {
2655
2685
  this.vfs = vfs;
2656
- this.cache = /* @__PURE__ */ new Map();
2686
+ __publicField(this, "cache", /* @__PURE__ */ new Map());
2657
2687
  }
2658
2688
  async load(path) {
2659
2689
  if (this.cache.has(path)) {
@@ -3018,6 +3048,7 @@ function calculateTextureSize(texture) {
3018
3048
  }
3019
3049
  var TextureCache = class {
3020
3050
  constructor(options = {}) {
3051
+ __publicField(this, "cache");
3021
3052
  this.cache = new LruCache(
3022
3053
  options.capacity ?? 128,
3023
3054
  options.maxMemory ?? 256 * 1024 * 1024,
@@ -3185,8 +3216,10 @@ var AudioRegistryError = class extends Error {
3185
3216
  var AudioRegistry = class {
3186
3217
  constructor(vfs, options = {}) {
3187
3218
  this.vfs = vfs;
3188
- this.refCounts = /* @__PURE__ */ new Map();
3189
- this.nextRequestId = 0;
3219
+ __publicField(this, "cache");
3220
+ __publicField(this, "refCounts", /* @__PURE__ */ new Map());
3221
+ __publicField(this, "worker");
3222
+ __publicField(this, "nextRequestId", 0);
3190
3223
  this.cache = new LruCache(options.cacheSize ?? 64);
3191
3224
  if (options.workerPath) {
3192
3225
  this.worker = new Worker(options.workerPath, { type: "module" });
@@ -3420,7 +3453,7 @@ var AssetDependencyError = class extends Error {
3420
3453
  };
3421
3454
  var AssetDependencyTracker = class {
3422
3455
  constructor() {
3423
- this.nodes = /* @__PURE__ */ new Map();
3456
+ __publicField(this, "nodes", /* @__PURE__ */ new Map());
3424
3457
  }
3425
3458
  register(assetKey, dependencies = []) {
3426
3459
  const node = this.nodes.get(assetKey) ?? { dependencies: /* @__PURE__ */ new Set(), loaded: false };
@@ -3473,9 +3506,19 @@ var AssetDependencyTracker = class {
3473
3506
  var AssetManager = class {
3474
3507
  constructor(vfs, options = {}) {
3475
3508
  this.vfs = vfs;
3476
- this.maps = /* @__PURE__ */ new Map();
3477
- this.loadQueue = [];
3478
- this.activeLoads = 0;
3509
+ __publicField(this, "textures");
3510
+ __publicField(this, "audio");
3511
+ __publicField(this, "dependencyTracker");
3512
+ __publicField(this, "resourceTracker");
3513
+ __publicField(this, "md2");
3514
+ __publicField(this, "md3");
3515
+ __publicField(this, "sprite");
3516
+ __publicField(this, "bsp");
3517
+ __publicField(this, "palette");
3518
+ __publicField(this, "maps", /* @__PURE__ */ new Map());
3519
+ __publicField(this, "loadQueue", []);
3520
+ __publicField(this, "activeLoads", 0);
3521
+ __publicField(this, "maxConcurrentLoads");
3479
3522
  this.textures = new TextureCache({
3480
3523
  capacity: options.textureCacheCapacity ?? 128,
3481
3524
  maxMemory: options.textureMemoryLimit
@@ -3773,6 +3816,7 @@ var AssetManager = class {
3773
3816
  var AudioContextController = class {
3774
3817
  constructor(factory) {
3775
3818
  this.factory = factory;
3819
+ __publicField(this, "context");
3776
3820
  }
3777
3821
  getContext() {
3778
3822
  if (!this.context) {
@@ -3828,7 +3872,7 @@ function createAudioGraph(controller) {
3828
3872
  var SoundRegistry = class {
3829
3873
  constructor(configStrings = new ConfigStringRegistry()) {
3830
3874
  this.configStrings = configStrings;
3831
- this.buffers = /* @__PURE__ */ new Map();
3875
+ __publicField(this, "buffers", /* @__PURE__ */ new Map());
3832
3876
  }
3833
3877
  registerName(name) {
3834
3878
  return this.configStrings.soundIndex(name);
@@ -3855,6 +3899,11 @@ var SoundRegistry = class {
3855
3899
  // src/audio/precache.ts
3856
3900
  var SoundPrecache = class {
3857
3901
  constructor(options) {
3902
+ __publicField(this, "vfs");
3903
+ __publicField(this, "registry");
3904
+ __publicField(this, "contextController");
3905
+ __publicField(this, "decodeAudio");
3906
+ __publicField(this, "soundRoot");
3858
3907
  this.vfs = options.vfs;
3859
3908
  this.registry = options.registry;
3860
3909
  this.contextController = options.context;
@@ -3944,8 +3993,9 @@ function pickChannel(channels, entnum, entchannel, context) {
3944
3993
  // src/audio/reverb.ts
3945
3994
  var ReverbSystem = class {
3946
3995
  constructor(node) {
3947
- this.activePreset = null;
3948
- this.enabled = true;
3996
+ __publicField(this, "activePreset", null);
3997
+ __publicField(this, "node");
3998
+ __publicField(this, "enabled", true);
3949
3999
  this.node = node;
3950
4000
  this.node.input.gain.value = 0.5;
3951
4001
  this.node.output.gain.value = 1;
@@ -3980,8 +4030,18 @@ var ReverbSystem = class {
3980
4030
  // src/audio/system.ts
3981
4031
  var AudioSystem = class {
3982
4032
  constructor(options) {
3983
- this.activeSources = /* @__PURE__ */ new Map();
3984
- this.playbackRate = 1;
4033
+ __publicField(this, "channels");
4034
+ __publicField(this, "registry");
4035
+ __publicField(this, "contextController");
4036
+ __publicField(this, "graph");
4037
+ __publicField(this, "playerEntity");
4038
+ __publicField(this, "activeSources", /* @__PURE__ */ new Map());
4039
+ __publicField(this, "resolveOcclusion");
4040
+ __publicField(this, "listener");
4041
+ __publicField(this, "sfxVolume");
4042
+ __publicField(this, "masterVolume");
4043
+ __publicField(this, "playbackRate", 1);
4044
+ __publicField(this, "reverb");
3985
4045
  this.contextController = options.context;
3986
4046
  this.registry = options.registry;
3987
4047
  this.playerEntity = options.playerEntity;
@@ -4230,7 +4290,7 @@ var clamp01 = (value) => clamp(value, 0, 1);
4230
4290
  var AudioOcclusion = class {
4231
4291
  constructor(trace) {
4232
4292
  this.trace = trace;
4233
- this.resolve = (listener, source, attenuation) => {
4293
+ __publicField(this, "resolve", (listener, source, attenuation) => {
4234
4294
  const dist = shared.lengthVec3(shared.subtractVec3(source, listener.origin));
4235
4295
  const maxDist = shared.calculateMaxAudibleDistance(attenuation);
4236
4296
  const clampedDist = Math.min(dist, maxDist);
@@ -4251,7 +4311,7 @@ var AudioOcclusion = class {
4251
4311
  };
4252
4312
  }
4253
4313
  return void 0;
4254
- };
4314
+ });
4255
4315
  }
4256
4316
  };
4257
4317
  function createOcclusionResolver(trace) {
@@ -4263,6 +4323,14 @@ function createOcclusionResolver(trace) {
4263
4323
  var MusicSystem = class {
4264
4324
  // Timer handle
4265
4325
  constructor(options) {
4326
+ __publicField(this, "createElement");
4327
+ __publicField(this, "resolveSource");
4328
+ __publicField(this, "crossfadeDuration");
4329
+ __publicField(this, "currentElement");
4330
+ __publicField(this, "fadingElement");
4331
+ __publicField(this, "track");
4332
+ __publicField(this, "volume");
4333
+ __publicField(this, "fadeInterval");
4266
4334
  this.createElement = options.createElement;
4267
4335
  this.resolveSource = options.resolveSource ?? (async (path) => path);
4268
4336
  this.volume = options.volume ?? 1;
@@ -4506,8 +4574,11 @@ function linkProgram(gl, vertexShader, fragmentShader, attributeLocations) {
4506
4574
  }
4507
4575
  var ShaderProgram = class _ShaderProgram {
4508
4576
  constructor(gl, program, sourceSize) {
4509
- this.uniformLocations = /* @__PURE__ */ new Map();
4510
- this.attributeLocations = /* @__PURE__ */ new Map();
4577
+ __publicField(this, "gl");
4578
+ __publicField(this, "program");
4579
+ __publicField(this, "uniformLocations", /* @__PURE__ */ new Map());
4580
+ __publicField(this, "attributeLocations", /* @__PURE__ */ new Map());
4581
+ __publicField(this, "sourceSize");
4511
4582
  this.gl = gl;
4512
4583
  this.program = program;
4513
4584
  this.sourceSize = sourceSize;
@@ -4554,6 +4625,9 @@ function createProgramFromSources(gl, sources, attributeLocations) {
4554
4625
  // src/render/resources.ts
4555
4626
  var VertexBuffer = class {
4556
4627
  constructor(gl, usage = gl.STATIC_DRAW, target) {
4628
+ __publicField(this, "gl");
4629
+ __publicField(this, "buffer");
4630
+ __publicField(this, "target");
4557
4631
  this.gl = gl;
4558
4632
  this.target = target ?? gl.ARRAY_BUFFER;
4559
4633
  const buffer = gl.createBuffer();
@@ -4586,6 +4660,8 @@ var IndexBuffer = class extends VertexBuffer {
4586
4660
  };
4587
4661
  var VertexArray = class {
4588
4662
  constructor(gl) {
4663
+ __publicField(this, "gl");
4664
+ __publicField(this, "vao");
4589
4665
  this.gl = gl;
4590
4666
  const vao = gl.createVertexArray();
4591
4667
  if (!vao) {
@@ -4622,8 +4698,11 @@ var VertexArray = class {
4622
4698
  };
4623
4699
  var Texture2D = class {
4624
4700
  constructor(gl, target = gl.TEXTURE_2D) {
4625
- this.width = 0;
4626
- this.height = 0;
4701
+ __publicField(this, "gl");
4702
+ __publicField(this, "texture");
4703
+ __publicField(this, "target");
4704
+ __publicField(this, "width", 0);
4705
+ __publicField(this, "height", 0);
4627
4706
  this.gl = gl;
4628
4707
  this.target = target;
4629
4708
  const texture = gl.createTexture();
@@ -4666,6 +4745,9 @@ var Texture2D = class {
4666
4745
  };
4667
4746
  var TextureCubeMap = class {
4668
4747
  constructor(gl) {
4748
+ __publicField(this, "gl");
4749
+ __publicField(this, "texture");
4750
+ __publicField(this, "target");
4669
4751
  this.gl = gl;
4670
4752
  this.target = gl.TEXTURE_CUBE_MAP;
4671
4753
  const texture = gl.createTexture();
@@ -4703,6 +4785,8 @@ var TextureCubeMap = class {
4703
4785
  };
4704
4786
  var Framebuffer = class {
4705
4787
  constructor(gl) {
4788
+ __publicField(this, "gl");
4789
+ __publicField(this, "framebuffer");
4706
4790
  this.gl = gl;
4707
4791
  const framebuffer = gl.createFramebuffer();
4708
4792
  if (!framebuffer) {
@@ -5232,7 +5316,7 @@ function gatherVisibleFaces(map, cameraPosition, frustum, portalState) {
5232
5316
  var MAX_DLIGHTS = 32;
5233
5317
  var DynamicLightManager = class {
5234
5318
  constructor() {
5235
- this.lights = [];
5319
+ __publicField(this, "lights", []);
5236
5320
  }
5237
5321
  /**
5238
5322
  * Adds a dynamic light or updates an existing one with the same key.
@@ -5536,7 +5620,33 @@ function deriveSurfaceRenderState(surfaceFlags = shared.SURF_NONE, timeSeconds =
5536
5620
  }
5537
5621
  var BspSurfacePipeline = class {
5538
5622
  constructor(gl) {
5539
- this.uniformDlights = [];
5623
+ __publicField(this, "gl");
5624
+ __publicField(this, "program");
5625
+ __publicField(this, "uniformMvp");
5626
+ __publicField(this, "uniformTexScroll");
5627
+ __publicField(this, "uniformLmScroll");
5628
+ __publicField(this, "uniformLightStyles");
5629
+ __publicField(this, "uniformStyleLayerMapping");
5630
+ __publicField(this, "uniformAlpha");
5631
+ __publicField(this, "uniformApplyLightmap");
5632
+ __publicField(this, "uniformWarp");
5633
+ __publicField(this, "uniformLightmapOnly");
5634
+ __publicField(this, "uniformDiffuse");
5635
+ __publicField(this, "uniformLightmap");
5636
+ __publicField(this, "uniformRefraction");
5637
+ // New
5638
+ __publicField(this, "uniformHasRefraction");
5639
+ // New
5640
+ __publicField(this, "uniformTime");
5641
+ __publicField(this, "uniformRenderMode");
5642
+ __publicField(this, "uniformSolidColor");
5643
+ __publicField(this, "uniformNumDlights");
5644
+ __publicField(this, "uniformDlights", []);
5645
+ // Lighting controls uniforms
5646
+ __publicField(this, "uniformBrightness");
5647
+ __publicField(this, "uniformGamma");
5648
+ __publicField(this, "uniformFullbright");
5649
+ __publicField(this, "uniformAmbient");
5540
5650
  this.gl = gl;
5541
5651
  this.program = ShaderProgram.create(
5542
5652
  gl,
@@ -5848,6 +5958,14 @@ void main() {
5848
5958
  }`;
5849
5959
  var SkyboxPipeline = class {
5850
5960
  constructor(gl) {
5961
+ __publicField(this, "gl");
5962
+ __publicField(this, "program");
5963
+ __publicField(this, "vao");
5964
+ __publicField(this, "vbo");
5965
+ __publicField(this, "cubemap");
5966
+ __publicField(this, "uniformViewProj");
5967
+ __publicField(this, "uniformScroll");
5968
+ __publicField(this, "uniformSampler");
5851
5969
  this.gl = gl;
5852
5970
  this.program = ShaderProgram.create(
5853
5971
  gl,
@@ -6119,6 +6237,14 @@ function buildMd2VertexData(model, geometry, blend) {
6119
6237
  }
6120
6238
  var Md2MeshBuffers = class {
6121
6239
  constructor(gl, model, blend) {
6240
+ __publicField(this, "gl");
6241
+ __publicField(this, "geometry");
6242
+ __publicField(this, "vertexBuffer");
6243
+ __publicField(this, "indexBuffer");
6244
+ __publicField(this, "vertexArray");
6245
+ __publicField(this, "indexCount");
6246
+ __publicField(this, "wireframeIndexBuffer");
6247
+ __publicField(this, "wireframeIndexCount");
6122
6248
  this.gl = gl;
6123
6249
  this.geometry = buildMd2Geometry(model);
6124
6250
  this.vertexBuffer = new VertexBuffer(gl, gl.STATIC_DRAW);
@@ -6155,7 +6281,23 @@ var Md2MeshBuffers = class {
6155
6281
  };
6156
6282
  var Md2Pipeline = class {
6157
6283
  constructor(gl) {
6158
- this.uniformDlights = [];
6284
+ __publicField(this, "gl");
6285
+ __publicField(this, "program");
6286
+ __publicField(this, "uniformMvp");
6287
+ __publicField(this, "uniformModelMatrix");
6288
+ __publicField(this, "uniformLightDir");
6289
+ __publicField(this, "uniformAmbient");
6290
+ __publicField(this, "uniformTint");
6291
+ __publicField(this, "uniformDiffuse");
6292
+ __publicField(this, "uniformRenderMode");
6293
+ __publicField(this, "uniformSolidColor");
6294
+ __publicField(this, "uniformNumDlights");
6295
+ __publicField(this, "uniformDlights", []);
6296
+ // Lighting controls
6297
+ __publicField(this, "uniformBrightness");
6298
+ __publicField(this, "uniformGamma");
6299
+ __publicField(this, "uniformFullbright");
6300
+ __publicField(this, "uniformGlobalAmbient");
6159
6301
  this.gl = gl;
6160
6302
  this.program = ShaderProgram.create(
6161
6303
  gl,
@@ -6260,21 +6402,23 @@ var Md2Pipeline = class {
6260
6402
  };
6261
6403
  var Camera = class {
6262
6404
  constructor(width, height) {
6263
- this._position = glMatrix.vec3.create();
6264
- this._angles = glMatrix.vec3.create();
6405
+ __publicField(this, "_position", glMatrix.vec3.create());
6406
+ __publicField(this, "_angles", glMatrix.vec3.create());
6265
6407
  // pitch, yaw, roll
6266
- this._bobAngles = glMatrix.vec3.create();
6267
- this._bobOffset = glMatrix.vec3.create();
6268
- this._kickAngles = glMatrix.vec3.create();
6269
- this._rollAngle = 0;
6270
- this._fov = 90;
6271
- this._aspect = 1;
6272
- this._near = 0.1;
6273
- this._far = 1e3;
6274
- this._viewMatrix = glMatrix.mat4.create();
6275
- this._projectionMatrix = glMatrix.mat4.create();
6276
- this._viewProjectionMatrix = glMatrix.mat4.create();
6277
- this._dirty = true;
6408
+ __publicField(this, "_bobAngles", glMatrix.vec3.create());
6409
+ __publicField(this, "_bobOffset", glMatrix.vec3.create());
6410
+ __publicField(this, "_kickAngles", glMatrix.vec3.create());
6411
+ __publicField(this, "_rollAngle", 0);
6412
+ __publicField(this, "_fov", 90);
6413
+ __publicField(this, "_aspect", 1);
6414
+ __publicField(this, "_near", 0.1);
6415
+ __publicField(this, "_far", 1e3);
6416
+ __publicField(this, "_viewMatrix", glMatrix.mat4.create());
6417
+ __publicField(this, "_projectionMatrix", glMatrix.mat4.create());
6418
+ __publicField(this, "_viewProjectionMatrix", glMatrix.mat4.create());
6419
+ __publicField(this, "_dirty", true);
6420
+ // Event callback
6421
+ __publicField(this, "onCameraMove");
6278
6422
  if (width !== void 0 && height !== void 0 && height > 0) {
6279
6423
  this._aspect = width / height;
6280
6424
  }
@@ -6716,6 +6860,14 @@ void main() {
6716
6860
  }`;
6717
6861
  var Md3SurfaceMesh = class {
6718
6862
  constructor(gl, surface, blend, lighting) {
6863
+ __publicField(this, "gl");
6864
+ __publicField(this, "geometry");
6865
+ __publicField(this, "vertexBuffer");
6866
+ __publicField(this, "indexBuffer");
6867
+ __publicField(this, "vertexArray");
6868
+ __publicField(this, "indexCount");
6869
+ __publicField(this, "wireframeIndexBuffer");
6870
+ __publicField(this, "wireframeIndexCount");
6719
6871
  this.gl = gl;
6720
6872
  this.geometry = buildMd3SurfaceGeometry(surface);
6721
6873
  this.vertexBuffer = new VertexBuffer(gl, gl.STATIC_DRAW);
@@ -6753,7 +6905,11 @@ var Md3SurfaceMesh = class {
6753
6905
  };
6754
6906
  var Md3ModelMesh = class {
6755
6907
  constructor(gl, model, blend, lighting) {
6756
- this.surfaces = /* @__PURE__ */ new Map();
6908
+ __publicField(this, "surfaces", /* @__PURE__ */ new Map());
6909
+ __publicField(this, "gl");
6910
+ __publicField(this, "model");
6911
+ __publicField(this, "blend");
6912
+ __publicField(this, "lighting");
6757
6913
  this.gl = gl;
6758
6914
  this.model = model;
6759
6915
  this.blend = blend;
@@ -6779,6 +6935,18 @@ var Md3ModelMesh = class {
6779
6935
  };
6780
6936
  var Md3Pipeline = class {
6781
6937
  constructor(gl) {
6938
+ __publicField(this, "gl");
6939
+ __publicField(this, "program");
6940
+ __publicField(this, "uniformMvp");
6941
+ __publicField(this, "uniformTint");
6942
+ __publicField(this, "uniformDiffuse");
6943
+ __publicField(this, "uniformRenderMode");
6944
+ __publicField(this, "uniformSolidColor");
6945
+ // Lighting controls
6946
+ __publicField(this, "uniformBrightness");
6947
+ __publicField(this, "uniformGamma");
6948
+ __publicField(this, "uniformFullbright");
6949
+ __publicField(this, "uniformGlobalAmbient");
6782
6950
  this.gl = gl;
6783
6951
  this.program = ShaderProgram.create(
6784
6952
  gl,
@@ -6855,6 +7023,29 @@ var Md3Pipeline = class {
6855
7023
  var DEFAULT_COLOR = [1, 1, 1, 1];
6856
7024
  var ParticleSystem = class {
6857
7025
  constructor(maxParticles, rng) {
7026
+ __publicField(this, "maxParticles");
7027
+ __publicField(this, "rng");
7028
+ __publicField(this, "alive");
7029
+ __publicField(this, "positionX");
7030
+ __publicField(this, "positionY");
7031
+ __publicField(this, "positionZ");
7032
+ __publicField(this, "velocityX");
7033
+ __publicField(this, "velocityY");
7034
+ __publicField(this, "velocityZ");
7035
+ __publicField(this, "colorR");
7036
+ __publicField(this, "colorG");
7037
+ __publicField(this, "colorB");
7038
+ __publicField(this, "colorA");
7039
+ __publicField(this, "size");
7040
+ __publicField(this, "lifetime");
7041
+ __publicField(this, "remaining");
7042
+ __publicField(this, "gravity");
7043
+ __publicField(this, "damping");
7044
+ __publicField(this, "bounce");
7045
+ __publicField(this, "fade");
7046
+ __publicField(this, "blendMode");
7047
+ // 0 alpha, 1 additive
7048
+ __publicField(this, "textureIndex");
6858
7049
  this.maxParticles = maxParticles;
6859
7050
  this.rng = rng;
6860
7051
  this.alive = new Uint8Array(maxParticles);
@@ -7073,8 +7264,14 @@ void main() {
7073
7264
  }`;
7074
7265
  var ParticleRenderer = class {
7075
7266
  constructor(gl, system) {
7076
- this.vertexCapacity = 0;
7077
- this.indexCapacity = 0;
7267
+ __publicField(this, "gl");
7268
+ __publicField(this, "program");
7269
+ __publicField(this, "system");
7270
+ __publicField(this, "vertexBuffer");
7271
+ __publicField(this, "indexBuffer");
7272
+ __publicField(this, "vertexArray");
7273
+ __publicField(this, "vertexCapacity", 0);
7274
+ __publicField(this, "indexCapacity", 0);
7078
7275
  this.gl = gl;
7079
7276
  this.system = system;
7080
7277
  this.program = ShaderProgram.create(gl, { vertex: PARTICLE_VERTEX_SHADER, fragment: PARTICLE_FRAGMENT_SHADER });
@@ -7511,6 +7708,12 @@ void main() {
7511
7708
  `;
7512
7709
  var PostProcessPipeline = class {
7513
7710
  constructor(gl) {
7711
+ __publicField(this, "gl");
7712
+ __publicField(this, "program");
7713
+ __publicField(this, "vao");
7714
+ __publicField(this, "uTime");
7715
+ __publicField(this, "uStrength");
7716
+ __publicField(this, "uTexture");
7514
7717
  this.gl = gl;
7515
7718
  this.program = ShaderProgram.create(
7516
7719
  gl,
@@ -7630,8 +7833,17 @@ void main() {
7630
7833
  `;
7631
7834
  var BloomPipeline = class {
7632
7835
  constructor(gl) {
7633
- this.width = 0;
7634
- this.height = 0;
7836
+ __publicField(this, "gl");
7837
+ __publicField(this, "extractProgram");
7838
+ __publicField(this, "blurProgram");
7839
+ __publicField(this, "compositeProgram");
7840
+ __publicField(this, "vao");
7841
+ __publicField(this, "framebuffer1");
7842
+ __publicField(this, "framebuffer2");
7843
+ __publicField(this, "texture1");
7844
+ __publicField(this, "texture2");
7845
+ __publicField(this, "width", 0);
7846
+ __publicField(this, "height", 0);
7635
7847
  this.gl = gl;
7636
7848
  this.extractProgram = ShaderProgram.create(gl, { vertex: QUAD_VERTEX_SOURCE, fragment: EXTRACT_FRAGMENT_SOURCE }, { a_position: 0 });
7637
7849
  this.blurProgram = ShaderProgram.create(gl, { vertex: QUAD_VERTEX_SOURCE, fragment: BLUR_FRAGMENT_SOURCE }, { a_position: 0 });
@@ -8057,6 +8269,14 @@ void main() {
8057
8269
  }`;
8058
8270
  var SpriteRenderer = class {
8059
8271
  constructor(gl) {
8272
+ __publicField(this, "gl");
8273
+ __publicField(this, "program");
8274
+ __publicField(this, "vao");
8275
+ __publicField(this, "vbo");
8276
+ __publicField(this, "whiteTexture");
8277
+ __publicField(this, "uniformProjection");
8278
+ __publicField(this, "uniformDiffuse");
8279
+ __publicField(this, "uniformTint");
8060
8280
  this.gl = gl;
8061
8281
  this.program = ShaderProgram.create(
8062
8282
  gl,
@@ -8145,7 +8365,12 @@ void main() {
8145
8365
  }`;
8146
8366
  var CollisionVisRenderer = class {
8147
8367
  constructor(gl) {
8148
- this.vertices = [];
8368
+ __publicField(this, "gl");
8369
+ __publicField(this, "program");
8370
+ __publicField(this, "vao");
8371
+ __publicField(this, "vbo");
8372
+ __publicField(this, "vertices", []);
8373
+ __publicField(this, "uniformViewProjection");
8149
8374
  this.gl = gl;
8150
8375
  this.program = ShaderProgram.create(
8151
8376
  gl,
@@ -8319,17 +8544,20 @@ function calculateEntityLight(map, origin) {
8319
8544
  // src/render/gpuProfiler.ts
8320
8545
  var GpuProfiler = class {
8321
8546
  constructor(gl) {
8322
- this.activeQueries = [];
8323
- this.queryPool = [];
8324
- this.currentQuery = null;
8325
- this.lastGpuTimeMs = 0;
8547
+ __publicField(this, "ext");
8548
+ // EXT_disjoint_timer_query_webgl2
8549
+ __publicField(this, "gl");
8550
+ __publicField(this, "activeQueries", []);
8551
+ __publicField(this, "queryPool", []);
8552
+ __publicField(this, "currentQuery", null);
8553
+ __publicField(this, "lastGpuTimeMs", 0);
8326
8554
  // CPU-side counters
8327
- this.frameStartTime = 0;
8328
- this.lastCpuFrameTimeMs = 0;
8555
+ __publicField(this, "frameStartTime", 0);
8556
+ __publicField(this, "lastCpuFrameTimeMs", 0);
8329
8557
  // Resource Tracking
8330
- this.textureMemoryBytes = 0;
8331
- this.bufferMemoryBytes = 0;
8332
- this.shaderMemoryBytes = 0;
8558
+ __publicField(this, "textureMemoryBytes", 0);
8559
+ __publicField(this, "bufferMemoryBytes", 0);
8560
+ __publicField(this, "shaderMemoryBytes", 0);
8333
8561
  this.gl = gl;
8334
8562
  this.ext = gl.getExtension("EXT_disjoint_timer_query_webgl2");
8335
8563
  }
@@ -8543,9 +8771,16 @@ function fromGlVec3(v) {
8543
8771
  }
8544
8772
  var DebugRenderer = class {
8545
8773
  constructor(gl) {
8546
- this.vertices = [];
8547
- this.solidVertices = [];
8548
- this.labels = [];
8774
+ __publicField(this, "gl");
8775
+ __publicField(this, "shader");
8776
+ __publicField(this, "vao");
8777
+ __publicField(this, "vbo");
8778
+ __publicField(this, "shaderSolid");
8779
+ __publicField(this, "vaoSolid");
8780
+ __publicField(this, "vboSolid");
8781
+ __publicField(this, "vertices", []);
8782
+ __publicField(this, "solidVertices", []);
8783
+ __publicField(this, "labels", []);
8549
8784
  this.gl = gl;
8550
8785
  this.shader = ShaderProgram.create(gl, { vertex: VS_SOURCE, fragment: FS_SOURCE });
8551
8786
  this.vao = new VertexArray(gl);
@@ -9737,15 +9972,15 @@ var FrameRenderer = class {
9737
9972
  constructor(context, pipelines) {
9738
9973
  this.context = context;
9739
9974
  this.pipelines = pipelines;
9740
- this.depthTexture = null;
9741
- this.copyTexture = null;
9975
+ __publicField(this, "depthTexture", null);
9976
+ __publicField(this, "copyTexture", null);
9742
9977
  // Separate texture for headless output if no context exists
9743
- this.headlessTarget = null;
9744
- this.lastWidth = 0;
9745
- this.lastHeight = 0;
9746
- this.lastFrameTime = 0;
9978
+ __publicField(this, "headlessTarget", null);
9979
+ __publicField(this, "lastWidth", 0);
9980
+ __publicField(this, "lastHeight", 0);
9981
+ __publicField(this, "lastFrameTime", 0);
9747
9982
  // Current frame context (available during frame rendering)
9748
- this.currentFrameContext = null;
9983
+ __publicField(this, "currentFrameContext", null);
9749
9984
  }
9750
9985
  ensureDepthTexture(width, height) {
9751
9986
  if (this.depthTexture && this.lastWidth === width && this.lastHeight === height) {
@@ -9950,7 +10185,9 @@ var FrameRenderer = class {
9950
10185
  gamma,
9951
10186
  fullbright,
9952
10187
  ambient,
9953
- cameraPosition: options.camera.position
10188
+ cameraPosition: options.camera.position,
10189
+ // Workaround for worldPos offset bug: pass surface mins for shader correction
10190
+ surfaceMins: geometry.mins
9954
10191
  });
9955
10192
  this.pipelines.bsp.draw(pass, geometry, renderMode);
9956
10193
  stats.facesDrawn++;
@@ -10031,6 +10268,9 @@ fn fs_main(in: VSOutput) -> @location(0) vec4f {
10031
10268
  var GPUBufferResource = class {
10032
10269
  constructor(device, descriptor) {
10033
10270
  this.device = device;
10271
+ __publicField(this, "buffer");
10272
+ __publicField(this, "size");
10273
+ __publicField(this, "usage");
10034
10274
  this.size = Math.ceil(descriptor.size / 4) * 4;
10035
10275
  this.usage = descriptor.usage;
10036
10276
  this.buffer = device.createBuffer({
@@ -10116,9 +10356,7 @@ function getBlockSize(format) {
10116
10356
  case "rgba16float":
10117
10357
  case "rgba16sint":
10118
10358
  case "rgba16uint":
10119
- case "rgba32float":
10120
10359
  return 8;
10121
- // wait, rgba16 is 8 bytes. rgba32 is 16 bytes.
10122
10360
  case "rgba32float":
10123
10361
  case "rgba32sint":
10124
10362
  case "rgba32uint":
@@ -10135,6 +10373,10 @@ function getBlockSize(format) {
10135
10373
  var _Texture2D = class _Texture2D {
10136
10374
  constructor(device, descriptor) {
10137
10375
  this.device = device;
10376
+ __publicField(this, "texture");
10377
+ __publicField(this, "width");
10378
+ __publicField(this, "height");
10379
+ __publicField(this, "format");
10138
10380
  this.width = descriptor.width;
10139
10381
  this.height = descriptor.height;
10140
10382
  this.format = descriptor.format;
@@ -10271,11 +10513,12 @@ var _Texture2D = class _Texture2D {
10271
10513
  }
10272
10514
  };
10273
10515
  // Cache pipelines per device and per format
10274
- _Texture2D.mipmapPipelines = /* @__PURE__ */ new WeakMap();
10275
- _Texture2D.mipmapSamplers = /* @__PURE__ */ new WeakMap();
10516
+ __publicField(_Texture2D, "mipmapPipelines", /* @__PURE__ */ new WeakMap());
10517
+ __publicField(_Texture2D, "mipmapSamplers", /* @__PURE__ */ new WeakMap());
10276
10518
  var Texture2D2 = _Texture2D;
10277
10519
  var Sampler = class {
10278
10520
  constructor(device, descriptor) {
10521
+ __publicField(this, "sampler");
10279
10522
  this.sampler = device.createSampler({
10280
10523
  ...descriptor,
10281
10524
  label: descriptor.label
@@ -10295,6 +10538,7 @@ function createLinearSampler(device) {
10295
10538
  var ShaderModule = class {
10296
10539
  constructor(device, descriptor) {
10297
10540
  this.device = device;
10541
+ __publicField(this, "module");
10298
10542
  this.module = device.createShaderModule({
10299
10543
  code: descriptor.code,
10300
10544
  label: descriptor.label
@@ -10307,6 +10551,7 @@ var ShaderModule = class {
10307
10551
  var RenderPipeline = class {
10308
10552
  constructor(device, descriptor) {
10309
10553
  this.device = device;
10554
+ __publicField(this, "pipeline");
10310
10555
  const layout = descriptor.layout;
10311
10556
  this.pipeline = device.createRenderPipeline({
10312
10557
  layout,
@@ -10335,6 +10580,7 @@ var RenderPipeline = class {
10335
10580
  var BindGroupLayout = class {
10336
10581
  constructor(device, descriptor) {
10337
10582
  this.device = device;
10583
+ __publicField(this, "layout");
10338
10584
  this.layout = device.createBindGroupLayout({
10339
10585
  entries: descriptor.entries,
10340
10586
  label: descriptor.label
@@ -10344,6 +10590,7 @@ var BindGroupLayout = class {
10344
10590
  var BindGroup = class {
10345
10591
  constructor(device, layout, entries, label) {
10346
10592
  this.device = device;
10593
+ __publicField(this, "bindGroup");
10347
10594
  const gpuEntries = entries.map((entry) => {
10348
10595
  let resource;
10349
10596
  if (entry.resource instanceof GPUBufferResource) {
@@ -10370,7 +10617,7 @@ var BindGroup = class {
10370
10617
  var BindGroupBuilder = class {
10371
10618
  constructor(label) {
10372
10619
  this.label = label;
10373
- this.entries = [];
10620
+ __publicField(this, "entries", []);
10374
10621
  }
10375
10622
  addUniformBuffer(binding, visibility) {
10376
10623
  this.entries.push({
@@ -10468,13 +10715,24 @@ var SpriteRenderer2 = class {
10468
10715
  constructor(device, format) {
10469
10716
  this.device = device;
10470
10717
  this.format = format;
10471
- this.currentVertexCount = 0;
10472
- this.currentIndexCount = 0;
10473
- this.currentTexture = null;
10474
- this.drawCommands = [];
10475
- this.textureBindGroups = /* @__PURE__ */ new Map();
10476
- this._activeEncoder = null;
10477
- this._activeRenderTarget = null;
10718
+ __publicField(this, "pipelineTextured");
10719
+ __publicField(this, "pipelineSolid");
10720
+ __publicField(this, "vertexBuffer");
10721
+ __publicField(this, "indexBuffer");
10722
+ __publicField(this, "uniformBuffer");
10723
+ __publicField(this, "uniformBindGroup");
10724
+ __publicField(this, "textureBindGroupLayout");
10725
+ __publicField(this, "defaultSampler");
10726
+ __publicField(this, "projectionMatrix");
10727
+ // Batching state
10728
+ __publicField(this, "vertexData");
10729
+ __publicField(this, "currentVertexCount", 0);
10730
+ __publicField(this, "currentIndexCount", 0);
10731
+ __publicField(this, "currentTexture", null);
10732
+ __publicField(this, "drawCommands", []);
10733
+ __publicField(this, "textureBindGroups", /* @__PURE__ */ new Map());
10734
+ __publicField(this, "_activeEncoder", null);
10735
+ __publicField(this, "_activeRenderTarget", null);
10478
10736
  const shaderModule = new ShaderModule(device, {
10479
10737
  code: SPRITE_SHADER,
10480
10738
  label: "sprite-shader"
@@ -10758,7 +11016,7 @@ var CoordinateSystem = /* @__PURE__ */ ((CoordinateSystem2) => {
10758
11016
  // src/render/matrix/webgpu.ts
10759
11017
  var WebGPUMatrixBuilder = class {
10760
11018
  constructor() {
10761
- this.coordinateSystem = "webgpu" /* WEBGPU */;
11019
+ __publicField(this, "coordinateSystem", "webgpu" /* WEBGPU */);
10762
11020
  }
10763
11021
  buildProjectionMatrix(camera) {
10764
11022
  const projection = glMatrix.mat4.create();
@@ -10866,6 +11124,12 @@ var SkyboxPipeline3 = class {
10866
11124
  constructor(device, format) {
10867
11125
  this.device = device;
10868
11126
  this.format = format;
11127
+ __publicField(this, "pipeline");
11128
+ __publicField(this, "vertexBuffer");
11129
+ __publicField(this, "bindGroupHelper");
11130
+ __publicField(this, "uniformBuffer");
11131
+ __publicField(this, "sampler");
11132
+ __publicField(this, "matrixBuilder");
10869
11133
  this.matrixBuilder = new WebGPUMatrixBuilder();
10870
11134
  const module = device.createShaderModule({
10871
11135
  label: "skybox-shader",
@@ -11021,7 +11285,7 @@ var SkyboxBindGroupHelper = class {
11021
11285
  this.layout = layout;
11022
11286
  this.uniformBuffer = uniformBuffer;
11023
11287
  this.sampler = sampler;
11024
- this.bindGroupCache = /* @__PURE__ */ new Map();
11288
+ __publicField(this, "bindGroupCache", /* @__PURE__ */ new Map());
11025
11289
  }
11026
11290
  getBindGroup(cubemap) {
11027
11291
  if (this.bindGroupCache.has(cubemap)) {
@@ -11050,7 +11314,7 @@ var SkyboxBindGroupHelper = class {
11050
11314
  };
11051
11315
 
11052
11316
  // raw-loader:/home/runner/work/quake2/quake2/quake2ts/packages/engine/src/render/webgpu/shaders/bsp.wgsl
11053
- var bsp_default = "struct DLight {\n position: vec3<f32>,\n intensity: f32,\n color: vec3<f32>,\n padding: f32,\n}\n\nstruct FrameUniforms {\n viewProjection: mat4x4<f32>, // 0-64\n cameraPosition: vec3<f32>, // 64-76\n pad0: f32, // 76-80 (Explicit padding to align next field to 80)\n time: f32, // 80-84\n brightness: f32, // 84-88\n gamma: f32, // 88-92\n ambient: f32, // 92-96\n numDlights: u32, // 96-100\n fullbright: u32, // 100-104\n pad1: vec2<f32>, // 104-112 (Aligns next field to 112)\n pad2: vec4<f32>, // 112-128 (Aligns next field to 128)\n dlights: array<DLight, 32>, // Starts at 128\n}\n\nstruct SurfaceUniforms {\n texScroll: vec2<f32>,\n lightmapScroll: vec2<f32>,\n lightStyleFactors: vec4<f32>,\n styleLayerMapping: vec4<f32>,\n solidColor: vec4<f32>,\n alpha: f32,\n applyLightmap: u32,\n warp: u32,\n lightmapOnly: u32,\n renderMode: u32, // 0: Texture, 1: Solid, 2: Faceted\n padding: vec3<f32>,\n}\n\n@group(0) @binding(0) var<uniform> frame: FrameUniforms;\n@group(1) @binding(0) var<uniform> surface: SurfaceUniforms;\n@group(2) @binding(0) var diffuseMap: texture_2d<f32>;\n@group(2) @binding(1) var diffuseSampler: sampler;\n@group(2) @binding(2) var lightmapAtlas: texture_2d<f32>;\n@group(2) @binding(3) var lightmapSampler: sampler;\n\nstruct VertexInput {\n @location(0) position: vec3<f32>,\n @location(1) texCoord: vec2<f32>,\n @location(2) lightmapCoord: vec2<f32>,\n @location(3) lightmapStep: f32,\n}\n\nstruct VertexOutput {\n @builtin(position) position: vec4<f32>,\n @location(0) texCoord: vec2<f32>,\n @location(1) lightmapCoord: vec2<f32>,\n @location(2) lightmapStep: f32,\n @location(3) worldPos: vec3<f32>,\n @location(4) screenPos: vec4<f32>,\n}\n\n@vertex\nfn vertexMain(input: VertexInput) -> VertexOutput {\n var output: VertexOutput;\n\n var pos = input.position;\n var tex = input.texCoord;\n var lm = input.lightmapCoord;\n\n // Vertex Warping\n if (surface.warp != 0u) {\n let amp = 0.125;\n let s = tex.x + sin((tex.y * 0.125 + frame.time) * 1.0) * amp;\n let t = tex.y + sin((tex.x * 0.125 + frame.time) * 1.0) * amp;\n tex = vec2<f32>(s, t);\n }\n\n output.texCoord = tex + surface.texScroll;\n output.lightmapCoord = lm + surface.lightmapScroll;\n output.lightmapStep = input.lightmapStep;\n output.worldPos = pos;\n output.position = frame.viewProjection * vec4<f32>(pos, 1.0);\n output.screenPos = output.position;\n\n return output;\n}\n\n@fragment\nfn fragmentMain(input: VertexOutput) -> @location(0) vec4<f32> {\n var finalColor: vec4<f32>;\n\n if (surface.renderMode == 0u) {\n // TEXTURED MODE\n var base = vec4<f32>(1.0, 1.0, 1.0, 1.0);\n if (surface.lightmapOnly == 0u) {\n base = textureSample(diffuseMap, diffuseSampler, input.texCoord);\n }\n\n var totalLight = vec3<f32>(0.0, 0.0, 0.0);\n\n if (frame.fullbright != 0u) {\n totalLight = vec3<f32>(1.0, 1.0, 1.0);\n } else {\n // Apply Lightmaps\n if (surface.applyLightmap != 0u) {\n var hasLight = false;\n for (var i = 0; i < 4; i++) {\n let layer = surface.styleLayerMapping[i];\n let factor = surface.lightStyleFactors[i];\n\n if (layer >= -0.5) {\n let offset = vec2<f32>(0.0, layer * input.lightmapStep);\n totalLight += textureSample(lightmapAtlas, lightmapSampler, input.lightmapCoord + offset).rgb * factor;\n hasLight = true;\n }\n }\n\n // If lightmap enabled but no active layers, fallback to white?\n // Quake 2 logic usually implies at least one style is active if surfaced has SURF_LIGHT\n // But if we have no lightmap data, we start black.\n if (!hasLight) {\n // Fallback to avoid pitch black if lightmap intended but missing?\n // totalLight = vec3<f32>(1.0, 1.0, 1.0);\n }\n }\n\n // Apply Dynamic Lights\n for (var i = 0u; i < 32u; i++) {\n if (i >= frame.numDlights) {\n break;\n }\n let dlight = frame.dlights[i];\n let dist = distance(input.worldPos, dlight.position);\n\n if (dist < dlight.intensity) {\n let contribution = (dlight.intensity - dist) * (1.0 / 255.0);\n totalLight += dlight.color * contribution;\n }\n }\n }\n\n totalLight = max(totalLight, vec3<f32>(frame.ambient));\n totalLight *= frame.brightness;\n base = vec4<f32>(base.rgb * totalLight, base.a);\n\n // Gamma correction\n if (frame.gamma != 1.0) {\n base = vec4<f32>(pow(base.rgb, vec3<f32>(1.0 / frame.gamma)), base.a);\n }\n\n finalColor = vec4<f32>(base.rgb, base.a * surface.alpha);\n\n } else {\n // SOLID / WIREFRAME / FACETED\n var color = surface.solidColor.rgb;\n if (surface.renderMode == 2u) {\n // FACETED\n let fdx = dpdx(input.worldPos);\n let fdy = dpdy(input.worldPos);\n let faceNormal = normalize(cross(fdx, fdy));\n let lightDir = normalize(vec3<f32>(0.5, 0.5, 1.0));\n let diff = max(dot(faceNormal, lightDir), 0.2);\n color *= diff;\n }\n finalColor = vec4<f32>(color, surface.solidColor.a * surface.alpha);\n }\n\n // Alpha Test (Simple discard for fence textures if alpha is very low)\n if (finalColor.a < 0.01) {\n discard;\n }\n\n return finalColor;\n}\n";
11317
+ var bsp_default = "struct DLight {\n position: vec3<f32>,\n intensity: f32,\n color: vec3<f32>,\n padding: f32,\n}\n\nstruct FrameUniforms {\n viewProjection: mat4x4<f32>, // 0-64\n cameraPosition: vec3<f32>, // 64-76\n pad0: f32, // 76-80 (Explicit padding to align next field to 80)\n time: f32, // 80-84\n brightness: f32, // 84-88\n gamma: f32, // 88-92\n ambient: f32, // 92-96\n numDlights: u32, // 96-100\n fullbright: u32, // 100-104\n pad1: vec2<f32>, // 104-112 (Aligns next field to 112)\n pad2: vec4<f32>, // 112-128 (Aligns next field to 128)\n dlights: array<DLight, 32>, // Starts at 128\n}\n\nstruct SurfaceUniforms {\n texScroll: vec2<f32>,\n lightmapScroll: vec2<f32>,\n lightStyleFactors: vec4<f32>,\n styleLayerMapping: vec4<f32>,\n solidColor: vec4<f32>,\n alpha: f32,\n applyLightmap: u32,\n warp: u32,\n lightmapOnly: u32,\n renderMode: u32, // 0: Texture, 1: Solid, 2: Faceted, 3: WorldPos Debug, 4: Distance Debug\n pad0: vec3<f32>,\n // Workaround for worldPos offset bug: surface mins for correction\n surfaceMins: vec3<f32>,\n pad1: f32,\n}\n\n@group(0) @binding(0) var<uniform> frame: FrameUniforms;\n@group(1) @binding(0) var<uniform> surface: SurfaceUniforms;\n@group(2) @binding(0) var diffuseMap: texture_2d<f32>;\n@group(2) @binding(1) var diffuseSampler: sampler;\n@group(2) @binding(2) var lightmapAtlas: texture_2d<f32>;\n@group(2) @binding(3) var lightmapSampler: sampler;\n\nstruct VertexInput {\n @location(0) position: vec3<f32>,\n @location(1) texCoord: vec2<f32>,\n @location(2) lightmapCoord: vec2<f32>,\n @location(3) lightmapStep: f32,\n}\n\nstruct VertexOutput {\n @builtin(position) position: vec4<f32>,\n @location(0) texCoord: vec2<f32>,\n @location(1) lightmapCoord: vec2<f32>,\n @location(2) lightmapStep: f32,\n @location(3) worldPos: vec3<f32>,\n @location(4) screenPos: vec4<f32>,\n}\n\n@vertex\nfn vertexMain(input: VertexInput) -> VertexOutput {\n var output: VertexOutput;\n\n var pos = input.position;\n var tex = input.texCoord;\n var lm = input.lightmapCoord;\n\n // Vertex Warping\n if (surface.warp != 0u) {\n let amp = 0.125;\n let s = tex.x + sin((tex.y * 0.125 + frame.time) * 1.0) * amp;\n let t = tex.y + sin((tex.x * 0.125 + frame.time) * 1.0) * amp;\n tex = vec2<f32>(s, t);\n }\n\n output.texCoord = tex + surface.texScroll;\n output.lightmapCoord = lm + surface.lightmapScroll;\n output.lightmapStep = input.lightmapStep;\n output.worldPos = pos;\n output.position = frame.viewProjection * vec4<f32>(pos, 1.0);\n output.screenPos = output.position;\n\n return output;\n}\n\n@fragment\nfn fragmentMain(input: VertexOutput) -> @location(0) vec4<f32> {\n var finalColor: vec4<f32>;\n\n if (surface.renderMode == 0u) {\n // TEXTURED MODE\n var base = vec4<f32>(1.0, 1.0, 1.0, 1.0);\n if (surface.lightmapOnly == 0u) {\n base = textureSample(diffuseMap, diffuseSampler, input.texCoord);\n }\n\n var totalLight = vec3<f32>(0.0, 0.0, 0.0);\n\n if (frame.fullbright != 0u) {\n totalLight = vec3<f32>(1.0, 1.0, 1.0);\n } else {\n // Apply Lightmaps\n if (surface.applyLightmap != 0u) {\n var hasLight = false;\n for (var i = 0; i < 4; i++) {\n let layer = surface.styleLayerMapping[i];\n let factor = surface.lightStyleFactors[i];\n\n if (layer >= -0.5) {\n let offset = vec2<f32>(0.0, layer * input.lightmapStep);\n totalLight += textureSample(lightmapAtlas, lightmapSampler, input.lightmapCoord + offset).rgb * factor;\n hasLight = true;\n }\n }\n\n // If lightmap enabled but no active layers, fallback to white?\n // Quake 2 logic usually implies at least one style is active if surfaced has SURF_LIGHT\n // But if we have no lightmap data, we start black.\n if (!hasLight) {\n // Fallback to avoid pitch black if lightmap intended but missing?\n // totalLight = vec3<f32>(1.0, 1.0, 1.0);\n }\n }\n\n // Apply Dynamic Lights\n // Workaround: worldPos appears offset by surface.mins, so we add it back\n let correctedWorldPos = input.worldPos + surface.surfaceMins;\n for (var i = 0u; i < 32u; i++) {\n if (i >= frame.numDlights) {\n break;\n }\n let dlight = frame.dlights[i];\n let dist = distance(correctedWorldPos, dlight.position);\n\n if (dist < dlight.intensity) {\n let contribution = (dlight.intensity - dist) * (1.0 / 255.0);\n totalLight += dlight.color * contribution;\n }\n }\n }\n\n totalLight = max(totalLight, vec3<f32>(frame.ambient));\n totalLight *= frame.brightness;\n base = vec4<f32>(base.rgb * totalLight, base.a);\n\n // Gamma correction\n if (frame.gamma != 1.0) {\n base = vec4<f32>(pow(base.rgb, vec3<f32>(1.0 / frame.gamma)), base.a);\n }\n\n finalColor = vec4<f32>(base.rgb, base.a * surface.alpha);\n\n } else if (surface.renderMode == 3u) {\n // DEBUG: Output corrected worldPos as color (scaled to 0-1 range)\n // Map worldPos components: divide by 256 and take fract to visualize\n // Values 0-255 map to 0-1, values 256-511 wrap back to 0-1, etc.\n // Use correctedWorldPos (input.worldPos + surface.surfaceMins) for accurate debug output\n let debugWorldPos = input.worldPos + surface.surfaceMins;\n let posScaled = abs(debugWorldPos) / 256.0;\n finalColor = vec4<f32>(fract(posScaled.x), fract(posScaled.y), fract(posScaled.z), 1.0);\n } else if (surface.renderMode == 4u) {\n // DEBUG: Output distance to first dlight as grayscale\n // Brighter = closer to light. Scale: 0-500 units maps to 1.0-0.0\n // Use correctedWorldPos (input.worldPos + surface.surfaceMins) for accurate distance calculation\n let debugWorldPos = input.worldPos + surface.surfaceMins;\n var dist = 500.0;\n if (frame.numDlights > 0u) {\n dist = distance(debugWorldPos, frame.dlights[0].position);\n }\n let brightness = clamp(1.0 - dist / 500.0, 0.0, 1.0);\n finalColor = vec4<f32>(brightness, brightness, brightness, 1.0);\n } else {\n // SOLID / WIREFRAME / FACETED\n var color = surface.solidColor.rgb;\n if (surface.renderMode == 2u) {\n // FACETED\n let fdx = dpdx(input.worldPos);\n let fdy = dpdy(input.worldPos);\n let faceNormal = normalize(cross(fdx, fdy));\n let lightDir = normalize(vec3<f32>(0.5, 0.5, 1.0));\n let diff = max(dot(faceNormal, lightDir), 0.2);\n color *= diff;\n }\n finalColor = vec4<f32>(color, surface.solidColor.a * surface.alpha);\n }\n\n // Alpha Test (Simple discard for fence textures if alpha is very low)\n if (finalColor.a < 0.01) {\n discard;\n }\n\n return finalColor;\n}\n";
11054
11318
 
11055
11319
  // src/render/webgpu/pipelines/bspPipeline.ts
11056
11320
  var DEFAULT_STYLE_INDICES2 = [0, 255, 255, 255];
@@ -11093,8 +11357,21 @@ function deriveSurfaceRenderState2(surfaceFlags = shared.SURF_NONE, timeSeconds
11093
11357
  }
11094
11358
  var BspSurfacePipeline3 = class {
11095
11359
  constructor(device, format, depthFormat) {
11360
+ __publicField(this, "device");
11361
+ __publicField(this, "pipeline");
11362
+ __publicField(this, "pipelineWireframe");
11363
+ __publicField(this, "frameUniformBuffer");
11364
+ __publicField(this, "surfaceUniformBuffer");
11365
+ __publicField(this, "frameBindGroup");
11366
+ __publicField(this, "frameBindGroupLayout");
11367
+ __publicField(this, "surfaceBindGroupLayout");
11368
+ __publicField(this, "textureBindGroupLayout");
11369
+ // Default resources
11370
+ __publicField(this, "defaultWhiteTexture");
11371
+ __publicField(this, "defaultSampler");
11372
+ __publicField(this, "defaultBindGroup");
11096
11373
  // Cache for texture bind groups
11097
- this.textureBindGroupCache = /* @__PURE__ */ new Map();
11374
+ __publicField(this, "textureBindGroupCache", /* @__PURE__ */ new Map());
11098
11375
  this.device = device;
11099
11376
  const frameBufferSize = 2048;
11100
11377
  const surfaceBufferSize = 256;
@@ -11248,7 +11525,8 @@ var BspSurfacePipeline3 = class {
11248
11525
  gamma = 1,
11249
11526
  fullbright = false,
11250
11527
  ambient = 0,
11251
- cameraPosition = [0, 0, 0]
11528
+ cameraPosition = [0, 0, 0],
11529
+ surfaceMins = { x: 0, y: 0, z: 0 }
11252
11530
  } = options;
11253
11531
  const state = deriveSurfaceRenderState2(surfaceFlags, timeSeconds);
11254
11532
  const styles = resolveLightStyles2(styleIndices, styleValues);
@@ -11297,6 +11575,10 @@ var BspSurfacePipeline3 = class {
11297
11575
  modeInt = 1;
11298
11576
  } else if (renderMode.mode === "solid-faceted") {
11299
11577
  modeInt = 2;
11578
+ } else if (renderMode.mode === "worldpos-debug") {
11579
+ modeInt = 3;
11580
+ } else if (renderMode.mode === "distance-debug") {
11581
+ modeInt = 4;
11300
11582
  }
11301
11583
  if (renderMode.color) {
11302
11584
  color = [...renderMode.color];
@@ -11312,6 +11594,9 @@ var BspSurfacePipeline3 = class {
11312
11594
  surfaceUint[18] = finalWarp ? 1 : 0;
11313
11595
  surfaceUint[19] = lightmapOnly ? 1 : 0;
11314
11596
  surfaceUint[20] = modeInt;
11597
+ surfaceData[28] = surfaceMins.x;
11598
+ surfaceData[29] = surfaceMins.y;
11599
+ surfaceData[30] = surfaceMins.z;
11315
11600
  this.device.queue.writeBuffer(this.surfaceUniformBuffer, 0, surfaceData);
11316
11601
  const surfaceBindGroup = this.device.createBindGroup({
11317
11602
  layout: this.surfaceBindGroupLayout,
@@ -11358,12 +11643,17 @@ var WebGPURendererImpl = class {
11358
11643
  this.context = context;
11359
11644
  this.frameRenderer = frameRenderer;
11360
11645
  this.pipelines = pipelines;
11361
- this.type = "webgpu";
11646
+ __publicField(this, "type", "webgpu");
11362
11647
  // Texture cache for registered pics
11363
- this.picCache = /* @__PURE__ */ new Map();
11364
- this.font = null;
11648
+ __publicField(this, "picCache", /* @__PURE__ */ new Map());
11649
+ __publicField(this, "whiteTexture");
11650
+ __publicField(this, "font", null);
11365
11651
  // 2D rendering state
11366
- this.is2DActive = false;
11652
+ __publicField(this, "is2DActive", false);
11653
+ // Stub implementations for required properties
11654
+ __publicField(this, "collisionVis");
11655
+ __publicField(this, "debug");
11656
+ __publicField(this, "particleSystem");
11367
11657
  this.whiteTexture = new Texture2D2(context.device, {
11368
11658
  width: 1,
11369
11659
  height: 1,
@@ -11673,8 +11963,11 @@ async function createWebGPURenderer(canvas, options) {
11673
11963
  }
11674
11964
  var DemoReader = class {
11675
11965
  constructor(buffer) {
11676
- this.messageOffsets = [];
11677
- this.currentBlock = null;
11966
+ __publicField(this, "buffer");
11967
+ __publicField(this, "view");
11968
+ __publicField(this, "offset");
11969
+ __publicField(this, "messageOffsets", []);
11970
+ __publicField(this, "currentBlock", null);
11678
11971
  this.buffer = buffer;
11679
11972
  this.view = new DataView(buffer);
11680
11973
  this.offset = 0;
@@ -16015,6 +16308,9 @@ var pako = {
16015
16308
  var _StreamingBuffer = class _StreamingBuffer {
16016
16309
  // From vanilla Q2
16017
16310
  constructor(initialCapacity = _StreamingBuffer.INITIAL_SIZE) {
16311
+ __publicField(this, "buffer");
16312
+ __publicField(this, "readOffset");
16313
+ __publicField(this, "writeOffset");
16018
16314
  this.buffer = new Uint8Array(initialCapacity);
16019
16315
  this.readOffset = 0;
16020
16316
  this.writeOffset = 0;
@@ -16205,9 +16501,9 @@ var _StreamingBuffer = class _StreamingBuffer {
16205
16501
  this.writeOffset = 0;
16206
16502
  }
16207
16503
  };
16208
- _StreamingBuffer.INITIAL_SIZE = 64 * 1024;
16504
+ __publicField(_StreamingBuffer, "INITIAL_SIZE", 64 * 1024);
16209
16505
  // 64KB initial buffer
16210
- _StreamingBuffer.MAX_STRING_LENGTH = 2048;
16506
+ __publicField(_StreamingBuffer, "MAX_STRING_LENGTH", 2048);
16211
16507
  var StreamingBuffer = _StreamingBuffer;
16212
16508
 
16213
16509
  // src/demo/state.ts
@@ -16289,7 +16585,7 @@ var PROTO34_MAP = {
16289
16585
  };
16290
16586
  var Quake2ProtocolHandler = class {
16291
16587
  constructor() {
16292
- this.protocolVersion = 34;
16588
+ __publicField(this, "protocolVersion", 34);
16293
16589
  }
16294
16590
  translateCommand(cmd) {
16295
16591
  if (PROTO34_MAP[cmd] !== void 0) {
@@ -16444,7 +16740,7 @@ var Quake2ProtocolHandler = class {
16444
16740
  var PROTOCOL_VERSION_RERELEASE = 2023;
16445
16741
  var RereleaseProtocolHandler = class {
16446
16742
  constructor() {
16447
- this.protocolVersion = PROTOCOL_VERSION_RERELEASE;
16743
+ __publicField(this, "protocolVersion", PROTOCOL_VERSION_RERELEASE);
16448
16744
  }
16449
16745
  translateCommand(cmd) {
16450
16746
  return cmd;
@@ -16601,6 +16897,7 @@ var RereleaseProtocolHandler = class {
16601
16897
  };
16602
16898
  var LegacyProtocolHandler = class {
16603
16899
  constructor(version = 0) {
16900
+ __publicField(this, "protocolVersion");
16604
16901
  this.protocolVersion = version;
16605
16902
  }
16606
16903
  translateCommand(cmd) {
@@ -16752,7 +17049,7 @@ var LegacyProtocolHandler = class {
16752
17049
  };
16753
17050
  var BootstrapProtocolHandler = class {
16754
17051
  constructor() {
16755
- this.protocolVersion = 0;
17052
+ __publicField(this, "protocolVersion", 0);
16756
17053
  }
16757
17054
  // We assume standard Q2 opcodes for bootstrap to find serverdata
16758
17055
  // but we can also check for legacy serverdata (12 vs 13 vs 7)
@@ -16870,9 +17167,12 @@ var BinaryStreamAdapter = class extends StreamingBuffer {
16870
17167
  };
16871
17168
  var NetworkMessageParser = class _NetworkMessageParser {
16872
17169
  constructor(stream, handler, strictMode = false) {
16873
- this.strictMode = false;
16874
- this.errorCount = 0;
16875
- this.isDemo = RECORD_CLIENT;
17170
+ __publicField(this, "stream");
17171
+ __publicField(this, "handler");
17172
+ __publicField(this, "strictMode", false);
17173
+ __publicField(this, "errorCount", 0);
17174
+ __publicField(this, "protocolHandler");
17175
+ __publicField(this, "isDemo", RECORD_CLIENT);
16876
17176
  if (stream instanceof shared.BinaryStream) {
16877
17177
  this.stream = new BinaryStreamAdapter(stream);
16878
17178
  } else {
@@ -17498,23 +17798,24 @@ var DemoEventType = /* @__PURE__ */ ((DemoEventType2) => {
17498
17798
  // src/demo/analyzer.ts
17499
17799
  var DemoAnalyzer = class {
17500
17800
  constructor(buffer) {
17501
- this.events = [];
17502
- this.summary = {
17801
+ __publicField(this, "buffer");
17802
+ __publicField(this, "events", []);
17803
+ __publicField(this, "summary", {
17503
17804
  totalKills: 0,
17504
17805
  totalDeaths: 0,
17505
17806
  damageDealt: 0,
17506
17807
  damageReceived: 0,
17507
17808
  weaponUsage: /* @__PURE__ */ new Map()
17508
- };
17509
- this.header = null;
17510
- this.configStrings = /* @__PURE__ */ new Map();
17511
- this.serverInfo = {};
17512
- this.statistics = null;
17513
- this.playerStats = /* @__PURE__ */ new Map();
17809
+ });
17810
+ __publicField(this, "header", null);
17811
+ __publicField(this, "configStrings", /* @__PURE__ */ new Map());
17812
+ __publicField(this, "serverInfo", {});
17813
+ __publicField(this, "statistics", null);
17814
+ __publicField(this, "playerStats", /* @__PURE__ */ new Map());
17514
17815
  // By playerNum
17515
- this.weaponStats = /* @__PURE__ */ new Map();
17816
+ __publicField(this, "weaponStats", /* @__PURE__ */ new Map());
17516
17817
  // By entity ID
17517
- this.activeEntities = /* @__PURE__ */ new Set();
17818
+ __publicField(this, "activeEntities", /* @__PURE__ */ new Set());
17518
17819
  this.buffer = buffer;
17519
17820
  }
17520
17821
  analyze() {
@@ -17786,39 +18087,41 @@ var createNoOpHandler = () => ({
17786
18087
  });
17787
18088
  var DemoPlaybackController = class {
17788
18089
  constructor() {
17789
- this.reader = null;
17790
- this.buffer = null;
18090
+ __publicField(this, "reader", null);
18091
+ __publicField(this, "buffer", null);
17791
18092
  // Keep reference for analysis
17792
- this.state = 0 /* Stopped */;
17793
- this.playbackSpeed = 1;
17794
- this.currentProtocolVersion = 0;
17795
- this.currentFrameIndex = -1;
18093
+ __publicField(this, "state", 0 /* Stopped */);
18094
+ __publicField(this, "playbackSpeed", 1);
18095
+ __publicField(this, "handler");
18096
+ __publicField(this, "callbacks");
18097
+ __publicField(this, "currentProtocolVersion", 0);
18098
+ __publicField(this, "currentFrameIndex", -1);
17796
18099
  // -1 means no frames processed yet
17797
18100
  // Last parsed frame data for accessors
17798
- this.lastFrameData = null;
18101
+ __publicField(this, "lastFrameData", null);
17799
18102
  // Timing
17800
- this.accumulatedTime = 0;
17801
- this.frameDuration = 100;
18103
+ __publicField(this, "accumulatedTime", 0);
18104
+ __publicField(this, "frameDuration", 100);
17802
18105
  // ms (10Hz default)
17803
18106
  // Snapshots
17804
- this.snapshotInterval = 100;
18107
+ __publicField(this, "snapshotInterval", 100);
17805
18108
  // frames
17806
- this.snapshots = /* @__PURE__ */ new Map();
18109
+ __publicField(this, "snapshots", /* @__PURE__ */ new Map());
17807
18110
  // Analysis Cache
17808
- this.cachedEvents = null;
17809
- this.cachedSummary = null;
17810
- this.cachedHeader = null;
17811
- this.cachedConfigStrings = null;
17812
- this.cachedServerInfo = null;
17813
- this.cachedStatistics = null;
17814
- this.cachedPlayerStats = null;
17815
- this.cachedWeaponStats = null;
18111
+ __publicField(this, "cachedEvents", null);
18112
+ __publicField(this, "cachedSummary", null);
18113
+ __publicField(this, "cachedHeader", null);
18114
+ __publicField(this, "cachedConfigStrings", null);
18115
+ __publicField(this, "cachedServerInfo", null);
18116
+ __publicField(this, "cachedStatistics", null);
18117
+ __publicField(this, "cachedPlayerStats", null);
18118
+ __publicField(this, "cachedWeaponStats", null);
17816
18119
  // Resource Tracking
17817
- this.tracker = null;
18120
+ __publicField(this, "tracker", null);
17818
18121
  // Camera State
17819
- this.cameraMode = 0 /* FirstPerson */;
17820
- this.thirdPersonDistance = 80;
17821
- this.thirdPersonOffset = { x: 0, y: 0, z: 0 };
18122
+ __publicField(this, "cameraMode", 0 /* FirstPerson */);
18123
+ __publicField(this, "thirdPersonDistance", 80);
18124
+ __publicField(this, "thirdPersonOffset", { x: 0, y: 0, z: 0 });
17822
18125
  }
17823
18126
  setHandler(handler) {
17824
18127
  this.handler = handler;
@@ -18439,11 +18742,12 @@ var DemoPlaybackController = class {
18439
18742
  var DemoRecorder = class {
18440
18743
  // -1 means start of demo
18441
18744
  constructor() {
18442
- this.isRecording = false;
18443
- this.startTime = 0;
18444
- this.frameCount = 0;
18445
- this.filename = null;
18446
- this.lastMessageSize = -1;
18745
+ __publicField(this, "isRecording", false);
18746
+ __publicField(this, "messageBuffer");
18747
+ __publicField(this, "startTime", 0);
18748
+ __publicField(this, "frameCount", 0);
18749
+ __publicField(this, "filename", null);
18750
+ __publicField(this, "lastMessageSize", -1);
18447
18751
  this.messageBuffer = new shared.BinaryWriter(1024 * 1024);
18448
18752
  }
18449
18753
  startRecording(filename, startTime = 0) {
@@ -18476,6 +18780,8 @@ var DemoRecorder = class {
18476
18780
  };
18477
18781
  var MessageWriter = class {
18478
18782
  constructor(writer, protocol = 34) {
18783
+ __publicField(this, "writer");
18784
+ __publicField(this, "protocol");
18479
18785
  this.writer = writer || new shared.BinaryWriter(new Uint8Array(64 * 1024));
18480
18786
  this.protocol = protocol;
18481
18787
  }
@@ -18835,10 +19141,12 @@ var DemoValidator = class {
18835
19141
  // src/demo/clipper.ts
18836
19142
  var DemoClipper = class {
18837
19143
  constructor(buffer) {
18838
- this.frames = [];
18839
- this.configStrings = /* @__PURE__ */ new Map();
18840
- this.baselines = /* @__PURE__ */ new Map();
18841
- this.currentEntities = /* @__PURE__ */ new Map();
19144
+ __publicField(this, "parser");
19145
+ __publicField(this, "frames", []);
19146
+ __publicField(this, "serverData");
19147
+ __publicField(this, "configStrings", /* @__PURE__ */ new Map());
19148
+ __publicField(this, "baselines", /* @__PURE__ */ new Map());
19149
+ __publicField(this, "currentEntities", /* @__PURE__ */ new Map());
18842
19150
  if (buffer) {
18843
19151
  const sb = new StreamingBuffer(buffer.byteLength);
18844
19152
  sb.append(new Uint8Array(buffer));
@@ -19553,13 +19861,13 @@ async function captureRenderTarget(device, texture) {
19553
19861
  // src/render/null/renderer.ts
19554
19862
  var NullRenderer = class {
19555
19863
  constructor(width = 800, height = 600) {
19556
- this.width = 0;
19557
- this.height = 0;
19558
- this.collisionVis = null;
19559
- this.debug = null;
19560
- this.particleSystem = null;
19561
- this.frameCount = 0;
19562
- this.callLog = [];
19864
+ __publicField(this, "width", 0);
19865
+ __publicField(this, "height", 0);
19866
+ __publicField(this, "collisionVis", null);
19867
+ __publicField(this, "debug", null);
19868
+ __publicField(this, "particleSystem", null);
19869
+ __publicField(this, "frameCount", 0);
19870
+ __publicField(this, "callLog", []);
19563
19871
  this.width = width;
19564
19872
  this.height = height;
19565
19873
  }
@@ -19672,7 +19980,7 @@ var NullRenderer = class {
19672
19980
  };
19673
19981
  var WebGLMatrixBuilder = class {
19674
19982
  constructor() {
19675
- this.coordinateSystem = "opengl" /* OPENGL */;
19983
+ __publicField(this, "coordinateSystem", "opengl" /* OPENGL */);
19676
19984
  }
19677
19985
  buildProjectionMatrix(camera) {
19678
19986
  const projection = glMatrix.mat4.create();
@@ -19738,7 +20046,7 @@ var WebGLMatrixBuilder = class {
19738
20046
  };
19739
20047
  var IdentityMatrixBuilder = class {
19740
20048
  constructor() {
19741
- this.coordinateSystem = "quake" /* QUAKE */;
20049
+ __publicField(this, "coordinateSystem", "quake" /* QUAKE */);
19742
20050
  }
19743
20051
  buildProjectionMatrix(camera) {
19744
20052
  const projection = glMatrix.mat4.create();
@@ -19789,12 +20097,14 @@ function quakeToWebGPU(v) {
19789
20097
  // src/render/logging/renderer.ts
19790
20098
  var LoggingRenderer = class {
19791
20099
  constructor(options = {}) {
19792
- this.width = 0;
19793
- this.height = 0;
19794
- this.collisionVis = null;
19795
- this.debug = null;
19796
- this.particleSystem = null;
19797
- this.logs = [];
20100
+ __publicField(this, "width", 0);
20101
+ __publicField(this, "height", 0);
20102
+ __publicField(this, "collisionVis", null);
20103
+ __publicField(this, "debug", null);
20104
+ __publicField(this, "particleSystem", null);
20105
+ __publicField(this, "logs", []);
20106
+ __publicField(this, "builder");
20107
+ __publicField(this, "options");
19798
20108
  this.options = {
19799
20109
  targetSystem: options.targetSystem ?? "quake" /* QUAKE */,
19800
20110
  verbose: options.verbose ?? true,
@@ -19993,23 +20303,25 @@ var ConnectionState = /* @__PURE__ */ ((ConnectionState2) => {
19993
20303
  })(ConnectionState || {});
19994
20304
  var ClientConnection = class {
19995
20305
  constructor(options) {
19996
- this.state = 0 /* Disconnected */;
19997
- this.parser = null;
20306
+ __publicField(this, "state", 0 /* Disconnected */);
20307
+ __publicField(this, "netchan");
20308
+ __publicField(this, "parser", null);
20309
+ __publicField(this, "options");
19998
20310
  // Event listeners
19999
- this.listeners = {};
20311
+ __publicField(this, "listeners", {});
20000
20312
  // Game State
20001
- this.serverProtocol = 0;
20002
- this.serverCount = 0;
20003
- this.gameDir = "";
20004
- this.playerNum = 0;
20005
- this.levelName = "";
20006
- this.configStrings = /* @__PURE__ */ new Map();
20007
- this.baselines = /* @__PURE__ */ new Map();
20008
- this.entities = /* @__PURE__ */ new Map();
20009
- this.latestServerFrame = 0;
20010
- this.frameCRCs = /* @__PURE__ */ new Map();
20011
- this.currentPacketCRC = 0;
20012
- this.commandHistory = [];
20313
+ __publicField(this, "serverProtocol", 0);
20314
+ __publicField(this, "serverCount", 0);
20315
+ __publicField(this, "gameDir", "");
20316
+ __publicField(this, "playerNum", 0);
20317
+ __publicField(this, "levelName", "");
20318
+ __publicField(this, "configStrings", /* @__PURE__ */ new Map());
20319
+ __publicField(this, "baselines", /* @__PURE__ */ new Map());
20320
+ __publicField(this, "entities", /* @__PURE__ */ new Map());
20321
+ __publicField(this, "latestServerFrame", 0);
20322
+ __publicField(this, "frameCRCs", /* @__PURE__ */ new Map());
20323
+ __publicField(this, "currentPacketCRC", 0);
20324
+ __publicField(this, "commandHistory", []);
20013
20325
  this.options = options;
20014
20326
  this.netchan = options.netchan ?? new shared.NetChan();
20015
20327
  }