@pascal-app/viewer 1.1.0 → 1.1.1

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 (224) hide show
  1. package/README.md +157 -0
  2. package/dist/components/viewer/drone-controller.d.ts.map +1 -1
  3. package/dist/components/viewer/drone-controller.js +1 -5
  4. package/dist/components/viewer/first-person/build-collider-world.d.ts +14 -0
  5. package/dist/components/viewer/first-person/build-collider-world.d.ts.map +1 -0
  6. package/dist/components/viewer/first-person/build-collider-world.js +426 -0
  7. package/dist/components/viewer/first-person/ground-holes.d.ts +22 -0
  8. package/dist/components/viewer/first-person/ground-holes.d.ts.map +1 -0
  9. package/dist/components/viewer/first-person/ground-holes.js +116 -0
  10. package/dist/components/viewer/first-person/mechanism-targets.d.ts +27 -0
  11. package/dist/components/viewer/first-person/mechanism-targets.d.ts.map +1 -0
  12. package/dist/components/viewer/first-person/mechanism-targets.js +79 -0
  13. package/dist/components/viewer/first-person/terrain-collider.d.ts +32 -0
  14. package/dist/components/viewer/first-person/terrain-collider.d.ts.map +1 -0
  15. package/dist/components/viewer/first-person/terrain-collider.js +175 -0
  16. package/dist/components/viewer/glb-walkthrough-controller.d.ts +1 -1
  17. package/dist/components/viewer/glb-walkthrough-controller.d.ts.map +1 -1
  18. package/dist/components/viewer/glb-walkthrough-controller.js +3 -4
  19. package/dist/components/viewer/live-walkthrough-controller.d.ts +17 -0
  20. package/dist/components/viewer/live-walkthrough-controller.d.ts.map +1 -0
  21. package/dist/components/viewer/live-walkthrough-controller.js +1449 -0
  22. package/dist/components/viewer/post-processing.d.ts.map +1 -1
  23. package/dist/components/viewer/post-processing.js +22 -1
  24. package/dist/index.d.ts +3 -0
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +3 -0
  27. package/dist/lib/daylight/room-map.d.ts +29 -4
  28. package/dist/lib/daylight/room-map.d.ts.map +1 -1
  29. package/dist/lib/daylight/room-map.js +219 -36
  30. package/dist/lib/daylight/room-scene.d.ts.map +1 -1
  31. package/dist/lib/daylight/room-scene.js +9 -3
  32. package/dist/lib/daylight/rooms.d.ts +15 -6
  33. package/dist/lib/daylight/rooms.d.ts.map +1 -1
  34. package/dist/lib/daylight/rooms.js +49 -9
  35. package/dist/lib/measurement-presentation.d.ts +2 -0
  36. package/dist/lib/measurement-presentation.d.ts.map +1 -1
  37. package/dist/lib/measurement-presentation.js +6 -0
  38. package/dist/lib/typing-target.d.ts +2 -0
  39. package/dist/lib/typing-target.d.ts.map +1 -0
  40. package/dist/lib/typing-target.js +7 -0
  41. package/dist/lib/viewer-config.d.ts +6 -0
  42. package/dist/lib/viewer-config.d.ts.map +1 -1
  43. package/dist/lib/viewer-config.js +2 -0
  44. package/dist/sfx/audio-settings.d.ts +81 -0
  45. package/dist/sfx/audio-settings.d.ts.map +1 -0
  46. package/dist/sfx/audio-settings.js +166 -0
  47. package/dist/sfx/index.d.ts +6 -0
  48. package/dist/sfx/index.d.ts.map +1 -0
  49. package/dist/sfx/index.js +5 -0
  50. package/dist/sfx/interaction-sounds.d.ts +7 -0
  51. package/dist/sfx/interaction-sounds.d.ts.map +1 -0
  52. package/dist/sfx/interaction-sounds.js +39 -0
  53. package/dist/sfx/player.d.ts +31 -0
  54. package/dist/sfx/player.d.ts.map +1 -0
  55. package/dist/sfx/player.js +255 -0
  56. package/dist/sfx/sounds.d.ts +60 -0
  57. package/dist/sfx/sounds.d.ts.map +1 -0
  58. package/dist/sfx/sounds.js +25 -0
  59. package/dist/sfx/use-viewer-ui-sounds.d.ts +8 -0
  60. package/dist/sfx/use-viewer-ui-sounds.d.ts.map +1 -0
  61. package/dist/sfx/use-viewer-ui-sounds.js +42 -0
  62. package/dist/store/use-first-person-hud.d.ts +13 -0
  63. package/dist/store/use-first-person-hud.d.ts.map +1 -0
  64. package/dist/store/use-first-person-hud.js +21 -0
  65. package/dist/systems/roof/roof-system.d.ts.map +1 -1
  66. package/dist/systems/roof/roof-system.js +27 -13
  67. package/dist/ui/components/action-button.d.ts +14 -0
  68. package/dist/ui/components/action-button.d.ts.map +1 -0
  69. package/dist/ui/components/action-button.js +21 -0
  70. package/dist/ui/components/action-menu-placement.d.ts +7 -0
  71. package/dist/ui/components/action-menu-placement.d.ts.map +1 -0
  72. package/dist/ui/components/action-menu-placement.js +10 -0
  73. package/dist/ui/components/floorplan-compass-button.d.ts +10 -0
  74. package/dist/ui/components/floorplan-compass-button.d.ts.map +1 -0
  75. package/dist/ui/components/floorplan-compass-button.js +22 -0
  76. package/dist/ui/components/follow-pascal-toggle.d.ts +6 -0
  77. package/dist/ui/components/follow-pascal-toggle.d.ts.map +1 -0
  78. package/dist/ui/components/follow-pascal-toggle.js +21 -0
  79. package/dist/ui/components/localized-html.d.ts +9 -0
  80. package/dist/ui/components/localized-html.d.ts.map +1 -0
  81. package/dist/ui/components/localized-html.js +16 -0
  82. package/dist/ui/components/render-settings-menu.d.ts +9 -0
  83. package/dist/ui/components/render-settings-menu.d.ts.map +1 -0
  84. package/dist/ui/components/render-settings-menu.js +145 -0
  85. package/dist/ui/components/rooms/room-highlight.d.ts +10 -0
  86. package/dist/ui/components/rooms/room-highlight.d.ts.map +1 -0
  87. package/dist/ui/components/rooms/room-highlight.js +56 -0
  88. package/dist/ui/components/rooms/room-labels.d.ts +278 -0
  89. package/dist/ui/components/rooms/room-labels.d.ts.map +1 -0
  90. package/dist/ui/components/rooms/room-labels.js +1295 -0
  91. package/dist/ui/components/rooms/viewer-rooms.d.ts +14 -0
  92. package/dist/ui/components/rooms/viewer-rooms.d.ts.map +1 -0
  93. package/dist/ui/components/rooms/viewer-rooms.js +123 -0
  94. package/dist/ui/components/scene-loader.d.ts +18 -0
  95. package/dist/ui/components/scene-loader.d.ts.map +1 -0
  96. package/dist/ui/components/scene-loader.js +29 -0
  97. package/dist/ui/components/sky-control.d.ts +37 -0
  98. package/dist/ui/components/sky-control.d.ts.map +1 -0
  99. package/dist/ui/components/sky-control.js +382 -0
  100. package/dist/ui/components/use-viewer-camera-navigation-sync.d.ts +4 -0
  101. package/dist/ui/components/use-viewer-camera-navigation-sync.d.ts.map +1 -0
  102. package/dist/ui/components/use-viewer-camera-navigation-sync.js +117 -0
  103. package/dist/ui/components/viewer-controls-bar.d.ts +20 -0
  104. package/dist/ui/components/viewer-controls-bar.d.ts.map +1 -0
  105. package/dist/ui/components/viewer-controls-bar.js +130 -0
  106. package/dist/ui/components/viewer-hover-label.d.ts +14 -0
  107. package/dist/ui/components/viewer-hover-label.d.ts.map +1 -0
  108. package/dist/ui/components/viewer-hover-label.js +28 -0
  109. package/dist/ui/components/viewer-scene-header.d.ts +34 -0
  110. package/dist/ui/components/viewer-scene-header.d.ts.map +1 -0
  111. package/dist/ui/components/viewer-scene-header.js +92 -0
  112. package/dist/ui/components/viewer-selection-manager.d.ts +7 -0
  113. package/dist/ui/components/viewer-selection-manager.d.ts.map +1 -0
  114. package/dist/ui/components/viewer-selection-manager.js +116 -0
  115. package/dist/ui/components/viewer-stage-modes.d.ts +7 -0
  116. package/dist/ui/components/viewer-stage-modes.d.ts.map +1 -0
  117. package/dist/ui/components/viewer-stage-modes.js +42 -0
  118. package/dist/ui/components/viewer-stage-switcher.d.ts +10 -0
  119. package/dist/ui/components/viewer-stage-switcher.d.ts.map +1 -0
  120. package/dist/ui/components/viewer-stage-switcher.js +16 -0
  121. package/dist/ui/components/viewer-stage.d.ts +25 -0
  122. package/dist/ui/components/viewer-stage.d.ts.map +1 -0
  123. package/dist/ui/components/viewer-stage.js +107 -0
  124. package/dist/ui/components/walkthrough-hud.d.ts +29 -0
  125. package/dist/ui/components/walkthrough-hud.d.ts.map +1 -0
  126. package/dist/ui/components/walkthrough-hud.js +55 -0
  127. package/dist/ui/floorplan/floorplan-camera-sync.d.ts +22 -0
  128. package/dist/ui/floorplan/floorplan-camera-sync.d.ts.map +1 -0
  129. package/dist/ui/floorplan/floorplan-camera-sync.js +157 -0
  130. package/dist/ui/floorplan/floorplan-dimension-renderer.d.ts +61 -0
  131. package/dist/ui/floorplan/floorplan-dimension-renderer.d.ts.map +1 -0
  132. package/dist/ui/floorplan/floorplan-dimension-renderer.js +280 -0
  133. package/dist/ui/floorplan/floorplan-geometry-renderer.d.ts +54 -0
  134. package/dist/ui/floorplan/floorplan-geometry-renderer.d.ts.map +1 -0
  135. package/dist/ui/floorplan/floorplan-geometry-renderer.js +317 -0
  136. package/dist/ui/floorplan/floorplan-label-angle.d.ts +24 -0
  137. package/dist/ui/floorplan/floorplan-label-angle.d.ts.map +1 -0
  138. package/dist/ui/floorplan/floorplan-label-angle.js +60 -0
  139. package/dist/ui/floorplan/floorplan-navigation-sync.d.ts +18 -0
  140. package/dist/ui/floorplan/floorplan-navigation-sync.d.ts.map +1 -0
  141. package/dist/ui/floorplan/floorplan-navigation-sync.js +41 -0
  142. package/dist/ui/floorplan/floorplan-preview-geometry.d.ts +26 -0
  143. package/dist/ui/floorplan/floorplan-preview-geometry.d.ts.map +1 -0
  144. package/dist/ui/floorplan/floorplan-preview-geometry.js +173 -0
  145. package/dist/ui/floorplan/floorplan-preview-navigation.d.ts +22 -0
  146. package/dist/ui/floorplan/floorplan-preview-navigation.d.ts.map +1 -0
  147. package/dist/ui/floorplan/floorplan-preview-navigation.js +41 -0
  148. package/dist/ui/floorplan/floorplan-preview-visibility.d.ts +8 -0
  149. package/dist/ui/floorplan/floorplan-preview-visibility.d.ts.map +1 -0
  150. package/dist/ui/floorplan/floorplan-preview-visibility.js +21 -0
  151. package/dist/ui/floorplan/floorplan-preview.d.ts +19 -0
  152. package/dist/ui/floorplan/floorplan-preview.d.ts.map +1 -0
  153. package/dist/ui/floorplan/floorplan-preview.js +700 -0
  154. package/dist/ui/hooks/use-mobile.d.ts +2 -0
  155. package/dist/ui/hooks/use-mobile.d.ts.map +1 -0
  156. package/dist/ui/hooks/use-mobile.js +14 -0
  157. package/dist/ui/index.d.ts +49 -0
  158. package/dist/ui/index.d.ts.map +1 -0
  159. package/dist/ui/index.js +48 -0
  160. package/dist/ui/lib/below-grade.d.ts +38 -0
  161. package/dist/ui/lib/below-grade.d.ts.map +1 -0
  162. package/dist/ui/lib/below-grade.js +102 -0
  163. package/dist/ui/lib/camera-pose.d.ts +19 -0
  164. package/dist/ui/lib/camera-pose.d.ts.map +1 -0
  165. package/dist/ui/lib/camera-pose.js +113 -0
  166. package/dist/ui/lib/cn.d.ts +3 -0
  167. package/dist/ui/lib/cn.d.ts.map +1 -0
  168. package/dist/ui/lib/cn.js +5 -0
  169. package/dist/ui/lib/level-name.d.ts +10 -0
  170. package/dist/ui/lib/level-name.d.ts.map +1 -0
  171. package/dist/ui/lib/level-name.js +33 -0
  172. package/dist/ui/lib/node-display-label.d.ts +8 -0
  173. package/dist/ui/lib/node-display-label.d.ts.map +1 -0
  174. package/dist/ui/lib/node-display-label.js +36 -0
  175. package/dist/ui/lib/room-area.d.ts +3 -0
  176. package/dist/ui/lib/room-area.d.ts.map +1 -0
  177. package/dist/ui/lib/room-area.js +8 -0
  178. package/dist/ui/lib/room-assembly-overlay.d.ts +46 -0
  179. package/dist/ui/lib/room-assembly-overlay.d.ts.map +1 -0
  180. package/dist/ui/lib/room-assembly-overlay.js +222 -0
  181. package/dist/ui/lib/room-name-messages.d.ts +28 -0
  182. package/dist/ui/lib/room-name-messages.d.ts.map +1 -0
  183. package/dist/ui/lib/room-name-messages.js +112 -0
  184. package/dist/ui/lib/room-selection.d.ts +58 -0
  185. package/dist/ui/lib/room-selection.d.ts.map +1 -0
  186. package/dist/ui/lib/room-selection.js +297 -0
  187. package/dist/ui/lib/scene-theme-name.d.ts +4 -0
  188. package/dist/ui/lib/scene-theme-name.d.ts.map +1 -0
  189. package/dist/ui/lib/scene-theme-name.js +22 -0
  190. package/dist/ui/lib/selection-modifiers.d.ts +20 -0
  191. package/dist/ui/lib/selection-modifiers.d.ts.map +1 -0
  192. package/dist/ui/lib/selection-modifiers.js +15 -0
  193. package/dist/ui/lib/viewer-selection.d.ts +132 -0
  194. package/dist/ui/lib/viewer-selection.d.ts.map +1 -0
  195. package/dist/ui/lib/viewer-selection.js +462 -0
  196. package/dist/ui/lib/zone-content.d.ts +6 -0
  197. package/dist/ui/lib/zone-content.d.ts.map +1 -0
  198. package/dist/ui/lib/zone-content.js +96 -0
  199. package/dist/ui/primitives/button.d.ts +11 -0
  200. package/dist/ui/primitives/button.d.ts.map +1 -0
  201. package/dist/ui/primitives/button.js +35 -0
  202. package/dist/ui/primitives/dropdown-menu.d.ts +26 -0
  203. package/dist/ui/primitives/dropdown-menu.d.ts.map +1 -0
  204. package/dist/ui/primitives/dropdown-menu.js +53 -0
  205. package/dist/ui/primitives/popover.d.ts +8 -0
  206. package/dist/ui/primitives/popover.d.ts.map +1 -0
  207. package/dist/ui/primitives/popover.js +17 -0
  208. package/dist/ui/primitives/switch.d.ts +5 -0
  209. package/dist/ui/primitives/switch.d.ts.map +1 -0
  210. package/dist/ui/primitives/switch.js +8 -0
  211. package/dist/ui/primitives/tooltip.d.ts +8 -0
  212. package/dist/ui/primitives/tooltip.d.ts.map +1 -0
  213. package/dist/ui/primitives/tooltip.js +17 -0
  214. package/dist/ui/store/camera-pose-store.d.ts +17 -0
  215. package/dist/ui/store/camera-pose-store.d.ts.map +1 -0
  216. package/dist/ui/store/camera-pose-store.js +15 -0
  217. package/dist/ui/store/navigation-sync-pose-store.d.ts +26 -0
  218. package/dist/ui/store/navigation-sync-pose-store.d.ts.map +1 -0
  219. package/dist/ui/store/navigation-sync-pose-store.js +16 -0
  220. package/dist/ui/store/use-follow-pascal.d.ts +30 -0
  221. package/dist/ui/store/use-follow-pascal.d.ts.map +1 -0
  222. package/dist/ui/store/use-follow-pascal.js +28 -0
  223. package/dist/ui/theme.css +339 -0
  224. package/package.json +34 -7
