@thunderclap-engine/engine 0.0.0-stage → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +390 -0
- package/LICENSE +21 -0
- package/README.md +333 -2
- package/dist/analytics/analytics.d.ts +80 -0
- package/dist/analytics/analytics.js +129 -0
- package/dist/analytics/index.d.ts +1 -0
- package/dist/analytics/index.js +1 -0
- package/dist/anim/aim.d.ts +43 -0
- package/dist/anim/aim.js +157 -0
- package/dist/anim/clip.d.ts +98 -0
- package/dist/anim/clip.js +282 -0
- package/dist/anim/compress.d.ts +65 -0
- package/dist/anim/compress.js +339 -0
- package/dist/anim/foot-ik.d.ts +74 -0
- package/dist/anim/foot-ik.js +241 -0
- package/dist/anim/graph.d.ts +153 -0
- package/dist/anim/graph.js +532 -0
- package/dist/anim/ik.d.ts +105 -0
- package/dist/anim/ik.js +435 -0
- package/dist/anim/index.d.ts +36 -0
- package/dist/anim/index.js +21 -0
- package/dist/anim/match.d.ts +66 -0
- package/dist/anim/match.js +153 -0
- package/dist/anim/mixer.d.ts +113 -0
- package/dist/anim/mixer.js +314 -0
- package/dist/anim/morph.d.ts +41 -0
- package/dist/anim/morph.js +94 -0
- package/dist/anim/pose.d.ts +74 -0
- package/dist/anim/pose.js +254 -0
- package/dist/anim/quat.d.ts +44 -0
- package/dist/anim/quat.js +187 -0
- package/dist/anim/retarget.d.ts +97 -0
- package/dist/anim/retarget.js +366 -0
- package/dist/anim/root-motion.d.ts +44 -0
- package/dist/anim/root-motion.js +224 -0
- package/dist/anim/skin-pose.d.ts +39 -0
- package/dist/anim/skin-pose.js +53 -0
- package/dist/anim/socket.d.ts +47 -0
- package/dist/anim/socket.js +84 -0
- package/dist/anim/spring-chain.d.ts +73 -0
- package/dist/anim/spring-chain.js +294 -0
- package/dist/assets/atlas.d.ts +90 -0
- package/dist/assets/atlas.js +212 -0
- package/dist/assets/baked.d.ts +33 -0
- package/dist/assets/baked.js +38 -0
- package/dist/assets/bundle.d.ts +88 -0
- package/dist/assets/bundle.js +464 -0
- package/dist/assets/cache.d.ts +56 -0
- package/dist/assets/cache.js +123 -0
- package/dist/assets/gltf-load.d.ts +252 -0
- package/dist/assets/gltf-load.js +661 -0
- package/dist/assets/gltf-skin.d.ts +36 -0
- package/dist/assets/gltf-skin.js +109 -0
- package/dist/assets/gltf.d.ts +706 -0
- package/dist/assets/gltf.js +1376 -0
- package/dist/assets/index.d.ts +20 -0
- package/dist/assets/index.js +10 -0
- package/dist/assets/ktx2.d.ts +71 -0
- package/dist/assets/ktx2.js +213 -0
- package/dist/assets/manifest.d.ts +79 -0
- package/dist/assets/manifest.js +7 -0
- package/dist/assets/meshopt.d.ts +23 -0
- package/dist/assets/meshopt.js +403 -0
- package/dist/audio/audio.d.ts +733 -0
- package/dist/audio/audio.js +2013 -0
- package/dist/audio/dsp.d.ts +61 -0
- package/dist/audio/dsp.js +159 -0
- package/dist/audio/duck.d.ts +44 -0
- package/dist/audio/duck.js +101 -0
- package/dist/audio/envelope.d.ts +53 -0
- package/dist/audio/envelope.js +106 -0
- package/dist/audio/index.d.ts +13 -0
- package/dist/audio/index.js +14 -0
- package/dist/audio/music.d.ts +113 -0
- package/dist/audio/music.js +548 -0
- package/dist/audio/occlusion.d.ts +55 -0
- package/dist/audio/occlusion.js +61 -0
- package/dist/audio/persist.d.ts +23 -0
- package/dist/audio/persist.js +27 -0
- package/dist/audio/recipes.d.ts +55 -0
- package/dist/audio/recipes.js +227 -0
- package/dist/audio/send.d.ts +41 -0
- package/dist/audio/send.js +118 -0
- package/dist/audio/sprites.d.ts +59 -0
- package/dist/audio/sprites.js +43 -0
- package/dist/audio/synth.d.ts +103 -0
- package/dist/audio/synth.js +197 -0
- package/dist/audio/variations.d.ts +25 -0
- package/dist/audio/variations.js +55 -0
- package/dist/audio/zones.d.ts +100 -0
- package/dist/audio/zones.js +167 -0
- package/dist/core/detached-surface.d.ts +44 -0
- package/dist/core/detached-surface.js +104 -0
- package/dist/core/events.d.ts +24 -0
- package/dist/core/events.js +43 -0
- package/dist/core/game.d.ts +409 -0
- package/dist/core/game.js +530 -0
- package/dist/core/hash.d.ts +24 -0
- package/dist/core/hash.js +49 -0
- package/dist/core/index.d.ts +17 -0
- package/dist/core/index.js +9 -0
- package/dist/core/loop.d.ts +113 -0
- package/dist/core/loop.js +185 -0
- package/dist/core/math.d.ts +58 -0
- package/dist/core/math.js +210 -0
- package/dist/core/noise.d.ts +40 -0
- package/dist/core/noise.js +247 -0
- package/dist/core/pool.d.ts +42 -0
- package/dist/core/pool.js +85 -0
- package/dist/core/random.d.ts +61 -0
- package/dist/core/random.js +199 -0
- package/dist/core/scene.d.ts +79 -0
- package/dist/core/scene.js +195 -0
- package/dist/core/timer.d.ts +66 -0
- package/dist/core/timer.js +286 -0
- package/dist/fx/billboard-wgsl.d.ts +29 -0
- package/dist/fx/billboard-wgsl.js +158 -0
- package/dist/fx/billboard.d.ts +249 -0
- package/dist/fx/billboard.js +702 -0
- package/dist/fx/debug-draw.d.ts +127 -0
- package/dist/fx/debug-draw.js +523 -0
- package/dist/fx/debug-wgsl.d.ts +7 -0
- package/dist/fx/debug-wgsl.js +32 -0
- package/dist/fx/decals-wgsl.d.ts +15 -0
- package/dist/fx/decals-wgsl.js +173 -0
- package/dist/fx/decals.d.ts +216 -0
- package/dist/fx/decals.js +607 -0
- package/dist/fx/effect.d.ts +129 -0
- package/dist/fx/effect.js +349 -0
- package/dist/fx/effects/hit-spark.json +48 -0
- package/dist/fx/effects/index.d.ts +8 -0
- package/dist/fx/effects/index.js +9 -0
- package/dist/fx/effects/magic-aura.json +47 -0
- package/dist/fx/effects/smoke-puff.json +34 -0
- package/dist/fx/emit-surface.d.ts +40 -0
- package/dist/fx/emit-surface.js +124 -0
- package/dist/fx/flicker.d.ts +30 -0
- package/dist/fx/flicker.js +42 -0
- package/dist/fx/index.d.ts +31 -0
- package/dist/fx/index.js +20 -0
- package/dist/fx/particles-wgsl.d.ts +57 -0
- package/dist/fx/particles-wgsl.js +828 -0
- package/dist/fx/particles.d.ts +566 -0
- package/dist/fx/particles.js +1533 -0
- package/dist/fx/random.d.ts +15 -0
- package/dist/fx/random.js +20 -0
- package/dist/fx/sky-wgsl.d.ts +23 -0
- package/dist/fx/sky-wgsl.js +127 -0
- package/dist/fx/sky.d.ts +96 -0
- package/dist/fx/sky.js +175 -0
- package/dist/fx/text-atlas.d.ts +143 -0
- package/dist/fx/text-atlas.js +327 -0
- package/dist/fx/trail-wgsl.d.ts +11 -0
- package/dist/fx/trail-wgsl.js +42 -0
- package/dist/fx/trail.d.ts +194 -0
- package/dist/fx/trail.js +555 -0
- package/dist/fx/water-wgsl.d.ts +34 -0
- package/dist/fx/water-wgsl.js +197 -0
- package/dist/fx/water.d.ts +176 -0
- package/dist/fx/water.js +371 -0
- package/dist/geom/collide/bvh.d.ts +151 -0
- package/dist/geom/collide/bvh.js +493 -0
- package/dist/geom/collide/debug.d.ts +14 -0
- package/dist/geom/collide/debug.js +74 -0
- package/dist/geom/collide/grid.d.ts +26 -0
- package/dist/geom/collide/grid.js +91 -0
- package/dist/geom/collide/index.d.ts +8 -0
- package/dist/geom/collide/index.js +8 -0
- package/dist/geom/collide/queries.d.ts +70 -0
- package/dist/geom/collide/queries.js +583 -0
- package/dist/geom/collide/serialize.d.ts +14 -0
- package/dist/geom/collide/serialize.js +145 -0
- package/dist/geom/collide/shapes.d.ts +161 -0
- package/dist/geom/collide/shapes.js +686 -0
- package/dist/geom/collide/slide.d.ts +66 -0
- package/dist/geom/collide/slide.js +375 -0
- package/dist/geom/collide/tile-slide.d.ts +88 -0
- package/dist/geom/collide/tile-slide.js +255 -0
- package/dist/geom/geometry.d.ts +95 -0
- package/dist/geom/geometry.js +322 -0
- package/dist/geom/heightfield.d.ts +72 -0
- package/dist/geom/heightfield.js +295 -0
- package/dist/geom/hull.d.ts +27 -0
- package/dist/geom/hull.js +279 -0
- package/dist/geom/index.d.ts +35 -0
- package/dist/geom/index.js +23 -0
- package/dist/geom/iso.d.ts +74 -0
- package/dist/geom/iso.js +89 -0
- package/dist/geom/lod.d.ts +29 -0
- package/dist/geom/lod.js +27 -0
- package/dist/geom/ops.d.ts +47 -0
- package/dist/geom/ops.js +285 -0
- package/dist/geom/primitives.d.ts +97 -0
- package/dist/geom/primitives.js +359 -0
- package/dist/geom/shapes.d.ts +43 -0
- package/dist/geom/shapes.js +88 -0
- package/dist/geom/simplify.d.ts +38 -0
- package/dist/geom/simplify.js +519 -0
- package/dist/geom/split.d.ts +37 -0
- package/dist/geom/split.js +413 -0
- package/dist/geom/sweep.d.ts +83 -0
- package/dist/geom/sweep.js +534 -0
- package/dist/geom/tangents.d.ts +16 -0
- package/dist/geom/tangents.js +124 -0
- package/dist/geom/triangulate.d.ts +19 -0
- package/dist/geom/triangulate.js +147 -0
- package/dist/host/default.d.ts +10 -0
- package/dist/host/default.js +10 -0
- package/dist/host/index.d.ts +4 -0
- package/dist/host/index.js +3 -0
- package/dist/host/types.d.ts +144 -0
- package/dist/host/types.js +1 -0
- package/dist/host/web-links.d.ts +38 -0
- package/dist/host/web-links.js +110 -0
- package/dist/host/web.d.ts +30 -0
- package/dist/host/web.js +216 -0
- package/dist/host/xr.d.ts +24 -0
- package/dist/host/xr.js +59 -0
- package/dist/i18n/i18n.d.ts +59 -0
- package/dist/i18n/i18n.js +241 -0
- package/dist/i18n/index.d.ts +3 -0
- package/dist/i18n/index.js +3 -0
- package/dist/i18n/message.d.ts +72 -0
- package/dist/i18n/message.js +369 -0
- package/dist/i18n/negotiate.d.ts +17 -0
- package/dist/i18n/negotiate.js +58 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +1 -0
- package/dist/input/bindings.d.ts +31 -0
- package/dist/input/bindings.js +141 -0
- package/dist/input/clock.d.ts +44 -0
- package/dist/input/clock.js +49 -0
- package/dist/input/follow.d.ts +133 -0
- package/dist/input/follow.js +218 -0
- package/dist/input/gestures.d.ts +281 -0
- package/dist/input/gestures.js +662 -0
- package/dist/input/glyphs.d.ts +35 -0
- package/dist/input/glyphs.js +216 -0
- package/dist/input/gyro.d.ts +85 -0
- package/dist/input/gyro.js +140 -0
- package/dist/input/index.d.ts +19 -0
- package/dist/input/index.js +16 -0
- package/dist/input/input.d.ts +543 -0
- package/dist/input/input.js +1492 -0
- package/dist/input/look.d.ts +327 -0
- package/dist/input/look.js +681 -0
- package/dist/input/magnify.d.ts +177 -0
- package/dist/input/magnify.js +131 -0
- package/dist/input/pointer-dispatch.d.ts +138 -0
- package/dist/input/pointer-dispatch.js +180 -0
- package/dist/input/pointer-router.d.ts +204 -0
- package/dist/input/pointer-router.js +533 -0
- package/dist/input/pointer-sources.d.ts +164 -0
- package/dist/input/pointer-sources.js +306 -0
- package/dist/input/rays.d.ts +138 -0
- package/dist/input/rays.js +615 -0
- package/dist/input/record.d.ts +209 -0
- package/dist/input/record.js +601 -0
- package/dist/input/touch-zones.d.ts +147 -0
- package/dist/input/touch-zones.js +300 -0
- package/dist/input/types.d.ts +158 -0
- package/dist/input/types.js +1 -0
- package/dist/input/xr-source.d.ts +53 -0
- package/dist/input/xr-source.js +164 -0
- package/dist/nav/astar.d.ts +45 -0
- package/dist/nav/astar.js +182 -0
- package/dist/nav/corridor.d.ts +40 -0
- package/dist/nav/corridor.js +95 -0
- package/dist/nav/crowd.d.ts +94 -0
- package/dist/nav/crowd.js +624 -0
- package/dist/nav/flow.d.ts +61 -0
- package/dist/nav/flow.js +193 -0
- package/dist/nav/grid.d.ts +108 -0
- package/dist/nav/grid.js +210 -0
- package/dist/nav/heap.d.ts +22 -0
- package/dist/nav/heap.js +92 -0
- package/dist/nav/index.d.ts +37 -0
- package/dist/nav/index.js +19 -0
- package/dist/nav/mesh/areas.d.ts +44 -0
- package/dist/nav/mesh/areas.js +98 -0
- package/dist/nav/mesh/bake-options.d.ts +33 -0
- package/dist/nav/mesh/bake-options.js +76 -0
- package/dist/nav/mesh/contour.d.ts +22 -0
- package/dist/nav/mesh/contour.js +323 -0
- package/dist/nav/mesh/flow3.d.ts +35 -0
- package/dist/nav/mesh/flow3.js +229 -0
- package/dist/nav/mesh/links.d.ts +38 -0
- package/dist/nav/mesh/links.js +72 -0
- package/dist/nav/mesh/mesh-path.d.ts +152 -0
- package/dist/nav/mesh/mesh-path.js +643 -0
- package/dist/nav/mesh/mesh-reach.d.ts +78 -0
- package/dist/nav/mesh/mesh-reach.js +450 -0
- package/dist/nav/mesh/navmesh.d.ts +117 -0
- package/dist/nav/mesh/navmesh.js +647 -0
- package/dist/nav/mesh/polymesh.d.ts +24 -0
- package/dist/nav/mesh/polymesh.js +384 -0
- package/dist/nav/mesh/regions.d.ts +12 -0
- package/dist/nav/mesh/regions.js +367 -0
- package/dist/nav/mesh/serialize.d.ts +13 -0
- package/dist/nav/mesh/serialize.js +197 -0
- package/dist/nav/mesh/voxelize.d.ts +111 -0
- package/dist/nav/mesh/voxelize.js +552 -0
- package/dist/nav/obstacles.d.ts +75 -0
- package/dist/nav/obstacles.js +294 -0
- package/dist/nav/path.d.ts +59 -0
- package/dist/nav/path.js +177 -0
- package/dist/nav/query-queue.d.ts +46 -0
- package/dist/nav/query-queue.js +308 -0
- package/dist/nav/reach.d.ts +53 -0
- package/dist/nav/reach.js +148 -0
- package/dist/nav/steer.d.ts +36 -0
- package/dist/nav/steer.js +78 -0
- package/dist/platform/boot.d.ts +28 -0
- package/dist/platform/boot.js +43 -0
- package/dist/platform/device-mode.d.ts +40 -0
- package/dist/platform/device-mode.js +104 -0
- package/dist/platform/device.d.ts +31 -0
- package/dist/platform/device.js +91 -0
- package/dist/platform/environment.d.ts +42 -0
- package/dist/platform/environment.js +82 -0
- package/dist/platform/gpu.d.ts +40 -0
- package/dist/platform/gpu.js +57 -0
- package/dist/platform/index.d.ts +18 -0
- package/dist/platform/index.js +10 -0
- package/dist/platform/letterbox.d.ts +43 -0
- package/dist/platform/letterbox.js +57 -0
- package/dist/platform/links.d.ts +20 -0
- package/dist/platform/links.js +43 -0
- package/dist/platform/screens.d.ts +36 -0
- package/dist/platform/screens.js +138 -0
- package/dist/platform/surface.d.ts +72 -0
- package/dist/platform/surface.js +157 -0
- package/dist/platform/xr-fake.d.ts +168 -0
- package/dist/platform/xr-fake.js +434 -0
- package/dist/platform/xr-surface.d.ts +120 -0
- package/dist/platform/xr-surface.js +214 -0
- package/dist/platform/xr-types.d.ts +262 -0
- package/dist/post/ao.d.ts +12 -0
- package/dist/post/ao.js +136 -0
- package/dist/post/blend.d.ts +27 -0
- package/dist/post/blend.js +129 -0
- package/dist/post/depth-pass.d.ts +43 -0
- package/dist/post/depth-pass.js +118 -0
- package/dist/post/dof.d.ts +1 -0
- package/dist/post/dof.js +66 -0
- package/dist/post/exposure.d.ts +80 -0
- package/dist/post/exposure.js +322 -0
- package/dist/post/index.d.ts +12 -0
- package/dist/post/index.js +11 -0
- package/dist/post/lens-dirt.d.ts +13 -0
- package/dist/post/lens-dirt.js +91 -0
- package/dist/post/lut.d.ts +19 -0
- package/dist/post/lut.js +50 -0
- package/dist/post/motion-blur.d.ts +9 -0
- package/dist/post/motion-blur.js +78 -0
- package/dist/post/post-stack.d.ts +302 -0
- package/dist/post/post-stack.js +1137 -0
- package/dist/post/settings.d.ts +485 -0
- package/dist/post/settings.js +416 -0
- package/dist/post/shaders.d.ts +25 -0
- package/dist/post/shaders.js +410 -0
- package/dist/post/ssr.d.ts +16 -0
- package/dist/post/ssr.js +155 -0
- package/dist/post/taa.d.ts +74 -0
- package/dist/post/taa.js +235 -0
- package/dist/post/white-balance.d.ts +25 -0
- package/dist/post/white-balance.js +98 -0
- package/dist/render/bindings.d.ts +98 -0
- package/dist/render/bindings.js +281 -0
- package/dist/render/blend.d.ts +13 -0
- package/dist/render/blend.js +26 -0
- package/dist/render/camera-2d.d.ts +72 -0
- package/dist/render/camera-2d.js +92 -0
- package/dist/render/camera.d.ts +302 -0
- package/dist/render/camera.js +671 -0
- package/dist/render/color.d.ts +16 -0
- package/dist/render/color.js +41 -0
- package/dist/render/compressed.d.ts +104 -0
- package/dist/render/compressed.js +248 -0
- package/dist/render/diagnostics.d.ts +15 -0
- package/dist/render/diagnostics.js +43 -0
- package/dist/render/dynamic-resolution.d.ts +70 -0
- package/dist/render/dynamic-resolution.js +126 -0
- package/dist/render/fake-gpu.d.ts +204 -0
- package/dist/render/fake-gpu.js +426 -0
- package/dist/render/flipbook.d.ts +56 -0
- package/dist/render/flipbook.js +87 -0
- package/dist/render/frame.d.ts +278 -0
- package/dist/render/frame.js +174 -0
- package/dist/render/fullscreen.d.ts +54 -0
- package/dist/render/fullscreen.js +91 -0
- package/dist/render/gpu-timer.d.ts +73 -0
- package/dist/render/gpu-timer.js +186 -0
- package/dist/render/index.d.ts +53 -0
- package/dist/render/index.js +29 -0
- package/dist/render/instance-list.d.ts +185 -0
- package/dist/render/instance-list.js +547 -0
- package/dist/render/lights.d.ts +181 -0
- package/dist/render/lights.js +233 -0
- package/dist/render/lod.d.ts +54 -0
- package/dist/render/lod.js +52 -0
- package/dist/render/material.d.ts +165 -0
- package/dist/render/material.js +292 -0
- package/dist/render/mesh.d.ts +284 -0
- package/dist/render/mesh.js +472 -0
- package/dist/render/mipmap.d.ts +16 -0
- package/dist/render/mipmap.js +121 -0
- package/dist/render/parallax.d.ts +50 -0
- package/dist/render/parallax.js +47 -0
- package/dist/render/pbr-wgsl.d.ts +31 -0
- package/dist/render/pbr-wgsl.js +119 -0
- package/dist/render/ping-pong.d.ts +42 -0
- package/dist/render/ping-pong.js +74 -0
- package/dist/render/renderer.d.ts +741 -0
- package/dist/render/renderer.js +2486 -0
- package/dist/render/scene-pipelines.d.ts +44 -0
- package/dist/render/scene-pipelines.js +92 -0
- package/dist/render/scene-target.d.ts +170 -0
- package/dist/render/scene-target.js +450 -0
- package/dist/render/shadow.d.ts +74 -0
- package/dist/render/shadow.js +208 -0
- package/dist/render/skin.d.ts +112 -0
- package/dist/render/skin.js +240 -0
- package/dist/render/snapshot.d.ts +36 -0
- package/dist/render/snapshot.js +34 -0
- package/dist/render/standard.d.ts +162 -0
- package/dist/render/standard.js +263 -0
- package/dist/render/texture.d.ts +142 -0
- package/dist/render/texture.js +228 -0
- package/dist/render/tile-layer.d.ts +110 -0
- package/dist/render/tile-layer.js +304 -0
- package/dist/render/transform.d.ts +115 -0
- package/dist/render/transform.js +318 -0
- package/dist/render/wgsl.d.ts +131 -0
- package/dist/render/wgsl.js +528 -0
- package/dist/save/codec.d.ts +49 -0
- package/dist/save/codec.js +169 -0
- package/dist/save/index.d.ts +8 -0
- package/dist/save/index.js +8 -0
- package/dist/save/journal.d.ts +24 -0
- package/dist/save/journal.js +102 -0
- package/dist/save/migrate.d.ts +15 -0
- package/dist/save/migrate.js +37 -0
- package/dist/save/schema.d.ts +72 -0
- package/dist/save/schema.js +154 -0
- package/dist/save/settings.d.ts +28 -0
- package/dist/save/settings.js +59 -0
- package/dist/save/slots.d.ts +56 -0
- package/dist/save/slots.js +200 -0
- package/dist/save/storage.d.ts +35 -0
- package/dist/save/storage.js +62 -0
- package/dist/save/store.d.ts +114 -0
- package/dist/save/store.js +269 -0
- package/dist/testing/fake-host.d.ts +103 -0
- package/dist/testing/fake-host.js +163 -0
- package/dist/testing/fixed-clock.d.ts +25 -0
- package/dist/testing/fixed-clock.js +30 -0
- package/dist/testing/index.d.ts +4 -0
- package/dist/testing/index.js +5 -0
- package/dist/testing/test-game.d.ts +76 -0
- package/dist/testing/test-game.js +92 -0
- package/dist/tween/ease.d.ts +77 -0
- package/dist/tween/ease.js +192 -0
- package/dist/tween/index.d.ts +8 -0
- package/dist/tween/index.js +7 -0
- package/dist/tween/timeline.d.ts +78 -0
- package/dist/tween/timeline.js +269 -0
- package/dist/tween/tween.d.ts +168 -0
- package/dist/tween/tween.js +320 -0
- package/dist/ui/anchor.d.ts +206 -0
- package/dist/ui/anchor.js +307 -0
- package/dist/ui/caption.d.ts +122 -0
- package/dist/ui/caption.js +286 -0
- package/dist/ui/cursor.d.ts +105 -0
- package/dist/ui/cursor.js +261 -0
- package/dist/ui/dom.d.ts +30 -0
- package/dist/ui/dom.js +92 -0
- package/dist/ui/floats.d.ts +86 -0
- package/dist/ui/floats.js +260 -0
- package/dist/ui/hud.d.ts +198 -0
- package/dist/ui/hud.js +431 -0
- package/dist/ui/index.d.ts +37 -0
- package/dist/ui/index.js +34 -0
- package/dist/ui/inventory-card.d.ts +52 -0
- package/dist/ui/inventory-card.js +173 -0
- package/dist/ui/inventory-context.d.ts +29 -0
- package/dist/ui/inventory-context.js +125 -0
- package/dist/ui/inventory-drag.d.ts +63 -0
- package/dist/ui/inventory-drag.js +394 -0
- package/dist/ui/inventory-grid.d.ts +66 -0
- package/dist/ui/inventory-grid.js +625 -0
- package/dist/ui/inventory-radial.d.ts +39 -0
- package/dist/ui/inventory-radial.js +168 -0
- package/dist/ui/inventory.d.ts +128 -0
- package/dist/ui/inventory.js +154 -0
- package/dist/ui/layout.d.ts +356 -0
- package/dist/ui/layout.js +856 -0
- package/dist/ui/link.d.ts +64 -0
- package/dist/ui/link.js +155 -0
- package/dist/ui/loading.d.ts +40 -0
- package/dist/ui/loading.js +157 -0
- package/dist/ui/loupe.d.ts +74 -0
- package/dist/ui/loupe.js +164 -0
- package/dist/ui/menu-nav.d.ts +33 -0
- package/dist/ui/menu-nav.js +28 -0
- package/dist/ui/minimap-canvas.d.ts +145 -0
- package/dist/ui/minimap-canvas.js +460 -0
- package/dist/ui/notify.d.ts +40 -0
- package/dist/ui/notify.js +141 -0
- package/dist/ui/orb.d.ts +53 -0
- package/dist/ui/orb.js +304 -0
- package/dist/ui/overlay.d.ts +213 -0
- package/dist/ui/overlay.js +394 -0
- package/dist/ui/padnav.d.ts +53 -0
- package/dist/ui/padnav.js +146 -0
- package/dist/ui/perf.d.ts +130 -0
- package/dist/ui/perf.js +329 -0
- package/dist/ui/rotate-card.d.ts +54 -0
- package/dist/ui/rotate-card.js +97 -0
- package/dist/ui/stack.d.ts +128 -0
- package/dist/ui/stack.js +312 -0
- package/dist/ui/styles.d.ts +13 -0
- package/dist/ui/styles.js +200 -0
- package/dist/ui/text-scale.d.ts +67 -0
- package/dist/ui/text-scale.js +102 -0
- package/dist/ui/theme.d.ts +70 -0
- package/dist/ui/theme.js +98 -0
- package/dist/ui/toast.d.ts +23 -0
- package/dist/ui/toast.js +46 -0
- package/dist/ui/tooltip.d.ts +89 -0
- package/dist/ui/tooltip.js +333 -0
- package/dist/ui/widgets-2.d.ts +134 -0
- package/dist/ui/widgets-2.js +399 -0
- package/dist/ui/widgets-3.d.ts +91 -0
- package/dist/ui/widgets-3.js +212 -0
- package/dist/ui/widgets.d.ts +34 -0
- package/dist/ui/widgets.js +50 -0
- package/dist/ui/world-panel/index.d.ts +5 -0
- package/dist/ui/world-panel/index.js +5 -0
- package/dist/ui/world-panel/layout.d.ts +38 -0
- package/dist/ui/world-panel/layout.js +68 -0
- package/dist/ui/world-panel/paint.d.ts +96 -0
- package/dist/ui/world-panel/paint.js +136 -0
- package/dist/ui/world-panel/panel.d.ts +235 -0
- package/dist/ui/world-panel/panel.js +762 -0
- package/dist/ui/world-panel/wgsl.d.ts +10 -0
- package/dist/ui/world-panel/wgsl.js +52 -0
- package/dist/ui/world-panel/widgets.d.ts +207 -0
- package/dist/ui/world-panel/widgets.js +569 -0
- package/dist/voxel/chunks.d.ts +77 -0
- package/dist/voxel/chunks.js +149 -0
- package/dist/voxel/grid.d.ts +84 -0
- package/dist/voxel/grid.js +223 -0
- package/dist/voxel/index.d.ts +22 -0
- package/dist/voxel/index.js +7 -0
- package/dist/voxel/mesher-worker.d.ts +14 -0
- package/dist/voxel/mesher-worker.js +47 -0
- package/dist/voxel/mesher.d.ts +73 -0
- package/dist/voxel/mesher.js +306 -0
- package/dist/voxel/ray.d.ts +32 -0
- package/dist/voxel/ray.js +73 -0
- package/dist/voxel/wgsl.d.ts +16 -0
- package/dist/voxel/wgsl.js +28 -0
- package/dist/voxel/worker-client.d.ts +79 -0
- package/dist/voxel/worker-client.js +122 -0
- package/package.json +177 -3
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GPU pass timing with `timestamp-query` (feature-detected; see `initGpu`).
|
|
3
|
+
*
|
|
4
|
+
* One sampled frame is in flight at a time. On a sampled frame, every pass that asks for
|
|
5
|
+
* `pass(label)` gets begin/end timestamp writes; passes sharing a label are summed (the bloom
|
|
6
|
+
* mip chain is many passes, one label). `mark()` opens the frame with an empty compute pass so
|
|
7
|
+
* the work encoded before the first labelled pass (pre-passes, drawable prepare) is counted.
|
|
8
|
+
*
|
|
9
|
+
* Results land in `result` (plain object, reused) after the readback maps. Per-frame work is
|
|
10
|
+
* allocation-free apart from the `mapAsync` promise and the mapped range on sampled frames.
|
|
11
|
+
*/
|
|
12
|
+
/** Pass label → GPU ms for the last resolved frame. */
|
|
13
|
+
export type GpuPassTimes = Record<string, number>;
|
|
14
|
+
export interface GpuTimerResult {
|
|
15
|
+
/** First timestamp to last timestamp of the sampled frame (ms). */
|
|
16
|
+
totalMs: number;
|
|
17
|
+
/** Per-label sums (ms). `pre` is the gap between `mark()` and the first labelled pass. */
|
|
18
|
+
passes: GpuPassTimes;
|
|
19
|
+
/** Frames resolved so far. */
|
|
20
|
+
samples: number;
|
|
21
|
+
}
|
|
22
|
+
/** True when the device was created with the `timestamp-query` feature. */
|
|
23
|
+
export declare function supportsTimestamps(device: GPUDevice): boolean;
|
|
24
|
+
export declare class GpuTimer {
|
|
25
|
+
readonly maxPasses: number;
|
|
26
|
+
readonly result: GpuTimerResult;
|
|
27
|
+
/** True between `begin()` and `resolve()`: passes should take `pass(label)` writes. */
|
|
28
|
+
active: boolean;
|
|
29
|
+
private readonly querySet;
|
|
30
|
+
private readonly resolveBuf;
|
|
31
|
+
private readonly readBuf;
|
|
32
|
+
private readonly writes;
|
|
33
|
+
private readonly markWrites;
|
|
34
|
+
private readonly markDesc;
|
|
35
|
+
/** Label index per used pair this frame. */
|
|
36
|
+
private readonly pairLabel;
|
|
37
|
+
private readonly labels;
|
|
38
|
+
private readonly labelIndex;
|
|
39
|
+
private readonly sums;
|
|
40
|
+
private used;
|
|
41
|
+
private marked;
|
|
42
|
+
private pending;
|
|
43
|
+
private destroyed;
|
|
44
|
+
private readonly listeners;
|
|
45
|
+
private readonly onMapped;
|
|
46
|
+
private readonly onMapFailed;
|
|
47
|
+
constructor(device: GPUDevice, maxPasses?: number);
|
|
48
|
+
/** True while a sampled frame is being read back (the next `begin` would be refused). */
|
|
49
|
+
get busy(): boolean;
|
|
50
|
+
/** Called with each resolved frame. Returns unsubscribe. */
|
|
51
|
+
onResult(fn: (r: GpuTimerResult) => void): () => void;
|
|
52
|
+
/** Start a sampled frame. Returns false (and stays inactive) while the last one is in flight. */
|
|
53
|
+
begin(): boolean;
|
|
54
|
+
/** Frame start marker: an empty compute pass with timestamps. Call first in the encoder. */
|
|
55
|
+
mark(encoder: GPUCommandEncoder): void;
|
|
56
|
+
/**
|
|
57
|
+
* Timestamp writes for one pass under `label`, or undefined when not sampling (or out of
|
|
58
|
+
* slots). Pass the result as the render/compute pass descriptor's `timestampWrites`.
|
|
59
|
+
*/
|
|
60
|
+
pass(label: string): GPURenderPassTimestampWrites | undefined;
|
|
61
|
+
/** Resolve the queries into the readback buffer. Call after the last timed pass. */
|
|
62
|
+
resolve(encoder: GPUCommandEncoder): void;
|
|
63
|
+
/** Start the readback. Call after `queue.submit`. */
|
|
64
|
+
afterSubmit(): void;
|
|
65
|
+
/**
|
|
66
|
+
* Per-pass cost is the pass's *marginal* time: its end minus the later of its own start and
|
|
67
|
+
* the previous pass's end. Tiled GPUs (Apple, many mobiles) overlap consecutive passes, so a
|
|
68
|
+
* plain end − begin counts the overlap twice and sums past the frame; ends are in order, so
|
|
69
|
+
* marginal times add up to the frame total.
|
|
70
|
+
*/
|
|
71
|
+
private read;
|
|
72
|
+
destroy(): void;
|
|
73
|
+
}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GPU pass timing with `timestamp-query` (feature-detected; see `initGpu`).
|
|
3
|
+
*
|
|
4
|
+
* One sampled frame is in flight at a time. On a sampled frame, every pass that asks for
|
|
5
|
+
* `pass(label)` gets begin/end timestamp writes; passes sharing a label are summed (the bloom
|
|
6
|
+
* mip chain is many passes, one label). `mark()` opens the frame with an empty compute pass so
|
|
7
|
+
* the work encoded before the first labelled pass (pre-passes, drawable prepare) is counted.
|
|
8
|
+
*
|
|
9
|
+
* Results land in `result` (plain object, reused) after the readback maps. Per-frame work is
|
|
10
|
+
* allocation-free apart from the `mapAsync` promise and the mapped range on sampled frames.
|
|
11
|
+
*/
|
|
12
|
+
/** True when the device was created with the `timestamp-query` feature. */
|
|
13
|
+
export function supportsTimestamps(device) {
|
|
14
|
+
const f = device.features;
|
|
15
|
+
return !!f && typeof f.has === 'function' && f.has('timestamp-query');
|
|
16
|
+
}
|
|
17
|
+
export class GpuTimer {
|
|
18
|
+
maxPasses;
|
|
19
|
+
result = { totalMs: 0, passes: {}, samples: 0 };
|
|
20
|
+
/** True between `begin()` and `resolve()`: passes should take `pass(label)` writes. */
|
|
21
|
+
active = false;
|
|
22
|
+
querySet;
|
|
23
|
+
resolveBuf;
|
|
24
|
+
readBuf;
|
|
25
|
+
writes = [];
|
|
26
|
+
markWrites;
|
|
27
|
+
markDesc;
|
|
28
|
+
/** Label index per used pair this frame. */
|
|
29
|
+
pairLabel;
|
|
30
|
+
labels = [];
|
|
31
|
+
labelIndex = new Map();
|
|
32
|
+
sums;
|
|
33
|
+
used = 0;
|
|
34
|
+
marked = false;
|
|
35
|
+
pending = false;
|
|
36
|
+
destroyed = false;
|
|
37
|
+
listeners = new Set();
|
|
38
|
+
onMapped = () => this.read();
|
|
39
|
+
onMapFailed = () => {
|
|
40
|
+
this.pending = false;
|
|
41
|
+
};
|
|
42
|
+
constructor(device, maxPasses = 48) {
|
|
43
|
+
this.maxPasses = maxPasses;
|
|
44
|
+
// Pair 0 is the frame mark; pairs 1.. are labelled passes.
|
|
45
|
+
const count = (maxPasses + 1) * 2;
|
|
46
|
+
this.querySet = device.createQuerySet({ label: 'gpu-timer', type: 'timestamp', count });
|
|
47
|
+
this.resolveBuf = device.createBuffer({
|
|
48
|
+
label: 'gpu-timer-resolve',
|
|
49
|
+
size: count * 8,
|
|
50
|
+
usage: GPUBufferUsage.QUERY_RESOLVE | GPUBufferUsage.COPY_SRC,
|
|
51
|
+
});
|
|
52
|
+
this.readBuf = device.createBuffer({
|
|
53
|
+
label: 'gpu-timer-read',
|
|
54
|
+
size: count * 8,
|
|
55
|
+
usage: GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST,
|
|
56
|
+
});
|
|
57
|
+
for (let i = 1; i <= maxPasses; i++) {
|
|
58
|
+
this.writes.push({
|
|
59
|
+
querySet: this.querySet,
|
|
60
|
+
beginningOfPassWriteIndex: i * 2,
|
|
61
|
+
endOfPassWriteIndex: i * 2 + 1,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
this.markWrites = {
|
|
65
|
+
querySet: this.querySet,
|
|
66
|
+
beginningOfPassWriteIndex: 0,
|
|
67
|
+
endOfPassWriteIndex: 1,
|
|
68
|
+
};
|
|
69
|
+
this.markDesc = { label: 'gpu-timer-mark', timestampWrites: this.markWrites };
|
|
70
|
+
this.pairLabel = new Int32Array(maxPasses);
|
|
71
|
+
this.sums = new Float64Array(maxPasses);
|
|
72
|
+
}
|
|
73
|
+
/** True while a sampled frame is being read back (the next `begin` would be refused). */
|
|
74
|
+
get busy() {
|
|
75
|
+
return this.pending || this.active;
|
|
76
|
+
}
|
|
77
|
+
/** Called with each resolved frame. Returns unsubscribe. */
|
|
78
|
+
onResult(fn) {
|
|
79
|
+
this.listeners.add(fn);
|
|
80
|
+
return () => this.listeners.delete(fn);
|
|
81
|
+
}
|
|
82
|
+
/** Start a sampled frame. Returns false (and stays inactive) while the last one is in flight. */
|
|
83
|
+
begin() {
|
|
84
|
+
if (this.busy || this.destroyed)
|
|
85
|
+
return false;
|
|
86
|
+
this.active = true;
|
|
87
|
+
this.used = 0;
|
|
88
|
+
this.marked = false;
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
/** Frame start marker: an empty compute pass with timestamps. Call first in the encoder. */
|
|
92
|
+
mark(encoder) {
|
|
93
|
+
if (!this.active)
|
|
94
|
+
return;
|
|
95
|
+
encoder.beginComputePass(this.markDesc).end();
|
|
96
|
+
this.marked = true;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Timestamp writes for one pass under `label`, or undefined when not sampling (or out of
|
|
100
|
+
* slots). Pass the result as the render/compute pass descriptor's `timestampWrites`.
|
|
101
|
+
*/
|
|
102
|
+
pass(label) {
|
|
103
|
+
if (!this.active || this.used >= this.maxPasses)
|
|
104
|
+
return undefined;
|
|
105
|
+
let li = this.labelIndex.get(label);
|
|
106
|
+
if (li === undefined) {
|
|
107
|
+
li = this.labels.length;
|
|
108
|
+
if (li >= this.maxPasses)
|
|
109
|
+
return undefined;
|
|
110
|
+
this.labels.push(label);
|
|
111
|
+
this.labelIndex.set(label, li);
|
|
112
|
+
}
|
|
113
|
+
this.pairLabel[this.used] = li;
|
|
114
|
+
return this.writes[this.used++];
|
|
115
|
+
}
|
|
116
|
+
/** Resolve the queries into the readback buffer. Call after the last timed pass. */
|
|
117
|
+
resolve(encoder) {
|
|
118
|
+
if (!this.active)
|
|
119
|
+
return;
|
|
120
|
+
this.active = false;
|
|
121
|
+
if (this.used === 0 && !this.marked)
|
|
122
|
+
return;
|
|
123
|
+
const count = (this.used + 1) * 2;
|
|
124
|
+
encoder.resolveQuerySet(this.querySet, 0, count, this.resolveBuf, 0);
|
|
125
|
+
encoder.copyBufferToBuffer(this.resolveBuf, 0, this.readBuf, 0, count * 8);
|
|
126
|
+
this.pending = true;
|
|
127
|
+
}
|
|
128
|
+
/** Start the readback. Call after `queue.submit`. */
|
|
129
|
+
afterSubmit() {
|
|
130
|
+
if (!this.pending || this.readBuf.mapState !== 'unmapped')
|
|
131
|
+
return;
|
|
132
|
+
this.readBuf.mapAsync(GPUMapMode.READ).then(this.onMapped, this.onMapFailed);
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Per-pass cost is the pass's *marginal* time: its end minus the later of its own start and
|
|
136
|
+
* the previous pass's end. Tiled GPUs (Apple, many mobiles) overlap consecutive passes, so a
|
|
137
|
+
* plain end − begin counts the overlap twice and sums past the frame; ends are in order, so
|
|
138
|
+
* marginal times add up to the frame total.
|
|
139
|
+
*/
|
|
140
|
+
read() {
|
|
141
|
+
if (this.destroyed)
|
|
142
|
+
return;
|
|
143
|
+
const ts = new BigInt64Array(this.readBuf.getMappedRange());
|
|
144
|
+
const used = this.used;
|
|
145
|
+
const sums = this.sums;
|
|
146
|
+
sums.fill(0);
|
|
147
|
+
const markB = this.marked ? ts[0] : 0n;
|
|
148
|
+
const markE = this.marked ? ts[1] : 0n;
|
|
149
|
+
let first = markB;
|
|
150
|
+
let prevEnd = markE;
|
|
151
|
+
let firstPass = 0n;
|
|
152
|
+
for (let i = 0; i < used; i++) {
|
|
153
|
+
const b = ts[(i + 1) * 2];
|
|
154
|
+
const e = ts[(i + 1) * 2 + 1];
|
|
155
|
+
// A zero timestamp was never written (a skipped pass): ignore the pair.
|
|
156
|
+
if (b <= 0n || e < b)
|
|
157
|
+
continue;
|
|
158
|
+
if (first === 0n || b < first)
|
|
159
|
+
first = b;
|
|
160
|
+
if (firstPass === 0n)
|
|
161
|
+
firstPass = b;
|
|
162
|
+
// biome-ignore lint/complexity/useMathMinMax: bigint (Math.max takes numbers)
|
|
163
|
+
const from = prevEnd > b ? prevEnd : b;
|
|
164
|
+
if (e > from)
|
|
165
|
+
sums[this.pairLabel[i]] += Number(e - from) / 1e6;
|
|
166
|
+
if (e > prevEnd)
|
|
167
|
+
prevEnd = e;
|
|
168
|
+
}
|
|
169
|
+
this.readBuf.unmap();
|
|
170
|
+
this.pending = false;
|
|
171
|
+
const r = this.result;
|
|
172
|
+
r.totalMs = first > 0n && prevEnd > first ? Number(prevEnd - first) / 1e6 : 0;
|
|
173
|
+
for (let i = 0; i < this.labels.length; i++)
|
|
174
|
+
r.passes[this.labels[i]] = sums[i];
|
|
175
|
+
r.passes.pre = markE > 0n && firstPass > markE ? Number(firstPass - markE) / 1e6 : 0;
|
|
176
|
+
r.samples++;
|
|
177
|
+
for (const fn of this.listeners)
|
|
178
|
+
fn(r);
|
|
179
|
+
}
|
|
180
|
+
destroy() {
|
|
181
|
+
this.destroyed = true;
|
|
182
|
+
this.querySet.destroy();
|
|
183
|
+
this.resolveBuf.destroy();
|
|
184
|
+
this.readBuf.destroy();
|
|
185
|
+
}
|
|
186
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export type { RenderBlendMode } from './blend.js';
|
|
2
|
+
export type { CameraPoint, CameraRect } from './camera.js';
|
|
3
|
+
export { ALL_LAYERS, Camera, FRUSTUM_FLOATS, ORTHO2D_HALF_DEPTH, } from './camera.js';
|
|
4
|
+
export type { Follow2D, Follow2DBounds, Follow2DCamera, Follow2DOptions } from './camera-2d.js';
|
|
5
|
+
export { createFollow2D } from './camera-2d.js';
|
|
6
|
+
export type { RGBA } from './color.js';
|
|
7
|
+
export { hex, linearToSrgb, rgba, scaleRgb, srgbToLinear } from './color.js';
|
|
8
|
+
export type { BlockInfo, CompressedUploadTarget, CompressionFamily, Ktx2LevelLayout, RendererCaps, UploadKtx2Options, } from './compressed.js';
|
|
9
|
+
export { blockInfo, COMPRESSION_FEATURES, CompressedTextureError, compressionFeatures, ktx2LevelLayout, rendererCaps, uploadKtx2, } from './compressed.js';
|
|
10
|
+
export { gpuDiagnostics, installGpuErrorLogging, onGpuError, reportGpuError } from './diagnostics.js';
|
|
11
|
+
export { DynamicResolution, type DynamicResolutionOptions, } from './dynamic-resolution.js';
|
|
12
|
+
export type { AtlasGrid, Flipbook, FlipbookOptions, UvRect } from './flipbook.js';
|
|
13
|
+
export { atlasFrames, createFlipbook } from './flipbook.js';
|
|
14
|
+
export type { Drawable, DrawParams, InstanceBatch, InstanceParams, ViewInfo } from './frame.js';
|
|
15
|
+
export { Frame, INSTANCE_PARAM_FLOATS, SKIN_PARAM, writeInstanceParams } from './frame.js';
|
|
16
|
+
export type { FullscreenEncodeOptions, FullscreenPassDesc } from './fullscreen.js';
|
|
17
|
+
export { FullscreenPass } from './fullscreen.js';
|
|
18
|
+
export type { GpuPassTimes, GpuTimerResult } from './gpu-timer.js';
|
|
19
|
+
export { GpuTimer, supportsTimestamps } from './gpu-timer.js';
|
|
20
|
+
export { InstanceList, type InstanceListOptions } from './instance-list.js';
|
|
21
|
+
export type { DirectionalLight, DistanceFog, PointLight, ShadowUniforms, SpotLight, SunLight, SunShadow, } from './lights.js';
|
|
22
|
+
export { ALL_LIGHT_LAYERS, DEFAULT_SHADOW_BIAS, INSTANCE_LAYER_BITS, INSTANCE_LAYER_SHIFT, Lights, MAX_POINT_LIGHTS, MAX_SPOT_LIGHTS, POINT_LIGHT_FLOATS, packInstanceFlags, SPOT_LIGHT_FLOATS, spotCone, } from './lights.js';
|
|
23
|
+
export type { MeshLod, MeshLodChain, MeshLodDesc } from './lod.js';
|
|
24
|
+
export { DEFAULT_LOD_HYSTERESIS, isMeshLod, lodSizePx, pickLodLevel } from './lod.js';
|
|
25
|
+
export type { DepthMode, MaterialDesc } from './material.js';
|
|
26
|
+
export { DEPTH_FORMAT, INSTANCE_BUFFER_LAYOUT, INSTANCE_FLOATS, INSTANCE_OFFSET, INSTANCE_STRIDE, Material, } from './material.js';
|
|
27
|
+
export type { MeshBounds, MeshCapacity, MeshDesc, MeshRange, MeshReply, MeshUpdate, VertexLayout, } from './mesh.js';
|
|
28
|
+
export { AUTO_BOUNDS_MAX_VERTICES, Mesh, quadGeometry, SKIN_JOINTS_BYTE_OFFSET, SKIN_WEIGHTS_BYTE_OFFSET, VERTEX_BUFFER_LAYOUT, VERTEX_FLOATS, VERTEX_LAYOUT_2D, VERTEX_LAYOUT_3D, VERTEX_LAYOUT_3D_TANGENT, VERTEX_LAYOUT_3D_UV2, VERTEX_LAYOUT_SKINNED, VERTEX_SKINNED_BUFFER_LAYOUT, VERTEX_SKINNED_FLOATS, VERTEX_SKINNED_STRIDE, VERTEX_STRIDE, VERTEX3D_BUFFER_LAYOUT, VERTEX3D_FLOATS, VERTEX3D_STRIDE, VERTEX3D_UV2_FLOATS, VERTEX3D_UV2_STRIDE, } from './mesh.js';
|
|
29
|
+
export type { GenerateMipmapsOptions, MipFilter } from './mipmap.js';
|
|
30
|
+
export { generateMipmaps } from './mipmap.js';
|
|
31
|
+
export type { Parallax, ParallaxLayer, ParallaxLayerOptions } from './parallax.js';
|
|
32
|
+
export { createParallax, parallaxOffset } from './parallax.js';
|
|
33
|
+
export { WGSL_PBR } from './pbr-wgsl.js';
|
|
34
|
+
export type { PingPongStepOptions } from './ping-pong.js';
|
|
35
|
+
export { PingPong } from './ping-pong.js';
|
|
36
|
+
export type { FrameTiming, JitterFn, PostInputs, PostProcessor, PostProjection, PostView, RendererGpu, RendererOptions, RenderStats, ResolutionOptions, SpriteMaterialOptions, TextureFromSourceOptions, } from './renderer.js';
|
|
37
|
+
export { MIN_RESOLUTION_SCALE, Renderer, sceneSize } from './renderer.js';
|
|
38
|
+
export type { SceneTargetAux, SceneTargetExternal, SceneTargetViewport } from './scene-target.js';
|
|
39
|
+
export { ROUGH_METAL_FORMAT, SCENE_FORMAT, SceneTarget, type SceneTargetDesc, VELOCITY_FORMAT, } from './scene-target.js';
|
|
40
|
+
export { DEFAULT_SHADOW_SIZE, SHADOW_FORMAT, ShadowMap } from './shadow.js';
|
|
41
|
+
export type { SkinPaletteDesc } from './skin.js';
|
|
42
|
+
export { JOINT_FLOATS, SkinPalette, setVertexSkin } from './skin.js';
|
|
43
|
+
export { type SnapshotOptions, SnapshotRenderer } from './snapshot.js';
|
|
44
|
+
export type { StandardDissolve, StandardMapDesc, StandardMapSlot, StandardMaterialDesc, } from './standard.js';
|
|
45
|
+
export { createStandardMaterial, packStandardUniforms, STANDARD_DISSOLVE_OFFSET, STANDARD_TEXTURE_SLOTS, STANDARD_UNIFORM_FLOATS, } from './standard.js';
|
|
46
|
+
export type { DefaultTextures, LoadTextureArrayOptions, LoadTextureOptions, PixelData, PixelSource, SamplerKind, TextureArrayDesc, TextureDesc, TextureLayerSource, TextureLike, TextureSource, } from './texture.js';
|
|
47
|
+
export { bytesPerTexel, createTextureArray, defaultTextures, loadTexture, loadTextureArray, mipLevelCount, Texture, } from './texture.js';
|
|
48
|
+
export type { TileLayer, TileLayerOptions, TileLayerOrder } from './tile-layer.js';
|
|
49
|
+
export { createTileLayer } from './tile-layer.js';
|
|
50
|
+
export type { ReadonlyQuat, ReadonlyVec3 } from './transform.js';
|
|
51
|
+
export { Transform } from './transform.js';
|
|
52
|
+
export type { PreludeVariant } from './wgsl.js';
|
|
53
|
+
export { createShaderModule, materialPrelude, PLAIN_VARIANT, prevLaneBufferLayout, prevLaneLocations, SKIN_PALETTE_BINDING, WGSL_FULLSCREEN_PRELUDE, WGSL_GLOBALS, WGSL_LAMBERT_BRDF, WGSL_LIGHTS, WGSL_NOISE, WGSL_SKIN, wgslLightLoop, } from './wgsl.js';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export { ALL_LAYERS, Camera, FRUSTUM_FLOATS, ORTHO2D_HALF_DEPTH, } from './camera.js';
|
|
2
|
+
export { createFollow2D } from './camera-2d.js';
|
|
3
|
+
export { hex, linearToSrgb, rgba, scaleRgb, srgbToLinear } from './color.js';
|
|
4
|
+
export { blockInfo, COMPRESSION_FEATURES, CompressedTextureError, compressionFeatures, ktx2LevelLayout, rendererCaps, uploadKtx2, } from './compressed.js';
|
|
5
|
+
export { gpuDiagnostics, installGpuErrorLogging, onGpuError, reportGpuError } from './diagnostics.js';
|
|
6
|
+
export { DynamicResolution, } from './dynamic-resolution.js';
|
|
7
|
+
export { atlasFrames, createFlipbook } from './flipbook.js';
|
|
8
|
+
export { Frame, INSTANCE_PARAM_FLOATS, SKIN_PARAM, writeInstanceParams } from './frame.js';
|
|
9
|
+
export { FullscreenPass } from './fullscreen.js';
|
|
10
|
+
export { GpuTimer, supportsTimestamps } from './gpu-timer.js';
|
|
11
|
+
export { InstanceList } from './instance-list.js';
|
|
12
|
+
export { ALL_LIGHT_LAYERS, DEFAULT_SHADOW_BIAS, INSTANCE_LAYER_BITS, INSTANCE_LAYER_SHIFT, Lights, MAX_POINT_LIGHTS, MAX_SPOT_LIGHTS, POINT_LIGHT_FLOATS, packInstanceFlags, SPOT_LIGHT_FLOATS, spotCone, } from './lights.js';
|
|
13
|
+
export { DEFAULT_LOD_HYSTERESIS, isMeshLod, lodSizePx, pickLodLevel } from './lod.js';
|
|
14
|
+
export { DEPTH_FORMAT, INSTANCE_BUFFER_LAYOUT, INSTANCE_FLOATS, INSTANCE_OFFSET, INSTANCE_STRIDE, Material, } from './material.js';
|
|
15
|
+
export { AUTO_BOUNDS_MAX_VERTICES, Mesh, quadGeometry, SKIN_JOINTS_BYTE_OFFSET, SKIN_WEIGHTS_BYTE_OFFSET, VERTEX_BUFFER_LAYOUT, VERTEX_FLOATS, VERTEX_LAYOUT_2D, VERTEX_LAYOUT_3D, VERTEX_LAYOUT_3D_TANGENT, VERTEX_LAYOUT_3D_UV2, VERTEX_LAYOUT_SKINNED, VERTEX_SKINNED_BUFFER_LAYOUT, VERTEX_SKINNED_FLOATS, VERTEX_SKINNED_STRIDE, VERTEX_STRIDE, VERTEX3D_BUFFER_LAYOUT, VERTEX3D_FLOATS, VERTEX3D_STRIDE, VERTEX3D_UV2_FLOATS, VERTEX3D_UV2_STRIDE, } from './mesh.js';
|
|
16
|
+
export { generateMipmaps } from './mipmap.js';
|
|
17
|
+
export { createParallax, parallaxOffset } from './parallax.js';
|
|
18
|
+
export { WGSL_PBR } from './pbr-wgsl.js';
|
|
19
|
+
export { PingPong } from './ping-pong.js';
|
|
20
|
+
export { MIN_RESOLUTION_SCALE, Renderer, sceneSize } from './renderer.js';
|
|
21
|
+
export { ROUGH_METAL_FORMAT, SCENE_FORMAT, SceneTarget, VELOCITY_FORMAT, } from './scene-target.js';
|
|
22
|
+
export { DEFAULT_SHADOW_SIZE, SHADOW_FORMAT, ShadowMap } from './shadow.js';
|
|
23
|
+
export { JOINT_FLOATS, SkinPalette, setVertexSkin } from './skin.js';
|
|
24
|
+
export { SnapshotRenderer } from './snapshot.js';
|
|
25
|
+
export { createStandardMaterial, packStandardUniforms, STANDARD_DISSOLVE_OFFSET, STANDARD_TEXTURE_SLOTS, STANDARD_UNIFORM_FLOATS, } from './standard.js';
|
|
26
|
+
export { bytesPerTexel, createTextureArray, defaultTextures, loadTexture, loadTextureArray, mipLevelCount, Texture, } from './texture.js';
|
|
27
|
+
export { createTileLayer } from './tile-layer.js';
|
|
28
|
+
export { Transform } from './transform.js';
|
|
29
|
+
export { createShaderModule, materialPrelude, PLAIN_VARIANT, prevLaneBufferLayout, prevLaneLocations, SKIN_PALETTE_BINDING, WGSL_FULLSCREEN_PRELUDE, WGSL_GLOBALS, WGSL_LAMBERT_BRDF, WGSL_LIGHTS, WGSL_NOISE, WGSL_SKIN, wgslLightLoop, } from './wgsl.js';
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { type InstanceBatch, type InstanceParams } from './frame.js';
|
|
2
|
+
import { type MeshLod } from './lod.js';
|
|
3
|
+
import { type Material } from './material.js';
|
|
4
|
+
import type { Mesh, MeshBounds } from './mesh.js';
|
|
5
|
+
import { Transform } from './transform.js';
|
|
6
|
+
/** `renderer.createInstanceList` options. */
|
|
7
|
+
export interface InstanceListOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Keep each instance's previous-frame matrix in a second vertex buffer (`prevBuffer`), so a
|
|
10
|
+
* material writing a velocity attachment (`SceneTargetDesc.aux.velocity`) sees the
|
|
11
|
+
* instance's own motion rather than the camera's alone. A LOD list keeps the matrices but
|
|
12
|
+
* no buffer: they travel with its per-frame copy. Default false.
|
|
13
|
+
*/
|
|
14
|
+
velocity?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A retained list of up to `capacity` instances of one mesh and material, drawn with
|
|
18
|
+
* `frame.list(list)`; made by `renderer.createInstanceList`. Instances are set and removed by
|
|
19
|
+
* index (`set`, `remove`: swap-remove) and live in the list's own GPU vertex buffer, in the
|
|
20
|
+
* engine instance format: a frame uploads only the index range touched since the last one, so
|
|
21
|
+
* an unchanged list costs nothing on the CPU and no `writeBuffer`. `matrices` (12 floats per
|
|
22
|
+
* instance, 3×4 row-major) and `params` (`INSTANCE_PARAM_FLOATS` each) are the CPU copies; code
|
|
23
|
+
* that writes them directly calls `touch(i)` so the range uploads.
|
|
24
|
+
*
|
|
25
|
+
* The list is culled as one unit by `bounds`, a world-space sphere: computed from the mesh's
|
|
26
|
+
* bounds through every instance (the centre of their box, the radius to the farthest one plus
|
|
27
|
+
* its scaled mesh radius) whenever instances changed, or fixed by `setBounds`. A mesh without
|
|
28
|
+
* bounds (`radius` Infinity) gives a list that is never culled.
|
|
29
|
+
*/
|
|
30
|
+
export declare class InstanceList implements InstanceBatch {
|
|
31
|
+
readonly material: Material;
|
|
32
|
+
readonly capacity: number;
|
|
33
|
+
readonly matrices: Float32Array;
|
|
34
|
+
readonly params: Float32Array;
|
|
35
|
+
/** Layer mask of the whole list (`camera.layers`); default 1. */
|
|
36
|
+
layerBits: number;
|
|
37
|
+
/** Sort key (`InstanceParams.order`); default 0. */
|
|
38
|
+
order: number;
|
|
39
|
+
/** Draw into the sun's shadow map; default: the mesh is not 2D. */
|
|
40
|
+
castShadow?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* The GPU vertex buffer the instances live in (`capacity` × `INSTANCE_STRIDE` bytes). A LOD
|
|
43
|
+
* list (`lod`) never writes it (ws/render-9): its instances reach the GPU in the frame's
|
|
44
|
+
* per-level copy.
|
|
45
|
+
*/
|
|
46
|
+
readonly buffer: GPUBuffer;
|
|
47
|
+
/**
|
|
48
|
+
* With `velocity` (ws/render-4): the previous frame's matrices (12 floats per instance) and
|
|
49
|
+
* the vertex buffer (48 bytes per instance, slot 2) a material writing a velocity attachment
|
|
50
|
+
* reads them from; null otherwise. A slot `set` this frame keeps what it held before as
|
|
51
|
+
* previous; one left alone settles to its current matrix at the next flush (no motion).
|
|
52
|
+
* A LOD list (`lod`) keeps `prevMatrices` but has no `prevBuffer` and uploads none
|
|
53
|
+
* (ws/render-8): the renderer copies its previous matrices into its shared lane.
|
|
54
|
+
*/
|
|
55
|
+
readonly prevMatrices: Float32Array | null;
|
|
56
|
+
readonly prevBuffer: GPUBuffer | null;
|
|
57
|
+
/** Keeps a previous-matrix lane (`createInstanceList(..., { velocity: true })`). */
|
|
58
|
+
readonly velocity: boolean;
|
|
59
|
+
private _count;
|
|
60
|
+
private _bounds;
|
|
61
|
+
private fixedBounds;
|
|
62
|
+
private boundsDirty;
|
|
63
|
+
/** Instance range `[dirtyLo, dirtyHi)` to upload; empty when `dirtyLo >= dirtyHi`. */
|
|
64
|
+
private dirtyLo;
|
|
65
|
+
private dirtyHi;
|
|
66
|
+
/** Interleaved staging for the upload, in the instance format. */
|
|
67
|
+
private readonly data;
|
|
68
|
+
private readonly center;
|
|
69
|
+
/** With velocity: the flush each slot was last captured in (0: never); `flushes` counts them. */
|
|
70
|
+
private readonly stamp;
|
|
71
|
+
private flushes;
|
|
72
|
+
/** With velocity: the range dirty at the last flush, settled (prev := current) at the next. */
|
|
73
|
+
private settleLo;
|
|
74
|
+
private settleHi;
|
|
75
|
+
/** Live instances at the last flush. */
|
|
76
|
+
private lastCount;
|
|
77
|
+
/** Per-slot keys (`setKey`; NaN: none), made on the first `setKey`. */
|
|
78
|
+
private keys;
|
|
79
|
+
/**
|
|
80
|
+
* Key → slot hash tables (open addressing, `tableMask + 1` entries): `tableSlots[t]` -1 is
|
|
81
|
+
* empty. `cur` is the one the last flush filled; the other is refilled at the next.
|
|
82
|
+
*/
|
|
83
|
+
private tableKeys;
|
|
84
|
+
private tableSlots;
|
|
85
|
+
private tableMask;
|
|
86
|
+
private cur;
|
|
87
|
+
/** With velocity and keys: each slot's matrix at the last flush. */
|
|
88
|
+
private lastMatrices;
|
|
89
|
+
private _previousIndex;
|
|
90
|
+
/** The list's mesh: the one it was made with, or the first level of its `lod`. */
|
|
91
|
+
readonly mesh: Mesh;
|
|
92
|
+
/**
|
|
93
|
+
* The LOD chain the list was made with (ws/render-6), else null. Each instance then picks a
|
|
94
|
+
* level per view, and `frame.list` copies the instances into the frame's upload bucketed by
|
|
95
|
+
* level rather than drawing from `buffer`; with `velocity` its `prevMatrices` travel with
|
|
96
|
+
* the copy into the renderer's shared lane (ws/render-7), so it has no `prevBuffer`.
|
|
97
|
+
*/
|
|
98
|
+
readonly lod: MeshLod | null;
|
|
99
|
+
constructor(device: GPUDevice, mesh: Mesh | MeshLod, material: Material, capacity: number, opts?: InstanceListOptions);
|
|
100
|
+
/** Live instances (the first `count` slots). */
|
|
101
|
+
get count(): number;
|
|
102
|
+
/**
|
|
103
|
+
* The world sphere the list is culled by: `setBounds`'s, or the one computed from the
|
|
104
|
+
* instances (refreshed by the next `frame.list` after a change, or by `flush`); null for a
|
|
105
|
+
* mesh without bounds.
|
|
106
|
+
*/
|
|
107
|
+
get bounds(): MeshBounds | null;
|
|
108
|
+
/**
|
|
109
|
+
* True once any instance has a key (`setKey`, ws/render-7): the list then matches each
|
|
110
|
+
* instance to last frame's by key (keyless slots by index) at every flush, for its LOD
|
|
111
|
+
* level memory and its velocity history.
|
|
112
|
+
*/
|
|
113
|
+
get keyed(): boolean;
|
|
114
|
+
/**
|
|
115
|
+
* Flushes so far (`flush`, once per `frame.list`). `previousIndex` maps the instances of
|
|
116
|
+
* flush `flushCount` onto those of flush `flushCount - 1`.
|
|
117
|
+
*/
|
|
118
|
+
get flushCount(): number;
|
|
119
|
+
/**
|
|
120
|
+
* With keys (`keyed`), after each flush: per live instance, the index it held at the
|
|
121
|
+
* previous flush (matched by key, a keyless slot by its own index), or -1 for an instance
|
|
122
|
+
* that was not there (a new key, or an index past last flush's count). Null until keyed.
|
|
123
|
+
*/
|
|
124
|
+
get previousIndex(): Int32Array | null;
|
|
125
|
+
/**
|
|
126
|
+
* Give instance `i` (0..count-1) a stable `key` (ws/render-7): a finite number, an entity
|
|
127
|
+
* id, unique in the list (on duplicates the last slot wins). The instance's LOD level
|
|
128
|
+
* memory and velocity history then follow the key, not the index, so removing or
|
|
129
|
+
* reordering instances (`remove`'s swap, a `clear` and refill in another order) changes no
|
|
130
|
+
* other instance's level and no other instance's motion. `null` clears it. The key stays
|
|
131
|
+
* with the slot through `set` and moves with `remove`; a slot appended by `set` starts
|
|
132
|
+
* without one. Chain it after `set`: `list.set(i, t).setKey(i, id)`.
|
|
133
|
+
*/
|
|
134
|
+
setKey(i: number, key: number | null): this;
|
|
135
|
+
/** Instance `i`'s key (`setKey`), or null for none. */
|
|
136
|
+
keyOf(i: number): number | null;
|
|
137
|
+
/** True when the next `frame.list` has something to upload. */
|
|
138
|
+
get dirty(): boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Place instance `i` (0..count; `count` appends) by a `Transform` or a 3×4 row-major matrix
|
|
141
|
+
* (12 floats, read from `offset`), with `params` (`InstanceParams`; omitted: the defaults).
|
|
142
|
+
* `size` is the transform's scale.xy, or the matrix's x and y column lengths.
|
|
143
|
+
*/
|
|
144
|
+
set(i: number, m: Transform | ArrayLike<number>, params?: InstanceParams, offset?: number): this;
|
|
145
|
+
/**
|
|
146
|
+
* Remove instance `i`: the last instance moves into its slot (swap-remove). Returns the index
|
|
147
|
+
* that moved (the old last), or -1 when `i` was the last. Callers keeping indices update
|
|
148
|
+
* the moved one.
|
|
149
|
+
*/
|
|
150
|
+
remove(i: number): number;
|
|
151
|
+
/** Drop every instance (nothing to upload: the next `set`s mark their own range). */
|
|
152
|
+
clear(): void;
|
|
153
|
+
/** Mark instance `i` changed (after writing `matrices` / `params` directly). */
|
|
154
|
+
touch(i: number): void;
|
|
155
|
+
/**
|
|
156
|
+
* Fix the cull sphere (world space, copied), or pass null to go back to the automatic one.
|
|
157
|
+
*/
|
|
158
|
+
setBounds(bounds: MeshBounds | null): this;
|
|
159
|
+
/**
|
|
160
|
+
* Upload the changed range to `buffer` (one `writeBuffer`, or none when nothing changed) and
|
|
161
|
+
* refresh the automatic bounds. The renderer calls it from `frame.list`; no allocation. A LOD
|
|
162
|
+
* list uploads nothing: `frame.list` copies its instances into the frame's upload per level.
|
|
163
|
+
*/
|
|
164
|
+
flush(queue: GPUQueue): void;
|
|
165
|
+
destroy(): void;
|
|
166
|
+
/** With velocity: the first `set` of a slot in a frame keeps its current matrix as previous. */
|
|
167
|
+
private capture;
|
|
168
|
+
/**
|
|
169
|
+
* Settle the slots dirty last flush but untouched this one (previous := current), give a
|
|
170
|
+
* brand-new instance its current matrix as previous, and upload the previous lane over the
|
|
171
|
+
* union of both ranges.
|
|
172
|
+
*/
|
|
173
|
+
private flushPrevious;
|
|
174
|
+
private ensureKeys;
|
|
175
|
+
/** Hash table start index of `k`. */
|
|
176
|
+
private hashOf;
|
|
177
|
+
/**
|
|
178
|
+
* Fill `previousIndex` from the table of the last flush (keyed slots by key, keyless by
|
|
179
|
+
* index), then refill the other table with this flush's keys and make it current. No
|
|
180
|
+
* allocation.
|
|
181
|
+
*/
|
|
182
|
+
private matchKeys;
|
|
183
|
+
/** The automatic sphere: `mesh.bounds` through every live instance. */
|
|
184
|
+
private computeBounds;
|
|
185
|
+
}
|