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
@@ -2036,6 +2036,28 @@ var VirtualFileSystem = class {
2036
2036
  async readBinaryFile(path) {
2037
2037
  return this.readFile(path);
2038
2038
  }
2039
+ streamFile(path, chunkSize = 1024 * 1024) {
2040
+ const source = this.files.get(normalizePath(path));
2041
+ if (!source) {
2042
+ throw new Error(`File not found in VFS: ${path}`);
2043
+ }
2044
+ const { archive, entry } = source;
2045
+ const fullData = archive.readFile(path);
2046
+ let offset = 0;
2047
+ const totalSize = fullData.length;
2048
+ return new ReadableStream({
2049
+ pull(controller) {
2050
+ if (offset >= totalSize) {
2051
+ controller.close();
2052
+ return;
2053
+ }
2054
+ const end = Math.min(offset + chunkSize, totalSize);
2055
+ const chunk = fullData.slice(offset, end);
2056
+ offset = end;
2057
+ controller.enqueue(chunk);
2058
+ }
2059
+ });
2060
+ }
2039
2061
  async readTextFile(path) {
2040
2062
  const data = await this.readFile(path);
2041
2063
  return new TextDecoder("utf-8").decode(data);
@@ -6696,6 +6718,25 @@ var Camera = class {
6696
6718
  );
6697
6719
  return projectionMatrix;
6698
6720
  }
6721
+ screenToWorldRay(screenX, screenY) {
6722
+ const ndcX = screenX * 2 - 1;
6723
+ const ndcY = 1 - screenY * 2;
6724
+ const clipStart = import_gl_matrix.vec3.fromValues(ndcX, ndcY, -1);
6725
+ const clipEnd = import_gl_matrix.vec3.fromValues(ndcX, ndcY, 1);
6726
+ const invViewProj = import_gl_matrix.mat4.create();
6727
+ import_gl_matrix.mat4.invert(invViewProj, this.viewProjectionMatrix);
6728
+ const worldStart = import_gl_matrix.vec3.create();
6729
+ const worldEnd = import_gl_matrix.vec3.create();
6730
+ import_gl_matrix.vec3.transformMat4(worldStart, clipStart, invViewProj);
6731
+ import_gl_matrix.vec3.transformMat4(worldEnd, clipEnd, invViewProj);
6732
+ const direction = import_gl_matrix.vec3.create();
6733
+ import_gl_matrix.vec3.subtract(direction, worldEnd, worldStart);
6734
+ import_gl_matrix.vec3.normalize(direction, direction);
6735
+ return {
6736
+ origin: import_gl_matrix.vec3.clone(this._position),
6737
+ direction
6738
+ };
6739
+ }
6699
6740
  updateMatrices() {
6700
6741
  if (!this._dirty) {
6701
6742
  return;
@@ -6709,20 +6750,20 @@ var Camera = class {
6709
6750
  );
6710
6751
  const quakeToGl = import_gl_matrix.mat4.fromValues(
6711
6752
  0,
6712
- -1,
6713
6753
  0,
6754
+ -1,
6714
6755
  0,
6715
- // column 0: Quake X -> WebGL (0, -1, 0)
6756
+ // column 0: Quake X -> WebGL -Z
6757
+ -1,
6716
6758
  0,
6717
6759
  0,
6718
- 1,
6719
6760
  0,
6720
- // column 1: Quake Y -> WebGL (0, 0, 1)
6721
- -1,
6761
+ // column 1: Quake Y -> WebGL -X
6722
6762
  0,
6763
+ 1,
6723
6764
  0,
6724
6765
  0,
6725
- // column 2: Quake Z -> WebGL (-1, 0, 0)
6766
+ // column 2: Quake Z -> WebGL Y
6726
6767
  0,
6727
6768
  0,
6728
6769
  0,
@@ -6747,9 +6788,12 @@ var Camera = class {
6747
6788
  const rotatedPosQuake = import_gl_matrix.vec3.create();
6748
6789
  import_gl_matrix.vec3.transformMat4(rotatedPosQuake, negativePosition, rotationQuake);
6749
6790
  const translationGl = import_gl_matrix.vec3.fromValues(
6750
- rotatedPosQuake[1] || 0,
6791
+ rotatedPosQuake[1] ? -rotatedPosQuake[1] : 0,
6792
+ // Y in Quake -> -X in WebGL
6751
6793
  rotatedPosQuake[2] || 0,
6752
- rotatedPosQuake[0] || 0
6794
+ // Z in Quake -> Y in WebGL
6795
+ rotatedPosQuake[0] ? -rotatedPosQuake[0] : 0
6796
+ // X in Quake -> -Z in WebGL
6753
6797
  );
6754
6798
  import_gl_matrix.mat4.copy(this._viewMatrix, rotationGl);
6755
6799
  this._viewMatrix[12] = translationGl[0];