wallhammer-web 0.0.0-stage → 0.4.0

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 (408) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +88 -2
  3. package/dist/base/data.d.ts +67 -0
  4. package/dist/base/data.js +10 -0
  5. package/dist/base/destructible.d.ts +167 -0
  6. package/dist/base/destructible.js +47 -0
  7. package/dist/base/env-slot.d.ts +101 -0
  8. package/dist/base/env-slot.js +8 -0
  9. package/dist/base/frames.d.ts +138 -0
  10. package/dist/base/frames.js +459 -0
  11. package/dist/base/index.d.ts +21 -0
  12. package/dist/base/index.js +11 -0
  13. package/dist/base/mat34.d.ts +46 -0
  14. package/dist/base/mat34.js +173 -0
  15. package/dist/base/material.d.ts +87 -0
  16. package/dist/base/material.js +6 -0
  17. package/dist/base/math.d.ts +27 -0
  18. package/dist/base/math.js +60 -0
  19. package/dist/base/progress.d.ts +38 -0
  20. package/dist/base/progress.js +81 -0
  21. package/dist/base/rig.d.ts +177 -0
  22. package/dist/base/rig.js +97 -0
  23. package/dist/base/trig.d.ts +29 -0
  24. package/dist/base/trig.js +169 -0
  25. package/dist/base/up.d.ts +26 -0
  26. package/dist/base/up.js +40 -0
  27. package/dist/base/view.d.ts +128 -0
  28. package/dist/base/view.js +136 -0
  29. package/dist/camera/camera.d.ts +99 -0
  30. package/dist/camera/camera.js +228 -0
  31. package/dist/camera/follow.d.ts +120 -0
  32. package/dist/camera/follow.js +320 -0
  33. package/dist/camera/free.d.ts +153 -0
  34. package/dist/camera/free.js +359 -0
  35. package/dist/camera/index.d.ts +10 -0
  36. package/dist/camera/index.js +6 -0
  37. package/dist/camera/orbit.d.ts +93 -0
  38. package/dist/camera/orbit.js +261 -0
  39. package/dist/camera/path.d.ts +48 -0
  40. package/dist/camera/path.js +179 -0
  41. package/dist/core/ballistic.d.ts +66 -0
  42. package/dist/core/ballistic.js +104 -0
  43. package/dist/core/bodies.d.ts +77 -0
  44. package/dist/core/bodies.js +125 -0
  45. package/dist/core/clock.d.ts +37 -0
  46. package/dist/core/clock.js +87 -0
  47. package/dist/core/cover-fade.d.ts +14 -0
  48. package/dist/core/cover-fade.js +38 -0
  49. package/dist/core/index.d.ts +13 -0
  50. package/dist/core/index.js +8 -0
  51. package/dist/core/kepler.d.ts +74 -0
  52. package/dist/core/kepler.js +108 -0
  53. package/dist/core/level-fade.d.ts +66 -0
  54. package/dist/core/level-fade.js +123 -0
  55. package/dist/core/palette.d.ts +15 -0
  56. package/dist/core/palette.js +47 -0
  57. package/dist/env/atmosphere.d.ts +129 -0
  58. package/dist/env/atmosphere.js +707 -0
  59. package/dist/env/cloud-field.d.ts +44 -0
  60. package/dist/env/cloud-field.js +111 -0
  61. package/dist/env/environment.d.ts +217 -0
  62. package/dist/env/environment.js +441 -0
  63. package/dist/env/frame-block.d.ts +29 -0
  64. package/dist/env/frame-block.js +152 -0
  65. package/dist/env/glsl.d.ts +35 -0
  66. package/dist/env/glsl.js +246 -0
  67. package/dist/env/index.d.ts +13 -0
  68. package/dist/env/index.js +9 -0
  69. package/dist/env/sky.d.ts +48 -0
  70. package/dist/env/sky.js +227 -0
  71. package/dist/env/sun.d.ts +31 -0
  72. package/dist/env/sun.js +42 -0
  73. package/dist/gen-arch/build.d.ts +17 -0
  74. package/dist/gen-arch/build.js +414 -0
  75. package/dist/gen-arch/damage/damaged.d.ts +44 -0
  76. package/dist/gen-arch/damage/damaged.js +1119 -0
  77. package/dist/gen-arch/damage/fall-material.d.ts +10 -0
  78. package/dist/gen-arch/damage/fall-material.js +47 -0
  79. package/dist/gen-arch/damage/fall.d.ts +78 -0
  80. package/dist/gen-arch/damage/fall.js +797 -0
  81. package/dist/gen-arch/damage/rubble.d.ts +22 -0
  82. package/dist/gen-arch/damage/rubble.js +188 -0
  83. package/dist/gen-arch/index.d.ts +25 -0
  84. package/dist/gen-arch/index.js +16 -0
  85. package/dist/gen-arch/interior/interior-plan.d.ts +114 -0
  86. package/dist/gen-arch/interior/interior-plan.js +615 -0
  87. package/dist/gen-arch/interior/interior.d.ts +97 -0
  88. package/dist/gen-arch/interior/interior.js +966 -0
  89. package/dist/gen-arch/structure/building-shader.d.ts +25 -0
  90. package/dist/gen-arch/structure/building-shader.js +946 -0
  91. package/dist/gen-arch/structure/buildings.d.ts +248 -0
  92. package/dist/gen-arch/structure/buildings.js +294 -0
  93. package/dist/gen-arch/structure/dims.d.ts +77 -0
  94. package/dist/gen-arch/structure/dims.js +39 -0
  95. package/dist/gen-arch/structure/distant.d.ts +62 -0
  96. package/dist/gen-arch/structure/distant.js +316 -0
  97. package/dist/gen-arch/structure/env-slots.d.ts +18 -0
  98. package/dist/gen-arch/structure/env-slots.js +47 -0
  99. package/dist/gen-arch/structure/facade.d.ts +193 -0
  100. package/dist/gen-arch/structure/facade.js +159 -0
  101. package/dist/gen-arch/structure/parts.d.ts +31 -0
  102. package/dist/gen-arch/structure/parts.js +69 -0
  103. package/dist/gen-arch/structure/roof.d.ts +76 -0
  104. package/dist/gen-arch/structure/roof.js +568 -0
  105. package/dist/gen-arch/structure/structure-material.d.ts +23 -0
  106. package/dist/gen-arch/structure/structure-material.js +55 -0
  107. package/dist/gen-arch/structure/writer.d.ts +94 -0
  108. package/dist/gen-arch/structure/writer.js +195 -0
  109. package/dist/gen-core/cell.d.ts +138 -0
  110. package/dist/gen-core/cell.js +150 -0
  111. package/dist/gen-core/cube-sphere.d.ts +57 -0
  112. package/dist/gen-core/cube-sphere.js +159 -0
  113. package/dist/gen-core/field.d.ts +55 -0
  114. package/dist/gen-core/field.js +154 -0
  115. package/dist/gen-core/geometry.d.ts +31 -0
  116. package/dist/gen-core/geometry.js +231 -0
  117. package/dist/gen-core/hash.d.ts +18 -0
  118. package/dist/gen-core/hash.js +58 -0
  119. package/dist/gen-core/height-field.d.ts +33 -0
  120. package/dist/gen-core/height-field.js +137 -0
  121. package/dist/gen-core/index.d.ts +22 -0
  122. package/dist/gen-core/index.js +17 -0
  123. package/dist/gen-core/instance-cells.d.ts +37 -0
  124. package/dist/gen-core/instance-cells.js +72 -0
  125. package/dist/gen-core/near-scatter.d.ts +56 -0
  126. package/dist/gen-core/near-scatter.js +120 -0
  127. package/dist/gen-core/noise.d.ts +23 -0
  128. package/dist/gen-core/noise.js +72 -0
  129. package/dist/gen-core/occupancy.d.ts +21 -0
  130. package/dist/gen-core/occupancy.js +104 -0
  131. package/dist/gen-core/sphere-patch.d.ts +138 -0
  132. package/dist/gen-core/sphere-patch.js +544 -0
  133. package/dist/gen-core/strip-surface.d.ts +34 -0
  134. package/dist/gen-core/strip-surface.js +246 -0
  135. package/dist/gen-core/strip.d.ts +102 -0
  136. package/dist/gen-core/strip.js +817 -0
  137. package/dist/gen-ground/env-slots.d.ts +48 -0
  138. package/dist/gen-ground/env-slots.js +78 -0
  139. package/dist/gen-ground/ground.d.ts +78 -0
  140. package/dist/gen-ground/ground.js +208 -0
  141. package/dist/gen-ground/index.d.ts +9 -0
  142. package/dist/gen-ground/index.js +7 -0
  143. package/dist/gen-ground/markings.d.ts +46 -0
  144. package/dist/gen-ground/markings.js +124 -0
  145. package/dist/gen-ground/materials.d.ts +18 -0
  146. package/dist/gen-ground/materials.js +22 -0
  147. package/dist/gen-ground/terrain-shader.d.ts +5 -0
  148. package/dist/gen-ground/terrain-shader.js +151 -0
  149. package/dist/gen-mesh/bare-shapes.d.ts +194 -0
  150. package/dist/gen-mesh/bare-shapes.js +596 -0
  151. package/dist/gen-mesh/bisect-surface.d.ts +47 -0
  152. package/dist/gen-mesh/bisect-surface.js +261 -0
  153. package/dist/gen-mesh/box.d.ts +18 -0
  154. package/dist/gen-mesh/box.js +2 -0
  155. package/dist/gen-mesh/cell-morph-mesh.d.ts +52 -0
  156. package/dist/gen-mesh/cell-morph-mesh.js +258 -0
  157. package/dist/gen-mesh/cell-surface-mesh.d.ts +32 -0
  158. package/dist/gen-mesh/cell-surface-mesh.js +140 -0
  159. package/dist/gen-mesh/chunk-mesh.d.ts +25 -0
  160. package/dist/gen-mesh/chunk-mesh.js +112 -0
  161. package/dist/gen-mesh/drape-mesh.d.ts +36 -0
  162. package/dist/gen-mesh/drape-mesh.js +98 -0
  163. package/dist/gen-mesh/height-field-mesh.d.ts +14 -0
  164. package/dist/gen-mesh/height-field-mesh.js +98 -0
  165. package/dist/gen-mesh/index.d.ts +26 -0
  166. package/dist/gen-mesh/index.js +15 -0
  167. package/dist/gen-mesh/line-mesh.d.ts +25 -0
  168. package/dist/gen-mesh/line-mesh.js +62 -0
  169. package/dist/gen-mesh/mesh-builder.d.ts +115 -0
  170. package/dist/gen-mesh/mesh-builder.js +315 -0
  171. package/dist/gen-mesh/packed-mesh.d.ts +53 -0
  172. package/dist/gen-mesh/packed-mesh.js +205 -0
  173. package/dist/gen-mesh/prism-mesh.d.ts +33 -0
  174. package/dist/gen-mesh/prism-mesh.js +176 -0
  175. package/dist/gen-mesh/rig-mesh.d.ts +9 -0
  176. package/dist/gen-mesh/rig-mesh.js +135 -0
  177. package/dist/gen-mesh/strip-mesh.d.ts +45 -0
  178. package/dist/gen-mesh/strip-mesh.js +258 -0
  179. package/dist/gen-plan/drain.d.ts +58 -0
  180. package/dist/gen-plan/drain.js +270 -0
  181. package/dist/gen-plan/grid.d.ts +37 -0
  182. package/dist/gen-plan/grid.js +182 -0
  183. package/dist/gen-plan/horizon.d.ts +50 -0
  184. package/dist/gen-plan/horizon.js +185 -0
  185. package/dist/gen-plan/index.d.ts +15 -0
  186. package/dist/gen-plan/index.js +13 -0
  187. package/dist/gen-plan/line-tiles.d.ts +35 -0
  188. package/dist/gen-plan/line-tiles.js +190 -0
  189. package/dist/gen-plan/lines.d.ts +31 -0
  190. package/dist/gen-plan/lines.js +183 -0
  191. package/dist/gen-plan/plots.d.ts +40 -0
  192. package/dist/gen-plan/plots.js +282 -0
  193. package/dist/gen-plan/route.d.ts +55 -0
  194. package/dist/gen-plan/route.js +297 -0
  195. package/dist/gen-plan/sites.d.ts +32 -0
  196. package/dist/gen-plan/sites.js +209 -0
  197. package/dist/gen-tex/code-stamp.d.ts +31 -0
  198. package/dist/gen-tex/code-stamp.js +137 -0
  199. package/dist/gen-tex/index.d.ts +7 -0
  200. package/dist/gen-tex/index.js +5 -0
  201. package/dist/gen-tex/light-horizon.d.ts +47 -0
  202. package/dist/gen-tex/light-horizon.js +180 -0
  203. package/dist/gen-tex/textures.d.ts +8 -0
  204. package/dist/gen-tex/textures.js +49 -0
  205. package/dist/gen-tex/value-textures.d.ts +46 -0
  206. package/dist/gen-tex/value-textures.js +102 -0
  207. package/dist/gen-vegetation/env-slots.d.ts +20 -0
  208. package/dist/gen-vegetation/env-slots.js +29 -0
  209. package/dist/gen-vegetation/index.d.ts +8 -0
  210. package/dist/gen-vegetation/index.js +7 -0
  211. package/dist/gen-vegetation/materials.d.ts +7 -0
  212. package/dist/gen-vegetation/materials.js +17 -0
  213. package/dist/gen-vegetation/planting.d.ts +170 -0
  214. package/dist/gen-vegetation/planting.js +363 -0
  215. package/dist/gen-vegetation/tree-shader.d.ts +23 -0
  216. package/dist/gen-vegetation/tree-shader.js +229 -0
  217. package/dist/gen-vegetation/trees.d.ts +59 -0
  218. package/dist/gen-vegetation/trees.js +329 -0
  219. package/dist/gpu/device.d.ts +286 -0
  220. package/dist/gpu/device.js +1157 -0
  221. package/dist/gpu/gl.d.ts +134 -0
  222. package/dist/gpu/gl.js +276 -0
  223. package/dist/gpu/index.d.ts +4 -0
  224. package/dist/gpu/index.js +3 -0
  225. package/dist/index.d.ts +11 -0
  226. package/dist/index.js +13 -0
  227. package/dist/motion/graph.d.ts +244 -0
  228. package/dist/motion/graph.js +739 -0
  229. package/dist/motion/index.d.ts +8 -0
  230. package/dist/motion/index.js +8 -0
  231. package/dist/motion/pose-ops.d.ts +30 -0
  232. package/dist/motion/pose-ops.js +232 -0
  233. package/dist/motion/reach.d.ts +45 -0
  234. package/dist/motion/reach.js +264 -0
  235. package/dist/motion/skeleton.d.ts +49 -0
  236. package/dist/motion/skeleton.js +99 -0
  237. package/dist/platform/byte-store.d.ts +21 -0
  238. package/dist/platform/byte-store.js +137 -0
  239. package/dist/platform/canvas.d.ts +29 -0
  240. package/dist/platform/canvas.js +76 -0
  241. package/dist/platform/context-loss.d.ts +8 -0
  242. package/dist/platform/context-loss.js +17 -0
  243. package/dist/platform/free-input.d.ts +51 -0
  244. package/dist/platform/free-input.js +100 -0
  245. package/dist/platform/index.d.ts +18 -0
  246. package/dist/platform/index.js +10 -0
  247. package/dist/platform/input.d.ts +48 -0
  248. package/dist/platform/input.js +117 -0
  249. package/dist/platform/keys.d.ts +12 -0
  250. package/dist/platform/keys.js +29 -0
  251. package/dist/platform/loop.d.ts +41 -0
  252. package/dist/platform/loop.js +84 -0
  253. package/dist/platform/walk-input.d.ts +74 -0
  254. package/dist/platform/walk-input.js +226 -0
  255. package/dist/platform/worker.d.ts +51 -0
  256. package/dist/platform/worker.js +170 -0
  257. package/dist/render/bone-instances.d.ts +24 -0
  258. package/dist/render/bone-instances.js +74 -0
  259. package/dist/render/cells.d.ts +70 -0
  260. package/dist/render/cells.js +144 -0
  261. package/dist/render/glsl.d.ts +66 -0
  262. package/dist/render/glsl.js +173 -0
  263. package/dist/render/index.d.ts +26 -0
  264. package/dist/render/index.js +16 -0
  265. package/dist/render/instance-sets.d.ts +97 -0
  266. package/dist/render/instance-sets.js +241 -0
  267. package/dist/render/near-instances.d.ts +75 -0
  268. package/dist/render/near-instances.js +219 -0
  269. package/dist/render/particles.d.ts +63 -0
  270. package/dist/render/particles.js +215 -0
  271. package/dist/render/pieces.d.ts +57 -0
  272. package/dist/render/pieces.js +151 -0
  273. package/dist/render/point-lights.d.ts +97 -0
  274. package/dist/render/point-lights.js +243 -0
  275. package/dist/render/renderer.d.ts +447 -0
  276. package/dist/render/renderer.js +1100 -0
  277. package/dist/render/rig.d.ts +74 -0
  278. package/dist/render/rig.js +576 -0
  279. package/dist/render/shadow-areas.d.ts +49 -0
  280. package/dist/render/shadow-areas.js +125 -0
  281. package/dist/render/shadow-glsl.d.ts +12 -0
  282. package/dist/render/shadow-glsl.js +146 -0
  283. package/dist/render/transient.d.ts +61 -0
  284. package/dist/render/transient.js +213 -0
  285. package/dist/render/value-glsl.d.ts +17 -0
  286. package/dist/render/value-glsl.js +208 -0
  287. package/dist/render/value-layers.d.ts +180 -0
  288. package/dist/render/value-layers.js +333 -0
  289. package/dist/runtime/atmosphere.d.ts +37 -0
  290. package/dist/runtime/atmosphere.js +304 -0
  291. package/dist/runtime/cloud-shell.d.ts +29 -0
  292. package/dist/runtime/cloud-shell.js +158 -0
  293. package/dist/runtime/engine.d.ts +155 -0
  294. package/dist/runtime/engine.js +305 -0
  295. package/dist/runtime/environment-link.d.ts +22 -0
  296. package/dist/runtime/environment-link.js +49 -0
  297. package/dist/runtime/index.d.ts +13 -0
  298. package/dist/runtime/index.js +12 -0
  299. package/dist/runtime/precipitation-glsl.d.ts +2 -0
  300. package/dist/runtime/precipitation-glsl.js +70 -0
  301. package/dist/runtime/precipitation.d.ts +11 -0
  302. package/dist/runtime/precipitation.js +78 -0
  303. package/dist/runtime/sky.d.ts +30 -0
  304. package/dist/runtime/sky.js +114 -0
  305. package/dist/runtime/streaming.d.ts +245 -0
  306. package/dist/runtime/streaming.js +602 -0
  307. package/dist/sim/agenda.d.ts +167 -0
  308. package/dist/sim/agenda.js +425 -0
  309. package/dist/sim/bytes.d.ts +34 -0
  310. package/dist/sim/bytes.js +125 -0
  311. package/dist/sim/destruction/apply.d.ts +59 -0
  312. package/dist/sim/destruction/apply.js +243 -0
  313. package/dist/sim/destruction/cell-states.d.ts +54 -0
  314. package/dist/sim/destruction/cell-states.js +198 -0
  315. package/dist/sim/destruction/index.d.ts +11 -0
  316. package/dist/sim/destruction/index.js +10 -0
  317. package/dist/sim/destruction/int-geometry.d.ts +17 -0
  318. package/dist/sim/destruction/int-geometry.js +131 -0
  319. package/dist/sim/destruction/pick.d.ts +13 -0
  320. package/dist/sim/destruction/pick.js +59 -0
  321. package/dist/sim/destruction/rubble.d.ts +8 -0
  322. package/dist/sim/destruction/rubble.js +159 -0
  323. package/dist/sim/destruction/state.d.ts +15 -0
  324. package/dist/sim/destruction/state.js +83 -0
  325. package/dist/sim/destruction/structure.d.ts +30 -0
  326. package/dist/sim/destruction/structure.js +139 -0
  327. package/dist/sim/events.d.ts +37 -0
  328. package/dist/sim/events.js +106 -0
  329. package/dist/sim/fixed.d.ts +21 -0
  330. package/dist/sim/fixed.js +64 -0
  331. package/dist/sim/flow-probe.d.ts +58 -0
  332. package/dist/sim/flow-probe.js +158 -0
  333. package/dist/sim/flow.d.ts +257 -0
  334. package/dist/sim/flow.js +967 -0
  335. package/dist/sim/index.d.ts +28 -0
  336. package/dist/sim/index.js +20 -0
  337. package/dist/sim/interlock.d.ts +47 -0
  338. package/dist/sim/interlock.js +252 -0
  339. package/dist/sim/movers.d.ts +228 -0
  340. package/dist/sim/movers.js +1083 -0
  341. package/dist/sim/nav.d.ts +72 -0
  342. package/dist/sim/nav.js +292 -0
  343. package/dist/sim/paths.d.ts +80 -0
  344. package/dist/sim/paths.js +197 -0
  345. package/dist/sim/regions.d.ts +87 -0
  346. package/dist/sim/regions.js +517 -0
  347. package/dist/sim/simulation.d.ts +114 -0
  348. package/dist/sim/simulation.js +291 -0
  349. package/dist/sim/states.d.ts +23 -0
  350. package/dist/sim/states.js +54 -0
  351. package/dist/sim/table.d.ts +49 -0
  352. package/dist/sim/table.js +126 -0
  353. package/dist/sim/zones.d.ts +11 -0
  354. package/dist/sim/zones.js +196 -0
  355. package/dist/tools/collision-lines.d.ts +12 -0
  356. package/dist/tools/collision-lines.js +50 -0
  357. package/dist/tools/data-view-glsl.d.ts +3 -0
  358. package/dist/tools/data-view-glsl.js +63 -0
  359. package/dist/tools/data-view-layers.d.ts +20 -0
  360. package/dist/tools/data-view-layers.js +60 -0
  361. package/dist/tools/debug-view.d.ts +30 -0
  362. package/dist/tools/debug-view.js +4 -0
  363. package/dist/tools/index.d.ts +10 -0
  364. package/dist/tools/index.js +7 -0
  365. package/dist/tools/mesh-checks.d.ts +67 -0
  366. package/dist/tools/mesh-checks.js +188 -0
  367. package/dist/tools/profile.d.ts +85 -0
  368. package/dist/tools/profile.js +173 -0
  369. package/dist/world/cell-cache.d.ts +32 -0
  370. package/dist/world/cell-cache.js +60 -0
  371. package/dist/world/cell-format.d.ts +25 -0
  372. package/dist/world/cell-format.js +232 -0
  373. package/dist/world/collide.d.ts +192 -0
  374. package/dist/world/collide.js +822 -0
  375. package/dist/world/index.d.ts +16 -0
  376. package/dist/world/index.js +12 -0
  377. package/dist/world/mesh-solids.d.ts +48 -0
  378. package/dist/world/mesh-solids.js +169 -0
  379. package/dist/world/pick.d.ts +34 -0
  380. package/dist/world/pick.js +177 -0
  381. package/dist/world/providers.d.ts +66 -0
  382. package/dist/world/providers.js +83 -0
  383. package/dist/world/sphere.d.ts +69 -0
  384. package/dist/world/sphere.js +271 -0
  385. package/dist/world/streaming.d.ts +288 -0
  386. package/dist/world/streaming.js +801 -0
  387. package/dist/world/walker.d.ts +145 -0
  388. package/dist/world/walker.js +502 -0
  389. package/docs/architecture.md +111 -0
  390. package/docs/cameras.md +302 -0
  391. package/docs/concepts.md +123 -0
  392. package/docs/destruction.md +127 -0
  393. package/docs/frames.md +199 -0
  394. package/docs/generators.md +575 -0
  395. package/docs/getting-started.md +123 -0
  396. package/docs/headless.md +50 -0
  397. package/docs/motion.md +160 -0
  398. package/docs/planet.md +152 -0
  399. package/docs/recipes.md +521 -0
  400. package/docs/reference.md +364 -0
  401. package/docs/rendering.md +823 -0
  402. package/docs/rigs.md +203 -0
  403. package/docs/simulation.md +235 -0
  404. package/docs/streaming.md +590 -0
  405. package/docs/system.md +166 -0
  406. package/docs/tools.md +175 -0
  407. package/docs/walking.md +262 -0
  408. package/package.json +131 -3
