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,609 @@
|
|
|
1
|
+
// Copyright 2026 The cuju Authors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
// The referee's decisions as on television. When a foul, a card or an offside stops play, the
|
|
5
|
+
// view rewinds a few seconds and replays the moment in slow motion from a clear angle, with rings
|
|
6
|
+
// under the offender and the victim, an arrow of the challenge, a frozen flash on the contact
|
|
7
|
+
// and a banner of the decision, or the offside line at the pass. A card brings the referee to the
|
|
8
|
+
// offender with the card raised and a lower third of the card, then the restart follows.
|
|
9
|
+
|
|
10
|
+
import * as THREE from 'three';
|
|
11
|
+
import { NODES_FLOAT, PLAYER_FLOATS, isCut } from '../recording/format.js';
|
|
12
|
+
import { teamNames } from './hud.js';
|
|
13
|
+
import { teamName } from '../core/names.js';
|
|
14
|
+
import { HALF_H, HALF_W } from '../world/pitch.js';
|
|
15
|
+
import {
|
|
16
|
+
WIPE, blendPose, clamp, headingOf, headingTo, namedPose, rgb, showPointer, smooth,
|
|
17
|
+
} from './transition.js';
|
|
18
|
+
import { t, tn } from '../core/i18n.js';
|
|
19
|
+
|
|
20
|
+
const STOP = 0.8;
|
|
21
|
+
const FREEZE = 1.9;
|
|
22
|
+
const CARD = 3.4;
|
|
23
|
+
// Frames of the replay before the contact, and those of them shown slowly.
|
|
24
|
+
const LEAD = 32;
|
|
25
|
+
const SLOW_FRAMES = 9;
|
|
26
|
+
const SLOW = 0.35;
|
|
27
|
+
|
|
28
|
+
const COLORS = { foul: '#ff8a1f', yellow: '#ffd400', red: '#e0242b', offside: '#35a7ff' };
|
|
29
|
+
const TITLES = {
|
|
30
|
+
foul: t('decisions.title.foul'), yellow: t('decisions.title.yellow'), red: t('decisions.title.red'),
|
|
31
|
+
offside: t('decisions.title.offside'),
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
function el(tag, cls, parent, text) {
|
|
35
|
+
const e = document.createElement(tag);
|
|
36
|
+
if (cls) {
|
|
37
|
+
e.className = cls;
|
|
38
|
+
}
|
|
39
|
+
if (text != null) {
|
|
40
|
+
e.textContent = text;
|
|
41
|
+
}
|
|
42
|
+
if (parent) {
|
|
43
|
+
parent.appendChild(e);
|
|
44
|
+
}
|
|
45
|
+
return e;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function flatMaterial(color, opacity) {
|
|
49
|
+
return new THREE.MeshBasicMaterial({
|
|
50
|
+
color, transparent: true, opacity, depthWrite: false, side: THREE.DoubleSide,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// The marks drawn on the pitch, rings, an arrow and the offside lines, all flat on the grass.
|
|
55
|
+
class Telestration {
|
|
56
|
+
constructor(scene) {
|
|
57
|
+
this.group = new THREE.Group();
|
|
58
|
+
this.group.visible = false;
|
|
59
|
+
this.group.renderOrder = 3;
|
|
60
|
+
scene.add(this.group);
|
|
61
|
+
const ring = new THREE.RingGeometry(0.72, 0.92, 48);
|
|
62
|
+
ring.rotateX(-Math.PI / 2);
|
|
63
|
+
const disc = new THREE.CircleGeometry(0.72, 40);
|
|
64
|
+
disc.rotateX(-Math.PI / 2);
|
|
65
|
+
this.rings = [0, 1].map(() => {
|
|
66
|
+
const g = new THREE.Group();
|
|
67
|
+
const r = new THREE.Mesh(ring, flatMaterial(0xffffff, 0.95));
|
|
68
|
+
const d = new THREE.Mesh(disc, flatMaterial(0xffffff, 0.22));
|
|
69
|
+
r.renderOrder = 3;
|
|
70
|
+
d.renderOrder = 3;
|
|
71
|
+
g.add(r, d);
|
|
72
|
+
this.group.add(g);
|
|
73
|
+
return g;
|
|
74
|
+
});
|
|
75
|
+
const plane = new THREE.PlaneGeometry(1, 1);
|
|
76
|
+
plane.rotateX(-Math.PI / 2);
|
|
77
|
+
plane.translate(0.5, 0, 0);
|
|
78
|
+
this.shaft = new THREE.Mesh(plane, flatMaterial(0xffffff, 0.9));
|
|
79
|
+
const head = new THREE.BufferGeometry();
|
|
80
|
+
head.setAttribute('position', new THREE.Float32BufferAttribute([0, 0, -0.55, 0.9, 0, 0, 0, 0, 0.55], 3));
|
|
81
|
+
this.head = new THREE.Mesh(head, flatMaterial(0xffffff, 0.95));
|
|
82
|
+
this.arrow = new THREE.Group();
|
|
83
|
+
this.arrow.add(this.shaft, this.head);
|
|
84
|
+
this.shaft.renderOrder = 3;
|
|
85
|
+
this.head.renderOrder = 3;
|
|
86
|
+
this.group.add(this.arrow);
|
|
87
|
+
const lineGeo = new THREE.PlaneGeometry(1, 1);
|
|
88
|
+
lineGeo.rotateX(-Math.PI / 2);
|
|
89
|
+
this.lines = [0, 1].map(() => {
|
|
90
|
+
const m = new THREE.Mesh(lineGeo, flatMaterial(0xffffff, 0.92));
|
|
91
|
+
m.renderOrder = 3;
|
|
92
|
+
this.group.add(m);
|
|
93
|
+
return m;
|
|
94
|
+
});
|
|
95
|
+
this.shade = new THREE.Mesh(lineGeo, flatMaterial(0x35a7ff, 0.16));
|
|
96
|
+
this.shade.renderOrder = 2;
|
|
97
|
+
this.group.add(this.shade);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
clear() {
|
|
101
|
+
this.group.visible = false;
|
|
102
|
+
for (const r of this.rings) {
|
|
103
|
+
r.visible = false;
|
|
104
|
+
}
|
|
105
|
+
this.arrow.visible = false;
|
|
106
|
+
this.lines[0].visible = false;
|
|
107
|
+
this.lines[1].visible = false;
|
|
108
|
+
this.shade.visible = false;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
ring(i, x, y, color, pulse) {
|
|
112
|
+
const g = this.rings[i];
|
|
113
|
+
g.visible = true;
|
|
114
|
+
this.group.visible = true;
|
|
115
|
+
g.position.set(x, 0.035 + i * 0.002, -y);
|
|
116
|
+
g.scale.setScalar(1 + 0.08 * Math.sin(pulse * 6));
|
|
117
|
+
g.children[0].material.color.set(color);
|
|
118
|
+
g.children[1].material.color.set(color);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// An arrow on the grass from a to b, drawn to fraction f of its length.
|
|
122
|
+
arrowTo(ax, ay, bx, by, f, color) {
|
|
123
|
+
const len = Math.hypot(bx - ax, by - ay) * f;
|
|
124
|
+
if (len < 0.3) {
|
|
125
|
+
this.arrow.visible = false;
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
this.group.visible = true;
|
|
129
|
+
this.arrow.visible = true;
|
|
130
|
+
const angle = Math.atan2(by - ay, bx - ax);
|
|
131
|
+
this.arrow.position.set(ax, 0.04, -ay);
|
|
132
|
+
this.arrow.rotation.set(0, angle, 0);
|
|
133
|
+
const shaft = Math.max(0.1, len - 0.85);
|
|
134
|
+
this.shaft.scale.set(shaft, 1, 0.32);
|
|
135
|
+
this.head.position.set(shaft - 0.05, 0, 0);
|
|
136
|
+
this.shaft.material.color.set(color);
|
|
137
|
+
this.head.material.color.set(color);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// The offside lines across the pitch, the defence at lineX and the attacker at attackX.
|
|
141
|
+
offside(lineX, attackX, attack, f) {
|
|
142
|
+
this.group.visible = true;
|
|
143
|
+
const len = HALF_H * 2 + 2;
|
|
144
|
+
const [defence, attacker] = this.lines;
|
|
145
|
+
defence.visible = true;
|
|
146
|
+
defence.position.set(lineX, 0.03, 0);
|
|
147
|
+
defence.scale.set(0.16, 1, len * f);
|
|
148
|
+
defence.material.color.set(COLORS.offside);
|
|
149
|
+
attacker.visible = true;
|
|
150
|
+
attacker.position.set(attackX, 0.031, 0);
|
|
151
|
+
attacker.scale.set(0.12, 1, len * f);
|
|
152
|
+
attacker.material.color.set(COLORS.red);
|
|
153
|
+
// The ground beyond the defence, towards the goal the attacker runs at.
|
|
154
|
+
const goal = attack * HALF_W;
|
|
155
|
+
this.shade.visible = true;
|
|
156
|
+
this.shade.position.set((lineX + goal) / 2, 0.025, 0);
|
|
157
|
+
this.shade.scale.set(Math.abs(goal - lineX), 1, len * f);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
dispose() {
|
|
161
|
+
this.group.removeFromParent();
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export class Decisions {
|
|
166
|
+
constructor(app, transitions) {
|
|
167
|
+
this.app = app;
|
|
168
|
+
this.tr = transitions;
|
|
169
|
+
transitions.decisions = this;
|
|
170
|
+
this.marks = new Telestration(app.view.scene);
|
|
171
|
+
const watch = document.getElementById('watch');
|
|
172
|
+
this.flash = el('div', 'decision-flash', watch);
|
|
173
|
+
this.banner = el('div', 'decision-banner', watch);
|
|
174
|
+
this.bannerLabel = el('div', 'db-label', this.banner);
|
|
175
|
+
const body = el('div', 'db-body', this.banner);
|
|
176
|
+
this.bannerNumber = el('b', 'db-number', body);
|
|
177
|
+
const text = el('div', 'db-text', body);
|
|
178
|
+
this.bannerName = el('div', 'db-name', text);
|
|
179
|
+
this.bannerTeam = el('div', 'db-team', text);
|
|
180
|
+
this.third = el('div', 'card-third', watch);
|
|
181
|
+
const card = el('div', 'ct-card', this.third);
|
|
182
|
+
this.cardYellow = el('i', 'ct-yellow', card);
|
|
183
|
+
this.cardRed = el('i', 'ct-red', card);
|
|
184
|
+
this.thirdBadge = el('b', 'ct-badge', this.third);
|
|
185
|
+
const ct = el('div', 'ct-text', this.third);
|
|
186
|
+
this.thirdKind = el('div', 'ct-kind', ct);
|
|
187
|
+
this.thirdName = el('div', 'ct-name', ct);
|
|
188
|
+
this.thirdTeam = el('div', 'ct-team', ct);
|
|
189
|
+
this.thirdMinute = el('div', 'ct-minute', this.third);
|
|
190
|
+
this.hint = el('button', 'decision-skip', watch);
|
|
191
|
+
this.hint.replaceChildren(...tn('decisions.skip'));
|
|
192
|
+
this.hint.type = 'button';
|
|
193
|
+
this.hint.addEventListener('click', () => this.tr.skip());
|
|
194
|
+
// A click on the view skips a decision's replay.
|
|
195
|
+
document.getElementById('stage').addEventListener('click', () => {
|
|
196
|
+
if (this.tr.seq && this.tr.seq.decision) {
|
|
197
|
+
this.tr.skip();
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
this.tmp = new Float32Array(PLAYER_FLOATS);
|
|
201
|
+
this.v = new THREE.Vector3();
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// Name, number and team of player k, from the roster of the team's style when it has one.
|
|
205
|
+
info(k) {
|
|
206
|
+
const app = this.app;
|
|
207
|
+
const header = app.source.header;
|
|
208
|
+
const p = header.players[k] || { team: 0, index: 0 };
|
|
209
|
+
const style = app.styles ? app.styles[p.team] : null;
|
|
210
|
+
const roster = style && style.players ? style.players[p.index] : null;
|
|
211
|
+
const team = header.teams[p.team] || {};
|
|
212
|
+
return {
|
|
213
|
+
team: p.team,
|
|
214
|
+
number: roster && roster.number != null ? roster.number : (p.goalkeeper ? 1 : p.index + 1),
|
|
215
|
+
name: roster && roster.name ? roster.name : (p.goalkeeper ? t('show.player.goalkeeper') : t('show.player.unnamed', { number: p.index + 1 })),
|
|
216
|
+
teamName: teamNames(header)[p.team],
|
|
217
|
+
badge: (style && style.badge) || (teamName(team) || '?').slice(0, 1).toUpperCase(),
|
|
218
|
+
color: style ? rgb(style.kit.primary) : (p.team ? '#2a56b8' : '#b3262e'),
|
|
219
|
+
trim: style ? rgb(style.kit.secondary) : '#ffffff',
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// The scenes of a decision. Play stops with the whistle, the replay runs to the contact or
|
|
224
|
+
// the pass and freezes on it, a card is shown, then the restart.
|
|
225
|
+
scenes(seq) {
|
|
226
|
+
const tr = this.tr;
|
|
227
|
+
const app = this.app;
|
|
228
|
+
const d = seq.ev.decision;
|
|
229
|
+
const tl = app.timeline;
|
|
230
|
+
const store = tl.store;
|
|
231
|
+
const sps = tl.sps;
|
|
232
|
+
seq.decision = d;
|
|
233
|
+
const T = seq.T;
|
|
234
|
+
const C = clamp(d.contact, store.first, T);
|
|
235
|
+
// The replay starts a few seconds back, never across a cut or the restart before.
|
|
236
|
+
let start = C;
|
|
237
|
+
const earlier = tr.events.filter((e) => e.index < T && e !== seq.ev).pop();
|
|
238
|
+
const floor = Math.max(store.first, earlier ? earlier.index + 1 : store.first);
|
|
239
|
+
while (start > floor && C - start < LEAD) {
|
|
240
|
+
const a = store.get(start - 1);
|
|
241
|
+
const b = store.get(start);
|
|
242
|
+
if (!a || !b || isCut(a, b)) {
|
|
243
|
+
break;
|
|
244
|
+
}
|
|
245
|
+
start--;
|
|
246
|
+
}
|
|
247
|
+
const slowFrom = Math.max(start, C - SLOW_FRAMES);
|
|
248
|
+
const fast = (slowFrom - start) / sps;
|
|
249
|
+
const slow = (C - slowFrom) / (sps * SLOW);
|
|
250
|
+
const replay = fast + slow;
|
|
251
|
+
seq.replay = { start, C, slowFrom, fast };
|
|
252
|
+
if (d.type === 'offside') {
|
|
253
|
+
this.prepareOffside(seq);
|
|
254
|
+
} else {
|
|
255
|
+
this.prepareFoul(seq);
|
|
256
|
+
}
|
|
257
|
+
const kind = d.type === 'red' && d.secondYellow ? 'second' : d.type;
|
|
258
|
+
const scenes = [];
|
|
259
|
+
scenes.push({
|
|
260
|
+
name: 'stop', dur: STOP + WIPE / 2,
|
|
261
|
+
at: () => T - 1,
|
|
262
|
+
dress: (pose, l) => tr.dressStage(pose, seq, l, 0.25),
|
|
263
|
+
enter: () => {
|
|
264
|
+
tr.whistle(d.type === 'red' || d.type === 'yellow' ? [0.25, 0.5] : [0.3]);
|
|
265
|
+
this.hint.classList.add('show');
|
|
266
|
+
showPointer(true);
|
|
267
|
+
},
|
|
268
|
+
});
|
|
269
|
+
scenes.push({
|
|
270
|
+
name: 'replay', dur: WIPE / 2 + replay, wipe: true, wipeLabel: 'Replay',
|
|
271
|
+
at: (s, l) => {
|
|
272
|
+
const u = Math.max(0, l - WIPE / 2);
|
|
273
|
+
if (u < fast) {
|
|
274
|
+
return start + u * sps;
|
|
275
|
+
}
|
|
276
|
+
return Math.min(C, slowFrom + (u - fast) * sps * SLOW);
|
|
277
|
+
},
|
|
278
|
+
dress: (pose, l, s, sample) => {
|
|
279
|
+
this.keepVisible(seq, sample);
|
|
280
|
+
this.dressReplay(pose, seq, -1);
|
|
281
|
+
},
|
|
282
|
+
enter: () => {
|
|
283
|
+
app.hud.setReplay(true);
|
|
284
|
+
seq.replayBadge = true;
|
|
285
|
+
tr.takeCamera(this.replayShot(seq, null), true);
|
|
286
|
+
},
|
|
287
|
+
});
|
|
288
|
+
scenes.push({
|
|
289
|
+
name: 'freeze', dur: FREEZE + WIPE / 2,
|
|
290
|
+
at: () => C,
|
|
291
|
+
dress: (pose, l, s, sample) => {
|
|
292
|
+
this.keepVisible(seq, sample);
|
|
293
|
+
this.dressReplay(pose, seq, l);
|
|
294
|
+
},
|
|
295
|
+
enter: () => this.showBanner(d, kind),
|
|
296
|
+
// The flash follows the sequence's clock, so a pause or the speed holds it too, and
|
|
297
|
+
// reduced motion leaves it out.
|
|
298
|
+
update: (s, l) => {
|
|
299
|
+
this.flash.style.opacity = app.reducedMotion ? '0' : (0.85 * (1 - smooth(l / 0.5))).toFixed(3);
|
|
300
|
+
},
|
|
301
|
+
exit: () => {
|
|
302
|
+
this.flash.style.opacity = '0';
|
|
303
|
+
this.hideBanner();
|
|
304
|
+
},
|
|
305
|
+
});
|
|
306
|
+
if (d.type === 'yellow' || d.type === 'red') {
|
|
307
|
+
const color = d.type === 'red' ? 'red' : 'yellow';
|
|
308
|
+
scenes.push({
|
|
309
|
+
name: 'card', dur: WIPE / 2 + CARD + WIPE / 2, wipe: true, wipeLabel: TITLES[kind === 'second' ? 'red' : d.type],
|
|
310
|
+
at: () => T,
|
|
311
|
+
dress: (pose, l, s, sample) => {
|
|
312
|
+
this.keepVisible(seq, sample);
|
|
313
|
+
this.dressCard(pose, seq, l, color);
|
|
314
|
+
},
|
|
315
|
+
enter: () => {
|
|
316
|
+
this.marks.clear();
|
|
317
|
+
app.hud.setReplay(false);
|
|
318
|
+
seq.replayBadge = false;
|
|
319
|
+
this.prepareCard(seq);
|
|
320
|
+
tr.takeCamera(seq.card.shot, true);
|
|
321
|
+
},
|
|
322
|
+
update: (s, l) => {
|
|
323
|
+
if (l > WIPE / 2 + 0.9 && !seq.thirdShown) {
|
|
324
|
+
seq.thirdShown = true;
|
|
325
|
+
this.showThird(d, kind, store.get(T));
|
|
326
|
+
}
|
|
327
|
+
},
|
|
328
|
+
exit: () => this.hideThird(),
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
const setup = tr.setupScene(seq);
|
|
332
|
+
const enter = setup.enter;
|
|
333
|
+
setup.enter = () => {
|
|
334
|
+
this.marks.clear();
|
|
335
|
+
this.hint.classList.remove('show');
|
|
336
|
+
showPointer(false);
|
|
337
|
+
app.hud.setReplay(false);
|
|
338
|
+
seq.replayBadge = false;
|
|
339
|
+
enter();
|
|
340
|
+
};
|
|
341
|
+
scenes.push(setup);
|
|
342
|
+
return scenes;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
end(seq) {
|
|
346
|
+
this.flash.style.opacity = '0';
|
|
347
|
+
this.marks.clear();
|
|
348
|
+
this.hideBanner();
|
|
349
|
+
this.hideThird();
|
|
350
|
+
if (this.hint.classList.contains('show')) {
|
|
351
|
+
showPointer(false);
|
|
352
|
+
}
|
|
353
|
+
this.hint.classList.remove('show');
|
|
354
|
+
if (seq && seq.replayBadge) {
|
|
355
|
+
this.app.hud.setReplay(false);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
// A player sent off leaves the frames at the call, yet the replay and the card show him.
|
|
360
|
+
// The sample's frame is swapped for a copy that keeps him on the pitch, which the page
|
|
361
|
+
// reads after the hooks, so the stored frames stay as they are.
|
|
362
|
+
keepVisible(seq, sample) {
|
|
363
|
+
const d = seq.decision;
|
|
364
|
+
const f = sample && sample.a;
|
|
365
|
+
if (!f) {
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
const missing = [d.offender, d.victim].filter((k) => k >= 0 && !(f.playerFlags[k] & 1));
|
|
369
|
+
if (!missing.length) {
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
if (!seq.shown || seq.shown.from !== f) {
|
|
373
|
+
const flags = f.playerFlags.slice();
|
|
374
|
+
for (const k of missing) {
|
|
375
|
+
flags[k] |= 1;
|
|
376
|
+
}
|
|
377
|
+
seq.shown = { from: f, frame: { ...f, playerFlags: flags } };
|
|
378
|
+
}
|
|
379
|
+
sample.a = seq.shown.frame;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
// Foul replays.
|
|
383
|
+
|
|
384
|
+
prepareFoul(seq) {
|
|
385
|
+
const d = seq.decision;
|
|
386
|
+
const store = this.app.timeline.store;
|
|
387
|
+
const C = seq.replay.C;
|
|
388
|
+
const pos = (j, k) => {
|
|
389
|
+
const f = store.get(j);
|
|
390
|
+
if (!f || k < 0) {
|
|
391
|
+
return null;
|
|
392
|
+
}
|
|
393
|
+
const o = NODES_FLOAT + k * PLAYER_FLOATS;
|
|
394
|
+
return [f.data[o], f.data[o + 1]];
|
|
395
|
+
};
|
|
396
|
+
const from = pos(Math.max(seq.replay.start, C - 8), d.offender);
|
|
397
|
+
const to = pos(C, d.victim) || pos(C, d.offender);
|
|
398
|
+
seq.arrow = from && to ? { from, to } : null;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
// Offside replays, the line of the second last defender at the pass.
|
|
402
|
+
prepareOffside(seq) {
|
|
403
|
+
const app = this.app;
|
|
404
|
+
const d = seq.decision;
|
|
405
|
+
const header = app.source.header;
|
|
406
|
+
const f = app.timeline.store.get(seq.replay.C);
|
|
407
|
+
const team = header.players[d.offender].team;
|
|
408
|
+
const attack = team === 0 ? 1 : -1;
|
|
409
|
+
const depths = [];
|
|
410
|
+
for (let k = 0; k < header.players.length; k++) {
|
|
411
|
+
if (header.players[k].team !== team && (f.playerFlags[k] & 1)) {
|
|
412
|
+
depths.push(f.data[NODES_FLOAT + k * PLAYER_FLOATS] * attack);
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
depths.sort((a, b) => b - a);
|
|
416
|
+
const second = Math.min(HALF_W, Math.max(0, depths.length > 1 ? depths[1] : 0, f.data[8] * attack));
|
|
417
|
+
const o = NODES_FLOAT + d.offender * PLAYER_FLOATS;
|
|
418
|
+
seq.offside = { lineX: second * attack, attackX: f.data[o], attackY: f.data[o + 1], attack };
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
// A clear angle of the challenge, from the main stand side and low, or along the offside
|
|
422
|
+
// line so it stands upright on the screen.
|
|
423
|
+
replayShot(seq, mid) {
|
|
424
|
+
if (seq.offside) {
|
|
425
|
+
const s = seq.offside;
|
|
426
|
+
// On the line itself, high on the near side, with the attacker in the middle.
|
|
427
|
+
const near = Math.min(HALF_H + 14, -s.attackY + 26);
|
|
428
|
+
return {
|
|
429
|
+
pos: new THREE.Vector3(s.lineX, 11, near),
|
|
430
|
+
target: new THREE.Vector3(s.lineX, 0.4, -s.attackY - 2),
|
|
431
|
+
fov: 40, rate: 2,
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
const m = mid || this.midpoint(seq, null);
|
|
435
|
+
return {
|
|
436
|
+
pos: new THREE.Vector3(m.x - 4, 5.6, m.z + 16),
|
|
437
|
+
target: new THREE.Vector3(m.x, 0.8, m.z),
|
|
438
|
+
fov: 30, rate: 2.5,
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
// The middle of the offender and the victim in three's frame, from the pose or the contact.
|
|
443
|
+
midpoint(seq, pose) {
|
|
444
|
+
const d = seq.decision;
|
|
445
|
+
const ks = [d.offender, d.victim].filter((k) => k >= 0);
|
|
446
|
+
const out = new THREE.Vector3();
|
|
447
|
+
if (!ks.length) {
|
|
448
|
+
return out;
|
|
449
|
+
}
|
|
450
|
+
for (const k of ks) {
|
|
451
|
+
if (pose) {
|
|
452
|
+
out.x += pose.nodes[k * PLAYER_FLOATS];
|
|
453
|
+
out.z -= pose.nodes[k * PLAYER_FLOATS + 1];
|
|
454
|
+
} else {
|
|
455
|
+
const f = this.app.timeline.store.get(seq.replay.C);
|
|
456
|
+
out.x += f.data[NODES_FLOAT + k * PLAYER_FLOATS];
|
|
457
|
+
out.z -= f.data[NODES_FLOAT + k * PLAYER_FLOATS + 1];
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
return out.divideScalar(ks.length);
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
// The marks during the replay, the arrow grows over the last second before the contact. A
|
|
464
|
+
// frozen time of zero or more is the time since the freeze on the contact.
|
|
465
|
+
dressReplay(pose, seq, frozenFor) {
|
|
466
|
+
const frozen = frozenFor >= 0;
|
|
467
|
+
const d = seq.decision;
|
|
468
|
+
const app = this.app;
|
|
469
|
+
const tl = app.timeline;
|
|
470
|
+
const color = COLORS[d.type] || COLORS.foul;
|
|
471
|
+
const nodes = pose.nodes;
|
|
472
|
+
// The rings pulse, and hold their size under reduced motion.
|
|
473
|
+
const pulse = app.reducedMotion ? 0 : performance.now() / 1000;
|
|
474
|
+
if (d.offender >= 0) {
|
|
475
|
+
this.marks.ring(0, nodes[d.offender * PLAYER_FLOATS], nodes[d.offender * PLAYER_FLOATS + 1], color, pulse);
|
|
476
|
+
}
|
|
477
|
+
if (d.victim >= 0) {
|
|
478
|
+
this.marks.ring(1, nodes[d.victim * PLAYER_FLOATS], nodes[d.victim * PLAYER_FLOATS + 1], '#ffffff', pulse + 0.5);
|
|
479
|
+
} else {
|
|
480
|
+
this.marks.rings[1].visible = false;
|
|
481
|
+
}
|
|
482
|
+
if (seq.arrow) {
|
|
483
|
+
const f = frozen ? 1 : clamp((tl.t - (seq.replay.C - 8)) / 8, 0, 1);
|
|
484
|
+
const a = seq.arrow;
|
|
485
|
+
this.marks.arrowTo(a.from[0], a.from[1], a.to[0], a.to[1], f, color);
|
|
486
|
+
}
|
|
487
|
+
if (seq.offside) {
|
|
488
|
+
const s = seq.offside;
|
|
489
|
+
if (frozen) {
|
|
490
|
+
this.marks.offside(s.lineX, nodes[d.offender * PLAYER_FLOATS], s.attack, Math.max(0.02, smooth(frozenFor / 0.45)));
|
|
491
|
+
}
|
|
492
|
+
} else if (!frozen) {
|
|
493
|
+
// The camera keeps the two players in the middle of the shot.
|
|
494
|
+
const shot = app.cameras.scripted;
|
|
495
|
+
const m = this.midpoint(seq, pose);
|
|
496
|
+
if (shot && app.cameras.mode === 'scripted') {
|
|
497
|
+
const want = this.replayShot(seq, m);
|
|
498
|
+
shot.pos.copy(want.pos);
|
|
499
|
+
shot.target.copy(want.target);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
// Cards.
|
|
505
|
+
|
|
506
|
+
prepareCard(seq) {
|
|
507
|
+
const app = this.app;
|
|
508
|
+
const d = seq.decision;
|
|
509
|
+
const store = app.timeline.store;
|
|
510
|
+
let f = store.get(seq.T);
|
|
511
|
+
const gone = !(f.playerFlags[d.offender] & 1);
|
|
512
|
+
if (gone) {
|
|
513
|
+
// Sent off at the call, he is shown where the foul was.
|
|
514
|
+
f = store.get(seq.replay.C) || f;
|
|
515
|
+
}
|
|
516
|
+
const o = NODES_FLOAT + d.offender * PLAYER_FLOATS;
|
|
517
|
+
const ox = f.data[o];
|
|
518
|
+
const oy = f.data[o + 1];
|
|
519
|
+
// The referee runs in from the side of play away from the nearest touch line.
|
|
520
|
+
const side = oy > 0 ? -1 : 1;
|
|
521
|
+
const from = [clamp(ox + 3, -HALF_W - 1, HALF_W + 1), clamp(oy + side * 8, -HALF_H - 1, HALF_H + 1)];
|
|
522
|
+
const dx = from[0] - ox;
|
|
523
|
+
const dy = from[1] - oy;
|
|
524
|
+
const dl = Math.hypot(dx, dy) || 1;
|
|
525
|
+
const to = [ox + (dx / dl) * 1.7, oy + (dy / dl) * 1.7];
|
|
526
|
+
// The camera looks across the pair, from the side, at chest height.
|
|
527
|
+
const mx = (ox + to[0]) / 2;
|
|
528
|
+
const my = (oy + to[1]) / 2;
|
|
529
|
+
let px = -dy / dl;
|
|
530
|
+
let py = dx / dl;
|
|
531
|
+
if (py > 0) {
|
|
532
|
+
px = -px;
|
|
533
|
+
py = -py;
|
|
534
|
+
}
|
|
535
|
+
const shot = {
|
|
536
|
+
pos: new THREE.Vector3(mx + px * 6.2, 2.0, -(my + py * 6.2)),
|
|
537
|
+
target: new THREE.Vector3(mx, 1.45, -my),
|
|
538
|
+
fov: 34, rate: 3,
|
|
539
|
+
};
|
|
540
|
+
seq.card = { from, to, ox, oy, shot, gone, heading: headingOf(f.data, NODES_FLOAT + d.offender * PLAYER_FLOATS) };
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
// The referee runs to the offender and raises the card, the offender holds his head.
|
|
544
|
+
dressCard(pose, seq, l, color) {
|
|
545
|
+
const c = seq.card;
|
|
546
|
+
if (!c) {
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
const tr = this.tr;
|
|
550
|
+
const d = seq.decision;
|
|
551
|
+
const u = l - WIPE / 2 + 0.25;
|
|
552
|
+
const run = 1.0;
|
|
553
|
+
tr.refAlong(c.from, c.to, Math.max(0, u), run, c.ox, c.oy, 'card_raise', run - 0.05);
|
|
554
|
+
tr.showReferee(true, u > run + 0.1 ? color : null);
|
|
555
|
+
// The offender turns to the referee and puts his hands on his head.
|
|
556
|
+
const o = d.offender * PLAYER_FLOATS;
|
|
557
|
+
const heading = headingTo(c.to[0] - c.ox, c.to[1] - c.oy);
|
|
558
|
+
const turn = c.gone ? 1 : smooth((u - 0.3) / 0.5);
|
|
559
|
+
if (c.gone) {
|
|
560
|
+
// His frames are off the pitch, so the whole pose is drawn here.
|
|
561
|
+
namedPose('idle', u, heading, c.ox, c.oy, pose.nodes, o);
|
|
562
|
+
}
|
|
563
|
+
if (turn > 0) {
|
|
564
|
+
namedPose('hands_on_head', u - 0.3, heading, c.ox, c.oy, this.tmp, 0);
|
|
565
|
+
for (let i = 2; i < 7; i++) {
|
|
566
|
+
this.tmp[i] = pose.nodes[o + i];
|
|
567
|
+
}
|
|
568
|
+
blendPose(pose.nodes, o, this.tmp, 0, turn, pose.nodes, o);
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
// Graphics.
|
|
573
|
+
|
|
574
|
+
showBanner(d, kind) {
|
|
575
|
+
const who = this.info(d.offender);
|
|
576
|
+
this.banner.style.setProperty('--decision', COLORS[kind === 'second' ? 'red' : d.type] || COLORS.foul);
|
|
577
|
+
this.banner.style.setProperty('--team', who.color);
|
|
578
|
+
this.bannerLabel.textContent = kind === 'second' ? t('decisions.title.second') : TITLES[d.type];
|
|
579
|
+
this.bannerNumber.textContent = who.number;
|
|
580
|
+
this.bannerName.textContent = who.name;
|
|
581
|
+
this.bannerTeam.textContent = d.type === 'offside' ? t('decisions.offside.team', { team: who.teamName }) : who.teamName;
|
|
582
|
+
this.banner.classList.add('show');
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
hideBanner() {
|
|
586
|
+
this.banner.classList.remove('show');
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
showThird(d, kind, frame) {
|
|
590
|
+
const who = this.info(d.offender);
|
|
591
|
+
const minute = frame ? Math.floor(frame.timeMs / 60000) + 1 : 0;
|
|
592
|
+
this.third.classList.remove('yellow', 'red', 'second', 'show');
|
|
593
|
+
this.third.classList.add(kind === 'second' ? 'second' : d.type);
|
|
594
|
+
this.third.style.setProperty('--team', who.color);
|
|
595
|
+
this.thirdBadge.textContent = who.badge;
|
|
596
|
+
this.thirdBadge.style.background = who.color;
|
|
597
|
+
this.thirdBadge.style.color = who.trim;
|
|
598
|
+
this.thirdKind.textContent = kind === 'second' ? t('decisions.third.second') : (d.type === 'red' ? t('decisions.third.red') : t('decisions.third.yellow'));
|
|
599
|
+
this.thirdName.textContent = `${who.number} ${who.name}`;
|
|
600
|
+
this.thirdTeam.textContent = who.teamName;
|
|
601
|
+
this.thirdMinute.textContent = minute ? `${minute}′` : '';
|
|
602
|
+
void this.third.offsetWidth;
|
|
603
|
+
this.third.classList.add('show');
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
hideThird() {
|
|
607
|
+
this.third.classList.remove('show');
|
|
608
|
+
}
|
|
609
|
+
}
|