@d5techs/3dgs-lib 1.4.56 → 1.4.57

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.
package/dist/3dgs-lib.js CHANGED
@@ -2412,7 +2412,7 @@ class SkyboxRenderer {
2412
2412
  this.mode = "equirect";
2413
2413
  }
2414
2414
  // ---- common ----
2415
- prepareFrame(viewMatrix, projectionMatrix, cameraPosition) {
2415
+ prepareFrame(viewMatrix, projectionMatrix, cameraPosition, groundY) {
2416
2416
  if (!this.isActive) {
2417
2417
  this.frameReady = false;
2418
2418
  return;
@@ -2430,7 +2430,9 @@ class SkyboxRenderer {
2430
2430
  ud[9] = viewMatrix[9];
2431
2431
  ud[10] = viewMatrix[10];
2432
2432
  ud[11] = 0;
2433
- ud[12] = cameraPosition ? cameraPosition[1] : 0;
2433
+ const camWorldY = cameraPosition ? cameraPosition[1] : 0;
2434
+ const gndY = groundY ?? 0;
2435
+ ud[12] = camWorldY - gndY;
2434
2436
  ud[13] = this.groundRadius;
2435
2437
  ud[14] = 0;
2436
2438
  ud[15] = 0;
@@ -19071,10 +19073,22 @@ class App {
19071
19073
  this.hotspotManager.updateBillboards();
19072
19074
  if ((_a2 = this.skyboxRenderer) == null ? void 0 : _a2.isActive) {
19073
19075
  const cam = this.camera.position;
19076
+ let groundY = 0;
19077
+ const gsRenderer2 = this.sceneManager.getGSRenderer();
19078
+ if (gsRenderer2) {
19079
+ const bbox = gsRenderer2.getBoundingBox();
19080
+ if (bbox) {
19081
+ const m = gsRenderer2.getModelMatrix();
19082
+ const minLocalY = bbox.center[1] - bbox.radius;
19083
+ groundY = minLocalY * m[5] + bbox.center[1] * (m[5] - m[5]) + m[13];
19084
+ groundY = (bbox.center[1] - bbox.radius) * m[5] + m[13];
19085
+ }
19086
+ }
19074
19087
  this.skyboxRenderer.prepareFrame(
19075
19088
  this.camera.viewMatrix,
19076
19089
  this.camera.projectionMatrix,
19077
- [cam[0], cam[1], cam[2]]
19090
+ [cam[0], cam[1], cam[2]],
19091
+ groundY
19078
19092
  );
19079
19093
  }
19080
19094
  const pass = this.renderer.beginFrame();