wallhammer-web 0.0.0-stage → 0.4.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.
- package/LICENSE +21 -0
- package/README.md +92 -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,232 @@
|
|
|
1
|
+
// Binary format of one MESHED cell. A generator running in a worker and a pre-baked file served over HTTP hand over
|
|
2
|
+
// exactly these bytes, so "from a generator" and "from a file" cannot drift apart. Decoding makes no copies: the
|
|
3
|
+
// typed arrays of the result are views into the one buffer, which a worker can transfer instead of copying.
|
|
4
|
+
//
|
|
5
|
+
// Layout (little endian, every section starts on a 4-byte boundary):
|
|
6
|
+
// u32 magic 'WHC1' u32 format version u32 domain version u32 cell id high u32 cell id low
|
|
7
|
+
// f32 × 6 bounds (min xyz, max xyz, cell-local) u32 mesh count u32 instance batch count
|
|
8
|
+
// mesh: str material, layout, u32 primitive (0 triangles, 1 lines), u32 count,
|
|
9
|
+
// u32 vertex bytes + bytes, u32 index width (0 none, 2, 4) + u32 index count + indices
|
|
10
|
+
// instances: str archetype, layout, u32 float count + f32 data, u32 id words + u32 ids ([high, low] per instance)
|
|
11
|
+
// layout: u32 stride, u32 attribute count, per attribute: str name, u8 size, u8 type, u8 flags, u8 0, u32 offset
|
|
12
|
+
// str: u32 byte length + UTF-8 bytes
|
|
13
|
+
//
|
|
14
|
+
// Format 2 (shaped cells) adds two fields after the cell id: `u32 shape hash` (0 = not stated) and `f32 error` in
|
|
15
|
+
// metres (negative = not measured). A cell is written in format 2 only when it states `shapeHash` or `error`; every
|
|
16
|
+
// other cell keeps format 1 and its bytes. The reader takes both.
|
|
17
|
+
import { cellBits, cellFromBits } from '../gen-core/cell.js';
|
|
18
|
+
export const CELL_MAGIC = 0x31434857; // 'WHC1'
|
|
19
|
+
export const CELL_FORMAT_VERSION = 1;
|
|
20
|
+
/** Format version of a cell that states the hash of its world shape or its error. */
|
|
21
|
+
export const CELL_FORMAT_VERSION_SHAPED = 2;
|
|
22
|
+
/** File extension of a baked cell. */
|
|
23
|
+
export const CELL_FILE_EXT = '.whc';
|
|
24
|
+
const TYPES = ['f32', 'i8', 'u8', 'i16', 'u16', 'i32', 'u32'];
|
|
25
|
+
const pad4 = (n) => (n + 3) & ~3;
|
|
26
|
+
class Writer {
|
|
27
|
+
buf = new ArrayBuffer(1 << 16);
|
|
28
|
+
view = new DataView(this.buf);
|
|
29
|
+
bytes = new Uint8Array(this.buf);
|
|
30
|
+
at = 0;
|
|
31
|
+
room(n) {
|
|
32
|
+
if (this.at + n <= this.buf.byteLength)
|
|
33
|
+
return;
|
|
34
|
+
let size = this.buf.byteLength * 2;
|
|
35
|
+
while (size < this.at + n)
|
|
36
|
+
size *= 2;
|
|
37
|
+
const next = new ArrayBuffer(size);
|
|
38
|
+
new Uint8Array(next).set(this.bytes.subarray(0, this.at));
|
|
39
|
+
this.buf = next;
|
|
40
|
+
this.view = new DataView(next);
|
|
41
|
+
this.bytes = new Uint8Array(next);
|
|
42
|
+
}
|
|
43
|
+
u32(v) {
|
|
44
|
+
this.room(4);
|
|
45
|
+
this.view.setUint32(this.at, v >>> 0, true);
|
|
46
|
+
this.at += 4;
|
|
47
|
+
}
|
|
48
|
+
f32(v) {
|
|
49
|
+
this.room(4);
|
|
50
|
+
this.view.setFloat32(this.at, v, true);
|
|
51
|
+
this.at += 4;
|
|
52
|
+
}
|
|
53
|
+
u8x4(a, b, c, d) {
|
|
54
|
+
this.room(4);
|
|
55
|
+
this.bytes[this.at] = a;
|
|
56
|
+
this.bytes[this.at + 1] = b;
|
|
57
|
+
this.bytes[this.at + 2] = c;
|
|
58
|
+
this.bytes[this.at + 3] = d;
|
|
59
|
+
this.at += 4;
|
|
60
|
+
}
|
|
61
|
+
/** Raw bytes, zero-padded to four. */
|
|
62
|
+
raw(src) {
|
|
63
|
+
const n = src.byteLength;
|
|
64
|
+
const p = pad4(n);
|
|
65
|
+
this.room(p);
|
|
66
|
+
this.bytes.set(new Uint8Array(src.buffer, src.byteOffset, n), this.at);
|
|
67
|
+
this.bytes.fill(0, this.at + n, this.at + p);
|
|
68
|
+
this.at += p;
|
|
69
|
+
}
|
|
70
|
+
str(s) {
|
|
71
|
+
const b = new TextEncoder().encode(s);
|
|
72
|
+
this.u32(b.byteLength);
|
|
73
|
+
this.raw(b);
|
|
74
|
+
}
|
|
75
|
+
layout(l) {
|
|
76
|
+
this.u32(l.stride);
|
|
77
|
+
this.u32(l.attribs.length);
|
|
78
|
+
for (const a of l.attribs) {
|
|
79
|
+
this.str(a.name);
|
|
80
|
+
this.u8x4(a.size, TYPES.indexOf(a.type), (a.normalized ? 1 : 0) | (a.integer ? 2 : 0), 0);
|
|
81
|
+
this.u32(a.offset);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
result() {
|
|
85
|
+
return this.bytes.slice(0, this.at);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/** Encodes a cell. The same content always gives the same bytes. */
|
|
89
|
+
export function encodeCell(c) {
|
|
90
|
+
const w = new Writer();
|
|
91
|
+
const [hi, lo] = cellBits(c.cell);
|
|
92
|
+
const shaped = c.shapeHash !== undefined || c.error !== undefined;
|
|
93
|
+
w.u32(CELL_MAGIC);
|
|
94
|
+
w.u32(shaped ? CELL_FORMAT_VERSION_SHAPED : CELL_FORMAT_VERSION);
|
|
95
|
+
w.u32(c.domainVersion);
|
|
96
|
+
w.u32(hi);
|
|
97
|
+
w.u32(lo);
|
|
98
|
+
if (shaped) {
|
|
99
|
+
w.u32(c.shapeHash ?? 0);
|
|
100
|
+
w.f32(c.error !== undefined && c.error >= 0 ? c.error : -1);
|
|
101
|
+
}
|
|
102
|
+
for (const v of [...c.bounds.min, ...c.bounds.max])
|
|
103
|
+
w.f32(v);
|
|
104
|
+
w.u32(c.meshes.length);
|
|
105
|
+
w.u32(c.instances.length);
|
|
106
|
+
for (const m of c.meshes) {
|
|
107
|
+
w.str(m.material);
|
|
108
|
+
w.layout(m.mesh.layout);
|
|
109
|
+
w.u32(m.mesh.primitive === 'lines' ? 1 : 0);
|
|
110
|
+
w.u32(m.mesh.count);
|
|
111
|
+
w.u32(m.mesh.vertices.byteLength);
|
|
112
|
+
w.raw(m.mesh.vertices);
|
|
113
|
+
const ix = m.mesh.indices;
|
|
114
|
+
w.u32(ix ? ix.BYTES_PER_ELEMENT : 0);
|
|
115
|
+
w.u32(ix ? ix.length : 0);
|
|
116
|
+
if (ix)
|
|
117
|
+
w.raw(ix);
|
|
118
|
+
}
|
|
119
|
+
for (const b of c.instances) {
|
|
120
|
+
w.str(b.archetype);
|
|
121
|
+
w.layout(b.data.layout);
|
|
122
|
+
w.u32(b.data.data.length);
|
|
123
|
+
w.raw(b.data.data);
|
|
124
|
+
w.u32(b.ids.length);
|
|
125
|
+
w.raw(b.ids);
|
|
126
|
+
}
|
|
127
|
+
return w.result();
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Decodes a cell of format 1 or 2. The typed arrays of the result are views into `bytes` (which must start on a
|
|
131
|
+
* 4-byte boundary). A format 2 cell comes back with `shapeHash` and `error` where the file states them.
|
|
132
|
+
*/
|
|
133
|
+
export function decodeCell(bytes) {
|
|
134
|
+
if (bytes.byteOffset % 4 !== 0)
|
|
135
|
+
bytes = bytes.slice();
|
|
136
|
+
const buf = bytes.buffer;
|
|
137
|
+
const base = bytes.byteOffset;
|
|
138
|
+
const view = new DataView(buf, base, bytes.byteLength);
|
|
139
|
+
let at = 0;
|
|
140
|
+
const u32 = () => {
|
|
141
|
+
const v = view.getUint32(at, true);
|
|
142
|
+
at += 4;
|
|
143
|
+
return v;
|
|
144
|
+
};
|
|
145
|
+
const f32 = () => {
|
|
146
|
+
const v = view.getFloat32(at, true);
|
|
147
|
+
at += 4;
|
|
148
|
+
return v;
|
|
149
|
+
};
|
|
150
|
+
const take = (n) => {
|
|
151
|
+
const start = at;
|
|
152
|
+
at += pad4(n);
|
|
153
|
+
if (at > bytes.byteLength)
|
|
154
|
+
throw new Error('cell file is truncated');
|
|
155
|
+
return base + start;
|
|
156
|
+
};
|
|
157
|
+
const str = () => {
|
|
158
|
+
const n = u32();
|
|
159
|
+
return new TextDecoder().decode(new Uint8Array(buf, take(n), n));
|
|
160
|
+
};
|
|
161
|
+
const layout = () => {
|
|
162
|
+
const stride = u32();
|
|
163
|
+
const count = u32();
|
|
164
|
+
const attribs = [];
|
|
165
|
+
for (let i = 0; i < count; i++) {
|
|
166
|
+
const name = str();
|
|
167
|
+
const size = view.getUint8(at);
|
|
168
|
+
const type = TYPES[view.getUint8(at + 1)];
|
|
169
|
+
const flags = view.getUint8(at + 2);
|
|
170
|
+
at += 4;
|
|
171
|
+
const offset = u32();
|
|
172
|
+
attribs.push({ name, size, type, offset, ...(flags & 1 ? { normalized: true } : {}), ...(flags & 2 ? { integer: true } : {}) });
|
|
173
|
+
}
|
|
174
|
+
return { stride, attribs };
|
|
175
|
+
};
|
|
176
|
+
if (u32() !== CELL_MAGIC)
|
|
177
|
+
throw new Error('not a cell file (bad magic)');
|
|
178
|
+
const version = u32();
|
|
179
|
+
if (version !== CELL_FORMAT_VERSION && version !== CELL_FORMAT_VERSION_SHAPED)
|
|
180
|
+
throw new Error(`cell file format ${version}, expected ${CELL_FORMAT_VERSION} or ${CELL_FORMAT_VERSION_SHAPED}`);
|
|
181
|
+
const domainVersion = u32();
|
|
182
|
+
const hi = u32();
|
|
183
|
+
const lo = u32();
|
|
184
|
+
const shaped = version === CELL_FORMAT_VERSION_SHAPED;
|
|
185
|
+
const shape = shaped ? u32() : 0;
|
|
186
|
+
const error = shaped ? f32() : -1;
|
|
187
|
+
const b = [f32(), f32(), f32(), f32(), f32(), f32()];
|
|
188
|
+
const meshCount = u32();
|
|
189
|
+
const instCount = u32();
|
|
190
|
+
const meshes = [];
|
|
191
|
+
for (let i = 0; i < meshCount; i++) {
|
|
192
|
+
const material = str();
|
|
193
|
+
const l = layout();
|
|
194
|
+
const primitive = u32() === 1 ? 'lines' : 'triangles';
|
|
195
|
+
const count = u32();
|
|
196
|
+
const vb = u32();
|
|
197
|
+
const vertices = new Uint8Array(buf, take(vb), vb);
|
|
198
|
+
const width = u32();
|
|
199
|
+
const n = u32();
|
|
200
|
+
const indices = width === 0 ? null : width === 2 ? new Uint16Array(buf, take(n * 2), n) : new Uint32Array(buf, take(n * 4), n);
|
|
201
|
+
const mesh = { layout: l, vertices, indices, count, ...(primitive === 'lines' ? { primitive } : {}) };
|
|
202
|
+
meshes.push({ material, mesh });
|
|
203
|
+
}
|
|
204
|
+
const instances = [];
|
|
205
|
+
for (let i = 0; i < instCount; i++) {
|
|
206
|
+
const archetype = str();
|
|
207
|
+
const l = layout();
|
|
208
|
+
const nf = u32();
|
|
209
|
+
const data = new Float32Array(buf, take(nf * 4), nf);
|
|
210
|
+
const ni = u32();
|
|
211
|
+
const ids = new Uint32Array(buf, take(ni * 4), ni);
|
|
212
|
+
instances.push({ archetype, data: { layout: l, data }, ids });
|
|
213
|
+
}
|
|
214
|
+
return {
|
|
215
|
+
cell: cellFromBits(hi, lo),
|
|
216
|
+
domainVersion,
|
|
217
|
+
bounds: { min: [b[0], b[1], b[2]], max: [b[3], b[4], b[5]] },
|
|
218
|
+
meshes,
|
|
219
|
+
instances,
|
|
220
|
+
...(shape !== 0 ? { shapeHash: shape } : {}),
|
|
221
|
+
...(error >= 0 ? { error } : {}),
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Relative path of a baked cell: `<face>/<level>/<x>/<y>.whc` (coordinates without the offset). With the hash of a
|
|
226
|
+
* world shape (`shapeHash` of gen-core) the path starts with it, as `s<8 hex digits>/`, so cells baked for different
|
|
227
|
+
* shapes never share a file.
|
|
228
|
+
*/
|
|
229
|
+
export function cellFilePath(c, shape) {
|
|
230
|
+
const dir = shape === undefined ? '' : `s${(shape >>> 0).toString(16).padStart(8, '0')}/`;
|
|
231
|
+
return `${dir}${c.face}/${c.level}/${c.x}/${c.y}${CELL_FILE_EXT}`;
|
|
232
|
+
}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
export interface CollisionWorldOptions {
|
|
2
|
+
/** Height of the base surface at a point, metres. */
|
|
3
|
+
heightAt(x: number, z: number): number;
|
|
4
|
+
/** Edge of a cell of the lookup grid, metres. Default 8. */
|
|
5
|
+
cellSize?: number;
|
|
6
|
+
/**
|
|
7
|
+
* Lowest and highest value `heightAt` returns, when known. A ray only searches for the base surface between them,
|
|
8
|
+
* so a ray above the highest point costs nothing. Default: unknown (the whole ray is searched).
|
|
9
|
+
*/
|
|
10
|
+
baseMinY?: number;
|
|
11
|
+
baseMaxY?: number;
|
|
12
|
+
/** Horizontal step of the ray search for the base surface, metres. Default 0.5; finer for a sharper surface. */
|
|
13
|
+
baseStep?: number;
|
|
14
|
+
/**
|
|
15
|
+
* Where the base surface exists, as [minX, minZ, maxX, maxZ] in metres, when it ends somewhere (a terrain of a given
|
|
16
|
+
* size). A ray searches for the base only inside it, so a ray that leaves it (toward an empty horizon) stops early.
|
|
17
|
+
* Default: everywhere, and a ray that misses everything searches the base to its end (`maxT`, at most 1e5 lengths,
|
|
18
|
+
* which takes milliseconds); pass a finite `maxT` or this extent for endless rays.
|
|
19
|
+
*/
|
|
20
|
+
baseExtent?: readonly [number, number, number, number];
|
|
21
|
+
}
|
|
22
|
+
export interface SolidOptions {
|
|
23
|
+
/** Can be stood on (its top is a walkable surface). Default true. */
|
|
24
|
+
standable?: boolean;
|
|
25
|
+
/** Stops a ray and a camera boom. Default true (false for invisible limits). */
|
|
26
|
+
blocksSight?: boolean;
|
|
27
|
+
/** Caller's number, returned in hits. */
|
|
28
|
+
tag?: number;
|
|
29
|
+
}
|
|
30
|
+
/** A ray hit: parameter `t` along the ray, the point, the unit normal (turned against the ray), the solid id and its tag (both −1 for the base surface). */
|
|
31
|
+
export interface RayHit {
|
|
32
|
+
t: number;
|
|
33
|
+
x: number;
|
|
34
|
+
y: number;
|
|
35
|
+
z: number;
|
|
36
|
+
nx: number;
|
|
37
|
+
ny: number;
|
|
38
|
+
nz: number;
|
|
39
|
+
solid: number;
|
|
40
|
+
tag: number;
|
|
41
|
+
}
|
|
42
|
+
/** Result of `slide`: the reached centre, whether a side was touched, the last contact normal (unit, horizontal) and that solid (−1: none). */
|
|
43
|
+
export interface SlideResult {
|
|
44
|
+
x: number;
|
|
45
|
+
z: number;
|
|
46
|
+
hit: boolean;
|
|
47
|
+
nx: number;
|
|
48
|
+
nz: number;
|
|
49
|
+
solid: number;
|
|
50
|
+
}
|
|
51
|
+
/** A read-only description of one solid, for debug drawing (`forEachSolid`). */
|
|
52
|
+
export interface SolidInfo {
|
|
53
|
+
kind: 'prism' | 'cylinder';
|
|
54
|
+
/** Prism: the outline as x, z pairs (do not change it). Cylinder: null. */
|
|
55
|
+
outline: Float32Array | null;
|
|
56
|
+
/** Cylinder: centre and radius. Prism: 0. */
|
|
57
|
+
x: number;
|
|
58
|
+
z: number;
|
|
59
|
+
radius: number;
|
|
60
|
+
minY: number;
|
|
61
|
+
maxY: number;
|
|
62
|
+
standable: boolean;
|
|
63
|
+
blocksSight: boolean;
|
|
64
|
+
tag: number;
|
|
65
|
+
}
|
|
66
|
+
/** A fresh `RayHit` to pass to `raycast` (allocate once, reuse). */
|
|
67
|
+
export declare function newRayHit(): RayHit;
|
|
68
|
+
/** A fresh `SlideResult` to pass to `slide` (allocate once, reuse). */
|
|
69
|
+
export declare function newSlideResult(): SlideResult;
|
|
70
|
+
/**
|
|
71
|
+
* Upright solids over a base surface, for walking and for the camera: ground and ceiling under and over a point,
|
|
72
|
+
* a circle sliding along the sides, a ray, and how far a sphere can travel. Ids are never reused: removing a solid
|
|
73
|
+
* leaves every other id as it was.
|
|
74
|
+
*/
|
|
75
|
+
export declare class CollisionWorld {
|
|
76
|
+
readonly cellSize: number;
|
|
77
|
+
private readonly heightAt;
|
|
78
|
+
private readonly baseMinY;
|
|
79
|
+
private readonly baseMaxY;
|
|
80
|
+
private readonly baseStep;
|
|
81
|
+
private readonly extent;
|
|
82
|
+
/** Rectangle around every solid ever added (it only grows), which ends the walk of a ray through the cells. */
|
|
83
|
+
private sx0;
|
|
84
|
+
private sx1;
|
|
85
|
+
private sz0;
|
|
86
|
+
private sz1;
|
|
87
|
+
private readonly kind;
|
|
88
|
+
private readonly flag;
|
|
89
|
+
private readonly tagOf;
|
|
90
|
+
private readonly lowY;
|
|
91
|
+
private readonly highY;
|
|
92
|
+
private readonly x0;
|
|
93
|
+
private readonly x1;
|
|
94
|
+
private readonly z0;
|
|
95
|
+
private readonly z1;
|
|
96
|
+
/** Prism: one ring in an array (the shape `pointInRings` and `rayPrism` take); null otherwise. */
|
|
97
|
+
private readonly rings;
|
|
98
|
+
/** Prism: +1 when the outline runs counter-clockwise (positive `ringSignedArea`), −1 otherwise. */
|
|
99
|
+
private readonly orient;
|
|
100
|
+
private readonly cx;
|
|
101
|
+
private readonly cz;
|
|
102
|
+
private readonly cr;
|
|
103
|
+
/** Keys of the cells a solid is listed in, for removal. */
|
|
104
|
+
private readonly cellsOf;
|
|
105
|
+
private readonly cells;
|
|
106
|
+
private live;
|
|
107
|
+
private mark;
|
|
108
|
+
private stamp;
|
|
109
|
+
private cand;
|
|
110
|
+
private dirX;
|
|
111
|
+
private dirZ;
|
|
112
|
+
private px;
|
|
113
|
+
private pz;
|
|
114
|
+
private readonly normal;
|
|
115
|
+
private readonly rayScratch;
|
|
116
|
+
constructor(options: CollisionWorldOptions);
|
|
117
|
+
/** Number of solids not removed. */
|
|
118
|
+
get solidCount(): number;
|
|
119
|
+
/** Vertical prism over a closed outline (x, z pairs), from minY to maxY. Returns the solid's id. */
|
|
120
|
+
addPrism(outline: ArrayLike<number>, minY: number, maxY: number, options?: SolidOptions): number;
|
|
121
|
+
/** Upright cylinder with its axis at (x, z). Returns the solid's id. */
|
|
122
|
+
addCylinder(x: number, z: number, radius: number, minY: number, maxY: number, options?: SolidOptions): number;
|
|
123
|
+
/**
|
|
124
|
+
* Oriented box; a convenience over addPrism. `yawRad` turns it about +y the way a view's yaw does: the local +x
|
|
125
|
+
* axis points to (cos yaw, −sin yaw) in x, z.
|
|
126
|
+
*/
|
|
127
|
+
addBox(x: number, z: number, halfX: number, halfZ: number, yawRad: number, minY: number, maxY: number, options?: SolidOptions): number;
|
|
128
|
+
/** Removes a solid. Other ids stay valid; a removed or unknown id is ignored. */
|
|
129
|
+
remove(id: number): void;
|
|
130
|
+
/** Height of the base surface at a point (the `heightAt` the world was made with). */
|
|
131
|
+
baseHeightAt(x: number, z: number): number;
|
|
132
|
+
/**
|
|
133
|
+
* Slope of the base surface at a point: writes the gradient (rise per metre along x and along z) into `out[0]`,
|
|
134
|
+
* `out[1]` and returns its length (the tangent of the slope angle). Central differences 0.05 m apart.
|
|
135
|
+
*/
|
|
136
|
+
baseSlopeAt(x: number, z: number, out: Float64Array | number[]): number;
|
|
137
|
+
/** Whether `id` is a solid that has not been removed. */
|
|
138
|
+
has(id: number): boolean;
|
|
139
|
+
/** Calls `fn` for every solid not removed, in id order (debug drawing; allocates). */
|
|
140
|
+
forEachSolid(fn: (id: number, info: SolidInfo) => void): void;
|
|
141
|
+
/**
|
|
142
|
+
* Highest surface (base or a standable top) that is not above `y + maxStepUp`. The base counts always, even above
|
|
143
|
+
* that limit. With `radius` a top counts when it reaches within `radius` of the point (a disc stands on an edge).
|
|
144
|
+
*/
|
|
145
|
+
groundAt(x: number, z: number, y: number, maxStepUp: number, radius?: number): number;
|
|
146
|
+
/**
|
|
147
|
+
* Lowest underside at or above `y` at the point (for the head when jumping); Infinity when open. Every solid counts,
|
|
148
|
+
* whatever its options. With `radius` an underside counts when the solid reaches within `radius` of the point.
|
|
149
|
+
*/
|
|
150
|
+
ceilingAt(x: number, z: number, y: number, radius?: number): number;
|
|
151
|
+
/**
|
|
152
|
+
* Moves a circle of `radius` by (dx, dz) against the sides of solids that overlap the height span, sliding along them.
|
|
153
|
+
* A solid takes part when its span overlaps (minY, maxY) (touching does not count), whatever its options. The move is
|
|
154
|
+
* split into sub-steps of at most half the radius, so no side is skipped; a circle that starts inside solids is first
|
|
155
|
+
* pushed out the shortest way. In a corner the circle stops: a sub-step that cannot be resolved is undone.
|
|
156
|
+
*/
|
|
157
|
+
slide(x: number, z: number, radius: number, minY: number, maxY: number, dx: number, dz: number, out: SlideResult): SlideResult;
|
|
158
|
+
/**
|
|
159
|
+
* First hit of a ray with the base surface and the solids, for t in [0, maxT]. The direction need not be unit; `t` is
|
|
160
|
+
* measured in its lengths. Solids with `blocksSight: false` are not hit. Writes `out` and returns true on a hit.
|
|
161
|
+
*/
|
|
162
|
+
raycast(ox: number, oy: number, oz: number, dx: number, dy: number, dz: number, maxT: number, out: RayHit): boolean;
|
|
163
|
+
/**
|
|
164
|
+
* How far a sphere of `radius` can travel from the origin along the direction, at most maxDist (for a camera boom).
|
|
165
|
+
* Solids with `blocksSight: false` do not stop it. 0 when the sphere already overlaps something at the origin. The
|
|
166
|
+
* direction need not be unit; distances are in metres. The sphere is tested every `radius` metres along the way and
|
|
167
|
+
* the contact refined by bisection; the centre line is first cast as a ray, so nothing thin is passed through.
|
|
168
|
+
*/
|
|
169
|
+
clearance(ox: number, oy: number, oz: number, dx: number, dy: number, dz: number, maxDist: number, radius: number): number;
|
|
170
|
+
private push;
|
|
171
|
+
/**
|
|
172
|
+
* Lists a solid in the cells of its rectangle that its shape reaches: a cell counts when the distance from its
|
|
173
|
+
* centre to the shape is at most half its diagonal (a long turned solid is not listed in every cell of its rectangle).
|
|
174
|
+
*/
|
|
175
|
+
private register;
|
|
176
|
+
private nextStamp;
|
|
177
|
+
/** Lists every live solid of the cells over a rectangle once, in `cand`, and returns their count. */
|
|
178
|
+
private gather;
|
|
179
|
+
/**
|
|
180
|
+
* Signed horizontal distance from (x, z) to the side of a solid: negative inside. Leaves in `dirX`, `dirZ` the unit
|
|
181
|
+
* direction that leads out (away from the side outside, toward it inside).
|
|
182
|
+
*/
|
|
183
|
+
private nearest;
|
|
184
|
+
/** Pushes the centre (`px`, `pz`) out of the candidates; false when overlap remains after `passes`. */
|
|
185
|
+
private resolve;
|
|
186
|
+
/** Whether a sphere at a point stays clear of the base and of the solids that block sight. */
|
|
187
|
+
private sphereFree;
|
|
188
|
+
/** Parameter of the ray's first downward passage through the base surface in [0, maxT], or Infinity. */
|
|
189
|
+
private rayBase;
|
|
190
|
+
/** Ray against an upright cylinder (side and both caps) for t in [0, tMax); writes `normal`; Infinity on a miss. */
|
|
191
|
+
private rayCylinder;
|
|
192
|
+
}
|