Download scripts/splat/page.html from CharlieDreemur/Recreate-AAA: direct link, hf CLI and curl.
- Browser
- Download file 2.67 kB
-
https://huggingface.co/CharlieDreemur/Recreate-AAA/resolve/main/scripts/splat/page.html
- Command line
-
hf download hf://CharlieDreemur/Recreate-AAA/scripts/splat/page.html
-
curl -L -o page.html https://huggingface.co/CharlieDreemur/Recreate-AAA/resolve/main/scripts/splat/page.html
2.67 kB
| <meta charset="utf-8"> | |
| <title>Reconstructed place</title> | |
| <style>html, body { margin: 0; height: 100%; background: #000; overflow: hidden } canvas { display: block }</style> | |
| <script type="importmap">{ "imports": { "three": "./lib/three.module.js" } }</script> | |
| <script type="module"> | |
| // The place the recording shows, walked with the recording's own controller. A game is built by adding to | |
| // this scene: see splats.js and controller.js. | |
| import * as THREE from 'three'; | |
| import { loadSplats } from './splats.js'; | |
| import { loadController } from './controller.js'; | |
| import { loadMoving } from './moving.js'; | |
| import { loadActors } from './actors.js'; | |
| import { loadOverlays } from './overlays.js'; | |
| const [splats, player] = await Promise.all([loadSplats(THREE), loadController()]); | |
| const renderer = new THREE.WebGLRenderer({ antialias: false }); | |
| renderer.setPixelRatio(1); renderer.setSize(innerWidth, innerHeight); | |
| const scene = new THREE.Scene(); scene.add(splats); | |
| const moving = await loadMoving(THREE); if (moving) scene.add(moving); // what moved in the recording, as it was filmed | |
| const actors = await loadActors(THREE, player, moving); if (actors) scene.add(actors); // the figures among them that have a body: moved as the recording moved them | |
| const overlays = await loadOverlays(THREE); // what the recording drew on the screen: a HUD, a banner | |
| const AT = new URLSearchParams(location.search).get('t'); // ?t=seconds holds them at one moment (with ?pose=) | |
| const sky = await new THREE.TextureLoader().loadAsync('./sky.jpg').catch(() => null); // the sky as the frames show it, where there is one | |
| if (sky) { sky.mapping = THREE.EquirectangularReflectionMapping; sky.colorSpace = THREE.SRGBColorSpace; scene.background = sky; } | |
| const aspect = innerWidth / innerHeight; | |
| const camera = new THREE.PerspectiveCamera(2 * Math.atan(Math.tan(player.numbers.hfov_deg * Math.PI / 360) / aspect) * 180 / Math.PI, aspect, 0.05, 2000); | |
| document.body.appendChild(renderer.domElement); // only now: the first frame anyone sees has the place in it | |
| let last = null, clock = 0; | |
| function frame(now) { | |
| const dt = last === null ? 0 : Math.min(0.05, (now - last) / 1000); last = now; clock += dt; | |
| player.step(dt); | |
| const seconds = AT !== null ? +AT : clock + (player.numbers.page_lead_frames || 0) / 30; | |
| if (moving) moving.show(seconds); | |
| if (actors) actors.show(seconds, dt, camera); | |
| player.apply(camera); renderer.render(scene, camera); | |
| if (overlays) { overlays.show(seconds); overlays.draw(renderer); } | |
| requestAnimationFrame(frame); | |
| } | |
| requestAnimationFrame(frame); | |
| </script> | |