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