@clockgrove/assetgrove 0.0.0-stage → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +277 -2
- package/dist/animation/commands.d.ts +180 -0
- package/dist/animation/commands.js +515 -0
- package/dist/animation/facing.d.ts +44 -0
- package/dist/animation/facing.js +100 -0
- package/dist/animation/fix.d.ts +136 -0
- package/dist/animation/fix.js +529 -0
- package/dist/animation/flicker.d.ts +44 -0
- package/dist/animation/flicker.js +117 -0
- package/dist/animation/halo.d.ts +72 -0
- package/dist/animation/halo.js +253 -0
- package/dist/animation/holes.d.ts +122 -0
- package/dist/animation/holes.js +262 -0
- package/dist/animation/preview.d.ts +38 -0
- package/dist/animation/preview.js +161 -0
- package/dist/animation/qa.d.ts +57 -0
- package/dist/animation/qa.js +418 -0
- package/dist/animation/run.d.ts +109 -0
- package/dist/animation/run.js +182 -0
- package/dist/animation/strip.d.ts +13 -0
- package/dist/animation/strip.js +41 -0
- package/dist/animation/template-choice.d.ts +75 -0
- package/dist/animation/template-choice.js +153 -0
- package/dist/animation/templates.d.ts +39 -0
- package/dist/animation/templates.js +333 -0
- package/dist/animation/types.d.ts +257 -0
- package/dist/animation/types.js +1 -0
- package/dist/approvals.d.ts +156 -0
- package/dist/approvals.js +369 -0
- package/dist/audio/aac.d.ts +61 -0
- package/dist/audio/aac.js +152 -0
- package/dist/audio/checks.d.ts +38 -0
- package/dist/audio/checks.js +254 -0
- package/dist/audio/delivery.d.ts +52 -0
- package/dist/audio/delivery.js +105 -0
- package/dist/audio/engine.d.ts +65 -0
- package/dist/audio/engine.js +164 -0
- package/dist/audio/handoff.d.ts +75 -0
- package/dist/audio/handoff.js +185 -0
- package/dist/audio/kinds.d.ts +6 -0
- package/dist/audio/kinds.js +315 -0
- package/dist/audio/loudness.d.ts +22 -0
- package/dist/audio/loudness.js +72 -0
- package/dist/audio/ogg.d.ts +27 -0
- package/dist/audio/ogg.js +65 -0
- package/dist/audio/operations.d.ts +20 -0
- package/dist/audio/operations.js +335 -0
- package/dist/audio/opus.d.ts +40 -0
- package/dist/audio/opus.js +108 -0
- package/dist/audio/profile.d.ts +200 -0
- package/dist/audio/profile.js +126 -0
- package/dist/audio/run.d.ts +83 -0
- package/dist/audio/run.js +192 -0
- package/dist/audio/vorbis-comments.d.ts +25 -0
- package/dist/audio/vorbis-comments.js +243 -0
- package/dist/audio/waveform.d.ts +13 -0
- package/dist/audio/waveform.js +52 -0
- package/dist/audio-parameters.d.ts +17 -0
- package/dist/audio-parameters.js +45 -0
- package/dist/audit/bar.d.ts +65 -0
- package/dist/audit/bar.js +97 -0
- package/dist/audit/members.d.ts +40 -0
- package/dist/audit/members.js +119 -0
- package/dist/bible-view.d.ts +10 -0
- package/dist/bible-view.js +122 -0
- package/dist/bible.d.ts +272 -0
- package/dist/bible.js +641 -0
- package/dist/budget.d.ts +119 -0
- package/dist/budget.js +227 -0
- package/dist/call-parameters.d.ts +71 -0
- package/dist/call-parameters.js +90 -0
- package/dist/calls.d.ts +145 -0
- package/dist/calls.js +788 -0
- package/dist/cli/main.d.ts +22 -0
- package/dist/cli/main.js +137 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +5 -0
- package/dist/commands/animation-qa.d.ts +1 -0
- package/dist/commands/animation-qa.js +240 -0
- package/dist/commands/apply.d.ts +12 -0
- package/dist/commands/apply.js +181 -0
- package/dist/commands/audit.d.ts +92 -0
- package/dist/commands/audit.js +555 -0
- package/dist/commands/bible.d.ts +1 -0
- package/dist/commands/bible.js +39 -0
- package/dist/commands/browse.d.ts +12 -0
- package/dist/commands/browse.js +113 -0
- package/dist/commands/card.d.ts +3 -0
- package/dist/commands/card.js +445 -0
- package/dist/commands/compare.d.ts +1 -0
- package/dist/commands/compare.js +90 -0
- package/dist/commands/confirm.d.ts +1 -0
- package/dist/commands/confirm.js +267 -0
- package/dist/commands/context.d.ts +43 -0
- package/dist/commands/context.js +115 -0
- package/dist/commands/deliver.d.ts +1 -0
- package/dist/commands/deliver.js +99 -0
- package/dist/commands/disclosure.d.ts +1 -0
- package/dist/commands/disclosure.js +80 -0
- package/dist/commands/doctor.d.ts +1 -0
- package/dist/commands/doctor.js +112 -0
- package/dist/commands/estimate.d.ts +2 -0
- package/dist/commands/estimate.js +80 -0
- package/dist/commands/extensions.d.ts +2 -0
- package/dist/commands/extensions.js +70 -0
- package/dist/commands/fix-frame.d.ts +1 -0
- package/dist/commands/fix-frame.js +206 -0
- package/dist/commands/generate-sheet.d.ts +1 -0
- package/dist/commands/generate-sheet.js +245 -0
- package/dist/commands/identity-check.d.ts +1 -0
- package/dist/commands/identity-check.js +110 -0
- package/dist/commands/identity-eval.d.ts +1 -0
- package/dist/commands/identity-eval.js +197 -0
- package/dist/commands/import.d.ts +7 -0
- package/dist/commands/import.js +472 -0
- package/dist/commands/init.d.ts +1 -0
- package/dist/commands/init.js +117 -0
- package/dist/commands/intake.d.ts +1 -0
- package/dist/commands/intake.js +56 -0
- package/dist/commands/labels.d.ts +1 -0
- package/dist/commands/labels.js +101 -0
- package/dist/commands/library.d.ts +9 -0
- package/dist/commands/library.js +711 -0
- package/dist/commands/lod.d.ts +1 -0
- package/dist/commands/lod.js +93 -0
- package/dist/commands/look-dev.d.ts +1 -0
- package/dist/commands/look-dev.js +148 -0
- package/dist/commands/materials.d.ts +1 -0
- package/dist/commands/materials.js +223 -0
- package/dist/commands/mcp.d.ts +1 -0
- package/dist/commands/mcp.js +53 -0
- package/dist/commands/migrate.d.ts +1 -0
- package/dist/commands/migrate.js +123 -0
- package/dist/commands/op.d.ts +5 -0
- package/dist/commands/op.js +114 -0
- package/dist/commands/ops.d.ts +1 -0
- package/dist/commands/ops.js +17 -0
- package/dist/commands/pick-batch.d.ts +24 -0
- package/dist/commands/pick-batch.js +343 -0
- package/dist/commands/pick.d.ts +48 -0
- package/dist/commands/pick.js +469 -0
- package/dist/commands/plan.d.ts +3 -0
- package/dist/commands/plan.js +156 -0
- package/dist/commands/recipe.d.ts +1 -0
- package/dist/commands/recipe.js +52 -0
- package/dist/commands/registry.d.ts +5 -0
- package/dist/commands/registry.js +121 -0
- package/dist/commands/render-sprite.d.ts +1 -0
- package/dist/commands/render-sprite.js +67 -0
- package/dist/commands/rendition.d.ts +1 -0
- package/dist/commands/rendition.js +56 -0
- package/dist/commands/request-change.d.ts +2 -0
- package/dist/commands/request-change.js +950 -0
- package/dist/commands/result.d.ts +34 -0
- package/dist/commands/result.js +237 -0
- package/dist/commands/review.d.ts +28 -0
- package/dist/commands/review.js +444 -0
- package/dist/commands/rig.d.ts +1 -0
- package/dist/commands/rig.js +74 -0
- package/dist/commands/runner.d.ts +45 -0
- package/dist/commands/runner.js +297 -0
- package/dist/commands/runs.d.ts +22 -0
- package/dist/commands/runs.js +159 -0
- package/dist/commands/search.d.ts +69 -0
- package/dist/commands/search.js +638 -0
- package/dist/commands/settings.d.ts +2 -0
- package/dist/commands/settings.js +284 -0
- package/dist/commands/spend.d.ts +2 -0
- package/dist/commands/spend.js +159 -0
- package/dist/commands/stage-source.d.ts +1 -0
- package/dist/commands/stage-source.js +58 -0
- package/dist/commands/stage.d.ts +9 -0
- package/dist/commands/stage.js +229 -0
- package/dist/commands/storage.d.ts +3 -0
- package/dist/commands/storage.js +200 -0
- package/dist/commands/turnaround.d.ts +1 -0
- package/dist/commands/turnaround.js +171 -0
- package/dist/commands/types.d.ts +195 -0
- package/dist/commands/types.js +7 -0
- package/dist/commands/vary.d.ts +2 -0
- package/dist/commands/vary.js +222 -0
- package/dist/commands/write-families.d.ts +14 -0
- package/dist/commands/write-families.js +158 -0
- package/dist/compare.d.ts +87 -0
- package/dist/compare.js +306 -0
- package/dist/confirm/delegation.d.ts +30 -0
- package/dist/confirm/delegation.js +31 -0
- package/dist/confirm/index.d.ts +84 -0
- package/dist/confirm/index.js +176 -0
- package/dist/confirm/mcp.d.ts +60 -0
- package/dist/confirm/mcp.js +253 -0
- package/dist/confirm/pending.d.ts +11 -0
- package/dist/confirm/pending.js +40 -0
- package/dist/confirm/prompt.d.ts +65 -0
- package/dist/confirm/prompt.js +68 -0
- package/dist/confirm/records.d.ts +17 -0
- package/dist/confirm/records.js +63 -0
- package/dist/contact.d.ts +80 -0
- package/dist/contact.js +224 -0
- package/dist/credentials.d.ts +170 -0
- package/dist/credentials.js +598 -0
- package/dist/dataflows.d.ts +32 -0
- package/dist/dataflows.js +42 -0
- package/dist/delivery.d.ts +89 -0
- package/dist/delivery.js +355 -0
- package/dist/disclosure.d.ts +84 -0
- package/dist/disclosure.js +397 -0
- package/dist/env.d.ts +90 -0
- package/dist/env.js +236 -0
- package/dist/errors.d.ts +90 -0
- package/dist/errors.js +105 -0
- package/dist/extension/api.d.ts +389 -0
- package/dist/extension/api.js +20 -0
- package/dist/extension/context.d.ts +9 -0
- package/dist/extension/context.js +60 -0
- package/dist/extension/helpers.d.ts +75 -0
- package/dist/extension/helpers.js +107 -0
- package/dist/extension/http.d.ts +32 -0
- package/dist/extension/http.js +104 -0
- package/dist/extension/setup.d.ts +53 -0
- package/dist/extension/setup.js +162 -0
- package/dist/extension/tools.d.ts +97 -0
- package/dist/extension/tools.js +235 -0
- package/dist/extensions/core.d.ts +7 -0
- package/dist/extensions/core.js +18 -0
- package/dist/extensions/errors.d.ts +22 -0
- package/dist/extensions/errors.js +34 -0
- package/dist/extensions/registry.d.ts +119 -0
- package/dist/extensions/registry.js +535 -0
- package/dist/extensions/version.d.ts +9 -0
- package/dist/extensions/version.js +57 -0
- package/dist/formats.d.ts +46 -0
- package/dist/formats.js +81 -0
- package/dist/frames.d.ts +58 -0
- package/dist/frames.js +80 -0
- package/dist/gateway/anthropic.d.ts +22 -0
- package/dist/gateway/anthropic.js +65 -0
- package/dist/gateway/elevenlabs.d.ts +36 -0
- package/dist/gateway/elevenlabs.js +192 -0
- package/dist/gateway/failure.d.ts +29 -0
- package/dist/gateway/failure.js +70 -0
- package/dist/gateway/openai-compatible.d.ts +20 -0
- package/dist/gateway/openai-compatible.js +76 -0
- package/dist/gateway/openai.d.ts +28 -0
- package/dist/gateway/openai.js +101 -0
- package/dist/gateway/provider.d.ts +380 -0
- package/dist/gateway/provider.js +5 -0
- package/dist/gateway/scripted.d.ts +252 -0
- package/dist/gateway/scripted.js +244 -0
- package/dist/gateway/stability.d.ts +38 -0
- package/dist/gateway/stability.js +232 -0
- package/dist/gateway/structured.d.ts +31 -0
- package/dist/gateway/structured.js +83 -0
- package/dist/gateway/tripo.d.ts +48 -0
- package/dist/gateway/tripo.js +374 -0
- package/dist/gateway/vercel.d.ts +52 -0
- package/dist/gateway/vercel.js +298 -0
- package/dist/generators/generator.d.ts +236 -0
- package/dist/generators/generator.js +12 -0
- package/dist/generators/image.d.ts +21 -0
- package/dist/generators/image.js +286 -0
- package/dist/generators/spec-schema.d.ts +29 -0
- package/dist/generators/spec-schema.js +21 -0
- package/dist/git-marker.d.ts +3 -0
- package/dist/git-marker.js +13 -0
- package/dist/gitlfs.d.ts +38 -0
- package/dist/gitlfs.js +171 -0
- package/dist/guard.d.ts +55 -0
- package/dist/guard.js +323 -0
- package/dist/handoff/current-profile.d.ts +48 -0
- package/dist/handoff/current-profile.js +127 -0
- package/dist/handoff/doctor.d.ts +26 -0
- package/dist/handoff/doctor.js +249 -0
- package/dist/handoff/mark-check.d.ts +17 -0
- package/dist/handoff/mark-check.js +66 -0
- package/dist/handoff/presets/aseprite-json.d.ts +5 -0
- package/dist/handoff/presets/aseprite-json.js +45 -0
- package/dist/handoff/presets/atlas-json.d.ts +44 -0
- package/dist/handoff/presets/atlas-json.js +195 -0
- package/dist/handoff/presets/atlas-pack.d.ts +14 -0
- package/dist/handoff/presets/atlas-pack.js +431 -0
- package/dist/handoff/presets/index.d.ts +273 -0
- package/dist/handoff/presets/index.js +58 -0
- package/dist/handoff/presets/manifest.d.ts +2 -0
- package/dist/handoff/presets/manifest.js +49 -0
- package/dist/handoff/usage.d.ts +27 -0
- package/dist/handoff/usage.js +159 -0
- package/dist/handoff.d.ts +345 -0
- package/dist/handoff.js +1221 -0
- package/dist/identity-eval.d.ts +156 -0
- package/dist/identity-eval.js +321 -0
- package/dist/identity.d.ts +293 -0
- package/dist/identity.js +675 -0
- package/dist/image/apply-style.d.ts +4 -0
- package/dist/image/apply-style.js +37 -0
- package/dist/image/digits.d.ts +5 -0
- package/dist/image/digits.js +40 -0
- package/dist/image/ktx2.d.ts +83 -0
- package/dist/image/ktx2.js +196 -0
- package/dist/image/raster.d.ts +23 -0
- package/dist/image/raster.js +77 -0
- package/dist/image/resample.d.ts +10 -0
- package/dist/image/resample.js +82 -0
- package/dist/image/webp.d.ts +17 -0
- package/dist/image/webp.js +323 -0
- package/dist/init.d.ts +132 -0
- package/dist/init.js +425 -0
- package/dist/inputs.d.ts +67 -0
- package/dist/inputs.js +151 -0
- package/dist/json.d.ts +7 -0
- package/dist/json.js +27 -0
- package/dist/keys.d.ts +34 -0
- package/dist/keys.js +198 -0
- package/dist/kind-schemas.d.ts +17 -0
- package/dist/kind-schemas.js +205 -0
- package/dist/library/actions.d.ts +76 -0
- package/dist/library/actions.js +212 -0
- package/dist/library/adopt.d.ts +177 -0
- package/dist/library/adopt.js +624 -0
- package/dist/library/canonical.d.ts +7 -0
- package/dist/library/canonical.js +29 -0
- package/dist/library/card.d.ts +138 -0
- package/dist/library/card.js +532 -0
- package/dist/library/credits.d.ts +70 -0
- package/dist/library/credits.js +222 -0
- package/dist/library/describe.d.ts +48 -0
- package/dist/library/describe.js +199 -0
- package/dist/library/diff.d.ts +26 -0
- package/dist/library/diff.js +208 -0
- package/dist/library/exact.d.ts +15 -0
- package/dist/library/exact.js +47 -0
- package/dist/library/extent.d.ts +56 -0
- package/dist/library/extent.js +205 -0
- package/dist/library/folder.d.ts +85 -0
- package/dist/library/folder.js +291 -0
- package/dist/library/labels.d.ts +29 -0
- package/dist/library/labels.js +112 -0
- package/dist/library/lfs.d.ts +42 -0
- package/dist/library/lfs.js +140 -0
- package/dist/library/maintain.d.ts +100 -0
- package/dist/library/maintain.js +750 -0
- package/dist/library/media-metadata.d.ts +19 -0
- package/dist/library/media-metadata.js +92 -0
- package/dist/library/paths.d.ts +7 -0
- package/dist/library/paths.js +65 -0
- package/dist/library/relations.d.ts +59 -0
- package/dist/library/relations.js +176 -0
- package/dist/library/review.d.ts +204 -0
- package/dist/library/review.js +545 -0
- package/dist/library/stale.d.ts +88 -0
- package/dist/library/stale.js +229 -0
- package/dist/library/suggestions.d.ts +37 -0
- package/dist/library/suggestions.js +146 -0
- package/dist/library/summary.d.ts +65 -0
- package/dist/library/summary.js +138 -0
- package/dist/library/undo.d.ts +18 -0
- package/dist/library/undo.js +141 -0
- package/dist/library/worklist.d.ts +42 -0
- package/dist/library/worklist.js +91 -0
- package/dist/library/write.d.ts +282 -0
- package/dist/library/write.js +790 -0
- package/dist/license.d.ts +67 -0
- package/dist/license.js +205 -0
- package/dist/limits.d.ts +51 -0
- package/dist/limits.js +100 -0
- package/dist/loop.d.ts +244 -0
- package/dist/loop.js +377 -0
- package/dist/material/core.d.ts +70 -0
- package/dist/material/core.js +238 -0
- package/dist/material/engine.d.ts +15 -0
- package/dist/material/engine.js +141 -0
- package/dist/material/flicker.d.ts +26 -0
- package/dist/material/flicker.js +71 -0
- package/dist/material/operations.d.ts +2 -0
- package/dist/material/operations.js +48 -0
- package/dist/material/pipeline.d.ts +51 -0
- package/dist/material/pipeline.js +431 -0
- package/dist/material/profile.d.ts +29 -0
- package/dist/material/profile.js +97 -0
- package/dist/material/rendition.d.ts +5 -0
- package/dist/material/rendition.js +76 -0
- package/dist/mcp.d.ts +72 -0
- package/dist/mcp.js +514 -0
- package/dist/media.d.ts +36 -0
- package/dist/media.js +46 -0
- package/dist/metadata.d.ts +61 -0
- package/dist/metadata.js +748 -0
- package/dist/model-declarations.d.ts +28 -0
- package/dist/model-declarations.js +14 -0
- package/dist/model3d/clip-map.d.ts +49 -0
- package/dist/model3d/clip-map.js +129 -0
- package/dist/model3d/core-checks.d.ts +61 -0
- package/dist/model3d/core-checks.js +278 -0
- package/dist/model3d/facing.d.ts +49 -0
- package/dist/model3d/facing.js +125 -0
- package/dist/model3d/generator.d.ts +19 -0
- package/dist/model3d/generator.js +482 -0
- package/dist/model3d/glb.d.ts +120 -0
- package/dist/model3d/glb.js +155 -0
- package/dist/model3d/handoff.d.ts +37 -0
- package/dist/model3d/handoff.js +131 -0
- package/dist/model3d/lod/chain.d.ts +50 -0
- package/dist/model3d/lod/chain.js +447 -0
- package/dist/model3d/lod/command.d.ts +38 -0
- package/dist/model3d/lod/command.js +377 -0
- package/dist/model3d/lod/qa.d.ts +36 -0
- package/dist/model3d/lod/qa.js +189 -0
- package/dist/model3d/lod/settings.d.ts +36 -0
- package/dist/model3d/lod/settings.js +137 -0
- package/dist/model3d/lod/simplify.d.ts +35 -0
- package/dist/model3d/lod/simplify.js +337 -0
- package/dist/model3d/lod/textures.d.ts +46 -0
- package/dist/model3d/lod/textures.js +190 -0
- package/dist/model3d/lookdev/command.d.ts +219 -0
- package/dist/model3d/lookdev/command.js +1795 -0
- package/dist/model3d/lookdev/edit.d.ts +44 -0
- package/dist/model3d/lookdev/edit.js +241 -0
- package/dist/model3d/lookdev/groom.d.ts +86 -0
- package/dist/model3d/lookdev/groom.js +462 -0
- package/dist/model3d/lookdev/markings.d.ts +98 -0
- package/dist/model3d/lookdev/markings.js +319 -0
- package/dist/model3d/lookdev/project.d.ts +100 -0
- package/dist/model3d/lookdev/project.js +721 -0
- package/dist/model3d/lookdev/settings.d.ts +65 -0
- package/dist/model3d/lookdev/settings.js +103 -0
- package/dist/model3d/lookdev/texels.d.ts +32 -0
- package/dist/model3d/lookdev/texels.js +192 -0
- package/dist/model3d/profile.d.ts +101 -0
- package/dist/model3d/profile.js +132 -0
- package/dist/model3d/prop.d.ts +29 -0
- package/dist/model3d/prop.js +317 -0
- package/dist/model3d/qa.d.ts +27 -0
- package/dist/model3d/qa.js +105 -0
- package/dist/model3d/render.d.ts +172 -0
- package/dist/model3d/render.js +791 -0
- package/dist/model3d/rig/build.d.ts +14 -0
- package/dist/model3d/rig/build.js +210 -0
- package/dist/model3d/rig/candidate.d.ts +50 -0
- package/dist/model3d/rig/candidate.js +132 -0
- package/dist/model3d/rig/command.d.ts +50 -0
- package/dist/model3d/rig/command.js +229 -0
- package/dist/model3d/rig/fit.d.ts +88 -0
- package/dist/model3d/rig/fit.js +568 -0
- package/dist/model3d/rig/gait.d.ts +105 -0
- package/dist/model3d/rig/gait.js +334 -0
- package/dist/model3d/rig/math.d.ts +27 -0
- package/dist/model3d/rig/math.js +92 -0
- package/dist/model3d/rig/motion.d.ts +26 -0
- package/dist/model3d/rig/motion.js +223 -0
- package/dist/model3d/rig/qa.d.ts +76 -0
- package/dist/model3d/rig/qa.js +357 -0
- package/dist/model3d/rig/rig.d.ts +55 -0
- package/dist/model3d/rig/rig.js +213 -0
- package/dist/model3d/rig/template.d.ts +195 -0
- package/dist/model3d/rig/template.js +456 -0
- package/dist/model3d/scene.d.ts +115 -0
- package/dist/model3d/scene.js +684 -0
- package/dist/model3d/views.d.ts +77 -0
- package/dist/model3d/views.js +190 -0
- package/dist/origin.d.ts +162 -0
- package/dist/origin.js +134 -0
- package/dist/paths.d.ts +53 -0
- package/dist/paths.js +240 -0
- package/dist/planning.d.ts +261 -0
- package/dist/planning.js +1470 -0
- package/dist/policy/blocklist.d.ts +28 -0
- package/dist/policy/blocklist.js +58 -0
- package/dist/policy/brief.d.ts +67 -0
- package/dist/policy/brief.js +110 -0
- package/dist/policy/cuts.d.ts +26 -0
- package/dist/policy/cuts.js +80 -0
- package/dist/policy/model.d.ts +69 -0
- package/dist/policy/model.js +202 -0
- package/dist/policy/text.d.ts +183 -0
- package/dist/policy/text.js +285 -0
- package/dist/postprocess.d.ts +68 -0
- package/dist/postprocess.js +302 -0
- package/dist/profile.d.ts +5 -0
- package/dist/profile.js +98 -0
- package/dist/project-rules.d.ts +54 -0
- package/dist/project-rules.js +105 -0
- package/dist/provenance-binding.d.ts +55 -0
- package/dist/provenance-binding.js +352 -0
- package/dist/providers/adapter.d.ts +176 -0
- package/dist/providers/adapter.js +418 -0
- package/dist/providers/index.d.ts +33 -0
- package/dist/providers/index.js +49 -0
- package/dist/providers/script.d.ts +13 -0
- package/dist/providers/script.js +65 -0
- package/dist/providers/set.d.ts +76 -0
- package/dist/providers/set.js +134 -0
- package/dist/pure-cbor.d.ts +1 -0
- package/dist/pure-cbor.js +8 -0
- package/dist/qa/stability.d.ts +215 -0
- package/dist/qa/stability.js +393 -0
- package/dist/qa/stability.json +32 -0
- package/dist/qa.d.ts +36 -0
- package/dist/qa.js +148 -0
- package/dist/reconcile.d.ts +111 -0
- package/dist/reconcile.js +416 -0
- package/dist/redact.d.ts +29 -0
- package/dist/redact.js +74 -0
- package/dist/regions.d.ts +49 -0
- package/dist/regions.js +113 -0
- package/dist/release-policy.d.ts +99 -0
- package/dist/release-policy.js +266 -0
- package/dist/request.d.ts +74 -0
- package/dist/request.js +249 -0
- package/dist/routes.d.ts +327 -0
- package/dist/routes.js +1166 -0
- package/dist/runs/dir.d.ts +33 -0
- package/dist/runs/dir.js +30 -0
- package/dist/runs/execute.d.ts +86 -0
- package/dist/runs/execute.js +422 -0
- package/dist/runs/journal.d.ts +150 -0
- package/dist/runs/journal.js +216 -0
- package/dist/runs/lock.d.ts +57 -0
- package/dist/runs/lock.js +322 -0
- package/dist/runs/plan.d.ts +261 -0
- package/dist/runs/plan.js +404 -0
- package/dist/search/near-match.d.ts +32 -0
- package/dist/search/near-match.js +86 -0
- package/dist/search/reader.d.ts +17 -0
- package/dist/search/reader.js +334 -0
- package/dist/search/sheet.d.ts +4 -0
- package/dist/search/sheet.js +28 -0
- package/dist/search/style-outliers.d.ts +77 -0
- package/dist/search/style-outliers.js +166 -0
- package/dist/settings-write.d.ts +78 -0
- package/dist/settings-write.js +374 -0
- package/dist/settings.d.ts +436 -0
- package/dist/settings.js +622 -0
- package/dist/shared-settings.d.ts +4 -0
- package/dist/shared-settings.js +24 -0
- package/dist/sheet/blobs.d.ts +33 -0
- package/dist/sheet/blobs.js +145 -0
- package/dist/sheet/generate.d.ts +71 -0
- package/dist/sheet/generate.js +278 -0
- package/dist/sheet/group.d.ts +20 -0
- package/dist/sheet/group.js +191 -0
- package/dist/sheet/import.d.ts +315 -0
- package/dist/sheet/import.js +832 -0
- package/dist/sheet/matte.d.ts +25 -0
- package/dist/sheet/matte.js +508 -0
- package/dist/sheet/media-import.d.ts +41 -0
- package/dist/sheet/media-import.js +118 -0
- package/dist/sheet/register.d.ts +17 -0
- package/dist/sheet/register.js +176 -0
- package/dist/sheet/slice.d.ts +73 -0
- package/dist/sheet/slice.js +912 -0
- package/dist/sheet/types.d.ts +225 -0
- package/dist/sheet/types.js +1 -0
- package/dist/source/aseprite.d.ts +14 -0
- package/dist/source/aseprite.js +124 -0
- package/dist/source/stage.d.ts +24 -0
- package/dist/source/stage.js +172 -0
- package/dist/spend.d.ts +220 -0
- package/dist/spend.js +436 -0
- package/dist/sprite/render.d.ts +22 -0
- package/dist/sprite/render.js +272 -0
- package/dist/storage.d.ts +135 -0
- package/dist/storage.js +405 -0
- package/dist/style.d.ts +19 -0
- package/dist/style.js +26 -0
- package/dist/template.d.ts +29 -0
- package/dist/template.js +98 -0
- package/dist/testing/aseprite.d.ts +54 -0
- package/dist/testing/aseprite.js +191 -0
- package/dist/testing/cli.d.ts +24 -0
- package/dist/testing/cli.js +91 -0
- package/dist/testing/conformance.d.ts +61 -0
- package/dist/testing/conformance.js +455 -0
- package/dist/testing/index.d.ts +23 -0
- package/dist/testing/index.js +15 -0
- package/dist/testing/mcp.d.ts +25 -0
- package/dist/testing/mcp.js +80 -0
- package/dist/testing/project.d.ts +81 -0
- package/dist/testing/project.js +215 -0
- package/dist/testing/samples.d.ts +42 -0
- package/dist/testing/samples.js +122 -0
- package/dist/transform/operations.d.ts +5 -0
- package/dist/transform/operations.js +320 -0
- package/dist/transform/raster-engine.d.ts +9 -0
- package/dist/transform/raster-engine.js +329 -0
- package/dist/transform/rendition.d.ts +65 -0
- package/dist/transform/rendition.js +317 -0
- package/dist/transform/run.d.ts +138 -0
- package/dist/transform/run.js +442 -0
- package/dist/transform/schema.d.ts +33 -0
- package/dist/transform/schema.js +73 -0
- package/dist/transform/types.d.ts +101 -0
- package/dist/transform/types.js +1 -0
- package/dist/tree/address.d.ts +18 -0
- package/dist/tree/address.js +59 -0
- package/dist/tree/list.d.ts +18 -0
- package/dist/tree/list.js +101 -0
- package/dist/tree/project.d.ts +61 -0
- package/dist/tree/project.js +145 -0
- package/dist/tree/read.d.ts +43 -0
- package/dist/tree/read.js +715 -0
- package/dist/tree/search.d.ts +20 -0
- package/dist/tree/search.js +44 -0
- package/dist/tree/serve.d.ts +79 -0
- package/dist/tree/serve.js +415 -0
- package/dist/tree/thumbs.d.ts +26 -0
- package/dist/tree/thumbs.js +134 -0
- package/dist/turnaround.d.ts +195 -0
- package/dist/turnaround.js +622 -0
- package/dist/types.d.ts +595 -0
- package/dist/types.js +1 -0
- package/package.json +112 -3
- package/policy/blocklist.json +47 -0
- package/policy/prompt-policy-cuts.json +15 -0
- package/skills/art-direction/SKILL.md +16 -0
- package/skills/art-direction/default.md +14 -0
- package/skills/art-direction/presets/cozy-storybook.md +121 -0
- package/skills/art-direction/presets/dark-gritty-isometric.md +121 -0
- package/skills/art-direction/presets/flat-cartoon-kids.md +121 -0
- package/skills/art-direction/references/bible-format.md +47 -0
- package/skills/assetgrove/SKILL.md +109 -0
- package/skills/assetgrove/references/commands.md +723 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { Glb } from "../glb.ts";
|
|
2
|
+
import type { V3 } from "./math.ts";
|
|
3
|
+
import type { SkeletonTemplate, TemplateFoot } from "./template.ts";
|
|
4
|
+
/** The mesh at rest: world-space primitives and every vertex in the facing frame. */
|
|
5
|
+
export interface BakedMesh {
|
|
6
|
+
primitives: Array<{
|
|
7
|
+
/** World positions and normals at rest (the file's frame, in metres). */
|
|
8
|
+
positions: Float64Array;
|
|
9
|
+
normals?: Float64Array;
|
|
10
|
+
uvs?: Float64Array;
|
|
11
|
+
indices: Uint32Array;
|
|
12
|
+
material?: number;
|
|
13
|
+
/** Index of this primitive's first vertex in `facing`. */
|
|
14
|
+
first: number;
|
|
15
|
+
}>;
|
|
16
|
+
/** Every vertex in the facing frame (+z forward, +y up, +x left), flat xyz. */
|
|
17
|
+
facing: Float64Array;
|
|
18
|
+
count: number;
|
|
19
|
+
/** Yaw in radians from the facing frame to the file's frame. */
|
|
20
|
+
yaw: number;
|
|
21
|
+
}
|
|
22
|
+
export declare function bakeMesh(glb: Glb, yaw: number): BakedMesh;
|
|
23
|
+
/** The fitted skeleton in the facing frame; rest rotations are identity. */
|
|
24
|
+
export interface Skeleton {
|
|
25
|
+
names: string[];
|
|
26
|
+
parent: number[];
|
|
27
|
+
/** Rest world positions in the facing frame. */
|
|
28
|
+
rest: V3[];
|
|
29
|
+
bodyLength: number;
|
|
30
|
+
/** The facing-frame point template coordinates are measured from (bounds centre on x and z). */
|
|
31
|
+
origin: V3;
|
|
32
|
+
feet: Array<TemplateFoot & {
|
|
33
|
+
chain: [number, number, number, number];
|
|
34
|
+
}>;
|
|
35
|
+
template: SkeletonTemplate;
|
|
36
|
+
/** How far fitting moved each joint from its template position, in body lengths. */
|
|
37
|
+
moved: number[];
|
|
38
|
+
}
|
|
39
|
+
/** Indices ordered so that parents come before children. */
|
|
40
|
+
export declare function topological(parent: number[]): number[];
|
|
41
|
+
/** Body length is the mesh's rest extent along its facing axis (z), tail and nose included. */
|
|
42
|
+
export declare function bodyFrame(mesh: BakedMesh): {
|
|
43
|
+
bodyLength: number;
|
|
44
|
+
origin: V3;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Places the template on the mesh: rest positions × body length from the origin, then each joint
|
|
48
|
+
* moves (across its bone, at most 0.05 body lengths) to the centroid of the mesh slab across the
|
|
49
|
+
* bone at the joint, searching only its own side of the body.
|
|
50
|
+
*/
|
|
51
|
+
export declare function fitSkeleton(template: SkeletonTemplate, mesh: BakedMesh): Skeleton;
|
|
52
|
+
/** Per-vertex skin: four joint indices and weights each. */
|
|
53
|
+
export interface SkinWeights {
|
|
54
|
+
joints: Uint16Array;
|
|
55
|
+
weights: Float32Array;
|
|
56
|
+
}
|
|
57
|
+
/** Bones as segments, each owned by the joint at its start (leaf joints own no segment). */
|
|
58
|
+
export declare function bones(skeleton: Skeleton): Array<{
|
|
59
|
+
joint: number;
|
|
60
|
+
a: V3;
|
|
61
|
+
b: V3;
|
|
62
|
+
}>;
|
|
63
|
+
export declare function skinWeights(skeleton: Skeleton, mesh: BakedMesh): SkinWeights;
|
|
64
|
+
/** The joint carrying most of a vertex's weight. */
|
|
65
|
+
export declare function dominantJoint(skin: SkinWeights, v: number): number;
|
|
66
|
+
/**
|
|
67
|
+
* Each foot's sole: of the vertices the ankle (or wrist) and toe carry at least three quarters of
|
|
68
|
+
* (else those they carry most), the lowest tenth at rest, at least three. A plantigrade foot's
|
|
69
|
+
* sole also takes the lowest of the vertices they carry most along its whole length, heel to toe,
|
|
70
|
+
* so a heel that rests raised is part of the sole and is measured. Indices into the mesh.
|
|
71
|
+
*/
|
|
72
|
+
export declare function soles(skeleton: Skeleton, mesh: BakedMesh, skin: SkinWeights): number[][];
|
|
73
|
+
/**
|
|
74
|
+
* A plantigrade foot's sole split into its heel end and its toe end (the rear and front third of
|
|
75
|
+
* the sole's length at rest), so a heel held above the toe can be measured on the mesh and laid
|
|
76
|
+
* flat, and how far the heel end's lowest vertex rests above the toe end's. A digitigrade foot has
|
|
77
|
+
* no ends: both are empty.
|
|
78
|
+
*/
|
|
79
|
+
export declare function soleEnds(skeleton: Skeleton, mesh: BakedMesh, soleVertices: number[][]): Array<{
|
|
80
|
+
heel: number[];
|
|
81
|
+
toe: number[];
|
|
82
|
+
restRise: number;
|
|
83
|
+
}>;
|
|
84
|
+
/** The unit normal of a leg's bend plane at rest (knee direction × upper-to-ankle direction). */
|
|
85
|
+
export declare function bendNormal(skeleton: Skeleton, chain: [number, number, number, number], fallbackKnee: V3): {
|
|
86
|
+
knee: V3;
|
|
87
|
+
normal: V3;
|
|
88
|
+
};
|
|
@@ -0,0 +1,568 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fitting a skeleton template to a character's mesh: the mesh is baked at rest into the facing
|
|
3
|
+
* frame, the template's rest positions are scaled by body length, each joint moves to the centre of
|
|
4
|
+
* the mesh around it, and the mesh is skinned with smooth weights.
|
|
5
|
+
*/
|
|
6
|
+
import { InputError } from "../../errors.js";
|
|
7
|
+
import { posedPrimitives } from "../scene.js";
|
|
8
|
+
import { add, cross, dot, length, normalize, rotY, rotate, scale, sub } from "./math.js";
|
|
9
|
+
export function bakeMesh(glb, yaw) {
|
|
10
|
+
const posed = posedPrimitives(glb);
|
|
11
|
+
if (posed.length === 0)
|
|
12
|
+
throw new InputError("the model has no triangle geometry to rig");
|
|
13
|
+
const count = posed.reduce((n, p) => n + p.positions.length / 3, 0);
|
|
14
|
+
const facing = new Float64Array(count * 3);
|
|
15
|
+
const back = rotY(-yaw);
|
|
16
|
+
let first = 0;
|
|
17
|
+
const primitives = [];
|
|
18
|
+
for (const p of posed) {
|
|
19
|
+
const n = p.positions.length / 3;
|
|
20
|
+
for (let v = 0; v < n; v++) {
|
|
21
|
+
const f = rotate(back, [
|
|
22
|
+
p.positions[v * 3],
|
|
23
|
+
p.positions[v * 3 + 1],
|
|
24
|
+
p.positions[v * 3 + 2],
|
|
25
|
+
]);
|
|
26
|
+
facing.set(f, (first + v) * 3);
|
|
27
|
+
}
|
|
28
|
+
primitives.push({
|
|
29
|
+
positions: p.positions,
|
|
30
|
+
...(p.normals && { normals: p.normals }),
|
|
31
|
+
...(p.uvs && { uvs: p.uvs }),
|
|
32
|
+
indices: p.indices,
|
|
33
|
+
...(p.material !== undefined && { material: p.material }),
|
|
34
|
+
first,
|
|
35
|
+
});
|
|
36
|
+
first += n;
|
|
37
|
+
}
|
|
38
|
+
return { primitives, facing, count, yaw };
|
|
39
|
+
}
|
|
40
|
+
const vertex = (mesh, v) => [
|
|
41
|
+
mesh.facing[v * 3],
|
|
42
|
+
mesh.facing[v * 3 + 1],
|
|
43
|
+
mesh.facing[v * 3 + 2],
|
|
44
|
+
];
|
|
45
|
+
/** Indices ordered so that parents come before children. */
|
|
46
|
+
export function topological(parent) {
|
|
47
|
+
const order = [];
|
|
48
|
+
const done = new Set();
|
|
49
|
+
const visit = (j) => {
|
|
50
|
+
if (done.has(j))
|
|
51
|
+
return;
|
|
52
|
+
if (parent[j] >= 0)
|
|
53
|
+
visit(parent[j]);
|
|
54
|
+
done.add(j);
|
|
55
|
+
order.push(j);
|
|
56
|
+
};
|
|
57
|
+
parent.forEach((_, j) => visit(j));
|
|
58
|
+
return order;
|
|
59
|
+
}
|
|
60
|
+
/** Body length is the mesh's rest extent along its facing axis (z), tail and nose included. */
|
|
61
|
+
export function bodyFrame(mesh) {
|
|
62
|
+
let minX = Infinity;
|
|
63
|
+
let maxX = -Infinity;
|
|
64
|
+
let minZ = Infinity;
|
|
65
|
+
let maxZ = -Infinity;
|
|
66
|
+
let maxY = -Infinity;
|
|
67
|
+
for (let v = 0; v < mesh.count; v++) {
|
|
68
|
+
const x = mesh.facing[v * 3];
|
|
69
|
+
maxY = Math.max(maxY, mesh.facing[v * 3 + 1]);
|
|
70
|
+
const z = mesh.facing[v * 3 + 2];
|
|
71
|
+
minX = Math.min(minX, x);
|
|
72
|
+
maxX = Math.max(maxX, x);
|
|
73
|
+
minZ = Math.min(minZ, z);
|
|
74
|
+
maxZ = Math.max(maxZ, z);
|
|
75
|
+
}
|
|
76
|
+
const bodyLength = maxZ - minZ;
|
|
77
|
+
if (!(bodyLength > 0))
|
|
78
|
+
throw new InputError("the model has no extent along its facing axis");
|
|
79
|
+
// The midline is the median x of the torso (the middle of the body, above a third of its
|
|
80
|
+
// height), so a tail curled to one side or a splayed leg does not pull it off the body.
|
|
81
|
+
const midZ = (minZ + maxZ) / 2;
|
|
82
|
+
const torso = [];
|
|
83
|
+
for (let v = 0; v < mesh.count; v++) {
|
|
84
|
+
const z = mesh.facing[v * 3 + 2];
|
|
85
|
+
if (Math.abs(z - midZ) > TORSO_BODY_LENGTHS * bodyLength)
|
|
86
|
+
continue;
|
|
87
|
+
if (mesh.facing[v * 3 + 1] < maxY / 3)
|
|
88
|
+
continue;
|
|
89
|
+
torso.push(mesh.facing[v * 3]);
|
|
90
|
+
}
|
|
91
|
+
torso.sort((a, b) => a - b);
|
|
92
|
+
// The true median: with an even count, the mean of the two middle values, so a symmetric torso
|
|
93
|
+
// with no vertex on its midline is not fitted one side over.
|
|
94
|
+
const half = torso.length >> 1;
|
|
95
|
+
const midX = torso.length === 0
|
|
96
|
+
? (minX + maxX) / 2
|
|
97
|
+
: torso.length % 2 === 1
|
|
98
|
+
? torso[half]
|
|
99
|
+
: (torso[half - 1] + torso[half]) / 2;
|
|
100
|
+
return { bodyLength, origin: [midX, 0, midZ] };
|
|
101
|
+
}
|
|
102
|
+
/** Half the length of the torso band whose median x is the midline, in body lengths. */
|
|
103
|
+
const TORSO_BODY_LENGTHS = 0.2;
|
|
104
|
+
/** Ground-contact vertices: at most this high above the lowest vertex, in body lengths. */
|
|
105
|
+
const GROUND_BODY_LENGTHS = 0.03;
|
|
106
|
+
/**
|
|
107
|
+
* How far a foot's ground contact is searched for, and moved, from the template's, in body lengths:
|
|
108
|
+
* far enough that a foot the template misplaces by a leg's spread is still found, so a mesh foot
|
|
109
|
+
* near the edge is never found on one side and missed on its mirror.
|
|
110
|
+
*/
|
|
111
|
+
const FOOT_SEARCH_BODY_LENGTHS = 0.3;
|
|
112
|
+
const MIN_FOOT_VERTICES = 3;
|
|
113
|
+
/** How far along the foot its ground contact may be from the template's before the foot moves. */
|
|
114
|
+
const FOOT_DEAD_ZONE_BODY_LENGTHS = 0.02;
|
|
115
|
+
/**
|
|
116
|
+
* Where each foot's ground contact is on the mesh, as an x-z shift from the template's: the
|
|
117
|
+
* centroid of the ground-contact vertices nearest that foot (the sole between ankle and toe for a
|
|
118
|
+
* plantigrade foot, the toe for a digitigrade one). A foot with too few vertices does not move.
|
|
119
|
+
*/
|
|
120
|
+
function footShifts(template, initial, index, mesh, L) {
|
|
121
|
+
const contacts = template.feet.map((foot) => {
|
|
122
|
+
const ankle = initial[index.get(foot.joints[2])];
|
|
123
|
+
const toe = initial[index.get(foot.joints[3])];
|
|
124
|
+
return foot.plantigrade
|
|
125
|
+
? [(ankle[0] + toe[0]) / 2, (ankle[2] + toe[2]) / 2]
|
|
126
|
+
: [toe[0], toe[2]];
|
|
127
|
+
});
|
|
128
|
+
let minY = Infinity;
|
|
129
|
+
for (let v = 0; v < mesh.count; v++)
|
|
130
|
+
minY = Math.min(minY, mesh.facing[v * 3 + 1]);
|
|
131
|
+
const sums = contacts.map(() => [0, 0, 0]);
|
|
132
|
+
const search = FOOT_SEARCH_BODY_LENGTHS * L;
|
|
133
|
+
for (let v = 0; v < mesh.count; v++) {
|
|
134
|
+
if (mesh.facing[v * 3 + 1] > minY + GROUND_BODY_LENGTHS * L)
|
|
135
|
+
continue;
|
|
136
|
+
const x = mesh.facing[v * 3];
|
|
137
|
+
const z = mesh.facing[v * 3 + 2];
|
|
138
|
+
let best = -1;
|
|
139
|
+
let bestD = search;
|
|
140
|
+
contacts.forEach(([cx, cz], f) => {
|
|
141
|
+
const d = Math.hypot(x - cx, z - cz);
|
|
142
|
+
if (d < bestD)
|
|
143
|
+
[best, bestD] = [f, d];
|
|
144
|
+
});
|
|
145
|
+
if (best < 0)
|
|
146
|
+
continue;
|
|
147
|
+
const sum = sums[best];
|
|
148
|
+
sum[0] += x;
|
|
149
|
+
sum[1] += z;
|
|
150
|
+
sum[2] += 1;
|
|
151
|
+
}
|
|
152
|
+
return contacts.map(([cx, cz], f) => {
|
|
153
|
+
const [sx, sz, n] = sums[f];
|
|
154
|
+
if (n < MIN_FOOT_VERTICES)
|
|
155
|
+
return [0, 0];
|
|
156
|
+
// Across the foot the sole's centroid is the foot's centre line, so x moves in full. Along it,
|
|
157
|
+
// the centroid is not exactly between ankle and toe, so the template is trusted within a dead
|
|
158
|
+
// zone and only a foot further off than that moves, by the excess.
|
|
159
|
+
const dx = sx / n - cx;
|
|
160
|
+
const dz = sz / n - cz;
|
|
161
|
+
const dead = FOOT_DEAD_ZONE_BODY_LENGTHS * L;
|
|
162
|
+
return [dx, Math.sign(dz) * Math.max(0, Math.abs(dz) - dead)];
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
/** How high a raised heel's underside is looked for above the ground, in body lengths. */
|
|
166
|
+
const UNDERSIDE_HEIGHT_BODY_LENGTHS = 0.12;
|
|
167
|
+
/** Half the width of a foot's footprint, and the step along it, in body lengths. */
|
|
168
|
+
const UNDERSIDE_HALF_WIDTH_BODY_LENGTHS = 0.04;
|
|
169
|
+
const UNDERSIDE_STEP_BODY_LENGTHS = 0.01;
|
|
170
|
+
/** How far behind the ankle and ahead of the toe the underside is looked for, in body lengths. */
|
|
171
|
+
const UNDERSIDE_BEHIND_BODY_LENGTHS = 0.08;
|
|
172
|
+
const UNDERSIDE_AHEAD_BODY_LENGTHS = 0.04;
|
|
173
|
+
/** A heel end this much above the toe end (in body lengths) rests raised. */
|
|
174
|
+
const RAISED_HEEL_BODY_LENGTHS = 0.02;
|
|
175
|
+
/**
|
|
176
|
+
* A plantigrade foot's underside when its heel rests raised: the lowest point of each step along
|
|
177
|
+
* the foot's footprint (around the ankle and toe, below a raised heel's height), its extent along
|
|
178
|
+
* the foot and its height above the ground there. Undefined when the foot rests flat, or has no
|
|
179
|
+
* underside to measure.
|
|
180
|
+
*/
|
|
181
|
+
function raisedUnderside(mesh, ankle, toe, L, groundY) {
|
|
182
|
+
const x = (ankle[0] + toe[0]) / 2;
|
|
183
|
+
const start = Math.min(ankle[2], toe[2]) - UNDERSIDE_BEHIND_BODY_LENGTHS * L;
|
|
184
|
+
const end = Math.max(ankle[2], toe[2]) + UNDERSIDE_AHEAD_BODY_LENGTHS * L;
|
|
185
|
+
const step = UNDERSIDE_STEP_BODY_LENGTHS * L;
|
|
186
|
+
const lowest = new Map();
|
|
187
|
+
const consider = ([vx, vy, vz]) => {
|
|
188
|
+
if (Math.abs(vx - x) > UNDERSIDE_HALF_WIDTH_BODY_LENGTHS * L)
|
|
189
|
+
return;
|
|
190
|
+
if (vz < start || vz > end)
|
|
191
|
+
return;
|
|
192
|
+
const y = vy - groundY;
|
|
193
|
+
if (y > UNDERSIDE_HEIGHT_BODY_LENGTHS * L)
|
|
194
|
+
return;
|
|
195
|
+
const bin = Math.floor((vz - start) / step);
|
|
196
|
+
if (y < (lowest.get(bin) ?? Infinity))
|
|
197
|
+
lowest.set(bin, y);
|
|
198
|
+
};
|
|
199
|
+
// The surface, not only its vertices: a low-poly sole has none between heel and toe, so each
|
|
200
|
+
// triangle edge is also sampled where it crosses the middle of each step.
|
|
201
|
+
for (const prim of mesh.primitives) {
|
|
202
|
+
for (let t = 0; t + 2 < prim.indices.length; t += 3) {
|
|
203
|
+
const tri = [0, 1, 2].map((k) => vertex(mesh, prim.first + prim.indices[t + k]));
|
|
204
|
+
for (let e = 0; e < 3; e++) {
|
|
205
|
+
const a = tri[e];
|
|
206
|
+
const b = tri[(e + 1) % 3];
|
|
207
|
+
consider(a);
|
|
208
|
+
const lo = Math.max(Math.min(a[2], b[2]), start);
|
|
209
|
+
const hi = Math.min(Math.max(a[2], b[2]), end);
|
|
210
|
+
if (hi <= lo || a[2] === b[2])
|
|
211
|
+
continue;
|
|
212
|
+
for (let k = Math.ceil((lo - start) / step - 0.5); start + (k + 0.5) * step <= hi; k++) {
|
|
213
|
+
const z = start + (k + 0.5) * step;
|
|
214
|
+
const u = (z - a[2]) / (b[2] - a[2]);
|
|
215
|
+
if (u < 0 || u > 1)
|
|
216
|
+
continue;
|
|
217
|
+
consider(add(a, scale(sub(b, a), u)));
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
const points = [...lowest.entries()]
|
|
223
|
+
.sort((a, b) => a[0] - b[0])
|
|
224
|
+
.map(([bin, y]) => ({ z: start + (bin + 0.5) * step, y }));
|
|
225
|
+
if (points.length < 3)
|
|
226
|
+
return undefined;
|
|
227
|
+
const from = points[0].z;
|
|
228
|
+
const to = points.at(-1).z;
|
|
229
|
+
const third = (to - from) / 3;
|
|
230
|
+
const endY = (lo, hi) => Math.min(...points.filter((p) => p.z >= lo && p.z <= hi).map((p) => p.y));
|
|
231
|
+
if (endY(from, from + third) - endY(to - third, to) <= RAISED_HEEL_BODY_LENGTHS * L) {
|
|
232
|
+
return undefined;
|
|
233
|
+
}
|
|
234
|
+
const heightAt = (z) => {
|
|
235
|
+
let best = points[0];
|
|
236
|
+
for (const p of points)
|
|
237
|
+
if (Math.abs(p.z - z) < Math.abs(best.z - z))
|
|
238
|
+
best = p;
|
|
239
|
+
return best.y;
|
|
240
|
+
};
|
|
241
|
+
return { from, to, heightAt };
|
|
242
|
+
}
|
|
243
|
+
const SEARCH_BODY_LENGTHS = 0.1;
|
|
244
|
+
const SLAB_BODY_LENGTHS = 0.02;
|
|
245
|
+
const MAX_MOVE_BODY_LENGTHS = 0.04;
|
|
246
|
+
const MIDLINE_BODY_LENGTHS = 0.02;
|
|
247
|
+
const MIN_SLAB_VERTICES = 8;
|
|
248
|
+
/**
|
|
249
|
+
* Places the template on the mesh: rest positions × body length from the origin, then each joint
|
|
250
|
+
* moves (across its bone, at most 0.05 body lengths) to the centroid of the mesh slab across the
|
|
251
|
+
* bone at the joint, searching only its own side of the body.
|
|
252
|
+
*/
|
|
253
|
+
export function fitSkeleton(template, mesh) {
|
|
254
|
+
const { bodyLength: L, origin } = bodyFrame(mesh);
|
|
255
|
+
const names = template.joints.map((j) => j.name);
|
|
256
|
+
const index = new Map(names.map((n, i) => [n, i]));
|
|
257
|
+
const parent = template.joints.map((j) => (j.parent === null ? -1 : index.get(j.parent)));
|
|
258
|
+
const initial = template.joints.map((j) => add(origin, scale(j.rest, L)));
|
|
259
|
+
// Each foot first goes to its ground contact on the mesh: the ankle and toe by the whole shift,
|
|
260
|
+
// the knee (or elbow) by half, the hip (or shoulder) not at all.
|
|
261
|
+
let groundY = Infinity;
|
|
262
|
+
for (let v = 0; v < mesh.count; v++)
|
|
263
|
+
groundY = Math.min(groundY, mesh.facing[v * 3 + 1]);
|
|
264
|
+
footShifts(template, initial, index, mesh, L).forEach(([dx, shiftZ], f) => {
|
|
265
|
+
const foot = template.feet[f];
|
|
266
|
+
const [, lower, ankle, toe] = foot.joints.map((n) => index.get(n));
|
|
267
|
+
for (const j of [lower, ankle, toe])
|
|
268
|
+
initial[j][0] += dx * (j === lower ? 0.5 : 1);
|
|
269
|
+
// A plantigrade foot that rests with its heel raised touches the ground only at its toe, so
|
|
270
|
+
// its ground contact is not its middle: its underside, heel to toe, places it instead, and
|
|
271
|
+
// the ankle and toe stand that far above the underside, so the ankle sits in the mesh's heel.
|
|
272
|
+
const under = foot.plantigrade
|
|
273
|
+
? raisedUnderside(mesh, initial[ankle], initial[toe], L, groundY)
|
|
274
|
+
: undefined;
|
|
275
|
+
let dz = shiftZ;
|
|
276
|
+
if (under) {
|
|
277
|
+
const off = (under.from + under.to) / 2 - (initial[ankle][2] + initial[toe][2]) / 2;
|
|
278
|
+
const dead = FOOT_DEAD_ZONE_BODY_LENGTHS * L;
|
|
279
|
+
dz = Math.sign(off) * Math.max(0, Math.abs(off) - dead);
|
|
280
|
+
}
|
|
281
|
+
for (const j of [lower, ankle, toe])
|
|
282
|
+
initial[j][2] += dz * (j === lower ? 0.5 : 1);
|
|
283
|
+
if (under) {
|
|
284
|
+
for (const j of [ankle, toe])
|
|
285
|
+
initial[j][1] += under.heightAt(initial[j][2]);
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
const children = names.map((_, i) => parent.flatMap((p, c) => (p === i ? [c] : [])));
|
|
289
|
+
const rest = initial.map((p) => [...p]);
|
|
290
|
+
const moved = names.map(() => 0);
|
|
291
|
+
template.joints.forEach((joint, j) => {
|
|
292
|
+
const p = initial[j];
|
|
293
|
+
// The joint's bones: from its parent and to its children. It moves only across them, so a
|
|
294
|
+
// joint at a corner (an ankle between shin and foot) re-centres sideways, not along a bone.
|
|
295
|
+
const bonesAt = [];
|
|
296
|
+
if (parent[j] >= 0)
|
|
297
|
+
bonesAt.push(sub(p, initial[parent[j]]));
|
|
298
|
+
for (const c of children[j])
|
|
299
|
+
bonesAt.push(sub(initial[c], p));
|
|
300
|
+
const basis = [];
|
|
301
|
+
for (const bone of bonesAt) {
|
|
302
|
+
let d = bone;
|
|
303
|
+
for (const e of basis)
|
|
304
|
+
d = sub(d, scale(e, dot(d, e)));
|
|
305
|
+
if (length(d) > 1e-6 * L && basis.length < 2)
|
|
306
|
+
basis.push(normalize(d));
|
|
307
|
+
}
|
|
308
|
+
if (basis.length === 0)
|
|
309
|
+
basis.push([0, 0, 1]);
|
|
310
|
+
const axis = normalize(bonesAt[children[j].length > 0 ? bonesAt.length - children[j].length : 0] ?? [0, 0, 1]);
|
|
311
|
+
const side = Math.abs(joint.rest[0]) > MIDLINE_BODY_LENGTHS ? Math.sign(joint.rest[0]) : 0;
|
|
312
|
+
let n = 0;
|
|
313
|
+
const sum = [0, 0, 0];
|
|
314
|
+
for (let v = 0; v < mesh.count; v++) {
|
|
315
|
+
const q = vertex(mesh, v);
|
|
316
|
+
const d = sub(q, p);
|
|
317
|
+
if (Math.abs(dot(d, axis)) > SLAB_BODY_LENGTHS * L)
|
|
318
|
+
continue;
|
|
319
|
+
if (length(d) > SEARCH_BODY_LENGTHS * L)
|
|
320
|
+
continue;
|
|
321
|
+
if (side !== 0 && Math.sign(q[0] - origin[0]) !== side)
|
|
322
|
+
continue;
|
|
323
|
+
sum[0] += q[0];
|
|
324
|
+
sum[1] += q[1];
|
|
325
|
+
sum[2] += q[2];
|
|
326
|
+
n++;
|
|
327
|
+
}
|
|
328
|
+
if (n < MIN_SLAB_VERTICES)
|
|
329
|
+
return;
|
|
330
|
+
let shift = sub(scale(sum, 1 / n), p);
|
|
331
|
+
for (const e of basis)
|
|
332
|
+
shift = sub(shift, scale(e, dot(shift, e)));
|
|
333
|
+
const distance = length(shift);
|
|
334
|
+
const limit = MAX_MOVE_BODY_LENGTHS * L;
|
|
335
|
+
if (distance > limit)
|
|
336
|
+
shift = scale(shift, limit / distance);
|
|
337
|
+
rest[j] = add(p, shift);
|
|
338
|
+
moved[j] = length(shift) / L;
|
|
339
|
+
});
|
|
340
|
+
const feet = template.feet.map((foot) => ({
|
|
341
|
+
...foot,
|
|
342
|
+
chain: foot.joints.map((name) => index.get(name)),
|
|
343
|
+
}));
|
|
344
|
+
return { names, parent, rest, bodyLength: L, origin, feet, template, moved };
|
|
345
|
+
}
|
|
346
|
+
function segmentDistance(p, a, b) {
|
|
347
|
+
const ab = sub(b, a);
|
|
348
|
+
const l2 = dot(ab, ab);
|
|
349
|
+
const t = l2 > 0 ? Math.max(0, Math.min(1, dot(sub(p, a), ab) / l2)) : 0;
|
|
350
|
+
return length(sub(p, add(a, scale(ab, t))));
|
|
351
|
+
}
|
|
352
|
+
/** Bones as segments, each owned by the joint at its start (leaf joints own no segment). */
|
|
353
|
+
export function bones(skeleton) {
|
|
354
|
+
const out = [];
|
|
355
|
+
skeleton.parent.forEach((p, c) => {
|
|
356
|
+
if (p >= 0)
|
|
357
|
+
out.push({ joint: p, a: skeleton.rest[p], b: skeleton.rest[c] });
|
|
358
|
+
});
|
|
359
|
+
return out;
|
|
360
|
+
}
|
|
361
|
+
const SMOOTHING_ROUNDS = 4;
|
|
362
|
+
/**
|
|
363
|
+
* Smooth weights: inverse distance to each bone (power 4), then rounds of averaging across the
|
|
364
|
+
* mesh with vertices welded by position, then the four largest, normalised.
|
|
365
|
+
*/
|
|
366
|
+
/** A plantigrade foot's bone reaches this share of its length behind the ankle, to the heel. */
|
|
367
|
+
const HEEL_SHARE = 0.6;
|
|
368
|
+
export function skinWeights(skeleton, mesh) {
|
|
369
|
+
const J = skeleton.names.length;
|
|
370
|
+
// The heel lies behind a plantigrade ankle and moves with the foot, not the shin, so the foot's
|
|
371
|
+
// bone starts behind the ankle.
|
|
372
|
+
const heels = new Set(skeleton.feet.filter((f) => f.plantigrade).map((f) => f.chain[2]));
|
|
373
|
+
const segments = bones(skeleton).map((s) => heels.has(s.joint) ? { ...s, a: sub(s.a, scale(sub(s.b, s.a), HEEL_SHARE)) } : s);
|
|
374
|
+
const epsilon = 0.01 * skeleton.bodyLength;
|
|
375
|
+
const dense = new Float64Array(mesh.count * J);
|
|
376
|
+
for (let v = 0; v < mesh.count; v++) {
|
|
377
|
+
const p = vertex(mesh, v);
|
|
378
|
+
const row = v * J;
|
|
379
|
+
for (const s of segments) {
|
|
380
|
+
const d = segmentDistance(p, s.a, s.b) + epsilon;
|
|
381
|
+
const w = 1 / (d * d * d * d);
|
|
382
|
+
if (w > dense[row + s.joint])
|
|
383
|
+
dense[row + s.joint] = w;
|
|
384
|
+
}
|
|
385
|
+
let total = 0;
|
|
386
|
+
for (let j = 0; j < J; j++)
|
|
387
|
+
total += dense[row + j];
|
|
388
|
+
for (let j = 0; j < J; j++)
|
|
389
|
+
dense[row + j] /= total || 1;
|
|
390
|
+
}
|
|
391
|
+
// Weld by position so seams (split UVs, separate primitives) smooth together.
|
|
392
|
+
const key = (v) => [0, 1, 2]
|
|
393
|
+
.map((c) => Math.round(mesh.facing[v * 3 + c] / (skeleton.bodyLength * 1e-5)))
|
|
394
|
+
.join(",");
|
|
395
|
+
const weldId = new Int32Array(mesh.count);
|
|
396
|
+
const ids = new Map();
|
|
397
|
+
for (let v = 0; v < mesh.count; v++) {
|
|
398
|
+
const k = key(v);
|
|
399
|
+
let id = ids.get(k);
|
|
400
|
+
if (id === undefined)
|
|
401
|
+
ids.set(k, (id = ids.size));
|
|
402
|
+
weldId[v] = id;
|
|
403
|
+
}
|
|
404
|
+
const neighbours = Array.from({ length: ids.size }, () => new Set());
|
|
405
|
+
for (const prim of mesh.primitives) {
|
|
406
|
+
for (let t = 0; t + 2 < prim.indices.length; t += 3) {
|
|
407
|
+
const tri = [0, 1, 2].map((k) => weldId[prim.first + prim.indices[t + k]]);
|
|
408
|
+
for (const a of tri)
|
|
409
|
+
for (const b of tri)
|
|
410
|
+
if (a !== b)
|
|
411
|
+
neighbours[a].add(b);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
// Weights per welded vertex: the mean of its copies.
|
|
415
|
+
let welded = new Float64Array(ids.size * J);
|
|
416
|
+
const copies = new Uint32Array(ids.size);
|
|
417
|
+
for (let v = 0; v < mesh.count; v++) {
|
|
418
|
+
const id = weldId[v];
|
|
419
|
+
copies[id]++;
|
|
420
|
+
for (let j = 0; j < J; j++)
|
|
421
|
+
welded[id * J + j] += dense[v * J + j];
|
|
422
|
+
}
|
|
423
|
+
for (let id = 0; id < ids.size; id++) {
|
|
424
|
+
for (let j = 0; j < J; j++)
|
|
425
|
+
welded[id * J + j] /= copies[id] || 1;
|
|
426
|
+
}
|
|
427
|
+
for (let round = 0; round < SMOOTHING_ROUNDS; round++) {
|
|
428
|
+
const next = new Float64Array(welded.length);
|
|
429
|
+
for (let id = 0; id < ids.size; id++) {
|
|
430
|
+
const around = neighbours[id];
|
|
431
|
+
for (let j = 0; j < J; j++) {
|
|
432
|
+
let mean = 0;
|
|
433
|
+
for (const n of around)
|
|
434
|
+
mean += welded[n * J + j];
|
|
435
|
+
next[id * J + j] =
|
|
436
|
+
around.size > 0
|
|
437
|
+
? 0.5 * welded[id * J + j] + (0.5 * mean) / around.size
|
|
438
|
+
: welded[id * J + j];
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
welded = next;
|
|
442
|
+
}
|
|
443
|
+
const joints = new Uint16Array(mesh.count * 4);
|
|
444
|
+
const weights = new Float32Array(mesh.count * 4);
|
|
445
|
+
const top = [];
|
|
446
|
+
for (let v = 0; v < mesh.count; v++) {
|
|
447
|
+
const row = weldId[v] * J;
|
|
448
|
+
top.length = 0;
|
|
449
|
+
for (let j = 0; j < J; j++) {
|
|
450
|
+
const w = welded[row + j];
|
|
451
|
+
if (w <= 0)
|
|
452
|
+
continue;
|
|
453
|
+
top.push([j, w]);
|
|
454
|
+
}
|
|
455
|
+
top.sort((a, b) => b[1] - a[1] || a[0] - b[0]);
|
|
456
|
+
const kept = top.slice(0, 4).filter(([, w]) => w > 1e-4);
|
|
457
|
+
const total = kept.reduce((s, [, w]) => s + w, 0) || 1;
|
|
458
|
+
kept.forEach(([j, w], k) => {
|
|
459
|
+
joints[v * 4 + k] = j;
|
|
460
|
+
weights[v * 4 + k] = w / total;
|
|
461
|
+
});
|
|
462
|
+
if (kept.length === 0) {
|
|
463
|
+
joints[v * 4] = 0;
|
|
464
|
+
weights[v * 4] = 1;
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
return { joints, weights };
|
|
468
|
+
}
|
|
469
|
+
/** The joint carrying most of a vertex's weight. */
|
|
470
|
+
export function dominantJoint(skin, v) {
|
|
471
|
+
let best = 0;
|
|
472
|
+
for (let k = 1; k < 4; k++)
|
|
473
|
+
if (skin.weights[v * 4 + k] > skin.weights[v * 4 + best])
|
|
474
|
+
best = k;
|
|
475
|
+
return skin.joints[v * 4 + best];
|
|
476
|
+
}
|
|
477
|
+
/** Bins along a plantigrade foot, heel to toe, whose lowest vertices make up its underside. */
|
|
478
|
+
const SOLE_BINS = 8;
|
|
479
|
+
/** The share of the foot's length, at each end, whose underside is its heel or its toe. */
|
|
480
|
+
const SOLE_END_SHARE = 1 / 3;
|
|
481
|
+
/** The foot's forward direction at rest, level: ankle to toe in x-z (else +z). */
|
|
482
|
+
function footForward(skeleton, ankle, toe) {
|
|
483
|
+
const d = sub(skeleton.rest[toe], skeleton.rest[ankle]);
|
|
484
|
+
const flat = [d[0], 0, d[2]];
|
|
485
|
+
return length(flat) > 1e-9 ? normalize(flat) : [0, 0, 1];
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* Each foot's sole: of the vertices the ankle (or wrist) and toe carry at least three quarters of
|
|
489
|
+
* (else those they carry most), the lowest tenth at rest, at least three. A plantigrade foot's
|
|
490
|
+
* sole also takes the lowest of the vertices they carry most along its whole length, heel to toe,
|
|
491
|
+
* so a heel that rests raised is part of the sole and is measured. Indices into the mesh.
|
|
492
|
+
*/
|
|
493
|
+
export function soles(skeleton, mesh, skin) {
|
|
494
|
+
return skeleton.feet.map((foot) => {
|
|
495
|
+
const [, , ankle, toe] = foot.chain;
|
|
496
|
+
const firm = [];
|
|
497
|
+
const dominant = [];
|
|
498
|
+
for (let v = 0; v < mesh.count; v++) {
|
|
499
|
+
let carried = 0;
|
|
500
|
+
for (let k = 0; k < 4; k++) {
|
|
501
|
+
const j = skin.joints[v * 4 + k];
|
|
502
|
+
if (j === ankle || j === toe)
|
|
503
|
+
carried += skin.weights[v * 4 + k];
|
|
504
|
+
}
|
|
505
|
+
if (carried >= 0.75)
|
|
506
|
+
firm.push(v);
|
|
507
|
+
const j = dominantJoint(skin, v);
|
|
508
|
+
if (j === ankle || j === toe)
|
|
509
|
+
dominant.push(v);
|
|
510
|
+
}
|
|
511
|
+
const own = firm.length >= 3 ? firm : dominant;
|
|
512
|
+
own.sort((a, b) => mesh.facing[a * 3 + 1] - mesh.facing[b * 3 + 1] || a - b);
|
|
513
|
+
const lowest = own.slice(0, Math.max(3, Math.ceil(own.length / 10)));
|
|
514
|
+
if (!foot.plantigrade || dominant.length === 0)
|
|
515
|
+
return lowest;
|
|
516
|
+
// Along the foot: the lowest tenth (at least one) of each bin, heel to toe, of the vertices
|
|
517
|
+
// the ankle and toe carry most (a heel is carried partly by the shin too).
|
|
518
|
+
dominant.sort((a, b) => mesh.facing[a * 3 + 1] - mesh.facing[b * 3 + 1] || a - b);
|
|
519
|
+
const forward = footForward(skeleton, ankle, toe);
|
|
520
|
+
const along = dominant.map((v) => dot(vertex(mesh, v), forward));
|
|
521
|
+
const lo = Math.min(...along);
|
|
522
|
+
const span = Math.max(...along) - lo;
|
|
523
|
+
const bins = Array.from({ length: SOLE_BINS }, () => []);
|
|
524
|
+
dominant.forEach((v, i) => {
|
|
525
|
+
const b = span > 0 ? Math.min(SOLE_BINS - 1, Math.floor(((along[i] - lo) / span) * SOLE_BINS)) : 0;
|
|
526
|
+
bins[b].push(v); // `own` is sorted lowest first, so each bin is too.
|
|
527
|
+
});
|
|
528
|
+
const sole = new Set(lowest);
|
|
529
|
+
for (const bin of bins)
|
|
530
|
+
for (const v of bin.slice(0, Math.ceil(bin.length / 10)))
|
|
531
|
+
sole.add(v);
|
|
532
|
+
return [...sole].sort((a, b) => a - b);
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* A plantigrade foot's sole split into its heel end and its toe end (the rear and front third of
|
|
537
|
+
* the sole's length at rest), so a heel held above the toe can be measured on the mesh and laid
|
|
538
|
+
* flat, and how far the heel end's lowest vertex rests above the toe end's. A digitigrade foot has
|
|
539
|
+
* no ends: both are empty.
|
|
540
|
+
*/
|
|
541
|
+
export function soleEnds(skeleton, mesh, soleVertices) {
|
|
542
|
+
return skeleton.feet.map((foot, f) => {
|
|
543
|
+
const sole = soleVertices[f];
|
|
544
|
+
if (!foot.plantigrade || sole.length === 0)
|
|
545
|
+
return { heel: [], toe: [], restRise: 0 };
|
|
546
|
+
const forward = footForward(skeleton, foot.chain[2], foot.chain[3]);
|
|
547
|
+
const along = sole.map((v) => dot(vertex(mesh, v), forward));
|
|
548
|
+
const lo = Math.min(...along);
|
|
549
|
+
const hi = Math.max(...along);
|
|
550
|
+
const cut = (hi - lo) * SOLE_END_SHARE;
|
|
551
|
+
const heel = sole.filter((_, i) => along[i] <= lo + cut);
|
|
552
|
+
const toe = sole.filter((_, i) => along[i] >= hi - cut);
|
|
553
|
+
const lowest = (vs) => Math.min(...vs.map((v) => mesh.facing[v * 3 + 1]));
|
|
554
|
+
return { heel, toe, restRise: heel.length && toe.length ? lowest(heel) - lowest(toe) : 0 };
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
/** The unit normal of a leg's bend plane at rest (knee direction × upper-to-ankle direction). */
|
|
558
|
+
export function bendNormal(skeleton, chain, fallbackKnee) {
|
|
559
|
+
const [u, l, a] = chain;
|
|
560
|
+
const P = skeleton.rest;
|
|
561
|
+
const along = normalize(sub(P[a], P[u]));
|
|
562
|
+
const offset = sub(P[l], P[u]);
|
|
563
|
+
let knee = sub(offset, scale(along, dot(offset, along)));
|
|
564
|
+
if (length(knee) < 1e-4 * skeleton.bodyLength)
|
|
565
|
+
knee = fallbackKnee;
|
|
566
|
+
knee = normalize(sub(knee, scale(along, dot(knee, along))));
|
|
567
|
+
return { knee, normal: normalize(cross(knee, along)) };
|
|
568
|
+
}
|