@@ -0,0 +1,159 @@
1
+ // Façade recipes: a generic description of what a building's walls carry (entrances, plinth, ground floor,
2
+ // window formats, balconies, cornice, chimneys, roof superstructures). The engine knows nothing about building
3
+ // types; the application decides which recipe a building gets. Elements that cast a visible shadow or change
4
+ // the silhouette become geometry here, everything flat is drawn by the building shader from per-vertex data.
5
+ import { pointInRings } from '../../gen-core/index.js';
6
+ /** How the ground floor differs from the floors above. */
7
+ export const GROUND_FLOOR = {
8
+ /** Same windows as the floors above. */
9
+ windows: 0,
10
+ /** Large glazing (lobby, shop, university entrance hall). */
11
+ glazed: 1,
12
+ /** Small high windows (utility rooms, garages, halls). */
13
+ high: 2,
14
+ /** No windows. */
15
+ blind: 3,
16
+ };
17
+ /** Kind of opening an entrance gets. Codes are what the shader reads. */
18
+ export const DOOR_KIND = { none: 0, door: 1, garage: 2, portal: 3, arch: 4 };
19
+ /** Distances and sizes for façade geometry. */
20
+ export const FACADE_DIM = {
21
+ /** Door height above the threshold, garage door and glazed portal. */
22
+ doorHeight: 2.25,
23
+ garageDoorHeight: 2.1,
24
+ portalHeight: 2.7,
25
+ /** One step: rise and tread. */
26
+ stepRise: 0.16,
27
+ stepTread: 0.3,
28
+ /** Landing in front of the door. */
29
+ landingDepth: 1.0,
30
+ /** Below this difference between threshold and terrain no steps are built. */
31
+ minStepHeight: 0.1,
32
+ maxSteps: 7,
33
+ /** How deep the steps reach under the terrain so they never float on a slope. */
34
+ stepSink: 0.3,
35
+ /** Canopy: gap above the door, slab thickness and how much wider than the door it is. */
36
+ canopyGap: 0.25,
37
+ canopyThickness: 0.16,
38
+ canopyExtraWidth: 0.9,
39
+ /** Distance from a wall end to the nearest door or balcony edge. */
40
+ wallEndMargin: 0.45,
41
+ /** Balcony slab thickness and parapet height above the floor. */
42
+ balconySlab: 0.16,
43
+ balconyParapet: 1.05,
44
+ /** Balcony width as a share of the window column, and its cap in metres. */
45
+ balconyColumnShare: 0.84,
46
+ balconyMaxWidth: 3.8,
47
+ /** Cornice top sits this much under the wall top so it never shares a plane with a parapet. */
48
+ corniceTopGap: 0.04,
49
+ /** Chimney size and how far it stands above the ridge. */
50
+ chimneySize: [0.55, 0.75],
51
+ chimneyAboveRidge: 0.85,
52
+ /** Sample offset in front of a wall when testing whether a neighbour stands there. */
53
+ partyProbe: 0.3,
54
+ /** Share of a wall covered by a neighbour from which the wall counts as a shared (party) wall. */
55
+ partyShare: 0.5,
56
+ /** Superstructures keep this distance from the roof edge (parapet thickness included). */
57
+ roofBoxMargin: 0.45,
58
+ /** Lowest superstructure worth drawing. */
59
+ roofBoxMinHeight: 0.4,
60
+ /** Height of an arch door as a multiple of its width (the head included). */
61
+ archHeightPerWidth: 1.5,
62
+ };
63
+ /** Bits of the per-vertex façade flags (`a_bits.x`). The building shader reads the same numbers. */
64
+ export const FACADE_FLAG = {
65
+ recipe: 1,
66
+ blind: 2,
67
+ panelJoints: 4,
68
+ stairStrip: 8,
69
+ transom: 16,
70
+ balconies: 32,
71
+ loggia: 64,
72
+ cornice: 128,
73
+ };
74
+ /**
75
+ * Footprints of all buildings with a coarse grid, for "does another building stand here" queries:
76
+ * shared walls, and façade elements that would poke into a neighbour.
77
+ */
78
+ export class FootprintIndex {
79
+ cell = 16;
80
+ grid = new Map();
81
+ rings;
82
+ constructor(rings) {
83
+ this.rings = rings;
84
+ rings.forEach((rs, i) => {
85
+ const outer = rs[0];
86
+ if (!outer)
87
+ return;
88
+ let minX = Infinity;
89
+ let maxX = -Infinity;
90
+ let minZ = Infinity;
91
+ let maxZ = -Infinity;
92
+ for (let k = 0; k < outer.length; k += 2) {
93
+ minX = Math.min(minX, outer[k]);
94
+ maxX = Math.max(maxX, outer[k]);
95
+ minZ = Math.min(minZ, outer[k + 1]);
96
+ maxZ = Math.max(maxZ, outer[k + 1]);
97
+ }
98
+ for (let gz = Math.floor(minZ / this.cell); gz <= Math.floor(maxZ / this.cell); gz++) {
99
+ for (let gx = Math.floor(minX / this.cell); gx <= Math.floor(maxX / this.cell); gx++) {
100
+ const key = gz * 100003 + gx;
101
+ let list = this.grid.get(key);
102
+ if (!list)
103
+ this.grid.set(key, (list = []));
104
+ list.push(i);
105
+ }
106
+ }
107
+ });
108
+ }
109
+ /** Is the point inside a building other than `self` (and other than those `skip` names)? */
110
+ occupied(x, z, self, skip) {
111
+ const list = this.grid.get(Math.floor(z / this.cell) * 100003 + Math.floor(x / this.cell));
112
+ if (!list)
113
+ return false;
114
+ for (const i of list)
115
+ if (i !== self && !(skip && skip(i)) && pointInRings(x, z, this.rings[i]))
116
+ return true;
117
+ return false;
118
+ }
119
+ /** Is any of the points inside another building? Points as flat x, z pairs. */
120
+ anyOccupied(pts, self, skip) {
121
+ for (let k = 0; k < pts.length; k += 2)
122
+ if (this.occupied(pts[k], pts[k + 1], self, skip))
123
+ return true;
124
+ return false;
125
+ }
126
+ }
127
+ /** Share of the wall from a to b that has another building (not one `skip` names) right in front of it. */
128
+ export function partyShare(index, self, ax, az, bx, bz, skip) {
129
+ const len = Math.hypot(bx - ax, bz - az);
130
+ if (len < 1e-3)
131
+ return 0;
132
+ const nx = (bz - az) / len;
133
+ const nz = -(bx - ax) / len;
134
+ const n = Math.max(3, Math.min(24, Math.round(len / 1.5)));
135
+ let hit = 0;
136
+ for (let k = 0; k < n; k++) {
137
+ const t = (k + 0.5) / n;
138
+ const x = ax + (bx - ax) * t + nx * FACADE_DIM.partyProbe;
139
+ const z = az + (bz - az) * t + nz * FACADE_DIM.partyProbe;
140
+ if (index.occupied(x, z, self, skip))
141
+ hit++;
142
+ }
143
+ return hit / n;
144
+ }
145
+ /** Corners of a box standing in front of a wall: from `u0` to `u1` along the wall, `d0` to `d1` out of it. */
146
+ export function wallBoxCorners(ax, az, dx, dz, u0, u1, d0, d1) {
147
+ const nx = dz;
148
+ const nz = -dx;
149
+ const out = [];
150
+ for (const [u, d] of [
151
+ [u0, d0],
152
+ [u1, d0],
153
+ [u1, d1],
154
+ [u0, d1],
155
+ ]) {
156
+ out.push(ax + dx * u + nx * d, az + dz * u + nz * d);
157
+ }
158
+ return out;
159
+ }
@@ -0,0 +1,31 @@
1
+ import type { StructureState } from '../../base/index.ts';
2
+ /** Immutable rule ids of the parts (never renumbered; a new rule takes a new id). */
3
+ export declare const PART_RULE: {
4
+ readonly foundation: 1;
5
+ readonly wall: 2;
6
+ readonly roof: 3;
7
+ readonly balcony: 4;
8
+ readonly canopy: 5;
9
+ readonly chimney: 6;
10
+ readonly roofTop: 7;
11
+ readonly slab: 8;
12
+ readonly partition: 9;
13
+ readonly stair: 10;
14
+ };
15
+ /** Key of a wall bay or balcony: ring (4 bits), edge vertex index (10), column (8), storey (6). -1 when out of range. */
16
+ export declare function bayKey(rule: number, ring: number, edge: number, column: number, storey: number): number;
17
+ export declare const foundationKey: () => number;
18
+ export declare const roofKey: (s: number, t: number) => number;
19
+ export declare const canopyKey: (k: number) => number;
20
+ export declare const chimneyKey: (k: number) => number;
21
+ export declare const roofTopKey: (k: number) => number;
22
+ /** Floor slab of storey `f` (0 is the ground slab, `floors` the slab under the roof space) over interior cell (i, j). */
23
+ export declare function slabKey(f: number, i: number, j: number): number;
24
+ /** Partition wall in storey `f`: direction (0 across, 1 along the long axis) and grid line (i, j). */
25
+ export declare function partitionKey(f: number, dir: number, i: number, j: number): number;
26
+ /** Stair flights from storey `f` up to `f + 1`. */
27
+ export declare const stairKey: (f: number) => number;
28
+ /** The rule id and path of a key, for debugging and reports. */
29
+ export declare function describeKey(key: number): string;
30
+ /** Is the part gone in this state (a ruin counts everything as gone)? */
31
+ export declare function partGone(state: StructureState | undefined, key: number): boolean;
@@ -0,0 +1,69 @@
1
+ // Stable keys of the destructible parts of a structure: rule id in the top four bits, the part's path in the recipe
2
+ // below (never the order in which geometry is written). Shared by the description, the damaged emission and the
3
+ // interior.
4
+ import { DAMAGE, entryRung } from '../../base/index.js';
5
+ /** Immutable rule ids of the parts (never renumbered; a new rule takes a new id). */
6
+ export const PART_RULE = { foundation: 1, wall: 2, roof: 3, balcony: 4, canopy: 5, chimney: 6, roofTop: 7, slab: 8, partition: 9, stair: 10 };
7
+ const ruleKey = (rule, payload) => ((rule << 28) | payload) >>> 0;
8
+ /** Key of a wall bay or balcony: ring (4 bits), edge vertex index (10), column (8), storey (6). -1 when out of range. */
9
+ export function bayKey(rule, ring, edge, column, storey) {
10
+ if (ring > 15 || edge > 1023 || column > 255 || storey > 63)
11
+ return -1;
12
+ return ruleKey(rule, (ring << 24) | (edge << 14) | (column << 6) | storey);
13
+ }
14
+ export const foundationKey = () => ruleKey(PART_RULE.foundation, 0);
15
+ export const roofKey = (s, t) => ruleKey(PART_RULE.roof, (s << 8) | t);
16
+ export const canopyKey = (k) => ruleKey(PART_RULE.canopy, k & 0xff);
17
+ export const chimneyKey = (k) => ruleKey(PART_RULE.chimney, k & 0xff);
18
+ export const roofTopKey = (k) => ruleKey(PART_RULE.roofTop, k & 0xfff);
19
+ /** Floor slab of storey `f` (0 is the ground slab, `floors` the slab under the roof space) over interior cell (i, j). */
20
+ export function slabKey(f, i, j) {
21
+ if (f > 63 || i > 1023 || j > 1023)
22
+ return -1;
23
+ return ruleKey(PART_RULE.slab, (f << 20) | (i << 10) | j);
24
+ }
25
+ /** Partition wall in storey `f`: direction (0 across, 1 along the long axis) and grid line (i, j). */
26
+ export function partitionKey(f, dir, i, j) {
27
+ if (f > 127 || i > 1023 || j > 1023)
28
+ return -1;
29
+ return ruleKey(PART_RULE.partition, (f << 21) | (dir << 20) | (i << 10) | j);
30
+ }
31
+ /** Stair flights from storey `f` up to `f + 1`. */
32
+ export const stairKey = (f) => ruleKey(PART_RULE.stair, f & 0xff);
33
+ /** The rule id and path of a key, for debugging and reports. */
34
+ export function describeKey(key) {
35
+ const rule = key >>> 28;
36
+ const p = key & 0x0fffffff;
37
+ switch (rule) {
38
+ case PART_RULE.wall:
39
+ case PART_RULE.balcony:
40
+ return `${rule === PART_RULE.wall ? 'wall' : 'balcony'} ring ${p >>> 24} edge ${(p >>> 14) & 1023} column ${(p >>> 6) & 255} storey ${p & 63}`;
41
+ case PART_RULE.roof:
42
+ return `roof cell ${p >>> 8},${p & 255}`;
43
+ case PART_RULE.foundation:
44
+ return 'foundation';
45
+ case PART_RULE.canopy:
46
+ return `canopy ${p}`;
47
+ case PART_RULE.chimney:
48
+ return `chimney ${p}`;
49
+ case PART_RULE.roofTop:
50
+ return `roof top ${p}`;
51
+ case PART_RULE.slab:
52
+ return `slab storey ${p >>> 20} cell ${(p >>> 10) & 1023},${p & 1023}`;
53
+ case PART_RULE.partition:
54
+ return `partition storey ${p >>> 21} ${(p >>> 20) & 1 ? 'along' : 'across'} ${(p >>> 10) & 1023},${p & 1023}`;
55
+ case PART_RULE.stair:
56
+ return `stair storey ${p}`;
57
+ default:
58
+ return `rule ${rule} path ${p}`;
59
+ }
60
+ }
61
+ /** Is the part gone in this state (a ruin counts everything as gone)? */
62
+ export function partGone(state, key) {
63
+ if (!state)
64
+ return false;
65
+ if (state.ruin)
66
+ return true;
67
+ const e = state.parts.get(key);
68
+ return e !== undefined && entryRung(e) === DAMAGE.gone;
69
+ }
@@ -0,0 +1,76 @@
1
+ import type { OrientedBox, Ring } from '../../gen-core/index.ts';
2
+ /** A line in the footprint: points where nx·x + nz·z = off. The roof plane breaks on it. */
3
+ export interface CreaseLine {
4
+ nx: number;
5
+ nz: number;
6
+ off: number;
7
+ }
8
+ export interface RoofGeometry {
9
+ /** Roof triangles: x, y, z for each vertex, 9 numbers per triangle, facing up. */
10
+ tris: number[];
11
+ /** Roof height above a footprint point. Walls get their top edge from it (gables). */
12
+ topAt: (x: number, z: number) => number;
13
+ /** Lines on which the wall's top edge breaks. Footprint edges must be split on them. */
14
+ creases: CreaseLine[];
15
+ /** Eave height the roof finally sits on. Pitched roofs derive it from the ridge and the allowed slope. */
16
+ eaveY: number;
17
+ /** The level that was finally used. */
18
+ tier: 1 | 2 | 3;
19
+ }
20
+ /** Input heights of a pitched roof. The ridge keeps the lidar height, the eave is derived so the slope stays within limits. */
21
+ export interface PitchSpec {
22
+ ridgeY: number;
23
+ /** Eave according to lidar. Used when it yields an allowed slope. */
24
+ eaveWanted: number;
25
+ /** The eave must not drop lower (smallest wall height). */
26
+ minEaveY: number;
27
+ /** Smallest and largest allowed slope (tangent). */
28
+ minSlope: number;
29
+ maxSlope: number;
30
+ }
31
+ /** Level 3: flat roof at height y. Also used when the triangulation fails the check. */
32
+ export declare function flatRoof(rings: Ring[], y: number): RoofGeometry;
33
+ /**
34
+ * Height profile of a roof: breakpoints `[k, h]`, both 0..1, `k` strictly rising from `[0, 0]` to `[1, 1]` and `h`
35
+ * never falling. `k` is 0 at the eave and 1 at the top; the height between breakpoints is linear.
36
+ */
37
+ export type RoofProfile = readonly (readonly [number, number])[];
38
+ /** Ready-made profiles: straight faces, a quarter circle (dome) and a two-slope face (steep below, flat above). */
39
+ export declare const ROOF_PROFILE: {
40
+ readonly straight: RoofProfile;
41
+ readonly dome: RoofProfile;
42
+ readonly mansard: RoofProfile;
43
+ };
44
+ export interface ApexRoofOptions {
45
+ /** Top point in the footprint. Must lie strictly inside the ring. */
46
+ cx: number;
47
+ cz: number;
48
+ eaveY: number;
49
+ topY: number;
50
+ profile: RoofProfile;
51
+ }
52
+ /**
53
+ * A radial roof that rises from every edge of a convex footprint to one top point: with the straight profile a pyramid
54
+ * (or a tall pointed roof), with a round profile a dome. The level lines are the ring shrunk about the top point.
55
+ * Returns null for more than one ring, a ring that is not convex, a top point not strictly inside, or a top lower
56
+ * than 0.1 above the eave. The eave is taken as given (no slope limits).
57
+ */
58
+ export declare function apexRoof(rings: Ring[], o: ApexRoofOptions): RoofGeometry | null;
59
+ export interface RidgeRoofOptions {
60
+ box: OrientedBox;
61
+ /** The ridge runs along the shorter axis of the rectangle instead of the longer one. */
62
+ ridgeAcross: boolean;
63
+ /** Hip roof: shortened ridge, sloped faces at the ends instead of gables. */
64
+ hipped: boolean;
65
+ pitch: PitchSpec;
66
+ /** Height profile across the faces (eave to ridge). Without it the faces are straight. */
67
+ profile?: RoofProfile;
68
+ }
69
+ /** Level 1: ridge on the axis of a rotated rectangle. Height is a linear function of the distance from the ridge. */
70
+ export declare function ridgeRoof(rings: Ring[], o: RidgeRoofOptions): RoofGeometry | null;
71
+ /**
72
+ * Level 2: a plane rises from every footprint edge and the roof is their intersection. The ridge comes out in the middle of each wing
73
+ * and also follows curved and closed footprints. The eave is at the same height everywhere, so the walls have no gables.
74
+ * The mesh breaks exactly where the nearest edge changes, so hips and ridges are sharp.
75
+ */
76
+ export declare function fieldRoof(rings: Ring[], pitch: PitchSpec, maxTriangles?: number): RoofGeometry | null;