Download native-eiffel/engine/shell-stub.mjs from peih/matrix-shooter-train: direct link, hf CLI and curl.
- Browser
- Download file 1.58 kB
-
https://huggingface.co/peih/matrix-shooter-train/resolve/main/native-eiffel/engine/shell-stub.mjs
- Command line
-
hf download hf://peih/matrix-shooter-train/native-eiffel/engine/shell-stub.mjs
-
curl -L -o shell-stub.mjs https://huggingface.co/peih/matrix-shooter-train/resolve/main/native-eiffel/engine/shell-stub.mjs
1.58 kB
| // Headless PrototypeShell: everything is the real module except the renderer, | |
| // which records the scene and camera instead of drawing them. | |
| export * from '/assets/user-interface/PrototypeShell.js'; | |
| export function createRenderer(container, { pixelRatio = 1 } = {}) { | |
| const renderer = { | |
| domElement: globalThis.document.createElement('canvas'), | |
| shadowMap: { enabled: false }, | |
| outputColorSpace: 'srgb', | |
| toneMapping: 0, | |
| toneMappingExposure: 1, | |
| clearColor: '#000000', | |
| pixelRatio, | |
| width: globalThis.innerWidth, | |
| height: globalThis.innerHeight, | |
| lastScene: null, | |
| lastCamera: null, | |
| renders: 0, | |
| setPixelRatio(value) { this.pixelRatio = value; }, | |
| setClearColor(color) { this.clearColor = color; }, | |
| setSize(width, height) { this.width = width; this.height = height; }, | |
| // Same matrix updates WebGLRenderer.render() performs before drawing. | |
| render(scene, camera) { | |
| if (scene.matrixWorldAutoUpdate === true) scene.updateMatrixWorld(); | |
| if (camera.parent === null && camera.matrixWorldAutoUpdate === true) camera.updateMatrixWorld(); | |
| this.lastScene = scene; | |
| this.lastCamera = camera; | |
| this.renders++; | |
| }, | |
| }; | |
| globalThis.__headlessRenderer = renderer; | |
| container?.appendChild?.(renderer.domElement); | |
| return renderer; | |
| } | |
| export function installResize(renderer, camera) { | |
| renderer.setSize(globalThis.innerWidth, globalThis.innerHeight); | |
| if (camera.isPerspectiveCamera) { | |
| camera.aspect = globalThis.innerWidth / globalThis.innerHeight; | |
| camera.updateProjectionMatrix(); | |
| } | |
| } | |