@vgai/engine 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/schemas/engine-capabilities.json +4 -4
- package/schemas/vgai-game.schema.json +2 -2
- package/src/adapter/authoring.ts +42 -0
- package/src/adapter/index.ts +3 -0
- package/src/adapter/ingest/overlay-apply.ts +50 -6
- package/src/adapter/ingest/scene-capture.ts +51 -2
- package/src/adapter/vgai-scene-game-adapter.ts +24 -0
- package/src/manifest/schema.ts +7 -3
- package/src/runtime/create-runtime.ts +97 -0
- package/src/runtime/game.ts +11 -1
- package/src/scene/asset-ref-check.ts +1 -1
- package/src/scene/scene-loader.ts +2 -2
- package/src/scene/user-data.ts +18 -0
- package/src/world3d-react/behavior.tsx +19 -11
- package/src/world3d-react/r3f-adapter.tsx +8 -0
- package/dist/adapter/adapter-surface.d.ts +0 -30
- package/dist/adapter/adapter-surface.d.ts.map +0 -1
- package/dist/adapter/adapter-surface.js +0 -18
- package/dist/adapter/authoring.d.ts +0 -461
- package/dist/adapter/authoring.d.ts.map +0 -1
- package/dist/adapter/authoring.js +0 -22
- package/dist/adapter/colyseus-networking-adapter.d.ts +0 -43
- package/dist/adapter/colyseus-networking-adapter.d.ts.map +0 -1
- package/dist/adapter/colyseus-networking-adapter.js +0 -38
- package/dist/adapter/first-party-systems.d.ts +0 -38
- package/dist/adapter/first-party-systems.d.ts.map +0 -1
- package/dist/adapter/first-party-systems.js +0 -77
- package/dist/adapter/game-adapter.d.ts +0 -133
- package/dist/adapter/game-adapter.d.ts.map +0 -1
- package/dist/adapter/game-adapter.js +0 -10
- package/dist/adapter/host-context.d.ts +0 -71
- package/dist/adapter/host-context.d.ts.map +0 -1
- package/dist/adapter/host-context.js +0 -16
- package/dist/adapter/index.d.ts +0 -22
- package/dist/adapter/index.d.ts.map +0 -1
- package/dist/adapter/index.js +0 -15
- package/dist/adapter/ingest/game-contract.d.ts +0 -53
- package/dist/adapter/ingest/game-contract.d.ts.map +0 -1
- package/dist/adapter/ingest/game-contract.js +0 -30
- package/dist/adapter/ingest/overlay-applier.d.ts +0 -118
- package/dist/adapter/ingest/overlay-applier.d.ts.map +0 -1
- package/dist/adapter/ingest/overlay-applier.js +0 -132
- package/dist/adapter/ingest/overlay-apply.d.ts +0 -60
- package/dist/adapter/ingest/overlay-apply.d.ts.map +0 -1
- package/dist/adapter/ingest/overlay-apply.js +0 -101
- package/dist/adapter/ingest/overlay-file.d.ts +0 -79
- package/dist/adapter/ingest/overlay-file.d.ts.map +0 -1
- package/dist/adapter/ingest/overlay-file.js +0 -66
- package/dist/adapter/ingest/overlay-report.d.ts +0 -113
- package/dist/adapter/ingest/overlay-report.d.ts.map +0 -1
- package/dist/adapter/ingest/overlay-report.js +0 -103
- package/dist/adapter/ingest/scene-capture.d.ts +0 -97
- package/dist/adapter/ingest/scene-capture.d.ts.map +0 -1
- package/dist/adapter/ingest/scene-capture.js +0 -248
- package/dist/adapter/ingest/upstream-pin.d.ts +0 -47
- package/dist/adapter/ingest/upstream-pin.d.ts.map +0 -1
- package/dist/adapter/ingest/upstream-pin.js +0 -50
- package/dist/adapter/loop-gate-report.d.ts +0 -34
- package/dist/adapter/loop-gate-report.d.ts.map +0 -1
- package/dist/adapter/loop-gate-report.js +0 -37
- package/dist/adapter/rapier-physics-adapter.d.ts +0 -12
- package/dist/adapter/rapier-physics-adapter.d.ts.map +0 -1
- package/dist/adapter/rapier-physics-adapter.js +0 -46
- package/dist/adapter/system-adapter.d.ts +0 -206
- package/dist/adapter/system-adapter.d.ts.map +0 -1
- package/dist/adapter/system-adapter.js +0 -13
- package/dist/adapter/transform.d.ts +0 -18
- package/dist/adapter/transform.d.ts.map +0 -1
- package/dist/adapter/transform.js +0 -1
- package/dist/adapter/vgai-scene-game-adapter.d.ts +0 -108
- package/dist/adapter/vgai-scene-game-adapter.d.ts.map +0 -1
- package/dist/adapter/vgai-scene-game-adapter.js +0 -762
- package/dist/ai/navigation.d.ts +0 -64
- package/dist/ai/navigation.d.ts.map +0 -1
- package/dist/ai/navigation.js +0 -133
- package/dist/animation/anim-graph-types.d.ts +0 -25
- package/dist/animation/anim-graph-types.d.ts.map +0 -1
- package/dist/animation/anim-graph-types.js +0 -1
- package/dist/animation/animation-clock.d.ts +0 -213
- package/dist/animation/animation-clock.d.ts.map +0 -1
- package/dist/animation/animation-clock.js +0 -301
- package/dist/animation/blend-node.d.ts +0 -22
- package/dist/animation/blend-node.d.ts.map +0 -1
- package/dist/animation/blend-node.js +0 -97
- package/dist/animation/camera-ownership.d.ts +0 -250
- package/dist/animation/camera-ownership.d.ts.map +0 -1
- package/dist/animation/camera-ownership.js +0 -169
- package/dist/animation/cinematic-cues.d.ts +0 -200
- package/dist/animation/cinematic-cues.d.ts.map +0 -1
- package/dist/animation/cinematic-cues.js +0 -213
- package/dist/animation/clip-map.d.ts +0 -12
- package/dist/animation/clip-map.d.ts.map +0 -1
- package/dist/animation/clip-map.js +0 -37
- package/dist/animation/gsap-registration.d.ts +0 -119
- package/dist/animation/gsap-registration.d.ts.map +0 -1
- package/dist/animation/gsap-registration.js +0 -92
- package/dist/animation/theatre-clock-binding.d.ts +0 -89
- package/dist/animation/theatre-clock-binding.d.ts.map +0 -1
- package/dist/animation/theatre-clock-binding.js +0 -29
- package/dist/animation/theatre-director.d.ts +0 -242
- package/dist/animation/theatre-director.d.ts.map +0 -1
- package/dist/animation/theatre-director.js +0 -235
- package/dist/animation/theatre-object-binding.d.ts +0 -305
- package/dist/animation/theatre-object-binding.d.ts.map +0 -1
- package/dist/animation/theatre-object-binding.js +0 -351
- package/dist/animation/xstate-animation-binding.d.ts +0 -56
- package/dist/animation/xstate-animation-binding.d.ts.map +0 -1
- package/dist/animation/xstate-animation-binding.js +0 -331
- package/dist/animation/xstate-animation-meta.d.ts +0 -266
- package/dist/animation/xstate-animation-meta.d.ts.map +0 -1
- package/dist/animation/xstate-animation-meta.js +0 -252
- package/dist/assets.d.ts +0 -26
- package/dist/assets.d.ts.map +0 -1
- package/dist/assets.js +0 -55
- package/dist/audio/index.d.ts +0 -4
- package/dist/audio/index.d.ts.map +0 -1
- package/dist/audio/index.js +0 -24
- package/dist/audio/tone-clock-binding.d.ts +0 -75
- package/dist/audio/tone-clock-binding.d.ts.map +0 -1
- package/dist/audio/tone-clock-binding.js +0 -29
- package/dist/audio/tone-context.d.ts +0 -114
- package/dist/audio/tone-context.d.ts.map +0 -1
- package/dist/audio/tone-context.js +0 -39
- package/dist/audio/tone-offline-render.d.ts +0 -90
- package/dist/audio/tone-offline-render.d.ts.map +0 -1
- package/dist/audio/tone-offline-render.js +0 -56
- package/dist/audio/wav-encode.d.ts +0 -38
- package/dist/audio/wav-encode.d.ts.map +0 -1
- package/dist/audio/wav-encode.js +0 -97
- package/dist/character/cloth-sim.d.ts +0 -179
- package/dist/character/cloth-sim.d.ts.map +0 -1
- package/dist/character/cloth-sim.js +0 -334
- package/dist/character/spring-chain.d.ts +0 -135
- package/dist/character/spring-chain.d.ts.map +0 -1
- package/dist/character/spring-chain.js +0 -165
- package/dist/core/game-loop.d.ts +0 -42
- package/dist/core/game-loop.d.ts.map +0 -1
- package/dist/core/game-loop.js +0 -167
- package/dist/core/seeded-random.d.ts +0 -69
- package/dist/core/seeded-random.d.ts.map +0 -1
- package/dist/core/seeded-random.js +0 -121
- package/dist/core/system-runner.d.ts +0 -120
- package/dist/core/system-runner.d.ts.map +0 -1
- package/dist/core/system-runner.js +0 -297
- package/dist/core/types.d.ts +0 -92
- package/dist/core/types.d.ts.map +0 -1
- package/dist/core/types.js +0 -25
- package/dist/data/data-asset.d.ts +0 -101
- package/dist/data/data-asset.d.ts.map +0 -1
- package/dist/data/data-asset.js +0 -122
- package/dist/data/data-check-core.d.ts +0 -110
- package/dist/data/data-check-core.d.ts.map +0 -1
- package/dist/data/data-check-core.js +0 -178
- package/dist/data/data-ref.d.ts +0 -79
- package/dist/data/data-ref.d.ts.map +0 -1
- package/dist/data/data-ref.js +0 -130
- package/dist/data/vite-plugin-data.d.ts +0 -79
- package/dist/data/vite-plugin-data.d.ts.map +0 -1
- package/dist/data/vite-plugin-data.js +0 -217
- package/dist/dev/console-bridge.d.ts +0 -22
- package/dist/dev/console-bridge.d.ts.map +0 -1
- package/dist/dev/console-bridge.js +0 -71
- package/dist/dev/debug-draw.d.ts +0 -24
- package/dist/dev/debug-draw.d.ts.map +0 -1
- package/dist/dev/debug-draw.js +0 -73
- package/dist/dev/logger.d.ts +0 -30
- package/dist/dev/logger.d.ts.map +0 -1
- package/dist/dev/logger.js +0 -90
- package/dist/dev/performance-profiler.d.ts +0 -60
- package/dist/dev/performance-profiler.d.ts.map +0 -1
- package/dist/dev/performance-profiler.js +0 -181
- package/dist/dev/webgl-gpu-timer.d.ts +0 -8
- package/dist/dev/webgl-gpu-timer.d.ts.map +0 -1
- package/dist/dev/webgl-gpu-timer.js +0 -52
- package/dist/ecs/component-manager.d.ts +0 -205
- package/dist/ecs/component-manager.d.ts.map +0 -1
- package/dist/ecs/component-manager.js +0 -706
- package/dist/ecs/game-component.d.ts +0 -146
- package/dist/ecs/game-component.d.ts.map +0 -1
- package/dist/ecs/game-component.js +0 -141
- package/dist/ecs/hmr-swap-report.d.ts +0 -53
- package/dist/ecs/hmr-swap-report.d.ts.map +0 -1
- package/dist/ecs/hmr-swap-report.js +0 -55
- package/dist/humanoid/bake.operation.d.ts +0 -119
- package/dist/humanoid/bake.operation.d.ts.map +0 -1
- package/dist/humanoid/bake.operation.js +0 -228
- package/dist/humanoid/body.d.ts +0 -101
- package/dist/humanoid/body.d.ts.map +0 -1
- package/dist/humanoid/body.js +0 -530
- package/dist/humanoid/clips.d.ts +0 -62
- package/dist/humanoid/clips.d.ts.map +0 -1
- package/dist/humanoid/clips.js +0 -121
- package/dist/humanoid/compose.d.ts +0 -75
- package/dist/humanoid/compose.d.ts.map +0 -1
- package/dist/humanoid/compose.js +0 -176
- package/dist/humanoid/generate.d.ts +0 -92
- package/dist/humanoid/generate.d.ts.map +0 -1
- package/dist/humanoid/generate.js +0 -124
- package/dist/humanoid/index.d.ts +0 -24
- package/dist/humanoid/index.d.ts.map +0 -1
- package/dist/humanoid/index.js +0 -18
- package/dist/humanoid/schema.d.ts +0 -35
- package/dist/humanoid/schema.d.ts.map +0 -1
- package/dist/humanoid/schema.js +0 -87
- package/dist/humanoid/skeleton.d.ts +0 -103
- package/dist/humanoid/skeleton.d.ts.map +0 -1
- package/dist/humanoid/skeleton.js +0 -289
- package/dist/index.d.ts +0 -37
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -30
- package/dist/input/input-manager.d.ts +0 -945
- package/dist/input/input-manager.d.ts.map +0 -1
- package/dist/input/input-manager.js +0 -2207
- package/dist/input/input-types.d.ts +0 -174
- package/dist/input/input-types.d.ts.map +0 -1
- package/dist/input/input-types.js +0 -1
- package/dist/input/prompt-labels.d.ts +0 -21
- package/dist/input/prompt-labels.d.ts.map +0 -1
- package/dist/input/prompt-labels.js +0 -121
- package/dist/input/rebind-controller.d.ts +0 -59
- package/dist/input/rebind-controller.d.ts.map +0 -1
- package/dist/input/rebind-controller.js +0 -85
- package/dist/input/schema.d.ts +0 -16
- package/dist/input/schema.d.ts.map +0 -1
- package/dist/input/schema.js +0 -228
- package/dist/loader.d.ts +0 -43
- package/dist/loader.d.ts.map +0 -1
- package/dist/loader.js +0 -59
- package/dist/manifest/index.d.ts +0 -5
- package/dist/manifest/index.d.ts.map +0 -1
- package/dist/manifest/index.js +0 -8
- package/dist/manifest/load-file.d.ts +0 -4
- package/dist/manifest/load-file.d.ts.map +0 -1
- package/dist/manifest/load-file.js +0 -14
- package/dist/manifest/load.d.ts +0 -144
- package/dist/manifest/load.d.ts.map +0 -1
- package/dist/manifest/load.js +0 -273
- package/dist/manifest/schema.d.ts +0 -230
- package/dist/manifest/schema.d.ts.map +0 -1
- package/dist/manifest/schema.js +0 -394
- package/dist/physics/collision-system.d.ts +0 -41
- package/dist/physics/collision-system.d.ts.map +0 -1
- package/dist/physics/collision-system.js +0 -64
- package/dist/physics/physics-registry.d.ts +0 -45
- package/dist/physics/physics-registry.d.ts.map +0 -1
- package/dist/physics/physics-registry.js +0 -65
- package/dist/physics/transform-writer.d.ts +0 -16
- package/dist/physics/transform-writer.d.ts.map +0 -1
- package/dist/physics/transform-writer.js +0 -38
- package/dist/physics/trigger-dispatch.d.ts +0 -24
- package/dist/physics/trigger-dispatch.d.ts.map +0 -1
- package/dist/physics/trigger-dispatch.js +0 -80
- package/dist/react/game-state.d.ts +0 -156
- package/dist/react/game-state.d.ts.map +0 -1
- package/dist/react/game-state.js +0 -222
- package/dist/react/root-adapter.d.ts +0 -11
- package/dist/react/root-adapter.d.ts.map +0 -1
- package/dist/react/root-adapter.js +0 -41
- package/dist/react/unmanaged-root-detector.d.ts +0 -12
- package/dist/react/unmanaged-root-detector.d.ts.map +0 -1
- package/dist/react/unmanaged-root-detector.js +0 -45
- package/dist/react/use-data.d.ts +0 -60
- package/dist/react/use-data.d.ts.map +0 -1
- package/dist/react/use-data.js +0 -101
- package/dist/react/use-selection.d.ts +0 -75
- package/dist/react/use-selection.d.ts.map +0 -1
- package/dist/react/use-selection.js +0 -90
- package/dist/render/auto-batcher.d.ts +0 -34
- package/dist/render/auto-batcher.d.ts.map +0 -1
- package/dist/render/auto-batcher.js +0 -140
- package/dist/render/render-batch-system.d.ts +0 -33
- package/dist/render/render-batch-system.d.ts.map +0 -1
- package/dist/render/render-batch-system.js +0 -230
- package/dist/render/render-features.d.ts +0 -47
- package/dist/render/render-features.d.ts.map +0 -1
- package/dist/render/render-features.js +0 -105
- package/dist/render/render-settings.d.ts +0 -36
- package/dist/render/render-settings.d.ts.map +0 -1
- package/dist/render/render-settings.js +0 -51
- package/dist/runtime/create-runtime.d.ts +0 -249
- package/dist/runtime/create-runtime.d.ts.map +0 -1
- package/dist/runtime/create-runtime.js +0 -641
- package/dist/runtime/debug-bridge.d.ts +0 -257
- package/dist/runtime/debug-bridge.d.ts.map +0 -1
- package/dist/runtime/debug-bridge.js +0 -224
- package/dist/runtime/debug-registry.d.ts +0 -288
- package/dist/runtime/debug-registry.d.ts.map +0 -1
- package/dist/runtime/debug-registry.js +0 -513
- package/dist/runtime/frame-selector-cache.d.ts +0 -41
- package/dist/runtime/frame-selector-cache.d.ts.map +0 -1
- package/dist/runtime/frame-selector-cache.js +0 -65
- package/dist/runtime/game.d.ts +0 -496
- package/dist/runtime/game.d.ts.map +0 -1
- package/dist/runtime/game.js +0 -741
- package/dist/runtime/gameplay-rng-trap.d.ts +0 -48
- package/dist/runtime/gameplay-rng-trap.d.ts.map +0 -1
- package/dist/runtime/gameplay-rng-trap.js +0 -96
- package/dist/runtime/input-router.d.ts +0 -78
- package/dist/runtime/input-router.d.ts.map +0 -1
- package/dist/runtime/input-router.js +0 -171
- package/dist/runtime/mount-game.d.ts +0 -129
- package/dist/runtime/mount-game.d.ts.map +0 -1
- package/dist/runtime/mount-game.js +0 -152
- package/dist/runtime/mount-manifest.d.ts +0 -173
- package/dist/runtime/mount-manifest.d.ts.map +0 -1
- package/dist/runtime/mount-manifest.js +0 -297
- package/dist/runtime/render-audio-control.d.ts +0 -110
- package/dist/runtime/render-audio-control.d.ts.map +0 -1
- package/dist/runtime/render-audio-control.js +0 -111
- package/dist/runtime/render-control.d.ts +0 -291
- package/dist/runtime/render-control.d.ts.map +0 -1
- package/dist/runtime/render-control.js +0 -264
- package/dist/runtime/render-seed.d.ts +0 -57
- package/dist/runtime/render-seed.d.ts.map +0 -1
- package/dist/runtime/render-seed.js +0 -74
- package/dist/runtime/state-bridge.d.ts +0 -61
- package/dist/runtime/state-bridge.d.ts.map +0 -1
- package/dist/runtime/state-bridge.js +0 -63
- package/dist/runtime/types.d.ts +0 -253
- package/dist/runtime/types.d.ts.map +0 -1
- package/dist/runtime/types.js +0 -1
- package/dist/scene/asset-loaders.d.ts +0 -79
- package/dist/scene/asset-loaders.d.ts.map +0 -1
- package/dist/scene/asset-loaders.js +0 -141
- package/dist/scene/asset-paths.d.ts +0 -11
- package/dist/scene/asset-paths.d.ts.map +0 -1
- package/dist/scene/asset-paths.js +0 -108
- package/dist/scene/asset-ref-check.d.ts +0 -88
- package/dist/scene/asset-ref-check.d.ts.map +0 -1
- package/dist/scene/asset-ref-check.js +0 -214
- package/dist/scene/asset-registry.d.ts +0 -38
- package/dist/scene/asset-registry.d.ts.map +0 -1
- package/dist/scene/asset-registry.js +0 -66
- package/dist/scene/collider-dimensions.d.ts +0 -63
- package/dist/scene/collider-dimensions.d.ts.map +0 -1
- package/dist/scene/collider-dimensions.js +0 -98
- package/dist/scene/component-registry.d.ts +0 -22
- package/dist/scene/component-registry.d.ts.map +0 -1
- package/dist/scene/component-registry.js +0 -37
- package/dist/scene/defaults.d.ts +0 -252
- package/dist/scene/defaults.d.ts.map +0 -1
- package/dist/scene/defaults.js +0 -151
- package/dist/scene/geometries/index.d.ts +0 -8
- package/dist/scene/geometries/index.d.ts.map +0 -1
- package/dist/scene/geometries/index.js +0 -7
- package/dist/scene/geometries/terrain.d.ts +0 -2
- package/dist/scene/geometries/terrain.d.ts.map +0 -1
- package/dist/scene/geometries/terrain.js +0 -37
- package/dist/scene/geometry-registry.d.ts +0 -24
- package/dist/scene/geometry-registry.d.ts.map +0 -1
- package/dist/scene/geometry-registry.js +0 -20
- package/dist/scene/instance-registry.d.ts +0 -36
- package/dist/scene/instance-registry.d.ts.map +0 -1
- package/dist/scene/instance-registry.js +0 -55
- package/dist/scene/instancers/grid.d.ts +0 -2
- package/dist/scene/instancers/grid.d.ts.map +0 -1
- package/dist/scene/instancers/grid.js +0 -36
- package/dist/scene/instancers/index.d.ts +0 -8
- package/dist/scene/instancers/index.d.ts.map +0 -1
- package/dist/scene/instancers/index.js +0 -7
- package/dist/scene/light-camera-factory.d.ts +0 -23
- package/dist/scene/light-camera-factory.d.ts.map +0 -1
- package/dist/scene/light-camera-factory.js +0 -68
- package/dist/scene/material-factory.d.ts +0 -17
- package/dist/scene/material-factory.d.ts.map +0 -1
- package/dist/scene/material-factory.js +0 -197
- package/dist/scene/material-registry.d.ts +0 -40
- package/dist/scene/material-registry.d.ts.map +0 -1
- package/dist/scene/material-registry.js +0 -44
- package/dist/scene/materials/index.d.ts +0 -8
- package/dist/scene/materials/index.d.ts.map +0 -1
- package/dist/scene/materials/index.js +0 -7
- package/dist/scene/materials/water.d.ts +0 -2
- package/dist/scene/materials/water.d.ts.map +0 -1
- package/dist/scene/materials/water.js +0 -54
- package/dist/scene/parse.d.ts +0 -23
- package/dist/scene/parse.d.ts.map +0 -1
- package/dist/scene/parse.js +0 -179
- package/dist/scene/particles-factory.d.ts +0 -33
- package/dist/scene/particles-factory.d.ts.map +0 -1
- package/dist/scene/particles-factory.js +0 -282
- package/dist/scene/scene-apply.d.ts +0 -109
- package/dist/scene/scene-apply.d.ts.map +0 -1
- package/dist/scene/scene-apply.js +0 -370
- package/dist/scene/scene-diff-schema.d.ts +0 -285
- package/dist/scene/scene-diff-schema.d.ts.map +0 -1
- package/dist/scene/scene-diff-schema.js +0 -92
- package/dist/scene/scene-diff-types.d.ts +0 -40
- package/dist/scene/scene-diff-types.d.ts.map +0 -1
- package/dist/scene/scene-diff-types.js +0 -14
- package/dist/scene/scene-loader.d.ts +0 -167
- package/dist/scene/scene-loader.d.ts.map +0 -1
- package/dist/scene/scene-loader.js +0 -1211
- package/dist/scene/scene-query.d.ts +0 -11
- package/dist/scene/scene-query.d.ts.map +0 -1
- package/dist/scene/scene-query.js +0 -63
- package/dist/scene/scene-types.d.ts +0 -10
- package/dist/scene/scene-types.d.ts.map +0 -1
- package/dist/scene/scene-types.js +0 -8
- package/dist/scene/scene-version.d.ts +0 -26
- package/dist/scene/scene-version.d.ts.map +0 -1
- package/dist/scene/scene-version.js +0 -34
- package/dist/scene/schema/animation.d.ts +0 -8
- package/dist/scene/schema/animation.d.ts.map +0 -1
- package/dist/scene/schema/animation.js +0 -42
- package/dist/scene/schema/audio.d.ts +0 -13
- package/dist/scene/schema/audio.d.ts.map +0 -1
- package/dist/scene/schema/audio.js +0 -22
- package/dist/scene/schema/camera.d.ts +0 -28
- package/dist/scene/schema/camera.d.ts.map +0 -1
- package/dist/scene/schema/camera.js +0 -17
- package/dist/scene/schema/collider.d.ts +0 -40
- package/dist/scene/schema/collider.d.ts.map +0 -1
- package/dist/scene/schema/collider.js +0 -55
- package/dist/scene/schema/entity-ref.d.ts +0 -31
- package/dist/scene/schema/entity-ref.d.ts.map +0 -1
- package/dist/scene/schema/entity-ref.js +0 -61
- package/dist/scene/schema/entity.d.ts +0 -1036
- package/dist/scene/schema/entity.d.ts.map +0 -1
- package/dist/scene/schema/entity.js +0 -153
- package/dist/scene/schema/environment.d.ts +0 -425
- package/dist/scene/schema/environment.d.ts.map +0 -1
- package/dist/scene/schema/environment.js +0 -357
- package/dist/scene/schema/index.d.ts +0 -37
- package/dist/scene/schema/index.d.ts.map +0 -1
- package/dist/scene/schema/index.js +0 -19
- package/dist/scene/schema/instances.d.ts +0 -14
- package/dist/scene/schema/instances.d.ts.map +0 -1
- package/dist/scene/schema/instances.js +0 -28
- package/dist/scene/schema/joint.d.ts +0 -23
- package/dist/scene/schema/joint.d.ts.map +0 -1
- package/dist/scene/schema/joint.js +0 -23
- package/dist/scene/schema/light.d.ts +0 -38
- package/dist/scene/schema/light.d.ts.map +0 -1
- package/dist/scene/schema/light.js +0 -26
- package/dist/scene/schema/material.d.ts +0 -199
- package/dist/scene/schema/material.d.ts.map +0 -1
- package/dist/scene/schema/material.js +0 -103
- package/dist/scene/schema/mesh.d.ts +0 -48
- package/dist/scene/schema/mesh.d.ts.map +0 -1
- package/dist/scene/schema/mesh.js +0 -82
- package/dist/scene/schema/particles.d.ts +0 -2178
- package/dist/scene/schema/particles.d.ts.map +0 -1
- package/dist/scene/schema/particles.js +0 -321
- package/dist/scene/schema/physics.d.ts +0 -56
- package/dist/scene/schema/physics.d.ts.map +0 -1
- package/dist/scene/schema/physics.js +0 -37
- package/dist/scene/schema/scene-file.d.ts +0 -303
- package/dist/scene/schema/scene-file.d.ts.map +0 -1
- package/dist/scene/schema/scene-file.js +0 -256
- package/dist/scene/schema/shadow.d.ts +0 -28
- package/dist/scene/schema/shadow.d.ts.map +0 -1
- package/dist/scene/schema/shadow.js +0 -20
- package/dist/scene/schema/spline.d.ts +0 -25
- package/dist/scene/schema/spline.d.ts.map +0 -1
- package/dist/scene/schema/spline.js +0 -15
- package/dist/scene/schema/tuples.d.ts +0 -12
- package/dist/scene/schema/tuples.d.ts.map +0 -1
- package/dist/scene/schema/tuples.js +0 -14
- package/dist/scene/user-data.d.ts +0 -185
- package/dist/scene/user-data.d.ts.map +0 -1
- package/dist/scene/user-data.js +0 -144
- package/dist/setup/setup-audio.d.ts +0 -20
- package/dist/setup/setup-audio.d.ts.map +0 -1
- package/dist/setup/setup-audio.js +0 -41
- package/dist/setup/setup-particles.d.ts +0 -17
- package/dist/setup/setup-particles.d.ts.map +0 -1
- package/dist/setup/setup-particles.js +0 -16
- package/dist/setup/setup-physics.d.ts +0 -25
- package/dist/setup/setup-physics.d.ts.map +0 -1
- package/dist/setup/setup-physics.js +0 -51
- package/dist/setup/setup-renderer.d.ts +0 -69
- package/dist/setup/setup-renderer.d.ts.map +0 -1
- package/dist/setup/setup-renderer.js +0 -363
- package/dist/tools/define-tool.d.ts +0 -130
- package/dist/tools/define-tool.d.ts.map +0 -1
- package/dist/tools/define-tool.js +0 -96
- package/dist/world2d/authoring-2d.d.ts +0 -80
- package/dist/world2d/authoring-2d.d.ts.map +0 -1
- package/dist/world2d/authoring-2d.js +0 -195
- package/dist/world2d/capture-to-scene2d.d.ts +0 -5
- package/dist/world2d/capture-to-scene2d.d.ts.map +0 -1
- package/dist/world2d/capture-to-scene2d.js +0 -49
- package/dist/world2d/collision-2d.d.ts +0 -52
- package/dist/world2d/collision-2d.d.ts.map +0 -1
- package/dist/world2d/collision-2d.js +0 -70
- package/dist/world2d/components-2d.d.ts +0 -47
- package/dist/world2d/components-2d.d.ts.map +0 -1
- package/dist/world2d/components-2d.js +0 -77
- package/dist/world2d/index.d.ts +0 -34
- package/dist/world2d/index.d.ts.map +0 -1
- package/dist/world2d/index.js +0 -32
- package/dist/world2d/ingest-iframe-2d.d.ts +0 -82
- package/dist/world2d/ingest-iframe-2d.d.ts.map +0 -1
- package/dist/world2d/ingest-iframe-2d.js +0 -166
- package/dist/world2d/ingest2d.d.ts +0 -97
- package/dist/world2d/ingest2d.d.ts.map +0 -1
- package/dist/world2d/ingest2d.js +0 -40
- package/dist/world2d/physics2d-registry.d.ts +0 -24
- package/dist/world2d/physics2d-registry.d.ts.map +0 -1
- package/dist/world2d/physics2d-registry.js +0 -38
- package/dist/world2d/pixi-game-adapter.d.ts +0 -107
- package/dist/world2d/pixi-game-adapter.d.ts.map +0 -1
- package/dist/world2d/pixi-game-adapter.js +0 -210
- package/dist/world2d/pixi-surface.d.ts +0 -39
- package/dist/world2d/pixi-surface.d.ts.map +0 -1
- package/dist/world2d/pixi-surface.js +0 -47
- package/dist/world2d/scene-capture-2d.d.ts +0 -43
- package/dist/world2d/scene-capture-2d.d.ts.map +0 -1
- package/dist/world2d/scene-capture-2d.js +0 -92
- package/dist/world2d/scene2d-loader.d.ts +0 -27
- package/dist/world2d/scene2d-loader.d.ts.map +0 -1
- package/dist/world2d/scene2d-loader.js +0 -275
- package/dist/world2d/schema/entity2d.d.ts +0 -102
- package/dist/world2d/schema/entity2d.d.ts.map +0 -1
- package/dist/world2d/schema/entity2d.js +0 -119
- package/dist/world2d/schema/physics2d.d.ts +0 -46
- package/dist/world2d/schema/physics2d.d.ts.map +0 -1
- package/dist/world2d/schema/physics2d.js +0 -45
- package/dist/world2d/schema/sprite.d.ts +0 -42
- package/dist/world2d/schema/sprite.d.ts.map +0 -1
- package/dist/world2d/schema/sprite.js +0 -63
- package/dist/world2d/schema/tilemap.d.ts +0 -15
- package/dist/world2d/schema/tilemap.d.ts.map +0 -1
- package/dist/world2d/schema/tilemap.js +0 -19
- package/dist/world2d/schema/tuples2d.d.ts +0 -20
- package/dist/world2d/schema/tuples2d.d.ts.map +0 -1
- package/dist/world2d/schema/tuples2d.js +0 -19
- package/dist/world2d/system-adapters-2d.d.ts +0 -16
- package/dist/world2d/system-adapters-2d.d.ts.map +0 -1
- package/dist/world2d/system-adapters-2d.js +0 -37
- package/dist/world2d/transform-writer-2d.d.ts +0 -16
- package/dist/world2d/transform-writer-2d.d.ts.map +0 -1
- package/dist/world2d/transform-writer-2d.js +0 -22
- package/dist/world2d/types.d.ts +0 -59
- package/dist/world2d/types.d.ts.map +0 -1
- package/dist/world2d/types.js +0 -1
package/dist/humanoid/body.js
DELETED
|
@@ -1,530 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The procedural humanoid BODY: entirely procedural three.js geometry
|
|
3
|
-
* (capsules + one pelvis box via `CapsuleGeometry`/`BoxGeometry`, merged with
|
|
4
|
-
* `BufferGeometryUtils.mergeGeometries` into ONE `SkinnedMesh`). No imported
|
|
5
|
-
* mesh anywhere. Promoted from the accepted Phase-1 PoC
|
|
6
|
-
* (`packages/engine/e2e/humanoid-skin-proof/procedural-body.ts`) and
|
|
7
|
-
* parameterized by body dimensions — with all-default dims the output is
|
|
8
|
-
* bit-identical to the PoC body.
|
|
9
|
-
*
|
|
10
|
-
* Skin binding is **analytic per-segment with smooth 2-bone joint blending**:
|
|
11
|
-
* every body part is generated along one bone segment (proximal joint →
|
|
12
|
-
* distal joint, both known a priori from the rest pose), so each vertex's
|
|
13
|
-
* normalized position `t` along the bone axis is exact — no nearest-bone
|
|
14
|
-
* search, no heuristic falloff radius. Vertices in the interior of a segment
|
|
15
|
-
* bind 100% to that segment's bone; vertices inside a blend zone at either
|
|
16
|
-
* end split weight smoothstep-wise with the adjacent bone, reaching 50/50 at
|
|
17
|
-
* (and past) the joint itself. This is the standard cure for the two classic
|
|
18
|
-
* rigid-binding artifacts: gaps/interpenetration at elbows/knees (fixed by
|
|
19
|
-
* the overshoot + 50/50 blend across the joint) and hard shading creases
|
|
20
|
-
* (fixed by the smoothstep ramp). Because the blend zone is derived from the
|
|
21
|
-
* ACTUAL joint positions of the (possibly rescaled) skeleton, weights stay
|
|
22
|
-
* correct as body proportions change. Two influences per vertex is enough
|
|
23
|
-
* for a capsule-limb body; the vertex format still uses the standard 4-wide
|
|
24
|
-
* skinIndex/skinWeight attributes, zero-padded, exactly as GLTF skins do.
|
|
25
|
-
*/
|
|
26
|
-
import * as THREE from 'three';
|
|
27
|
-
import { mergeGeometries } from 'three/addons/utils/BufferGeometryUtils.js';
|
|
28
|
-
const C = {
|
|
29
|
-
torso: 0x4f8fba,
|
|
30
|
-
pelvis: 0x3a6ea5,
|
|
31
|
-
head: 0xd9a066,
|
|
32
|
-
neck: 0xc98b5e,
|
|
33
|
-
armL: 0xe07b39,
|
|
34
|
-
foreL: 0xf0a860,
|
|
35
|
-
armR: 0x4fae6a,
|
|
36
|
-
foreR: 0x7fd196,
|
|
37
|
-
hand: 0xd9c8b4,
|
|
38
|
-
thigh: 0x8a5fb0,
|
|
39
|
-
shin: 0xb08ad0,
|
|
40
|
-
foot: 0x555f6e,
|
|
41
|
-
toe: 0x6d7885,
|
|
42
|
-
};
|
|
43
|
-
/** The full body map. Radii/overshoots are metres at reference scale, tuned
|
|
44
|
-
* to the reference rig's T-pose proportions (~1.83 m tall). */
|
|
45
|
-
const SEGMENTS = [
|
|
46
|
-
// Torso column — three short, fat, overlapping capsules following the
|
|
47
|
-
// spine chain, each blending into its neighbours.
|
|
48
|
-
{
|
|
49
|
-
bone: 'mixamorigSpine',
|
|
50
|
-
from: 'mixamorigSpine',
|
|
51
|
-
to: 'mixamorigSpine1',
|
|
52
|
-
radius: 0.135,
|
|
53
|
-
group: 'torso',
|
|
54
|
-
proximalBlend: 'mixamorigHips',
|
|
55
|
-
distalBlend: 'mixamorigSpine1',
|
|
56
|
-
overshootFrom: 0.03,
|
|
57
|
-
overshootTo: 0.02,
|
|
58
|
-
color: C.torso,
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
bone: 'mixamorigSpine1',
|
|
62
|
-
from: 'mixamorigSpine1',
|
|
63
|
-
to: 'mixamorigSpine2',
|
|
64
|
-
radius: 0.145,
|
|
65
|
-
group: 'torso',
|
|
66
|
-
proximalBlend: 'mixamorigSpine',
|
|
67
|
-
distalBlend: 'mixamorigSpine2',
|
|
68
|
-
overshootFrom: 0.02,
|
|
69
|
-
overshootTo: 0.02,
|
|
70
|
-
color: C.torso,
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
bone: 'mixamorigSpine2',
|
|
74
|
-
from: 'mixamorigSpine2',
|
|
75
|
-
to: 'mixamorigNeck',
|
|
76
|
-
radius: 0.14,
|
|
77
|
-
group: 'torso',
|
|
78
|
-
proximalBlend: 'mixamorigSpine1',
|
|
79
|
-
distalBlend: 'mixamorigNeck',
|
|
80
|
-
overshootFrom: 0.02,
|
|
81
|
-
overshootTo: 0.01,
|
|
82
|
-
color: C.torso,
|
|
83
|
-
},
|
|
84
|
-
// Neck + head.
|
|
85
|
-
{
|
|
86
|
-
bone: 'mixamorigNeck',
|
|
87
|
-
from: 'mixamorigNeck',
|
|
88
|
-
to: 'mixamorigHead',
|
|
89
|
-
radius: 0.048,
|
|
90
|
-
group: 'head',
|
|
91
|
-
proximalBlend: 'mixamorigSpine2',
|
|
92
|
-
distalBlend: 'mixamorigHead',
|
|
93
|
-
overshootFrom: 0.02,
|
|
94
|
-
overshootTo: 0.02,
|
|
95
|
-
color: C.neck,
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
bone: 'mixamorigHead',
|
|
99
|
-
from: 'mixamorigHead',
|
|
100
|
-
to: 'mixamorigHeadTop_End',
|
|
101
|
-
radius: 0.105,
|
|
102
|
-
group: 'head',
|
|
103
|
-
proximalBlend: 'mixamorigNeck',
|
|
104
|
-
color: C.head,
|
|
105
|
-
},
|
|
106
|
-
// Left arm chain (shoulder → upper arm → forearm → hand).
|
|
107
|
-
{
|
|
108
|
-
bone: 'mixamorigLeftShoulder',
|
|
109
|
-
from: 'mixamorigLeftShoulder',
|
|
110
|
-
to: 'mixamorigLeftArm',
|
|
111
|
-
radius: 0.062,
|
|
112
|
-
group: 'torso',
|
|
113
|
-
proximalBlend: 'mixamorigSpine2',
|
|
114
|
-
distalBlend: 'mixamorigLeftArm',
|
|
115
|
-
overshootFrom: 0.02,
|
|
116
|
-
color: C.torso,
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
bone: 'mixamorigLeftArm',
|
|
120
|
-
from: 'mixamorigLeftArm',
|
|
121
|
-
to: 'mixamorigLeftForeArm',
|
|
122
|
-
radius: 0.052,
|
|
123
|
-
group: 'limb',
|
|
124
|
-
proximalBlend: 'mixamorigLeftShoulder',
|
|
125
|
-
distalBlend: 'mixamorigLeftForeArm',
|
|
126
|
-
overshootFrom: 0.015,
|
|
127
|
-
overshootTo: 0.01,
|
|
128
|
-
color: C.armL,
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
bone: 'mixamorigLeftForeArm',
|
|
132
|
-
from: 'mixamorigLeftForeArm',
|
|
133
|
-
to: 'mixamorigLeftHand',
|
|
134
|
-
radius: 0.044,
|
|
135
|
-
group: 'limb',
|
|
136
|
-
proximalBlend: 'mixamorigLeftArm',
|
|
137
|
-
distalBlend: 'mixamorigLeftHand',
|
|
138
|
-
overshootFrom: 0.01,
|
|
139
|
-
overshootTo: 0.01,
|
|
140
|
-
color: C.foreL,
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
bone: 'mixamorigLeftHand',
|
|
144
|
-
from: 'mixamorigLeftHand',
|
|
145
|
-
to: 'mixamorigLeftHandMiddle1',
|
|
146
|
-
radius: 0.04,
|
|
147
|
-
group: 'limb',
|
|
148
|
-
proximalBlend: 'mixamorigLeftForeArm',
|
|
149
|
-
overshootTo: 0.05,
|
|
150
|
-
color: C.hand,
|
|
151
|
-
},
|
|
152
|
-
// Right arm chain.
|
|
153
|
-
{
|
|
154
|
-
bone: 'mixamorigRightShoulder',
|
|
155
|
-
from: 'mixamorigRightShoulder',
|
|
156
|
-
to: 'mixamorigRightArm',
|
|
157
|
-
radius: 0.062,
|
|
158
|
-
group: 'torso',
|
|
159
|
-
proximalBlend: 'mixamorigSpine2',
|
|
160
|
-
distalBlend: 'mixamorigRightArm',
|
|
161
|
-
overshootFrom: 0.02,
|
|
162
|
-
color: C.torso,
|
|
163
|
-
},
|
|
164
|
-
{
|
|
165
|
-
bone: 'mixamorigRightArm',
|
|
166
|
-
from: 'mixamorigRightArm',
|
|
167
|
-
to: 'mixamorigRightForeArm',
|
|
168
|
-
radius: 0.052,
|
|
169
|
-
group: 'limb',
|
|
170
|
-
proximalBlend: 'mixamorigRightShoulder',
|
|
171
|
-
distalBlend: 'mixamorigRightForeArm',
|
|
172
|
-
overshootFrom: 0.015,
|
|
173
|
-
overshootTo: 0.01,
|
|
174
|
-
color: C.armR,
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
bone: 'mixamorigRightForeArm',
|
|
178
|
-
from: 'mixamorigRightForeArm',
|
|
179
|
-
to: 'mixamorigRightHand',
|
|
180
|
-
radius: 0.044,
|
|
181
|
-
group: 'limb',
|
|
182
|
-
proximalBlend: 'mixamorigRightArm',
|
|
183
|
-
distalBlend: 'mixamorigRightHand',
|
|
184
|
-
overshootFrom: 0.01,
|
|
185
|
-
overshootTo: 0.01,
|
|
186
|
-
color: C.foreR,
|
|
187
|
-
},
|
|
188
|
-
{
|
|
189
|
-
bone: 'mixamorigRightHand',
|
|
190
|
-
from: 'mixamorigRightHand',
|
|
191
|
-
to: 'mixamorigRightHandMiddle1',
|
|
192
|
-
radius: 0.04,
|
|
193
|
-
group: 'limb',
|
|
194
|
-
proximalBlend: 'mixamorigRightForeArm',
|
|
195
|
-
overshootTo: 0.05,
|
|
196
|
-
color: C.hand,
|
|
197
|
-
},
|
|
198
|
-
// Left leg chain (thigh → shin → foot → toes).
|
|
199
|
-
{
|
|
200
|
-
bone: 'mixamorigLeftUpLeg',
|
|
201
|
-
from: 'mixamorigLeftUpLeg',
|
|
202
|
-
to: 'mixamorigLeftLeg',
|
|
203
|
-
radius: 0.078,
|
|
204
|
-
group: 'limb',
|
|
205
|
-
proximalBlend: 'mixamorigHips',
|
|
206
|
-
distalBlend: 'mixamorigLeftLeg',
|
|
207
|
-
overshootFrom: 0.035,
|
|
208
|
-
overshootTo: 0.01,
|
|
209
|
-
color: C.thigh,
|
|
210
|
-
},
|
|
211
|
-
{
|
|
212
|
-
bone: 'mixamorigLeftLeg',
|
|
213
|
-
from: 'mixamorigLeftLeg',
|
|
214
|
-
to: 'mixamorigLeftFoot',
|
|
215
|
-
radius: 0.058,
|
|
216
|
-
group: 'limb',
|
|
217
|
-
proximalBlend: 'mixamorigLeftUpLeg',
|
|
218
|
-
distalBlend: 'mixamorigLeftFoot',
|
|
219
|
-
overshootFrom: 0.01,
|
|
220
|
-
overshootTo: 0.01,
|
|
221
|
-
color: C.shin,
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
bone: 'mixamorigLeftFoot',
|
|
225
|
-
from: 'mixamorigLeftFoot',
|
|
226
|
-
to: 'mixamorigLeftToeBase',
|
|
227
|
-
radius: 0.05,
|
|
228
|
-
group: 'foot',
|
|
229
|
-
proximalBlend: 'mixamorigLeftLeg',
|
|
230
|
-
distalBlend: 'mixamorigLeftToeBase',
|
|
231
|
-
overshootFrom: 0.01,
|
|
232
|
-
color: C.foot,
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
bone: 'mixamorigLeftToeBase',
|
|
236
|
-
from: 'mixamorigLeftToeBase',
|
|
237
|
-
to: 'mixamorigLeftToe_End',
|
|
238
|
-
radius: 0.042,
|
|
239
|
-
group: 'foot',
|
|
240
|
-
proximalBlend: 'mixamorigLeftFoot',
|
|
241
|
-
color: C.toe,
|
|
242
|
-
},
|
|
243
|
-
// Right leg chain.
|
|
244
|
-
{
|
|
245
|
-
bone: 'mixamorigRightUpLeg',
|
|
246
|
-
from: 'mixamorigRightUpLeg',
|
|
247
|
-
to: 'mixamorigRightLeg',
|
|
248
|
-
radius: 0.078,
|
|
249
|
-
group: 'limb',
|
|
250
|
-
proximalBlend: 'mixamorigHips',
|
|
251
|
-
distalBlend: 'mixamorigRightLeg',
|
|
252
|
-
overshootFrom: 0.035,
|
|
253
|
-
overshootTo: 0.01,
|
|
254
|
-
color: C.thigh,
|
|
255
|
-
},
|
|
256
|
-
{
|
|
257
|
-
bone: 'mixamorigRightLeg',
|
|
258
|
-
from: 'mixamorigRightLeg',
|
|
259
|
-
to: 'mixamorigRightFoot',
|
|
260
|
-
radius: 0.058,
|
|
261
|
-
group: 'limb',
|
|
262
|
-
proximalBlend: 'mixamorigRightUpLeg',
|
|
263
|
-
distalBlend: 'mixamorigRightFoot',
|
|
264
|
-
overshootFrom: 0.01,
|
|
265
|
-
overshootTo: 0.01,
|
|
266
|
-
color: C.shin,
|
|
267
|
-
},
|
|
268
|
-
{
|
|
269
|
-
bone: 'mixamorigRightFoot',
|
|
270
|
-
from: 'mixamorigRightFoot',
|
|
271
|
-
to: 'mixamorigRightToeBase',
|
|
272
|
-
radius: 0.05,
|
|
273
|
-
group: 'foot',
|
|
274
|
-
proximalBlend: 'mixamorigRightLeg',
|
|
275
|
-
distalBlend: 'mixamorigRightToeBase',
|
|
276
|
-
overshootFrom: 0.01,
|
|
277
|
-
color: C.foot,
|
|
278
|
-
},
|
|
279
|
-
{
|
|
280
|
-
bone: 'mixamorigRightToeBase',
|
|
281
|
-
from: 'mixamorigRightToeBase',
|
|
282
|
-
to: 'mixamorigRightToe_End',
|
|
283
|
-
radius: 0.042,
|
|
284
|
-
group: 'foot',
|
|
285
|
-
proximalBlend: 'mixamorigRightFoot',
|
|
286
|
-
color: C.toe,
|
|
287
|
-
},
|
|
288
|
-
];
|
|
289
|
-
/** The head capsule's reference radius — `generate.ts` feeds this (× headSize)
|
|
290
|
-
* to the skeleton height normalization as the crown padding. */
|
|
291
|
-
export const HEAD_CAPSULE_RADIUS = SEGMENTS.find((s) => s.bone === 'mixamorigHead')?.radius ?? 0.105;
|
|
292
|
-
export const smoothstep = (x) => {
|
|
293
|
-
const t = Math.min(1, Math.max(0, x));
|
|
294
|
-
return t * t * (3 - 2 * t);
|
|
295
|
-
};
|
|
296
|
-
/** Blend-zone length as a fraction of a segment (≈10 cm at reference scale,
|
|
297
|
-
* clamped to 20–50% of the segment) — shared verbatim by the body generator
|
|
298
|
-
* and `skinToHumanoid` so clothing gets the SAME joint blend as the body. */
|
|
299
|
-
export const blendZone = (len, heightFactor) => Math.min(0.5, Math.max(0.2, (0.1 * heightFactor) / len));
|
|
300
|
-
/** World rest position of a named bone (scene must have updated matrices). */
|
|
301
|
-
function jointPos(rig, name) {
|
|
302
|
-
const bone = rig.byName.get(name);
|
|
303
|
-
if (!bone)
|
|
304
|
-
throw new Error(`humanoid: unknown bone '${name}'`);
|
|
305
|
-
return new THREE.Vector3().setFromMatrixPosition(bone.matrixWorld);
|
|
306
|
-
}
|
|
307
|
-
/** name → skinIndex row, cached per rig (reviewer note: the former O(n)
|
|
308
|
-
* findIndex per call was fine for 22 parts, not for per-prop/per-vertex use). */
|
|
309
|
-
const boneIndexCache = new WeakMap();
|
|
310
|
-
function boneIndex(rig, name) {
|
|
311
|
-
let map = boneIndexCache.get(rig);
|
|
312
|
-
if (!map) {
|
|
313
|
-
map = new Map(rig.bones.map((b, i) => [b.name, i]));
|
|
314
|
-
boneIndexCache.set(rig, map);
|
|
315
|
-
}
|
|
316
|
-
const i = map.get(name);
|
|
317
|
-
if (i === undefined)
|
|
318
|
-
throw new Error(`humanoid: unknown bone '${name}'`);
|
|
319
|
-
return i;
|
|
320
|
-
}
|
|
321
|
-
/** Fill vertex colors with a flat per-part color. */
|
|
322
|
-
function paint(geo, color) {
|
|
323
|
-
const n = geo.attributes['position'].count;
|
|
324
|
-
const c = new THREE.Color(color);
|
|
325
|
-
const arr = new Float32Array(n * 3);
|
|
326
|
-
for (let i = 0; i < n; i++)
|
|
327
|
-
arr.set([c.r, c.g, c.b], i * 3);
|
|
328
|
-
geo.setAttribute('color', new THREE.BufferAttribute(arr, 3));
|
|
329
|
-
}
|
|
330
|
-
/**
|
|
331
|
-
* Compute skinIndex/skinWeight for a segment geometry: per-vertex projection
|
|
332
|
-
* onto the joint axis → smoothstep 2-bone blend inside the end zones. The
|
|
333
|
-
* blend zone length adapts to the segment (≈10 cm at reference scale,
|
|
334
|
-
* clamped to 20–50% of the segment) so short torso links still blend and
|
|
335
|
-
* long thighs stay mostly rigid.
|
|
336
|
-
*/
|
|
337
|
-
function skinSegment(geo, rig, spec, p0, p1, heightFactor) {
|
|
338
|
-
const primary = boneIndex(rig, spec.bone);
|
|
339
|
-
const proximal = spec.proximalBlend ? boneIndex(rig, spec.proximalBlend) : -1;
|
|
340
|
-
const distal = spec.distalBlend ? boneIndex(rig, spec.distalBlend) : -1;
|
|
341
|
-
const axis = p1.clone().sub(p0);
|
|
342
|
-
const len = axis.length();
|
|
343
|
-
const axisN = axis.clone().divideScalar(len);
|
|
344
|
-
const blend = blendZone(len, heightFactor);
|
|
345
|
-
const pos = geo.attributes['position'];
|
|
346
|
-
const n = pos.count;
|
|
347
|
-
const skinIndex = new Uint16Array(n * 4);
|
|
348
|
-
const skinWeight = new Float32Array(n * 4);
|
|
349
|
-
const v = new THREE.Vector3();
|
|
350
|
-
for (let i = 0; i < n; i++) {
|
|
351
|
-
v.fromBufferAttribute(pos, i);
|
|
352
|
-
const t = v.sub(p0).dot(axisN) / len; // may exceed [0,1] via overshoot
|
|
353
|
-
let other = primary;
|
|
354
|
-
let w2 = 0;
|
|
355
|
-
if (proximal >= 0 && t < blend) {
|
|
356
|
-
// 50/50 exactly at (and beyond) the joint, ramping to 100% primary.
|
|
357
|
-
other = proximal;
|
|
358
|
-
w2 = 0.5 * (1 - smoothstep(t / blend));
|
|
359
|
-
}
|
|
360
|
-
else if (distal >= 0 && t > 1 - blend) {
|
|
361
|
-
other = distal;
|
|
362
|
-
w2 = 0.5 * smoothstep((t - (1 - blend)) / blend);
|
|
363
|
-
}
|
|
364
|
-
skinIndex.set([primary, other, 0, 0], i * 4);
|
|
365
|
-
skinWeight.set([1 - w2, w2, 0, 0], i * 4);
|
|
366
|
-
}
|
|
367
|
-
geo.setAttribute('skinIndex', new THREE.BufferAttribute(skinIndex, 4));
|
|
368
|
-
geo.setAttribute('skinWeight', new THREE.BufferAttribute(skinWeight, 4));
|
|
369
|
-
}
|
|
370
|
-
/** Capsule spanning exactly `p0 - dir*overshootFrom` → `p1 + dir*overshootTo`. */
|
|
371
|
-
function capsuleBetween(p0, p1, radius, overshootFrom, overshootTo) {
|
|
372
|
-
const dir = p1.clone().sub(p0).normalize();
|
|
373
|
-
const a = p0.clone().addScaledVector(dir, -overshootFrom);
|
|
374
|
-
const b = p1.clone().addScaledVector(dir, overshootTo);
|
|
375
|
-
const span = a.distanceTo(b);
|
|
376
|
-
const cyl = Math.max(0.01, span - 2 * radius);
|
|
377
|
-
const geo = new THREE.CapsuleGeometry(radius, cyl, 6, 16);
|
|
378
|
-
geo.deleteAttribute('uv'); // untextured; keeps merged attribute sets identical
|
|
379
|
-
const quat = new THREE.Quaternion().setFromUnitVectors(new THREE.Vector3(0, 1, 0), dir);
|
|
380
|
-
const mid = a.clone().add(b).multiplyScalar(0.5);
|
|
381
|
-
geo.applyMatrix4(new THREE.Matrix4().compose(mid, quat, new THREE.Vector3(1, 1, 1)));
|
|
382
|
-
return geo;
|
|
383
|
-
}
|
|
384
|
-
/** The pelvis is the one non-capsule part: a box centred between the hips
|
|
385
|
-
* and the upper-leg roots, rigidly bound to `mixamorigHips` (the thigh
|
|
386
|
-
* capsules overshoot up into it and carry the blending). */
|
|
387
|
-
function buildPelvis(rig, dims) {
|
|
388
|
-
const hips = jointPos(rig, 'mixamorigHips');
|
|
389
|
-
const upL = jointPos(rig, 'mixamorigLeftUpLeg');
|
|
390
|
-
const upR = jointPos(rig, 'mixamorigRightUpLeg');
|
|
391
|
-
const centerY = (hips.y + (upL.y + upR.y) / 2) / 2;
|
|
392
|
-
const f = dims.heightFactor;
|
|
393
|
-
const geo = new THREE.BoxGeometry(0.3 * f * dims.hipWidth, 0.17 * f, 0.19 * f * dims.torsoGirth, 2, 2, 2);
|
|
394
|
-
geo.deleteAttribute('uv');
|
|
395
|
-
geo.translate(hips.x, centerY, hips.z);
|
|
396
|
-
paint(geo, C.pelvis);
|
|
397
|
-
const hipsIndex = boneIndex(rig, 'mixamorigHips');
|
|
398
|
-
const n = geo.attributes['position'].count;
|
|
399
|
-
const skinIndex = new Uint16Array(n * 4);
|
|
400
|
-
const skinWeight = new Float32Array(n * 4);
|
|
401
|
-
for (let i = 0; i < n; i++) {
|
|
402
|
-
skinIndex[i * 4] = hipsIndex;
|
|
403
|
-
skinWeight[i * 4] = 1;
|
|
404
|
-
}
|
|
405
|
-
geo.setAttribute('skinIndex', new THREE.BufferAttribute(skinIndex, 4));
|
|
406
|
-
geo.setAttribute('skinWeight', new THREE.BufferAttribute(skinWeight, 4));
|
|
407
|
-
return geo;
|
|
408
|
-
}
|
|
409
|
-
function radiusMultiplier(group, dims) {
|
|
410
|
-
switch (group) {
|
|
411
|
-
case 'torso':
|
|
412
|
-
return dims.torsoGirth;
|
|
413
|
-
case 'limb':
|
|
414
|
-
return dims.limbThickness;
|
|
415
|
-
case 'head':
|
|
416
|
-
return dims.headSize;
|
|
417
|
-
case 'foot':
|
|
418
|
-
return 1;
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
/**
|
|
422
|
-
* Build the whole body as ONE merged `SkinnedMesh` in the rig root's space
|
|
423
|
-
* (the skeleton's rest pose), and bind it. Callers must have called
|
|
424
|
-
* `updateMatrixWorld(true)` on the armature's parent after adding the bone
|
|
425
|
-
* hierarchy, so every bone's `matrixWorld` is its rest pose —
|
|
426
|
-
* `new THREE.Skeleton(bones)` captures the inverse bind matrices from
|
|
427
|
-
* exactly those.
|
|
428
|
-
*/
|
|
429
|
-
export function buildHumanoidBody(rig, dims, material) {
|
|
430
|
-
const geos = [buildPelvis(rig, dims)];
|
|
431
|
-
const parts = [];
|
|
432
|
-
let vertexCursor = geos[0].attributes['position'].count;
|
|
433
|
-
parts.push({
|
|
434
|
-
name: 'pelvis',
|
|
435
|
-
boneIndices: [boneIndex(rig, 'mixamorigHips')],
|
|
436
|
-
vertexStart: 0,
|
|
437
|
-
vertexCount: vertexCursor,
|
|
438
|
-
});
|
|
439
|
-
const f = dims.heightFactor;
|
|
440
|
-
for (const spec of SEGMENTS) {
|
|
441
|
-
const p0 = jointPos(rig, spec.from);
|
|
442
|
-
const p1 = jointPos(rig, spec.to);
|
|
443
|
-
const radius = spec.radius * f * radiusMultiplier(spec.group, dims);
|
|
444
|
-
const geo = capsuleBetween(p0, p1, radius, (spec.overshootFrom ?? 0) * f, (spec.overshootTo ?? 0) * f);
|
|
445
|
-
paint(geo, spec.color);
|
|
446
|
-
skinSegment(geo, rig, spec, p0, p1, f);
|
|
447
|
-
const count = geo.attributes['position'].count;
|
|
448
|
-
const boneIndices = [boneIndex(rig, spec.bone)];
|
|
449
|
-
if (spec.proximalBlend)
|
|
450
|
-
boneIndices.push(boneIndex(rig, spec.proximalBlend));
|
|
451
|
-
if (spec.distalBlend)
|
|
452
|
-
boneIndices.push(boneIndex(rig, spec.distalBlend));
|
|
453
|
-
parts.push({ name: spec.bone, boneIndices, vertexStart: vertexCursor, vertexCount: count });
|
|
454
|
-
vertexCursor += count;
|
|
455
|
-
geos.push(geo);
|
|
456
|
-
}
|
|
457
|
-
const merged = mergeGeometries(geos, false);
|
|
458
|
-
if (!merged)
|
|
459
|
-
throw new Error('humanoid: mergeGeometries failed');
|
|
460
|
-
for (const g of geos)
|
|
461
|
-
g.dispose();
|
|
462
|
-
const mat = material ??
|
|
463
|
-
new THREE.MeshStandardMaterial({
|
|
464
|
-
vertexColors: true,
|
|
465
|
-
roughness: 0.75,
|
|
466
|
-
metalness: 0.05,
|
|
467
|
-
});
|
|
468
|
-
const mesh = new THREE.SkinnedMesh(merged, mat);
|
|
469
|
-
mesh.name = 'ProceduralHumanoidBody';
|
|
470
|
-
mesh.castShadow = true;
|
|
471
|
-
// An animated skinned mesh moves far outside its static rest-pose bounds.
|
|
472
|
-
mesh.frustumCulled = false;
|
|
473
|
-
const skeleton = new THREE.Skeleton(rig.bones);
|
|
474
|
-
mesh.updateMatrixWorld(true);
|
|
475
|
-
mesh.bind(skeleton, mesh.matrixWorld.clone());
|
|
476
|
-
return {
|
|
477
|
-
mesh,
|
|
478
|
-
skeleton,
|
|
479
|
-
vertexCount: merged.attributes['position'].count,
|
|
480
|
-
parts,
|
|
481
|
-
};
|
|
482
|
-
}
|
|
483
|
-
/**
|
|
484
|
-
* Resolve the body's segment map (plus one synthetic rigid pelvis segment —
|
|
485
|
-
* the pelvis box binds 100% to Hips, and belts/skirts must get the same
|
|
486
|
-
* anchor to stay congruent with it) against a concrete rest pose.
|
|
487
|
-
* Parameterized on lookups rather than `BuiltSkeleton` because the compose
|
|
488
|
-
* path recovers rest joints from `Skeleton.boneInverses` (bones may be
|
|
489
|
-
* mid-animation by then), while the generator reads live rest matrices.
|
|
490
|
-
* `jointAt` must return a FRESH Vector3 per call (results are mutated here).
|
|
491
|
-
*/
|
|
492
|
-
export function computeBindingSegments(jointAt, indexOf, dims) {
|
|
493
|
-
const f = dims.heightFactor;
|
|
494
|
-
const segments = [];
|
|
495
|
-
// Axis LATERALLY along the hip-to-hip line (not hips→legs): a capsule
|
|
496
|
-
// there is the closest round proxy for the pelvis box, and — unlike a
|
|
497
|
-
// short vertical axis with a wide radius — it does not bulge spherically
|
|
498
|
-
// down between the thighs and steal inner-thigh vertices from the legs.
|
|
499
|
-
const upLegL = jointAt('mixamorigLeftUpLeg');
|
|
500
|
-
const upLegR = jointAt('mixamorigRightUpLeg');
|
|
501
|
-
const pelvisAxis = upLegR.clone().sub(upLegL);
|
|
502
|
-
const pelvisLen = Math.max(pelvisAxis.length(), 1e-6);
|
|
503
|
-
segments.push({
|
|
504
|
-
bone: indexOf('mixamorigHips'),
|
|
505
|
-
proximal: -1,
|
|
506
|
-
distal: -1,
|
|
507
|
-
p0: upLegL,
|
|
508
|
-
axis: pelvisAxis.divideScalar(pelvisLen),
|
|
509
|
-
len: pelvisLen,
|
|
510
|
-
blend: 0,
|
|
511
|
-
radius: 0.1 * f * dims.hipWidth,
|
|
512
|
-
});
|
|
513
|
-
for (const spec of SEGMENTS) {
|
|
514
|
-
const p0 = jointAt(spec.from);
|
|
515
|
-
const p1 = jointAt(spec.to);
|
|
516
|
-
const axis = p1.sub(p0);
|
|
517
|
-
const len = Math.max(axis.length(), 1e-6);
|
|
518
|
-
segments.push({
|
|
519
|
-
bone: indexOf(spec.bone),
|
|
520
|
-
proximal: spec.proximalBlend ? indexOf(spec.proximalBlend) : -1,
|
|
521
|
-
distal: spec.distalBlend ? indexOf(spec.distalBlend) : -1,
|
|
522
|
-
p0,
|
|
523
|
-
axis: axis.divideScalar(len),
|
|
524
|
-
len,
|
|
525
|
-
blend: blendZone(len, f),
|
|
526
|
-
radius: spec.radius * f * radiusMultiplier(spec.group, dims),
|
|
527
|
-
});
|
|
528
|
-
}
|
|
529
|
-
return segments;
|
|
530
|
-
}
|
package/dist/humanoid/clips.d.ts
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Standard-clip playback for generated humanoids: map Mixamo-named
|
|
3
|
-
* `AnimationClip`s (from any GLB/FBX-derived source) onto the engine's
|
|
4
|
-
* standard skeleton, across naming variants, with the translation-track
|
|
5
|
-
* policy body-type rescaling requires.
|
|
6
|
-
*
|
|
7
|
-
* TRANSLATION-TRACK POLICY (the reviewer-flagged trap, documented choice):
|
|
8
|
-
* humanoid clips carry per-bone `.position` tracks baked for the SOURCE
|
|
9
|
-
* rig's segment lengths — played raw on a rescaled skeleton they snap limb
|
|
10
|
-
* proportions back to the source's. `retargetClipToHumanoid` therefore
|
|
11
|
-
* - DROPS every non-hips `.position` track (bones keep the generated
|
|
12
|
-
* rig's rest translations — segment lengths come from the body params),
|
|
13
|
-
* - KEEPS the hips `.position` track but multiplies it by the rig's
|
|
14
|
-
* `hipsPositionScale` (root motion / bob authored for the reference
|
|
15
|
-
* hip height lands at the generated hip height),
|
|
16
|
-
* - DROPS `.scale` tracks (rest scale is always 1), and
|
|
17
|
-
* - KEEPS every `.quaternion` track verbatim — rotations are
|
|
18
|
-
* proportion-independent, which is the whole point of a shared rest
|
|
19
|
-
* pose. This is the standard humanoid-retarget policy (the alternative,
|
|
20
|
-
* per-bone translation rescale, buys nothing for rigid capsule bodies
|
|
21
|
-
* and reintroduces per-bone coupling).
|
|
22
|
-
*
|
|
23
|
-
* NAME VARIANTS: track node names resolve across the three spellings in the
|
|
24
|
-
* wild — sanitized `mixamorigHips` (what GLTFLoader yields), raw
|
|
25
|
-
* `mixamorig:Hips` / `mixamorig_Hips` (FBX-side exports), and bare `Hips`
|
|
26
|
-
* (renamed rigs). A track whose node cannot be resolved to a standard bone
|
|
27
|
-
* — or whose property is not a bone TRS channel — is collected, and
|
|
28
|
-
* `retargetClipToHumanoid` throws ONE hard error listing every unresolved
|
|
29
|
-
* track (degrade loudly, never a silently-frozen limb).
|
|
30
|
-
*/
|
|
31
|
-
import * as THREE from 'three';
|
|
32
|
-
/** What retargeting needs to know about a generated rig — `HumanoidRig`
|
|
33
|
-
* satisfies this structurally. */
|
|
34
|
-
export interface HumanoidClipTarget {
|
|
35
|
-
/** Bone lookup by canonical (sanitized-Mixamo) name. */
|
|
36
|
-
bonesByName: ReadonlyMap<string, THREE.Bone>;
|
|
37
|
-
/** Hips-height ratio vs the reference rig (see `ScaledSkeletonDef`). */
|
|
38
|
-
hipsPositionScale: number;
|
|
39
|
-
}
|
|
40
|
-
/** Resolve a clip-track node name to a canonical bone name, or null. */
|
|
41
|
-
export declare function resolveHumanoidBoneName(nodeName: string, bonesByName: ReadonlyMap<string, THREE.Bone>): string | null;
|
|
42
|
-
/**
|
|
43
|
-
* Rebuild `clip` for a generated humanoid: node names canonicalized, the
|
|
44
|
-
* translation policy above applied. The input clip is never mutated. Throws
|
|
45
|
-
* (listing every offender) if any track fails to resolve to a standard bone
|
|
46
|
-
* TRS channel.
|
|
47
|
-
*/
|
|
48
|
-
export declare function retargetClipToHumanoid(clip: THREE.AnimationClip, target: HumanoidClipTarget): THREE.AnimationClip;
|
|
49
|
-
/**
|
|
50
|
-
* Build a name → clip library from a loaded GLB's `animations` array —
|
|
51
|
-
* `buildClipMap` semantics (exact names, case-insensitive lookup,
|
|
52
|
-
* armature-prefix stripping, `walking`→`walk`-style aliases), plus a
|
|
53
|
-
* loud getter.
|
|
54
|
-
*/
|
|
55
|
-
export declare function createHumanoidClipLibrary(animations: THREE.AnimationClip[], aliases?: Record<string, string>): HumanoidClipLibrary;
|
|
56
|
-
export interface HumanoidClipLibrary {
|
|
57
|
-
/** The full lookup map (exact + lowercase + aliased names). */
|
|
58
|
-
clips: ReadonlyMap<string, THREE.AnimationClip>;
|
|
59
|
-
/** Resolve a clip by name — throws listing available clips if absent. */
|
|
60
|
-
get(name: string): THREE.AnimationClip;
|
|
61
|
-
}
|
|
62
|
-
//# sourceMappingURL=clips.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clips.d.ts","sourceRoot":"","sources":["../../src/humanoid/clips.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B;mCACmC;AACnC,MAAM,WAAW,kBAAkB;IACjC,wDAAwD;IACxD,WAAW,EAAE,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7C,wEAAwE;IACxE,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,wEAAwE;AACxE,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,GAC3C,MAAM,GAAG,IAAI,CAUf;AAgCD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,KAAK,CAAC,aAAa,EACzB,MAAM,EAAE,kBAAkB,GACzB,KAAK,CAAC,aAAa,CAkBrB;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,KAAK,CAAC,aAAa,EAAE,EACjC,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GACnC,mBAAmB,CAarB;AAED,MAAM,WAAW,mBAAmB;IAClC,+DAA+D;IAC/D,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;IAChD,yEAAyE;IACzE,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,aAAa,CAAC;CACxC"}
|