quake2ts 0.0.410 → 0.0.412

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 (30) hide show
  1. package/package.json +1 -1
  2. package/packages/client/dist/browser/index.global.js +6 -6
  3. package/packages/client/dist/browser/index.global.js.map +1 -1
  4. package/packages/client/dist/cjs/index.cjs +30 -8
  5. package/packages/client/dist/cjs/index.cjs.map +1 -1
  6. package/packages/client/dist/esm/index.js +30 -8
  7. package/packages/client/dist/esm/index.js.map +1 -1
  8. package/packages/client/dist/tsconfig.tsbuildinfo +1 -1
  9. package/packages/engine/dist/browser/index.global.js +7 -7
  10. package/packages/engine/dist/browser/index.global.js.map +1 -1
  11. package/packages/engine/dist/cjs/index.cjs +52 -8
  12. package/packages/engine/dist/cjs/index.cjs.map +1 -1
  13. package/packages/engine/dist/esm/index.js +52 -8
  14. package/packages/engine/dist/esm/index.js.map +1 -1
  15. package/packages/engine/dist/tsconfig.tsbuildinfo +1 -1
  16. package/packages/engine/dist/types/assets/vfs.d.ts +1 -0
  17. package/packages/engine/dist/types/assets/vfs.d.ts.map +1 -1
  18. package/packages/engine/dist/types/editor/bsp-inspector.d.ts +28 -0
  19. package/packages/engine/dist/types/editor/bsp-inspector.d.ts.map +1 -0
  20. package/packages/engine/dist/types/render/camera.d.ts +4 -0
  21. package/packages/engine/dist/types/render/camera.d.ts.map +1 -1
  22. package/packages/engine/dist/types/render/cameraController.d.ts +5 -0
  23. package/packages/engine/dist/types/render/cameraController.d.ts.map +1 -1
  24. package/packages/game/dist/tsconfig.tsbuildinfo +1 -1
  25. package/packages/game/dist/types/editor/metadata.d.ts +31 -0
  26. package/packages/game/dist/types/editor/metadata.d.ts.map +1 -0
  27. package/packages/game/dist/types/editor/search.d.ts +9 -0
  28. package/packages/game/dist/types/editor/search.d.ts.map +1 -0
  29. package/packages/game/dist/types/editor/selection.d.ts +19 -0
  30. package/packages/game/dist/types/editor/selection.d.ts.map +1 -0
@@ -1833,6 +1833,28 @@ var VirtualFileSystem = class {
1833
1833
  async readBinaryFile(path) {
1834
1834
  return this.readFile(path);
1835
1835
  }
1836
+ streamFile(path, chunkSize = 1024 * 1024) {
1837
+ const source = this.files.get(normalizePath(path));
1838
+ if (!source) {
1839
+ throw new Error(`File not found in VFS: ${path}`);
1840
+ }
1841
+ const { archive, entry } = source;
1842
+ const fullData = archive.readFile(path);
1843
+ let offset = 0;
1844
+ const totalSize = fullData.length;
1845
+ return new ReadableStream({
1846
+ pull(controller) {
1847
+ if (offset >= totalSize) {
1848
+ controller.close();
1849
+ return;
1850
+ }
1851
+ const end = Math.min(offset + chunkSize, totalSize);
1852
+ const chunk = fullData.slice(offset, end);
1853
+ offset = end;
1854
+ controller.enqueue(chunk);
1855
+ }
1856
+ });
1857
+ }
1836
1858
  async readTextFile(path) {
1837
1859
  const data = await this.readFile(path);
1838
1860
  return new TextDecoder("utf-8").decode(data);
@@ -6493,6 +6515,25 @@ var Camera = class {
6493
6515
  );
6494
6516
  return projectionMatrix;
6495
6517
  }
6518
+ screenToWorldRay(screenX, screenY) {
6519
+ const ndcX = screenX * 2 - 1;
6520
+ const ndcY = 1 - screenY * 2;
6521
+ const clipStart = vec3.fromValues(ndcX, ndcY, -1);
6522
+ const clipEnd = vec3.fromValues(ndcX, ndcY, 1);
6523
+ const invViewProj = mat4.create();
6524
+ mat4.invert(invViewProj, this.viewProjectionMatrix);
6525
+ const worldStart = vec3.create();
6526
+ const worldEnd = vec3.create();
6527
+ vec3.transformMat4(worldStart, clipStart, invViewProj);
6528
+ vec3.transformMat4(worldEnd, clipEnd, invViewProj);
6529
+ const direction = vec3.create();
6530
+ vec3.subtract(direction, worldEnd, worldStart);
6531
+ vec3.normalize(direction, direction);
6532
+ return {
6533
+ origin: vec3.clone(this._position),
6534
+ direction
6535
+ };
6536
+ }
6496
6537
  updateMatrices() {
6497
6538
  if (!this._dirty) {
6498
6539
  return;
@@ -6506,20 +6547,20 @@ var Camera = class {
6506
6547
  );
6507
6548
  const quakeToGl = mat4.fromValues(
6508
6549
  0,
6509
- -1,
6510
6550
  0,
6551
+ -1,
6511
6552
  0,
6512
- // column 0: Quake X -> WebGL (0, -1, 0)
6553
+ // column 0: Quake X -> WebGL -Z
6554
+ -1,
6513
6555
  0,
6514
6556
  0,
6515
- 1,
6516
6557
  0,
6517
- // column 1: Quake Y -> WebGL (0, 0, 1)
6518
- -1,
6558
+ // column 1: Quake Y -> WebGL -X
6519
6559
  0,
6560
+ 1,
6520
6561
  0,
6521
6562
  0,
6522
- // column 2: Quake Z -> WebGL (-1, 0, 0)
6563
+ // column 2: Quake Z -> WebGL Y
6523
6564
  0,
6524
6565
  0,
6525
6566
  0,
@@ -6544,9 +6585,12 @@ var Camera = class {
6544
6585
  const rotatedPosQuake = vec3.create();
6545
6586
  vec3.transformMat4(rotatedPosQuake, negativePosition, rotationQuake);
6546
6587
  const translationGl = vec3.fromValues(
6547
- rotatedPosQuake[1] || 0,
6588
+ rotatedPosQuake[1] ? -rotatedPosQuake[1] : 0,
6589
+ // Y in Quake -> -X in WebGL
6548
6590
  rotatedPosQuake[2] || 0,
6549
- rotatedPosQuake[0] || 0
6591
+ // Z in Quake -> Y in WebGL
6592
+ rotatedPosQuake[0] ? -rotatedPosQuake[0] : 0
6593
+ // X in Quake -> -Z in WebGL
6550
6594
  );
6551
6595
  mat4.copy(this._viewMatrix, rotationGl);
6552
6596
  this._viewMatrix[12] = translationGl[0];