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.
- package/LICENSE +21 -0
- package/README.md +88 -2
- package/dist/base/data.d.ts +67 -0
- package/dist/base/data.js +10 -0
- package/dist/base/destructible.d.ts +167 -0
- package/dist/base/destructible.js +47 -0
- package/dist/base/env-slot.d.ts +101 -0
- package/dist/base/env-slot.js +8 -0
- package/dist/base/frames.d.ts +138 -0
- package/dist/base/frames.js +459 -0
- package/dist/base/index.d.ts +21 -0
- package/dist/base/index.js +11 -0
- package/dist/base/mat34.d.ts +46 -0
- package/dist/base/mat34.js +173 -0
- package/dist/base/material.d.ts +87 -0
- package/dist/base/material.js +6 -0
- package/dist/base/math.d.ts +27 -0
- package/dist/base/math.js +60 -0
- package/dist/base/progress.d.ts +38 -0
- package/dist/base/progress.js +81 -0
- package/dist/base/rig.d.ts +177 -0
- package/dist/base/rig.js +97 -0
- package/dist/base/trig.d.ts +29 -0
- package/dist/base/trig.js +169 -0
- package/dist/base/up.d.ts +26 -0
- package/dist/base/up.js +40 -0
- package/dist/base/view.d.ts +128 -0
- package/dist/base/view.js +136 -0
- package/dist/camera/camera.d.ts +99 -0
- package/dist/camera/camera.js +228 -0
- package/dist/camera/follow.d.ts +120 -0
- package/dist/camera/follow.js +320 -0
- package/dist/camera/free.d.ts +153 -0
- package/dist/camera/free.js +359 -0
- package/dist/camera/index.d.ts +10 -0
- package/dist/camera/index.js +6 -0
- package/dist/camera/orbit.d.ts +93 -0
- package/dist/camera/orbit.js +261 -0
- package/dist/camera/path.d.ts +48 -0
- package/dist/camera/path.js +179 -0
- package/dist/core/ballistic.d.ts +66 -0
- package/dist/core/ballistic.js +104 -0
- package/dist/core/bodies.d.ts +77 -0
- package/dist/core/bodies.js +125 -0
- package/dist/core/clock.d.ts +37 -0
- package/dist/core/clock.js +87 -0
- package/dist/core/cover-fade.d.ts +14 -0
- package/dist/core/cover-fade.js +38 -0
- package/dist/core/index.d.ts +13 -0
- package/dist/core/index.js +8 -0
- package/dist/core/kepler.d.ts +74 -0
- package/dist/core/kepler.js +108 -0
- package/dist/core/level-fade.d.ts +66 -0
- package/dist/core/level-fade.js +123 -0
- package/dist/core/palette.d.ts +15 -0
- package/dist/core/palette.js +47 -0
- package/dist/env/atmosphere.d.ts +129 -0
- package/dist/env/atmosphere.js +707 -0
- package/dist/env/cloud-field.d.ts +44 -0
- package/dist/env/cloud-field.js +111 -0
- package/dist/env/environment.d.ts +217 -0
- package/dist/env/environment.js +441 -0
- package/dist/env/frame-block.d.ts +29 -0
- package/dist/env/frame-block.js +152 -0
- package/dist/env/glsl.d.ts +35 -0
- package/dist/env/glsl.js +246 -0
- package/dist/env/index.d.ts +13 -0
- package/dist/env/index.js +9 -0
- package/dist/env/sky.d.ts +48 -0
- package/dist/env/sky.js +227 -0
- package/dist/env/sun.d.ts +31 -0
- package/dist/env/sun.js +42 -0
- package/dist/gen-arch/build.d.ts +17 -0
- package/dist/gen-arch/build.js +414 -0
- package/dist/gen-arch/damage/damaged.d.ts +44 -0
- package/dist/gen-arch/damage/damaged.js +1119 -0
- package/dist/gen-arch/damage/fall-material.d.ts +10 -0
- package/dist/gen-arch/damage/fall-material.js +47 -0
- package/dist/gen-arch/damage/fall.d.ts +78 -0
- package/dist/gen-arch/damage/fall.js +797 -0
- package/dist/gen-arch/damage/rubble.d.ts +22 -0
- package/dist/gen-arch/damage/rubble.js +188 -0
- package/dist/gen-arch/index.d.ts +25 -0
- package/dist/gen-arch/index.js +16 -0
- package/dist/gen-arch/interior/interior-plan.d.ts +114 -0
- package/dist/gen-arch/interior/interior-plan.js +615 -0
- package/dist/gen-arch/interior/interior.d.ts +97 -0
- package/dist/gen-arch/interior/interior.js +966 -0
- package/dist/gen-arch/structure/building-shader.d.ts +25 -0
- package/dist/gen-arch/structure/building-shader.js +946 -0
- package/dist/gen-arch/structure/buildings.d.ts +248 -0
- package/dist/gen-arch/structure/buildings.js +294 -0
- package/dist/gen-arch/structure/dims.d.ts +77 -0
- package/dist/gen-arch/structure/dims.js +39 -0
- package/dist/gen-arch/structure/distant.d.ts +62 -0
- package/dist/gen-arch/structure/distant.js +316 -0
- package/dist/gen-arch/structure/env-slots.d.ts +18 -0
- package/dist/gen-arch/structure/env-slots.js +47 -0
- package/dist/gen-arch/structure/facade.d.ts +193 -0
- package/dist/gen-arch/structure/facade.js +159 -0
- package/dist/gen-arch/structure/parts.d.ts +31 -0
- package/dist/gen-arch/structure/parts.js +69 -0
- package/dist/gen-arch/structure/roof.d.ts +76 -0
- package/dist/gen-arch/structure/roof.js +568 -0
- package/dist/gen-arch/structure/structure-material.d.ts +23 -0
- package/dist/gen-arch/structure/structure-material.js +55 -0
- package/dist/gen-arch/structure/writer.d.ts +94 -0
- package/dist/gen-arch/structure/writer.js +195 -0
- package/dist/gen-core/cell.d.ts +138 -0
- package/dist/gen-core/cell.js +150 -0
- package/dist/gen-core/cube-sphere.d.ts +57 -0
- package/dist/gen-core/cube-sphere.js +159 -0
- package/dist/gen-core/field.d.ts +55 -0
- package/dist/gen-core/field.js +154 -0
- package/dist/gen-core/geometry.d.ts +31 -0
- package/dist/gen-core/geometry.js +231 -0
- package/dist/gen-core/hash.d.ts +18 -0
- package/dist/gen-core/hash.js +58 -0
- package/dist/gen-core/height-field.d.ts +33 -0
- package/dist/gen-core/height-field.js +137 -0
- package/dist/gen-core/index.d.ts +22 -0
- package/dist/gen-core/index.js +17 -0
- package/dist/gen-core/instance-cells.d.ts +37 -0
- package/dist/gen-core/instance-cells.js +72 -0
- package/dist/gen-core/near-scatter.d.ts +56 -0
- package/dist/gen-core/near-scatter.js +120 -0
- package/dist/gen-core/noise.d.ts +23 -0
- package/dist/gen-core/noise.js +72 -0
- package/dist/gen-core/occupancy.d.ts +21 -0
- package/dist/gen-core/occupancy.js +104 -0
- package/dist/gen-core/sphere-patch.d.ts +138 -0
- package/dist/gen-core/sphere-patch.js +544 -0
- package/dist/gen-core/strip-surface.d.ts +34 -0
- package/dist/gen-core/strip-surface.js +246 -0
- package/dist/gen-core/strip.d.ts +102 -0
- package/dist/gen-core/strip.js +817 -0
- package/dist/gen-ground/env-slots.d.ts +48 -0
- package/dist/gen-ground/env-slots.js +78 -0
- package/dist/gen-ground/ground.d.ts +78 -0
- package/dist/gen-ground/ground.js +208 -0
- package/dist/gen-ground/index.d.ts +9 -0
- package/dist/gen-ground/index.js +7 -0
- package/dist/gen-ground/markings.d.ts +46 -0
- package/dist/gen-ground/markings.js +124 -0
- package/dist/gen-ground/materials.d.ts +18 -0
- package/dist/gen-ground/materials.js +22 -0
- package/dist/gen-ground/terrain-shader.d.ts +5 -0
- package/dist/gen-ground/terrain-shader.js +151 -0
- package/dist/gen-mesh/bare-shapes.d.ts +194 -0
- package/dist/gen-mesh/bare-shapes.js +596 -0
- package/dist/gen-mesh/bisect-surface.d.ts +47 -0
- package/dist/gen-mesh/bisect-surface.js +261 -0
- package/dist/gen-mesh/box.d.ts +18 -0
- package/dist/gen-mesh/box.js +2 -0
- package/dist/gen-mesh/cell-morph-mesh.d.ts +52 -0
- package/dist/gen-mesh/cell-morph-mesh.js +258 -0
- package/dist/gen-mesh/cell-surface-mesh.d.ts +32 -0
- package/dist/gen-mesh/cell-surface-mesh.js +140 -0
- package/dist/gen-mesh/chunk-mesh.d.ts +25 -0
- package/dist/gen-mesh/chunk-mesh.js +112 -0
- package/dist/gen-mesh/drape-mesh.d.ts +36 -0
- package/dist/gen-mesh/drape-mesh.js +98 -0
- package/dist/gen-mesh/height-field-mesh.d.ts +14 -0
- package/dist/gen-mesh/height-field-mesh.js +98 -0
- package/dist/gen-mesh/index.d.ts +26 -0
- package/dist/gen-mesh/index.js +15 -0
- package/dist/gen-mesh/line-mesh.d.ts +25 -0
- package/dist/gen-mesh/line-mesh.js +62 -0
- package/dist/gen-mesh/mesh-builder.d.ts +115 -0
- package/dist/gen-mesh/mesh-builder.js +315 -0
- package/dist/gen-mesh/packed-mesh.d.ts +53 -0
- package/dist/gen-mesh/packed-mesh.js +205 -0
- package/dist/gen-mesh/prism-mesh.d.ts +33 -0
- package/dist/gen-mesh/prism-mesh.js +176 -0
- package/dist/gen-mesh/rig-mesh.d.ts +9 -0
- package/dist/gen-mesh/rig-mesh.js +135 -0
- package/dist/gen-mesh/strip-mesh.d.ts +45 -0
- package/dist/gen-mesh/strip-mesh.js +258 -0
- package/dist/gen-plan/drain.d.ts +58 -0
- package/dist/gen-plan/drain.js +270 -0
- package/dist/gen-plan/grid.d.ts +37 -0
- package/dist/gen-plan/grid.js +182 -0
- package/dist/gen-plan/horizon.d.ts +50 -0
- package/dist/gen-plan/horizon.js +185 -0
- package/dist/gen-plan/index.d.ts +15 -0
- package/dist/gen-plan/index.js +13 -0
- package/dist/gen-plan/line-tiles.d.ts +35 -0
- package/dist/gen-plan/line-tiles.js +190 -0
- package/dist/gen-plan/lines.d.ts +31 -0
- package/dist/gen-plan/lines.js +183 -0
- package/dist/gen-plan/plots.d.ts +40 -0
- package/dist/gen-plan/plots.js +282 -0
- package/dist/gen-plan/route.d.ts +55 -0
- package/dist/gen-plan/route.js +297 -0
- package/dist/gen-plan/sites.d.ts +32 -0
- package/dist/gen-plan/sites.js +209 -0
- package/dist/gen-tex/code-stamp.d.ts +31 -0
- package/dist/gen-tex/code-stamp.js +137 -0
- package/dist/gen-tex/index.d.ts +7 -0
- package/dist/gen-tex/index.js +5 -0
- package/dist/gen-tex/light-horizon.d.ts +47 -0
- package/dist/gen-tex/light-horizon.js +180 -0
- package/dist/gen-tex/textures.d.ts +8 -0
- package/dist/gen-tex/textures.js +49 -0
- package/dist/gen-tex/value-textures.d.ts +46 -0
- package/dist/gen-tex/value-textures.js +102 -0
- package/dist/gen-vegetation/env-slots.d.ts +20 -0
- package/dist/gen-vegetation/env-slots.js +29 -0
- package/dist/gen-vegetation/index.d.ts +8 -0
- package/dist/gen-vegetation/index.js +7 -0
- package/dist/gen-vegetation/materials.d.ts +7 -0
- package/dist/gen-vegetation/materials.js +17 -0
- package/dist/gen-vegetation/planting.d.ts +170 -0
- package/dist/gen-vegetation/planting.js +363 -0
- package/dist/gen-vegetation/tree-shader.d.ts +23 -0
- package/dist/gen-vegetation/tree-shader.js +229 -0
- package/dist/gen-vegetation/trees.d.ts +59 -0
- package/dist/gen-vegetation/trees.js +329 -0
- package/dist/gpu/device.d.ts +286 -0
- package/dist/gpu/device.js +1157 -0
- package/dist/gpu/gl.d.ts +134 -0
- package/dist/gpu/gl.js +276 -0
- package/dist/gpu/index.d.ts +4 -0
- package/dist/gpu/index.js +3 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +13 -0
- package/dist/motion/graph.d.ts +244 -0
- package/dist/motion/graph.js +739 -0
- package/dist/motion/index.d.ts +8 -0
- package/dist/motion/index.js +8 -0
- package/dist/motion/pose-ops.d.ts +30 -0
- package/dist/motion/pose-ops.js +232 -0
- package/dist/motion/reach.d.ts +45 -0
- package/dist/motion/reach.js +264 -0
- package/dist/motion/skeleton.d.ts +49 -0
- package/dist/motion/skeleton.js +99 -0
- package/dist/platform/byte-store.d.ts +21 -0
- package/dist/platform/byte-store.js +137 -0
- package/dist/platform/canvas.d.ts +29 -0
- package/dist/platform/canvas.js +76 -0
- package/dist/platform/context-loss.d.ts +8 -0
- package/dist/platform/context-loss.js +17 -0
- package/dist/platform/free-input.d.ts +51 -0
- package/dist/platform/free-input.js +100 -0
- package/dist/platform/index.d.ts +18 -0
- package/dist/platform/index.js +10 -0
- package/dist/platform/input.d.ts +48 -0
- package/dist/platform/input.js +117 -0
- package/dist/platform/keys.d.ts +12 -0
- package/dist/platform/keys.js +29 -0
- package/dist/platform/loop.d.ts +41 -0
- package/dist/platform/loop.js +84 -0
- package/dist/platform/walk-input.d.ts +74 -0
- package/dist/platform/walk-input.js +226 -0
- package/dist/platform/worker.d.ts +51 -0
- package/dist/platform/worker.js +170 -0
- package/dist/render/bone-instances.d.ts +24 -0
- package/dist/render/bone-instances.js +74 -0
- package/dist/render/cells.d.ts +70 -0
- package/dist/render/cells.js +144 -0
- package/dist/render/glsl.d.ts +66 -0
- package/dist/render/glsl.js +173 -0
- package/dist/render/index.d.ts +26 -0
- package/dist/render/index.js +16 -0
- package/dist/render/instance-sets.d.ts +97 -0
- package/dist/render/instance-sets.js +241 -0
- package/dist/render/near-instances.d.ts +75 -0
- package/dist/render/near-instances.js +219 -0
- package/dist/render/particles.d.ts +63 -0
- package/dist/render/particles.js +215 -0
- package/dist/render/pieces.d.ts +57 -0
- package/dist/render/pieces.js +151 -0
- package/dist/render/point-lights.d.ts +97 -0
- package/dist/render/point-lights.js +243 -0
- package/dist/render/renderer.d.ts +447 -0
- package/dist/render/renderer.js +1100 -0
- package/dist/render/rig.d.ts +74 -0
- package/dist/render/rig.js +576 -0
- package/dist/render/shadow-areas.d.ts +49 -0
- package/dist/render/shadow-areas.js +125 -0
- package/dist/render/shadow-glsl.d.ts +12 -0
- package/dist/render/shadow-glsl.js +146 -0
- package/dist/render/transient.d.ts +61 -0
- package/dist/render/transient.js +213 -0
- package/dist/render/value-glsl.d.ts +17 -0
- package/dist/render/value-glsl.js +208 -0
- package/dist/render/value-layers.d.ts +180 -0
- package/dist/render/value-layers.js +333 -0
- package/dist/runtime/atmosphere.d.ts +37 -0
- package/dist/runtime/atmosphere.js +304 -0
- package/dist/runtime/cloud-shell.d.ts +29 -0
- package/dist/runtime/cloud-shell.js +158 -0
- package/dist/runtime/engine.d.ts +155 -0
- package/dist/runtime/engine.js +305 -0
- package/dist/runtime/environment-link.d.ts +22 -0
- package/dist/runtime/environment-link.js +49 -0
- package/dist/runtime/index.d.ts +13 -0
- package/dist/runtime/index.js +12 -0
- package/dist/runtime/precipitation-glsl.d.ts +2 -0
- package/dist/runtime/precipitation-glsl.js +70 -0
- package/dist/runtime/precipitation.d.ts +11 -0
- package/dist/runtime/precipitation.js +78 -0
- package/dist/runtime/sky.d.ts +30 -0
- package/dist/runtime/sky.js +114 -0
- package/dist/runtime/streaming.d.ts +245 -0
- package/dist/runtime/streaming.js +602 -0
- package/dist/sim/agenda.d.ts +167 -0
- package/dist/sim/agenda.js +425 -0
- package/dist/sim/bytes.d.ts +34 -0
- package/dist/sim/bytes.js +125 -0
- package/dist/sim/destruction/apply.d.ts +59 -0
- package/dist/sim/destruction/apply.js +243 -0
- package/dist/sim/destruction/cell-states.d.ts +54 -0
- package/dist/sim/destruction/cell-states.js +198 -0
- package/dist/sim/destruction/index.d.ts +11 -0
- package/dist/sim/destruction/index.js +10 -0
- package/dist/sim/destruction/int-geometry.d.ts +17 -0
- package/dist/sim/destruction/int-geometry.js +131 -0
- package/dist/sim/destruction/pick.d.ts +13 -0
- package/dist/sim/destruction/pick.js +59 -0
- package/dist/sim/destruction/rubble.d.ts +8 -0
- package/dist/sim/destruction/rubble.js +159 -0
- package/dist/sim/destruction/state.d.ts +15 -0
- package/dist/sim/destruction/state.js +83 -0
- package/dist/sim/destruction/structure.d.ts +30 -0
- package/dist/sim/destruction/structure.js +139 -0
- package/dist/sim/events.d.ts +37 -0
- package/dist/sim/events.js +106 -0
- package/dist/sim/fixed.d.ts +21 -0
- package/dist/sim/fixed.js +64 -0
- package/dist/sim/flow-probe.d.ts +58 -0
- package/dist/sim/flow-probe.js +158 -0
- package/dist/sim/flow.d.ts +257 -0
- package/dist/sim/flow.js +967 -0
- package/dist/sim/index.d.ts +28 -0
- package/dist/sim/index.js +20 -0
- package/dist/sim/interlock.d.ts +47 -0
- package/dist/sim/interlock.js +252 -0
- package/dist/sim/movers.d.ts +228 -0
- package/dist/sim/movers.js +1083 -0
- package/dist/sim/nav.d.ts +72 -0
- package/dist/sim/nav.js +292 -0
- package/dist/sim/paths.d.ts +80 -0
- package/dist/sim/paths.js +197 -0
- package/dist/sim/regions.d.ts +87 -0
- package/dist/sim/regions.js +517 -0
- package/dist/sim/simulation.d.ts +114 -0
- package/dist/sim/simulation.js +291 -0
- package/dist/sim/states.d.ts +23 -0
- package/dist/sim/states.js +54 -0
- package/dist/sim/table.d.ts +49 -0
- package/dist/sim/table.js +126 -0
- package/dist/sim/zones.d.ts +11 -0
- package/dist/sim/zones.js +196 -0
- package/dist/tools/collision-lines.d.ts +12 -0
- package/dist/tools/collision-lines.js +50 -0
- package/dist/tools/data-view-glsl.d.ts +3 -0
- package/dist/tools/data-view-glsl.js +63 -0
- package/dist/tools/data-view-layers.d.ts +20 -0
- package/dist/tools/data-view-layers.js +60 -0
- package/dist/tools/debug-view.d.ts +30 -0
- package/dist/tools/debug-view.js +4 -0
- package/dist/tools/index.d.ts +10 -0
- package/dist/tools/index.js +7 -0
- package/dist/tools/mesh-checks.d.ts +67 -0
- package/dist/tools/mesh-checks.js +188 -0
- package/dist/tools/profile.d.ts +85 -0
- package/dist/tools/profile.js +173 -0
- package/dist/world/cell-cache.d.ts +32 -0
- package/dist/world/cell-cache.js +60 -0
- package/dist/world/cell-format.d.ts +25 -0
- package/dist/world/cell-format.js +232 -0
- package/dist/world/collide.d.ts +192 -0
- package/dist/world/collide.js +822 -0
- package/dist/world/index.d.ts +16 -0
- package/dist/world/index.js +12 -0
- package/dist/world/mesh-solids.d.ts +48 -0
- package/dist/world/mesh-solids.js +169 -0
- package/dist/world/pick.d.ts +34 -0
- package/dist/world/pick.js +177 -0
- package/dist/world/providers.d.ts +66 -0
- package/dist/world/providers.js +83 -0
- package/dist/world/sphere.d.ts +69 -0
- package/dist/world/sphere.js +271 -0
- package/dist/world/streaming.d.ts +288 -0
- package/dist/world/streaming.js +801 -0
- package/dist/world/walker.d.ts +145 -0
- package/dist/world/walker.js +502 -0
- package/docs/architecture.md +111 -0
- package/docs/cameras.md +302 -0
- package/docs/concepts.md +123 -0
- package/docs/destruction.md +127 -0
- package/docs/frames.md +199 -0
- package/docs/generators.md +575 -0
- package/docs/getting-started.md +123 -0
- package/docs/headless.md +50 -0
- package/docs/motion.md +160 -0
- package/docs/planet.md +152 -0
- package/docs/recipes.md +521 -0
- package/docs/reference.md +364 -0
- package/docs/rendering.md +823 -0
- package/docs/rigs.md +203 -0
- package/docs/simulation.md +235 -0
- package/docs/streaming.md +590 -0
- package/docs/system.md +166 -0
- package/docs/tools.md +175 -0
- package/docs/walking.md +262 -0
- package/package.json +131 -3
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { MeshData, RubbleFootprint } from '../../base/index.ts';
|
|
2
|
+
import type { BuildingSpec } from '../structure/buildings.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Mesh of rubble footprints. `colours` gives the palette rows of each footprint's structure (wall, roof, trim);
|
|
5
|
+
* `groundAt` the ground height under a point (the mound sits on it, a little sunk). `arrival` makes a footprint grow
|
|
6
|
+
* in from its base over a span of clock time (rubble of parts still falling), so it takes over from the falling
|
|
7
|
+
* pieces without a jump.
|
|
8
|
+
*/
|
|
9
|
+
export declare function buildRubbleMesh(footprints: readonly RubbleFootprint[], colours: (structure: number) => {
|
|
10
|
+
wall: number;
|
|
11
|
+
roof: number;
|
|
12
|
+
trim: number;
|
|
13
|
+
} | undefined, groundAt: (x: number, z: number) => number, arrival?: (fp: RubbleFootprint) => {
|
|
14
|
+
start: number;
|
|
15
|
+
seconds: number;
|
|
16
|
+
} | undefined): MeshData;
|
|
17
|
+
/** Palette rows of structures by id, for `buildRubbleMesh`. */
|
|
18
|
+
export declare function rubbleColours(specs: readonly BuildingSpec[]): (structure: number) => {
|
|
19
|
+
wall: number;
|
|
20
|
+
roof: number;
|
|
21
|
+
trim: number;
|
|
22
|
+
} | undefined;
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
// Rubble of destroyed parts as structure mesh (same layout and material as the structures). A pure seeded generator:
|
|
2
|
+
// footprint in (archetype, oriented rectangle, height, seed, material slot), mesh out. The footprint is decided by the
|
|
3
|
+
// destruction model at the moment of the event; this only draws it.
|
|
4
|
+
//
|
|
5
|
+
// Archetypes: heap (a mound of broken masonry with blocks on it), slabs (tilted sections lying on a low mound),
|
|
6
|
+
// scatter (loose pieces, no mound), ruin (one large mound over a whole structure).
|
|
7
|
+
import { hashInts, unit } from '../../gen-core/index.js';
|
|
8
|
+
import { RUBBLE } from '../../base/index.js';
|
|
9
|
+
import { STRUCTURE_MATERIAL } from './damaged.js';
|
|
10
|
+
import { BUILDING_LAYOUT, DAMAGE_STEP, KIND, VertexWriter, pushBox } from '../structure/writer.js';
|
|
11
|
+
/** Share of the mound height left as a flat top, and how many blocks each archetype carries. */
|
|
12
|
+
const TOP_INSET = 0.45;
|
|
13
|
+
/** Damage level of rubble in the vertex damage channel (dusty broken material). */
|
|
14
|
+
const RUBBLE_DAMAGE = 4;
|
|
15
|
+
/** The roof covering of a fallen roof section lies this far above its core. */
|
|
16
|
+
const COVER_LIFT_M = 0.02;
|
|
17
|
+
const CHUNKS = {
|
|
18
|
+
[RUBBLE.heap]: [6, 11],
|
|
19
|
+
[RUBBLE.slabs]: [3, 6],
|
|
20
|
+
[RUBBLE.scatter]: [5, 9],
|
|
21
|
+
[RUBBLE.ruin]: [18, 30],
|
|
22
|
+
};
|
|
23
|
+
/** Writes a truncated four-sided mound over the oriented rectangle. */
|
|
24
|
+
function mound(w, fp, base, height, mat) {
|
|
25
|
+
const cx = fp.cx / 100;
|
|
26
|
+
const cz = fp.cz / 100;
|
|
27
|
+
const ux = fp.ux / 1024;
|
|
28
|
+
const uz = fp.uz / 1024;
|
|
29
|
+
const hl = fp.halfL / 100;
|
|
30
|
+
const hw = fp.halfW / 100;
|
|
31
|
+
const ring = (k) => [
|
|
32
|
+
[-1, -1],
|
|
33
|
+
[1, -1],
|
|
34
|
+
[1, 1],
|
|
35
|
+
[-1, 1],
|
|
36
|
+
].map(([su, sv]) => [cx + ux * hl * su * k - uz * hw * sv * k, 0, cz + uz * hl * su * k + ux * hw * sv * k]);
|
|
37
|
+
const lo = ring(1).map((v) => [v[0], base, v[2]]);
|
|
38
|
+
const hi = ring(TOP_INSET).map((v) => [v[0], base + height, v[2]]);
|
|
39
|
+
const kind = KIND.trim + DAMAGE_STEP * RUBBLE_DAMAGE;
|
|
40
|
+
const put = (v, n) => w.push(v[0], v[1], v[2], n[0], n[1], n[2], kind, 0, 0, v[1] - base, 100, mat, 1, 3);
|
|
41
|
+
const face = (a, b, c) => {
|
|
42
|
+
const ex = b[0] - a[0];
|
|
43
|
+
const ey = b[1] - a[1];
|
|
44
|
+
const ez = b[2] - a[2];
|
|
45
|
+
const fx = c[0] - a[0];
|
|
46
|
+
const fy = c[1] - a[1];
|
|
47
|
+
const fz = c[2] - a[2];
|
|
48
|
+
let nx = ey * fz - ez * fy;
|
|
49
|
+
let ny = ez * fx - ex * fz;
|
|
50
|
+
let nz = ex * fy - ey * fx;
|
|
51
|
+
// Mound faces point up and out.
|
|
52
|
+
if (ny < 0) {
|
|
53
|
+
nx = -nx;
|
|
54
|
+
ny = -ny;
|
|
55
|
+
nz = -nz;
|
|
56
|
+
[b, c] = [c, b];
|
|
57
|
+
}
|
|
58
|
+
const l = Math.hypot(nx, ny, nz) || 1;
|
|
59
|
+
const n = [nx / l, ny / l, nz / l];
|
|
60
|
+
put(a, n);
|
|
61
|
+
put(b, n);
|
|
62
|
+
put(c, n);
|
|
63
|
+
};
|
|
64
|
+
for (let i = 0; i < 4; i++) {
|
|
65
|
+
const j = (i + 1) % 4;
|
|
66
|
+
face(lo[i], lo[j], hi[j]);
|
|
67
|
+
face(lo[i], hi[j], hi[i]);
|
|
68
|
+
}
|
|
69
|
+
face(hi[0], hi[1], hi[2]);
|
|
70
|
+
face(hi[0], hi[2], hi[3]);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* A section of roof lying in the rubble: a slab of broken core (`pushBox`, damage 3) with the roof covering on top
|
|
74
|
+
* (KIND.roofPitched, courses along its tilt), so fallen roof reads as roof and not as a dark lump.
|
|
75
|
+
*/
|
|
76
|
+
function roofSection(w, p) {
|
|
77
|
+
pushBox(w, p, 3);
|
|
78
|
+
const mat = { seed: unit(p.hash), bayWidth: 1, wallColor: p.color, roofColor: p.color, windowStyle: 0, trimColor: p.color };
|
|
79
|
+
const vx = -p.uz;
|
|
80
|
+
const vz = p.ux;
|
|
81
|
+
const lift = p.height + COVER_LIFT_M;
|
|
82
|
+
const nl = Math.hypot(p.slope, 1);
|
|
83
|
+
const nx = (-p.slope * p.ux) / nl;
|
|
84
|
+
const nz = (-p.slope * p.uz) / nl;
|
|
85
|
+
const ny = 1 / nl;
|
|
86
|
+
// Height of the covering above its low edge, scaled so the shader's course spacing holds on a shallow tilt
|
|
87
|
+
// (roofColor divides by the sine of the slope, at least 0.2).
|
|
88
|
+
const sine = Math.max(Math.sqrt(Math.max(0, 1 - ny * ny)), 0.2);
|
|
89
|
+
const low = p.slope >= 0 ? -1 : 1;
|
|
90
|
+
const c = (su, sv) => {
|
|
91
|
+
const along = Math.abs(su - low) * p.halfL * nl;
|
|
92
|
+
w.push(p.cx + p.ux * p.halfL * su + vx * p.halfW * sv, p.baseY + p.slope * p.halfL * su + lift, p.cz + p.uz * p.halfL * su + vz * p.halfW * sv, nx, ny, nz, KIND.roofPitched, 0, 0, along * sine, 0, mat, 1, 3);
|
|
93
|
+
};
|
|
94
|
+
c(-1, -1);
|
|
95
|
+
c(-1, 1);
|
|
96
|
+
c(1, -1);
|
|
97
|
+
c(1, -1);
|
|
98
|
+
c(-1, 1);
|
|
99
|
+
c(1, 1);
|
|
100
|
+
}
|
|
101
|
+
/** Height of the mound at a point given in the footprint's own axes, normalised to −1…1. */
|
|
102
|
+
function moundAt(s, t, height) {
|
|
103
|
+
const q = Math.max(Math.abs(s), Math.abs(t));
|
|
104
|
+
return q <= TOP_INSET ? height : Math.max(0, (height * (1 - q)) / (1 - TOP_INSET));
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Mesh of rubble footprints. `colours` gives the palette rows of each footprint's structure (wall, roof, trim);
|
|
108
|
+
* `groundAt` the ground height under a point (the mound sits on it, a little sunk). `arrival` makes a footprint grow
|
|
109
|
+
* in from its base over a span of clock time (rubble of parts still falling), so it takes over from the falling
|
|
110
|
+
* pieces without a jump.
|
|
111
|
+
*/
|
|
112
|
+
export function buildRubbleMesh(footprints, colours, groundAt, arrival) {
|
|
113
|
+
const w = new VertexWriter();
|
|
114
|
+
for (const fp of footprints) {
|
|
115
|
+
const first = w.count;
|
|
116
|
+
const c = colours(fp.structure) ?? { wall: 0, roof: 0, trim: 0 };
|
|
117
|
+
// A fallen roof: masonry dust under roof sections. A fallen floor: the same mound under concrete sections.
|
|
118
|
+
const roofSlab = fp.archetype === RUBBLE.slabs && fp.material === STRUCTURE_MATERIAL.slab;
|
|
119
|
+
const main = fp.archetype === RUBBLE.slabs ? c.wall : fp.material === STRUCTURE_MATERIAL.masonry ? c.wall : c.trim;
|
|
120
|
+
const r = (k) => unit(hashInts(fp.seed, k));
|
|
121
|
+
const cx = fp.cx / 100;
|
|
122
|
+
const cz = fp.cz / 100;
|
|
123
|
+
const ux = fp.ux / 1024;
|
|
124
|
+
const uz = fp.uz / 1024;
|
|
125
|
+
const hl = fp.halfL / 100;
|
|
126
|
+
const hw = fp.halfW / 100;
|
|
127
|
+
const h = fp.height / 100;
|
|
128
|
+
const base = Math.min(fp.y / 100, groundAt(cx, cz)) - 0.08;
|
|
129
|
+
const mat = { seed: r(1), bayWidth: 1, wallColor: main, roofColor: main, windowStyle: 0, trimColor: main };
|
|
130
|
+
const moundH = fp.archetype === RUBBLE.scatter ? 0 : fp.archetype === RUBBLE.slabs ? h * 0.45 : h * 0.8;
|
|
131
|
+
if (moundH > 0.05)
|
|
132
|
+
mound(w, fp, base, moundH, mat);
|
|
133
|
+
// Slabs: tilted sections lying on the mound, roof sections (three to five) or floor sections (two to four).
|
|
134
|
+
if (fp.archetype === RUBBLE.slabs || fp.archetype === RUBBLE.ruin) {
|
|
135
|
+
const n = (roofSlab ? 3 : 2) + Math.floor(r(2) * 3);
|
|
136
|
+
for (let k = 0; k < n; k++) {
|
|
137
|
+
const s = (r(10 + k) * 2 - 1) * 0.45;
|
|
138
|
+
const t = (r(20 + k) * 2 - 1) * 0.45;
|
|
139
|
+
const yaw = (r(30 + k) - 0.5) * 0.9;
|
|
140
|
+
const cs = 1 - (yaw * yaw) / 2;
|
|
141
|
+
const sn = yaw - (yaw * yaw * yaw) / 6;
|
|
142
|
+
const bx = ux * cs - uz * sn;
|
|
143
|
+
const bz = uz * cs + ux * sn;
|
|
144
|
+
const box = {
|
|
145
|
+
cx: cx + ux * s * hl - uz * t * hw,
|
|
146
|
+
cz: cz + uz * s * hl + ux * t * hw,
|
|
147
|
+
baseY: base + moundH * 0.6,
|
|
148
|
+
ux: bx,
|
|
149
|
+
uz: bz,
|
|
150
|
+
halfL: Math.max(0.4, hl * (0.35 + 0.25 * r(40 + k))),
|
|
151
|
+
halfW: Math.max(0.3, hw * (0.3 + 0.2 * r(50 + k))),
|
|
152
|
+
height: 0.18,
|
|
153
|
+
slope: (r(60 + k) - 0.5) * 0.7,
|
|
154
|
+
color: roofSlab || fp.archetype === RUBBLE.ruin ? c.roof : c.trim,
|
|
155
|
+
hash: hashInts(fp.seed, 70 + k),
|
|
156
|
+
};
|
|
157
|
+
if (roofSlab || fp.archetype === RUBBLE.ruin)
|
|
158
|
+
roofSection(w, box);
|
|
159
|
+
else
|
|
160
|
+
pushBox(w, box, 1);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
// Blocks scattered over the mound (or the ground), some in the trim colour.
|
|
164
|
+
const [lo, hi] = CHUNKS[fp.archetype] ?? [4, 8];
|
|
165
|
+
const n = lo + Math.floor(r(3) * (hi - lo + 1));
|
|
166
|
+
for (let k = 0; k < n; k++) {
|
|
167
|
+
const s = (r(100 + k) * 2 - 1) * (fp.archetype === RUBBLE.scatter ? 1 : 0.85);
|
|
168
|
+
const t = (r(200 + k) * 2 - 1) * (fp.archetype === RUBBLE.scatter ? 1 : 0.85);
|
|
169
|
+
const size = (fp.archetype === RUBBLE.ruin ? 0.35 : 0.2) + r(300 + k) * (fp.archetype === RUBBLE.ruin ? 0.8 : 0.45);
|
|
170
|
+
const a = r(400 + k) * 2 - 1;
|
|
171
|
+
const b = Math.sqrt(Math.max(0, 1 - a * a)) * (r(500 + k) < 0.5 ? -1 : 1);
|
|
172
|
+
const x = cx + ux * s * hl - uz * t * hw;
|
|
173
|
+
const z = cz + uz * s * hl + ux * t * hw;
|
|
174
|
+
const y = base + moundAt(s, t, moundH) - size * 0.35;
|
|
175
|
+
const colour = r(600 + k) < 0.2 ? c.trim : r(600 + k) < 0.35 && fp.archetype === RUBBLE.ruin ? c.roof : main;
|
|
176
|
+
pushBox(w, { cx: x, cz: z, baseY: y, ux: a, uz: b, halfL: size * (0.5 + 0.4 * r(700 + k)), halfW: size * (0.35 + 0.3 * r(800 + k)), height: size * (0.4 + 0.5 * r(900 + k)), slope: (r(1000 + k) - 0.5) * 0.8, color: colour, hash: hashInts(fp.seed, 1100 + k) }, RUBBLE_DAMAGE);
|
|
177
|
+
}
|
|
178
|
+
const arrive = arrival?.(fp);
|
|
179
|
+
if (arrive)
|
|
180
|
+
w.growIn(first, w.count, arrive.start, arrive.seconds, base - 0.05);
|
|
181
|
+
}
|
|
182
|
+
return { layout: BUILDING_LAYOUT, vertices: w.bytes(), indices: null, count: w.count };
|
|
183
|
+
}
|
|
184
|
+
/** Palette rows of structures by id, for `buildRubbleMesh`. */
|
|
185
|
+
export function rubbleColours(specs) {
|
|
186
|
+
const m = new Map(specs.map((b) => [b.id, { wall: b.wallColor, roof: b.roofColor, trim: b.trimColor }]));
|
|
187
|
+
return (id) => m.get(id);
|
|
188
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export { BUILDING_ATTRIBS, BUILDING_LAYOUT, ROOF_COVER, WALL_FINISH, WINDOW_STYLE } from './structure/buildings.ts';
|
|
2
|
+
export { buildBuildingMesh } from './build.ts';
|
|
3
|
+
export type { BuildingMeshStats, BuildingSpec, PropBox, RoofKind } from './structure/buildings.ts';
|
|
4
|
+
export { ROOF_PROFILE } from './structure/roof.ts';
|
|
5
|
+
export type { RoofProfile } from './structure/roof.ts';
|
|
6
|
+
export { DOOR_KIND, FACADE_DIM, GROUND_FLOOR } from './structure/facade.ts';
|
|
7
|
+
export type { BalconyRecipe, CorniceRecipe, DoorKind, EntranceSpec, FacadeRecipe, GroundFloorKind, RoofBoxSpec, WindowRecipe } from './structure/facade.ts';
|
|
8
|
+
export { BUILDING_VS, buildingFs, buildingVs } from './structure/building-shader.ts';
|
|
9
|
+
export type { StructureShaderOptions } from './structure/building-shader.ts';
|
|
10
|
+
export { structureMaterial, structureUniforms } from './structure/structure-material.ts';
|
|
11
|
+
export { fallingMaterial } from './damage/fall-material.ts';
|
|
12
|
+
export type { StructureRows } from './structure/structure-material.ts';
|
|
13
|
+
export type { ArchDims, ArchMeshDims, ArchShadeDims } from './structure/dims.ts';
|
|
14
|
+
export { DEFAULT_WINDOWS, windowLightSlot, windowShare } from './structure/env-slots.ts';
|
|
15
|
+
export type { WindowLight, WindowLightState } from './structure/env-slots.ts';
|
|
16
|
+
export type { StructureOptions } from './structure/buildings.ts';
|
|
17
|
+
export { DESTRUCT_DIM, PART_RULE, STRUCTURE_MATERIAL, STRUCTURE_MATERIALS, bayKey, canopyKey, chimneyKey, describeKey, foundationKey, partitionKey, roofKey, roofTopKey, slabKey, stairKey } from './damage/damaged.ts';
|
|
18
|
+
export { INTERIOR_DIM } from './structure/dims.ts';
|
|
19
|
+
export { ROOM_TYPE, cellAt, roomAt } from './interior/interior-plan.ts';
|
|
20
|
+
export type { InteriorCell, InteriorPartition, InteriorPlan, InteriorRoom, PartitionSeg, StairCore } from './interior/interior-plan.ts';
|
|
21
|
+
export { buildRubbleMesh, rubbleColours } from './damage/rubble.ts';
|
|
22
|
+
export { FALL_ATTRIBS, FALL_LAYOUT, fallPieces, retimeFall } from './damage/fall.ts';
|
|
23
|
+
export type { FallChange, FallEvent, FallInput, FallOutput } from './damage/fall.ts';
|
|
24
|
+
export { MASSING_ATTRIBS, MASSING_LAYOUT, buildMassingMesh, massingMaterial, roofTones, stampFootprints } from './structure/distant.ts';
|
|
25
|
+
export type { MassingMesh, MassingOptions } from './structure/distant.ts';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// wallhammer-web/gen-arch: structures from recipes. Walls, roofs and façades as one mesh (plain data), and the material
|
|
2
|
+
// that draws them.
|
|
3
|
+
export { BUILDING_ATTRIBS, BUILDING_LAYOUT, ROOF_COVER, WALL_FINISH, WINDOW_STYLE } from './structure/buildings.js';
|
|
4
|
+
export { buildBuildingMesh } from './build.js';
|
|
5
|
+
export { ROOF_PROFILE } from './structure/roof.js';
|
|
6
|
+
export { DOOR_KIND, FACADE_DIM, GROUND_FLOOR } from './structure/facade.js';
|
|
7
|
+
export { BUILDING_VS, buildingFs, buildingVs } from './structure/building-shader.js';
|
|
8
|
+
export { structureMaterial, structureUniforms } from './structure/structure-material.js';
|
|
9
|
+
export { fallingMaterial } from './damage/fall-material.js';
|
|
10
|
+
export { DEFAULT_WINDOWS, windowLightSlot, windowShare } from './structure/env-slots.js';
|
|
11
|
+
export { DESTRUCT_DIM, PART_RULE, STRUCTURE_MATERIAL, STRUCTURE_MATERIALS, bayKey, canopyKey, chimneyKey, describeKey, foundationKey, partitionKey, roofKey, roofTopKey, slabKey, stairKey } from './damage/damaged.js';
|
|
12
|
+
export { INTERIOR_DIM } from './structure/dims.js';
|
|
13
|
+
export { ROOM_TYPE, cellAt, roomAt } from './interior/interior-plan.js';
|
|
14
|
+
export { buildRubbleMesh, rubbleColours } from './damage/rubble.js';
|
|
15
|
+
export { FALL_ATTRIBS, FALL_LAYOUT, fallPieces, retimeFall } from './damage/fall.js';
|
|
16
|
+
export { MASSING_ATTRIBS, MASSING_LAYOUT, buildMassingMesh, massingMaterial, roofTones, stampFootprints } from './structure/distant.js';
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import type { Ring } from '../../gen-core/index.ts';
|
|
2
|
+
import type { StructurePlan } from '../structure/buildings.ts';
|
|
3
|
+
/** What a room is. Codes are what the shader reads. */
|
|
4
|
+
export declare const ROOM_TYPE: {
|
|
5
|
+
readonly room: 0;
|
|
6
|
+
readonly corridor: 1;
|
|
7
|
+
readonly core: 2;
|
|
8
|
+
readonly attic: 3;
|
|
9
|
+
};
|
|
10
|
+
/** Oriented frame of the footprint box: s along (ux, uz), t across. */
|
|
11
|
+
export interface BoxFrame {
|
|
12
|
+
cx: number;
|
|
13
|
+
cz: number;
|
|
14
|
+
ux: number;
|
|
15
|
+
uz: number;
|
|
16
|
+
}
|
|
17
|
+
/** A rectangle in the box frame. */
|
|
18
|
+
export interface FrameRect {
|
|
19
|
+
s0: number;
|
|
20
|
+
s1: number;
|
|
21
|
+
t0: number;
|
|
22
|
+
t1: number;
|
|
23
|
+
}
|
|
24
|
+
export interface InteriorCell {
|
|
25
|
+
i: number;
|
|
26
|
+
j: number;
|
|
27
|
+
/** Convex polygons (x, z pairs) of the inset footprint inside the cell. */
|
|
28
|
+
polys: number[][];
|
|
29
|
+
area: number;
|
|
30
|
+
/** Room index, -1 for an empty cell. */
|
|
31
|
+
room: number;
|
|
32
|
+
}
|
|
33
|
+
/** One straight run of a partition in the box frame; `wall0`/`wall1`: the end meets an outer wall. */
|
|
34
|
+
export interface PartitionSeg {
|
|
35
|
+
s0: number;
|
|
36
|
+
t0: number;
|
|
37
|
+
s1: number;
|
|
38
|
+
t1: number;
|
|
39
|
+
wall0: boolean;
|
|
40
|
+
wall1: boolean;
|
|
41
|
+
}
|
|
42
|
+
export interface InteriorPartition {
|
|
43
|
+
/** 0: along t at s = sCuts[i] (between cells i − 1 and i of row j); 1: along s at t = tCuts[j]. */
|
|
44
|
+
dir: 0 | 1;
|
|
45
|
+
i: number;
|
|
46
|
+
j: number;
|
|
47
|
+
/** Cells on the negative and positive side. */
|
|
48
|
+
cellA: number;
|
|
49
|
+
cellB: number;
|
|
50
|
+
segs: PartitionSeg[];
|
|
51
|
+
/** Door opening: segment, distance of its centre from the segment start, width. */
|
|
52
|
+
door: {
|
|
53
|
+
seg: number;
|
|
54
|
+
at: number;
|
|
55
|
+
width: number;
|
|
56
|
+
} | null;
|
|
57
|
+
}
|
|
58
|
+
export interface InteriorRoom {
|
|
59
|
+
type: number;
|
|
60
|
+
cells: number[];
|
|
61
|
+
hash: number;
|
|
62
|
+
}
|
|
63
|
+
/** The stair core: its cell and the stair rectangle; flights run along s when `alongS`, they start at the low end when `startLow`. */
|
|
64
|
+
export interface StairCore {
|
|
65
|
+
cell: number;
|
|
66
|
+
rect: FrameRect;
|
|
67
|
+
alongS: boolean;
|
|
68
|
+
startLow: boolean;
|
|
69
|
+
}
|
|
70
|
+
export interface InteriorPlan {
|
|
71
|
+
/** False when the footprint could not be inset: no interior is drawn. */
|
|
72
|
+
ok: boolean;
|
|
73
|
+
frame: BoxFrame;
|
|
74
|
+
sCuts: number[];
|
|
75
|
+
tCuts: number[];
|
|
76
|
+
/** Row of the corridor, -1 without one. */
|
|
77
|
+
corridorRow: number;
|
|
78
|
+
/** Inset rings (the inner face of the outer walls) and their triangulation (x, z per vertex). */
|
|
79
|
+
insets: Ring[];
|
|
80
|
+
tris: number[];
|
|
81
|
+
/** Cells by `i * nT + j`. */
|
|
82
|
+
cells: InteriorCell[];
|
|
83
|
+
rooms: InteriorRoom[];
|
|
84
|
+
partitions: InteriorPartition[];
|
|
85
|
+
core: StairCore | null;
|
|
86
|
+
/** Floor top of every storey; the last entry (index `floors`) is the floor of the space under the roof. */
|
|
87
|
+
floorY: number[];
|
|
88
|
+
/** Clear ceiling of every storey (underside of the slab or roof above). */
|
|
89
|
+
ceilY: number[];
|
|
90
|
+
/** A pitched roof with room under it: an attic slab at the eave and one attic room. */
|
|
91
|
+
attic: boolean;
|
|
92
|
+
/** Per edge of the structure plan: positions along the wall where partitions meet it, sorted. */
|
|
93
|
+
wallSplits: number[][];
|
|
94
|
+
}
|
|
95
|
+
declare const toS: (f: BoxFrame, x: number, z: number) => number;
|
|
96
|
+
declare const toT: (f: BoxFrame, x: number, z: number) => number;
|
|
97
|
+
export declare const frameX: (f: BoxFrame, s: number, t: number) => number;
|
|
98
|
+
export declare const frameZ: (f: BoxFrame, s: number, t: number) => number;
|
|
99
|
+
export { toS as frameS, toT as frameT };
|
|
100
|
+
/** Clips a convex polygon given in the box frame (s, t, then any extra values per vertex) to a rectangle. */
|
|
101
|
+
export declare function clipToRect(poly: number[][], r: FrameRect): number[][];
|
|
102
|
+
/** Parameter intervals (0–1) of the segment a → b that lie inside the rings (even–odd). */
|
|
103
|
+
export declare function segmentInside(rings: Ring[], ax: number, az: number, bx: number, bz: number): [number, number][];
|
|
104
|
+
/** Cell index of a point, or -1 outside the grid. */
|
|
105
|
+
export declare function cellAt(plan: InteriorPlan, x: number, z: number): number;
|
|
106
|
+
/** Room of a point, or -1. */
|
|
107
|
+
export declare function roomAt(plan: InteriorPlan, x: number, z: number): number;
|
|
108
|
+
/** Rectangle of a cell in the box frame. */
|
|
109
|
+
export declare function cellRect(plan: InteriorPlan, c: number): FrameRect;
|
|
110
|
+
/**
|
|
111
|
+
* The interior plan of one structure. Deterministic for the same structure plan; independent of any damage state.
|
|
112
|
+
* `wallT` is the outer wall thickness (`DESTRUCT_DIM.wall`), `roofSlab` the roof thickness.
|
|
113
|
+
*/
|
|
114
|
+
export declare function planInterior(p: StructurePlan, wallT: number, roofSlab: number): InteriorPlan;
|