cuju-render 0.1.0__py3-none-any.whl
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.
- cuju/render/__init__.py +759 -0
- cuju/render/__main__.py +1065 -0
- cuju/render/_export/__init__.py +3 -0
- cuju/render/_export/feed.py +542 -0
- cuju/render/_export/sizes.py +157 -0
- cuju/render/_export/video.py +1618 -0
- cuju/render/_export/video_jobs.py +408 -0
- cuju/render/_format/__init__.py +3 -0
- cuju/render/_format/annotations.py +235 -0
- cuju/render/_format/codec.py +307 -0
- cuju/render/_format/keep.py +121 -0
- cuju/render/_format/recording.py +860 -0
- cuju/render/_format/writer.py +54 -0
- cuju/render/_guide/__init__.py +3 -0
- cuju/render/_guide/doctor.py +523 -0
- cuju/render/_guide/help.py +62 -0
- cuju/render/_guide/tutorial.py +254 -0
- cuju/render/_http/__init__.py +3 -0
- cuju/render/_http/commands.py +57 -0
- cuju/render/_http/headers.py +103 -0
- cuju/render/_http/launch.py +500 -0
- cuju/render/_http/launchers.py +408 -0
- cuju/render/_http/pwa.py +128 -0
- cuju/render/_http/server.py +2105 -0
- cuju/render/_http/window.py +360 -0
- cuju/render/_moments/__init__.py +3 -0
- cuju/render/_moments/captions.py +284 -0
- cuju/render/_moments/events.py +1123 -0
- cuju/render/_moments/search.py +694 -0
- cuju/render/_packages/__init__.py +3 -0
- cuju/render/_packages/glsl.py +746 -0
- cuju/render/_packages/loudness.py +334 -0
- cuju/render/_packages/pack.py +1959 -0
- cuju/render/_packages/presentation.py +1376 -0
- cuju/render/_packages/vocabulary.py +609 -0
- cuju/render/_playing/__init__.py +3 -0
- cuju/render/_playing/achievements.py +463 -0
- cuju/render/_playing/bench.py +609 -0
- cuju/render/_playing/challenges.py +1813 -0
- cuju/render/_playing/demo.py +323 -0
- cuju/render/_playing/draw.py +211 -0
- cuju/render/_playing/errors.py +20 -0
- cuju/render/_playing/game.py +645 -0
- cuju/render/_playing/limits.py +339 -0
- cuju/render/_playing/play.py +926 -0
- cuju/render/_playing/policy_worker.py +250 -0
- cuju/render/_playing/strict.py +810 -0
- cuju/render/_registry/__init__.py +3 -0
- cuju/render/_registry/clips.py +394 -0
- cuju/render/_registry/joints.py +108 -0
- cuju/render/_registry/teams.py +2058 -0
- cuju/render/_store/__init__.py +3 -0
- cuju/render/_store/home.py +70 -0
- cuju/render/_store/library.py +604 -0
- cuju/render/_store/samples.py +163 -0
- cuju/render/_text/__init__.py +3 -0
- cuju/render/_text/languages.py +637 -0
- cuju/render/_text/messages.py +1396 -0
- cuju/render/_tournaments/__init__.py +3 -0
- cuju/render/_tournaments/results.py +547 -0
- cuju/render/_tournaments/tournament.py +2742 -0
- cuju/render/_tournaments/tournament_cli.py +587 -0
- cuju/render/_tournaments/tournament_runner.py +1975 -0
- cuju/render/_version.py +6 -0
- cuju/render/_watch/__init__.py +3 -0
- cuju/render/_watch/grid.py +265 -0
- cuju/render/_watch/live.py +664 -0
- cuju/render/_watch/notebook.py +79 -0
- cuju/render/_watch/show.py +171 -0
- cuju/render/samples/sample-11v11.cjr +0 -0
- cuju/render/samples/sample-5v5.cjr +0 -0
- cuju/render/samples/teams/starter/main.py +33 -0
- cuju/render/scenarios/benchmark_full_game_11_vs_11_easy.py +46 -0
- cuju/render/scenarios/benchmark_full_game_11_vs_11_hard.py +46 -0
- cuju/render/scenarios/benchmark_full_game_11_vs_11_medium.py +46 -0
- cuju/render/scenarios/benchmark_full_game_5_vs_5_easy.py +34 -0
- cuju/render/scenarios/benchmark_full_game_5_vs_5_hard.py +34 -0
- cuju/render/scenarios/benchmark_full_game_5_vs_5_medium.py +34 -0
- cuju/render/web/assets/adboard_polygon.webp +0 -0
- cuju/render/web/assets/adboard_your_ad_here.webp +0 -0
- cuju/render/web/assets/animations/kaykit-rig-medium-combatmelee.glb +0 -0
- cuju/render/web/assets/animations/kaykit-rig-medium-general.glb +0 -0
- cuju/render/web/assets/animations/kaykit-rig-medium-movementadvanced.glb +0 -0
- cuju/render/web/assets/animations/kaykit-rig-medium-movementbasic.glb +0 -0
- cuju/render/web/assets/animations/kaykit-rig-medium-simulation.glb +0 -0
- cuju/render/web/assets/animations/kaykit-rig-medium-special.glb +0 -0
- cuju/render/web/assets/ball.glb +0 -0
- cuju/render/web/assets/challenges/3_vs_1_with_keeper.mp4 +0 -0
- cuju/render/web/assets/challenges/3_vs_1_with_keeper.webp +0 -0
- cuju/render/web/assets/challenges/corner.mp4 +0 -0
- cuju/render/web/assets/challenges/corner.webp +0 -0
- cuju/render/web/assets/challenges/counterattack_easy.mp4 +0 -0
- cuju/render/web/assets/challenges/counterattack_easy.webp +0 -0
- cuju/render/web/assets/challenges/counterattack_hard.mp4 +0 -0
- cuju/render/web/assets/challenges/counterattack_hard.webp +0 -0
- cuju/render/web/assets/challenges/empty_goal.mp4 +0 -0
- cuju/render/web/assets/challenges/empty_goal.webp +0 -0
- cuju/render/web/assets/challenges/empty_goal_close.mp4 +0 -0
- cuju/render/web/assets/challenges/empty_goal_close.webp +0 -0
- cuju/render/web/assets/challenges/manifest.json +375 -0
- cuju/render/web/assets/challenges/one_on_one.mp4 +0 -0
- cuju/render/web/assets/challenges/one_on_one.webp +0 -0
- cuju/render/web/assets/challenges/one_on_one_hard.mp4 +0 -0
- cuju/render/web/assets/challenges/one_on_one_hard.webp +0 -0
- cuju/render/web/assets/challenges/pass_and_shoot_with_keeper.mp4 +0 -0
- cuju/render/web/assets/challenges/pass_and_shoot_with_keeper.webp +0 -0
- cuju/render/web/assets/challenges/run_pass_and_shoot_with_keeper.mp4 +0 -0
- cuju/render/web/assets/challenges/run_pass_and_shoot_with_keeper.webp +0 -0
- cuju/render/web/assets/challenges/run_to_score.mp4 +0 -0
- cuju/render/web/assets/challenges/run_to_score.webp +0 -0
- cuju/render/web/assets/challenges/run_to_score_with_keeper.mp4 +0 -0
- cuju/render/web/assets/challenges/run_to_score_with_keeper.webp +0 -0
- cuju/render/web/assets/challenges/single_goal_versus_lazy.mp4 +0 -0
- cuju/render/web/assets/challenges/single_goal_versus_lazy.webp +0 -0
- cuju/render/web/assets/crowd.webp +0 -0
- cuju/render/web/assets/crowd_normal.webp +0 -0
- cuju/render/web/assets/cuju-logo-384.png +0 -0
- cuju/render/web/assets/cuju-logo.png +0 -0
- cuju/render/web/assets/cuju-logo.svg +46 -0
- cuju/render/web/assets/cuju-mark-light.svg +33 -0
- cuju/render/web/assets/cuju-mark.svg +33 -0
- cuju/render/web/assets/goal.glb +0 -0
- cuju/render/web/assets/grass.webp +0 -0
- cuju/render/web/assets/hair_black.png +0 -0
- cuju/render/web/assets/hair_blonde.png +0 -0
- cuju/render/web/assets/hair_brown.png +0 -0
- cuju/render/web/assets/hair_darkblonde.png +0 -0
- cuju/render/web/assets/hair_long01.glb +0 -0
- cuju/render/web/assets/hair_long02.glb +0 -0
- cuju/render/web/assets/hair_medium01.glb +0 -0
- cuju/render/web/assets/hair_red.png +0 -0
- cuju/render/web/assets/hair_short01.glb +0 -0
- cuju/render/web/assets/hair_short02.glb +0 -0
- cuju/render/web/assets/icons/cuju-192.png +0 -0
- cuju/render/web/assets/icons/cuju-512.png +0 -0
- cuju/render/web/assets/icons/cuju-maskable-512.png +0 -0
- cuju/render/web/assets/kit_goalkeeper.webp +0 -0
- cuju/render/web/assets/kit_mask.png +0 -0
- cuju/render/web/assets/kit_normal.webp +0 -0
- cuju/render/web/assets/manifest.json +601 -0
- cuju/render/web/assets/models/kaykit-barbarian.glb +0 -0
- cuju/render/web/assets/models/kaykit-barbarian.json +23 -0
- cuju/render/web/assets/models/kaykit-knight.glb +0 -0
- cuju/render/web/assets/models/kaykit-knight.json +23 -0
- cuju/render/web/assets/models/kaykit-mage.glb +0 -0
- cuju/render/web/assets/models/kaykit-mage.json +23 -0
- cuju/render/web/assets/models/kaykit-mannequin-medium.glb +0 -0
- cuju/render/web/assets/models/kaykit-mannequin-medium.json +23 -0
- cuju/render/web/assets/models/kaykit-ranger.glb +0 -0
- cuju/render/web/assets/models/kaykit-ranger.json +23 -0
- cuju/render/web/assets/models/kaykit-rogue-hooded.glb +0 -0
- cuju/render/web/assets/models/kaykit-rogue-hooded.json +23 -0
- cuju/render/web/assets/models/kaykit-rogue.glb +0 -0
- cuju/render/web/assets/models/kaykit-rogue.json +23 -0
- cuju/render/web/assets/models/kaykit-skeleton-mage.glb +0 -0
- cuju/render/web/assets/models/kaykit-skeleton-mage.json +23 -0
- cuju/render/web/assets/models/kaykit-skeleton-minion.glb +0 -0
- cuju/render/web/assets/models/kaykit-skeleton-minion.json +23 -0
- cuju/render/web/assets/models/kaykit-skeleton-rogue.glb +0 -0
- cuju/render/web/assets/models/kaykit-skeleton-rogue.json +23 -0
- cuju/render/web/assets/models/kaykit-skeleton-warrior.glb +0 -0
- cuju/render/web/assets/models/kaykit-skeleton-warrior.json +23 -0
- cuju/render/web/assets/pitch.webp +0 -0
- cuju/render/web/assets/pitch_normal.webp +0 -0
- cuju/render/web/assets/player.glb +0 -0
- cuju/render/web/assets/shoe.webp +0 -0
- cuju/render/web/assets/shoe_sole.png +0 -0
- cuju/render/web/assets/skin_01.png +0 -0
- cuju/render/web/assets/skin_02.png +0 -0
- cuju/render/web/assets/skin_03.png +0 -0
- cuju/render/web/assets/skin_04.png +0 -0
- cuju/render/web/assets/sounds/applause.ogg +0 -0
- cuju/render/web/assets/sounds/beach-wave-1.ogg +0 -0
- cuju/render/web/assets/sounds/beach-wave-2.ogg +0 -0
- cuju/render/web/assets/sounds/beach-wave-3.ogg +0 -0
- cuju/render/web/assets/sounds/beach-wave-4.ogg +0 -0
- cuju/render/web/assets/sounds/city-horn.ogg +0 -0
- cuju/render/web/assets/sounds/city-loop.ogg +0 -0
- cuju/render/web/assets/sounds/city-siren.ogg +0 -0
- cuju/render/web/assets/sounds/crowd-cheer.ogg +0 -0
- cuju/render/web/assets/sounds/crowd-loop.ogg +0 -0
- cuju/render/web/assets/sounds/crowd-ooh.ogg +0 -0
- cuju/render/web/assets/sounds/gulls.ogg +0 -0
- cuju/render/web/assets/sounds/neon-sting.ogg +0 -0
- cuju/render/web/assets/sounds/rain-loop.ogg +0 -0
- cuju/render/web/assets/sounds/sounds.json +46 -0
- cuju/render/web/assets/sounds/space-beep.ogg +0 -0
- cuju/render/web/assets/sounds/space-hum.ogg +0 -0
- cuju/render/web/assets/sounds/space-radio.ogg +0 -0
- cuju/render/web/assets/sounds/whistle-long.ogg +0 -0
- cuju/render/web/assets/sounds/whistle-short.ogg +0 -0
- cuju/render/web/assets/sounds/wind-loop.ogg +0 -0
- cuju/render/web/easy.css +357 -0
- cuju/render/web/export.html +23 -0
- cuju/render/web/feed.css +262 -0
- cuju/render/web/feed.html +28 -0
- cuju/render/web/flat.css +120 -0
- cuju/render/web/home.css +837 -0
- cuju/render/web/index.html +373 -0
- cuju/render/web/js/boot.js +50 -0
- cuju/render/web/js/broadcast/audio.js +2141 -0
- cuju/render/web/js/broadcast/celebrate.js +1238 -0
- cuju/render/web/js/broadcast/decisions.js +609 -0
- cuju/render/web/js/broadcast/hud.js +352 -0
- cuju/render/web/js/broadcast/show.js +3614 -0
- cuju/render/web/js/broadcast/transition.js +2231 -0
- cuju/render/web/js/broadcast/voices.js +153 -0
- cuju/render/web/js/capture.js +101 -0
- cuju/render/web/js/core/accessibility.js +90 -0
- cuju/render/web/js/core/api.js +429 -0
- cuju/render/web/js/core/comfort.js +135 -0
- cuju/render/web/js/core/i18n.js +705 -0
- cuju/render/web/js/core/icons.js +167 -0
- cuju/render/web/js/core/input-settings.js +156 -0
- cuju/render/web/js/core/keys.js +277 -0
- cuju/render/web/js/core/language-ui.js +125 -0
- cuju/render/web/js/core/menu.js +853 -0
- cuju/render/web/js/core/names.js +113 -0
- cuju/render/web/js/core/page-structure.js +110 -0
- cuju/render/web/js/core/scenarios.js +109 -0
- cuju/render/web/js/core/spoilers.js +236 -0
- cuju/render/web/js/core/typeahead.js +38 -0
- cuju/render/web/js/export/dom-picture.js +330 -0
- cuju/render/web/js/export/export-host.js +97 -0
- cuju/render/web/js/export/feed-dialog.js +191 -0
- cuju/render/web/js/export/feed-params.js +266 -0
- cuju/render/web/js/export/feed.js +363 -0
- cuju/render/web/js/export/mp4-mux.js +295 -0
- cuju/render/web/js/export/photo-core.js +313 -0
- cuju/render/web/js/export/photo.js +1314 -0
- cuju/render/web/js/export/safe-frame.js +59 -0
- cuju/render/web/js/export/size-fields.js +103 -0
- cuju/render/web/js/export/sizes.js +178 -0
- cuju/render/web/js/export/video-boot.js +55 -0
- cuju/render/web/js/export/video-browser.js +325 -0
- cuju/render/web/js/export/video-export.js +417 -0
- cuju/render/web/js/export/video-plan.js +207 -0
- cuju/render/web/js/export/video-range.js +185 -0
- cuju/render/web/js/export/webm-mux.js +198 -0
- cuju/render/web/js/feed-boot.js +151 -0
- cuju/render/web/js/feed-frame.js +101 -0
- cuju/render/web/js/help/doctor.js +488 -0
- cuju/render/web/js/help/firstrun.js +379 -0
- cuju/render/web/js/help/help-center.js +438 -0
- cuju/render/web/js/help/install-offer.js +164 -0
- cuju/render/web/js/help/install-state.js +104 -0
- cuju/render/web/js/help/lessons-core.js +207 -0
- cuju/render/web/js/help/lessons.js +463 -0
- cuju/render/web/js/help/palette.js +584 -0
- cuju/render/web/js/help/pwa.js +257 -0
- cuju/render/web/js/help/tour-core.js +241 -0
- cuju/render/web/js/help/tour.js +461 -0
- cuju/render/web/js/main.js +2513 -0
- cuju/render/web/js/pages/draw.js +188 -0
- cuju/render/web/js/pages/fieldpage.js +530 -0
- cuju/render/web/js/pages/home.js +521 -0
- cuju/render/web/js/pages/matches.js +779 -0
- cuju/render/web/js/pages/moments-ui.js +359 -0
- cuju/render/web/js/pages/queue-filters.js +63 -0
- cuju/render/web/js/pages/recording-groups.js +80 -0
- cuju/render/web/js/pages/recordings.js +1069 -0
- cuju/render/web/js/play/bench.js +347 -0
- cuju/render/web/js/play/challenges.js +1302 -0
- cuju/render/web/js/play/medals.js +127 -0
- cuju/render/web/js/play/play.js +1953 -0
- cuju/render/web/js/play/teasers.js +196 -0
- cuju/render/web/js/play/touch.js +350 -0
- cuju/render/web/js/play/tournament-layout.js +487 -0
- cuju/render/web/js/play/tournament-results.js +441 -0
- cuju/render/web/js/play/tournament-strict.js +560 -0
- cuju/render/web/js/play/tournament.js +2585 -0
- cuju/render/web/js/players/animate.js +972 -0
- cuju/render/web/js/players/clips.js +224 -0
- cuju/render/web/js/players/kaykit.js +162 -0
- cuju/render/web/js/players/kits.js +676 -0
- cuju/render/web/js/players/number-patch.js +82 -0
- cuju/render/web/js/players/players.js +2694 -0
- cuju/render/web/js/players/recolor.js +893 -0
- cuju/render/web/js/players/retarget.js +325 -0
- cuju/render/web/js/players/rig-numbers.js +174 -0
- cuju/render/web/js/presentation/animator.js +231 -0
- cuju/render/web/js/presentation/assign.js +85 -0
- cuju/render/web/js/presentation/behaviors.js +440 -0
- cuju/render/web/js/presentation/budget.js +209 -0
- cuju/render/web/js/presentation/catalog.js +1674 -0
- cuju/render/web/js/presentation/clocks.js +72 -0
- cuju/render/web/js/presentation/commands.js +301 -0
- cuju/render/web/js/presentation/contract.js +240 -0
- cuju/render/web/js/presentation/effects.js +904 -0
- cuju/render/web/js/presentation/flash.js +605 -0
- cuju/render/web/js/presentation/freeze-worklet.js +22 -0
- cuju/render/web/js/presentation/glsl.js +464 -0
- cuju/render/web/js/presentation/host.js +323 -0
- cuju/render/web/js/presentation/index.js +2066 -0
- cuju/render/web/js/presentation/loudness-worklet.js +235 -0
- cuju/render/web/js/presentation/loudness.js +740 -0
- cuju/render/web/js/presentation/moments.js +536 -0
- cuju/render/web/js/presentation/post.js +327 -0
- cuju/render/web/js/presentation/preview.js +180 -0
- cuju/render/web/js/presentation/protocol.js +174 -0
- cuju/render/web/js/presentation/reach.js +158 -0
- cuju/render/web/js/presentation/rigging.js +130 -0
- cuju/render/web/js/presentation/sandbox.js +157 -0
- cuju/render/web/js/presentation/shaders.js +235 -0
- cuju/render/web/js/presentation/stage.js +402 -0
- cuju/render/web/js/presentation/teamaudio.js +722 -0
- cuju/render/web/js/presentation/tracks.js +197 -0
- cuju/render/web/js/presentation/values.js +81 -0
- cuju/render/web/js/recording/annotation-data.js +203 -0
- cuju/render/web/js/recording/captions.js +491 -0
- cuju/render/web/js/recording/codec.js +185 -0
- cuju/render/web/js/recording/decode-worker.js +70 -0
- cuju/render/web/js/recording/decode.js +94 -0
- cuju/render/web/js/recording/episodes.js +46 -0
- cuju/render/web/js/recording/format.js +461 -0
- cuju/render/web/js/recording/live.js +348 -0
- cuju/render/web/js/recording/moments-query.js +59 -0
- cuju/render/web/js/recording/moments.js +149 -0
- cuju/render/web/js/recording/pose.js +86 -0
- cuju/render/web/js/recording/timeline.js +275 -0
- cuju/render/web/js/teams/art.js +50 -0
- cuju/render/web/js/teams/clip-editor.js +293 -0
- cuju/render/web/js/teams/editor.js +1979 -0
- cuju/render/web/js/teams/library.js +344 -0
- cuju/render/web/js/teams/painter.js +633 -0
- cuju/render/web/js/teams/surprise-ui.js +195 -0
- cuju/render/web/js/teams/surprise.js +497 -0
- cuju/render/web/js/teams/team-check.js +127 -0
- cuju/render/web/js/watch/annotations.js +270 -0
- cuju/render/web/js/watch/flat.js +366 -0
- cuju/render/web/js/watch/grid.js +436 -0
- cuju/render/web/js/watch/pitch2d.js +289 -0
- cuju/render/web/js/watch/player-tools.js +192 -0
- cuju/render/web/js/watch/presets.js +201 -0
- cuju/render/web/js/world/arenas.js +997 -0
- cuju/render/web/js/world/ball.js +204 -0
- cuju/render/web/js/world/cameras.js +982 -0
- cuju/render/web/js/world/crowd.js +376 -0
- cuju/render/web/js/world/field.js +227 -0
- cuju/render/web/js/world/framing.js +145 -0
- cuju/render/web/js/world/occlusion.js +48 -0
- cuju/render/web/js/world/pitch.js +703 -0
- cuju/render/web/js/world/scene.js +395 -0
- cuju/render/web/js/world/sky.js +325 -0
- cuju/render/web/js/world/stadium.js +1262 -0
- cuju/render/web/js/world/vendor-sky.js +367 -0
- cuju/render/web/js/world/weather.js +264 -0
- cuju/render/web/languages/en.json +4750 -0
- cuju/render/web/lessons.json +137 -0
- cuju/render/web/manifest.webmanifest +23 -0
- cuju/render/web/style.css +8399 -0
- cuju/render/web/sw.js +235 -0
- cuju/render/web/vendor/fabric/LICENSE +16 -0
- cuju/render/web/vendor/fabric/fabric.min.mjs +1 -0
- cuju/render/web/vendor/lucide/LICENSE +43 -0
- cuju/render/web/vendor/lucide/icons.js +141 -0
- cuju/render/web/vendor/three/LICENSE +21 -0
- cuju/render/web/vendor/three/build/three.core.js +60586 -0
- cuju/render/web/vendor/three/build/three.module.js +19719 -0
- cuju/render/web/vendor/three/examples/jsm/loaders/GLTFLoader.js +4925 -0
- cuju/render/web/vendor/three/examples/jsm/postprocessing/EffectComposer.js +365 -0
- cuju/render/web/vendor/three/examples/jsm/postprocessing/MaskPass.js +195 -0
- cuju/render/web/vendor/three/examples/jsm/postprocessing/OutputPass.js +148 -0
- cuju/render/web/vendor/three/examples/jsm/postprocessing/Pass.js +191 -0
- cuju/render/web/vendor/three/examples/jsm/postprocessing/RenderPass.js +193 -0
- cuju/render/web/vendor/three/examples/jsm/postprocessing/ShaderPass.js +135 -0
- cuju/render/web/vendor/three/examples/jsm/postprocessing/UnrealBloomPass.js +541 -0
- cuju/render/web/vendor/three/examples/jsm/shaders/CopyShader.js +52 -0
- cuju/render/web/vendor/three/examples/jsm/shaders/LuminosityHighPassShader.js +68 -0
- cuju/render/web/vendor/three/examples/jsm/shaders/OutputShader.js +103 -0
- cuju/render/web/vendor/three/examples/jsm/utils/BufferGeometryUtils.js +1501 -0
- cuju/render/web/vendor/three/examples/jsm/utils/SkeletonUtils.js +496 -0
- cuju_render-0.1.0.dist-info/METADATA +116 -0
- cuju_render-0.1.0.dist-info/RECORD +382 -0
- cuju_render-0.1.0.dist-info/WHEEL +4 -0
- cuju_render-0.1.0.dist-info/licenses/LICENSE +202 -0
- cuju_render-0.1.0.dist-info/licenses/LICENSES/CC-BY-4.0.txt +396 -0
- cuju_render-0.1.0.dist-info/licenses/LICENSES/CC0-1.0.txt +127 -0
- cuju_render-0.1.0.dist-info/licenses/LICENSES/ISC.txt +16 -0
- cuju_render-0.1.0.dist-info/licenses/LICENSES/MIT.txt +24 -0
- cuju_render-0.1.0.dist-info/licenses/LICENSES/Unlicense.txt +13 -0
- cuju_render-0.1.0.dist-info/licenses/NOTICE +35 -0
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
// Copyright 2026 The cuju Authors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
// The celebration clips that teams upload, as poses of GRF's skeleton of 14 nodes. A clip moves
|
|
5
|
+
// the bones of a skeleton of its own, and clips.js reads those bones at 30 frames a second. This
|
|
6
|
+
// module turns each moment into nodes by the joint mapping of the clip, the inverse of the way a
|
|
7
|
+
// custom model follows the nodes, so a clip plays on GRF's player and on every model alike.
|
|
8
|
+
//
|
|
9
|
+
// A custom model draws a mapped bone with the world rotation of its node times a correction, the
|
|
10
|
+
// inverse of GRF's rest rotation of the node times the bone's own rest rotation. A clip's bone
|
|
11
|
+
// gives its node the world rotation of the bone times the inverse of that correction, and an
|
|
12
|
+
// unmapped node keeps its rest turn relative to its parent. The pelvis gives the body its height
|
|
13
|
+
// above the floor, scaled from the clip's skeleton to GRF's, and every other node hangs from its
|
|
14
|
+
// parent at GRF's own bone lengths, as the procedural animations do.
|
|
15
|
+
//
|
|
16
|
+
// The pelvis may travel. A clip that ends more than a quarter meter from where it began walks or
|
|
17
|
+
// runs, so that steady travel is taken out and the clip plays in place, and any movement left
|
|
18
|
+
// stays within a meter and a half of the spot. A choreography that pins a player to his place
|
|
19
|
+
// takes the travel out entirely, and a scorer stays inside the touch and goal lines.
|
|
20
|
+
//
|
|
21
|
+
// Poses use the engine frame of a recording, z up in meters with the player facing engine minus
|
|
22
|
+
// y at heading 0. Bones arrive in three.js's frame, y up, which glTF shares, facing plus z.
|
|
23
|
+
|
|
24
|
+
import { NODE_COUNT, NODE_PARENTS, PLAYER_FLOATS } from '../recording/format.js';
|
|
25
|
+
|
|
26
|
+
// Local rest positions of GRF's player, as in animate.js and players.js. Every local rotation of
|
|
27
|
+
// the rest pose is the identity.
|
|
28
|
+
export const REST_LOCAL = [
|
|
29
|
+
[0, 0, 0], [0, 0, 0.96], [0, 0, 0.15], [0, -0.03, 0.5], [0.16, -0.01, 0.48], [-0.01, 0, -0.33],
|
|
30
|
+
[-0.16, -0.01, 0.48], [0.01, 0, -0.33], [0.087, 0, -0.01], [0, 0, -0.42], [0, -0.04, -0.44],
|
|
31
|
+
[-0.087, 0, -0.01], [0, 0, -0.42], [0, -0.04, -0.44],
|
|
32
|
+
];
|
|
33
|
+
// The height of the pelvis above the ground point in the rest pose.
|
|
34
|
+
export const REST_BODY_HEIGHT = 0.96;
|
|
35
|
+
export const FPS = 30;
|
|
36
|
+
// The longest stretch of a clip that plays, in seconds.
|
|
37
|
+
export const MAX_SECONDS = 30;
|
|
38
|
+
// A clip that ends farther than this from its start travels, in meters.
|
|
39
|
+
export const DRIFT = 0.25;
|
|
40
|
+
// The farthest the pelvis strays from the spot, in meters.
|
|
41
|
+
export const ROOT_LIMIT = 1.5;
|
|
42
|
+
|
|
43
|
+
// Quaternions are arrays x, y, z, w.
|
|
44
|
+
export function multiply(a, b, out = [0, 0, 0, 1]) {
|
|
45
|
+
const [ax, ay, az, aw] = a;
|
|
46
|
+
const [bx, by, bz, bw] = b;
|
|
47
|
+
out[0] = aw * bx + ax * bw + ay * bz - az * by;
|
|
48
|
+
out[1] = aw * by - ax * bz + ay * bw + az * bx;
|
|
49
|
+
out[2] = aw * bz + ax * by - ay * bx + az * bw;
|
|
50
|
+
out[3] = aw * bw - ax * bx - ay * by - az * bz;
|
|
51
|
+
return out;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function invert(q, out = [0, 0, 0, 1]) {
|
|
55
|
+
const n = q[0] * q[0] + q[1] * q[1] + q[2] * q[2] + q[3] * q[3] || 1;
|
|
56
|
+
out[0] = -q[0] / n;
|
|
57
|
+
out[1] = -q[1] / n;
|
|
58
|
+
out[2] = -q[2] / n;
|
|
59
|
+
out[3] = q[3] / n;
|
|
60
|
+
return out;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function normalize(q) {
|
|
64
|
+
const n = Math.hypot(q[0], q[1], q[2], q[3]);
|
|
65
|
+
if (!(n > 1e-9)) {
|
|
66
|
+
q[0] = 0;
|
|
67
|
+
q[1] = 0;
|
|
68
|
+
q[2] = 0;
|
|
69
|
+
q[3] = 1;
|
|
70
|
+
return q;
|
|
71
|
+
}
|
|
72
|
+
q[0] /= n;
|
|
73
|
+
q[1] /= n;
|
|
74
|
+
q[2] /= n;
|
|
75
|
+
q[3] /= n;
|
|
76
|
+
return q;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// The vector v turned by the unit quaternion q.
|
|
80
|
+
export function rotate(q, v, out = [0, 0, 0]) {
|
|
81
|
+
const [x, y, z, w] = q;
|
|
82
|
+
const [vx, vy, vz] = v;
|
|
83
|
+
const tx = 2 * (y * vz - z * vy);
|
|
84
|
+
const ty = 2 * (z * vx - x * vz);
|
|
85
|
+
const tz = 2 * (x * vy - y * vx);
|
|
86
|
+
out[0] = vx + w * tx + y * tz - z * ty;
|
|
87
|
+
out[1] = vy + w * ty + z * tx - x * tz;
|
|
88
|
+
out[2] = vz + w * tz + x * ty - y * tx;
|
|
89
|
+
return out;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// three.js's frame to the engine's, the inverse of the turn players.js makes for every node.
|
|
93
|
+
export function engineRotation(q, out = [0, 0, 0, 1]) {
|
|
94
|
+
const [x, y, z, w] = q;
|
|
95
|
+
out[0] = x;
|
|
96
|
+
out[1] = -z;
|
|
97
|
+
out[2] = y;
|
|
98
|
+
out[3] = w;
|
|
99
|
+
return out;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export function enginePosition(p, out = [0, 0, 0]) {
|
|
103
|
+
const [x, y, z] = p;
|
|
104
|
+
out[0] = x;
|
|
105
|
+
out[1] = -z;
|
|
106
|
+
out[2] = y;
|
|
107
|
+
return out;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const world = Array.from({ length: NODE_COUNT }, () => [0, 0, 0, 1]);
|
|
111
|
+
const place = Array.from({ length: NODE_COUNT }, () => [0, 0, 0]);
|
|
112
|
+
const turned = [0, 0, 0];
|
|
113
|
+
const inverse = [0, 0, 0, 1];
|
|
114
|
+
const bone = [0, 0, 0, 1];
|
|
115
|
+
|
|
116
|
+
// Writes the nodes of one moment of a clip into out at o. bones holds, for each node, the world
|
|
117
|
+
// rotation in three.js's frame of the bone mapped to it, or null for a node without a bone, and
|
|
118
|
+
// body the world position in that frame of the bone mapped to body, the pelvis. rig holds
|
|
119
|
+
// corrections, the correction of each node or null, heightRatio, the clip's pelvis height over
|
|
120
|
+
// GRF's, and floor, the height of the clip's floor in the frame of the bones. offset is the
|
|
121
|
+
// pelvis's travel from the spot along engine x and y.
|
|
122
|
+
export function nodesFromBones(bones, body, rig, offset, out, o = 0) {
|
|
123
|
+
world[0][0] = 0;
|
|
124
|
+
world[0][1] = 0;
|
|
125
|
+
world[0][2] = 0;
|
|
126
|
+
world[0][3] = 1;
|
|
127
|
+
for (let n = 1; n < NODE_COUNT; n++) {
|
|
128
|
+
const q = bones[n];
|
|
129
|
+
const c = rig.corrections[n];
|
|
130
|
+
if (q && c) {
|
|
131
|
+
multiply(q, invert(c, inverse), bone);
|
|
132
|
+
normalize(engineRotation(bone, world[n]));
|
|
133
|
+
} else {
|
|
134
|
+
const p = world[NODE_PARENTS[n]];
|
|
135
|
+
world[n][0] = p[0];
|
|
136
|
+
world[n][1] = p[1];
|
|
137
|
+
world[n][2] = p[2];
|
|
138
|
+
world[n][3] = p[3];
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
place[0][0] = offset[0];
|
|
142
|
+
place[0][1] = offset[1];
|
|
143
|
+
place[0][2] = 0;
|
|
144
|
+
place[1][0] = offset[0];
|
|
145
|
+
place[1][1] = offset[1];
|
|
146
|
+
place[1][2] = (body[1] - rig.floor) / (rig.heightRatio || 1);
|
|
147
|
+
for (let n = 2; n < NODE_COUNT; n++) {
|
|
148
|
+
const parent = NODE_PARENTS[n];
|
|
149
|
+
rotate(world[parent], REST_LOCAL[n], turned);
|
|
150
|
+
place[n][0] = place[parent][0] + turned[0];
|
|
151
|
+
place[n][1] = place[parent][1] + turned[1];
|
|
152
|
+
place[n][2] = place[parent][2] + turned[2];
|
|
153
|
+
}
|
|
154
|
+
for (let n = 0; n < NODE_COUNT; n++) {
|
|
155
|
+
const k = o + n * 7;
|
|
156
|
+
out[k] = place[n][0];
|
|
157
|
+
out[k + 1] = place[n][1];
|
|
158
|
+
out[k + 2] = place[n][2];
|
|
159
|
+
out[k + 3] = world[n][0];
|
|
160
|
+
out[k + 4] = world[n][1];
|
|
161
|
+
out[k + 5] = world[n][2];
|
|
162
|
+
out[k + 6] = world[n][3];
|
|
163
|
+
}
|
|
164
|
+
return out;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// The travel of the pelvis at each sample along engine x and y, with steady travel taken out of
|
|
168
|
+
// a clip that goes somewhere and the rest kept within ROOT_LIMIT of the spot.
|
|
169
|
+
export function rootOffsets(bodies) {
|
|
170
|
+
const count = bodies.length;
|
|
171
|
+
const first = bodies[0];
|
|
172
|
+
const last = bodies[count - 1];
|
|
173
|
+
// Engine x is three's x and engine y is three's minus z.
|
|
174
|
+
const endX = last[0] - first[0];
|
|
175
|
+
const endY = -(last[2] - first[2]);
|
|
176
|
+
const travels = Math.hypot(endX, endY) > DRIFT;
|
|
177
|
+
return bodies.map((p, i) => {
|
|
178
|
+
let x = p[0] - first[0];
|
|
179
|
+
let y = -(p[2] - first[2]);
|
|
180
|
+
if (travels) {
|
|
181
|
+
const u = count > 1 ? i / (count - 1) : 0;
|
|
182
|
+
x -= endX * u;
|
|
183
|
+
y -= endY * u;
|
|
184
|
+
}
|
|
185
|
+
const d = Math.hypot(x, y);
|
|
186
|
+
if (d > ROOT_LIMIT) {
|
|
187
|
+
x *= ROOT_LIMIT / d;
|
|
188
|
+
y *= ROOT_LIMIT / d;
|
|
189
|
+
}
|
|
190
|
+
return [x, y];
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// A clip of nodes from its samples, each the bones and pelvis of one moment as nodesFromBones
|
|
195
|
+
// takes them, FPS apart, the last at duration.
|
|
196
|
+
export function nodeClip(samples, rig, duration) {
|
|
197
|
+
const count = samples.length;
|
|
198
|
+
const frames = new Float32Array(count * PLAYER_FLOATS);
|
|
199
|
+
const offsets = rootOffsets(samples.map((s) => s.body));
|
|
200
|
+
samples.forEach((s, i) => nodesFromBones(s.bones, s.body, rig, offsets[i], frames, i * PLAYER_FLOATS));
|
|
201
|
+
return { duration: count > 1 ? duration : 0, count, frames };
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
const qa = [0, 0, 0, 1];
|
|
205
|
+
const qb = [0, 0, 0, 1];
|
|
206
|
+
const yaw = [0, 0, 0, 1];
|
|
207
|
+
const pose = new Float32Array(PLAYER_FLOATS);
|
|
208
|
+
|
|
209
|
+
// Writes the nodes of a clip at time t seconds into out at o, looping, standing at x, y and
|
|
210
|
+
// turned to heading, radians about engine z. With pin the pelvis keeps to the spot, and bounds,
|
|
211
|
+
// half the length and width of the pitch, keep the ground point inside the lines.
|
|
212
|
+
export function poseNodeClip(clip, t, out, o = 0, { x = 0, y = 0, heading = 0, pin = false, bounds = null } = {}) {
|
|
213
|
+
const span = clip.duration;
|
|
214
|
+
let time = Math.max(0, Number(t) || 0);
|
|
215
|
+
if (span > 0) {
|
|
216
|
+
time %= span;
|
|
217
|
+
}
|
|
218
|
+
const f = span > 0 ? (time / span) * (clip.count - 1) : 0;
|
|
219
|
+
const i0 = Math.min(clip.count - 1, Math.floor(f));
|
|
220
|
+
const i1 = Math.min(clip.count - 1, i0 + 1);
|
|
221
|
+
const w = f - i0;
|
|
222
|
+
const a = i0 * PLAYER_FLOATS;
|
|
223
|
+
const b = i1 * PLAYER_FLOATS;
|
|
224
|
+
const frames = clip.frames;
|
|
225
|
+
for (let n = 0; n < NODE_COUNT; n++) {
|
|
226
|
+
const k = n * 7;
|
|
227
|
+
for (let c = 0; c < 3; c++) {
|
|
228
|
+
pose[k + c] = frames[a + k + c] + (frames[b + k + c] - frames[a + k + c]) * w;
|
|
229
|
+
}
|
|
230
|
+
for (let c = 0; c < 4; c++) {
|
|
231
|
+
qa[c] = frames[a + k + 3 + c];
|
|
232
|
+
qb[c] = frames[b + k + 3 + c];
|
|
233
|
+
}
|
|
234
|
+
// The shorter way round, then a normalized blend, close enough a thirtieth of a second
|
|
235
|
+
// apart.
|
|
236
|
+
const dot = qa[0] * qb[0] + qa[1] * qb[1] + qa[2] * qb[2] + qa[3] * qb[3];
|
|
237
|
+
const s = dot < 0 ? -1 : 1;
|
|
238
|
+
for (let c = 0; c < 4; c++) {
|
|
239
|
+
qa[c] += (qb[c] * s - qa[c]) * w;
|
|
240
|
+
}
|
|
241
|
+
normalize(qa);
|
|
242
|
+
for (let c = 0; c < 4; c++) {
|
|
243
|
+
pose[k + 3 + c] = qa[c];
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
if (pin) {
|
|
247
|
+
const px = pose[0];
|
|
248
|
+
const py = pose[1];
|
|
249
|
+
for (let n = 0; n < NODE_COUNT; n++) {
|
|
250
|
+
pose[n * 7] -= px;
|
|
251
|
+
pose[n * 7 + 1] -= py;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
yaw[2] = Math.sin(heading / 2);
|
|
255
|
+
yaw[3] = Math.cos(heading / 2);
|
|
256
|
+
const cos = Math.cos(heading);
|
|
257
|
+
const sin = Math.sin(heading);
|
|
258
|
+
let dx = x;
|
|
259
|
+
let dy = y;
|
|
260
|
+
if (bounds) {
|
|
261
|
+
const gx = x + cos * pose[0] - sin * pose[1];
|
|
262
|
+
const gy = y + sin * pose[0] + cos * pose[1];
|
|
263
|
+
dx += Math.max(-bounds[0], Math.min(bounds[0], gx)) - gx;
|
|
264
|
+
dy += Math.max(-bounds[1], Math.min(bounds[1], gy)) - gy;
|
|
265
|
+
}
|
|
266
|
+
for (let n = 0; n < NODE_COUNT; n++) {
|
|
267
|
+
const k = n * 7;
|
|
268
|
+
const px = pose[k];
|
|
269
|
+
const py = pose[k + 1];
|
|
270
|
+
out[o + k] = dx + cos * px - sin * py;
|
|
271
|
+
out[o + k + 1] = dy + sin * px + cos * py;
|
|
272
|
+
out[o + k + 2] = pose[k + 2];
|
|
273
|
+
qb[0] = pose[k + 3];
|
|
274
|
+
qb[1] = pose[k + 4];
|
|
275
|
+
qb[2] = pose[k + 5];
|
|
276
|
+
qb[3] = pose[k + 6];
|
|
277
|
+
multiply(yaw, qb, qa);
|
|
278
|
+
out[o + k + 3] = qa[0];
|
|
279
|
+
out[o + k + 4] = qa[1];
|
|
280
|
+
out[o + k + 5] = qa[2];
|
|
281
|
+
out[o + k + 6] = qa[3];
|
|
282
|
+
}
|
|
283
|
+
return out;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
// The uploaded clips that the page has loaded, by the names celebrations play them under, each
|
|
287
|
+
// with its clip of nodes and the name of its animation.
|
|
288
|
+
const uploads = new Map();
|
|
289
|
+
|
|
290
|
+
export function registerUpload(name, clip, label) {
|
|
291
|
+
uploads.set(name, { clip, label });
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
// Forgets every loaded clip whose name ends with suffix.
|
|
295
|
+
export function forgetUploads(suffix) {
|
|
296
|
+
for (const name of [...uploads.keys()]) {
|
|
297
|
+
if (name.endsWith(suffix)) {
|
|
298
|
+
uploads.delete(name);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
export function hasUpload(name) {
|
|
304
|
+
return typeof name === 'string' && uploads.has(name);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
export function uploadDuration(name) {
|
|
308
|
+
const entry = uploads.get(name);
|
|
309
|
+
return entry ? entry.clip.duration : 0;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
export function uploadLabel(name) {
|
|
313
|
+
const entry = uploads.get(name);
|
|
314
|
+
return entry ? entry.label : null;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
// Poses a loaded clip as poseNodeClip does, false for a name the page has not loaded.
|
|
318
|
+
export function poseUpload(name, t, out, o, options) {
|
|
319
|
+
const entry = uploads.get(name);
|
|
320
|
+
if (!entry) {
|
|
321
|
+
return false;
|
|
322
|
+
}
|
|
323
|
+
poseNodeClip(entry.clip, t, out, o, options);
|
|
324
|
+
return true;
|
|
325
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
// Copyright 2026 The cuju Authors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
// Shirt numbers on the backs of player models other than GRF's, KayKit's characters and a team's
|
|
5
|
+
// own model. Each number is a small square of the atlas of numbers that rides the model's chest
|
|
6
|
+
// bone, placed once per model from its torso in GRF's rest pose, as number-patch.js measures it.
|
|
7
|
+
// A model whose torso is too small, or that a team lists among hidden_numbers, shows none.
|
|
8
|
+
|
|
9
|
+
import * as THREE from 'three';
|
|
10
|
+
import { backPatch, numberCell, numbersShown } from './number-patch.js';
|
|
11
|
+
|
|
12
|
+
// The patch of each rig, measured once, or null for a rig without room for a number.
|
|
13
|
+
const patches = new WeakMap();
|
|
14
|
+
|
|
15
|
+
// Where a number sits on a rig, as the index of the bone it rides, the bone mapped to GRF's
|
|
16
|
+
// middle node, else its body node, and the patch's matrix in that bone's frame. The torso is the
|
|
17
|
+
// bones mapped to the body and middle nodes with the bones below them that no other node moves,
|
|
18
|
+
// such as a spine between the two, so a cape or a pack on the back counts as the back.
|
|
19
|
+
function measure(rig, restNodes) {
|
|
20
|
+
if (patches.has(rig)) {
|
|
21
|
+
return patches.get(rig);
|
|
22
|
+
}
|
|
23
|
+
let patch = null;
|
|
24
|
+
try {
|
|
25
|
+
patch = measureRig(rig, restNodes);
|
|
26
|
+
} catch (err) {
|
|
27
|
+
console.warn('shirt number not placed', err);
|
|
28
|
+
}
|
|
29
|
+
patches.set(rig, patch);
|
|
30
|
+
return patch;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function measureRig(rig, restNodes) {
|
|
34
|
+
let bone = rig.bones.findIndex((b) => b.node === 2);
|
|
35
|
+
if (bone < 0) {
|
|
36
|
+
bone = rig.bones.findIndex((b) => b.node === 1);
|
|
37
|
+
}
|
|
38
|
+
if (bone < 0) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
const torso = rig.bones.map((b, j) => {
|
|
42
|
+
for (let i = j; i >= 0; i = rig.bones[i].parent) {
|
|
43
|
+
if (rig.bones[i].node >= 0) {
|
|
44
|
+
return rig.bones[i].node === 1 || rig.bones[i].node === 2;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return false;
|
|
48
|
+
});
|
|
49
|
+
const inst = rig.instantiate();
|
|
50
|
+
try {
|
|
51
|
+
rig.pose(inst, restNodes, 0);
|
|
52
|
+
const index = new Map(inst.bones.map((b, j) => [b, j]));
|
|
53
|
+
const points = [];
|
|
54
|
+
const v = new THREE.Vector4();
|
|
55
|
+
const w = new THREE.Vector4();
|
|
56
|
+
const m = new THREE.Matrix4();
|
|
57
|
+
inst.root.traverse((obj) => {
|
|
58
|
+
if (!obj.isSkinnedMesh) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const g = obj.geometry;
|
|
62
|
+
const pos = g.attributes.position;
|
|
63
|
+
const si = g.attributes.skinIndex;
|
|
64
|
+
const sw = g.attributes.skinWeight;
|
|
65
|
+
if (!pos || !si || !sw) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
for (let i = 0; i < pos.count; i++) {
|
|
69
|
+
let best = 0;
|
|
70
|
+
for (let c = 1; c < 4; c++) {
|
|
71
|
+
if (sw.getComponent(i, c) > sw.getComponent(i, best)) {
|
|
72
|
+
best = c;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
const j = index.get(obj.skeleton.bones[si.getComponent(i, best)]);
|
|
76
|
+
if (j === undefined || !torso[j]) {
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
v.set(pos.getX(i), pos.getY(i), pos.getZ(i), 1).applyMatrix4(obj.bindMatrix);
|
|
80
|
+
w.set(0, 0, 0, 0);
|
|
81
|
+
for (let c = 0; c < 4; c++) {
|
|
82
|
+
const weight = sw.getComponent(i, c);
|
|
83
|
+
if (weight) {
|
|
84
|
+
const b = si.getComponent(i, c);
|
|
85
|
+
m.multiplyMatrices(obj.skeleton.bones[b].matrixWorld, obj.skeleton.boneInverses[b]);
|
|
86
|
+
w.addScaledVector(v.clone().applyMatrix4(m), weight);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
points.push(w.x, w.y, w.z);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
const found = backPatch(points);
|
|
93
|
+
if (!found) {
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
const place = new THREE.Matrix4().compose(
|
|
97
|
+
new THREE.Vector3(found.x, found.y, found.z), new THREE.Quaternion(),
|
|
98
|
+
new THREE.Vector3(found.size, found.size, found.size));
|
|
99
|
+
return { bone, local: inst.world[bone].clone().invert().multiply(place) };
|
|
100
|
+
} finally {
|
|
101
|
+
rig.release(inst);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// The numbers of one set of posed models. Add gives a player a number, update follows the bones
|
|
106
|
+
// after every pose, and dispose frees the meshes and materials, never the shared atlas.
|
|
107
|
+
export class RigNumbers {
|
|
108
|
+
constructor(parent, atlas, restNodes) {
|
|
109
|
+
this.group = new THREE.Group();
|
|
110
|
+
parent.add(this.group);
|
|
111
|
+
this.atlas = atlas;
|
|
112
|
+
this.restNodes = restNodes;
|
|
113
|
+
this.materials = new Map();
|
|
114
|
+
this.items = [];
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Gives a posed model a number on its back, when the team shows numbers on that model and
|
|
118
|
+
// its torso holds one. Entry is the model's player, its rig and instance.
|
|
119
|
+
add(entry, style, model, number, color) {
|
|
120
|
+
if (!numbersShown(style, model)) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
const patch = measure(entry.rig, this.restNodes);
|
|
124
|
+
if (!patch) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
const key = color.getHexString();
|
|
128
|
+
if (!this.materials.has(key)) {
|
|
129
|
+
this.materials.set(key, new THREE.MeshStandardMaterial({
|
|
130
|
+
map: this.atlas, color, transparent: true, alphaTest: 0.4, roughness: 0.6,
|
|
131
|
+
polygonOffset: true, polygonOffsetFactor: -2, depthWrite: false,
|
|
132
|
+
}));
|
|
133
|
+
}
|
|
134
|
+
const geometry = new THREE.PlaneGeometry(1, 1);
|
|
135
|
+
// The square faces minus z, the back, and reads from behind.
|
|
136
|
+
geometry.rotateY(Math.PI);
|
|
137
|
+
const [u0, v0, u1, v1] = numberCell(number);
|
|
138
|
+
const uv = geometry.attributes.uv;
|
|
139
|
+
for (let i = 0; i < uv.count; i++) {
|
|
140
|
+
uv.setXY(i, uv.getX(i) ? u1 : u0, uv.getY(i) ? v1 : v0);
|
|
141
|
+
}
|
|
142
|
+
const mesh = new THREE.Mesh(geometry, this.materials.get(key));
|
|
143
|
+
// Skinning places the models in the world from their bones alone, and so does the number.
|
|
144
|
+
mesh.matrixAutoUpdate = false;
|
|
145
|
+
mesh.matrixWorldAutoUpdate = false;
|
|
146
|
+
mesh.frustumCulled = false;
|
|
147
|
+
mesh.visible = false;
|
|
148
|
+
this.group.add(mesh);
|
|
149
|
+
this.items.push({ entry, mesh, bone: patch.bone, local: patch.local });
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// Follows each model's chest as last posed, and hides the numbers of hidden models.
|
|
153
|
+
update() {
|
|
154
|
+
for (const item of this.items) {
|
|
155
|
+
const instance = item.entry.instance;
|
|
156
|
+
item.mesh.visible = instance.root.visible;
|
|
157
|
+
if (item.mesh.visible) {
|
|
158
|
+
item.mesh.matrixWorld.multiplyMatrices(instance.world[item.bone], item.local);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
dispose() {
|
|
164
|
+
this.group.removeFromParent();
|
|
165
|
+
for (const item of this.items) {
|
|
166
|
+
item.mesh.geometry.dispose();
|
|
167
|
+
}
|
|
168
|
+
for (const material of this.materials.values()) {
|
|
169
|
+
material.dispose();
|
|
170
|
+
}
|
|
171
|
+
this.items = [];
|
|
172
|
+
this.materials.clear();
|
|
173
|
+
}
|
|
174
|
+
}
|