@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,706 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* glTF 2.0 parser: bytes in, an engine-free `GltfDocument` out. Pure data, no DOM, no GPU, no
|
|
3
|
+
* fetch (the game fetches the file and any external resource; VISION rule: the engine never
|
|
4
|
+
* makes a network call). `gltf-load.ts` turns the document into meshes, textures and transforms.
|
|
5
|
+
*
|
|
6
|
+
* Handles the GLB container, `.gltf` JSON (as text bytes or a parsed object), `data:` URIs in
|
|
7
|
+
* buffers and images, and every accessor component type (float, normalised and unnormalised
|
|
8
|
+
* integers, interleaved strides). Static geometry only: `triangles` primitives, metallic-roughness
|
|
9
|
+
* materials, node hierarchies, plus skins (joints, inverse bind matrices, `JOINTS_0`/`WEIGHTS_0`)
|
|
10
|
+
* and animations (every sampler interpolation, cubic-spline tangents kept) and morph targets
|
|
11
|
+
* (`POSITION` and `NORMAL` deltas per target, sparse or dense, plus the mesh's default
|
|
12
|
+
* `weights`). Sparse accessors outside morph targets, other primitive modes and required
|
|
13
|
+
* extensions throw a `GltfError`; `extensionsUsed` entries the parser does not read are listed
|
|
14
|
+
* in `warnings`. Materials carry every metallic-roughness slot (`TextureRef` per map, with
|
|
15
|
+
* `KHR_texture_transform` and `KHR_materials_emissive_strength` applied) and textures their
|
|
16
|
+
* sampler; primitives also read `TANGENT` and `TEXCOORD_1`. `gltf-skin.ts` turns skins into the
|
|
17
|
+
* animation module's `Skeleton` shape and skinned primitives into the skinned vertex layout.
|
|
18
|
+
*
|
|
19
|
+
* Matrices follow the engine's `Transform` convention: 3×4 row-major, `local = T · R · S`,
|
|
20
|
+
* `world = parent.world · local`.
|
|
21
|
+
*/
|
|
22
|
+
export declare class GltfError extends Error {
|
|
23
|
+
constructor(message: string);
|
|
24
|
+
}
|
|
25
|
+
export type GltfComponentType = 5120 | 5121 | 5122 | 5123 | 5125 | 5126;
|
|
26
|
+
export type GltfAccessorType = 'SCALAR' | 'VEC2' | 'VEC3' | 'VEC4' | 'MAT2' | 'MAT3' | 'MAT4';
|
|
27
|
+
export interface GltfJsonAccessor {
|
|
28
|
+
bufferView?: number;
|
|
29
|
+
byteOffset?: number;
|
|
30
|
+
componentType: GltfComponentType;
|
|
31
|
+
normalized?: boolean;
|
|
32
|
+
count: number;
|
|
33
|
+
type: GltfAccessorType;
|
|
34
|
+
min?: number[];
|
|
35
|
+
max?: number[];
|
|
36
|
+
/** Sparse storage: `count` overrides at `indices` over the dense data (or zeros). */
|
|
37
|
+
sparse?: GltfJsonSparse;
|
|
38
|
+
}
|
|
39
|
+
/** A sparse accessor's indices and values (glTF `accessor.sparse`). */
|
|
40
|
+
export interface GltfJsonSparse {
|
|
41
|
+
count: number;
|
|
42
|
+
indices: {
|
|
43
|
+
bufferView: number;
|
|
44
|
+
byteOffset?: number;
|
|
45
|
+
componentType: 5121 | 5123 | 5125;
|
|
46
|
+
};
|
|
47
|
+
values: {
|
|
48
|
+
bufferView: number;
|
|
49
|
+
byteOffset?: number;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export interface GltfJsonBufferView {
|
|
53
|
+
buffer: number;
|
|
54
|
+
byteOffset?: number;
|
|
55
|
+
byteLength: number;
|
|
56
|
+
byteStride?: number;
|
|
57
|
+
extensions?: {
|
|
58
|
+
EXT_meshopt_compression?: GltfJsonMeshoptView;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/** `EXT_meshopt_compression` on a buffer view: where the compressed stream is and how to decode it. */
|
|
62
|
+
export interface GltfJsonMeshoptView {
|
|
63
|
+
buffer: number;
|
|
64
|
+
byteOffset?: number;
|
|
65
|
+
byteLength: number;
|
|
66
|
+
byteStride: number;
|
|
67
|
+
count: number;
|
|
68
|
+
mode: 'ATTRIBUTES' | 'TRIANGLES' | 'INDICES';
|
|
69
|
+
filter?: 'NONE' | 'OCTAHEDRAL' | 'QUATERNION' | 'EXPONENTIAL';
|
|
70
|
+
}
|
|
71
|
+
/** One `KHR_lights_punctual` light definition (`extensions.KHR_lights_punctual.lights[i]`). */
|
|
72
|
+
export interface GltfJsonLight {
|
|
73
|
+
name?: string;
|
|
74
|
+
type: 'directional' | 'point' | 'spot';
|
|
75
|
+
color?: number[];
|
|
76
|
+
intensity?: number;
|
|
77
|
+
range?: number;
|
|
78
|
+
spot?: {
|
|
79
|
+
innerConeAngle?: number;
|
|
80
|
+
outerConeAngle?: number;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/** One glTF `camera`. */
|
|
84
|
+
export interface GltfJsonCamera {
|
|
85
|
+
name?: string;
|
|
86
|
+
type: 'perspective' | 'orthographic';
|
|
87
|
+
perspective?: {
|
|
88
|
+
aspectRatio?: number;
|
|
89
|
+
yfov: number;
|
|
90
|
+
zfar?: number;
|
|
91
|
+
znear: number;
|
|
92
|
+
};
|
|
93
|
+
orthographic?: {
|
|
94
|
+
xmag: number;
|
|
95
|
+
ymag: number;
|
|
96
|
+
zfar: number;
|
|
97
|
+
znear: number;
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
/** `KHR_materials_variants` on a primitive: which material each set of variants binds. */
|
|
101
|
+
export interface GltfJsonVariantMapping {
|
|
102
|
+
material: number;
|
|
103
|
+
variants: number[];
|
|
104
|
+
name?: string;
|
|
105
|
+
}
|
|
106
|
+
export interface GltfJsonPrimitive {
|
|
107
|
+
attributes: Record<string, number>;
|
|
108
|
+
indices?: number;
|
|
109
|
+
material?: number;
|
|
110
|
+
mode?: number;
|
|
111
|
+
/** Morph targets: one attribute map per target (`POSITION`, `NORMAL`, `TANGENT`, …). */
|
|
112
|
+
targets?: Record<string, number>[];
|
|
113
|
+
extensions?: {
|
|
114
|
+
KHR_materials_variants?: {
|
|
115
|
+
mappings?: GltfJsonVariantMapping[];
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
export interface GltfJsonMesh {
|
|
120
|
+
name?: string;
|
|
121
|
+
primitives: GltfJsonPrimitive[];
|
|
122
|
+
/** Default morph weight per target. */
|
|
123
|
+
weights?: number[];
|
|
124
|
+
}
|
|
125
|
+
export interface GltfJsonNode {
|
|
126
|
+
name?: string;
|
|
127
|
+
children?: number[];
|
|
128
|
+
mesh?: number;
|
|
129
|
+
skin?: number;
|
|
130
|
+
matrix?: number[];
|
|
131
|
+
translation?: number[];
|
|
132
|
+
rotation?: number[];
|
|
133
|
+
scale?: number[];
|
|
134
|
+
/** Index into `GltfJson.cameras`. */
|
|
135
|
+
camera?: number;
|
|
136
|
+
extensions?: {
|
|
137
|
+
KHR_lights_punctual?: {
|
|
138
|
+
light: number;
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
/** `KHR_texture_transform` on a texture reference (`extensions.KHR_texture_transform`). */
|
|
143
|
+
export interface GltfJsonTextureTransform {
|
|
144
|
+
offset?: number[];
|
|
145
|
+
rotation?: number;
|
|
146
|
+
scale?: number[];
|
|
147
|
+
texCoord?: number;
|
|
148
|
+
}
|
|
149
|
+
/** A glTF `textureInfo` (`normalTextureInfo` adds `scale`, `occlusionTextureInfo` `strength`). */
|
|
150
|
+
export interface GltfJsonTextureInfo {
|
|
151
|
+
index: number;
|
|
152
|
+
texCoord?: number;
|
|
153
|
+
scale?: number;
|
|
154
|
+
strength?: number;
|
|
155
|
+
extensions?: {
|
|
156
|
+
KHR_texture_transform?: GltfJsonTextureTransform;
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
export interface GltfJsonMaterial {
|
|
160
|
+
name?: string;
|
|
161
|
+
pbrMetallicRoughness?: {
|
|
162
|
+
baseColorFactor?: number[];
|
|
163
|
+
baseColorTexture?: GltfJsonTextureInfo;
|
|
164
|
+
metallicFactor?: number;
|
|
165
|
+
roughnessFactor?: number;
|
|
166
|
+
metallicRoughnessTexture?: GltfJsonTextureInfo;
|
|
167
|
+
};
|
|
168
|
+
normalTexture?: GltfJsonTextureInfo;
|
|
169
|
+
occlusionTexture?: GltfJsonTextureInfo;
|
|
170
|
+
emissiveTexture?: GltfJsonTextureInfo;
|
|
171
|
+
emissiveFactor?: number[];
|
|
172
|
+
doubleSided?: boolean;
|
|
173
|
+
alphaMode?: 'OPAQUE' | 'MASK' | 'BLEND';
|
|
174
|
+
alphaCutoff?: number;
|
|
175
|
+
extensions?: {
|
|
176
|
+
KHR_materials_emissive_strength?: {
|
|
177
|
+
emissiveStrength?: number;
|
|
178
|
+
};
|
|
179
|
+
KHR_materials_clearcoat?: {
|
|
180
|
+
clearcoatFactor?: number;
|
|
181
|
+
clearcoatTexture?: GltfJsonTextureInfo;
|
|
182
|
+
clearcoatRoughnessFactor?: number;
|
|
183
|
+
clearcoatRoughnessTexture?: GltfJsonTextureInfo;
|
|
184
|
+
clearcoatNormalTexture?: GltfJsonTextureInfo;
|
|
185
|
+
};
|
|
186
|
+
KHR_materials_sheen?: {
|
|
187
|
+
sheenColorFactor?: number[];
|
|
188
|
+
sheenColorTexture?: GltfJsonTextureInfo;
|
|
189
|
+
sheenRoughnessFactor?: number;
|
|
190
|
+
sheenRoughnessTexture?: GltfJsonTextureInfo;
|
|
191
|
+
};
|
|
192
|
+
KHR_materials_transmission?: {
|
|
193
|
+
transmissionFactor?: number;
|
|
194
|
+
transmissionTexture?: GltfJsonTextureInfo;
|
|
195
|
+
};
|
|
196
|
+
KHR_materials_volume?: {
|
|
197
|
+
thicknessFactor?: number;
|
|
198
|
+
thicknessTexture?: GltfJsonTextureInfo;
|
|
199
|
+
attenuationDistance?: number;
|
|
200
|
+
attenuationColor?: number[];
|
|
201
|
+
};
|
|
202
|
+
KHR_materials_ior?: {
|
|
203
|
+
ior?: number;
|
|
204
|
+
};
|
|
205
|
+
KHR_materials_specular?: {
|
|
206
|
+
specularFactor?: number;
|
|
207
|
+
specularTexture?: GltfJsonTextureInfo;
|
|
208
|
+
specularColorFactor?: number[];
|
|
209
|
+
specularColorTexture?: GltfJsonTextureInfo;
|
|
210
|
+
};
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
export interface GltfJsonSkin {
|
|
214
|
+
name?: string;
|
|
215
|
+
/** Accessor of `MAT4` inverse bind matrices, one per joint (identity when absent). */
|
|
216
|
+
inverseBindMatrices?: number;
|
|
217
|
+
/** The skeleton root node. */
|
|
218
|
+
skeleton?: number;
|
|
219
|
+
joints: number[];
|
|
220
|
+
}
|
|
221
|
+
export type GltfJsonInterpolation = 'LINEAR' | 'STEP' | 'CUBICSPLINE';
|
|
222
|
+
export interface GltfJsonAnimationSampler {
|
|
223
|
+
/** Accessor of keyframe times (`SCALAR` float, seconds, ascending). */
|
|
224
|
+
input: number;
|
|
225
|
+
/** Accessor of keyframe values (`VEC3`, `VEC4` or `SCALAR` weights; ×3 for `CUBICSPLINE`). */
|
|
226
|
+
output: number;
|
|
227
|
+
interpolation?: GltfJsonInterpolation;
|
|
228
|
+
}
|
|
229
|
+
export interface GltfJsonAnimationChannel {
|
|
230
|
+
sampler: number;
|
|
231
|
+
target: {
|
|
232
|
+
node?: number;
|
|
233
|
+
path: string;
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
export interface GltfJsonAnimation {
|
|
237
|
+
name?: string;
|
|
238
|
+
channels: GltfJsonAnimationChannel[];
|
|
239
|
+
samplers: GltfJsonAnimationSampler[];
|
|
240
|
+
}
|
|
241
|
+
/** The parts of a glTF 2.0 JSON document the parser reads. Other properties pass through. */
|
|
242
|
+
export interface GltfJson {
|
|
243
|
+
asset?: {
|
|
244
|
+
version?: string;
|
|
245
|
+
generator?: string;
|
|
246
|
+
};
|
|
247
|
+
extensionsRequired?: string[];
|
|
248
|
+
extensionsUsed?: string[];
|
|
249
|
+
scene?: number;
|
|
250
|
+
scenes?: {
|
|
251
|
+
name?: string;
|
|
252
|
+
nodes?: number[];
|
|
253
|
+
}[];
|
|
254
|
+
nodes?: GltfJsonNode[];
|
|
255
|
+
meshes?: GltfJsonMesh[];
|
|
256
|
+
accessors?: GltfJsonAccessor[];
|
|
257
|
+
bufferViews?: GltfJsonBufferView[];
|
|
258
|
+
buffers?: {
|
|
259
|
+
uri?: string;
|
|
260
|
+
byteLength: number;
|
|
261
|
+
/** `fallback: true` marks a buffer only `EXT_meshopt_compression` views point at (may have no data). */
|
|
262
|
+
extensions?: {
|
|
263
|
+
EXT_meshopt_compression?: {
|
|
264
|
+
fallback?: boolean;
|
|
265
|
+
};
|
|
266
|
+
};
|
|
267
|
+
}[];
|
|
268
|
+
materials?: GltfJsonMaterial[];
|
|
269
|
+
textures?: {
|
|
270
|
+
name?: string;
|
|
271
|
+
source?: number;
|
|
272
|
+
sampler?: number;
|
|
273
|
+
extensions?: {
|
|
274
|
+
KHR_texture_basisu?: {
|
|
275
|
+
source: number;
|
|
276
|
+
};
|
|
277
|
+
};
|
|
278
|
+
}[];
|
|
279
|
+
images?: {
|
|
280
|
+
name?: string;
|
|
281
|
+
uri?: string;
|
|
282
|
+
mimeType?: string;
|
|
283
|
+
bufferView?: number;
|
|
284
|
+
}[];
|
|
285
|
+
samplers?: {
|
|
286
|
+
magFilter?: number;
|
|
287
|
+
minFilter?: number;
|
|
288
|
+
wrapS?: number;
|
|
289
|
+
wrapT?: number;
|
|
290
|
+
}[];
|
|
291
|
+
skins?: GltfJsonSkin[];
|
|
292
|
+
animations?: GltfJsonAnimation[];
|
|
293
|
+
cameras?: GltfJsonCamera[];
|
|
294
|
+
extensions?: {
|
|
295
|
+
KHR_lights_punctual?: {
|
|
296
|
+
lights?: GltfJsonLight[];
|
|
297
|
+
};
|
|
298
|
+
KHR_materials_variants?: {
|
|
299
|
+
variants?: {
|
|
300
|
+
name?: string;
|
|
301
|
+
}[];
|
|
302
|
+
};
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
export type Vec3 = [number, number, number];
|
|
306
|
+
export type Vec4 = [number, number, number, number];
|
|
307
|
+
/** An axis-aligned box and the sphere around it. */
|
|
308
|
+
export interface GltfBounds {
|
|
309
|
+
min: Vec3;
|
|
310
|
+
max: Vec3;
|
|
311
|
+
center: Vec3;
|
|
312
|
+
radius: number;
|
|
313
|
+
}
|
|
314
|
+
/** One `triangles` primitive, de-interleaved: `vertexCount` vertices, `indices.length / 3` triangles. */
|
|
315
|
+
export interface GltfPrimitive {
|
|
316
|
+
vertexCount: number;
|
|
317
|
+
/** xyz per vertex. */
|
|
318
|
+
position: Float32Array;
|
|
319
|
+
/** xyz per vertex; flat face normals when the file has none (vertices are then unwelded). */
|
|
320
|
+
normal: Float32Array;
|
|
321
|
+
/** uv per vertex (`TEXCOORD_0`); zeros when missing. */
|
|
322
|
+
uv0: Float32Array;
|
|
323
|
+
/** `TEXCOORD_1`, uv per vertex, or null when missing (the loader binds `uv0` only). */
|
|
324
|
+
uv1: Float32Array | null;
|
|
325
|
+
/**
|
|
326
|
+
* `TANGENT`, xyzw per vertex (xyz the unit tangent along +u, w ±1 the handedness: the
|
|
327
|
+
* bitangent is `w · cross(normal, tangent)`), or null. Follows the unwelding.
|
|
328
|
+
*/
|
|
329
|
+
tangent: Float32Array | null;
|
|
330
|
+
/** rgba per vertex (`COLOR_0`, a vec3 gets alpha 1); ones when missing. */
|
|
331
|
+
color0: Float32Array;
|
|
332
|
+
/** Triangle list; generated `0..n-1` when the file has none. */
|
|
333
|
+
indices: Uint16Array | Uint32Array;
|
|
334
|
+
/** Index into `GltfDocument.materials`, or null for the default material. */
|
|
335
|
+
material: number | null;
|
|
336
|
+
/** From the position accessor's `min`/`max` (computed from the data when absent). */
|
|
337
|
+
bounds: GltfBounds;
|
|
338
|
+
/** Whether the file carried normals (`false`: generated flat). */
|
|
339
|
+
hadNormals: boolean;
|
|
340
|
+
/**
|
|
341
|
+
* `JOINTS_0`, 4 joint indices per vertex (into the node's skin `joints`), or null when the
|
|
342
|
+
* primitive is not skinned. `Uint8Array` when every index fits a byte (the skinned vertex
|
|
343
|
+
* layout's `uint8x4`), `Uint16Array` otherwise.
|
|
344
|
+
*/
|
|
345
|
+
joints: Uint8Array | Uint16Array | null;
|
|
346
|
+
/** `WEIGHTS_0`, 4 floats per vertex (normalised integers already divided), or null. */
|
|
347
|
+
weights: Float32Array | null;
|
|
348
|
+
/**
|
|
349
|
+
* Morph targets, in file order (empty when the primitive has none). Each holds per-vertex
|
|
350
|
+
* deltas (`vertexCount × 3`) that `anim`'s `createMorphBlender` adds to the base at the
|
|
351
|
+
* target's weight; both follow the unwelding when flat normals are generated.
|
|
352
|
+
*/
|
|
353
|
+
targets: GltfMorphTarget[];
|
|
354
|
+
/** Target attributes the parser read past (`TANGENT`, `TEXCOORD_0`, …), once each. */
|
|
355
|
+
ignoredTargetAttributes: string[];
|
|
356
|
+
/**
|
|
357
|
+
* `KHR_materials_variants` mappings: each binds `material` when one of `variants` (indices
|
|
358
|
+
* into `GltfDocument.variants`) is active; empty when the primitive has none. A variant no
|
|
359
|
+
* mapping names leaves the primitive on `material`.
|
|
360
|
+
*/
|
|
361
|
+
variants: GltfVariantMapping[];
|
|
362
|
+
}
|
|
363
|
+
/** One `KHR_materials_variants` mapping of a primitive. */
|
|
364
|
+
export interface GltfVariantMapping {
|
|
365
|
+
/** Index into `GltfDocument.materials`. */
|
|
366
|
+
material: number;
|
|
367
|
+
/** Indices into `GltfDocument.variants`. */
|
|
368
|
+
variants: number[];
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* One morph target: position and normal deltas, 3 floats per vertex, or null when the target
|
|
372
|
+
* does not displace that attribute. The shape `anim/morph.ts` (`MorphTarget`) consumes.
|
|
373
|
+
*/
|
|
374
|
+
export interface GltfMorphTarget {
|
|
375
|
+
position: Float32Array | null;
|
|
376
|
+
normal: Float32Array | null;
|
|
377
|
+
}
|
|
378
|
+
export interface GltfMesh {
|
|
379
|
+
name: string | null;
|
|
380
|
+
primitives: GltfPrimitive[];
|
|
381
|
+
/**
|
|
382
|
+
* Default morph weights, one per target (`mesh.weights`), or null when the file gives none
|
|
383
|
+
* (every target then starts at 0). The `weights` animation path writes the same layout.
|
|
384
|
+
*/
|
|
385
|
+
weights: Float32Array | null;
|
|
386
|
+
}
|
|
387
|
+
export interface GltfNode {
|
|
388
|
+
name: string | null;
|
|
389
|
+
parent: number | null;
|
|
390
|
+
children: number[];
|
|
391
|
+
mesh: number | null;
|
|
392
|
+
/** Index into `GltfDocument.skins`, or null. */
|
|
393
|
+
skin: number | null;
|
|
394
|
+
/** Index into the file's `cameras` the node carries, or null (`GltfDocument.cameras` places it). */
|
|
395
|
+
camera: number | null;
|
|
396
|
+
/** Index into the file's `KHR_lights_punctual` lights, or null (`GltfDocument.lights`). */
|
|
397
|
+
light: number | null;
|
|
398
|
+
/** TRS, decomposed from `matrix` when the node gave one. */
|
|
399
|
+
translation: Vec3;
|
|
400
|
+
rotation: Vec4;
|
|
401
|
+
scale: Vec3;
|
|
402
|
+
/** `T · R · S`, 3×4 row-major (the engine's `Transform.localMatrix` convention). */
|
|
403
|
+
local: Float32Array;
|
|
404
|
+
/** `parent.world · local`, 3×4 row-major. */
|
|
405
|
+
world: Float32Array;
|
|
406
|
+
}
|
|
407
|
+
export type GltfAlphaMode = 'OPAQUE' | 'MASK' | 'BLEND';
|
|
408
|
+
/**
|
|
409
|
+
* `KHR_texture_transform`: `uv' = offset + R(rotation) · (scale ⊙ uv)`, the spec's
|
|
410
|
+
* `T · R · S` with `R` rotating by `rotation` radians counter-clockwise in uv space
|
|
411
|
+
* (`u' = cos·su − sin·sv`, `v' = sin·su + cos·sv`). `transformUv` applies one.
|
|
412
|
+
*/
|
|
413
|
+
export interface GltfTextureTransform {
|
|
414
|
+
offset: [number, number];
|
|
415
|
+
rotation: number;
|
|
416
|
+
scale: [number, number];
|
|
417
|
+
}
|
|
418
|
+
/** A material's reference to one of `GltfDocument.textures`. */
|
|
419
|
+
export interface TextureRef {
|
|
420
|
+
/** Index into `GltfDocument.textures`. */
|
|
421
|
+
index: number;
|
|
422
|
+
/** Which `TEXCOORD_n` the slot reads (0 or 1; the loader binds `TEXCOORD_0` only). */
|
|
423
|
+
texCoord: number;
|
|
424
|
+
/** The slot's `KHR_texture_transform`, or null for identity. */
|
|
425
|
+
transform: GltfTextureTransform | null;
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* A glTF material, every slot of the metallic-roughness model. Factors default as the spec
|
|
429
|
+
* says (base colour 1, metallic 1, roughness 1, normal scale 1, occlusion strength 1, emissive
|
|
430
|
+
* 0); `emissiveFactor` already includes `KHR_materials_emissive_strength`. Texture conventions
|
|
431
|
+
* are glTF's: base colour and emissive are sRGB, metallic-roughness has roughness in G and
|
|
432
|
+
* metallic in B, occlusion is in R, the normal map is +Y up.
|
|
433
|
+
*/
|
|
434
|
+
export interface GltfMaterial {
|
|
435
|
+
name: string | null;
|
|
436
|
+
/** Linear RGBA multiplier (default 1, 1, 1, 1). */
|
|
437
|
+
baseColorFactor: Vec4;
|
|
438
|
+
baseColor: TextureRef | null;
|
|
439
|
+
/** Default 1. */
|
|
440
|
+
metallicFactor: number;
|
|
441
|
+
/** Default 1. */
|
|
442
|
+
roughnessFactor: number;
|
|
443
|
+
metallicRoughness: TextureRef | null;
|
|
444
|
+
normal: TextureRef | null;
|
|
445
|
+
/** `normalTexture.scale`, default 1. */
|
|
446
|
+
normalScale: number;
|
|
447
|
+
occlusion: TextureRef | null;
|
|
448
|
+
/** `occlusionTexture.strength`, default 1. */
|
|
449
|
+
occlusionStrength: number;
|
|
450
|
+
emissive: TextureRef | null;
|
|
451
|
+
/** Linear RGB × `KHR_materials_emissive_strength` (default 0, 0, 0). */
|
|
452
|
+
emissiveFactor: Vec3;
|
|
453
|
+
doubleSided: boolean;
|
|
454
|
+
alphaMode: GltfAlphaMode;
|
|
455
|
+
/** For `MASK` (default 0.5). */
|
|
456
|
+
alphaCutoff: number;
|
|
457
|
+
/**
|
|
458
|
+
* The `KHR_materials_*` extensions the parser reads but the standard material does not
|
|
459
|
+
* render yet (clearcoat, sheen, transmission, volume, ior, specular), defaults filled; null
|
|
460
|
+
* when the material does not carry one. `GltfDocument.unsupportedExtensions` lists them.
|
|
461
|
+
*/
|
|
462
|
+
extensions: GltfMaterialExtensions;
|
|
463
|
+
}
|
|
464
|
+
/** `KHR_materials_clearcoat`, spec defaults (factors 0). */
|
|
465
|
+
export interface GltfClearcoat {
|
|
466
|
+
clearcoatFactor: number;
|
|
467
|
+
clearcoatTexture: TextureRef | null;
|
|
468
|
+
clearcoatRoughnessFactor: number;
|
|
469
|
+
clearcoatRoughnessTexture: TextureRef | null;
|
|
470
|
+
clearcoatNormalTexture: TextureRef | null;
|
|
471
|
+
}
|
|
472
|
+
/** `KHR_materials_sheen`, spec defaults (colour 0, roughness 0). */
|
|
473
|
+
export interface GltfSheen {
|
|
474
|
+
sheenColorFactor: Vec3;
|
|
475
|
+
sheenColorTexture: TextureRef | null;
|
|
476
|
+
sheenRoughnessFactor: number;
|
|
477
|
+
sheenRoughnessTexture: TextureRef | null;
|
|
478
|
+
}
|
|
479
|
+
/** `KHR_materials_transmission` (factor default 0). */
|
|
480
|
+
export interface GltfTransmission {
|
|
481
|
+
transmissionFactor: number;
|
|
482
|
+
transmissionTexture: TextureRef | null;
|
|
483
|
+
}
|
|
484
|
+
/** `KHR_materials_volume` (thickness 0, attenuation distance Infinity, colour white). */
|
|
485
|
+
export interface GltfVolume {
|
|
486
|
+
thicknessFactor: number;
|
|
487
|
+
thicknessTexture: TextureRef | null;
|
|
488
|
+
attenuationDistance: number;
|
|
489
|
+
attenuationColor: Vec3;
|
|
490
|
+
}
|
|
491
|
+
/** `KHR_materials_ior` (default 1.5). */
|
|
492
|
+
export interface GltfIor {
|
|
493
|
+
ior: number;
|
|
494
|
+
}
|
|
495
|
+
/** `KHR_materials_specular` (factor 1, colour white). */
|
|
496
|
+
export interface GltfSpecular {
|
|
497
|
+
specularFactor: number;
|
|
498
|
+
specularTexture: TextureRef | null;
|
|
499
|
+
specularColorFactor: Vec3;
|
|
500
|
+
specularColorTexture: TextureRef | null;
|
|
501
|
+
}
|
|
502
|
+
/** The parsed-but-not-rendered `KHR_materials_*` records of one material. */
|
|
503
|
+
export interface GltfMaterialExtensions {
|
|
504
|
+
clearcoat: GltfClearcoat | null;
|
|
505
|
+
sheen: GltfSheen | null;
|
|
506
|
+
transmission: GltfTransmission | null;
|
|
507
|
+
volume: GltfVolume | null;
|
|
508
|
+
ior: GltfIor | null;
|
|
509
|
+
specular: GltfSpecular | null;
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* One `KHR_lights_punctual` light placed by a node of the default scene. Units are glTF's:
|
|
513
|
+
* world units are metres, angles radians, `intensity` candela (point, spot) or lux
|
|
514
|
+
* (directional); `loadGltf` turns it into the engine's light records (`GltfScene.lights`).
|
|
515
|
+
*/
|
|
516
|
+
export interface GltfLight {
|
|
517
|
+
name: string | null;
|
|
518
|
+
/** The node carrying the light (index into `GltfDocument.nodes`). */
|
|
519
|
+
node: number;
|
|
520
|
+
/** Index into the file's `KHR_lights_punctual.lights`. */
|
|
521
|
+
light: number;
|
|
522
|
+
type: 'directional' | 'point' | 'spot';
|
|
523
|
+
/** Linear RGB (default white). */
|
|
524
|
+
color: Vec3;
|
|
525
|
+
/** Default 1. */
|
|
526
|
+
intensity: number;
|
|
527
|
+
/** Distance where the light reaches zero; absent for "infinite" (and for directional lights). */
|
|
528
|
+
range?: number;
|
|
529
|
+
/** Spot only: full intensity inside this half-angle (default 0). */
|
|
530
|
+
innerConeAngle?: number;
|
|
531
|
+
/** Spot only: zero outside this half-angle (default π/4). */
|
|
532
|
+
outerConeAngle?: number;
|
|
533
|
+
/** World position of the node. */
|
|
534
|
+
position: Vec3;
|
|
535
|
+
/** Unit world direction the light travels: the node's local -Z. */
|
|
536
|
+
direction: Vec3;
|
|
537
|
+
/** The node's world matrix (3×4 row-major, shared with the node). */
|
|
538
|
+
world: Float32Array;
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* One glTF camera placed by a node of the default scene. Perspective: `yfov` radians,
|
|
542
|
+
* `aspectRatio` (null: the viewport's), `znear`, `zfar` (null: infinite). Orthographic:
|
|
543
|
+
* `xmag`, `ymag` (half extents), `znear`, `zfar`. The camera looks down its node's local -Z.
|
|
544
|
+
*/
|
|
545
|
+
export interface GltfCamera {
|
|
546
|
+
name: string | null;
|
|
547
|
+
/** The node carrying the camera. */
|
|
548
|
+
node: number;
|
|
549
|
+
/** Index into the file's `cameras`. */
|
|
550
|
+
camera: number;
|
|
551
|
+
type: 'perspective' | 'orthographic';
|
|
552
|
+
yfov: number;
|
|
553
|
+
aspectRatio: number | null;
|
|
554
|
+
znear: number;
|
|
555
|
+
zfar: number | null;
|
|
556
|
+
xmag: number;
|
|
557
|
+
ymag: number;
|
|
558
|
+
position: Vec3;
|
|
559
|
+
/** The node's world matrix (3×4 row-major, shared with the node). */
|
|
560
|
+
world: Float32Array;
|
|
561
|
+
/** The view matrix: the inverse of the node's world with scale removed, column-major 4×4. */
|
|
562
|
+
view: Float32Array;
|
|
563
|
+
}
|
|
564
|
+
export type GltfFilter = 'nearest' | 'linear';
|
|
565
|
+
export type GltfWrap = 'repeat' | 'clamp-to-edge' | 'mirror-repeat';
|
|
566
|
+
/** A texture's sampler in GPU terms (`GPUSamplerDescriptor` names), defaults filled. */
|
|
567
|
+
export interface GltfSampler {
|
|
568
|
+
/** Default `'linear'`. */
|
|
569
|
+
magFilter: GltfFilter;
|
|
570
|
+
/** Default `'linear'`. */
|
|
571
|
+
minFilter: GltfFilter;
|
|
572
|
+
/** Between mip levels; null when `minFilter` names no mipmap mode (then no mips). */
|
|
573
|
+
mipmapFilter: GltfFilter | null;
|
|
574
|
+
/** Default `'repeat'`. */
|
|
575
|
+
wrapS: GltfWrap;
|
|
576
|
+
wrapT: GltfWrap;
|
|
577
|
+
}
|
|
578
|
+
export interface GltfTexture {
|
|
579
|
+
name: string | null;
|
|
580
|
+
/** Index into `GltfDocument.images`, or null (an extension-only texture). */
|
|
581
|
+
source: number | null;
|
|
582
|
+
/**
|
|
583
|
+
* `KHR_texture_basisu`: the KTX2 image (index into `GltfDocument.images`), or null. The
|
|
584
|
+
* loader does not upload it yet (`parseKtx2` reads the container); `source`, when given, is
|
|
585
|
+
* the file's PNG/JPEG fallback and is what `loadGltf` binds.
|
|
586
|
+
*/
|
|
587
|
+
basisuSource: number | null;
|
|
588
|
+
/** `wrapS`/`wrapT` are 10497 repeat (default), 33071 clamp, 33648 mirror. */
|
|
589
|
+
wrapS: number;
|
|
590
|
+
wrapT: number;
|
|
591
|
+
/** 9728 nearest or 9729 linear, when the sampler gave one. */
|
|
592
|
+
magFilter: number | null;
|
|
593
|
+
/** The same sampler in GPU terms, defaults filled. */
|
|
594
|
+
sampler: GltfSampler;
|
|
595
|
+
}
|
|
596
|
+
export interface GltfImage {
|
|
597
|
+
name: string | null;
|
|
598
|
+
/** Encoded image bytes (from a bufferView or a `data:` URI), or null when `uri` is external. */
|
|
599
|
+
bytes: Uint8Array | null;
|
|
600
|
+
/** `image/png`, `image/jpeg`, …; from the file or the data URI, null when unknown. */
|
|
601
|
+
mimeType: string | null;
|
|
602
|
+
/** An external URI the game resolves (`loadGltf` `opts.resources[uri]`), or null. */
|
|
603
|
+
uri: string | null;
|
|
604
|
+
}
|
|
605
|
+
/** A skin: which nodes are joints and the matrix that takes a vertex into each joint's space. */
|
|
606
|
+
export interface GltfSkin {
|
|
607
|
+
name: string | null;
|
|
608
|
+
/** Node index per joint (`joints[j]` is the node joint `j` follows). */
|
|
609
|
+
joints: number[];
|
|
610
|
+
/**
|
|
611
|
+
* Inverse bind matrix per joint, 3×4 row-major, 12 floats each (`joints.length * 12`),
|
|
612
|
+
* converted from the file's column-major 4×4; identity when the file has none.
|
|
613
|
+
*/
|
|
614
|
+
inverseBind: Float32Array;
|
|
615
|
+
/** The skeleton root node the file named, or null. */
|
|
616
|
+
skeleton: number | null;
|
|
617
|
+
}
|
|
618
|
+
export type GltfAnimationPath = 'translation' | 'rotation' | 'scale' | 'weights';
|
|
619
|
+
export type GltfInterpolation = 'STEP' | 'LINEAR' | 'CUBICSPLINE';
|
|
620
|
+
/**
|
|
621
|
+
* One animated property of one node, in the shape of the animation module's `AnimationChannel`
|
|
622
|
+
* (`src/anim/clip.ts`; restated here so `assets` does not import `anim`). `times` holds `n`
|
|
623
|
+
* ascending seconds; `values` holds `n` elements of 3 (`translation`, `scale`), 4 (`rotation`,
|
|
624
|
+
* quaternion xyzw exactly as the file stored them) or `k` (`weights`, one per morph target)
|
|
625
|
+
* floats, or `3 * n` elements for `CUBICSPLINE` (in-tangent, value, out-tangent per keyframe).
|
|
626
|
+
*/
|
|
627
|
+
export interface GltfAnimationChannel {
|
|
628
|
+
/** Index into `GltfDocument.nodes`. */
|
|
629
|
+
node: number;
|
|
630
|
+
path: GltfAnimationPath;
|
|
631
|
+
interpolation: GltfInterpolation;
|
|
632
|
+
times: Float32Array;
|
|
633
|
+
values: Float32Array;
|
|
634
|
+
}
|
|
635
|
+
/** One clip, in the shape of the animation module's `AnimationClip`. */
|
|
636
|
+
export interface GltfAnimation {
|
|
637
|
+
/** The file's name, or `animation<i>`. */
|
|
638
|
+
name: string;
|
|
639
|
+
/** The last keyframe time over every channel (0 for an empty clip). */
|
|
640
|
+
duration: number;
|
|
641
|
+
channels: GltfAnimationChannel[];
|
|
642
|
+
}
|
|
643
|
+
export interface GltfDocument {
|
|
644
|
+
/** `asset.version`. */
|
|
645
|
+
version: string;
|
|
646
|
+
/** Root node indices of the default scene. */
|
|
647
|
+
scene: number[];
|
|
648
|
+
/** Every node reachable from `scene`, parents before children. */
|
|
649
|
+
sceneNodes: number[];
|
|
650
|
+
nodes: GltfNode[];
|
|
651
|
+
meshes: GltfMesh[];
|
|
652
|
+
materials: GltfMaterial[];
|
|
653
|
+
textures: GltfTexture[];
|
|
654
|
+
images: GltfImage[];
|
|
655
|
+
skins: GltfSkin[];
|
|
656
|
+
animations: GltfAnimation[];
|
|
657
|
+
/** External (non-`data:`) URIs the game must fetch: images here, buffers at parse time. */
|
|
658
|
+
externalUris: string[];
|
|
659
|
+
/**
|
|
660
|
+
* `extensionsUsed` entries the parser does not read, and anything else it skipped. Read
|
|
661
|
+
* (never warned): `KHR_texture_transform`, `KHR_materials_emissive_strength`,
|
|
662
|
+
* `KHR_mesh_quantization`, `EXT_meshopt_compression`, `KHR_lights_punctual`,
|
|
663
|
+
* `KHR_materials_variants`, plus those in `unsupportedExtensions`.
|
|
664
|
+
*/
|
|
665
|
+
warnings: string[];
|
|
666
|
+
/**
|
|
667
|
+
* `extensionsUsed` entries the parser reads into the document but the renderer does not
|
|
668
|
+
* draw yet, once each: `KHR_materials_clearcoat`, `_sheen`, `_transmission`, `_volume`,
|
|
669
|
+
* `_ior`, `_specular` (`GltfMaterial.extensions`) and `KHR_texture_basisu`
|
|
670
|
+
* (`GltfTexture.basisuSource`).
|
|
671
|
+
*/
|
|
672
|
+
unsupportedExtensions: string[];
|
|
673
|
+
/** `KHR_lights_punctual` lights of the default scene, one per carrying node, in scene order. */
|
|
674
|
+
lights: GltfLight[];
|
|
675
|
+
/** Cameras of the default scene, one per carrying node, in scene order. */
|
|
676
|
+
cameras: GltfCamera[];
|
|
677
|
+
/** `KHR_materials_variants` names, in file order (`GltfScene.setVariant` takes one). */
|
|
678
|
+
variants: string[];
|
|
679
|
+
/** World-space bounds of the default scene's meshes; radius 0 at the origin when empty. */
|
|
680
|
+
bounds: GltfBounds;
|
|
681
|
+
}
|
|
682
|
+
/**
|
|
683
|
+
* A `.gltf` whose JSON the game already parsed. `buffers[i]` supplies `json.buffers[i]` when
|
|
684
|
+
* that buffer has an external `uri` (or none, as in a GLB); `data:` buffers decode themselves.
|
|
685
|
+
*/
|
|
686
|
+
export interface GltfJsonSource {
|
|
687
|
+
json: GltfJson;
|
|
688
|
+
buffers?: ArrayBuffer[];
|
|
689
|
+
}
|
|
690
|
+
/**
|
|
691
|
+
* Parse a GLB (`ArrayBuffer`), the UTF-8 text of a `.gltf` (`ArrayBuffer`), or a parsed
|
|
692
|
+
* `.gltf` with its buffers. Throws `GltfError` on anything this step does not support.
|
|
693
|
+
*/
|
|
694
|
+
export declare function parseGltf(source: ArrayBuffer | GltfJsonSource): GltfDocument;
|
|
695
|
+
/**
|
|
696
|
+
* Apply a `KHR_texture_transform` to one uv (`T · R · S · uv`): `out[0], out[1]` ← the
|
|
697
|
+
* transformed `u, v`. Returns `out`.
|
|
698
|
+
*/
|
|
699
|
+
export declare function transformUv(t: GltfTextureTransform, u: number, v: number, out?: [number, number]): [number, number];
|
|
700
|
+
/** `T · R · S` as 3×4 row-major (the same formula as `Transform.updateLocal`). */
|
|
701
|
+
export declare function composeTrs(t: Vec3, q: Vec4, s: Vec3, out: Float32Array): void;
|
|
702
|
+
/** Decode a `data:[<mime>][;base64],<payload>` URI. */
|
|
703
|
+
export declare function decodeDataUri(uri: string): {
|
|
704
|
+
bytes: Uint8Array<ArrayBuffer>;
|
|
705
|
+
mimeType: string | null;
|
|
706
|
+
};
|