@pibbl/core 0.0.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.txt +19 -0
- package/README.md +76 -0
- package/THIRD_PARTY_NOTICES.txt +205 -0
- package/dist/features/particles/index.d.ts +7 -0
- package/dist/features/particles/index.js +26 -0
- package/dist/features/particles/index.js.map +7 -0
- package/dist/features/particles/index.mjs +1 -0
- package/dist/features/particles/lib/canvas/birth-ledger.d.ts +69 -0
- package/dist/features/particles/lib/canvas/birth-ledger.js +752 -0
- package/dist/features/particles/lib/canvas/birth-ledger.js.map +7 -0
- package/dist/features/particles/lib/canvas/component.d.ts +14 -0
- package/dist/features/particles/lib/canvas/component.js +249 -0
- package/dist/features/particles/lib/canvas/component.js.map +7 -0
- package/dist/features/particles/lib/canvas/executor.d.ts +31 -0
- package/dist/features/particles/lib/canvas/executor.js +537 -0
- package/dist/features/particles/lib/canvas/executor.js.map +7 -0
- package/dist/features/particles/lib/canvas/primitive.d.ts +14 -0
- package/dist/features/particles/lib/canvas/primitive.js +50 -0
- package/dist/features/particles/lib/canvas/primitive.js.map +7 -0
- package/dist/features/particles/lib/canvas/raster-cache.d.ts +13 -0
- package/dist/features/particles/lib/canvas/raster-cache.js +106 -0
- package/dist/features/particles/lib/canvas/raster-cache.js.map +7 -0
- package/dist/features/particles/lib/color.d.ts +7 -0
- package/dist/features/particles/lib/color.js +159 -0
- package/dist/features/particles/lib/color.js.map +7 -0
- package/dist/features/particles/lib/compiler.d.ts +134 -0
- package/dist/features/particles/lib/compiler.js +443 -0
- package/dist/features/particles/lib/compiler.js.map +7 -0
- package/dist/features/particles/lib/curve.d.ts +19 -0
- package/dist/features/particles/lib/curve.js +129 -0
- package/dist/features/particles/lib/curve.js.map +7 -0
- package/dist/features/particles/lib/definition-records.d.ts +58 -0
- package/dist/features/particles/lib/definition-records.js +500 -0
- package/dist/features/particles/lib/definition-records.js.map +7 -0
- package/dist/features/particles/lib/definition.d.ts +18 -0
- package/dist/features/particles/lib/definition.js +602 -0
- package/dist/features/particles/lib/definition.js.map +7 -0
- package/dist/features/particles/lib/emission.d.ts +54 -0
- package/dist/features/particles/lib/emission.js +184 -0
- package/dist/features/particles/lib/emission.js.map +7 -0
- package/dist/features/particles/lib/flow/field.d.ts +81 -0
- package/dist/features/particles/lib/flow/field.js +585 -0
- package/dist/features/particles/lib/flow/field.js.map +7 -0
- package/dist/features/particles/lib/flow/hook.d.ts +158 -0
- package/dist/features/particles/lib/flow/hook.js +215 -0
- package/dist/features/particles/lib/flow/hook.js.map +7 -0
- package/dist/features/particles/lib/flow/population.d.ts +25 -0
- package/dist/features/particles/lib/flow/population.js +104 -0
- package/dist/features/particles/lib/flow/population.js.map +7 -0
- package/dist/features/particles/lib/particle.d.ts +113 -0
- package/dist/features/particles/lib/particle.js +192 -0
- package/dist/features/particles/lib/particle.js.map +7 -0
- package/dist/features/particles/lib/random.d.ts +16 -0
- package/dist/features/particles/lib/random.js +61 -0
- package/dist/features/particles/lib/random.js.map +7 -0
- package/dist/features/particles/lib/sample.d.ts +32 -0
- package/dist/features/particles/lib/sample.js +397 -0
- package/dist/features/particles/lib/sample.js.map +7 -0
- package/dist/features/particles/lib/signal-inputs.d.ts +6 -0
- package/dist/features/particles/lib/signal-inputs.js +41 -0
- package/dist/features/particles/lib/signal-inputs.js.map +7 -0
- package/dist/features/particles/lib/system/binding.d.ts +59 -0
- package/dist/features/particles/lib/system/binding.js +122 -0
- package/dist/features/particles/lib/system/binding.js.map +7 -0
- package/dist/features/particles/lib/system/controller.d.ts +58 -0
- package/dist/features/particles/lib/system/controller.js +1446 -0
- package/dist/features/particles/lib/system/controller.js.map +7 -0
- package/dist/features/particles/lib/system/hook.d.ts +13 -0
- package/dist/features/particles/lib/system/hook.js +52 -0
- package/dist/features/particles/lib/system/hook.js.map +7 -0
- package/dist/features/particles/lib/system/ownership.d.ts +26 -0
- package/dist/features/particles/lib/system/ownership.js +128 -0
- package/dist/features/particles/lib/system/ownership.js.map +7 -0
- package/dist/features/particles/lib/types.d.ts +983 -0
- package/dist/features/physics/2d-geometry.d.ts +216 -0
- package/dist/features/physics/2d-geometry.js +59 -0
- package/dist/features/physics/2d-geometry.js.map +7 -0
- package/dist/features/physics/2d-geometry.mjs +1 -0
- package/dist/features/physics/2d-testing.d.ts +80 -0
- package/dist/features/physics/2d-testing.js +141 -0
- package/dist/features/physics/2d-testing.js.map +7 -0
- package/dist/features/physics/2d-testing.mjs +1 -0
- package/dist/features/physics/2d.d.ts +165 -0
- package/dist/features/physics/2d.js +119 -0
- package/dist/features/physics/2d.js.map +7 -0
- package/dist/features/physics/2d.mjs +1 -0
- package/dist/features/physics/lib/2d/canvas/components.d.ts +46 -0
- package/dist/features/physics/lib/2d/canvas/components.js +212 -0
- package/dist/features/physics/lib/2d/canvas/components.js.map +7 -0
- package/dist/features/physics/lib/2d/canvas/custom.d.ts +24 -0
- package/dist/features/physics/lib/2d/canvas/custom.js +45 -0
- package/dist/features/physics/lib/2d/canvas/custom.js.map +7 -0
- package/dist/features/physics/lib/2d/canvas/debug.d.ts +23 -0
- package/dist/features/physics/lib/2d/canvas/debug.js +53 -0
- package/dist/features/physics/lib/2d/canvas/debug.js.map +7 -0
- package/dist/features/physics/lib/2d/canvas/inference.d.ts +9 -0
- package/dist/features/physics/lib/2d/canvas/inference.js +704 -0
- package/dist/features/physics/lib/2d/canvas/inference.js.map +7 -0
- package/dist/features/physics/lib/2d/canvas/presentation.d.ts +11 -0
- package/dist/features/physics/lib/2d/canvas/presentation.js +169 -0
- package/dist/features/physics/lib/2d/canvas/presentation.js.map +7 -0
- package/dist/features/physics/lib/2d/collision/analytic.d.ts +15 -0
- package/dist/features/physics/lib/2d/collision/analytic.js +151 -0
- package/dist/features/physics/lib/2d/collision/analytic.js.map +7 -0
- package/dist/features/physics/lib/2d/collision/casts.d.ts +37 -0
- package/dist/features/physics/lib/2d/collision/casts.js +631 -0
- package/dist/features/physics/lib/2d/collision/casts.js.map +7 -0
- package/dist/features/physics/lib/2d/collision/epa.d.ts +21 -0
- package/dist/features/physics/lib/2d/collision/epa.js +102 -0
- package/dist/features/physics/lib/2d/collision/epa.js.map +7 -0
- package/dist/features/physics/lib/2d/collision/gjk.d.ts +28 -0
- package/dist/features/physics/lib/2d/collision/gjk.js +233 -0
- package/dist/features/physics/lib/2d/collision/gjk.js.map +7 -0
- package/dist/features/physics/lib/2d/collision/manifold.d.ts +35 -0
- package/dist/features/physics/lib/2d/collision/manifold.js +238 -0
- package/dist/features/physics/lib/2d/collision/manifold.js.map +7 -0
- package/dist/features/physics/lib/2d/collision/pairs.d.ts +10 -0
- package/dist/features/physics/lib/2d/collision/pairs.js +285 -0
- package/dist/features/physics/lib/2d/collision/pairs.js.map +7 -0
- package/dist/features/physics/lib/2d/collision/support.d.ts +20 -0
- package/dist/features/physics/lib/2d/collision/support.js +155 -0
- package/dist/features/physics/lib/2d/collision/support.js.map +7 -0
- package/dist/features/physics/lib/2d/inspection-types.d.ts +159 -0
- package/dist/features/physics/lib/2d/math.d.ts +27 -0
- package/dist/features/physics/lib/2d/math.js +314 -0
- package/dist/features/physics/lib/2d/math.js.map +7 -0
- package/dist/features/physics/lib/2d/numeric-policy.d.ts +24 -0
- package/dist/features/physics/lib/2d/numeric-policy.js +51 -0
- package/dist/features/physics/lib/2d/numeric-policy.js.map +7 -0
- package/dist/features/physics/lib/2d/runtime/body-handle.d.ts +148 -0
- package/dist/features/physics/lib/2d/runtime/body-handle.js +305 -0
- package/dist/features/physics/lib/2d/runtime/body-handle.js.map +7 -0
- package/dist/features/physics/lib/2d/runtime/context.d.ts +9 -0
- package/dist/features/physics/lib/2d/runtime/context.js +57 -0
- package/dist/features/physics/lib/2d/runtime/context.js.map +7 -0
- package/dist/features/physics/lib/2d/runtime/controller.d.ts +106 -0
- package/dist/features/physics/lib/2d/runtime/controller.js +1317 -0
- package/dist/features/physics/lib/2d/runtime/controller.js.map +7 -0
- package/dist/features/physics/lib/2d/runtime/descriptors.d.ts +153 -0
- package/dist/features/physics/lib/2d/runtime/descriptors.js +526 -0
- package/dist/features/physics/lib/2d/runtime/descriptors.js.map +7 -0
- package/dist/features/physics/lib/2d/runtime/events.d.ts +56 -0
- package/dist/features/physics/lib/2d/runtime/events.js +153 -0
- package/dist/features/physics/lib/2d/runtime/events.js.map +7 -0
- package/dist/features/physics/lib/2d/runtime/obstacles.d.ts +22 -0
- package/dist/features/physics/lib/2d/runtime/obstacles.js +192 -0
- package/dist/features/physics/lib/2d/runtime/obstacles.js.map +7 -0
- package/dist/features/physics/lib/2d/runtime/ownership.d.ts +41 -0
- package/dist/features/physics/lib/2d/runtime/ownership.js +46 -0
- package/dist/features/physics/lib/2d/runtime/ownership.js.map +7 -0
- package/dist/features/physics/lib/2d/runtime/trace.d.ts +32 -0
- package/dist/features/physics/lib/2d/runtime/trace.js +22 -0
- package/dist/features/physics/lib/2d/runtime/trace.js.map +7 -0
- package/dist/features/physics/lib/2d/runtime/world-component.d.ts +18 -0
- package/dist/features/physics/lib/2d/runtime/world-component.js +41 -0
- package/dist/features/physics/lib/2d/runtime/world-component.js.map +7 -0
- package/dist/features/physics/lib/2d/runtime/world-props.d.ts +16 -0
- package/dist/features/physics/lib/2d/shape-records.d.ts +60 -0
- package/dist/features/physics/lib/2d/shape-records.js +26 -0
- package/dist/features/physics/lib/2d/shape-records.js.map +7 -0
- package/dist/features/physics/lib/2d/shapes.d.ts +191 -0
- package/dist/features/physics/lib/2d/shapes.js +543 -0
- package/dist/features/physics/lib/2d/shapes.js.map +7 -0
- package/dist/features/physics/lib/2d/types.d.ts +713 -0
- package/dist/features/physics/lib/2d/types.js +1 -0
- package/dist/features/physics/lib/2d/types.js.map +7 -0
- package/dist/features/physics/lib/2d/world/broad-phase.d.ts +77 -0
- package/dist/features/physics/lib/2d/world/broad-phase.js +762 -0
- package/dist/features/physics/lib/2d/world/broad-phase.js.map +7 -0
- package/dist/features/physics/lib/2d/world/ccd.d.ts +19 -0
- package/dist/features/physics/lib/2d/world/ccd.js +265 -0
- package/dist/features/physics/lib/2d/world/ccd.js.map +7 -0
- package/dist/features/physics/lib/2d/world/contact-cache.d.ts +81 -0
- package/dist/features/physics/lib/2d/world/contact-cache.js +497 -0
- package/dist/features/physics/lib/2d/world/contact-cache.js.map +7 -0
- package/dist/features/physics/lib/2d/world/integrator.d.ts +11 -0
- package/dist/features/physics/lib/2d/world/integrator.js +99 -0
- package/dist/features/physics/lib/2d/world/integrator.js.map +7 -0
- package/dist/features/physics/lib/2d/world/queries.d.ts +62 -0
- package/dist/features/physics/lib/2d/world/queries.js +424 -0
- package/dist/features/physics/lib/2d/world/queries.js.map +7 -0
- package/dist/features/physics/lib/2d/world/rapier-engine.js +7054 -0
- package/dist/features/physics/lib/2d/world/rapier-engine.js.map +7 -0
- package/dist/features/physics/lib/2d/world/rapier.d.ts +50 -0
- package/dist/features/physics/lib/2d/world/rapier.js +655 -0
- package/dist/features/physics/lib/2d/world/rapier.js.map +7 -0
- package/dist/features/physics/lib/2d/world/solver.d.ts +58 -0
- package/dist/features/physics/lib/2d/world/solver.js +660 -0
- package/dist/features/physics/lib/2d/world/solver.js.map +7 -0
- package/dist/features/physics/lib/2d/world/storage.d.ts +96 -0
- package/dist/features/physics/lib/2d/world/storage.js +371 -0
- package/dist/features/physics/lib/2d/world/storage.js.map +7 -0
- package/dist/features/physics/lib/2d/world/world.d.ts +265 -0
- package/dist/features/physics/lib/2d/world/world.js +1713 -0
- package/dist/features/physics/lib/2d/world/world.js.map +7 -0
- package/dist/features/physics/lib/shared/signal-inputs.d.ts +5 -0
- package/dist/features/physics/lib/shared/signal-inputs.js +20 -0
- package/dist/features/physics/lib/shared/signal-inputs.js.map +7 -0
- package/dist/features/physics/lib/shared/validation.d.ts +5 -0
- package/dist/features/physics/lib/shared/validation.js +48 -0
- package/dist/features/physics/lib/shared/validation.js.map +7 -0
- package/dist/features/sprites/formats/aseprite.js +23 -0
- package/dist/features/sprites/formats/aseprite.js.map +7 -0
- package/dist/features/sprites/formats/aseprite.mjs +1 -0
- package/dist/features/sprites/formats/texture-packer.js +14 -0
- package/dist/features/sprites/formats/texture-packer.js.map +7 -0
- package/dist/features/sprites/formats/texture-packer.mjs +1 -0
- package/dist/features/sprites/index.js +9 -0
- package/dist/features/sprites/index.js.map +7 -0
- package/dist/features/sprites/index.mjs +1 -0
- package/dist/features/sprites/loader.js +63 -0
- package/dist/features/sprites/loader.js.map +7 -0
- package/dist/features/sprites/model.js +64 -0
- package/dist/features/sprites/model.js.map +7 -0
- package/dist/features/sprites/sprite.js +31 -0
- package/dist/features/sprites/sprite.js.map +7 -0
- package/dist/features/textures/index.d.ts +22 -0
- package/dist/features/textures/index.js +31 -0
- package/dist/features/textures/index.js.map +7 -0
- package/dist/features/textures/index.mjs +1 -0
- package/dist/features/textures/lib/definitions.d.ts +117 -0
- package/dist/features/textures/lib/definitions.js +179 -0
- package/dist/features/textures/lib/definitions.js.map +7 -0
- package/dist/features/textures/lib/electric-boundary.d.ts +3 -0
- package/dist/features/textures/lib/electric-boundary.js +11 -0
- package/dist/features/textures/lib/electric-boundary.js.map +7 -0
- package/dist/features/textures/lib/electric-shared.d.ts +69 -0
- package/dist/features/textures/lib/electric-shared.js +43 -0
- package/dist/features/textures/lib/electric-shared.js.map +7 -0
- package/dist/features/textures/lib/electric-sources.d.ts +50 -0
- package/dist/features/textures/lib/electric-sources.js +43 -0
- package/dist/features/textures/lib/electric-sources.js.map +7 -0
- package/dist/features/textures/lib/lightning.d.ts +72 -0
- package/dist/features/textures/lib/lightning.js +139 -0
- package/dist/features/textures/lib/lightning.js.map +7 -0
- package/dist/features/textures/lib/material-field.d.ts +12 -0
- package/dist/features/textures/lib/material-field.js +31 -0
- package/dist/features/textures/lib/material-field.js.map +7 -0
- package/dist/features/textures/lib/palette.d.ts +45 -0
- package/dist/features/textures/lib/palette.js +52 -0
- package/dist/features/textures/lib/palette.js.map +7 -0
- package/dist/features/textures/lib/presentation.d.ts +54 -0
- package/dist/features/textures/lib/presentation.js +83 -0
- package/dist/features/textures/lib/presentation.js.map +7 -0
- package/dist/features/textures/lib/procedural-texture.d.ts +44 -0
- package/dist/features/textures/lib/procedural-texture.js +110 -0
- package/dist/features/textures/lib/procedural-texture.js.map +7 -0
- package/dist/features/textures/lib/rain-drops.d.ts +96 -0
- package/dist/features/textures/lib/rain-drops.js +322 -0
- package/dist/features/textures/lib/rain-drops.js.map +7 -0
- package/dist/features/textures/lib/reaction-diffusion.d.ts +67 -0
- package/dist/features/textures/lib/reaction-diffusion.js +210 -0
- package/dist/features/textures/lib/reaction-diffusion.js.map +7 -0
- package/dist/features/textures/lib/simulation.d.ts +16 -0
- package/dist/features/textures/lib/simulation.js +85 -0
- package/dist/features/textures/lib/simulation.js.map +7 -0
- package/dist/features/textures/lib/tendrils.d.ts +57 -0
- package/dist/features/textures/lib/tendrils.js +216 -0
- package/dist/features/textures/lib/tendrils.js.map +7 -0
- package/dist/features/textures/lib/wasm/cellular-bytes.d.ts +1 -0
- package/dist/features/textures/lib/wasm/cellular-bytes.js +5 -0
- package/dist/features/textures/lib/wasm/cellular-bytes.js.map +7 -0
- package/dist/features/textures/lib/wasm/electric.d.ts +88 -0
- package/dist/features/textures/lib/wasm/electric.js +299 -0
- package/dist/features/textures/lib/wasm/electric.js.map +7 -0
- package/dist/features/textures/lib/wasm/ink-bytes.d.ts +1 -0
- package/dist/features/textures/lib/wasm/ink-bytes.js +5 -0
- package/dist/features/textures/lib/wasm/ink-bytes.js.map +7 -0
- package/dist/features/textures/lib/wasm/lightning-bytes.d.ts +1 -0
- package/dist/features/textures/lib/wasm/lightning-bytes.js +5 -0
- package/dist/features/textures/lib/wasm/lightning-bytes.js.map +7 -0
- package/dist/features/textures/lib/wasm/marble-bytes.d.ts +1 -0
- package/dist/features/textures/lib/wasm/marble-bytes.js +5 -0
- package/dist/features/textures/lib/wasm/marble-bytes.js.map +7 -0
- package/dist/features/textures/lib/wasm/memory.d.ts +31 -0
- package/dist/features/textures/lib/wasm/memory.js +103 -0
- package/dist/features/textures/lib/wasm/memory.js.map +7 -0
- package/dist/features/textures/lib/wasm/paper-bytes.d.ts +1 -0
- package/dist/features/textures/lib/wasm/paper-bytes.js +5 -0
- package/dist/features/textures/lib/wasm/paper-bytes.js.map +7 -0
- package/dist/features/textures/lib/wasm/tendrils-bytes.d.ts +1 -0
- package/dist/features/textures/lib/wasm/tendrils-bytes.js +5 -0
- package/dist/features/textures/lib/wasm/tendrils-bytes.js.map +7 -0
- package/dist/features/textures/lib/wasm/water-surface-bytes.d.ts +1 -0
- package/dist/features/textures/lib/wasm/water-surface-bytes.js +5 -0
- package/dist/features/textures/lib/wasm/water-surface-bytes.js.map +7 -0
- package/dist/features/textures/lib/wasm/water-waves-bytes.d.ts +1 -0
- package/dist/features/textures/lib/wasm/water-waves-bytes.js +5 -0
- package/dist/features/textures/lib/wasm/water-waves-bytes.js.map +7 -0
- package/dist/features/textures/lib/water-surface.d.ts +92 -0
- package/dist/features/textures/lib/water-surface.js +378 -0
- package/dist/features/textures/lib/water-surface.js.map +7 -0
- package/dist/features/textures/lib/water-waves.d.ts +60 -0
- package/dist/features/textures/lib/water-waves.js +154 -0
- package/dist/features/textures/lib/water-waves.js.map +7 -0
- package/dist/features/viz/index.d.ts +28 -0
- package/dist/features/viz/index.js +45 -0
- package/dist/features/viz/index.js.map +7 -0
- package/dist/features/viz/index.mjs +1 -0
- package/dist/features/viz/lib/anchored-layout.d.ts +104 -0
- package/dist/features/viz/lib/anchored-layout.js +166 -0
- package/dist/features/viz/lib/anchored-layout.js.map +7 -0
- package/dist/features/viz/lib/axis.d.ts +10 -0
- package/dist/features/viz/lib/axis.js +116 -0
- package/dist/features/viz/lib/axis.js.map +7 -0
- package/dist/features/viz/lib/band-scale.d.ts +3 -0
- package/dist/features/viz/lib/band-scale.js +57 -0
- package/dist/features/viz/lib/band-scale.js.map +7 -0
- package/dist/features/viz/lib/bar-fill.d.ts +16 -0
- package/dist/features/viz/lib/bar-fill.js +53 -0
- package/dist/features/viz/lib/bar-fill.js.map +7 -0
- package/dist/features/viz/lib/bar-series.d.ts +150 -0
- package/dist/features/viz/lib/bar-series.js +152 -0
- package/dist/features/viz/lib/bar-series.js.map +7 -0
- package/dist/features/viz/lib/hover-card.d.ts +92 -0
- package/dist/features/viz/lib/hover-card.js +146 -0
- package/dist/features/viz/lib/hover-card.js.map +7 -0
- package/dist/features/viz/lib/hover-data.d.ts +12 -0
- package/dist/features/viz/lib/hover-data.js +50 -0
- package/dist/features/viz/lib/hover-data.js.map +7 -0
- package/dist/features/viz/lib/hover-placement.d.ts +46 -0
- package/dist/features/viz/lib/hover-placement.js +51 -0
- package/dist/features/viz/lib/hover-placement.js.map +7 -0
- package/dist/features/viz/lib/hover-queries.d.ts +60 -0
- package/dist/features/viz/lib/hover-queries.js +185 -0
- package/dist/features/viz/lib/hover-queries.js.map +7 -0
- package/dist/features/viz/lib/hover-types.d.ts +277 -0
- package/dist/features/viz/lib/layout-pie.d.ts +13 -0
- package/dist/features/viz/lib/layout-pie.js +159 -0
- package/dist/features/viz/lib/layout-pie.js.map +7 -0
- package/dist/features/viz/lib/line-series.d.ts +11 -0
- package/dist/features/viz/lib/line-series.js +89 -0
- package/dist/features/viz/lib/line-series.js.map +7 -0
- package/dist/features/viz/lib/linear-scale.d.ts +3 -0
- package/dist/features/viz/lib/linear-scale.js +70 -0
- package/dist/features/viz/lib/linear-scale.js.map +7 -0
- package/dist/features/viz/lib/nearest.d.ts +82 -0
- package/dist/features/viz/lib/nearest.js +51 -0
- package/dist/features/viz/lib/nearest.js.map +7 -0
- package/dist/features/viz/lib/paint.d.ts +2 -0
- package/dist/features/viz/lib/paint.js +17 -0
- package/dist/features/viz/lib/paint.js.map +7 -0
- package/dist/features/viz/lib/pie-layout.d.ts +31 -0
- package/dist/features/viz/lib/pie-layout.js +324 -0
- package/dist/features/viz/lib/pie-layout.js.map +7 -0
- package/dist/features/viz/lib/pie-slices.d.ts +51 -0
- package/dist/features/viz/lib/pie-slices.js +50 -0
- package/dist/features/viz/lib/pie-slices.js.map +7 -0
- package/dist/features/viz/lib/pie-types.d.ts +215 -0
- package/dist/features/viz/lib/plot-series.d.ts +13 -0
- package/dist/features/viz/lib/plot-series.js +53 -0
- package/dist/features/viz/lib/plot-series.js.map +7 -0
- package/dist/features/viz/lib/plot-types.d.ts +63 -0
- package/dist/features/viz/lib/point-data.d.ts +5 -0
- package/dist/features/viz/lib/point-data.js +17 -0
- package/dist/features/viz/lib/point-data.js.map +7 -0
- package/dist/features/viz/lib/point-geometry.d.ts +2 -0
- package/dist/features/viz/lib/point-geometry.js +24 -0
- package/dist/features/viz/lib/point-geometry.js.map +7 -0
- package/dist/features/viz/lib/point-series.d.ts +11 -0
- package/dist/features/viz/lib/point-series.js +118 -0
- package/dist/features/viz/lib/point-series.js.map +7 -0
- package/dist/features/viz/lib/point-types.d.ts +94 -0
- package/dist/features/viz/lib/scale-adjust.d.ts +11 -0
- package/dist/features/viz/lib/scale-adjust.js +25 -0
- package/dist/features/viz/lib/scale-adjust.js.map +7 -0
- package/dist/features/viz/lib/scale-context.d.ts +8 -0
- package/dist/features/viz/lib/scale-context.js +61 -0
- package/dist/features/viz/lib/scale-context.js.map +7 -0
- package/dist/features/viz/lib/scale.d.ts +11 -0
- package/dist/features/viz/lib/scale.js +80 -0
- package/dist/features/viz/lib/scale.js.map +7 -0
- package/dist/features/viz/lib/types.d.ts +414 -0
- package/dist/features/viz/lib/use-scale.d.ts +20 -0
- package/dist/features/viz/lib/use-scale.js +10 -0
- package/dist/features/viz/lib/use-scale.js.map +7 -0
- package/dist/filters/displacement-gpu.d.ts +38 -0
- package/dist/filters/displacement-gpu.js +243 -0
- package/dist/filters/displacement-gpu.js.map +7 -0
- package/dist/filters/displacement-math.d.ts +5 -0
- package/dist/filters/displacement-math.js +22 -0
- package/dist/filters/displacement-math.js.map +7 -0
- package/dist/filters/displacement.d.ts +13 -0
- package/dist/filters/displacement.js +65 -0
- package/dist/filters/displacement.js.map +7 -0
- package/dist/filters/filter-executor.d.ts +21 -0
- package/dist/filters/filter-executor.js +120 -0
- package/dist/filters/filter-executor.js.map +7 -0
- package/dist/filters/native-canvas-filter.d.ts +4 -0
- package/dist/filters/native-canvas-filter.js +105 -0
- package/dist/filters/native-canvas-filter.js.map +7 -0
- package/dist/filters/native-color.d.ts +2 -0
- package/dist/filters/native-color.js +200 -0
- package/dist/filters/native-color.js.map +7 -0
- package/dist/filters/native-operations.d.ts +8 -0
- package/dist/filters/native-operations.js +7 -0
- package/dist/filters/native-operations.js.map +7 -0
- package/dist/filters/native.d.ts +113 -0
- package/dist/filters/native.js +115 -0
- package/dist/filters/native.js.map +7 -0
- package/dist/filters/reflected-light.d.ts +12 -0
- package/dist/filters/reflected-light.js +93 -0
- package/dist/filters/reflected-light.js.map +7 -0
- package/dist/filters/reflection-gpu.d.ts +58 -0
- package/dist/filters/reflection-gpu.js +266 -0
- package/dist/filters/reflection-gpu.js.map +7 -0
- package/dist/filters/render-displacement-boundary.d.ts +12 -0
- package/dist/filters/render-displacement-boundary.js +116 -0
- package/dist/filters/render-displacement-boundary.js.map +7 -0
- package/dist/filters/render-reflection-boundary.d.ts +15 -0
- package/dist/filters/render-reflection-boundary.js +127 -0
- package/dist/filters/render-reflection-boundary.js.map +7 -0
- package/dist/filters.d.ts +5 -0
- package/dist/filters.js +29 -0
- package/dist/filters.js.map +7 -0
- package/dist/filters.mjs +1 -0
- package/dist/index.d.ts +111 -0
- package/dist/index.js +300 -0
- package/dist/index.js.map +7 -0
- package/dist/index.mjs +1 -0
- package/dist/internal.d.ts +160 -0
- package/dist/internal.js +320 -0
- package/dist/internal.js.map +7 -0
- package/dist/internal.mjs +1 -0
- package/dist/jsx-dev-runtime.d.ts +35 -0
- package/dist/jsx-dev-runtime.js +6 -0
- package/dist/jsx-dev-runtime.js.map +7 -0
- package/dist/jsx-dev-runtime.mjs +1 -0
- package/dist/jsx-runtime.d.ts +35 -0
- package/dist/jsx-runtime.js +7 -0
- package/dist/jsx-runtime.js.map +7 -0
- package/dist/jsx-runtime.mjs +1 -0
- package/dist/lib/animation/definition.d.ts +140 -0
- package/dist/lib/animation/definition.js +605 -0
- package/dist/lib/animation/definition.js.map +7 -0
- package/dist/lib/animation/easing.d.ts +55 -0
- package/dist/lib/animation/easing.js +112 -0
- package/dist/lib/animation/easing.js.map +7 -0
- package/dist/lib/animation/evaluate.d.ts +118 -0
- package/dist/lib/animation/evaluate.js +2398 -0
- package/dist/lib/animation/evaluate.js.map +7 -0
- package/dist/lib/animation/playback.d.ts +30 -0
- package/dist/lib/animation/playback.js +932 -0
- package/dist/lib/animation/playback.js.map +7 -0
- package/dist/lib/animation/program.d.ts +145 -0
- package/dist/lib/animation/program.js +741 -0
- package/dist/lib/animation/program.js.map +7 -0
- package/dist/lib/animation/spring.d.ts +30 -0
- package/dist/lib/animation/spring.js +324 -0
- package/dist/lib/animation/spring.js.map +7 -0
- package/dist/lib/animation/types.d.ts +418 -0
- package/dist/lib/animation/writer-leases.d.ts +47 -0
- package/dist/lib/animation/writer-leases.js +314 -0
- package/dist/lib/animation/writer-leases.js.map +7 -0
- package/dist/lib/backend/canvas-2d-backend.d.ts +4 -0
- package/dist/lib/backend/canvas-2d-backend.js +97 -0
- package/dist/lib/backend/canvas-2d-backend.js.map +7 -0
- package/dist/lib/backend/types.d.ts +309 -0
- package/dist/lib/backend/types.js +26 -0
- package/dist/lib/backend/types.js.map +7 -0
- package/dist/lib/components/arc-geometry.d.ts +4 -0
- package/dist/lib/components/arc-geometry.js +46 -0
- package/dist/lib/components/arc-geometry.js.map +7 -0
- package/dist/lib/components/arc.d.ts +55 -0
- package/dist/lib/components/arc.js +91 -0
- package/dist/lib/components/arc.js.map +7 -0
- package/dist/lib/components/circle.d.ts +49 -0
- package/dist/lib/components/circle.js +46 -0
- package/dist/lib/components/circle.js.map +7 -0
- package/dist/lib/components/clip.d.ts +43 -0
- package/dist/lib/components/clip.js +24 -0
- package/dist/lib/components/clip.js.map +7 -0
- package/dist/lib/components/ellipse.d.ts +53 -0
- package/dist/lib/components/ellipse.js +59 -0
- package/dist/lib/components/ellipse.js.map +7 -0
- package/dist/lib/components/g.d.ts +56 -0
- package/dist/lib/components/g.js +24 -0
- package/dist/lib/components/g.js.map +7 -0
- package/dist/lib/components/horizontal-line.d.ts +56 -0
- package/dist/lib/components/horizontal-line.js +71 -0
- package/dist/lib/components/horizontal-line.js.map +7 -0
- package/dist/lib/components/html-box.d.ts +16 -0
- package/dist/lib/components/html-box.js +57 -0
- package/dist/lib/components/html-box.js.map +7 -0
- package/dist/lib/components/img.d.ts +24 -0
- package/dist/lib/components/img.js +150 -0
- package/dist/lib/components/img.js.map +7 -0
- package/dist/lib/components/layer-node-equality.d.ts +65 -0
- package/dist/lib/components/layer-node-equality.js +91 -0
- package/dist/lib/components/layer-node-equality.js.map +7 -0
- package/dist/lib/components/layer.d.ts +34 -0
- package/dist/lib/components/layer.js +172 -0
- package/dist/lib/components/layer.js.map +7 -0
- package/dist/lib/components/line.d.ts +51 -0
- package/dist/lib/components/line.js +76 -0
- package/dist/lib/components/line.js.map +7 -0
- package/dist/lib/components/path.d.ts +28 -0
- package/dist/lib/components/path.js +47 -0
- package/dist/lib/components/path.js.map +7 -0
- package/dist/lib/components/polygon.d.ts +45 -0
- package/dist/lib/components/polygon.js +93 -0
- package/dist/lib/components/polygon.js.map +7 -0
- package/dist/lib/components/rect.d.ts +24 -0
- package/dist/lib/components/rect.js +83 -0
- package/dist/lib/components/rect.js.map +7 -0
- package/dist/lib/components/regular-polygon.d.ts +102 -0
- package/dist/lib/components/regular-polygon.js +112 -0
- package/dist/lib/components/regular-polygon.js.map +7 -0
- package/dist/lib/components/rounded-corner-style.d.ts +7 -0
- package/dist/lib/components/rounded-corner-style.js +40 -0
- package/dist/lib/components/rounded-corner-style.js.map +7 -0
- package/dist/lib/components/shape-style.d.ts +7 -0
- package/dist/lib/components/shape-style.js +52 -0
- package/dist/lib/components/shape-style.js.map +7 -0
- package/dist/lib/components/star.d.ts +56 -0
- package/dist/lib/components/star.js +98 -0
- package/dist/lib/components/star.js.map +7 -0
- package/dist/lib/components/structural-events.d.ts +10 -0
- package/dist/lib/components/structural-events.js +8 -0
- package/dist/lib/components/structural-events.js.map +7 -0
- package/dist/lib/components/svg-path.d.ts +23 -0
- package/dist/lib/components/svg-path.js +25 -0
- package/dist/lib/components/svg-path.js.map +7 -0
- package/dist/lib/components/text-layout.d.ts +31 -0
- package/dist/lib/components/text-layout.js +139 -0
- package/dist/lib/components/text-layout.js.map +7 -0
- package/dist/lib/components/text.d.ts +29 -0
- package/dist/lib/components/text.js +174 -0
- package/dist/lib/components/text.js.map +7 -0
- package/dist/lib/components/vertical-line.d.ts +57 -0
- package/dist/lib/components/vertical-line.js +71 -0
- package/dist/lib/components/vertical-line.js.map +7 -0
- package/dist/lib/components/wedge.d.ts +55 -0
- package/dist/lib/components/wedge.js +93 -0
- package/dist/lib/components/wedge.js.map +7 -0
- package/dist/lib/define-primitive.d.ts +82 -0
- package/dist/lib/define-primitive.js +85 -0
- package/dist/lib/define-primitive.js.map +7 -0
- package/dist/lib/development.d.ts +2 -0
- package/dist/lib/development.js +5 -0
- package/dist/lib/development.js.map +7 -0
- package/dist/lib/element/children.d.ts +16 -0
- package/dist/lib/element/children.js +333 -0
- package/dist/lib/element/children.js.map +7 -0
- package/dist/lib/element/create-element.d.ts +34 -0
- package/dist/lib/element/create-element.js +75 -0
- package/dist/lib/element/create-element.js.map +7 -0
- package/dist/lib/element/fragment.d.ts +15 -0
- package/dist/lib/element/fragment.js +11 -0
- package/dist/lib/element/fragment.js.map +7 -0
- package/dist/lib/element/jsx-runtime.d.ts +48 -0
- package/dist/lib/element/jsx-runtime.js +16 -0
- package/dist/lib/element/jsx-runtime.js.map +7 -0
- package/dist/lib/element/metadata.d.ts +96 -0
- package/dist/lib/element/metadata.js +160 -0
- package/dist/lib/element/metadata.js.map +7 -0
- package/dist/lib/element/resolve-primitive-inputs.d.ts +12 -0
- package/dist/lib/element/resolve-primitive-inputs.js +83 -0
- package/dist/lib/element/resolve-primitive-inputs.js.map +7 -0
- package/dist/lib/element/types.d.ts +123 -0
- package/dist/lib/element-enhancers.d.ts +134 -0
- package/dist/lib/element-enhancers.js +193 -0
- package/dist/lib/element-enhancers.js.map +7 -0
- package/dist/lib/events/adapters/clipboard.d.ts +9 -0
- package/dist/lib/events/adapters/clipboard.js +23 -0
- package/dist/lib/events/adapters/clipboard.js.map +7 -0
- package/dist/lib/events/adapters/drag.d.ts +12 -0
- package/dist/lib/events/adapters/drag.js +29 -0
- package/dist/lib/events/adapters/drag.js.map +7 -0
- package/dist/lib/events/adapters/editing.d.ts +15 -0
- package/dist/lib/events/adapters/editing.js +41 -0
- package/dist/lib/events/adapters/editing.js.map +7 -0
- package/dist/lib/events/adapters/keyboard-focus.d.ts +12 -0
- package/dist/lib/events/adapters/keyboard-focus.js +36 -0
- package/dist/lib/events/adapters/keyboard-focus.js.map +7 -0
- package/dist/lib/events/adapters/mouse.d.ts +17 -0
- package/dist/lib/events/adapters/mouse.js +32 -0
- package/dist/lib/events/adapters/mouse.js.map +7 -0
- package/dist/lib/events/adapters/pointer.d.ts +19 -0
- package/dist/lib/events/adapters/pointer.js +40 -0
- package/dist/lib/events/adapters/pointer.js.map +7 -0
- package/dist/lib/events/adapters/touch.d.ts +16 -0
- package/dist/lib/events/adapters/touch.js +36 -0
- package/dist/lib/events/adapters/touch.js.map +7 -0
- package/dist/lib/events/adapters/wheel.d.ts +10 -0
- package/dist/lib/events/adapters/wheel.js +16 -0
- package/dist/lib/events/adapters/wheel.js.map +7 -0
- package/dist/lib/events/boundary-transitions.d.ts +9 -0
- package/dist/lib/events/boundary-transitions.js +16 -0
- package/dist/lib/events/boundary-transitions.js.map +7 -0
- package/dist/lib/events/dispatch.d.ts +21 -0
- package/dist/lib/events/dispatch.js +1078 -0
- package/dist/lib/events/dispatch.js.map +7 -0
- package/dist/lib/events/event-definitions.d.ts +23 -0
- package/dist/lib/events/event-definitions.js +74 -0
- package/dist/lib/events/event-definitions.js.map +7 -0
- package/dist/lib/events/event-facade.d.ts +19 -0
- package/dist/lib/events/event-facade.js +188 -0
- package/dist/lib/events/event-facade.js.map +7 -0
- package/dist/lib/events/event-path.d.ts +3 -0
- package/dist/lib/events/event-path.js +43 -0
- package/dist/lib/events/event-path.js.map +7 -0
- package/dist/lib/events/hit-test.d.ts +13 -0
- package/dist/lib/events/hit-test.js +135 -0
- package/dist/lib/events/hit-test.js.map +7 -0
- package/dist/lib/events/native-listener-hub.d.ts +10 -0
- package/dist/lib/events/native-listener-hub.js +72 -0
- package/dist/lib/events/native-listener-hub.js.map +7 -0
- package/dist/lib/events/paint-entry.d.ts +66 -0
- package/dist/lib/events/paint-entry.js +30 -0
- package/dist/lib/events/paint-entry.js.map +7 -0
- package/dist/lib/events/pointer-capture.d.ts +23 -0
- package/dist/lib/events/pointer-capture.js +339 -0
- package/dist/lib/events/pointer-capture.js.map +7 -0
- package/dist/lib/events/propagation.d.ts +7 -0
- package/dist/lib/events/propagation.js +56 -0
- package/dist/lib/events/propagation.js.map +7 -0
- package/dist/lib/events/registrations.d.ts +120 -0
- package/dist/lib/events/registrations.js +397 -0
- package/dist/lib/events/registrations.js.map +7 -0
- package/dist/lib/events/resolver-input.d.ts +25 -0
- package/dist/lib/events/resolver-input.js +62 -0
- package/dist/lib/events/resolver-input.js.map +7 -0
- package/dist/lib/events/types.d.ts +596 -0
- package/dist/lib/execute-render.d.ts +9 -0
- package/dist/lib/execute-render.js +195 -0
- package/dist/lib/execute-render.js.map +7 -0
- package/dist/lib/filter/canvas-state.d.ts +2 -0
- package/dist/lib/filter/canvas-state.js +31 -0
- package/dist/lib/filter/canvas-state.js.map +7 -0
- package/dist/lib/filter/filter-region.d.ts +33 -0
- package/dist/lib/filter/filter-region.js +291 -0
- package/dist/lib/filter/filter-region.js.map +7 -0
- package/dist/lib/filter/filter-surface-pool.d.ts +38 -0
- package/dist/lib/filter/filter-surface-pool.js +252 -0
- package/dist/lib/filter/filter-surface-pool.js.map +7 -0
- package/dist/lib/filter/render-filter-boundary.d.ts +14 -0
- package/dist/lib/filter/render-filter-boundary.js +211 -0
- package/dist/lib/filter/render-filter-boundary.js.map +7 -0
- package/dist/lib/focus/directional-navigation.d.ts +12 -0
- package/dist/lib/focus/directional-navigation.js +86 -0
- package/dist/lib/focus/directional-navigation.js.map +7 -0
- package/dist/lib/focus/dom-focus-host.d.ts +13 -0
- package/dist/lib/focus/dom-focus-host.js +352 -0
- package/dist/lib/focus/dom-focus-host.js.map +7 -0
- package/dist/lib/focus/dom-tab-stops.d.ts +3 -0
- package/dist/lib/focus/dom-tab-stops.js +71 -0
- package/dist/lib/focus/dom-tab-stops.js.map +7 -0
- package/dist/lib/focus/focus-events.d.ts +4 -0
- package/dist/lib/focus/focus-events.js +78 -0
- package/dist/lib/focus/focus-events.js.map +7 -0
- package/dist/lib/focus/focus-manager.d.ts +121 -0
- package/dist/lib/focus/focus-manager.js +1131 -0
- package/dist/lib/focus/focus-manager.js.map +7 -0
- package/dist/lib/focus/geometry.d.ts +4 -0
- package/dist/lib/focus/geometry.js +64 -0
- package/dist/lib/focus/geometry.js.map +7 -0
- package/dist/lib/focus/html-focus-region.d.ts +27 -0
- package/dist/lib/focus/keyboard-defaults.d.ts +7 -0
- package/dist/lib/focus/keyboard-defaults.js +110 -0
- package/dist/lib/focus/keyboard-defaults.js.map +7 -0
- package/dist/lib/focus/policy-components.d.ts +45 -0
- package/dist/lib/focus/policy-components.js +94 -0
- package/dist/lib/focus/policy-components.js.map +7 -0
- package/dist/lib/focus/types.d.ts +37 -0
- package/dist/lib/focus/types.js +7 -0
- package/dist/lib/focus/types.js.map +7 -0
- package/dist/lib/geometry/circle.d.ts +22 -0
- package/dist/lib/geometry/circle.js +13 -0
- package/dist/lib/geometry/circle.js.map +7 -0
- package/dist/lib/geometry/circular-sweep.d.ts +54 -0
- package/dist/lib/geometry/circular-sweep.js +95 -0
- package/dist/lib/geometry/circular-sweep.js.map +7 -0
- package/dist/lib/geometry/ellipse.d.ts +26 -0
- package/dist/lib/geometry/ellipse.js +17 -0
- package/dist/lib/geometry/ellipse.js.map +7 -0
- package/dist/lib/geometry/line.d.ts +20 -0
- package/dist/lib/geometry/line.js +15 -0
- package/dist/lib/geometry/line.js.map +7 -0
- package/dist/lib/geometry/path-arc.d.ts +25 -0
- package/dist/lib/geometry/path-arc.js +57 -0
- package/dist/lib/geometry/path-arc.js.map +7 -0
- package/dist/lib/geometry/path-bend-guide.d.ts +31 -0
- package/dist/lib/geometry/path-bend-guide.js +282 -0
- package/dist/lib/geometry/path-bend-guide.js.map +7 -0
- package/dist/lib/geometry/path-bend-spans.d.ts +31 -0
- package/dist/lib/geometry/path-bend-spans.js +109 -0
- package/dist/lib/geometry/path-bend-spans.js.map +7 -0
- package/dist/lib/geometry/path-bending.d.ts +90 -0
- package/dist/lib/geometry/path-bending.js +202 -0
- package/dist/lib/geometry/path-bending.js.map +7 -0
- package/dist/lib/geometry/path-conversion.d.ts +19 -0
- package/dist/lib/geometry/path-conversion.js +114 -0
- package/dist/lib/geometry/path-conversion.js.map +7 -0
- package/dist/lib/geometry/path-geometry.d.ts +218 -0
- package/dist/lib/geometry/path-geometry.js +557 -0
- package/dist/lib/geometry/path-geometry.js.map +7 -0
- package/dist/lib/geometry/path-radial.d.ts +15 -0
- package/dist/lib/geometry/path-radial.js +107 -0
- package/dist/lib/geometry/path-radial.js.map +7 -0
- package/dist/lib/geometry/path-transforms.d.ts +233 -0
- package/dist/lib/geometry/path-transforms.js +478 -0
- package/dist/lib/geometry/path-transforms.js.map +7 -0
- package/dist/lib/geometry/path-utilities.d.ts +78 -0
- package/dist/lib/geometry/path-utilities.js +341 -0
- package/dist/lib/geometry/path-utilities.js.map +7 -0
- package/dist/lib/geometry/path-wang.d.ts +18 -0
- package/dist/lib/geometry/path-wang.js +136 -0
- package/dist/lib/geometry/path-wang.js.map +7 -0
- package/dist/lib/geometry/path-warp-bezier.d.ts +17 -0
- package/dist/lib/geometry/path-warp-bezier.js +109 -0
- package/dist/lib/geometry/path-warp-bezier.js.map +7 -0
- package/dist/lib/geometry/path-warp.d.ts +27 -0
- package/dist/lib/geometry/path-warp.js +165 -0
- package/dist/lib/geometry/path-warp.js.map +7 -0
- package/dist/lib/geometry/polygon.d.ts +21 -0
- package/dist/lib/geometry/polygon.js +12 -0
- package/dist/lib/geometry/polygon.js.map +7 -0
- package/dist/lib/geometry/rectangle.d.ts +38 -0
- package/dist/lib/geometry/rectangle.js +22 -0
- package/dist/lib/geometry/rectangle.js.map +7 -0
- package/dist/lib/geometry/regular-polygon.d.ts +88 -0
- package/dist/lib/geometry/regular-polygon.js +67 -0
- package/dist/lib/geometry/regular-polygon.js.map +7 -0
- package/dist/lib/geometry/resolve-path.d.ts +4 -0
- package/dist/lib/geometry/resolve-path.js +16 -0
- package/dist/lib/geometry/resolve-path.js.map +7 -0
- package/dist/lib/geometry/rounded-corners.d.ts +28 -0
- package/dist/lib/geometry/rounded-corners.js +118 -0
- package/dist/lib/geometry/rounded-corners.js.map +7 -0
- package/dist/lib/geometry/star.d.ts +39 -0
- package/dist/lib/geometry/star.js +90 -0
- package/dist/lib/geometry/star.js.map +7 -0
- package/dist/lib/geometry/svg-path.d.ts +21 -0
- package/dist/lib/geometry/svg-path.js +7 -0
- package/dist/lib/geometry/svg-path.js.map +7 -0
- package/dist/lib/geometry/transform-bend.d.ts +46 -0
- package/dist/lib/geometry/transform-bend.js +219 -0
- package/dist/lib/geometry/transform-bend.js.map +7 -0
- package/dist/lib/geometry/transform-guide.d.ts +57 -0
- package/dist/lib/geometry/transform-guide.js +157 -0
- package/dist/lib/geometry/transform-guide.js.map +7 -0
- package/dist/lib/geometry/transform-math.d.ts +21 -0
- package/dist/lib/geometry/transform-math.js +91 -0
- package/dist/lib/geometry/transform-math.js.map +7 -0
- package/dist/lib/geometry/transform-mesh.d.ts +39 -0
- package/dist/lib/geometry/transform-mesh.js +129 -0
- package/dist/lib/geometry/transform-mesh.js.map +7 -0
- package/dist/lib/geometry/validation.d.ts +6 -0
- package/dist/lib/geometry/validation.js +42 -0
- package/dist/lib/geometry/validation.js.map +7 -0
- package/dist/lib/global-state.d.ts +63 -0
- package/dist/lib/global-state.js +176 -0
- package/dist/lib/global-state.js.map +7 -0
- package/dist/lib/hooks/hook-slot.d.ts +30 -0
- package/dist/lib/hooks/hook-slot.js +66 -0
- package/dist/lib/hooks/hook-slot.js.map +7 -0
- package/dist/lib/hooks/use-animated-value.d.ts +24 -0
- package/dist/lib/hooks/use-animated-value.js +169 -0
- package/dist/lib/hooks/use-animated-value.js.map +7 -0
- package/dist/lib/hooks/use-canvas-context.d.ts +10 -0
- package/dist/lib/hooks/use-canvas-context.js +13 -0
- package/dist/lib/hooks/use-canvas-context.js.map +7 -0
- package/dist/lib/hooks/use-computed.d.ts +13 -0
- package/dist/lib/hooks/use-computed.js +91 -0
- package/dist/lib/hooks/use-computed.js.map +7 -0
- package/dist/lib/hooks/use-const.d.ts +10 -0
- package/dist/lib/hooks/use-const.js +15 -0
- package/dist/lib/hooks/use-const.js.map +7 -0
- package/dist/lib/hooks/use-cursor.d.ts +16 -0
- package/dist/lib/hooks/use-cursor.js +51 -0
- package/dist/lib/hooks/use-cursor.js.map +7 -0
- package/dist/lib/hooks/use-event-listener.d.ts +10 -0
- package/dist/lib/hooks/use-event-listener.js +24 -0
- package/dist/lib/hooks/use-event-listener.js.map +7 -0
- package/dist/lib/hooks/use-event-target.d.ts +14 -0
- package/dist/lib/hooks/use-event-target.js +30 -0
- package/dist/lib/hooks/use-event-target.js.map +7 -0
- package/dist/lib/hooks/use-layout-box.d.ts +9 -0
- package/dist/lib/hooks/use-layout-box.js +8 -0
- package/dist/lib/hooks/use-layout-box.js.map +7 -0
- package/dist/lib/hooks/use-line-path.d.ts +14 -0
- package/dist/lib/hooks/use-line-path.js +13 -0
- package/dist/lib/hooks/use-line-path.js.map +7 -0
- package/dist/lib/hooks/use-paint-target.d.ts +3 -0
- package/dist/lib/hooks/use-paint-target.js +34 -0
- package/dist/lib/hooks/use-paint-target.js.map +7 -0
- package/dist/lib/hooks/use-playback.d.ts +21 -0
- package/dist/lib/hooks/use-playback.js +87 -0
- package/dist/lib/hooks/use-playback.js.map +7 -0
- package/dist/lib/hooks/use-reaction.d.ts +19 -0
- package/dist/lib/hooks/use-reaction.js +245 -0
- package/dist/lib/hooks/use-reaction.js.map +7 -0
- package/dist/lib/hooks/use-rect-path.d.ts +20 -0
- package/dist/lib/hooks/use-rect-path.js +25 -0
- package/dist/lib/hooks/use-rect-path.js.map +7 -0
- package/dist/lib/hooks/use-ref.d.ts +17 -0
- package/dist/lib/hooks/use-ref.js +8 -0
- package/dist/lib/hooks/use-ref.js.map +7 -0
- package/dist/lib/hooks/use-region.d.ts +11 -0
- package/dist/lib/hooks/use-region.js +34 -0
- package/dist/lib/hooks/use-region.js.map +7 -0
- package/dist/lib/hooks/use-signal.d.ts +12 -0
- package/dist/lib/hooks/use-signal.js +12 -0
- package/dist/lib/hooks/use-signal.js.map +7 -0
- package/dist/lib/hooks/use-svg-path.d.ts +11 -0
- package/dist/lib/hooks/use-svg-path.js +13 -0
- package/dist/lib/hooks/use-svg-path.js.map +7 -0
- package/dist/lib/hooks/use-value-memo-slot.d.ts +12 -0
- package/dist/lib/hooks/use-value-memo-slot.js +45 -0
- package/dist/lib/hooks/use-value-memo-slot.js.map +7 -0
- package/dist/lib/hooks/use-visibility-transition.d.ts +103 -0
- package/dist/lib/hooks/use-visibility-transition.js +195 -0
- package/dist/lib/hooks/use-visibility-transition.js.map +7 -0
- package/dist/lib/html/html-service.d.ts +30 -0
- package/dist/lib/html/html-service.js +281 -0
- package/dist/lib/html/html-service.js.map +7 -0
- package/dist/lib/html/overlay-config.d.ts +3 -0
- package/dist/lib/html/overlay-config.js +37 -0
- package/dist/lib/html/overlay-config.js.map +7 -0
- package/dist/lib/html/portable-clips.d.ts +4 -0
- package/dist/lib/html/portable-clips.js +20 -0
- package/dist/lib/html/portable-clips.js.map +7 -0
- package/dist/lib/html/types.d.ts +110 -0
- package/dist/lib/layout/absolute.d.ts +57 -0
- package/dist/lib/layout/absolute.js +348 -0
- package/dist/lib/layout/absolute.js.map +7 -0
- package/dist/lib/layout/box.d.ts +19 -0
- package/dist/lib/layout/box.js +209 -0
- package/dist/lib/layout/box.js.map +7 -0
- package/dist/lib/layout/context.d.ts +13 -0
- package/dist/lib/layout/context.js +42 -0
- package/dist/lib/layout/context.js.map +7 -0
- package/dist/lib/layout/diagnostics.d.ts +15 -0
- package/dist/lib/layout/diagnostics.js +30 -0
- package/dist/lib/layout/diagnostics.js.map +7 -0
- package/dist/lib/layout/flex.d.ts +64 -0
- package/dist/lib/layout/flex.js +803 -0
- package/dist/lib/layout/flex.js.map +7 -0
- package/dist/lib/layout/flow.d.ts +53 -0
- package/dist/lib/layout/flow.js +400 -0
- package/dist/lib/layout/flow.js.map +7 -0
- package/dist/lib/layout/grid.d.ts +64 -0
- package/dist/lib/layout/grid.js +597 -0
- package/dist/lib/layout/grid.js.map +7 -0
- package/dist/lib/layout/measure.d.ts +19 -0
- package/dist/lib/layout/measure.js +144 -0
- package/dist/lib/layout/measure.js.map +7 -0
- package/dist/lib/layout/overlay.d.ts +42 -0
- package/dist/lib/layout/overlay.js +151 -0
- package/dist/lib/layout/overlay.js.map +7 -0
- package/dist/lib/layout/place-child.d.ts +12 -0
- package/dist/lib/layout/place-child.js +72 -0
- package/dist/lib/layout/place-child.js.map +7 -0
- package/dist/lib/layout/positioning-diagnostics.d.ts +3 -0
- package/dist/lib/layout/positioning-diagnostics.js +15 -0
- package/dist/lib/layout/positioning-diagnostics.js.map +7 -0
- package/dist/lib/layout/types.d.ts +78 -0
- package/dist/lib/manipulation/controller-types.d.ts +299 -0
- package/dist/lib/manipulation/controller.d.ts +57 -0
- package/dist/lib/manipulation/controller.js +464 -0
- package/dist/lib/manipulation/controller.js.map +7 -0
- package/dist/lib/manipulation/coordinates.d.ts +9 -0
- package/dist/lib/manipulation/coordinates.js +55 -0
- package/dist/lib/manipulation/coordinates.js.map +7 -0
- package/dist/lib/manipulation/degrees.d.ts +10 -0
- package/dist/lib/manipulation/degrees.js +9 -0
- package/dist/lib/manipulation/degrees.js.map +7 -0
- package/dist/lib/manipulation/frame.d.ts +24 -0
- package/dist/lib/manipulation/frame.js +101 -0
- package/dist/lib/manipulation/frame.js.map +7 -0
- package/dist/lib/manipulation/geometry.d.ts +4 -0
- package/dist/lib/manipulation/geometry.js +26 -0
- package/dist/lib/manipulation/geometry.js.map +7 -0
- package/dist/lib/manipulation/handles.d.ts +298 -0
- package/dist/lib/manipulation/handles.js +598 -0
- package/dist/lib/manipulation/handles.js.map +7 -0
- package/dist/lib/manipulation/manipulable.d.ts +65 -0
- package/dist/lib/manipulation/manipulable.js +47 -0
- package/dist/lib/manipulation/manipulable.js.map +7 -0
- package/dist/lib/manipulation/ownership.d.ts +15 -0
- package/dist/lib/manipulation/ownership.js +80 -0
- package/dist/lib/manipulation/ownership.js.map +7 -0
- package/dist/lib/manipulation/snap.d.ts +6 -0
- package/dist/lib/manipulation/snap.js +40 -0
- package/dist/lib/manipulation/snap.js.map +7 -0
- package/dist/lib/manipulation/solve.d.ts +2 -0
- package/dist/lib/manipulation/solve.js +563 -0
- package/dist/lib/manipulation/solve.js.map +7 -0
- package/dist/lib/manipulation/types.d.ts +178 -0
- package/dist/lib/mount-pibbl.d.ts +25 -0
- package/dist/lib/mount-pibbl.js +278 -0
- package/dist/lib/mount-pibbl.js.map +7 -0
- package/dist/lib/optional-services.d.ts +8 -0
- package/dist/lib/optional-services.js +11 -0
- package/dist/lib/optional-services.js.map +7 -0
- package/dist/lib/pibbl.d.ts +17 -0
- package/dist/lib/pibbl.js +21 -0
- package/dist/lib/pibbl.js.map +7 -0
- package/dist/lib/primitive-presentation.d.ts +24 -0
- package/dist/lib/primitive-presentation.js +102 -0
- package/dist/lib/primitive-presentation.js.map +7 -0
- package/dist/lib/render-layer/controller.d.ts +67 -0
- package/dist/lib/render-layer/controller.js +603 -0
- package/dist/lib/render-layer/controller.js.map +7 -0
- package/dist/lib/render-layer/define-render-layer.d.ts +17 -0
- package/dist/lib/render-layer/define-render-layer.js +90 -0
- package/dist/lib/render-layer/define-render-layer.js.map +7 -0
- package/dist/lib/render-layer/types.d.ts +315 -0
- package/dist/lib/render-target.d.ts +27 -0
- package/dist/lib/render-target.js +118 -0
- package/dist/lib/render-target.js.map +7 -0
- package/dist/lib/render-transaction.d.ts +10 -0
- package/dist/lib/render-transaction.js +46 -0
- package/dist/lib/render-transaction.js.map +7 -0
- package/dist/lib/render.d.ts +3 -0
- package/dist/lib/render.js +385 -0
- package/dist/lib/render.js.map +7 -0
- package/dist/lib/scheduler/realm-scheduler.d.ts +52 -0
- package/dist/lib/scheduler/realm-scheduler.js +964 -0
- package/dist/lib/scheduler/realm-scheduler.js.map +7 -0
- package/dist/lib/scheduler/renderer-participant.d.ts +257 -0
- package/dist/lib/scheduler/renderer-participant.js +216 -0
- package/dist/lib/scheduler/renderer-participant.js.map +7 -0
- package/dist/lib/scheduler/simulation-participant.d.ts +103 -0
- package/dist/lib/scheduler/simulation-participant.js +229 -0
- package/dist/lib/scheduler/simulation-participant.js.map +7 -0
- package/dist/lib/scheduler/testing.d.ts +56 -0
- package/dist/lib/scheduler/testing.js +71 -0
- package/dist/lib/scheduler/testing.js.map +7 -0
- package/dist/lib/scheduler/types.d.ts +103 -0
- package/dist/lib/signals/edge.d.ts +44 -0
- package/dist/lib/signals/edge.js +245 -0
- package/dist/lib/signals/edge.js.map +7 -0
- package/dist/lib/signals/graph.d.ts +220 -0
- package/dist/lib/signals/graph.js +1035 -0
- package/dist/lib/signals/graph.js.map +7 -0
- package/dist/lib/signals/input-provision.d.ts +3 -0
- package/dist/lib/signals/input-provision.js +67 -0
- package/dist/lib/signals/input-provision.js.map +7 -0
- package/dist/lib/signals/render-consumer.d.ts +21 -0
- package/dist/lib/signals/render-consumer.js +218 -0
- package/dist/lib/signals/render-consumer.js.map +7 -0
- package/dist/lib/signals/resolve-signal-value.d.ts +10 -0
- package/dist/lib/signals/resolve-signal-value.js +17 -0
- package/dist/lib/signals/resolve-signal-value.js.map +7 -0
- package/dist/lib/signals/types.d.ts +80 -0
- package/dist/lib/style/diagnostics.d.ts +83 -0
- package/dist/lib/style/diagnostics.js +63 -0
- package/dist/lib/style/diagnostics.js.map +7 -0
- package/dist/lib/style/empty-style.d.ts +3 -0
- package/dist/lib/style/empty-style.js +5 -0
- package/dist/lib/style/empty-style.js.map +7 -0
- package/dist/lib/style/filter-types.d.ts +243 -0
- package/dist/lib/style/filter-types.js +5 -0
- package/dist/lib/style/filter-types.js.map +7 -0
- package/dist/lib/style/filter.d.ts +7 -0
- package/dist/lib/style/filter.js +50 -0
- package/dist/lib/style/filter.js.map +7 -0
- package/dist/lib/style/normalize.d.ts +18 -0
- package/dist/lib/style/normalize.js +50 -0
- package/dist/lib/style/normalize.js.map +7 -0
- package/dist/lib/style/positioning.d.ts +32 -0
- package/dist/lib/style/positioning.js +81 -0
- package/dist/lib/style/positioning.js.map +7 -0
- package/dist/lib/style/resolve-built-in.d.ts +6 -0
- package/dist/lib/style/resolve-built-in.js +58 -0
- package/dist/lib/style/resolve-built-in.js.map +7 -0
- package/dist/lib/style/resolve-dispatch.d.ts +20 -0
- package/dist/lib/style/resolve-dispatch.js +167 -0
- package/dist/lib/style/resolve-dispatch.js.map +7 -0
- package/dist/lib/style/resolve-length.d.ts +16 -0
- package/dist/lib/style/resolve-length.js +54 -0
- package/dist/lib/style/resolve-length.js.map +7 -0
- package/dist/lib/style/responsive.d.ts +31 -0
- package/dist/lib/style/responsive.js +172 -0
- package/dist/lib/style/responsive.js.map +7 -0
- package/dist/lib/style/types.d.ts +338 -0
- package/dist/lib/surface/resolve-surface.d.ts +4 -0
- package/dist/lib/surface/resolve-surface.js +184 -0
- package/dist/lib/surface/resolve-surface.js.map +7 -0
- package/dist/lib/surface/root-surface.d.ts +7 -0
- package/dist/lib/surface/root-surface.js +171 -0
- package/dist/lib/surface/root-surface.js.map +7 -0
- package/dist/lib/surface/transform.d.ts +4 -0
- package/dist/lib/surface/transform.js +16 -0
- package/dist/lib/surface/transform.js.map +7 -0
- package/dist/lib/surface/types.d.ts +132 -0
- package/dist/lib/teardowns.d.ts +14 -0
- package/dist/lib/teardowns.js +50 -0
- package/dist/lib/teardowns.js.map +7 -0
- package/dist/lib/textures/texture-protocol.d.ts +124 -0
- package/dist/lib/textures/texture-protocol.js +40 -0
- package/dist/lib/textures/texture-protocol.js.map +7 -0
- package/dist/lib/textures/texture.d.ts +170 -0
- package/dist/lib/textures/texture.js +385 -0
- package/dist/lib/textures/texture.js.map +7 -0
- package/dist/lib/transitions/bifrost.d.ts +47 -0
- package/dist/lib/transitions/bifrost.js +91 -0
- package/dist/lib/transitions/bifrost.js.map +7 -0
- package/dist/lib/transitions/binding.d.ts +14 -0
- package/dist/lib/transitions/binding.js +35 -0
- package/dist/lib/transitions/binding.js.map +7 -0
- package/dist/lib/transitions/capture.d.ts +21 -0
- package/dist/lib/transitions/capture.js +91 -0
- package/dist/lib/transitions/capture.js.map +7 -0
- package/dist/lib/transitions/common.d.ts +130 -0
- package/dist/lib/transitions/common.js +57 -0
- package/dist/lib/transitions/common.js.map +7 -0
- package/dist/lib/transitions/define-transition.d.ts +64 -0
- package/dist/lib/transitions/define-transition.js +31 -0
- package/dist/lib/transitions/define-transition.js.map +7 -0
- package/dist/lib/transitions/embers-physics.d.ts +114 -0
- package/dist/lib/transitions/embers-physics.js +161 -0
- package/dist/lib/transitions/embers-physics.js.map +7 -0
- package/dist/lib/transitions/embers.d.ts +67 -0
- package/dist/lib/transitions/embers.js +196 -0
- package/dist/lib/transitions/embers.js.map +7 -0
- package/dist/lib/transitions/fade.d.ts +41 -0
- package/dist/lib/transitions/fade.js +31 -0
- package/dist/lib/transitions/fade.js.map +7 -0
- package/dist/lib/transitions/hologram.d.ts +47 -0
- package/dist/lib/transitions/hologram.js +94 -0
- package/dist/lib/transitions/hologram.js.map +7 -0
- package/dist/lib/transitions/wasm/bifrost-bytes.d.ts +1 -0
- package/dist/lib/transitions/wasm/bifrost-bytes.js +5 -0
- package/dist/lib/transitions/wasm/bifrost-bytes.js.map +7 -0
- package/dist/lib/transitions/wasm/bifrost-kernel.d.ts +1 -0
- package/dist/lib/transitions/wasm/bifrost-kernel.js +27 -0
- package/dist/lib/transitions/wasm/bifrost-kernel.js.map +7 -0
- package/dist/lib/transitions/wasm/embers-bytes.d.ts +1 -0
- package/dist/lib/transitions/wasm/embers-bytes.js +5 -0
- package/dist/lib/transitions/wasm/embers-bytes.js.map +7 -0
- package/dist/lib/transitions/wasm/hologram-bytes.d.ts +1 -0
- package/dist/lib/transitions/wasm/hologram-bytes.js +5 -0
- package/dist/lib/transitions/wasm/hologram-bytes.js.map +7 -0
- package/dist/lib/transitions/wasm/kernel.d.ts +7 -0
- package/dist/lib/transitions/wasm/kernel.js +26 -0
- package/dist/lib/transitions/wasm/kernel.js.map +7 -0
- package/dist/lib/types.d.ts +570 -0
- package/dist/lib/update.d.ts +8 -0
- package/dist/lib/update.js +20 -0
- package/dist/lib/update.js.map +7 -0
- package/dist/lib/util/get-2d-context.d.ts +2 -0
- package/dist/lib/util/get-2d-context.js +11 -0
- package/dist/lib/util/get-2d-context.js.map +7 -0
- package/dist/lib/util/get-mouse-coordinates.d.ts +2 -0
- package/dist/lib/util/get-mouse-coordinates.js +32 -0
- package/dist/lib/util/get-mouse-coordinates.js.map +7 -0
- package/dist/lib/util/is-hit.d.ts +11 -0
- package/dist/lib/util/is-hit.js +52 -0
- package/dist/lib/util/is-hit.js.map +7 -0
- package/dist/lib/util/is-transparent.d.ts +1 -0
- package/dist/lib/util/is-transparent.js +8 -0
- package/dist/lib/util/is-transparent.js.map +7 -0
- package/dist/lib/util/pixel-grid-adjustments.d.ts +8 -0
- package/dist/lib/util/pixel-grid-adjustments.js +28 -0
- package/dist/lib/util/pixel-grid-adjustments.js.map +7 -0
- package/dist/lib/util/push-clipping-path.d.ts +6 -0
- package/dist/lib/util/push-clipping-path.js +28 -0
- package/dist/lib/util/push-clipping-path.js.map +7 -0
- package/dist/lib/util/wire-common-events.d.ts +2 -0
- package/dist/lib/util/wire-common-events.js +15 -0
- package/dist/lib/util/wire-common-events.js.map +7 -0
- package/dist/types.d.ts +1 -0
- package/dist/types.js +1 -0
- package/dist/types.js.map +7 -0
- package/dist/types.mjs +1 -0
- package/package.json +149 -0
|
@@ -0,0 +1,1713 @@
|
|
|
1
|
+
import { manifoldBetweenShapeRecords2D } from "../collision/pairs.js";
|
|
2
|
+
import {
|
|
3
|
+
DEFAULT_FIXED_STEP_MILLISECONDS,
|
|
4
|
+
DEFAULT_GRAVITY,
|
|
5
|
+
DEFAULT_INTERPOLATION,
|
|
6
|
+
DEFAULT_MAX_CATCH_UP_STEPS,
|
|
7
|
+
DEFAULT_POSITION_ITERATIONS,
|
|
8
|
+
DEFAULT_SLEEPING,
|
|
9
|
+
DEFAULT_VELOCITY_ITERATIONS,
|
|
10
|
+
MAX_CATCH_UP_STEPS,
|
|
11
|
+
MAX_SOLVER_ITERATIONS,
|
|
12
|
+
MIN_CATCH_UP_STEPS,
|
|
13
|
+
MIN_SOLVER_ITERATIONS,
|
|
14
|
+
RADIANS_TO_DEGREES
|
|
15
|
+
} from "../numeric-policy.js";
|
|
16
|
+
import { recordPhysicsWorld2DTrace } from "../runtime/trace.js";
|
|
17
|
+
import { createPhysicsOwnershipCounters2D } from "../runtime/ownership.js";
|
|
18
|
+
import { DynamicAabbBroadPhase2D } from "./broad-phase.js";
|
|
19
|
+
import { BoundedCcd2D, collisionFiltersAllow2D } from "./ccd.js";
|
|
20
|
+
import { ContactCache2D, updateSortedContactCache2D } from "./contact-cache.js";
|
|
21
|
+
import {
|
|
22
|
+
BODY_TYPE_DYNAMIC_2D,
|
|
23
|
+
BODY_TYPE_KINEMATIC_2D,
|
|
24
|
+
applyForceAtPointToCandidateBody2D,
|
|
25
|
+
applyImpulseAtPointToCandidateBody2D,
|
|
26
|
+
applyTorqueToCandidateBody2D,
|
|
27
|
+
integrateCandidateVelocities2D,
|
|
28
|
+
integrateCandidatePoses2D
|
|
29
|
+
} from "./integrator.js";
|
|
30
|
+
import { BODY_SLEEPING_2D, SequentialImpulseSolver2D } from "./solver.js";
|
|
31
|
+
import {
|
|
32
|
+
BodyStore2D,
|
|
33
|
+
ColliderStore2D
|
|
34
|
+
} from "./storage.js";
|
|
35
|
+
const NO_INDEX = -1;
|
|
36
|
+
let failureInjector;
|
|
37
|
+
function installPhysicsWorld2DFailureInjectorForTest(injector) {
|
|
38
|
+
const previous = failureInjector;
|
|
39
|
+
failureInjector = injector;
|
|
40
|
+
return () => {
|
|
41
|
+
if (failureInjector === injector) failureInjector = previous;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
class PhysicsWorld2DCandidate {
|
|
45
|
+
constructor(owner, checkpoint, frameId, logicalTime, stepCount, tick, accumulatorMilliseconds, advanceEligible, eventOffset, eventCount, eventTicks, eventKinds, eventFirstColliderIndices, eventFirstColliderGenerations, eventSecondColliderIndices, eventSecondColliderGenerations, eventNormalX, eventNormalY, eventPointCounts, eventPointFirstX, eventPointFirstY, eventPointSecondX, eventPointSecondY, eventPointSeparations, eventTotalNormalImpulses, topologyRevision, commandRevision, commandCount) {
|
|
46
|
+
this.owner = owner;
|
|
47
|
+
this.checkpoint = checkpoint;
|
|
48
|
+
this.frameId = frameId;
|
|
49
|
+
this.logicalTime = logicalTime;
|
|
50
|
+
this.stepCount = stepCount;
|
|
51
|
+
this.tick = tick;
|
|
52
|
+
this.accumulatorMilliseconds = accumulatorMilliseconds;
|
|
53
|
+
this.advanceEligible = advanceEligible;
|
|
54
|
+
this.eventOffset = eventOffset;
|
|
55
|
+
this.eventCount = eventCount;
|
|
56
|
+
this.eventTicks = eventTicks;
|
|
57
|
+
this.eventKinds = eventKinds;
|
|
58
|
+
this.eventFirstColliderIndices = eventFirstColliderIndices;
|
|
59
|
+
this.eventFirstColliderGenerations = eventFirstColliderGenerations;
|
|
60
|
+
this.eventSecondColliderIndices = eventSecondColliderIndices;
|
|
61
|
+
this.eventSecondColliderGenerations = eventSecondColliderGenerations;
|
|
62
|
+
this.eventNormalX = eventNormalX;
|
|
63
|
+
this.eventNormalY = eventNormalY;
|
|
64
|
+
this.eventPointCounts = eventPointCounts;
|
|
65
|
+
this.eventPointFirstX = eventPointFirstX;
|
|
66
|
+
this.eventPointFirstY = eventPointFirstY;
|
|
67
|
+
this.eventPointSecondX = eventPointSecondX;
|
|
68
|
+
this.eventPointSecondY = eventPointSecondY;
|
|
69
|
+
this.eventPointSeparations = eventPointSeparations;
|
|
70
|
+
this.eventTotalNormalImpulses = eventTotalNormalImpulses;
|
|
71
|
+
this.topologyRevision = topologyRevision;
|
|
72
|
+
this.commandRevision = commandRevision;
|
|
73
|
+
this.commandCount = commandCount;
|
|
74
|
+
}
|
|
75
|
+
owner;
|
|
76
|
+
checkpoint;
|
|
77
|
+
frameId;
|
|
78
|
+
logicalTime;
|
|
79
|
+
stepCount;
|
|
80
|
+
tick;
|
|
81
|
+
accumulatorMilliseconds;
|
|
82
|
+
advanceEligible;
|
|
83
|
+
eventOffset;
|
|
84
|
+
eventCount;
|
|
85
|
+
eventTicks;
|
|
86
|
+
eventKinds;
|
|
87
|
+
eventFirstColliderIndices;
|
|
88
|
+
eventFirstColliderGenerations;
|
|
89
|
+
eventSecondColliderIndices;
|
|
90
|
+
eventSecondColliderGenerations;
|
|
91
|
+
eventNormalX;
|
|
92
|
+
eventNormalY;
|
|
93
|
+
eventPointCounts;
|
|
94
|
+
eventPointFirstX;
|
|
95
|
+
eventPointFirstY;
|
|
96
|
+
eventPointSecondX;
|
|
97
|
+
eventPointSecondY;
|
|
98
|
+
eventPointSeparations;
|
|
99
|
+
eventTotalNormalImpulses;
|
|
100
|
+
topologyRevision;
|
|
101
|
+
commandRevision;
|
|
102
|
+
commandCount;
|
|
103
|
+
status = "live";
|
|
104
|
+
get lifecycle() {
|
|
105
|
+
return this.status;
|
|
106
|
+
}
|
|
107
|
+
consume(status) {
|
|
108
|
+
if (this.status !== "live") {
|
|
109
|
+
throw new Error("physics world candidate has already been consumed.");
|
|
110
|
+
}
|
|
111
|
+
const checkpoint = this.checkpoint;
|
|
112
|
+
this.checkpoint = void 0;
|
|
113
|
+
this.status = status;
|
|
114
|
+
return checkpoint;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
class PhysicsWorld2DKernel {
|
|
118
|
+
constructor(configuration = {}, simulation) {
|
|
119
|
+
this.simulation = simulation;
|
|
120
|
+
this.state = {
|
|
121
|
+
configuration: normalizePhysicsWorld2DConfiguration(configuration),
|
|
122
|
+
accumulatorMilliseconds: 0,
|
|
123
|
+
previousLogicalTime: 0,
|
|
124
|
+
anchored: false,
|
|
125
|
+
tick: 0,
|
|
126
|
+
topologyRevision: 0,
|
|
127
|
+
commandRevision: 0,
|
|
128
|
+
bodySlots: /* @__PURE__ */ new Map(),
|
|
129
|
+
colliderSlots: /* @__PURE__ */ new Map(),
|
|
130
|
+
bodyRecords: /* @__PURE__ */ new Map(),
|
|
131
|
+
colliderRecords: /* @__PURE__ */ new Map(),
|
|
132
|
+
disabledBodies: /* @__PURE__ */ new Map(),
|
|
133
|
+
previousPositionX: new Float64Array(this.bodies.capacity),
|
|
134
|
+
previousPositionY: new Float64Array(this.bodies.capacity),
|
|
135
|
+
previousRotationRadians: new Float64Array(this.bodies.capacity),
|
|
136
|
+
bodyIndices: new Int32Array(this.bodies.capacity),
|
|
137
|
+
bodyCount: 0,
|
|
138
|
+
integrationBodyIndices: new Int32Array(this.bodies.capacity),
|
|
139
|
+
integrationBodyCount: 0,
|
|
140
|
+
eventTicks: new Float64Array(4),
|
|
141
|
+
eventKinds: new Uint8Array(4),
|
|
142
|
+
eventFirstColliderIndices: new Int32Array(4),
|
|
143
|
+
eventFirstColliderGenerations: new Uint32Array(4),
|
|
144
|
+
eventSecondColliderIndices: new Int32Array(4),
|
|
145
|
+
eventSecondColliderGenerations: new Uint32Array(4),
|
|
146
|
+
eventNormalX: new Float64Array(4),
|
|
147
|
+
eventNormalY: new Float64Array(4),
|
|
148
|
+
eventPointCounts: new Uint8Array(4),
|
|
149
|
+
eventPointFirstX: new Float64Array(8),
|
|
150
|
+
eventPointFirstY: new Float64Array(8),
|
|
151
|
+
eventPointSecondX: new Float64Array(8),
|
|
152
|
+
eventPointSecondY: new Float64Array(8),
|
|
153
|
+
eventPointSeparations: new Float64Array(8),
|
|
154
|
+
eventTotalNormalImpulses: new Float64Array(4),
|
|
155
|
+
eventCount: 0,
|
|
156
|
+
contactEventFacts: /* @__PURE__ */ new Map(),
|
|
157
|
+
savedNormalImpulses: new Float64Array(8),
|
|
158
|
+
savedTangentImpulses: new Float64Array(8)
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
simulation;
|
|
162
|
+
counters = createPhysicsOwnershipCounters2D();
|
|
163
|
+
bodies = new BodyStore2D(this.counters);
|
|
164
|
+
colliders = new ColliderStore2D(this.counters);
|
|
165
|
+
broadPhase = new DynamicAabbBroadPhase2D(this.counters);
|
|
166
|
+
contacts = new ContactCache2D();
|
|
167
|
+
solver = new SequentialImpulseSolver2D();
|
|
168
|
+
positionSolver = new SequentialImpulseSolver2D();
|
|
169
|
+
ccd = new BoundedCcd2D();
|
|
170
|
+
state;
|
|
171
|
+
pendingTopology;
|
|
172
|
+
pendingCommands = Object.freeze([]);
|
|
173
|
+
nextTopologyRevision = 0;
|
|
174
|
+
nextCommandRevision = 0;
|
|
175
|
+
liveCandidate;
|
|
176
|
+
disposed = false;
|
|
177
|
+
/** Refresh listener/tag metadata after a successful render without waking physics. */
|
|
178
|
+
updateColliderMetadata(records) {
|
|
179
|
+
this.assertUsable();
|
|
180
|
+
for (const record of records) {
|
|
181
|
+
if (record.kind !== "collider") continue;
|
|
182
|
+
const previous = this.state.colliderRecords.get(record.id);
|
|
183
|
+
if (!previous || previous.bodyId !== record.bodyId) continue;
|
|
184
|
+
const { handlers, tag, owner } = record.definition;
|
|
185
|
+
if (previous.definition.handlers === handlers && previous.definition.tag === tag && previous.definition.owner === owner)
|
|
186
|
+
continue;
|
|
187
|
+
this.state.colliderRecords.set(record.id, {
|
|
188
|
+
...previous,
|
|
189
|
+
definition: { ...previous.definition, handlers, tag, owner }
|
|
190
|
+
});
|
|
191
|
+
const slot = this.state.colliderSlots.get(record.id);
|
|
192
|
+
if (!slot) continue;
|
|
193
|
+
this.colliders.handlers[slot.index] = handlers;
|
|
194
|
+
this.colliders.tags[slot.index] = tag;
|
|
195
|
+
this.colliders.owners[slot.index] = owner;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
proposeTopology(records) {
|
|
199
|
+
this.assertUsable();
|
|
200
|
+
validateTopology(records);
|
|
201
|
+
this.pendingTopology = Object.freeze([...records]);
|
|
202
|
+
this.nextTopologyRevision += 1;
|
|
203
|
+
}
|
|
204
|
+
applyBegin(commands) {
|
|
205
|
+
this.assertUsable();
|
|
206
|
+
for (const command of commands) validateCommand(command);
|
|
207
|
+
this.pendingCommands = Object.freeze([
|
|
208
|
+
...this.pendingCommands,
|
|
209
|
+
...commands
|
|
210
|
+
]);
|
|
211
|
+
if (commands.length > 0) this.nextCommandRevision += 1;
|
|
212
|
+
}
|
|
213
|
+
advance(input) {
|
|
214
|
+
this.assertUsable();
|
|
215
|
+
if (this.liveCandidate !== void 0) {
|
|
216
|
+
throw new Error("physics world already has a live candidate.");
|
|
217
|
+
}
|
|
218
|
+
if (!Number.isSafeInteger(input.frameId) || input.frameId < 0) {
|
|
219
|
+
throw new RangeError("frameId must be a nonnegative safe integer.");
|
|
220
|
+
}
|
|
221
|
+
if (!Number.isFinite(input.logicalTime)) {
|
|
222
|
+
throw new RangeError("logicalTime must be finite.");
|
|
223
|
+
}
|
|
224
|
+
for (const [bodyId, pose] of input.stagedKinematicTargets) {
|
|
225
|
+
validateId(bodyId, "staged kinematic body id");
|
|
226
|
+
validatePose(pose, "staged kinematic pose");
|
|
227
|
+
}
|
|
228
|
+
const eventOffset = this.state.eventCount;
|
|
229
|
+
const checkpoint = this.captureCheckpoint();
|
|
230
|
+
const topologyRevision = this.nextTopologyRevision;
|
|
231
|
+
const commandRevision = this.nextCommandRevision;
|
|
232
|
+
const commandCount = this.pendingCommands.length;
|
|
233
|
+
try {
|
|
234
|
+
const topologyPending = this.pendingTopology !== void 0 && topologyRevision > this.state.topologyRevision;
|
|
235
|
+
const commandsPending = commandRevision > this.state.commandRevision;
|
|
236
|
+
if (topologyPending) {
|
|
237
|
+
this.reconcileTopology(this.pendingTopology);
|
|
238
|
+
this.state.topologyRevision = topologyRevision;
|
|
239
|
+
}
|
|
240
|
+
if (commandsPending) {
|
|
241
|
+
this.applyCommands(this.pendingCommands);
|
|
242
|
+
this.state.commandRevision = commandRevision;
|
|
243
|
+
}
|
|
244
|
+
injectFailure("topology");
|
|
245
|
+
const reanchor = !this.state.anchored;
|
|
246
|
+
const elapsed = reanchor ? 0 : Math.max(0, input.logicalTime - this.state.previousLogicalTime);
|
|
247
|
+
this.state.previousLogicalTime = input.logicalTime;
|
|
248
|
+
this.state.anchored = true;
|
|
249
|
+
const configuration = this.state.configuration;
|
|
250
|
+
const maximumElapsed = configuration.fixedStepMilliseconds * configuration.maxCatchUpSteps;
|
|
251
|
+
const acceptedElapsed = Math.min(elapsed, maximumElapsed);
|
|
252
|
+
const discardedElapsed = elapsed - acceptedElapsed;
|
|
253
|
+
if (discardedElapsed > 0) {
|
|
254
|
+
recordPhysicsWorld2DTrace({
|
|
255
|
+
kind: "physics-2d-clamp",
|
|
256
|
+
frameId: input.frameId,
|
|
257
|
+
logicalTime: input.logicalTime,
|
|
258
|
+
acceptedElapsedMilliseconds: acceptedElapsed,
|
|
259
|
+
discardedElapsedMilliseconds: discardedElapsed
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
this.state.accumulatorMilliseconds += acceptedElapsed;
|
|
263
|
+
const stepCount = Math.min(
|
|
264
|
+
configuration.maxCatchUpSteps,
|
|
265
|
+
Math.floor(
|
|
266
|
+
(this.state.accumulatorMilliseconds + Number.EPSILON) / configuration.fixedStepMilliseconds
|
|
267
|
+
)
|
|
268
|
+
);
|
|
269
|
+
const starts = /* @__PURE__ */ new Map();
|
|
270
|
+
if (stepCount > 1)
|
|
271
|
+
for (const [bodyId] of input.stagedKinematicTargets) {
|
|
272
|
+
if (this.state.bodySlots.has(bodyId))
|
|
273
|
+
starts.set(bodyId, this.authoritativePose(bodyId));
|
|
274
|
+
}
|
|
275
|
+
for (let step = 0; step < stepCount; step += 1) {
|
|
276
|
+
let tickInput = input;
|
|
277
|
+
if (stepCount > 1) {
|
|
278
|
+
const fraction = (step + 1) / stepCount;
|
|
279
|
+
const targets = /* @__PURE__ */ new Map();
|
|
280
|
+
for (const [bodyId, target] of input.stagedKinematicTargets) {
|
|
281
|
+
const start = starts.get(bodyId);
|
|
282
|
+
if (!start) continue;
|
|
283
|
+
targets.set(bodyId, {
|
|
284
|
+
position: [
|
|
285
|
+
start.position[0] + (target.position[0] - start.position[0]) * fraction,
|
|
286
|
+
start.position[1] + (target.position[1] - start.position[1]) * fraction
|
|
287
|
+
],
|
|
288
|
+
rotationDegrees: start.rotationDegrees + shortestRadians(
|
|
289
|
+
start.rotationDegrees / RADIANS_TO_DEGREES,
|
|
290
|
+
target.rotationDegrees / RADIANS_TO_DEGREES
|
|
291
|
+
) * RADIANS_TO_DEGREES * fraction
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
tickInput = { ...input, stagedKinematicTargets: targets };
|
|
295
|
+
}
|
|
296
|
+
this.simulateFixedTick(tickInput);
|
|
297
|
+
this.state.accumulatorMilliseconds -= configuration.fixedStepMilliseconds;
|
|
298
|
+
if (this.state.accumulatorMilliseconds < Number.EPSILON) {
|
|
299
|
+
this.state.accumulatorMilliseconds = 0;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
if (stepCount > 0 && !this.solver.advanceEligible && !this.hasKinematicBodies()) {
|
|
303
|
+
this.state.accumulatorMilliseconds = 0;
|
|
304
|
+
this.state.anchored = false;
|
|
305
|
+
this.capturePreviousPoses();
|
|
306
|
+
}
|
|
307
|
+
const candidate = new PhysicsWorld2DCandidate(
|
|
308
|
+
this,
|
|
309
|
+
checkpoint,
|
|
310
|
+
input.frameId,
|
|
311
|
+
input.logicalTime,
|
|
312
|
+
stepCount,
|
|
313
|
+
this.state.tick,
|
|
314
|
+
this.state.accumulatorMilliseconds,
|
|
315
|
+
this.hasAdvanceWork(),
|
|
316
|
+
eventOffset,
|
|
317
|
+
this.state.eventCount - eventOffset,
|
|
318
|
+
this.state.eventTicks,
|
|
319
|
+
this.state.eventKinds,
|
|
320
|
+
this.state.eventFirstColliderIndices,
|
|
321
|
+
this.state.eventFirstColliderGenerations,
|
|
322
|
+
this.state.eventSecondColliderIndices,
|
|
323
|
+
this.state.eventSecondColliderGenerations,
|
|
324
|
+
this.state.eventNormalX,
|
|
325
|
+
this.state.eventNormalY,
|
|
326
|
+
this.state.eventPointCounts,
|
|
327
|
+
this.state.eventPointFirstX,
|
|
328
|
+
this.state.eventPointFirstY,
|
|
329
|
+
this.state.eventPointSecondX,
|
|
330
|
+
this.state.eventPointSecondY,
|
|
331
|
+
this.state.eventPointSeparations,
|
|
332
|
+
this.state.eventTotalNormalImpulses,
|
|
333
|
+
topologyRevision,
|
|
334
|
+
commandRevision,
|
|
335
|
+
commandCount
|
|
336
|
+
);
|
|
337
|
+
this.liveCandidate = candidate;
|
|
338
|
+
recordPhysicsWorld2DTrace({
|
|
339
|
+
kind: "physics-2d-candidate",
|
|
340
|
+
frameId: input.frameId,
|
|
341
|
+
logicalTime: input.logicalTime,
|
|
342
|
+
tick: this.state.tick,
|
|
343
|
+
stepCount
|
|
344
|
+
});
|
|
345
|
+
return candidate;
|
|
346
|
+
} catch (error) {
|
|
347
|
+
this.restoreCheckpoint(checkpoint);
|
|
348
|
+
recordPhysicsWorld2DTrace({
|
|
349
|
+
kind: "physics-2d-error",
|
|
350
|
+
frameId: input.frameId,
|
|
351
|
+
logicalTime: input.logicalTime,
|
|
352
|
+
error
|
|
353
|
+
});
|
|
354
|
+
throw error;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
adopt(candidate) {
|
|
358
|
+
this.assertCandidate(candidate);
|
|
359
|
+
candidate.consume("adopted");
|
|
360
|
+
this.liveCandidate = void 0;
|
|
361
|
+
if (candidate.topologyRevision === this.nextTopologyRevision) {
|
|
362
|
+
this.pendingTopology = void 0;
|
|
363
|
+
}
|
|
364
|
+
if (candidate.commandRevision === this.nextCommandRevision) {
|
|
365
|
+
this.pendingCommands = Object.freeze([]);
|
|
366
|
+
} else if (candidate.commandCount > 0) {
|
|
367
|
+
this.pendingCommands = Object.freeze(
|
|
368
|
+
this.pendingCommands.slice(candidate.commandCount)
|
|
369
|
+
);
|
|
370
|
+
}
|
|
371
|
+
recordPhysicsWorld2DTrace({
|
|
372
|
+
kind: "physics-2d-adopt",
|
|
373
|
+
frameId: candidate.frameId,
|
|
374
|
+
tick: candidate.tick
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
discard(candidate) {
|
|
378
|
+
this.assertCandidate(candidate);
|
|
379
|
+
const checkpoint = candidate.consume("discarded");
|
|
380
|
+
this.restoreCheckpoint(checkpoint);
|
|
381
|
+
this.liveCandidate = void 0;
|
|
382
|
+
recordPhysicsWorld2DTrace({
|
|
383
|
+
kind: "physics-2d-discard",
|
|
384
|
+
frameId: candidate.frameId,
|
|
385
|
+
tick: candidate.tick
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
authoritativePose(bodyId) {
|
|
389
|
+
this.assertUsable();
|
|
390
|
+
const slot = this.requireBody(bodyId);
|
|
391
|
+
return publicBodyOriginPose(this.bodies, slot.index);
|
|
392
|
+
}
|
|
393
|
+
isBodyEnabled(bodyId) {
|
|
394
|
+
this.assertUsable();
|
|
395
|
+
return this.state.bodySlots.has(bodyId) && !this.state.disabledBodies.has(bodyId);
|
|
396
|
+
}
|
|
397
|
+
bodyIdentity(bodyId) {
|
|
398
|
+
this.assertUsable();
|
|
399
|
+
return this.state.bodySlots.get(bodyId);
|
|
400
|
+
}
|
|
401
|
+
bodyIdForIdentity(index, generation) {
|
|
402
|
+
this.assertUsable();
|
|
403
|
+
for (const [id, slot] of this.state.bodySlots) {
|
|
404
|
+
if (slot.index === index && slot.generation === generation) return id;
|
|
405
|
+
}
|
|
406
|
+
return void 0;
|
|
407
|
+
}
|
|
408
|
+
colliderIdForIdentity(index, generation) {
|
|
409
|
+
this.assertUsable();
|
|
410
|
+
for (const [id, slot] of this.state.colliderSlots) {
|
|
411
|
+
if (slot.index === index && slot.generation === generation) return id;
|
|
412
|
+
}
|
|
413
|
+
return void 0;
|
|
414
|
+
}
|
|
415
|
+
colliderIdentity(colliderId) {
|
|
416
|
+
this.assertUsable();
|
|
417
|
+
return this.state.colliderSlots.get(colliderId);
|
|
418
|
+
}
|
|
419
|
+
presentationPose(bodyId) {
|
|
420
|
+
this.assertUsable();
|
|
421
|
+
const slot = this.requireBody(bodyId);
|
|
422
|
+
const index = slot.index;
|
|
423
|
+
if (this.state.configuration.interpolation === "none") {
|
|
424
|
+
return this.authoritativePose(bodyId);
|
|
425
|
+
}
|
|
426
|
+
const alpha = this.state.accumulatorMilliseconds / this.state.configuration.fixedStepMilliseconds;
|
|
427
|
+
const previousRotation = this.state.previousRotationRadians[index];
|
|
428
|
+
const currentRotation = this.bodies.rotationRadians[index];
|
|
429
|
+
return publicPoseFromCenter(
|
|
430
|
+
this.bodies,
|
|
431
|
+
index,
|
|
432
|
+
lerp(
|
|
433
|
+
this.state.previousPositionX[index],
|
|
434
|
+
this.bodies.positionX[index],
|
|
435
|
+
alpha
|
|
436
|
+
),
|
|
437
|
+
lerp(
|
|
438
|
+
this.state.previousPositionY[index],
|
|
439
|
+
this.bodies.positionY[index],
|
|
440
|
+
alpha
|
|
441
|
+
),
|
|
442
|
+
previousRotation + shortestRadians(previousRotation, currentRotation) * alpha
|
|
443
|
+
);
|
|
444
|
+
}
|
|
445
|
+
snapshot() {
|
|
446
|
+
const bodies = [...this.state.bodySlots.entries()].sort(([first], [second]) => first - second).map(
|
|
447
|
+
([id, slot]) => Object.freeze({
|
|
448
|
+
id,
|
|
449
|
+
index: slot.index,
|
|
450
|
+
generation: slot.generation,
|
|
451
|
+
positionX: this.bodies.positionX[slot.index],
|
|
452
|
+
positionY: this.bodies.positionY[slot.index],
|
|
453
|
+
rotationRadians: this.bodies.rotationRadians[slot.index],
|
|
454
|
+
localCenterX: this.bodies.localCenterX[slot.index],
|
|
455
|
+
localCenterY: this.bodies.localCenterY[slot.index],
|
|
456
|
+
linearVelocityX: this.bodies.linearVelocityX[slot.index],
|
|
457
|
+
linearVelocityY: this.bodies.linearVelocityY[slot.index],
|
|
458
|
+
angularVelocity: this.bodies.angularVelocity[slot.index],
|
|
459
|
+
inverseMass: this.bodies.inverseMass[slot.index],
|
|
460
|
+
inverseInertia: this.bodies.inverseInertia[slot.index],
|
|
461
|
+
flags: this.bodies.flags[slot.index]
|
|
462
|
+
})
|
|
463
|
+
);
|
|
464
|
+
return Object.freeze({
|
|
465
|
+
tick: this.state.tick,
|
|
466
|
+
accumulatorMilliseconds: this.state.accumulatorMilliseconds,
|
|
467
|
+
anchored: this.state.anchored,
|
|
468
|
+
bodyCount: this.state.bodySlots.size,
|
|
469
|
+
colliderCount: this.state.colliderSlots.size,
|
|
470
|
+
contactCount: this.contacts.contactCount,
|
|
471
|
+
eventCount: this.state.eventCount,
|
|
472
|
+
rootNode: this.broadPhase.rootNode,
|
|
473
|
+
pairCount: this.broadPhase.pairCount,
|
|
474
|
+
counters: Object.freeze({ ...this.counters }),
|
|
475
|
+
bodies: Object.freeze(bodies)
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
dispose() {
|
|
479
|
+
if (this.disposed) return;
|
|
480
|
+
if (this.liveCandidate !== void 0) this.discard(this.liveCandidate);
|
|
481
|
+
this.reconcileTopology(Object.freeze([]));
|
|
482
|
+
this.state.eventCount = 0;
|
|
483
|
+
this.pendingTopology = void 0;
|
|
484
|
+
this.pendingCommands = Object.freeze([]);
|
|
485
|
+
this.simulation?.dispose();
|
|
486
|
+
this.disposed = true;
|
|
487
|
+
}
|
|
488
|
+
simulateFixedTick(input) {
|
|
489
|
+
this.ensureBodyScratchCapacity();
|
|
490
|
+
this.capturePreviousPoses();
|
|
491
|
+
const dt = this.state.configuration.fixedStepMilliseconds / 1e3;
|
|
492
|
+
this.applyKinematicTargets(input.stagedKinematicTargets, dt);
|
|
493
|
+
this.rebuildIntegrationBodyIndices();
|
|
494
|
+
if (this.simulation) {
|
|
495
|
+
const previousFlags = this.bodies.flags.slice();
|
|
496
|
+
this.simulation.step(
|
|
497
|
+
this.bodies,
|
|
498
|
+
this.colliders,
|
|
499
|
+
dt,
|
|
500
|
+
this.state.configuration.gravityX,
|
|
501
|
+
this.state.configuration.gravityY,
|
|
502
|
+
this.state.configuration.sleeping,
|
|
503
|
+
this.state.configuration.velocityIterations,
|
|
504
|
+
this.state.configuration.positionIterations
|
|
505
|
+
);
|
|
506
|
+
injectFailure("broad-phase");
|
|
507
|
+
injectFailure("ccd");
|
|
508
|
+
this.moveBroadPhaseProxies();
|
|
509
|
+
this.broadPhase.publishPairs();
|
|
510
|
+
updateSortedContactCache2D(
|
|
511
|
+
this.contacts,
|
|
512
|
+
this.simulation.contactPairs(this.broadPhase, this.colliders),
|
|
513
|
+
this.colliders,
|
|
514
|
+
(first, second) => {
|
|
515
|
+
const sensor = (this.colliders.flags[first] | this.colliders.flags[second]) & 1;
|
|
516
|
+
const dynamic = (this.bodies.flags[this.colliders.bodyIndices[first]] | this.bodies.flags[this.colliders.bodyIndices[second]]) & BODY_TYPE_DYNAMIC_2D;
|
|
517
|
+
return sensor || !dynamic ? this.manifoldBetweenColliders(first, second) : this.simulation.manifold(first, second);
|
|
518
|
+
}
|
|
519
|
+
);
|
|
520
|
+
for (let contact = 0; contact < this.contacts.contactCount; contact++) {
|
|
521
|
+
const impulses = this.simulation.normalImpulses(
|
|
522
|
+
this.contacts.firstColliderIndices[contact],
|
|
523
|
+
this.contacts.secondColliderIndices[contact]
|
|
524
|
+
);
|
|
525
|
+
for (let point = 0; point < 2; point++)
|
|
526
|
+
this.contacts.pointNormalImpulses[contact * 2 + point] = impulses[point] ?? 0;
|
|
527
|
+
}
|
|
528
|
+
injectFailure("narrow-phase");
|
|
529
|
+
injectFailure("velocity-solve");
|
|
530
|
+
injectFailure("position-solve");
|
|
531
|
+
this.solver.advanceEligible = false;
|
|
532
|
+
for (let offset = 0; offset < this.state.bodyCount; offset++) {
|
|
533
|
+
const body = this.state.bodyIndices[offset];
|
|
534
|
+
if (!(this.bodies.flags[body] & BODY_TYPE_DYNAMIC_2D)) continue;
|
|
535
|
+
const sleeping = !!(this.bodies.flags[body] & BODY_SLEEPING_2D);
|
|
536
|
+
if (!sleeping) this.solver.advanceEligible = true;
|
|
537
|
+
if (sleeping !== !!(previousFlags[body] & BODY_SLEEPING_2D))
|
|
538
|
+
this.appendEvent(sleeping ? 6 : 5, body, NO_INDEX);
|
|
539
|
+
}
|
|
540
|
+
this.stageContactEvents();
|
|
541
|
+
injectFailure("event-staging");
|
|
542
|
+
this.state.tick++;
|
|
543
|
+
recordPhysicsWorld2DTrace({
|
|
544
|
+
kind: "physics-2d-tick",
|
|
545
|
+
frameId: input.frameId,
|
|
546
|
+
logicalTime: input.logicalTime,
|
|
547
|
+
tick: this.state.tick
|
|
548
|
+
});
|
|
549
|
+
return;
|
|
550
|
+
}
|
|
551
|
+
integrateCandidateVelocities2D(
|
|
552
|
+
this.bodies,
|
|
553
|
+
this.state.integrationBodyIndices,
|
|
554
|
+
this.state.integrationBodyCount,
|
|
555
|
+
this.state.configuration.gravityX,
|
|
556
|
+
this.state.configuration.gravityY,
|
|
557
|
+
dt
|
|
558
|
+
);
|
|
559
|
+
this.moveBroadPhaseProxies();
|
|
560
|
+
this.broadPhase.publishPairs();
|
|
561
|
+
updateSortedContactCache2D(
|
|
562
|
+
this.contacts,
|
|
563
|
+
this.broadPhase,
|
|
564
|
+
this.colliders,
|
|
565
|
+
(first, second) => this.manifoldBetweenColliders(first, second)
|
|
566
|
+
);
|
|
567
|
+
const restitutionThreshold = Math.max(
|
|
568
|
+
1,
|
|
569
|
+
2 * dt * Math.hypot(
|
|
570
|
+
this.state.configuration.gravityX,
|
|
571
|
+
this.state.configuration.gravityY
|
|
572
|
+
)
|
|
573
|
+
);
|
|
574
|
+
this.solver.solveCandidate(
|
|
575
|
+
this.bodies,
|
|
576
|
+
this.state.bodyIndices,
|
|
577
|
+
this.state.bodyCount,
|
|
578
|
+
this.contacts,
|
|
579
|
+
this.state.configuration.velocityIterations,
|
|
580
|
+
0,
|
|
581
|
+
true,
|
|
582
|
+
restitutionThreshold
|
|
583
|
+
);
|
|
584
|
+
this.stageContactEvents(false);
|
|
585
|
+
integrateCandidatePoses2D(
|
|
586
|
+
this.bodies,
|
|
587
|
+
this.state.integrationBodyIndices,
|
|
588
|
+
this.state.integrationBodyCount,
|
|
589
|
+
dt
|
|
590
|
+
);
|
|
591
|
+
this.moveBroadPhaseProxies();
|
|
592
|
+
injectFailure("broad-phase");
|
|
593
|
+
this.ccd.resolveCandidateBodies(
|
|
594
|
+
this.bodies,
|
|
595
|
+
this.colliders,
|
|
596
|
+
this.broadPhase,
|
|
597
|
+
this.state.integrationBodyIndices,
|
|
598
|
+
this.state.integrationBodyCount,
|
|
599
|
+
this.state.previousPositionX,
|
|
600
|
+
this.state.previousPositionY,
|
|
601
|
+
this.state.previousRotationRadians
|
|
602
|
+
);
|
|
603
|
+
this.moveBroadPhaseProxies();
|
|
604
|
+
injectFailure("ccd");
|
|
605
|
+
this.broadPhase.publishPairs();
|
|
606
|
+
updateSortedContactCache2D(
|
|
607
|
+
this.contacts,
|
|
608
|
+
this.broadPhase,
|
|
609
|
+
this.colliders,
|
|
610
|
+
(firstCollider, secondCollider) => this.manifoldBetweenColliders(firstCollider, secondCollider)
|
|
611
|
+
);
|
|
612
|
+
injectFailure("narrow-phase");
|
|
613
|
+
this.solver.solveCandidate(
|
|
614
|
+
this.bodies,
|
|
615
|
+
this.state.bodyIndices,
|
|
616
|
+
this.state.bodyCount,
|
|
617
|
+
this.contacts,
|
|
618
|
+
this.state.configuration.velocityIterations,
|
|
619
|
+
0,
|
|
620
|
+
false,
|
|
621
|
+
restitutionThreshold
|
|
622
|
+
);
|
|
623
|
+
injectFailure("velocity-solve");
|
|
624
|
+
this.solvePositions();
|
|
625
|
+
injectFailure("position-solve");
|
|
626
|
+
this.solver.updateSleepingCandidate(this.bodies, this.contacts, dt, {
|
|
627
|
+
enabled: this.state.configuration.sleeping,
|
|
628
|
+
recordTransition: (bodyIndex, sleeping) => {
|
|
629
|
+
this.appendEvent(sleeping ? 6 : 5, bodyIndex, NO_INDEX);
|
|
630
|
+
}
|
|
631
|
+
});
|
|
632
|
+
this.stageContactEvents();
|
|
633
|
+
injectFailure("event-staging");
|
|
634
|
+
this.state.tick += 1;
|
|
635
|
+
recordPhysicsWorld2DTrace({
|
|
636
|
+
kind: "physics-2d-tick",
|
|
637
|
+
frameId: input.frameId,
|
|
638
|
+
logicalTime: input.logicalTime,
|
|
639
|
+
tick: this.state.tick
|
|
640
|
+
});
|
|
641
|
+
}
|
|
642
|
+
reconcileTopology(records) {
|
|
643
|
+
const desiredBodies = /* @__PURE__ */ new Map();
|
|
644
|
+
const desiredColliders = /* @__PURE__ */ new Map();
|
|
645
|
+
for (const record of records) {
|
|
646
|
+
if (record.kind === "body") desiredBodies.set(record.id, record);
|
|
647
|
+
else desiredColliders.set(record.id, record);
|
|
648
|
+
}
|
|
649
|
+
for (const [id, slot] of sortedEntries(this.state.colliderSlots, true)) {
|
|
650
|
+
if (desiredColliders.has(id)) continue;
|
|
651
|
+
this.releaseCollider(slot);
|
|
652
|
+
this.state.colliderSlots.delete(id);
|
|
653
|
+
this.state.colliderRecords.delete(id);
|
|
654
|
+
}
|
|
655
|
+
for (const [id, slot] of sortedEntries(this.state.bodySlots, true)) {
|
|
656
|
+
if (desiredBodies.has(id)) continue;
|
|
657
|
+
this.bodies.release(slot.index, slot.generation);
|
|
658
|
+
this.state.bodySlots.delete(id);
|
|
659
|
+
this.state.bodyRecords.delete(id);
|
|
660
|
+
this.state.disabledBodies.delete(id);
|
|
661
|
+
}
|
|
662
|
+
for (const [id, record] of sortedEntries(desiredBodies)) {
|
|
663
|
+
const existing = this.state.bodySlots.get(id);
|
|
664
|
+
if (existing === void 0) {
|
|
665
|
+
const index = this.bodies.allocate(record.definition);
|
|
666
|
+
const slot = Object.freeze({
|
|
667
|
+
index,
|
|
668
|
+
generation: this.bodies.generations[index]
|
|
669
|
+
});
|
|
670
|
+
this.state.bodySlots.set(id, slot);
|
|
671
|
+
this.state.anchored = false;
|
|
672
|
+
this.state.accumulatorMilliseconds = 0;
|
|
673
|
+
this.ensureBodyScratchCapacity();
|
|
674
|
+
this.snapPreviousPose(index);
|
|
675
|
+
this.state.bodyRecords.set(id, record);
|
|
676
|
+
} else if (!sameBodyDefinition(
|
|
677
|
+
this.state.bodyRecords.get(id)?.definition,
|
|
678
|
+
record.definition
|
|
679
|
+
)) {
|
|
680
|
+
const disabledState = this.state.disabledBodies.get(id);
|
|
681
|
+
if (disabledState === void 0 && this.wakeBody(existing.index)) {
|
|
682
|
+
this.state.anchored = false;
|
|
683
|
+
this.state.accumulatorMilliseconds = 0;
|
|
684
|
+
}
|
|
685
|
+
const preserveDynamicPose = disabledState === void 0 && (this.bodies.flags[existing.index] & BODY_TYPE_DYNAMIC_2D) !== 0 && (record.definition.flags & BODY_TYPE_DYNAMIC_2D) !== 0;
|
|
686
|
+
const dynamicState = preserveDynamicPose ? {
|
|
687
|
+
pose: publicBodyOriginPose(this.bodies, existing.index),
|
|
688
|
+
linearVelocityX: this.bodies.linearVelocityX[existing.index],
|
|
689
|
+
linearVelocityY: this.bodies.linearVelocityY[existing.index],
|
|
690
|
+
angularVelocity: this.bodies.angularVelocity[existing.index],
|
|
691
|
+
forceX: this.bodies.forceX[existing.index],
|
|
692
|
+
forceY: this.bodies.forceY[existing.index],
|
|
693
|
+
torque: this.bodies.torque[existing.index]
|
|
694
|
+
} : null;
|
|
695
|
+
writeBodyDefinition(this.bodies, existing.index, record.definition);
|
|
696
|
+
if (dynamicState !== null) {
|
|
697
|
+
this.setBodyOriginPose(existing.index, dynamicState.pose);
|
|
698
|
+
this.bodies.linearVelocityX[existing.index] = dynamicState.linearVelocityX;
|
|
699
|
+
this.bodies.linearVelocityY[existing.index] = dynamicState.linearVelocityY;
|
|
700
|
+
this.bodies.angularVelocity[existing.index] = dynamicState.angularVelocity;
|
|
701
|
+
this.bodies.forceX[existing.index] = dynamicState.forceX;
|
|
702
|
+
this.bodies.forceY[existing.index] = dynamicState.forceY;
|
|
703
|
+
this.bodies.torque[existing.index] = dynamicState.torque;
|
|
704
|
+
}
|
|
705
|
+
if (disabledState !== void 0) {
|
|
706
|
+
this.state.disabledBodies.set(
|
|
707
|
+
id,
|
|
708
|
+
Object.freeze({
|
|
709
|
+
...disabledState,
|
|
710
|
+
flags: record.definition.flags
|
|
711
|
+
})
|
|
712
|
+
);
|
|
713
|
+
this.bodies.flags[existing.index] = 0;
|
|
714
|
+
this.bodies.linearVelocityX[existing.index] = 0;
|
|
715
|
+
this.bodies.linearVelocityY[existing.index] = 0;
|
|
716
|
+
this.bodies.angularVelocity[existing.index] = 0;
|
|
717
|
+
this.bodies.forceX[existing.index] = 0;
|
|
718
|
+
this.bodies.forceY[existing.index] = 0;
|
|
719
|
+
this.bodies.torque[existing.index] = 0;
|
|
720
|
+
}
|
|
721
|
+
this.snapPreviousPose(existing.index);
|
|
722
|
+
this.state.bodyRecords.set(id, record);
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
for (const [id, record] of sortedEntries(desiredColliders)) {
|
|
726
|
+
const body = this.state.bodySlots.get(record.bodyId);
|
|
727
|
+
if (body === void 0) {
|
|
728
|
+
throw new Error(
|
|
729
|
+
`collider ${id} references missing body ${record.bodyId}.`
|
|
730
|
+
);
|
|
731
|
+
}
|
|
732
|
+
const existing = this.state.colliderSlots.get(id);
|
|
733
|
+
if (existing !== void 0 && sameColliderRecord(this.state.colliderRecords.get(id), record)) {
|
|
734
|
+
this.colliders.handlers[existing.index] = record.definition.handlers;
|
|
735
|
+
this.colliders.tags[existing.index] = record.definition.tag;
|
|
736
|
+
this.colliders.owners[existing.index] = record.definition.owner;
|
|
737
|
+
this.state.colliderRecords.set(id, record);
|
|
738
|
+
continue;
|
|
739
|
+
}
|
|
740
|
+
if (existing !== void 0) this.releaseCollider(existing);
|
|
741
|
+
this.state.colliderRecords.set(id, record);
|
|
742
|
+
if (this.state.disabledBodies.has(record.bodyId)) continue;
|
|
743
|
+
this.allocateColliderRecord(id, record, body);
|
|
744
|
+
if (this.wakeBody(body.index)) {
|
|
745
|
+
this.state.anchored = false;
|
|
746
|
+
this.state.accumulatorMilliseconds = 0;
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
this.rebuildBodyIndices();
|
|
750
|
+
this.moveBroadPhaseProxies();
|
|
751
|
+
}
|
|
752
|
+
applyCommands(commands) {
|
|
753
|
+
for (const command of commands) {
|
|
754
|
+
if (command.kind === "configure") {
|
|
755
|
+
const previousStep = this.state.configuration.fixedStepMilliseconds;
|
|
756
|
+
const sleepingWasEnabled = this.state.configuration.sleeping;
|
|
757
|
+
this.state.configuration = normalizePhysicsWorld2DConfiguration({
|
|
758
|
+
gravity: [
|
|
759
|
+
this.state.configuration.gravityX,
|
|
760
|
+
this.state.configuration.gravityY
|
|
761
|
+
],
|
|
762
|
+
fixedStepMilliseconds: this.state.configuration.fixedStepMilliseconds,
|
|
763
|
+
maxCatchUpSteps: this.state.configuration.maxCatchUpSteps,
|
|
764
|
+
interpolation: this.state.configuration.interpolation,
|
|
765
|
+
sleeping: this.state.configuration.sleeping,
|
|
766
|
+
...command.configuration,
|
|
767
|
+
solver: {
|
|
768
|
+
velocityIterations: this.state.configuration.velocityIterations,
|
|
769
|
+
positionIterations: this.state.configuration.positionIterations,
|
|
770
|
+
...command.configuration.solver
|
|
771
|
+
}
|
|
772
|
+
});
|
|
773
|
+
if (this.state.configuration.fixedStepMilliseconds !== previousStep) {
|
|
774
|
+
this.state.accumulatorMilliseconds = 0;
|
|
775
|
+
this.state.anchored = false;
|
|
776
|
+
}
|
|
777
|
+
if (sleepingWasEnabled && !this.state.configuration.sleeping) {
|
|
778
|
+
for (let offset = 0; offset < this.state.bodyCount; offset += 1) {
|
|
779
|
+
this.wakeBody(this.state.bodyIndices[offset]);
|
|
780
|
+
}
|
|
781
|
+
this.state.accumulatorMilliseconds = 0;
|
|
782
|
+
this.state.anchored = false;
|
|
783
|
+
}
|
|
784
|
+
continue;
|
|
785
|
+
}
|
|
786
|
+
const slot = this.state.bodySlots.get(command.bodyId);
|
|
787
|
+
if (slot === void 0) continue;
|
|
788
|
+
switch (command.kind) {
|
|
789
|
+
case "apply-force":
|
|
790
|
+
if (command.wake !== false) this.wakeCommandBody(slot.index);
|
|
791
|
+
applyForceAtPointToCandidateBody2D(
|
|
792
|
+
this.bodies,
|
|
793
|
+
slot.index,
|
|
794
|
+
slot.generation,
|
|
795
|
+
command.forceX,
|
|
796
|
+
command.forceY,
|
|
797
|
+
command.pointX ?? this.bodies.positionX[slot.index],
|
|
798
|
+
command.pointY ?? this.bodies.positionY[slot.index]
|
|
799
|
+
);
|
|
800
|
+
break;
|
|
801
|
+
case "apply-torque":
|
|
802
|
+
this.wakeCommandBody(slot.index);
|
|
803
|
+
applyTorqueToCandidateBody2D(
|
|
804
|
+
this.bodies,
|
|
805
|
+
slot.index,
|
|
806
|
+
slot.generation,
|
|
807
|
+
command.torque
|
|
808
|
+
);
|
|
809
|
+
break;
|
|
810
|
+
case "apply-impulse":
|
|
811
|
+
if (command.wake !== false) this.wakeCommandBody(slot.index);
|
|
812
|
+
applyImpulseAtPointToCandidateBody2D(
|
|
813
|
+
this.bodies,
|
|
814
|
+
slot.index,
|
|
815
|
+
slot.generation,
|
|
816
|
+
command.impulseX,
|
|
817
|
+
command.impulseY,
|
|
818
|
+
command.pointX ?? this.bodies.positionX[slot.index],
|
|
819
|
+
command.pointY ?? this.bodies.positionY[slot.index]
|
|
820
|
+
);
|
|
821
|
+
break;
|
|
822
|
+
case "set-pose":
|
|
823
|
+
this.wakeCommandBody(slot.index);
|
|
824
|
+
this.setBodyOriginPose(slot.index, command.pose);
|
|
825
|
+
this.snapPreviousPose(slot.index);
|
|
826
|
+
this.moveBroadPhaseProxies();
|
|
827
|
+
break;
|
|
828
|
+
case "set-velocity":
|
|
829
|
+
this.wakeCommandBody(slot.index);
|
|
830
|
+
this.bodies.linearVelocityX[slot.index] = command.linearVelocityX;
|
|
831
|
+
this.bodies.linearVelocityY[slot.index] = command.linearVelocityY;
|
|
832
|
+
this.bodies.angularVelocity[slot.index] = command.angularVelocityDegrees / RADIANS_TO_DEGREES;
|
|
833
|
+
break;
|
|
834
|
+
case "set-linear-velocity":
|
|
835
|
+
this.wakeCommandBody(slot.index);
|
|
836
|
+
this.bodies.linearVelocityX[slot.index] = command.linearVelocityX;
|
|
837
|
+
this.bodies.linearVelocityY[slot.index] = command.linearVelocityY;
|
|
838
|
+
break;
|
|
839
|
+
case "set-angular-velocity":
|
|
840
|
+
this.wakeCommandBody(slot.index);
|
|
841
|
+
this.bodies.angularVelocity[slot.index] = command.angularVelocityDegrees / RADIANS_TO_DEGREES;
|
|
842
|
+
break;
|
|
843
|
+
case "wake":
|
|
844
|
+
this.wakeCommandBody(slot.index);
|
|
845
|
+
break;
|
|
846
|
+
case "sleep":
|
|
847
|
+
this.sleepCommandBody(slot.index);
|
|
848
|
+
break;
|
|
849
|
+
case "disable":
|
|
850
|
+
this.disableCommandBody(command.bodyId, slot);
|
|
851
|
+
break;
|
|
852
|
+
case "enable":
|
|
853
|
+
this.enableCommandBody(command.bodyId, slot, command.velocity);
|
|
854
|
+
break;
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
wakeCommandBody(bodyIndex) {
|
|
859
|
+
if (this.wakeBody(bodyIndex)) {
|
|
860
|
+
this.state.anchored = false;
|
|
861
|
+
this.state.accumulatorMilliseconds = 0;
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
sleepCommandBody(bodyIndex) {
|
|
865
|
+
if ((this.bodies.flags[bodyIndex] & BODY_SLEEPING_2D) !== 0) return;
|
|
866
|
+
this.bodies.flags[bodyIndex] |= BODY_SLEEPING_2D;
|
|
867
|
+
this.bodies.linearVelocityX[bodyIndex] = 0;
|
|
868
|
+
this.bodies.linearVelocityY[bodyIndex] = 0;
|
|
869
|
+
this.bodies.angularVelocity[bodyIndex] = 0;
|
|
870
|
+
this.bodies.forceX[bodyIndex] = 0;
|
|
871
|
+
this.bodies.forceY[bodyIndex] = 0;
|
|
872
|
+
this.bodies.torque[bodyIndex] = 0;
|
|
873
|
+
this.appendEvent(6, bodyIndex, NO_INDEX);
|
|
874
|
+
}
|
|
875
|
+
disableCommandBody(bodyId, slot) {
|
|
876
|
+
if (this.state.disabledBodies.has(bodyId)) return;
|
|
877
|
+
this.state.disabledBodies.set(
|
|
878
|
+
bodyId,
|
|
879
|
+
Object.freeze({
|
|
880
|
+
flags: this.bodies.flags[slot.index],
|
|
881
|
+
linearVelocityX: this.bodies.linearVelocityX[slot.index],
|
|
882
|
+
linearVelocityY: this.bodies.linearVelocityY[slot.index],
|
|
883
|
+
angularVelocity: this.bodies.angularVelocity[slot.index]
|
|
884
|
+
})
|
|
885
|
+
);
|
|
886
|
+
for (const [colliderId, record] of this.state.colliderRecords) {
|
|
887
|
+
if (record.bodyId !== bodyId) continue;
|
|
888
|
+
const collider = this.state.colliderSlots.get(colliderId);
|
|
889
|
+
if (collider !== void 0) this.releaseCollider(collider);
|
|
890
|
+
this.state.colliderSlots.delete(colliderId);
|
|
891
|
+
}
|
|
892
|
+
this.bodies.flags[slot.index] = 0;
|
|
893
|
+
this.bodies.linearVelocityX[slot.index] = 0;
|
|
894
|
+
this.bodies.linearVelocityY[slot.index] = 0;
|
|
895
|
+
this.bodies.angularVelocity[slot.index] = 0;
|
|
896
|
+
this.bodies.forceX[slot.index] = 0;
|
|
897
|
+
this.bodies.forceY[slot.index] = 0;
|
|
898
|
+
this.bodies.torque[slot.index] = 0;
|
|
899
|
+
this.broadPhase.publishPairs();
|
|
900
|
+
updateSortedContactCache2D(
|
|
901
|
+
this.contacts,
|
|
902
|
+
this.broadPhase,
|
|
903
|
+
this.colliders,
|
|
904
|
+
(first, second) => this.manifoldBetweenColliders(first, second)
|
|
905
|
+
);
|
|
906
|
+
this.stageContactEvents();
|
|
907
|
+
}
|
|
908
|
+
enableCommandBody(bodyId, slot, velocity) {
|
|
909
|
+
const disabled = this.state.disabledBodies.get(bodyId);
|
|
910
|
+
if (disabled === void 0) return;
|
|
911
|
+
const authored = this.state.bodyRecords.get(bodyId)?.definition;
|
|
912
|
+
if (authored === void 0) return;
|
|
913
|
+
const disabledPose = publicBodyOriginPose(this.bodies, slot.index);
|
|
914
|
+
this.state.disabledBodies.delete(bodyId);
|
|
915
|
+
writeBodyDefinition(this.bodies, slot.index, authored);
|
|
916
|
+
this.setBodyOriginPose(slot.index, disabledPose);
|
|
917
|
+
this.bodies.flags[slot.index] = disabled.flags & ~BODY_SLEEPING_2D;
|
|
918
|
+
this.bodies.linearVelocityX[slot.index] = velocity === "preserve" ? disabled.linearVelocityX : 0;
|
|
919
|
+
this.bodies.linearVelocityY[slot.index] = velocity === "preserve" ? disabled.linearVelocityY : 0;
|
|
920
|
+
this.bodies.angularVelocity[slot.index] = velocity === "preserve" ? disabled.angularVelocity : 0;
|
|
921
|
+
this.snapPreviousPose(slot.index);
|
|
922
|
+
for (const [colliderId, record] of sortedEntries(
|
|
923
|
+
this.state.colliderRecords
|
|
924
|
+
)) {
|
|
925
|
+
if (record.bodyId !== bodyId || this.state.colliderSlots.has(colliderId))
|
|
926
|
+
continue;
|
|
927
|
+
this.allocateColliderRecord(colliderId, record, slot);
|
|
928
|
+
}
|
|
929
|
+
this.state.anchored = false;
|
|
930
|
+
this.state.accumulatorMilliseconds = 0;
|
|
931
|
+
}
|
|
932
|
+
allocateColliderRecord(id, record, body) {
|
|
933
|
+
const index = this.colliders.allocate({
|
|
934
|
+
...record.definition,
|
|
935
|
+
bodyIndex: body.index,
|
|
936
|
+
bodyGeneration: body.generation
|
|
937
|
+
});
|
|
938
|
+
const generation = this.colliders.generations[index];
|
|
939
|
+
const pose = internalPose(this.bodies, body.index);
|
|
940
|
+
const bounds = colliderBounds(
|
|
941
|
+
record.definition.shape,
|
|
942
|
+
pose.x,
|
|
943
|
+
pose.y,
|
|
944
|
+
pose.rotationRadians
|
|
945
|
+
);
|
|
946
|
+
const proxy = this.broadPhase.createProxy(
|
|
947
|
+
index,
|
|
948
|
+
generation,
|
|
949
|
+
bounds[0],
|
|
950
|
+
bounds[1],
|
|
951
|
+
bounds[2],
|
|
952
|
+
bounds[3]
|
|
953
|
+
);
|
|
954
|
+
this.colliders.setProxy(
|
|
955
|
+
index,
|
|
956
|
+
generation,
|
|
957
|
+
proxy,
|
|
958
|
+
this.broadPhase.proxyGenerations[proxy]
|
|
959
|
+
);
|
|
960
|
+
this.state.colliderSlots.set(id, Object.freeze({ index, generation }));
|
|
961
|
+
}
|
|
962
|
+
manifoldBetweenColliders(first, second) {
|
|
963
|
+
if (!collisionFiltersAllow2D(
|
|
964
|
+
this.colliders.filters[first],
|
|
965
|
+
this.colliders.filters[second]
|
|
966
|
+
)) {
|
|
967
|
+
return null;
|
|
968
|
+
}
|
|
969
|
+
const firstShape = this.colliders.shapes[first];
|
|
970
|
+
const secondShape = this.colliders.shapes[second];
|
|
971
|
+
if (firstShape === null || secondShape === null) return null;
|
|
972
|
+
const firstBody = this.colliders.bodyIndices[first];
|
|
973
|
+
const secondBody = this.colliders.bodyIndices[second];
|
|
974
|
+
return manifoldBetweenShapeRecords2D(
|
|
975
|
+
firstShape,
|
|
976
|
+
internalPose(this.bodies, firstBody),
|
|
977
|
+
first,
|
|
978
|
+
secondShape,
|
|
979
|
+
internalPose(this.bodies, secondBody),
|
|
980
|
+
second
|
|
981
|
+
);
|
|
982
|
+
}
|
|
983
|
+
moveBroadPhaseProxies() {
|
|
984
|
+
for (const [, slot] of sortedEntries(this.state.colliderSlots)) {
|
|
985
|
+
const body = this.colliders.bodyIndices[slot.index];
|
|
986
|
+
const shape = this.colliders.shapes[slot.index];
|
|
987
|
+
if (shape === null) continue;
|
|
988
|
+
const pose = internalPose(this.bodies, body);
|
|
989
|
+
const bounds = colliderBounds(
|
|
990
|
+
shape,
|
|
991
|
+
pose.x,
|
|
992
|
+
pose.y,
|
|
993
|
+
pose.rotationRadians
|
|
994
|
+
);
|
|
995
|
+
this.broadPhase.moveProxy(
|
|
996
|
+
this.colliders.proxyIndices[slot.index],
|
|
997
|
+
this.colliders.proxyGenerations[slot.index],
|
|
998
|
+
bounds[0],
|
|
999
|
+
bounds[1],
|
|
1000
|
+
bounds[2],
|
|
1001
|
+
bounds[3],
|
|
1002
|
+
this.bodies.positionX[body] - this.state.previousPositionX[body],
|
|
1003
|
+
this.bodies.positionY[body] - this.state.previousPositionY[body]
|
|
1004
|
+
);
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
applyKinematicTargets(targets, dt) {
|
|
1008
|
+
for (const [bodyId, pose] of targets) {
|
|
1009
|
+
const slot = this.state.bodySlots.get(bodyId);
|
|
1010
|
+
if (slot === void 0) continue;
|
|
1011
|
+
const index = slot.index;
|
|
1012
|
+
if ((this.bodies.flags[index] & BODY_TYPE_KINEMATIC_2D) === 0) continue;
|
|
1013
|
+
const targetRadians = pose.rotationDegrees / RADIANS_TO_DEGREES;
|
|
1014
|
+
const targetCenter = centerFromOrigin(
|
|
1015
|
+
this.bodies,
|
|
1016
|
+
index,
|
|
1017
|
+
pose.position[0],
|
|
1018
|
+
pose.position[1],
|
|
1019
|
+
targetRadians
|
|
1020
|
+
);
|
|
1021
|
+
this.bodies.linearVelocityX[index] = (targetCenter[0] - this.bodies.positionX[index]) / dt;
|
|
1022
|
+
this.bodies.linearVelocityY[index] = (targetCenter[1] - this.bodies.positionY[index]) / dt;
|
|
1023
|
+
this.bodies.angularVelocity[index] = shortestRadians(this.bodies.rotationRadians[index], targetRadians) / dt;
|
|
1024
|
+
if (this.wakeBody(index)) {
|
|
1025
|
+
this.state.anchored = false;
|
|
1026
|
+
this.state.accumulatorMilliseconds = 0;
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
stageContactEvents(includeHits = true) {
|
|
1031
|
+
for (let event = 0; event < this.contacts.eventCount; event += 1) {
|
|
1032
|
+
const first = this.contacts.eventFirstColliderIndices[event];
|
|
1033
|
+
const firstGeneration = this.contacts.eventFirstColliderGenerations[event];
|
|
1034
|
+
const second = this.contacts.eventSecondColliderIndices[event];
|
|
1035
|
+
const secondGeneration = this.contacts.eventSecondColliderGenerations[event];
|
|
1036
|
+
const kind = this.contacts.eventTypes[event];
|
|
1037
|
+
const contact = this.findContact(
|
|
1038
|
+
first,
|
|
1039
|
+
firstGeneration,
|
|
1040
|
+
second,
|
|
1041
|
+
secondGeneration
|
|
1042
|
+
);
|
|
1043
|
+
const key = contactKey(first, firstGeneration, second, secondGeneration);
|
|
1044
|
+
this.appendEvent(
|
|
1045
|
+
kind,
|
|
1046
|
+
first,
|
|
1047
|
+
second,
|
|
1048
|
+
firstGeneration,
|
|
1049
|
+
secondGeneration,
|
|
1050
|
+
kind === 2 || kind === 4 ? this.state.contactEventFacts.get(key) : contact < 0 ? void 0 : this.contactEventFact(contact)
|
|
1051
|
+
);
|
|
1052
|
+
}
|
|
1053
|
+
for (let contact = 0; contact < this.contacts.contactCount; contact += 1) {
|
|
1054
|
+
if (!includeHits || this.contacts.sensorFlags[contact] !== 0) continue;
|
|
1055
|
+
const first = this.contacts.firstColliderIndices[contact];
|
|
1056
|
+
const second = this.contacts.secondColliderIndices[contact];
|
|
1057
|
+
if (!hasColliderHandler(this.colliders.handlers[first], "onHit") && !hasColliderHandler(this.colliders.handlers[second], "onHit")) {
|
|
1058
|
+
continue;
|
|
1059
|
+
}
|
|
1060
|
+
const fact = this.contactEventFact(contact);
|
|
1061
|
+
if (fact.totalNormalImpulse <= 0) continue;
|
|
1062
|
+
this.appendEvent(
|
|
1063
|
+
7,
|
|
1064
|
+
first,
|
|
1065
|
+
second,
|
|
1066
|
+
this.contacts.firstColliderGenerations[contact],
|
|
1067
|
+
this.contacts.secondColliderGenerations[contact],
|
|
1068
|
+
fact
|
|
1069
|
+
);
|
|
1070
|
+
}
|
|
1071
|
+
this.state.contactEventFacts.clear();
|
|
1072
|
+
for (let contact = 0; contact < this.contacts.contactCount; contact += 1) {
|
|
1073
|
+
this.state.contactEventFacts.set(
|
|
1074
|
+
contactKey(
|
|
1075
|
+
this.contacts.firstColliderIndices[contact],
|
|
1076
|
+
this.contacts.firstColliderGenerations[contact],
|
|
1077
|
+
this.contacts.secondColliderIndices[contact],
|
|
1078
|
+
this.contacts.secondColliderGenerations[contact]
|
|
1079
|
+
),
|
|
1080
|
+
this.contactEventFact(contact)
|
|
1081
|
+
);
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
findContact(first, firstGeneration, second, secondGeneration) {
|
|
1085
|
+
for (let contact = 0; contact < this.contacts.contactCount; contact += 1) {
|
|
1086
|
+
if (this.contacts.firstColliderIndices[contact] === first && this.contacts.firstColliderGenerations[contact] === firstGeneration && this.contacts.secondColliderIndices[contact] === second && this.contacts.secondColliderGenerations[contact] === secondGeneration) {
|
|
1087
|
+
return contact;
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
return -1;
|
|
1091
|
+
}
|
|
1092
|
+
contactEventFact(contact) {
|
|
1093
|
+
const base = contact * 2;
|
|
1094
|
+
const pointCount = this.contacts.pointCounts[contact];
|
|
1095
|
+
return Object.freeze({
|
|
1096
|
+
normalX: this.contacts.normalX[contact],
|
|
1097
|
+
normalY: this.contacts.normalY[contact],
|
|
1098
|
+
pointCount,
|
|
1099
|
+
pointFirstX: Object.freeze([
|
|
1100
|
+
this.contacts.pointFirstX[base],
|
|
1101
|
+
this.contacts.pointFirstX[base + 1]
|
|
1102
|
+
]),
|
|
1103
|
+
pointFirstY: Object.freeze([
|
|
1104
|
+
this.contacts.pointFirstY[base],
|
|
1105
|
+
this.contacts.pointFirstY[base + 1]
|
|
1106
|
+
]),
|
|
1107
|
+
pointSecondX: Object.freeze([
|
|
1108
|
+
this.contacts.pointSecondX[base],
|
|
1109
|
+
this.contacts.pointSecondX[base + 1]
|
|
1110
|
+
]),
|
|
1111
|
+
pointSecondY: Object.freeze([
|
|
1112
|
+
this.contacts.pointSecondY[base],
|
|
1113
|
+
this.contacts.pointSecondY[base + 1]
|
|
1114
|
+
]),
|
|
1115
|
+
pointSeparations: Object.freeze([
|
|
1116
|
+
this.contacts.pointSeparations[base],
|
|
1117
|
+
this.contacts.pointSeparations[base + 1]
|
|
1118
|
+
]),
|
|
1119
|
+
totalNormalImpulse: this.contacts.pointNormalImpulses[base] + this.contacts.pointNormalImpulses[base + 1]
|
|
1120
|
+
});
|
|
1121
|
+
}
|
|
1122
|
+
solvePositions() {
|
|
1123
|
+
const pointCount = this.contacts.contactCount * 2;
|
|
1124
|
+
this.ensureSavedImpulseCapacity(pointCount);
|
|
1125
|
+
this.state.savedNormalImpulses.set(
|
|
1126
|
+
this.contacts.pointNormalImpulses.subarray(0, pointCount),
|
|
1127
|
+
0
|
|
1128
|
+
);
|
|
1129
|
+
this.state.savedTangentImpulses.set(
|
|
1130
|
+
this.contacts.pointTangentImpulses.subarray(0, pointCount),
|
|
1131
|
+
0
|
|
1132
|
+
);
|
|
1133
|
+
this.contacts.pointNormalImpulses.fill(0, 0, pointCount);
|
|
1134
|
+
this.contacts.pointTangentImpulses.fill(0, 0, pointCount);
|
|
1135
|
+
this.positionSolver.solveCandidate(
|
|
1136
|
+
this.bodies,
|
|
1137
|
+
this.state.bodyIndices,
|
|
1138
|
+
this.state.bodyCount,
|
|
1139
|
+
this.contacts,
|
|
1140
|
+
0,
|
|
1141
|
+
this.state.configuration.positionIterations
|
|
1142
|
+
);
|
|
1143
|
+
this.contacts.pointNormalImpulses.set(
|
|
1144
|
+
this.state.savedNormalImpulses.subarray(0, pointCount),
|
|
1145
|
+
0
|
|
1146
|
+
);
|
|
1147
|
+
this.contacts.pointTangentImpulses.set(
|
|
1148
|
+
this.state.savedTangentImpulses.subarray(0, pointCount),
|
|
1149
|
+
0
|
|
1150
|
+
);
|
|
1151
|
+
this.solver.positionIterationsPerformed = this.positionSolver.positionIterationsPerformed;
|
|
1152
|
+
}
|
|
1153
|
+
ensureSavedImpulseCapacity(required) {
|
|
1154
|
+
if (required <= this.state.savedNormalImpulses.length) return;
|
|
1155
|
+
let capacity = this.state.savedNormalImpulses.length * 2;
|
|
1156
|
+
while (capacity < required) capacity *= 2;
|
|
1157
|
+
this.state.savedNormalImpulses = growFloat64(
|
|
1158
|
+
this.state.savedNormalImpulses,
|
|
1159
|
+
capacity
|
|
1160
|
+
);
|
|
1161
|
+
this.state.savedTangentImpulses = growFloat64(
|
|
1162
|
+
this.state.savedTangentImpulses,
|
|
1163
|
+
capacity
|
|
1164
|
+
);
|
|
1165
|
+
}
|
|
1166
|
+
appendEvent(kind, first, second, firstGeneration = 0, secondGeneration = 0, fact) {
|
|
1167
|
+
this.ensureEventCapacity(this.state.eventCount + 1);
|
|
1168
|
+
const event = this.state.eventCount;
|
|
1169
|
+
this.state.eventTicks[event] = this.state.tick + 1;
|
|
1170
|
+
this.state.eventKinds[event] = kind;
|
|
1171
|
+
this.state.eventFirstColliderIndices[event] = first;
|
|
1172
|
+
this.state.eventFirstColliderGenerations[event] = firstGeneration;
|
|
1173
|
+
this.state.eventSecondColliderIndices[event] = second;
|
|
1174
|
+
this.state.eventSecondColliderGenerations[event] = secondGeneration;
|
|
1175
|
+
this.state.eventNormalX[event] = fact?.normalX ?? 0;
|
|
1176
|
+
this.state.eventNormalY[event] = fact?.normalY ?? 0;
|
|
1177
|
+
this.state.eventPointCounts[event] = fact?.pointCount ?? 0;
|
|
1178
|
+
this.state.eventTotalNormalImpulses[event] = fact?.totalNormalImpulse ?? 0;
|
|
1179
|
+
const pointBase = event * 2;
|
|
1180
|
+
for (let point = 0; point < 2; point += 1) {
|
|
1181
|
+
this.state.eventPointFirstX[pointBase + point] = fact?.pointFirstX[point] ?? 0;
|
|
1182
|
+
this.state.eventPointFirstY[pointBase + point] = fact?.pointFirstY[point] ?? 0;
|
|
1183
|
+
this.state.eventPointSecondX[pointBase + point] = fact?.pointSecondX[point] ?? 0;
|
|
1184
|
+
this.state.eventPointSecondY[pointBase + point] = fact?.pointSecondY[point] ?? 0;
|
|
1185
|
+
this.state.eventPointSeparations[pointBase + point] = fact?.pointSeparations[point] ?? 0;
|
|
1186
|
+
}
|
|
1187
|
+
this.state.eventCount += 1;
|
|
1188
|
+
}
|
|
1189
|
+
ensureEventCapacity(required) {
|
|
1190
|
+
if (required <= this.state.eventKinds.length) return;
|
|
1191
|
+
let capacity = this.state.eventKinds.length * 2;
|
|
1192
|
+
while (capacity < required) capacity *= 2;
|
|
1193
|
+
this.state.eventTicks = growFloat64(this.state.eventTicks, capacity);
|
|
1194
|
+
this.state.eventKinds = growUint8(this.state.eventKinds, capacity);
|
|
1195
|
+
this.state.eventFirstColliderIndices = growInt32(
|
|
1196
|
+
this.state.eventFirstColliderIndices,
|
|
1197
|
+
capacity
|
|
1198
|
+
);
|
|
1199
|
+
this.state.eventFirstColliderGenerations = growUint32(
|
|
1200
|
+
this.state.eventFirstColliderGenerations,
|
|
1201
|
+
capacity
|
|
1202
|
+
);
|
|
1203
|
+
this.state.eventSecondColliderIndices = growInt32(
|
|
1204
|
+
this.state.eventSecondColliderIndices,
|
|
1205
|
+
capacity
|
|
1206
|
+
);
|
|
1207
|
+
this.state.eventSecondColliderGenerations = growUint32(
|
|
1208
|
+
this.state.eventSecondColliderGenerations,
|
|
1209
|
+
capacity
|
|
1210
|
+
);
|
|
1211
|
+
this.state.eventNormalX = growFloat64(this.state.eventNormalX, capacity);
|
|
1212
|
+
this.state.eventNormalY = growFloat64(this.state.eventNormalY, capacity);
|
|
1213
|
+
this.state.eventPointCounts = growUint8(
|
|
1214
|
+
this.state.eventPointCounts,
|
|
1215
|
+
capacity
|
|
1216
|
+
);
|
|
1217
|
+
this.state.eventPointFirstX = growFloat64(
|
|
1218
|
+
this.state.eventPointFirstX,
|
|
1219
|
+
capacity * 2
|
|
1220
|
+
);
|
|
1221
|
+
this.state.eventPointFirstY = growFloat64(
|
|
1222
|
+
this.state.eventPointFirstY,
|
|
1223
|
+
capacity * 2
|
|
1224
|
+
);
|
|
1225
|
+
this.state.eventPointSecondX = growFloat64(
|
|
1226
|
+
this.state.eventPointSecondX,
|
|
1227
|
+
capacity * 2
|
|
1228
|
+
);
|
|
1229
|
+
this.state.eventPointSecondY = growFloat64(
|
|
1230
|
+
this.state.eventPointSecondY,
|
|
1231
|
+
capacity * 2
|
|
1232
|
+
);
|
|
1233
|
+
this.state.eventPointSeparations = growFloat64(
|
|
1234
|
+
this.state.eventPointSeparations,
|
|
1235
|
+
capacity * 2
|
|
1236
|
+
);
|
|
1237
|
+
this.state.eventTotalNormalImpulses = growFloat64(
|
|
1238
|
+
this.state.eventTotalNormalImpulses,
|
|
1239
|
+
capacity
|
|
1240
|
+
);
|
|
1241
|
+
}
|
|
1242
|
+
capturePreviousPoses() {
|
|
1243
|
+
for (let offset = 0; offset < this.state.bodyCount; offset += 1) {
|
|
1244
|
+
this.snapPreviousPose(this.state.bodyIndices[offset]);
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
snapPreviousPose(index) {
|
|
1248
|
+
this.state.previousPositionX[index] = this.bodies.positionX[index];
|
|
1249
|
+
this.state.previousPositionY[index] = this.bodies.positionY[index];
|
|
1250
|
+
this.state.previousRotationRadians[index] = this.bodies.rotationRadians[index];
|
|
1251
|
+
}
|
|
1252
|
+
setBodyOriginPose(index, pose) {
|
|
1253
|
+
const rotationRadians = pose.rotationDegrees / RADIANS_TO_DEGREES;
|
|
1254
|
+
const center = centerFromOrigin(
|
|
1255
|
+
this.bodies,
|
|
1256
|
+
index,
|
|
1257
|
+
pose.position[0],
|
|
1258
|
+
pose.position[1],
|
|
1259
|
+
rotationRadians
|
|
1260
|
+
);
|
|
1261
|
+
this.bodies.positionX[index] = center[0];
|
|
1262
|
+
this.bodies.positionY[index] = center[1];
|
|
1263
|
+
this.bodies.rotationRadians[index] = rotationRadians;
|
|
1264
|
+
}
|
|
1265
|
+
rebuildBodyIndices() {
|
|
1266
|
+
this.ensureBodyScratchCapacity();
|
|
1267
|
+
const indices = [...this.state.bodySlots.values()].map((slot) => slot.index).sort((first, second) => first - second);
|
|
1268
|
+
this.state.bodyCount = indices.length;
|
|
1269
|
+
for (let offset = 0; offset < indices.length; offset += 1) {
|
|
1270
|
+
this.state.bodyIndices[offset] = indices[offset];
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
rebuildIntegrationBodyIndices() {
|
|
1274
|
+
let count = 0;
|
|
1275
|
+
for (let offset = 0; offset < this.state.bodyCount; offset += 1) {
|
|
1276
|
+
const body = this.state.bodyIndices[offset];
|
|
1277
|
+
if ((this.bodies.flags[body] & BODY_SLEEPING_2D) !== 0) continue;
|
|
1278
|
+
this.state.integrationBodyIndices[count] = body;
|
|
1279
|
+
count += 1;
|
|
1280
|
+
}
|
|
1281
|
+
this.state.integrationBodyCount = count;
|
|
1282
|
+
}
|
|
1283
|
+
ensureBodyScratchCapacity() {
|
|
1284
|
+
if (this.bodies.capacity <= this.state.previousPositionX.length) return;
|
|
1285
|
+
const capacity = this.bodies.capacity;
|
|
1286
|
+
this.state.previousPositionX = growFloat64(
|
|
1287
|
+
this.state.previousPositionX,
|
|
1288
|
+
capacity
|
|
1289
|
+
);
|
|
1290
|
+
this.state.previousPositionY = growFloat64(
|
|
1291
|
+
this.state.previousPositionY,
|
|
1292
|
+
capacity
|
|
1293
|
+
);
|
|
1294
|
+
this.state.previousRotationRadians = growFloat64(
|
|
1295
|
+
this.state.previousRotationRadians,
|
|
1296
|
+
capacity
|
|
1297
|
+
);
|
|
1298
|
+
this.state.bodyIndices = growInt32(this.state.bodyIndices, capacity);
|
|
1299
|
+
this.state.integrationBodyIndices = growInt32(
|
|
1300
|
+
this.state.integrationBodyIndices,
|
|
1301
|
+
capacity
|
|
1302
|
+
);
|
|
1303
|
+
}
|
|
1304
|
+
wakeBody(bodyIndex) {
|
|
1305
|
+
const wasSleeping = (this.bodies.flags[bodyIndex] & BODY_SLEEPING_2D) !== 0;
|
|
1306
|
+
let targetWakeRecorded = false;
|
|
1307
|
+
const islandChanged = this.solver.wakeIslandContainingCandidate(
|
|
1308
|
+
this.bodies,
|
|
1309
|
+
bodyIndex,
|
|
1310
|
+
(body, sleeping) => {
|
|
1311
|
+
if (body === bodyIndex && !sleeping) targetWakeRecorded = true;
|
|
1312
|
+
this.appendEvent(sleeping ? 6 : 5, body, NO_INDEX);
|
|
1313
|
+
}
|
|
1314
|
+
);
|
|
1315
|
+
this.bodies.flags[bodyIndex] &= ~BODY_SLEEPING_2D;
|
|
1316
|
+
this.bodies.sleepTime[bodyIndex] = 0;
|
|
1317
|
+
if (wasSleeping && !targetWakeRecorded) {
|
|
1318
|
+
this.appendEvent(5, bodyIndex, NO_INDEX);
|
|
1319
|
+
}
|
|
1320
|
+
return wasSleeping || islandChanged;
|
|
1321
|
+
}
|
|
1322
|
+
releaseCollider(slot) {
|
|
1323
|
+
const proxy = this.colliders.proxyIndices[slot.index];
|
|
1324
|
+
const proxyGeneration = this.colliders.proxyGenerations[slot.index];
|
|
1325
|
+
if (proxy !== NO_INDEX)
|
|
1326
|
+
this.broadPhase.destroyProxy(proxy, proxyGeneration);
|
|
1327
|
+
this.colliders.release(slot.index, slot.generation);
|
|
1328
|
+
}
|
|
1329
|
+
captureCheckpoint() {
|
|
1330
|
+
return {
|
|
1331
|
+
rapier: this.simulation?.checkpoint(),
|
|
1332
|
+
snapshots: [
|
|
1333
|
+
captureObject(this.state),
|
|
1334
|
+
captureObject(this.counters),
|
|
1335
|
+
captureObject(this.bodies),
|
|
1336
|
+
captureObject(this.colliders),
|
|
1337
|
+
captureObject(this.broadPhase),
|
|
1338
|
+
captureObject(this.contacts),
|
|
1339
|
+
captureObject(this.solver),
|
|
1340
|
+
captureObject(this.positionSolver),
|
|
1341
|
+
captureObject(this.ccd)
|
|
1342
|
+
]
|
|
1343
|
+
};
|
|
1344
|
+
}
|
|
1345
|
+
restoreCheckpoint(checkpoint) {
|
|
1346
|
+
if (checkpoint.rapier) this.simulation.restore(checkpoint.rapier);
|
|
1347
|
+
for (let index = checkpoint.snapshots.length - 1; index >= 0; index -= 1) {
|
|
1348
|
+
restoreObject(checkpoint.snapshots[index]);
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1351
|
+
requireBody(bodyId) {
|
|
1352
|
+
const slot = this.state.bodySlots.get(bodyId);
|
|
1353
|
+
if (slot === void 0) throw new Error(`unknown physics body ${bodyId}.`);
|
|
1354
|
+
return slot;
|
|
1355
|
+
}
|
|
1356
|
+
hasAdvanceWork() {
|
|
1357
|
+
if (this.pendingTopology !== void 0 || this.pendingCommands.length > 0) {
|
|
1358
|
+
return true;
|
|
1359
|
+
}
|
|
1360
|
+
for (let offset = 0; offset < this.state.bodyCount; offset += 1) {
|
|
1361
|
+
const body = this.state.bodyIndices[offset];
|
|
1362
|
+
if ((this.bodies.flags[body] & BODY_TYPE_KINEMATIC_2D) !== 0)
|
|
1363
|
+
return true;
|
|
1364
|
+
if ((this.bodies.flags[body] & BODY_SLEEPING_2D) === 0) return true;
|
|
1365
|
+
}
|
|
1366
|
+
return false;
|
|
1367
|
+
}
|
|
1368
|
+
hasKinematicBodies() {
|
|
1369
|
+
for (let offset = 0; offset < this.state.bodyCount; offset += 1) {
|
|
1370
|
+
const body = this.state.bodyIndices[offset];
|
|
1371
|
+
if ((this.bodies.flags[body] & BODY_TYPE_KINEMATIC_2D) !== 0)
|
|
1372
|
+
return true;
|
|
1373
|
+
}
|
|
1374
|
+
return false;
|
|
1375
|
+
}
|
|
1376
|
+
assertCandidate(candidate) {
|
|
1377
|
+
this.assertUsable();
|
|
1378
|
+
if (candidate.owner !== this || candidate !== this.liveCandidate || candidate.lifecycle !== "live") {
|
|
1379
|
+
throw new Error("candidate is not the live candidate for this world.");
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
assertUsable() {
|
|
1383
|
+
if (this.disposed) throw new Error("physics world is disposed.");
|
|
1384
|
+
}
|
|
1385
|
+
}
|
|
1386
|
+
function normalizePhysicsWorld2DConfiguration(configuration) {
|
|
1387
|
+
const gravity = configuration.gravity ?? DEFAULT_GRAVITY;
|
|
1388
|
+
if (gravity.length !== 2 || !Number.isFinite(gravity[0]) || !Number.isFinite(gravity[1])) {
|
|
1389
|
+
throw new RangeError("gravity must contain two finite numbers.");
|
|
1390
|
+
}
|
|
1391
|
+
const fixedStepMilliseconds = configuration.fixedStepMilliseconds ?? DEFAULT_FIXED_STEP_MILLISECONDS;
|
|
1392
|
+
if (!Number.isFinite(fixedStepMilliseconds) || fixedStepMilliseconds <= 0) {
|
|
1393
|
+
throw new RangeError("fixedStepMilliseconds must be finite and positive.");
|
|
1394
|
+
}
|
|
1395
|
+
const maxCatchUpSteps = configuration.maxCatchUpSteps ?? DEFAULT_MAX_CATCH_UP_STEPS;
|
|
1396
|
+
validateIntegerRange(
|
|
1397
|
+
maxCatchUpSteps,
|
|
1398
|
+
MIN_CATCH_UP_STEPS,
|
|
1399
|
+
MAX_CATCH_UP_STEPS,
|
|
1400
|
+
"maxCatchUpSteps"
|
|
1401
|
+
);
|
|
1402
|
+
const interpolation = configuration.interpolation ?? DEFAULT_INTERPOLATION;
|
|
1403
|
+
if (interpolation !== "linear" && interpolation !== "none") {
|
|
1404
|
+
throw new RangeError('interpolation must be "linear" or "none".');
|
|
1405
|
+
}
|
|
1406
|
+
const velocityIterations = configuration.solver?.velocityIterations ?? configuration.velocityIterations ?? DEFAULT_VELOCITY_ITERATIONS;
|
|
1407
|
+
const positionIterations = configuration.solver?.positionIterations ?? configuration.positionIterations ?? DEFAULT_POSITION_ITERATIONS;
|
|
1408
|
+
validateIntegerRange(
|
|
1409
|
+
velocityIterations,
|
|
1410
|
+
MIN_SOLVER_ITERATIONS,
|
|
1411
|
+
MAX_SOLVER_ITERATIONS,
|
|
1412
|
+
"velocityIterations"
|
|
1413
|
+
);
|
|
1414
|
+
validateIntegerRange(
|
|
1415
|
+
positionIterations,
|
|
1416
|
+
MIN_SOLVER_ITERATIONS,
|
|
1417
|
+
MAX_SOLVER_ITERATIONS,
|
|
1418
|
+
"positionIterations"
|
|
1419
|
+
);
|
|
1420
|
+
return Object.freeze({
|
|
1421
|
+
gravityX: gravity[0],
|
|
1422
|
+
gravityY: gravity[1],
|
|
1423
|
+
fixedStepMilliseconds,
|
|
1424
|
+
maxCatchUpSteps,
|
|
1425
|
+
interpolation,
|
|
1426
|
+
sleeping: configuration.sleeping ?? DEFAULT_SLEEPING,
|
|
1427
|
+
velocityIterations,
|
|
1428
|
+
positionIterations
|
|
1429
|
+
});
|
|
1430
|
+
}
|
|
1431
|
+
function captureObject(target) {
|
|
1432
|
+
const record = target;
|
|
1433
|
+
const values = Reflect.ownKeys(record).map((key) => {
|
|
1434
|
+
const value = record[key];
|
|
1435
|
+
if (ArrayBuffer.isView(value) && !(value instanceof DataView)) {
|
|
1436
|
+
return {
|
|
1437
|
+
key,
|
|
1438
|
+
kind: "typed-array",
|
|
1439
|
+
reference: value,
|
|
1440
|
+
contents: value.slice()
|
|
1441
|
+
};
|
|
1442
|
+
}
|
|
1443
|
+
if (Array.isArray(value)) {
|
|
1444
|
+
return { key, kind: "array", reference: value, contents: [...value] };
|
|
1445
|
+
}
|
|
1446
|
+
if (value instanceof Map) {
|
|
1447
|
+
return {
|
|
1448
|
+
key,
|
|
1449
|
+
kind: "map",
|
|
1450
|
+
reference: value,
|
|
1451
|
+
contents: [...value.entries()]
|
|
1452
|
+
};
|
|
1453
|
+
}
|
|
1454
|
+
return { key, kind: "value", reference: value };
|
|
1455
|
+
});
|
|
1456
|
+
return { target: record, values };
|
|
1457
|
+
}
|
|
1458
|
+
function restoreObject(snapshot) {
|
|
1459
|
+
for (let index = snapshot.values.length - 1; index >= 0; index -= 1) {
|
|
1460
|
+
const value = snapshot.values[index];
|
|
1461
|
+
switch (value.kind) {
|
|
1462
|
+
case "typed-array": {
|
|
1463
|
+
snapshot.target[value.key] = value.reference;
|
|
1464
|
+
const target = value.reference;
|
|
1465
|
+
target.set(value.contents);
|
|
1466
|
+
break;
|
|
1467
|
+
}
|
|
1468
|
+
case "array": {
|
|
1469
|
+
snapshot.target[value.key] = value.reference;
|
|
1470
|
+
const target = value.reference;
|
|
1471
|
+
target.length = 0;
|
|
1472
|
+
target.push(...value.contents);
|
|
1473
|
+
break;
|
|
1474
|
+
}
|
|
1475
|
+
case "map": {
|
|
1476
|
+
snapshot.target[value.key] = value.reference;
|
|
1477
|
+
const target = value.reference;
|
|
1478
|
+
target.clear();
|
|
1479
|
+
for (const [key, entry] of value.contents) {
|
|
1480
|
+
target.set(key, entry);
|
|
1481
|
+
}
|
|
1482
|
+
break;
|
|
1483
|
+
}
|
|
1484
|
+
case "value":
|
|
1485
|
+
snapshot.target[value.key] = value.reference;
|
|
1486
|
+
break;
|
|
1487
|
+
}
|
|
1488
|
+
}
|
|
1489
|
+
}
|
|
1490
|
+
function validateTopology(records) {
|
|
1491
|
+
const bodies = /* @__PURE__ */ new Set();
|
|
1492
|
+
const colliders = /* @__PURE__ */ new Set();
|
|
1493
|
+
for (const record of records) {
|
|
1494
|
+
validateId(record.id, `${record.kind} id`);
|
|
1495
|
+
const ids = record.kind === "body" ? bodies : colliders;
|
|
1496
|
+
if (ids.has(record.id)) {
|
|
1497
|
+
throw new Error(`duplicate ${record.kind} id ${record.id}.`);
|
|
1498
|
+
}
|
|
1499
|
+
ids.add(record.id);
|
|
1500
|
+
if (record.kind === "body") validateBodyDefinition(record.definition);
|
|
1501
|
+
else validateId(record.bodyId, "collider bodyId");
|
|
1502
|
+
}
|
|
1503
|
+
for (const record of records) {
|
|
1504
|
+
if (record.kind === "collider" && !bodies.has(record.bodyId)) {
|
|
1505
|
+
throw new Error(
|
|
1506
|
+
`collider ${record.id} references missing body ${record.bodyId}.`
|
|
1507
|
+
);
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
}
|
|
1511
|
+
function hasColliderHandler(handlers, name) {
|
|
1512
|
+
return typeof handlers === "object" && handlers !== null && typeof handlers[name] === "function";
|
|
1513
|
+
}
|
|
1514
|
+
function validateBodyDefinition(definition) {
|
|
1515
|
+
for (const [name, value] of Object.entries(definition)) {
|
|
1516
|
+
if (name === "owner" || name === "flags") continue;
|
|
1517
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
1518
|
+
throw new RangeError(`body ${name} must be finite.`);
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1521
|
+
if (!Number.isSafeInteger(definition.flags) || definition.flags < 0) {
|
|
1522
|
+
throw new RangeError("body flags must be a nonnegative safe integer.");
|
|
1523
|
+
}
|
|
1524
|
+
}
|
|
1525
|
+
function validateCommand(command) {
|
|
1526
|
+
if (command.kind === "configure") {
|
|
1527
|
+
normalizePhysicsWorld2DConfiguration(command.configuration);
|
|
1528
|
+
return;
|
|
1529
|
+
}
|
|
1530
|
+
validateId(command.bodyId, "command bodyId");
|
|
1531
|
+
if (command.kind === "set-pose") {
|
|
1532
|
+
validatePose(command.pose, "command pose");
|
|
1533
|
+
return;
|
|
1534
|
+
}
|
|
1535
|
+
if (command.kind === "enable") {
|
|
1536
|
+
if (command.velocity !== "zero" && command.velocity !== "preserve") {
|
|
1537
|
+
throw new RangeError('command velocity must be "zero" or "preserve".');
|
|
1538
|
+
}
|
|
1539
|
+
return;
|
|
1540
|
+
}
|
|
1541
|
+
for (const [name, value] of Object.entries(command)) {
|
|
1542
|
+
if (name === "kind" || name === "bodyId" || name === "wake") continue;
|
|
1543
|
+
if ((name === "pointX" || name === "pointY") && value === void 0)
|
|
1544
|
+
continue;
|
|
1545
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
1546
|
+
throw new RangeError(`command ${name} must be finite.`);
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
}
|
|
1550
|
+
function injectFailure(stage) {
|
|
1551
|
+
failureInjector?.(stage);
|
|
1552
|
+
}
|
|
1553
|
+
function validatePose(pose, path) {
|
|
1554
|
+
if (pose.position.length !== 2 || !Number.isFinite(pose.position[0]) || !Number.isFinite(pose.position[1]) || !Number.isFinite(pose.rotationDegrees)) {
|
|
1555
|
+
throw new RangeError(`${path} must contain finite position and rotation.`);
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1558
|
+
function validateId(value, path) {
|
|
1559
|
+
if (!Number.isSafeInteger(value) || value < 0) {
|
|
1560
|
+
throw new RangeError(`${path} must be a nonnegative safe integer.`);
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
function validateIntegerRange(value, minimum, maximum, path) {
|
|
1564
|
+
if (!Number.isSafeInteger(value) || value < minimum || value > maximum) {
|
|
1565
|
+
throw new RangeError(
|
|
1566
|
+
`${path} must be an integer from ${minimum} through ${maximum}.`
|
|
1567
|
+
);
|
|
1568
|
+
}
|
|
1569
|
+
}
|
|
1570
|
+
function writeBodyDefinition(bodies, index, definition) {
|
|
1571
|
+
bodies.positionX[index] = definition.positionX;
|
|
1572
|
+
bodies.positionY[index] = definition.positionY;
|
|
1573
|
+
bodies.rotationRadians[index] = definition.rotationRadians;
|
|
1574
|
+
bodies.localCenterX[index] = definition.localCenterX ?? 0;
|
|
1575
|
+
bodies.localCenterY[index] = definition.localCenterY ?? 0;
|
|
1576
|
+
bodies.linearVelocityX[index] = definition.linearVelocityX;
|
|
1577
|
+
bodies.linearVelocityY[index] = definition.linearVelocityY;
|
|
1578
|
+
bodies.angularVelocity[index] = definition.angularVelocity;
|
|
1579
|
+
bodies.forceX[index] = definition.forceX;
|
|
1580
|
+
bodies.forceY[index] = definition.forceY;
|
|
1581
|
+
bodies.torque[index] = definition.torque;
|
|
1582
|
+
bodies.inverseMass[index] = definition.inverseMass;
|
|
1583
|
+
bodies.inverseInertia[index] = definition.inverseInertia;
|
|
1584
|
+
bodies.linearDamping[index] = definition.linearDamping;
|
|
1585
|
+
bodies.angularDamping[index] = definition.angularDamping;
|
|
1586
|
+
bodies.gravityScale[index] = definition.gravityScale;
|
|
1587
|
+
bodies.sleepTime[index] = definition.sleepTime;
|
|
1588
|
+
bodies.flags[index] = definition.flags;
|
|
1589
|
+
bodies.owners[index] = definition.owner;
|
|
1590
|
+
}
|
|
1591
|
+
function sameBodyDefinition(first, second) {
|
|
1592
|
+
return first !== void 0 && first.positionX === second.positionX && first.positionY === second.positionY && first.rotationRadians === second.rotationRadians && (first.localCenterX ?? 0) === (second.localCenterX ?? 0) && (first.localCenterY ?? 0) === (second.localCenterY ?? 0) && first.linearVelocityX === second.linearVelocityX && first.linearVelocityY === second.linearVelocityY && first.angularVelocity === second.angularVelocity && first.forceX === second.forceX && first.forceY === second.forceY && first.torque === second.torque && first.inverseMass === second.inverseMass && first.inverseInertia === second.inverseInertia && first.linearDamping === second.linearDamping && first.angularDamping === second.angularDamping && first.gravityScale === second.gravityScale && first.sleepTime === second.sleepTime && first.flags === second.flags && first.owner === second.owner;
|
|
1593
|
+
}
|
|
1594
|
+
function sameColliderRecord(first, second) {
|
|
1595
|
+
return first !== void 0 && first.bodyId === second.bodyId && first.definition.shape === second.definition.shape && first.definition.flags === second.definition.flags && shallowRecordEqual(first.definition.material, second.definition.material) && shallowRecordEqual(first.definition.filter, second.definition.filter);
|
|
1596
|
+
}
|
|
1597
|
+
function shallowRecordEqual(first, second) {
|
|
1598
|
+
if (first === second) return true;
|
|
1599
|
+
if (typeof first !== "object" || first === null || typeof second !== "object" || second === null) {
|
|
1600
|
+
return false;
|
|
1601
|
+
}
|
|
1602
|
+
const firstEntries = Object.entries(first);
|
|
1603
|
+
const secondRecord = second;
|
|
1604
|
+
if (firstEntries.length !== Object.keys(secondRecord).length) return false;
|
|
1605
|
+
return firstEntries.every(([key, value]) => secondRecord[key] === value);
|
|
1606
|
+
}
|
|
1607
|
+
function colliderBounds(shape, x, y, rotation) {
|
|
1608
|
+
const bounds = shape.localBounds;
|
|
1609
|
+
const cosine = Math.cos(rotation);
|
|
1610
|
+
const sine = Math.sin(rotation);
|
|
1611
|
+
let minX = Number.POSITIVE_INFINITY;
|
|
1612
|
+
let minY = Number.POSITIVE_INFINITY;
|
|
1613
|
+
let maxX = Number.NEGATIVE_INFINITY;
|
|
1614
|
+
let maxY = Number.NEGATIVE_INFINITY;
|
|
1615
|
+
for (let corner = 0; corner < 4; corner += 1) {
|
|
1616
|
+
const localX = corner % 2 === 0 ? bounds[0] : bounds[2];
|
|
1617
|
+
const localY = corner < 2 ? bounds[1] : bounds[3];
|
|
1618
|
+
const worldX = x + cosine * localX - sine * localY;
|
|
1619
|
+
const worldY = y + sine * localX + cosine * localY;
|
|
1620
|
+
minX = Math.min(minX, worldX);
|
|
1621
|
+
minY = Math.min(minY, worldY);
|
|
1622
|
+
maxX = Math.max(maxX, worldX);
|
|
1623
|
+
maxY = Math.max(maxY, worldY);
|
|
1624
|
+
}
|
|
1625
|
+
return [minX, minY, maxX, maxY];
|
|
1626
|
+
}
|
|
1627
|
+
function internalPose(bodies, index) {
|
|
1628
|
+
const rotationRadians = bodies.rotationRadians[index];
|
|
1629
|
+
const cosine = Math.cos(rotationRadians);
|
|
1630
|
+
const sine = Math.sin(rotationRadians);
|
|
1631
|
+
const localCenterX = bodies.localCenterX[index];
|
|
1632
|
+
const localCenterY = bodies.localCenterY[index];
|
|
1633
|
+
return {
|
|
1634
|
+
x: bodies.positionX[index] - cosine * localCenterX + sine * localCenterY,
|
|
1635
|
+
y: bodies.positionY[index] - sine * localCenterX - cosine * localCenterY,
|
|
1636
|
+
rotationRadians
|
|
1637
|
+
};
|
|
1638
|
+
}
|
|
1639
|
+
function centerFromOrigin(bodies, index, originX, originY, rotationRadians) {
|
|
1640
|
+
const cosine = Math.cos(rotationRadians);
|
|
1641
|
+
const sine = Math.sin(rotationRadians);
|
|
1642
|
+
const localCenterX = bodies.localCenterX[index];
|
|
1643
|
+
const localCenterY = bodies.localCenterY[index];
|
|
1644
|
+
return [
|
|
1645
|
+
originX + cosine * localCenterX - sine * localCenterY,
|
|
1646
|
+
originY + sine * localCenterX + cosine * localCenterY
|
|
1647
|
+
];
|
|
1648
|
+
}
|
|
1649
|
+
function publicBodyOriginPose(bodies, index) {
|
|
1650
|
+
const pose = internalPose(bodies, index);
|
|
1651
|
+
return publicPose(pose.x, pose.y, pose.rotationRadians);
|
|
1652
|
+
}
|
|
1653
|
+
function publicPoseFromCenter(bodies, index, centerX, centerY, rotationRadians) {
|
|
1654
|
+
const cosine = Math.cos(rotationRadians);
|
|
1655
|
+
const sine = Math.sin(rotationRadians);
|
|
1656
|
+
const localCenterX = bodies.localCenterX[index];
|
|
1657
|
+
const localCenterY = bodies.localCenterY[index];
|
|
1658
|
+
return publicPose(
|
|
1659
|
+
centerX - cosine * localCenterX + sine * localCenterY,
|
|
1660
|
+
centerY - sine * localCenterX - cosine * localCenterY,
|
|
1661
|
+
rotationRadians
|
|
1662
|
+
);
|
|
1663
|
+
}
|
|
1664
|
+
function publicPose(x, y, rotationRadians) {
|
|
1665
|
+
return Object.freeze({
|
|
1666
|
+
position: Object.freeze([x, y]),
|
|
1667
|
+
rotationDegrees: rotationRadians * RADIANS_TO_DEGREES
|
|
1668
|
+
});
|
|
1669
|
+
}
|
|
1670
|
+
function shortestRadians(from, to) {
|
|
1671
|
+
const full = Math.PI * 2;
|
|
1672
|
+
let delta = ((to - from + Math.PI) % full + full) % full - Math.PI;
|
|
1673
|
+
if (delta === -Math.PI) delta = Math.PI;
|
|
1674
|
+
return delta;
|
|
1675
|
+
}
|
|
1676
|
+
function lerp(from, to, amount) {
|
|
1677
|
+
return from + (to - from) * amount;
|
|
1678
|
+
}
|
|
1679
|
+
function sortedEntries(map, descending = false) {
|
|
1680
|
+
return [...map.entries()].sort(
|
|
1681
|
+
([first], [second]) => descending ? second - first : first - second
|
|
1682
|
+
);
|
|
1683
|
+
}
|
|
1684
|
+
function contactKey(first, firstGeneration, second, secondGeneration) {
|
|
1685
|
+
return `${String(first)}:${String(firstGeneration)}:${String(second)}:${String(secondGeneration)}`;
|
|
1686
|
+
}
|
|
1687
|
+
function growFloat64(source, capacity) {
|
|
1688
|
+
const result = new Float64Array(capacity);
|
|
1689
|
+
result.set(source);
|
|
1690
|
+
return result;
|
|
1691
|
+
}
|
|
1692
|
+
function growInt32(source, capacity) {
|
|
1693
|
+
const result = new Int32Array(capacity);
|
|
1694
|
+
result.set(source);
|
|
1695
|
+
return result;
|
|
1696
|
+
}
|
|
1697
|
+
function growUint8(source, capacity) {
|
|
1698
|
+
const result = new Uint8Array(capacity);
|
|
1699
|
+
result.set(source);
|
|
1700
|
+
return result;
|
|
1701
|
+
}
|
|
1702
|
+
function growUint32(source, capacity) {
|
|
1703
|
+
const result = new Uint32Array(capacity);
|
|
1704
|
+
result.set(source);
|
|
1705
|
+
return result;
|
|
1706
|
+
}
|
|
1707
|
+
export {
|
|
1708
|
+
PhysicsWorld2DCandidate,
|
|
1709
|
+
PhysicsWorld2DKernel,
|
|
1710
|
+
installPhysicsWorld2DFailureInjectorForTest,
|
|
1711
|
+
normalizePhysicsWorld2DConfiguration
|
|
1712
|
+
};
|
|
1713
|
+
//# sourceMappingURL=world.js.map
|