@pascal-app/viewer 1.0.0-beta.1 → 1.0.0-beta.3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"geometry-system.d.ts","sourceRoot":"","sources":["../../../src/systems/geometry/geometry-system.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAa,KAAK,KAAK,EAA4B,KAAK,QAAQ,EAAE,MAAM,OAAO,CAAA;AAQtF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,cAAc,YA8L1B,CAAA;AAmJD,eAAe,cAAc,CAAA;AAE7B,MAAM,MAAM,uBAAuB,GAAG;IACpC,KAAK,EAAE,KAAK,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,CAU7D;AAED,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,uBAAuB,CAAC,EAC3C,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,MAAM,GACV,OAAO,CAKT"}
1
+ {"version":3,"file":"geometry-system.d.ts","sourceRoot":"","sources":["../../../src/systems/geometry/geometry-system.tsx"],"names":[],"mappings":"AAkBA,OAAO,EAAa,KAAK,KAAK,EAA4B,KAAK,QAAQ,EAAE,MAAM,OAAO,CAAA;AAQtF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,cAAc,YA8L1B,CAAA;AAoKD,eAAe,cAAc,CAAA;AAE7B,MAAM,MAAM,uBAAuB,GAAG;IACpC,KAAK,EAAE,KAAK,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,CAU7D;AAED,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,uBAAuB,CAAC,EAC3C,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,MAAM,GACV,OAAO,CAKT"}
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { getEffectiveNode, nodeRegistry, sceneRegistry, useLiveNodeOverrides, useScene, } from '@pascal-app/core';
2
+ import { findLevelAncestorId, getEffectiveNode, levelBaseElevationAt, nodeRegistry, noteLevelBaseConsumer, sceneRegistry, useLiveNodeOverrides, useScene, } from '@pascal-app/core';
3
3
  import { useFrame } from '@react-three/fiber';
4
4
  import { useEffect, useRef } from 'react';
5
5
  import { FrontSide } from 'three';
@@ -259,7 +259,23 @@ function buildGeometryContext(node, nodes, levelData, materials) {
259
259
  .map((n) => getEffectiveNode(n));
260
260
  }
261
261
  }
262
- return { resolve, children, siblings, parent, levelData, materials };
262
+ // The ground under this node, for builders that bake their own vertical
263
+ // origin (`ctx.levelBaseAt`). A closure rather than a scalar because the
264
+ // sample point is the builder's business: a fence samples its own start,
265
+ // and a kind that wanted to drape a span could sample along it. Resolved
266
+ // against the node's level ancestor, so a builder never has to know how
267
+ // the level graph is walked — and gets `0` when it has no level, which is
268
+ // the flat-ground answer those nodes already assumed.
269
+ //
270
+ // Calling it also enrolls the kind in terrain invalidation
271
+ // (`noteLevelBaseConsumer`) — see `terrain-support.ts` for why asking is
272
+ // the registration.
273
+ const levelId = findLevelAncestorId(node.id, nodes);
274
+ const levelBaseAt = (x, z) => {
275
+ noteLevelBaseConsumer(node.type);
276
+ return levelId ? levelBaseElevationAt(nodes, levelId, x, z) : 0;
277
+ };
278
+ return { resolve, children, siblings, parent, levelBaseAt, levelData, materials };
263
279
  }
264
280
  function disposeChildren(group) {
265
281
  // Only dispose meshes the geometry builder produced on the previous
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pascal-app/viewer",
3
- "version": "1.0.0-beta.1",
3
+ "version": "1.0.0-beta.3",
4
4
  "description": "3D viewer component for Pascal building editor",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -22,7 +22,7 @@
22
22
  "prepublishOnly": "npm run build"
23
23
  },
24
24
  "peerDependencies": {
25
- "@pascal-app/core": "^1.0.0-beta.1",
25
+ "@pascal-app/core": "^1.0.0-beta.3",
26
26
  "@react-three/drei": "^10",
27
27
  "@react-three/fiber": "^9",
28
28
  "react": "^18 || ^19",