@@ -1 +1 @@
1
- {"version":3,"file":"post-processing.d.ts","sourceRoot":"","sources":["../../../src/components/viewer/post-processing.tsx"],"names":[],"mappings":"AA+FA,eAAO,MAAM,YAAY;IACvB,QAAQ;IACR,UAAU;CACX,CAAA;AAGD,eAAO,MAAM,WAAW;IACtB,OAAO;IACP,UAAU;IACV,SAAS;IACT,MAAM;IACN,SAAS;IACT,SAAS;IACT,gBAAgB;IAChB,WAAW;IACX,WAAW;IACX,kBAAkB;IAClB,sBAAsB;IACtB,oBAAoB;CACrB,CAAA;AAgED,MAAM,MAAM,UAAU,GAAG;IACvB,YAAY,EAAE,MAAM,CAAA;IACpB,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,OAAO,CAAA;CACf,CAAA;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,EAAE,UAAU,CAAA;CACpB,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;AAS9B,eAAO,MAAM,oBAAoB,EAAE,WAElC,CAAA;AA+CD,QAAA,MAAM,oBAAoB,oCAGvB;IACD,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,6EAA6E;IAC7E,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB,SAkvBA,CAAA;eAEc,oBAAoB"}
1
+ {"version":3,"file":"post-processing.d.ts","sourceRoot":"","sources":["../../../src/components/viewer/post-processing.tsx"],"names":[],"mappings":"AAgGA,eAAO,MAAM,YAAY;IACvB,QAAQ;IACR,UAAU;CACX,CAAA;AAGD,eAAO,MAAM,WAAW;IACtB,OAAO;IACP,UAAU;IACV,SAAS;IACT,MAAM;IACN,SAAS;IACT,SAAS;IACT,gBAAgB;IAChB,WAAW;IACX,WAAW;IACX,kBAAkB;IAClB,sBAAsB;IACtB,oBAAoB;CACrB,CAAA;AAgED,MAAM,MAAM,UAAU,GAAG;IACvB,YAAY,EAAE,MAAM,CAAA;IACpB,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,OAAO,CAAA;CACf,CAAA;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,EAAE,UAAU,CAAA;CACpB,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;AAS9B,eAAO,MAAM,oBAAoB,EAAE,WAElC,CAAA;AA+CD,QAAA,MAAM,oBAAoB,oCAGvB;IACD,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,6EAA6E;IAC7E,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB,SAkvBA,CAAA;eAEc,oBAAoB"}
@@ -760,7 +760,7 @@ const PostProcessingPasses = ({ hoverStyles = DEFAULT_HOVER_STYLES, disablePostF
760
760
  }
761
761
  const submittedAt = PERF_OVERLAY_ENABLED ? performance.now() : 0;
762
762
  timeSpan('render-encode', () => {
763
- renderWithSceneMatrices(scene, () => renderer.render(scene, camera));
763
+ renderWithSceneMatrices(scene, () => renderDirect(renderer, scene, camera));
764
764
  });
765
765
  if (PERF_OVERLAY_ENABLED)
766
766
  recordFrameGpuTiming(renderer, submittedAt);
@@ -815,3 +815,24 @@ const PostProcessingPasses = ({ hoverStyles = DEFAULT_HOVER_STYLES, disablePostF
815
815
  return null;
816
816
  };
817
817
  export default PostProcessingPasses;
818
+ /**
819
+ * Without the pipeline there is no overlay composite: the scene draws without the overlay layer,
820
+ * then overlays (selection highlights, room assemblies) draw over it with no scene-depth test,
821
+ * like the composite, whether or not the camera already enables that layer.
822
+ */
823
+ function renderDirect(renderer, scene, camera) {
824
+ const mask = camera.layers.mask;
825
+ const autoClear = renderer.autoClear;
826
+ try {
827
+ camera.layers.disable(OVERLAY_LAYER);
828
+ renderer.render(scene, camera);
829
+ camera.layers.set(OVERLAY_LAYER);
830
+ renderer.autoClear = false;
831
+ renderer.clearDepth();
832
+ renderer.render(scene, camera);
833
+ }
834
+ finally {
835
+ camera.layers.mask = mask;
836
+ renderer.autoClear = autoClear;
837
+ }
838
+ }
package/dist/index.d.ts CHANGED
@@ -9,6 +9,7 @@ export { buildGlbInteractiveItems, GlbInteractive, type GlbInteractiveItem, } fr
9
9
  export { buildGlbReferenceNodes, buildGlbReplaceNodes, } from './components/viewer/glb-reference-nodes';
10
10
  export { type GlbPickEvent, GlbScene, type GlbWalkthrough, resolveGlbPick, } from './components/viewer/glb-scene';
11
11
  export { CROUCH_CAPSULE, CROUCH_EYE_OFFSET, CROUCH_FLOAT_HEIGHT, CROUCH_RUN_SPEED, CROUCH_WALK_SPEED, EYE_LERP_SPEED, GlbWalkthroughController, STAND_CAPSULE, STAND_CLEARANCE, STAND_FLOAT_HEIGHT, WALKTHROUGH_FOV, } from './components/viewer/glb-walkthrough-controller';
12
+ export { LiveWalkthroughController, type LiveWalkthroughControllerProps, } from './components/viewer/live-walkthrough-controller';
12
13
  export type { HoverStyle, HoverStyles } from './components/viewer/post-processing';
13
14
  export { DEFAULT_HOVER_STYLES, SSGI_PARAMS, } from './components/viewer/post-processing';
14
15
  export { SceneAtmosphere, type SceneAtmosphereSource, useSceneAtmosphere, } from './components/viewer/scene-atmosphere';
@@ -69,9 +70,11 @@ export { createPlainSnapshotPipeline, createSnapshotPipeline, SNAPSHOT_MAX_EDGE,
69
70
  export { buildTerrainPerimeterFillGeometry, type TerrainPerimeterPoint, } from './lib/terrain-perimeter-fill';
70
71
  export { getPascalTextureRef, type PascalTextureColorSpace, type PascalTextureMap, type PascalTextureRef, stampPascalTextureRef, textureMapForSlot, } from './lib/texture-reference';
71
72
  export { packNormalToRGB, unpackRGBToNormal } from './lib/tsl-compat';
73
+ export { isTypingTarget } from './lib/typing-target';
72
74
  export { AMBIANCE_SECONDS, ambianceNow, ambianceTarget, easeAmbiance, eyeUnderTheGround, FADE_SECONDS, groundHoleOpenNode, groundHoleOpenNow, stepAmbianceProgress, temporarilyWithoutAmbiance, UNDERGROUND_RIM, undergroundAmbianceNode, } from './lib/underground-ambiance';
73
75
  export { ASSETS_CDN_URL, configureViewer, getViewerConfig, type ViewerConfig, } from './lib/viewer-config';
74
76
  export { createZoneShape, createZoneWallGeometry } from './lib/zone-geometry';
77
+ export { type FirstPersonHudState, useFirstPersonHud, type WalkthroughInteract, } from './store/use-first-person-hud';
75
78
  export type { LightSource } from './store/use-item-light-pool';
76
79
  export { catalogLightSource, useItemLightPool } from './store/use-item-light-pool';
77
80
  export { applyCountryUnitDefault, DEFAULT_UNDERGROUND_LOOK, default as useViewer, type GroundMode, groundVeiled, type MetricNotation, type RenderQuality, type RenderQualityChoice, siteGroundShown, type UndergroundEdge, type UndergroundLook, type UndergroundTransition, type WalkthroughMovement, type WallMode, } from './store/use-viewer';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAO3D,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAA;AAGnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iDAAiD,CAAA;AACxF,OAAO,EACL,OAAO,IAAI,MAAM,EACjB,sBAAsB,EACtB,KAAK,YAAY,EACjB,KAAK,sBAAsB,GAC5B,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,KAAK,YAAY,EACjB,OAAO,IAAI,SAAS,EACpB,KAAK,aAAa,GACnB,MAAM,gCAAgC,CAAA;AACvC,OAAO,EACL,eAAe,EACf,KAAK,oBAAoB,GAC1B,MAAM,sCAAsC,CAAA;AAC7C,OAAO,EACL,wBAAwB,EACxB,cAAc,EACd,KAAK,kBAAkB,GACxB,MAAM,qCAAqC,CAAA;AAC5C,OAAO,EACL,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,yCAAyC,CAAA;AAChD,OAAO,EACL,KAAK,YAAY,EACjB,QAAQ,EACR,KAAK,cAAc,EACnB,cAAc,GACf,MAAM,+BAA+B,CAAA;AACtC,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,wBAAwB,EACxB,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,eAAe,GAChB,MAAM,gDAAgD,CAAA;AACvD,YAAY,EAAE,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AAK,sBAAsB,GAC5B,MAAM,iCAAiC,CAAA;AACxC,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,qBAAqB,GAC3B,MAAM,+BAA+B,CAAA;AAKtC,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,0BAA0B,EAC1B,wBAAwB,EACxB,iBAAiB,EACjB,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,EAC/B,UAAU,GACX,MAAM,4BAA4B,CAAA;AACnC,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,0CAA0C,CAAA;AACjD,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAA;AACnF,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAA;AACrF,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AACvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAA"}
package/dist/index.js CHANGED
@@ -20,6 +20,7 @@ export { buildGlbInteractiveItems, GlbInteractive, } from './components/viewer/g
20
20
  export { buildGlbReferenceNodes, buildGlbReplaceNodes, } from './components/viewer/glb-reference-nodes';
21
21
  export { GlbScene, resolveGlbPick, } from './components/viewer/glb-scene';
22
22
  export { CROUCH_CAPSULE, CROUCH_EYE_OFFSET, CROUCH_FLOAT_HEIGHT, CROUCH_RUN_SPEED, CROUCH_WALK_SPEED, EYE_LERP_SPEED, GlbWalkthroughController, STAND_CAPSULE, STAND_CLEARANCE, STAND_FLOAT_HEIGHT, WALKTHROUGH_FOV, } from './components/viewer/glb-walkthrough-controller';
23
+ export { LiveWalkthroughController, } from './components/viewer/live-walkthrough-controller';
23
24
  export { DEFAULT_HOVER_STYLES, SSGI_PARAMS, } from './components/viewer/post-processing';
24
25
  export { SceneAtmosphere, useSceneAtmosphere, } from './components/viewer/scene-atmosphere';
25
26
  export { SceneEnvironment } from './components/viewer/scene-environment';
@@ -80,9 +81,11 @@ export { createPlainSnapshotPipeline, createSnapshotPipeline, SNAPSHOT_MAX_EDGE,
80
81
  export { buildTerrainPerimeterFillGeometry, } from './lib/terrain-perimeter-fill';
81
82
  export { getPascalTextureRef, stampPascalTextureRef, textureMapForSlot, } from './lib/texture-reference';
82
83
  export { packNormalToRGB, unpackRGBToNormal } from './lib/tsl-compat';
84
+ export { isTypingTarget } from './lib/typing-target';
83
85
  export { AMBIANCE_SECONDS, ambianceNow, ambianceTarget, easeAmbiance, eyeUnderTheGround, FADE_SECONDS, groundHoleOpenNode, groundHoleOpenNow, stepAmbianceProgress, temporarilyWithoutAmbiance, UNDERGROUND_RIM, undergroundAmbianceNode, } from './lib/underground-ambiance';
84
86
  export { ASSETS_CDN_URL, configureViewer, getViewerConfig, } from './lib/viewer-config';
85
87
  export { createZoneShape, createZoneWallGeometry } from './lib/zone-geometry';
88
+ export { useFirstPersonHud, } from './store/use-first-person-hud';
86
89
  export { catalogLightSource, useItemLightPool } from './store/use-item-light-pool';
87
90
  export { applyCountryUnitDefault, DEFAULT_UNDERGROUND_LOOK, default as useViewer, groundVeiled, siteGroundShown, } from './store/use-viewer';
88
91
  export { CEILING_CAP_MESH, CEILING_REGION_MESH, CeilingSystem, } from './systems/ceiling/ceiling-system';
@@ -12,6 +12,10 @@
12
12
  * buildings near it), so neighbouring buildings with different floor heights, or a 40-storey
13
13
  * tower, each keep their floors. Within a building, levels sorted by height stay sorted when they
14
14
  * explode apart, so the search runs on live heights.
15
+ *
16
+ * Each building's map is turned to its own walls: its cells run along the direction most of its
17
+ * room edges take, so a house drawn at 40° to the world reads exactly like the same house drawn
18
+ * square. Walls at other angles within a building still cross the cells in steps.
15
19
  */
16
20
  type N = any;
17
21
  export declare const CELL = 0.1;
@@ -33,15 +37,22 @@ export type MapRoom = {
33
37
  polygon: [number, number][];
34
38
  holes?: [number, number][][];
35
39
  };
40
+ /** A level's walls in plan: triangles of their footprints, six numbers each (world XZ × 3). */
41
+ export type MapWalls = {
42
+ level: number;
43
+ triangles: ArrayLike<number>;
44
+ };
36
45
  /** One tile while it is being built, inside its row's dilated cells (with a margin all round). */
37
46
  export type TileCells = {
38
47
  level: number;
39
48
  /** Site cell index of `cells[0]`. */
40
49
  ci0: number;
41
50
  cj0: number;
42
- /** World XZ of `cells[0]`'s lower corner. */
51
+ /** XZ of `cells[0]`'s lower corner, in the building's turned frame. */
43
52
  x0: number;
44
53
  z0: number;
54
+ /** The frame's turn [cos, sin]: world x = x·cos − z·sin, world z = x·sin + z·cos. */
55
+ turn: [number, number];
45
56
  /** Cells per buffer row. */
46
57
  stride: number;
47
58
  /** The tile's first cell in the buffer. */
@@ -61,8 +72,13 @@ export declare class RoomMap {
61
72
  private position;
62
73
  /** Per building: its range in `order`. */
63
74
  private buildingRange;
75
+ /** Per building: the turn [cos, sin] that lays its walls along the cells. */
76
+ private turns;
64
77
  private originX;
65
78
  private originZ;
79
+ /** The directory's corner: it stays on the world axes, whatever the buildings' turns. */
80
+ private dirX;
81
+ private dirZ;
66
82
  private dirTiles;
67
83
  private dirW;
68
84
  private dirH;
@@ -75,6 +91,9 @@ export declare class RoomMap {
75
91
  private warnedOverflow;
76
92
  readonly u: {
77
93
  origin: N;
94
+ dirOrigin: N;
95
+ /** The only building's turn (with `single`). */
96
+ turn: N;
78
97
  dirTiles: import("three/webgpu").UniformNode<"int", number>;
79
98
  dirW: import("three/webgpu").UniformNode<"int", number>;
80
99
  dirH: import("three/webgpu").UniformNode<"int", number>;
@@ -90,11 +109,17 @@ export declare class RoomMap {
90
109
  atlas: N;
91
110
  };
92
111
  private levelData;
93
- /** Rebuild from rooms. `onTile` sees every built tile (the doorway search walks room edges). */
94
- build(levels: MapLevel[], rooms: MapRoom[], onTile?: (tile: TileCells) => void): void;
112
+ /**
113
+ * Rebuild from rooms. `onTile` sees every built tile (the doorway search walks room edges).
114
+ * `walls` keep a room from growing out through them: a wall's far side stays outside.
115
+ */
116
+ build(levels: MapLevel[], rooms: MapRoom[], onTile?: (tile: TileCells) => void, walls?: MapWalls[]): void;
95
117
  /** CPU lookup in assembled space (same rule as the shader). */
96
118
  roomAt(x: number, y: number, z: number): number;
97
- /** A level's room at a point; clusters' rects can overlap (a wing around a courtyard pavilion). */
119
+ /**
120
+ * A level's room at a point of its building's frame; clusters' rects can overlap (a wing around
121
+ * a courtyard pavilion).
122
+ */
98
123
  private levelRoomAt;
99
124
  /** The level stacked right above `level` in its building, or −1. */
100
125
  levelAbove(level: number): number;
@@ -1 +1 @@
1
- {"version":3,"file":"room-map.d.ts","sourceRoot":"","sources":["../../../src/lib/daylight/room-map.ts"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;GAcG;AAEH,KAAK,CAAC,GAAG,GAAG,CAAA;AAEZ,eAAO,MAAM,IAAI,MAAM,CAAA;AACvB,2BAA2B;AAC3B,eAAO,MAAM,IAAI,KAAK,CAAA;AAWtB,iDAAiD;AACjD,eAAO,MAAM,SAAS,QAAQ,CAAA;AAC9B,2EAA2E;AAC3E,eAAO,MAAM,qBAAqB,OAAO,CAAA;AAEzC,MAAM,MAAM,QAAQ,GAAG;IACrB,8DAA8D;IAC9D,CAAC,EAAE,MAAM,CAAA;IACT,mEAAmE;IACnE,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,OAAO,GAAG;IACpB,KAAK,EAAE,MAAM,CAAA;IACb,gBAAgB;IAChB,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAA;IAC3B,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,EAAE,CAAA;CAC7B,CAAA;AAED,kGAAkG;AAClG,MAAM,MAAM,SAAS,GAAG;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,qCAAqC;IACrC,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,6CAA6C;IAC7C,EAAE,EAAE,MAAM,CAAA;IACV,EAAE,EAAE,MAAM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,OAAO,EAAE,QAkBtE;IAED,WAAW,WAEV;IAED,IAAI,KAAK;QACE,UAAU;QAAmB,IAAI;QAAa,IAAI;MAC5D;IAED,OAAO,CAAC,MAAM;IAsEd,OAAO,CAAC,UAAU;IAKlB,iFAAiF;IACjF,WAAW,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAGrB;IAED,gEAAgE;IAChE,WAAW,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAGrB;IAED,wEAAwE;IACxE,UAAU,4HA2FR;CACH"}
@@ -1,9 +1,14 @@
1
1
  import { DataTexture, FloatType, NearestFilter, RGBAFormat, RGFormat, UnsignedByteType, Vector2, } from 'three';
2
- import { Fn, floor, If, int, ivec2, Loop, round, texture, uniform } from 'three/tsl';
2
+ import { Fn, floor, If, int, ivec2, Loop, round, texture, uniform, vec2 } from 'three/tsl';
3
3
  export const CELL = 0.1;
4
4
  /** Cells per tile side. */
5
5
  export const TILE = 16;
6
6
  const TILE_M = CELL * TILE;
7
+ /**
8
+ * A cell is wall when a wall's footprint reaches this close to its centre (on each axis): thin
9
+ * walls still mark an unbroken line of cells, and a wall cell ends at most ~10 cm past the face.
10
+ */
11
+ const WALL_REACH = CELL / 4;
7
12
  /** Margin around a room: the 2-cell dilation plus polygon slop. */
8
13
  const APRON = 0.35;
9
14
  /** Cells built around a tile so its 2-pass dilation and its edges' neighbours are exact. */
@@ -26,8 +31,13 @@ export class RoomMap {
26
31
  position = [];
27
32
  /** Per building: its range in `order`. */
28
33
  buildingRange = [];
34
+ /** Per building: the turn [cos, sin] that lays its walls along the cells. */
35
+ turns = [];
29
36
  originX = 0;
30
37
  originZ = 0;
38
+ /** The directory's corner: it stays on the world axes, whatever the buildings' turns. */
39
+ dirX = 0;
40
+ dirZ = 0;
31
41
  dirTiles = 8;
32
42
  dirW = 0;
33
43
  dirH = 0;
@@ -40,6 +50,9 @@ export class RoomMap {
40
50
  warnedOverflow = false;
41
51
  u = {
42
52
  origin: uniform(new Vector2()),
53
+ dirOrigin: uniform(new Vector2()),
54
+ /** The only building's turn (with `single`). */
55
+ turn: uniform(new Vector2(1, 0)),
43
56
  dirTiles: uniform(8, 'int'),
44
57
  dirW: uniform(0, 'int'),
45
58
  dirH: uniform(0, 'int'),
@@ -55,8 +68,11 @@ export class RoomMap {
55
68
  atlas: texture(byteTexture(new Uint8Array(2), 1, 1)),
56
69
  };
57
70
  levelData = new Float32Array(8);
58
- /** Rebuild from rooms. `onTile` sees every built tile (the doorway search walks room edges). */
59
- build(levels, rooms, onTile) {
71
+ /**
72
+ * Rebuild from rooms. `onTile` sees every built tile (the doorway search walks room edges).
73
+ * `walls` keep a room from growing out through them: a wall's far side stays outside.
74
+ */
75
+ build(levels, rooms, onTile, walls = []) {
60
76
  this.levels = levels.map((l) => ({ y: l.y, building: l.building, clusters: [] }));
61
77
  this.order = levels
62
78
  .map((_, i) => i)
@@ -75,7 +91,54 @@ export class RoomMap {
75
91
  });
76
92
  if (rooms.length > MAX_ROOMS)
77
93
  console.warn(`[daylight] ${rooms.length} rooms: only the first ${MAX_ROOMS} get room light`);
78
- const used = rooms.slice(0, MAX_ROOMS);
94
+ // Each building's turn: the direction its room edges run along, folded to a quarter turn
95
+ // (walls at right angles agree) and weighted by length.
96
+ const sums = Array.from({ length: buildings }, () => [0, 0]);
97
+ for (const room of rooms.slice(0, MAX_ROOMS)) {
98
+ const sum = sums[levels[room.level]?.building ?? -1];
99
+ if (!sum)
100
+ continue;
101
+ for (const ring of [room.polygon, ...(room.holes ?? [])])
102
+ for (let a = 0, b = ring.length - 1; a < ring.length; b = a++) {
103
+ const dx = ring[a][0] - ring[b][0];
104
+ const dz = ring[a][1] - ring[b][1];
105
+ const length = Math.hypot(dx, dz);
106
+ const angle = 4 * Math.atan2(dz, dx);
107
+ sum[0] += length * Math.cos(angle);
108
+ sum[1] += length * Math.sin(angle);
109
+ }
110
+ }
111
+ // A building already square to the world keeps the plain frame, to the last bit.
112
+ this.turns = sums.map(([c, s]) => {
113
+ const angle = Math.hypot(c, s) < 1e-9 ? 0 : Math.atan2(s, c) / 4;
114
+ return Math.abs(angle) < 1e-9 ? IDENTITY : [Math.cos(angle), Math.sin(angle)];
115
+ });
116
+ const turnOf = (level) => this.turns[levels[level]?.building ?? -1] ?? IDENTITY;
117
+ const turned = (ring, [cos, sin]) => ring.map(([x, z]) => [x * cos + z * sin, z * cos - x * sin]);
118
+ // From here on rooms and walls are in their building's turned frame.
119
+ const used = rooms.slice(0, MAX_ROOMS).map((room) => {
120
+ const turn = turnOf(room.level);
121
+ return turn === IDENTITY
122
+ ? room
123
+ : {
124
+ level: room.level,
125
+ polygon: turned(room.polygon, turn),
126
+ holes: room.holes?.map((hole) => turned(hole, turn)),
127
+ };
128
+ });
129
+ const footprints = walls.map((wall) => {
130
+ const turn = turnOf(wall.level);
131
+ const t = wall.triangles;
132
+ if (turn === IDENTITY)
133
+ return t;
134
+ const [cos, sin] = turn;
135
+ const out = new Float64Array(t.length);
136
+ for (let k = 0; k + 1 < t.length; k += 2) {
137
+ out[k] = t[k] * cos + t[k + 1] * sin;
138
+ out[k + 1] = t[k + 1] * cos - t[k] * sin;
139
+ }
140
+ return out;
141
+ });
79
142
  // Site origin on the tile grid; every rect below is in whole tiles from it.
80
143
  let minX = Number.POSITIVE_INFINITY;
81
144
  let minZ = Number.POSITIVE_INFINITY;
@@ -114,6 +177,29 @@ export class RoomMap {
114
177
  const detailTiles = [];
115
178
  let buffer = new Uint16Array(0);
116
179
  let scratch = new Uint16Array(0);
180
+ let wallBuffer = new Uint8Array(0);
181
+ // Wall triangles per level and tile row (a row's strip reaches a margin into the next rows).
182
+ const wallRows = levels.map(() => new Map());
183
+ const reach = MARGIN * CELL + WALL_REACH;
184
+ walls.forEach((wall, wi) => {
185
+ const rows = wallRows[wall.level];
186
+ if (!rows)
187
+ return;
188
+ const t = footprints[wi];
189
+ for (let k = 0; k + 5 < t.length; k += 6) {
190
+ const zMin = Math.min(t[k + 1], t[k + 3], t[k + 5]);
191
+ const zMax = Math.max(t[k + 1], t[k + 3], t[k + 5]);
192
+ const r0 = Math.floor((zMin - reach - this.originZ) / TILE_M);
193
+ const r1 = Math.floor((zMax + reach - this.originZ) / TILE_M);
194
+ for (let r = r0; r <= r1; r++) {
195
+ const list = rows.get(r);
196
+ if (list)
197
+ list.push(wi, k);
198
+ else
199
+ rows.set(r, [wi, k]);
200
+ }
201
+ }
202
+ });
117
203
  // Where rooms overlap (an automatic room under drawn ones, a unit around its rooms), the
118
204
  // smallest wins: rasterized last, so each level's rooms go largest first.
119
205
  const area = used.map((room) => Math.abs(ringArea(room.polygon)));
@@ -159,8 +245,10 @@ export class RoomMap {
159
245
  if (buffer.length < stride * rowH) {
160
246
  buffer = new Uint16Array(stride * rowH);
161
247
  scratch = new Uint16Array(stride * rowH);
248
+ wallBuffer = new Uint8Array(stride * rowH);
162
249
  }
163
250
  const strip = buffer.subarray(0, stride * rowH);
251
+ const wallStrip = wallBuffer.subarray(0, stride * rowH);
164
252
  const inRow = new Set();
165
253
  for (let tz = tz0; tz <= tz1; tz++) {
166
254
  inRow.clear();
@@ -177,8 +265,15 @@ export class RoomMap {
177
265
  for (const ri of [...inRow].sort((a, b) => area[b] - area[a] || a - b))
178
266
  rasterize(used[ri], ri + 1, strip, stride, rowH, x0, z0);
179
267
  // Growth only fills empty cells: inside a big room there are none.
180
- if (strip.includes(0))
181
- dilate(strip, scratch, stride, rowH);
268
+ if (strip.includes(0)) {
269
+ const rowWalls = wallRows[li].get(tz);
270
+ if (rowWalls) {
271
+ wallStrip.fill(0);
272
+ for (let w = 0; w < rowWalls.length; w += 2)
273
+ markWall(footprints[rowWalls[w]], rowWalls[w + 1], wallStrip, stride, rowH, x0, z0);
274
+ }
275
+ dilate(strip, scratch, stride, rowH, rowWalls ? wallStrip : undefined);
276
+ }
182
277
  for (let tx = tx0; tx <= tx1; tx++) {
183
278
  const t = (tz - tz0) * cluster.tw + (tx - tx0);
184
279
  if (!buckets[t].length)
@@ -215,6 +310,7 @@ export class RoomMap {
215
310
  cj0,
216
311
  x0,
217
312
  z0,
313
+ turn: turnOf(li),
218
314
  stride,
219
315
  i0,
220
316
  j0: MARGIN,
@@ -243,33 +339,58 @@ export class RoomMap {
243
339
  }
244
340
  });
245
341
  // Directory: per cell, the buildings whose clusters reach it (coarser cells on vast sites).
246
- let maxTx = 0;
247
- let maxTz = 0;
248
- for (const l of this.levels)
342
+ // On the world axes: each cluster's rect, turned back, as a world box.
343
+ const boxes = [];
344
+ for (const l of this.levels) {
345
+ const [cos, sin] = this.turns[l.building] ?? IDENTITY;
249
346
  for (const c of l.clusters) {
250
- maxTx = Math.max(maxTx, c.tx0 + c.tw);
251
- maxTz = Math.max(maxTz, c.tz0 + c.th);
347
+ const box = {
348
+ building: l.building,
349
+ x0: Number.POSITIVE_INFINITY,
350
+ z0: Number.POSITIVE_INFINITY,
351
+ x1: Number.NEGATIVE_INFINITY,
352
+ z1: Number.NEGATIVE_INFINITY,
353
+ };
354
+ for (const tx of [c.tx0, c.tx0 + c.tw])
355
+ for (const tz of [c.tz0, c.tz0 + c.th]) {
356
+ const mx = this.originX + tx * TILE_M;
357
+ const mz = this.originZ + tz * TILE_M;
358
+ const x = mx * cos - mz * sin;
359
+ const z = mx * sin + mz * cos;
360
+ box.x0 = Math.min(box.x0, x);
361
+ box.z0 = Math.min(box.z0, z);
362
+ box.x1 = Math.max(box.x1, x);
363
+ box.z1 = Math.max(box.z1, z);
364
+ }
365
+ boxes.push(box);
252
366
  }
367
+ }
368
+ this.dirX = boxes.reduce((min, box) => Math.min(min, box.x0), Number.POSITIVE_INFINITY);
369
+ this.dirZ = boxes.reduce((min, box) => Math.min(min, box.z0), Number.POSITIVE_INFINITY);
370
+ if (!boxes.length)
371
+ this.dirX = this.dirZ = 0;
372
+ // Whole tiles; a hair under, so a box ending on a tile edge doesn't claim the next tile.
373
+ const tiles = (metres) => Math.max(0, Math.ceil(metres / TILE_M - 1e-6));
374
+ const maxTx = boxes.reduce((max, box) => Math.max(max, tiles(box.x1 - this.dirX)), 0);
375
+ const maxTz = boxes.reduce((max, box) => Math.max(max, tiles(box.z1 - this.dirZ)), 0);
253
376
  this.dirTiles = Math.max(8, Math.ceil(Math.sqrt((maxTx * maxTz) / MAX_DIR_CELLS)));
254
377
  this.dirW = Math.max(1, Math.ceil(maxTx / this.dirTiles));
255
378
  this.dirH = Math.max(1, Math.ceil(maxTz / this.dirTiles));
256
379
  this.dirLists = Array.from({ length: this.dirW * this.dirH }, () => []);
257
- for (const l of this.levels)
258
- for (const c of l.clusters)
259
- for (let dz = Math.floor(c.tz0 / this.dirTiles); dz <= Math.floor((c.tz0 + c.th - 1) / this.dirTiles); dz++)
260
- for (let dx = Math.floor(c.tx0 / this.dirTiles); dx <= Math.floor((c.tx0 + c.tw - 1) / this.dirTiles); dx++) {
261
- const list = this.dirLists[dz * this.dirW + dx];
262
- if (!list.includes(l.building))
263
- list.push(l.building);
264
- }
380
+ const dirCell = (metres) => Math.floor(metres / TILE_M / this.dirTiles);
381
+ for (const box of boxes)
382
+ for (let dz = dirCell(box.z0 - this.dirZ + 1e-6); dz <= Math.min(this.dirH - 1, dirCell(box.z1 - this.dirZ - 1e-6)); dz++)
383
+ for (let dx = dirCell(box.x0 - this.dirX + 1e-6); dx <= Math.min(this.dirW - 1, dirCell(box.x1 - this.dirX - 1e-6)); dx++) {
384
+ const list = this.dirLists[dz * this.dirW + dx];
385
+ if (!list.includes(box.building))
386
+ list.push(box.building);
387
+ }
265
388
  this.upload();
266
389
  }
267
390
  /** CPU lookup in assembled space (same rule as the shader). */
268
391
  roomAt(x, y, z) {
269
- const tx = Math.floor((x - this.originX) / TILE_M);
270
- const tz = Math.floor((z - this.originZ) / TILE_M);
271
- const dx = Math.floor(tx / this.dirTiles);
272
- const dz = Math.floor(tz / this.dirTiles);
392
+ const dx = Math.floor((x - this.dirX) / TILE_M / this.dirTiles);
393
+ const dz = Math.floor((z - this.dirZ) / TILE_M / this.dirTiles);
273
394
  if (dx < 0 || dz < 0 || dx >= this.dirW || dz >= this.dirH)
274
395
  return -1;
275
396
  for (const b of this.dirLists[dz * this.dirW + dx]) {
@@ -278,13 +399,22 @@ export class RoomMap {
278
399
  for (let pos = start; pos < start + count; pos++)
279
400
  if (this.levels[this.order[pos]].y <= y - 0.12)
280
401
  found = pos;
281
- const room = this.levelRoomAt(this.order[found], x, z, tx, tz);
402
+ // The point in the building's turned frame.
403
+ const [cos, sin] = this.turns[b];
404
+ const mx = x * cos + z * sin;
405
+ const mz = z * cos - x * sin;
406
+ const tx = Math.floor((mx - this.originX) / TILE_M);
407
+ const tz = Math.floor((mz - this.originZ) / TILE_M);
408
+ const room = this.levelRoomAt(this.order[found], mx, mz, tx, tz);
282
409
  if (room >= 0)
283
410
  return room;
284
411
  }
285
412
  return -1;
286
413
  }
287
- /** A level's room at a point; clusters' rects can overlap (a wing around a courtyard pavilion). */
414
+ /**
415
+ * A level's room at a point of its building's frame; clusters' rects can overlap (a wing around
416
+ * a courtyard pavilion).
417
+ */
288
418
  levelRoomAt(li, x, z, tx, tz) {
289
419
  for (const c of this.levels[li].clusters) {
290
420
  const lx = tx - c.tx0;
@@ -371,8 +501,7 @@ export class RoomMap {
371
501
  index[c * 4 + 1] = buildings.length;
372
502
  for (const b of buildings) {
373
503
  const [start, count] = this.buildingRange[b];
374
- index[list * 4] = start;
375
- index[list * 4 + 1] = count;
504
+ index.set([start, count, ...this.turns[b]], list * 4);
376
505
  list++;
377
506
  }
378
507
  });
@@ -402,6 +531,8 @@ export class RoomMap {
402
531
  replace(this.u.levels, floatTexture(this.levelData, LEVEL_W, levelRows));
403
532
  replace(this.u.atlas, byteTexture(this.atlas, aw, this.atlas.length / 2 / aw));
404
533
  this.u.origin.value.set(this.originX, this.originZ);
534
+ this.u.dirOrigin.value.set(this.dirX, this.dirZ);
535
+ this.u.turn.value.set(...(this.turns[0] ?? IDENTITY));
405
536
  this.u.indexW.value = indexW;
406
537
  this.u.dirTiles.value = this.dirTiles;
407
538
  this.u.dirW.value = this.dirW;
@@ -430,15 +561,13 @@ export class RoomMap {
430
561
  roomAtNode = Fn(([p]) => {
431
562
  const u = this.u;
432
563
  const room = int(-1).toVar();
433
- const tileF = p.xz.sub(u.origin).div(TILE_M);
434
- const tile = ivec2(floor(tileF));
435
564
  // Candidate buildings: the only one, or the directory cell's list.
436
565
  const count = int(0).toVar();
437
566
  const listStart = int(0).toVar();
438
567
  If(u.single.equal(1), () => {
439
568
  count.assign(1);
440
569
  }).Else(() => {
441
- const dir = ivec2(floor(tileF.div(u.dirTiles)));
570
+ const dir = ivec2(floor(p.xz.sub(u.dirOrigin).div(TILE_M).div(u.dirTiles)));
442
571
  If(dir.x
443
572
  .greaterThanEqual(0)
444
573
  .and(dir.y.greaterThanEqual(0))
@@ -454,11 +583,18 @@ export class RoomMap {
454
583
  If(room.lessThan(0), () => {
455
584
  const start = int(0).toVar();
456
585
  const levels = u.singleCount.toVar();
586
+ const turn = u.turn.toVar();
457
587
  If(u.single.equal(0), () => {
458
588
  const range = this.indexTexel(listStart.add(i));
459
589
  start.assign(int(range.x));
460
590
  levels.assign(int(range.y));
591
+ turn.assign(range.zw);
461
592
  });
593
+ // The point in the building's turned frame, from the site origin.
594
+ const m = vec2(p.x.mul(turn.x).add(p.z.mul(turn.y)), p.z.mul(turn.x).sub(p.x.mul(turn.y)))
595
+ .sub(u.origin)
596
+ .toVar();
597
+ const tile = ivec2(floor(m.div(TILE_M))).toVar();
462
598
  // Last level of the building whose live floor is at or below the point (else its lowest).
463
599
  const lo = start.toVar();
464
600
  const hi = start.add(levels).sub(1).toVar();
@@ -492,7 +628,7 @@ export class RoomMap {
492
628
  room.assign(int(round(e)).sub(1));
493
629
  }).ElseIf(e.lessThan(-0.5), () => {
494
630
  const a = int(round(e.negate())).sub(1);
495
- const cell = ivec2(floor(p.xz.sub(u.origin).div(CELL))).sub(tile.mul(TILE));
631
+ const cell = ivec2(floor(m.div(CELL))).sub(tile.mul(TILE));
496
632
  const at = ivec2(a.mod(u.atlasTilesW).mul(TILE).add(cell.x), a.div(u.atlasTilesW).mul(TILE).add(cell.y));
497
633
  const texel = u.atlas.load(at);
498
634
  const id = int(round(texel.x.mul(255))).add(int(round(texel.y.mul(255))).mul(256));
@@ -507,6 +643,7 @@ export class RoomMap {
507
643
  });
508
644
  }
509
645
  // ---- build helpers --------------------------------------------------------------------------
646
+ const IDENTITY = [1, 0];
510
647
  /** Groups a level's rooms whose padded tile rects lie within `CLUSTER_GAP` tiles of each other. */
511
648
  function clusterRooms(members, rects) {
512
649
  const parent = members.map((_, i) => i);
@@ -579,8 +716,49 @@ function rasterize(room, value, cells, width, height, x0, z0) {
579
716
  }
580
717
  }
581
718
  }
582
- /** Two passes of 4-neighbour growth into empty cells: wall thickness and polygon slop resolve. */
583
- function dilate(cells, scratch, width, height) {
719
+ /** Marks the cells one footprint triangle (`t[at…at+5]`, world XZ) reaches. */
720
+ function markWall(t, at, wall, width, height, x0, z0) {
721
+ const zMin = Math.min(t[at + 1], t[at + 3], t[at + 5]);
722
+ const zMax = Math.max(t[at + 1], t[at + 3], t[at + 5]);
723
+ const j0 = Math.max(0, Math.ceil((zMin - WALL_REACH - z0) / CELL - 0.5));
724
+ const j1 = Math.min(height - 1, Math.floor((zMax + WALL_REACH - z0) / CELL - 0.5));
725
+ for (let j = j0; j <= j1; j++) {
726
+ // The triangle's x extent inside the band of z this row's cell centres reach.
727
+ const lo = z0 + (j + 0.5) * CELL - WALL_REACH;
728
+ const hi = lo + 2 * WALL_REACH;
729
+ let xMin = Number.POSITIVE_INFINITY;
730
+ let xMax = Number.NEGATIVE_INFINITY;
731
+ for (let a = 0; a < 3; a++) {
732
+ const xa = t[at + a * 2];
733
+ const za = t[at + a * 2 + 1];
734
+ const xb = t[at + ((a + 1) % 3) * 2];
735
+ const zb = t[at + ((a + 1) % 3) * 2 + 1];
736
+ if (za >= lo && za <= hi) {
737
+ xMin = Math.min(xMin, xa);
738
+ xMax = Math.max(xMax, xa);
739
+ }
740
+ for (const z of [lo, hi])
741
+ if (za < z !== zb < z) {
742
+ const x = xa + ((xb - xa) * (z - za)) / (zb - za);
743
+ xMin = Math.min(xMin, x);
744
+ xMax = Math.max(xMax, x);
745
+ }
746
+ }
747
+ if (xMin > xMax)
748
+ continue;
749
+ const i0 = Math.max(0, Math.ceil((xMin - WALL_REACH - x0) / CELL - 0.5));
750
+ const i1 = Math.min(width - 1, Math.floor((xMax + WALL_REACH - x0) / CELL - 0.5));
751
+ if (i1 >= i0)
752
+ wall.fill(1, j * width + i0, j * width + i1 + 1);
753
+ }
754
+ }
755
+ /**
756
+ * Two passes of 4-neighbour growth into empty cells: wall thickness and polygon slop resolve.
757
+ * A room grows into a wall but never out of it: past a wall's far face is outside, wherever the
758
+ * room's outline runs inside the wall (its centre line, or either face).
759
+ */
760
+ function dilate(cells, scratch, width, height, wall) {
761
+ const steps = [-1, 1, -width, width];
584
762
  for (let pass = 0; pass < 2; pass++) {
585
763
  scratch.set(cells);
586
764
  for (let j = 1; j < height - 1; j++)
@@ -588,9 +766,14 @@ function dilate(cells, scratch, width, height) {
588
766
  const k = j * width + i;
589
767
  if (scratch[k])
590
768
  continue;
591
- const n = scratch[k - 1] || scratch[k + 1] || scratch[k - width] || scratch[k + width];
592
- if (n)
593
- cells[k] = n;
769
+ const open = !wall || wall[k] === 1;
770
+ for (const step of steps) {
771
+ const n = scratch[k + step];
772
+ if (n && (open || !wall?.[k + step])) {
773
+ cells[k] = n;
774
+ break;
775
+ }
776
+ }
594
777
  }
595
778
  }
596
779
  }