@quake2ts/engine 0.0.819 → 0.0.824

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.
@@ -5092,7 +5092,10 @@ function leafIntersectsFrustum(leaf, planes) {
5092
5092
  return boxIntersectsFrustum(mins, maxs, planes);
5093
5093
  }
5094
5094
  function findLeafForPoint(map, point) {
5095
- let nodeIndex = 0;
5095
+ if (map.models.length === 0) {
5096
+ return -1;
5097
+ }
5098
+ let nodeIndex = map.models[0].headNode;
5096
5099
  while (nodeIndex >= 0) {
5097
5100
  const node = map.nodes[nodeIndex];
5098
5101
  const plane = map.planes[node.planeIndex];
@@ -5104,6 +5107,9 @@ function findLeafForPoint(map, point) {
5104
5107
  }
5105
5108
  nodeIndex = child;
5106
5109
  }
5110
+ if (childIsLeaf(nodeIndex)) {
5111
+ return childLeafIndex(nodeIndex);
5112
+ }
5107
5113
  return -1;
5108
5114
  }
5109
5115
  function collectFacesFromLeaf(map, leafIndex) {
@@ -5193,7 +5199,10 @@ function gatherVisibleFaces(map, cameraPosition, frustum, portalState) {
5193
5199
  }
5194
5200
  const visibleFaces = [];
5195
5201
  const visitedFaces = /* @__PURE__ */ new Set();
5196
- traverse(map, 0, cameraPosition, frustum, viewCluster, visibleFaces, visitedFaces, reachableAreas);
5202
+ if (map.models.length > 0) {
5203
+ const headNode = map.models[0].headNode;
5204
+ traverse(map, headNode, cameraPosition, frustum, viewCluster, visibleFaces, visitedFaces, reachableAreas);
5205
+ }
5197
5206
  return visibleFaces;
5198
5207
  }
5199
5208
 
@@ -9548,6 +9557,10 @@ var createRenderer = (gl) => {
9548
9557
  queuedInstances.push(entity);
9549
9558
  }
9550
9559
  };
9560
+ const uploadBspGeometry = (map) => {
9561
+ const surfaces = createBspSurfaces(map);
9562
+ return buildBspGeometry(gl, surfaces, map);
9563
+ };
9551
9564
  return {
9552
9565
  get width() {
9553
9566
  return gl.canvas.width;
@@ -9591,6 +9604,7 @@ var createRenderer = (gl) => {
9591
9604
  setLodBias,
9592
9605
  setAreaPortalState,
9593
9606
  renderInstanced,
9607
+ uploadBspGeometry,
9594
9608
  dispose: () => {
9595
9609
  gpuProfiler.dispose();
9596
9610
  }
@@ -17598,6 +17612,10 @@ var NullRenderer = class {
17598
17612
  drawfillRect(x, y, width, height, color) {
17599
17613
  this.callLog.push(`drawfillRect(${x}, ${y}, ${width}, ${height})`);
17600
17614
  }
17615
+ uploadBspGeometry(map) {
17616
+ this.callLog.push(`uploadBspGeometry(${map.faces.length})`);
17617
+ return { surfaces: [], lightmaps: [] };
17618
+ }
17601
17619
  setEntityHighlight(entityId, color) {
17602
17620
  }
17603
17621
  clearEntityHighlight(entityId) {
@@ -17998,6 +18016,10 @@ var LoggingRenderer = class {
17998
18016
  drawfillRect(x, y, width, height, color) {
17999
18017
  this.log(`drawfillRect(${x}, ${y}, ${width}x${height})`);
18000
18018
  }
18019
+ uploadBspGeometry(map) {
18020
+ this.log(`uploadBspGeometry(map with ${map.faces.length} faces)`);
18021
+ return { surfaces: [], lightmaps: [] };
18022
+ }
18001
18023
  // All other IRenderer methods as no-ops
18002
18024
  setEntityHighlight(entityId, color) {
18003
18025
  }